:root {
  color-scheme: light;
  --bg: #f6f8fb; --surface: #fff; --text: #151c2a; --muted: #657086;
  --line: #d8e0ec; --accent: #2563eb; --tint: #eef4ff;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
html.theme-dark, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d121c; --surface: #141c29; --text: #eef2f8; --muted: #aab5c8;
  --line: #293449; --accent: #79a7ff; --tint: #202f49;
}
* { box-sizing: border-box }
[hidden] { display: none !important }
body { margin: 0; background: var(--bg); color: var(--text) }
main { max-width: 1000px; margin: auto; padding: max(26px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(64px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left)) }
.books-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px }
.books-nav a { display: inline-flex; align-items: center; min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text); font-size: .92rem; font-weight: 550 }
.books-nav a:hover { border-color: var(--accent); color: var(--accent); background: var(--tint); text-decoration: none }
.books-theme-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--muted); cursor: pointer }
.books-theme-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--tint) }
a { color: var(--accent); text-underline-offset: .18em }
nav a, .book-links a, .book-title { text-decoration: none }
a:hover { text-decoration: underline }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px }
h1 { margin: 16px 0 12px; font-size: clamp(1.7rem, 4vw, 2.15rem); line-height: 1.25; letter-spacing: -.03em }
input, select { max-width: 100%; min-height: 42px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit }
input:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent) }
input { display: block; width: 100% }
.search-label { display: block; margin-bottom: 5px; font-weight: 600 }
.filters { display: flex; align-items: end; gap: 8px 12px; flex-wrap: wrap; margin: 10px 0 }
.filters label { display: inline-flex; align-items: center; gap: 5px; min-width: 0; font-size: .9rem; color: var(--muted) }
.filters select { min-width: 80px }
.summary { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; color: var(--muted); font-size: .9rem }
#book-status { margin: 4px 0 0 }
h2 { font-size: 1.15rem; margin: 24px 0 8px; letter-spacing: -.02em }
article { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 13px 16px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease }
article:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: 0 4px 14px rgba(16, 36, 67, .06); transform: translateY(-1px) }
html.theme-dark article:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, .25) }
.book-info { min-width: 0; overflow-wrap: anywhere }
.book-meta, .book-subject { margin: 0; color: var(--muted); font-size: .84rem }
h3 { margin: 3px 0; line-height: 1.35; font-size: 1rem }
.book-title { color: inherit }
.book-links { display: flex; flex-shrink: 0; flex-wrap: wrap; justify-content: end; align-items: center; gap: 6px 8px; max-width: 42%; font-size: .86rem }
.book-links a { padding: 7px 11px; border-radius: 8px; background: var(--tint); font-weight: 550 }
.book-links a:hover { background: var(--accent); color: #fff; text-decoration: none }
#book-list > p { margin: 20px 0; color: var(--muted) }
@media (prefers-reduced-motion: reduce) {
  article { transition: none }
  article:hover { transform: none }
}
@media (max-width: 650px) {
  main { padding: max(16px, env(safe-area-inset-top)) 14px max(48px, env(safe-area-inset-bottom)) }
  article { flex-direction: column; align-items: start; gap: 8px; padding: 12px 13px }
  .book-links { max-width: 100%; justify-content: start }
  .filters { gap: 6px 10px }
  .filters label { flex-direction: column; align-items: start; gap: 2px }
  .filters select { min-width: 72px; font-size: 1rem }
}

#book-more { display: block; min-height: 44px; margin: 16px auto; padding: 8px 18px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--accent); cursor: pointer; font: inherit }
.book-skeleton { display: grid; gap: 8px; margin-top: 20px }
.book-skeleton i { position: relative; overflow: hidden; display: block; height: 74px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line) }
.book-skeleton i::before { content: ''; position: absolute; left: 16px; top: 20px; width: min(60%,300px); height: 34px; background: linear-gradient(var(--line),var(--line)) top left / 95% 11px no-repeat, linear-gradient(var(--line),var(--line)) bottom left / 65% 8px no-repeat; border-radius: 3px }
.book-skeleton i::after { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg,transparent 35%,color-mix(in srgb,var(--surface) 85%,transparent) 50%,transparent 65%); animation: book-sweep 1.4s ease-in-out infinite }
@keyframes book-sweep { from { transform: translateX(-100%) } to { transform: translateX(100%) } }
@media (prefers-reduced-motion: reduce) { .book-skeleton i::after { animation: none; display: none } }
