:root {
  --bg: #f4f1e9;
  --surface: #fffdf7;
  --surface-2: #efebe0;
  --ink: #26302e;
  --ink-soft: #4c5753;
  --muted: #837f73;
  --line: #e2dccd;
  --accent: #2d6a63;
  --accent-soft: #e1eeeb;
  --shadow: 0 10px 30px rgba(38, 48, 46, .09);
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
}
html[data-theme="dark"] {
  --bg: #10191b;
  --surface: #172326;
  --surface-2: #1d2c2f;
  --ink: #e9e7de;
  --ink-soft: #c3ccc8;
  --muted: #94a29f;
  --line: #2b3b3e;
  --accent: #92cec2;
  --accent-soft: #1d3534;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

#progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: var(--accent); z-index: 50; transition: width .08s linear;
}

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px;
  min-height: 56px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--serif); font-size: 17px; font-weight: 700; letter-spacing: .12em; }
/* 顶栏 logo 的尺寸在 index.html 里以内联属性写死；此处仅作兜底，避免 CSS 缓存导致撑大 */
img.brand-logo {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  display: block;
  width: 90px; height: 40px; max-width: 34vw;
  object-fit: contain;
  border-radius: 7px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .28);
  cursor: default;
}
.topbar .spacer, footer .spacer { flex: 1; }
.topbar nav { display: flex; gap: 4px; }
.link-btn { border: 0; background: transparent; color: var(--ink-soft); padding: 7px 11px; border-radius: 8px; font-size: 13.5px; }
.link-btn:hover { background: var(--surface-2); color: var(--accent); }
.theme-btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); padding: 6px 11px; border-radius: 999px; font-size: 12.5px; white-space: nowrap; }
.theme-btn:hover { border-color: var(--accent); color: var(--accent); }

main { max-width: 900px; margin: 0 auto; padding: 32px 20px 72px; min-height: 60vh; }
.loading, .error-box { padding: 60px 20px; text-align: center; color: var(--muted); font-size: 14px; }
.error-box { color: #a2534d; }

.hero { position: relative; overflow: hidden; border-radius: 16px; box-shadow: var(--shadow); background: var(--surface-2); aspect-ratio: 16 / 9; }
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero::after { content: ""; position: absolute; inset: 40% 0 0 0; background: linear-gradient(to bottom, transparent, rgba(8, 18, 20, .78)); pointer-events: none; }
.hero-text { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 0 30px 26px; color: #fff; }
.hero-text h1 { font-family: var(--serif); font-size: clamp(30px, 6vw, 52px); margin: 0 0 6px; letter-spacing: .18em; text-shadow: 0 2px 16px rgba(0,0,0,.5); }
.hero-text p { margin: 0; font-size: 13px; letter-spacing: .22em; opacity: .88; }

.status-card { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 22px 0 30px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-card .count { font-family: var(--serif); font-size: 19px; font-weight: 700; }
.status-card .hint { color: var(--muted); font-size: 13px; }
.primary-btn { border: 1px solid var(--accent); background: var(--accent); color: #fff; padding: 10px 22px; border-radius: 999px; font-size: 14px; font-weight: 600; }
html[data-theme="dark"] .primary-btn { color: #0d1b1c; }
.primary-btn:hover { opacity: .88; }

.section-head { display: flex; align-items: baseline; gap: 12px; margin: 0 0 14px; }
.section-head h2 { font-family: var(--serif); font-size: 21px; margin: 0; letter-spacing: .08em; }
.section-head span { color: var(--muted); font-size: 12.5px; }
.chapter-list { display: grid; gap: 10px; }
.chapter-row { display: grid; grid-template-columns: 44px 116px 1fr auto; gap: 16px; align-items: center; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; transition: border-color .2s, transform .2s, box-shadow .2s; }
.chapter-row:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.chapter-row .num { font-family: var(--serif); font-size: 24px; color: var(--accent); text-align: center; }
.chapter-row .thumb { width: 116px; height: 65px; object-fit: cover; border-radius: 7px; background: var(--surface-2); display: block; }
.chapter-row .info .t { font-family: var(--serif); font-size: 16.5px; font-weight: 600; }
.chapter-row .info .m { color: var(--muted); font-size: 12px; margin-top: 4px; }
.chapter-row .arrow { color: var(--muted); font-size: 18px; }
.img-missing { display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); text-align: center; }

.reading { max-width: 720px; margin: 0 auto; }
.crumb { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.crumb button { border: 0; background: transparent; color: var(--accent); padding: 4px 0; font-size: 13px; }
.crumb .sep { color: var(--line); }
article h1 { font-family: var(--serif); font-size: clamp(25px, 4.5vw, 34px); letter-spacing: .06em; margin: 0 0 6px; }
.chapter-meta { color: var(--muted); font-size: 12.5px; margin: 0 0 24px; }
figure { margin: 0 0 34px; }
figure img { width: 100%; display: block; border-radius: 12px; background: var(--surface-2); box-shadow: var(--shadow); aspect-ratio: 16 / 9; object-fit: cover; }
figcaption { text-align: center; color: var(--muted); font-size: 12px; margin-top: 10px; letter-spacing: .1em; }
.prose p { font-family: var(--serif); font-size: 18px; line-height: 2.08; text-indent: 2em; margin: 0 0 1.15em; color: var(--ink); }
.prose p.footnote { text-indent: 0; font-size: 14px; line-height: 1.8; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 14px; margin-top: 30px; }
.pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--line); }
.pager button { border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); padding: 11px 16px; border-radius: 10px; font-size: 13.5px; text-align: left; }
.pager button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pager button:disabled { opacity: .42; cursor: default; }
.pager .next { text-align: right; }
.pager .toc { border: 0; background: transparent; text-align: center; color: var(--muted); padding: 10px 8px; }
.to-be-continued { margin-top: 28px; padding: 16px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-family: var(--serif); letter-spacing: .3em; font-size: 14px; }

footer { max-width: 900px; margin: 0 auto; padding: 26px 20px 46px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

@media (max-width: 640px) {
  main { padding: 20px 14px 56px; }
  .topbar { padding: 8px 10px; gap: 6px; min-height: 48px; }
  img.brand-logo { width: 62px !important; height: 28px !important; }
  .theme-btn { font-size: 11px; padding: 5px 8px; }
  .link-btn { padding: 6px 8px; font-size: 12.5px; }
  .hero-text { padding: 0 18px 18px; }
  .chapter-row { grid-template-columns: 34px 82px 1fr; gap: 11px; padding: 10px 12px; }
  .chapter-row .thumb { width: 82px; height: 46px; }
  .chapter-row .num { font-size: 20px; }
  .chapter-row .arrow { display: none; }
  .prose p { font-size: 17px; line-height: 2; }
  .pager { grid-template-columns: 1fr 1fr; }
  .pager .toc { grid-column: 1 / -1; order: 3; }
}
