/* ============================================================
   梦境的音乐 · 电子书站点
   style.css —— 主题、排版、组件
   ============================================================ */

/* ---------- 基础变量 ---------- */
:root {
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  --font-song: "Songti SC", "SimSun", "Source Han Serif SC", "Noto Serif CJK SC",
    "Georgia", "Times New Roman", serif;
  --font-hei: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC",
    "Noto Sans CJK SC", sans-serif;
  --font-kai: "Kaiti SC", "STKaiti", "KaiTi", "Baoli SC", serif;

  --radius: 14px;
  --radius-sm: 9px;
  --topbar-h: 58px;
  --shadow-1: 0 1px 2px rgba(15, 18, 30, .06), 0 6px 18px -8px rgba(15, 18, 30, .22);
  --shadow-2: 0 18px 50px -18px rgba(15, 18, 30, .42);
  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ---------- 主题：日光 ---------- */
[data-theme="light"] {
  --bg: #f6f6f9;
  --bg-grad: radial-gradient(1200px 600px at 12% -8%, #e7e4ff 0%, transparent 60%),
             radial-gradient(900px 500px at 100% 0%, #d9f4f1 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #f2f2f6;
  --surface-3: #e9e9f0;
  --text: #1b1d26;
  --text-dim: #545969;
  --text-mute: #8b90a2;
  --line: #e3e4ec;
  --line-soft: #eeeeF4;
  --accent: #6d5efc;
  --accent-2: #00b3a4;
  --accent-ink: #ffffff;
  --paper: #ffffff;
  --paper-edge: #eceef4;
  --mark: #ffe58a;
  --stage-bg: #f0efff;
  --stage-ink: #5b53b8;
  --dlg-bg: #f7f7fb;
}

/* ---------- 主题：夜读 ---------- */
[data-theme="dark"] {
  --bg: #14161d;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, #262046 0%, transparent 60%),
             radial-gradient(900px 500px at 100% 0%, #10312f 0%, transparent 55%);
  --surface: #1c1f28;
  --surface-2: #232733;
  --surface-3: #2c313f;
  --text: #e6e8f0;
  --text-dim: #a6abbd;
  --text-mute: #747a8d;
  --line: #2e3341;
  --line-soft: #262b37;
  --accent: #9c8dff;
  --accent-2: #43d9c6;
  --accent-ink: #14161d;
  --paper: #1a1d25;
  --paper-edge: #262b37;
  --mark: #6b5a1c;
  --stage-bg: #23283a;
  --stage-ink: #a6a0f0;
  --dlg-bg: #212531;
}

/* ---------- 主题：纸黄 ---------- */
[data-theme="sepia"] {
  --bg: #ece0c8;
  --bg-grad: radial-gradient(1100px 600px at 10% -10%, #f3e6cb 0%, transparent 60%),
             radial-gradient(900px 500px at 100% 0%, #e3d3b4 0%, transparent 55%);
  --surface: #f6ecd8;
  --surface-2: #efe3cb;
  --surface-3: #e5d7ba;
  --text: #3a3021;
  --text-dim: #6b5c45;
  --text-mute: #94836a;
  --line: #ddd0b4;
  --line-soft: #e8dcc4;
  --accent: #a2661f;
  --accent-2: #6f8b3a;
  --accent-ink: #fdf8ee;
  --paper: #f8f0dd;
  --paper-edge: #e6d8ba;
  --mark: #f2d98b;
  --stage-bg: #efe0c4;
  --stage-ink: #8a6a2f;
  --dlg-bg: #f3e9d4;
}

/* ---------- 主题：护眼绿 ---------- */
[data-theme="green"] {
  --bg: #dbe7dc;
  --bg-grad: radial-gradient(1100px 600px at 10% -10%, #e2eede 0%, transparent 60%),
             radial-gradient(900px 500px at 100% 0%, #cfe0d3 0%, transparent 55%);
  --surface: #e6efe4;
  --surface-2: #dde9db;
  --surface-3: #cfdecb;
  --text: #23301f;
  --text-dim: #526049;
  --text-mute: #7d8b74;
  --line: #c8d8c6;
  --line-soft: #d6e3d3;
  --accent: #3d7a4a;
  --accent-2: #8a7a2e;
  --accent-ink: #f4faf1;
  --paper: #eaf2e7;
  --paper-edge: #d3e1d0;
  --mark: #e6dd94;
  --stage-bg: #dbe8d7;
  --stage-ink: #47704a;
  --dlg-bg: #e1ecde;
}

/* ---------- 主题：灰 ---------- */
[data-theme="gray"] {
  --bg: #212227;
  --bg-grad: none;
  --surface: #2a2b31;
  --surface-2: #31333a;
  --surface-3: #3a3c45;
  --text: #cfd1d8;
  --text-dim: #9ba0ac;
  --text-mute: #767b88;
  --line: #3a3c45;
  --line-soft: #32343c;
  --accent: #b9bcc6;
  --accent-2: #8fa0b5;
  --accent-ink: #212227;
  --paper: #26272d;
  --paper-edge: #34363e;
  --mark: #55584f;
  --stage-bg: #303239;
  --stage-ink: #a9b0bd;
  --dlg-bg: #2d2f36;
}

/* ---------- 复位 ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.6;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; }
::selection { background: var(--mark); color: var(--text); }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round;
}
.ic-sun { display: none; }
[data-theme="dark"] .ic-sun, [data-theme="gray"] .ic-sun { display: block; }
[data-theme="dark"] .ic-moon, [data-theme="gray"] .ic-moon { display: none; }
.ic-fs-off { display: none; }
body.is-full .ic-fs-on { display: none; }
body.is-full .ic-fs-off { display: block; }

/* ============================================================
   顶栏
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 clamp(12px, 3vw, 28px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; overflow: hidden; }
.brand-mark {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  border-radius: 10px; color: #fff; font-size: 17px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: var(--shadow-1);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; overflow: hidden; }
.brand-text b { font-size: 15px; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text i { font-size: 11px; color: var(--text-mute); font-style: normal; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topnav { display: flex; gap: 4px; margin-left: auto; flex: none; }
.topnav a {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 10px;
  font-size: 14px; color: var(--text-dim);
  transition: background .18s var(--ease), color .18s var(--ease);
}
.topnav a .ic { width: 17px; height: 17px; }
.topnav a:hover { background: var(--surface-2); color: var(--text); }
.topnav a.active { background: var(--surface-2); color: var(--accent); font-weight: 600; }
.topactions { display: flex; gap: 6px; }
.iconbtn {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; color: var(--text-dim);
  transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn:active { transform: scale(.94); }
.iconbtn.on { color: var(--accent); background: var(--surface-2); }

@media (max-width: 720px) {
  :root { --topbar-h: 54px; }
  .topbar { gap: 8px; padding: 0 10px; }
  .brand { gap: 8px; }
  .brand-text i { display: none; }
  .brand-text b { font-size: 14px; letter-spacing: 0; }
  .brand-mark { width: 30px; height: 30px; border-radius: 9px; font-size: 15px; }
  .topnav { gap: 2px; }
  .topnav a span { display: none; }
  .topnav a { padding: 8px 7px; }
  .topactions { gap: 0; }
  .iconbtn { width: 34px; height: 34px; }
}

/* ============================================================
   主视图
   ============================================================ */
.view { display: block; min-height: calc(100vh - var(--topbar-h) - 60px); outline: none; }
.wrap { max-width: 1180px; margin: 0 auto; padding: clamp(20px, 4vw, 44px) clamp(14px, 3.5vw, 32px) 60px; }
.wrap-narrow { max-width: 860px; }

.page-head { margin-bottom: 26px; }
.page-head h1 {
  font-size: clamp(24px, 3.4vw, 34px); letter-spacing: .02em; line-height: 1.25;
}
.page-head p { color: var(--text-dim); margin-top: 8px; font-size: 14.5px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin-bottom: 10px;
}

/* ---------- 继续阅读横幅 ---------- */
.resume {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 18px; margin-bottom: 28px;
  border-radius: var(--radius);
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), var(--surface));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}
.resume .r-ico {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  border-radius: 12px; background: var(--accent); color: var(--accent-ink);
}
.resume .r-ico .ic { width: 22px; height: 22px; }
.resume .r-meta { flex: 1; min-width: 0; }
.resume .r-meta b { display: block; font-size: 15px; }
.resume .r-meta small { color: var(--text-dim); font-size: 12.5px; }
.resume .r-bar { height: 4px; border-radius: 99px; background: var(--surface-3); margin-top: 7px; overflow: hidden; }
.resume .r-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 11px; font-size: 14px; font-weight: 600;
  background: var(--accent); color: var(--accent-ink);
  transition: transform .16s var(--ease), filter .16s var(--ease);
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn .ic { width: 17px; height: 17px; }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-line { background: transparent; border: 1px solid var(--line); color: var(--text); }

/* ---------- 书架 ---------- */
.shelf {
  display: grid; gap: clamp(16px, 2.4vw, 24px);
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.bookcard {
  position: relative; display: flex; flex-direction: column;
  border-radius: var(--radius); overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s var(--ease);
}
.bookcard:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.cover {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 16px 18px; color: #fff;
}
.cover::after {
  content: ""; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(115deg, rgba(255,255,255,.09) 0 1px, transparent 1px 13px);
  mix-blend-mode: overlay;
}
.cover .c-glyph {
  position: absolute; right: -6px; bottom: -28px;
  font-size: 118px; line-height: 1; opacity: .22; font-weight: 700;
}
.cover .c-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; position: relative; z-index: 1; }
.cover .c-badge {
  font-size: 11px; padding: 3px 9px; border-radius: 99px;
  background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.34);
  backdrop-filter: blur(4px); white-space: nowrap;
}
.cover .c-title { position: relative; z-index: 1; }
.cover .c-title b { display: block; font-size: 21px; letter-spacing: .03em; line-height: 1.25; }
.cover .c-title small { font-size: 12px; opacity: .82; }
.cardbody { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.cardbody p { font-size: 13.5px; color: var(--text-dim); line-height: 1.66;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.meta-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 11.5px; padding: 3px 9px; border-radius: 99px;
  background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--line-soft);
}
.stats { display: flex; gap: 14px; font-size: 12px; color: var(--text-mute); flex-wrap: wrap; }
.stats b { color: var(--text-dim); font-weight: 600; }
.cardfoot { margin-top: auto; display: flex; gap: 8px; align-items: center; }
.cardfoot .btn { flex: 1; justify-content: center; padding: 9px 12px; }
.progress-line { height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress-line i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ---------- 书籍详情 ---------- */
.bookhero {
  display: grid; grid-template-columns: 260px 1fr; gap: clamp(18px, 3vw, 36px);
  align-items: start; margin-bottom: 34px;
}
.bookhero .cover { border-radius: var(--radius); aspect-ratio: 3 / 4; box-shadow: var(--shadow-2); }
.bookhero .cover .c-glyph { font-size: 190px; bottom: -50px; }
.bookhero h1 { font-size: clamp(26px, 3.6vw, 38px); line-height: 1.2; letter-spacing: .02em; }
.bookhero .sub { color: var(--text-dim); margin-top: 6px; font-size: 15px; }
.bookhero .byline { color: var(--text-mute); font-size: 13px; margin-top: 10px; }
.bookhero .summary { margin-top: 16px; font-size: 15px; line-height: 1.85; color: var(--text-dim); }
.bookhero .actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
@media (max-width: 760px) {
  .bookhero { grid-template-columns: 1fr; }
  .bookhero .cover { max-width: 260px; aspect-ratio: 16/10; }
  .bookhero .cover .c-glyph { font-size: 130px; }
}

/* ---------- 目录列表 ---------- */
.volume { margin-bottom: 26px; }
.volume-head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px solid var(--line);
}
.volume-head h3 { font-size: 16px; letter-spacing: .04em; }
.volume-head small { color: var(--text-mute); font-size: 12.5px; }
.volume-head .count { margin-left: auto; font-size: 12px; color: var(--text-mute); }
.chap-list { display: flex; flex-direction: column; }
.chap {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.chap:hover { background: var(--surface-2); border-color: var(--line-soft); }
.chap .n {
  width: 26px; height: 26px; flex: none; border-radius: 8px;
  display: grid; place-items: center; font-size: 12px;
  background: var(--surface-2); color: var(--text-mute); font-variant-numeric: tabular-nums;
}
.chap .t { flex: 1; min-width: 0; font-size: 14.6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chap .w { font-size: 11.5px; color: var(--text-mute); white-space: nowrap; }
.chap.done .t { color: var(--text-mute); }
.chap.done .n { background: color-mix(in srgb, var(--accent) 18%, var(--surface-2)); color: var(--accent); }
.chap.cur { background: var(--surface-2); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.chap.cur .t { font-weight: 700; color: var(--text); }
.chap .dot-read { width: 6px; height: 6px; border-radius: 99px; background: var(--accent); flex: none; opacity: 0; }
.chap.done .dot-read { opacity: 1; }

/* ============================================================
   阅读器
   ============================================================ */
.reader {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  background: var(--paper);
}
.reader[hidden] { display: none; }
.read-progress {
  position: absolute; top: 0; left: 0; right: 0; height: 3px; z-index: 5;
  background: transparent; pointer-events: none;
}
.read-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.read-bar {
  flex: none; display: flex; align-items: center; gap: 2px;
  height: 52px; padding: 0 clamp(6px, 2vw, 16px);
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  transition: transform .28s var(--ease), opacity .22s var(--ease);
}
.read-bar .iconbtn { width: 36px; height: 36px; }
.read-title {
  flex: 1; min-width: 0; text-align: center;
  font-size: 13.5px; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 0 8px;
}
.read-title b { color: var(--text); font-weight: 600; }
.read-title i { font-style: normal; opacity: .5; margin: 0 6px; }

.read-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
body.hide-chrome .read-bar { transform: translateY(-100%); opacity: 0; pointer-events: none; }
body.hide-chrome .read-foot { transform: translateY(100%); opacity: 0; pointer-events: none; }
.read-foot {
  flex: none; display: flex; align-items: center; gap: 10px;
  height: 56px; padding: 0 clamp(10px, 2.4vw, 20px);
  border-top: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  transition: transform .28s var(--ease), opacity .22s var(--ease);
}
.navbtn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: 10px; font-size: 13.5px; color: var(--text-dim);
  transition: background .16s var(--ease), color .16s var(--ease);
}
.navbtn:hover { background: var(--surface-2); color: var(--text); }
.navbtn[disabled] { opacity: .32; pointer-events: none; }
.navbtn-mid { margin: 0 auto; font-variant-numeric: tabular-nums; color: var(--text-mute); }

.paged-viewport { height: 100%; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; }
.mode-page .paged-viewport { overflow: hidden; }

.read-body {
  --fs: 19px; --lh: 1.95; --ff: var(--font-song); --pw: 760px; --gap: 64px;
  max-width: var(--pw);
  margin: 0 auto;
  padding: clamp(24px, 5vh, 56px) clamp(18px, 5vw, 40px) 90px;
  font-family: var(--ff);
  font-size: var(--fs);
  line-height: var(--lh);
  color: var(--text);
  text-align: justify;
  hanging-punctuation: allow-end;
}
body.wide .read-body { max-width: none; }

.read-body .doc-title,
.read-body .md-h1 { font-size: 1.5em; line-height: 1.35; margin: .2em 0 1.1em; letter-spacing: .02em; text-align: left; }
.read-body .md-h2 { font-size: 1.22em; margin: 1.9em 0 .7em; text-align: left; }
.read-body .md-h3 { font-size: 1.06em; margin: 1.6em 0 .5em; text-align: left; color: var(--text-dim); }
.read-body p { margin: 0 0 .95em; }
body.indent .read-body > p,
body.indent .read-body .table-wrap ~ p { text-indent: 2em; }
.read-body strong { font-weight: 700; }
.read-body em { font-style: normal; color: var(--text-dim); }
.read-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.read-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .84em; padding: .1em .38em; border-radius: 5px;
  background: var(--surface-2); color: var(--text-dim);
}
.read-body hr.rule { border: 0; height: 1px; background: var(--line); margin: 2.2em auto; width: 42%; }
.read-body ul, .read-body ol { margin: 0 0 1.1em; padding-left: 1.6em; }
.read-body li { margin: .3em 0; }
.read-body pre.code {
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 12px 14px; overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8em; line-height: 1.6; text-align: left; text-indent: 0;
  margin: 0 0 1.2em;
}
.read-body blockquote.note {
  margin: 0 0 1.3em; padding: 12px 16px;
  border-left: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-dim); font-size: .93em;
}
.read-body blockquote.note p { margin: 0 0 .5em; }
.read-body blockquote.note p:last-child { margin: 0; }

/* 表格 */
.read-body .table-wrap { overflow-x: auto; margin: 0 0 1.3em; }
.read-body table { border-collapse: collapse; width: 100%; font-size: .84em; line-height: 1.6; }
.read-body th, .read-body td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.read-body th { background: var(--surface-2); font-weight: 600; white-space: nowrap; }
.read-body tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }

/* 剧本：场景标题 */
.read-body .scene {
  display: flex; align-items: center; gap: 14px;
  margin: 2.6em 0 1.3em; font-size: 1.02em; letter-spacing: .12em;
  color: var(--text-dim); font-weight: 600; text-align: left;
}
.read-body .scene::before { content: ""; width: 3px; height: 1.05em; border-radius: 2px; background: var(--accent); flex: none; }
.read-body .scene::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }
.read-body .scene:first-child { margin-top: .6em; }

/* 剧本：对白 */
.read-body .dialog {
  display: flex; gap: .7em; align-items: flex-start;
  margin: 0 0 .7em; text-indent: 0; text-align: left;
  padding: .18em .55em .18em 0;
}
.read-body .dialog .speaker {
  flex: none; font-size: .86em; font-weight: 700; letter-spacing: .04em;
  color: var(--accent); padding-top: .28em; min-width: 4.6em;
}
.read-body .dialog .say { flex: 1; min-width: 0; }
.read-body .dialog .aside { color: var(--text-mute); font-size: .9em; }
body.stage-dialog .read-body .dialog {
  background: var(--dlg-bg); border-radius: var(--radius-sm); padding: .5em .9em;
}
body.stage-dialog .read-body .dialog .speaker { padding-top: .35em; }

/* 剧本：舞台指示 */
.read-body .stage {
  color: var(--text-mute); font-size: .92em; text-indent: 0;
  margin: 0 0 .9em; padding-left: 1.1em; border-left: 2px solid var(--line-soft);
  text-align: left;
}

/* 剧本：场景信息卡 */
.read-body .stage-card {
  background: var(--stage-bg); border: 1px solid color-mix(in srgb, var(--stage-ink) 22%, transparent);
  border-radius: var(--radius-sm); padding: 10px 14px; margin: 0 0 1.6em;
  text-indent: 0; text-align: left;
}
.read-body .stage-card dl { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; font-size: .8em; }
.read-body .stage-card dt { color: var(--stage-ink); opacity: .8; margin-right: 5px; }
.read-body .stage-card dd { margin: 0; color: var(--text-dim); }
.read-body .stage-card dt, .read-body .stage-card dd { display: inline; }

/* 剧本：分支选项 / 变量 */
.read-body .choice-card {
  border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border-radius: var(--radius-sm); padding: 12px 16px; margin: 0 0 1.5em;
  text-indent: 0; text-align: left;
}
.read-body .card-title {
  display: block; font-size: .74em; letter-spacing: .18em; font-weight: 700;
  color: var(--accent); margin-bottom: 8px; text-transform: uppercase;
}
.read-body .choice-card ol { list-style: none; padding: 0; margin: 0; font-size: .9em; }
.read-body .choice-card li { display: flex; gap: 12px; align-items: baseline; padding: .3em 0; border-top: 1px dashed var(--line-soft); }
.read-body .choice-card li:first-child { border-top: 0; }
.read-body .choice-card .choice-text { flex: 1; font-weight: 600; }
.read-body .choice-card .choice-meta {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .78em; color: var(--text-mute); white-space: nowrap;
}
.read-body .set-card {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  font-size: .8em; color: var(--text-dim); margin: 0 0 1.5em;
  padding: 8px 14px; border-radius: var(--radius-sm); background: var(--surface-2);
  text-indent: 0; text-align: left;
}
.read-body .set-card b { color: var(--accent); }

/* 章节尾 */
.chap-end { margin-top: 4em; padding-top: 22px; border-top: 1px solid var(--line-soft); text-align: center; }
.chap-end .ce-mark { color: var(--text-mute); letter-spacing: .5em; font-size: .8em; }
.chap-end .ce-nav { display: flex; gap: 12px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.chap-end .ce-nav a {
  padding: 11px 20px; border-radius: 11px; border: 1px solid var(--line);
  font-size: 14px; display: inline-flex; align-items: center; gap: 8px;
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.chap-end .ce-nav a:hover { background: var(--surface-2); border-color: var(--accent); }

/* 翻页模式 */
.mode-page .paged-viewport { padding: clamp(18px, 4vh, 52px) clamp(16px, 5vw, 72px); }
.mode-page .read-body {
  height: 100%; max-width: none; margin: 0;
  padding: 0;
  column-width: var(--page-w, 720px);
  column-gap: var(--page-gap, 64px);
  column-fill: auto;
  will-change: transform;
}
.mode-page .read-body > * { break-inside: avoid-column; }
.mode-page .read-body .dialog,
.mode-page .read-body .stage,
.mode-page .read-body p { break-inside: auto; orphans: 2; widows: 2; }
.paged-viewport { position: relative; }

/* 回到顶部 */
.to-top {
  position: absolute; right: 20px; bottom: 76px; z-index: 4;
  width: 42px; height: 42px; border-radius: 99px;
  display: grid; place-items: center;
  background: var(--surface); color: var(--text-dim);
  border: 1px solid var(--line); box-shadow: var(--shadow-1);
  opacity: 0; pointer-events: none;
  transition: opacity .22s var(--ease), transform .22s var(--ease);
}
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top:hover { transform: translateY(-3px); }

/* ============================================================
   抽屉 / 设置
   ============================================================ */
.scrim {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(10, 12, 20, .44);
  backdrop-filter: blur(2px);
  animation: fade .2s var(--ease);
}
.scrim[hidden] { display: none; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.drawer {
  position: fixed; top: 0; bottom: 0; z-index: 80;
  width: min(400px, 88vw);
  display: flex; flex-direction: column;
  background: var(--surface);
  box-shadow: var(--shadow-2);
  transition: transform .3s var(--ease);
}
.drawer[hidden] { display: none; }
.drawer-left { left: 0; transform: translateX(-102%); border-right: 1px solid var(--line); }
.drawer-right { right: 0; transform: translateX(102%); border-left: 1px solid var(--line); }
.drawer.open { transform: none; }
.drawer-head {
  flex: none; display: flex; align-items: center; gap: 12px;
  padding: 14px 14px 14px 18px; border-bottom: 1px solid var(--line);
}
.drawer-head b { display: block; font-size: 15px; }
.drawer-head small { color: var(--text-mute); font-size: 12px; }
.drawer-head .iconbtn { margin-left: auto; }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 12px 40px; overscroll-behavior: contain; }

/* 设置组 */
.set-group { margin-bottom: 22px; }
.set-group > h4 {
  font-size: 12px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--text-mute); margin: 0 6px 10px; font-weight: 700;
}
.set-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
}
.set-row + .set-row { margin-top: 2px; }
.set-row > label { font-size: 14px; color: var(--text-dim); min-width: 58px; }
.set-row .grow { flex: 1; display: flex; gap: 6px; flex-wrap: wrap; }
.seg { display: flex; gap: 5px; flex-wrap: wrap; }
.seg button {
  padding: 7px 13px; border-radius: 9px; font-size: 13px;
  background: var(--surface-2); color: var(--text-dim);
  border: 1px solid transparent;
  transition: background .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button.on { background: color-mix(in srgb, var(--accent) 16%, var(--surface-2)); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 42%, transparent); font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: 9px; padding: 3px; }
.stepper button { width: 30px; height: 28px; border-radius: 7px; font-size: 16px; color: var(--text-dim); display: grid; place-items: center; }
.stepper button:hover { background: var(--surface-3); color: var(--text); }
.stepper span { min-width: 52px; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text); }
.switch { position: relative; width: 44px; height: 25px; border-radius: 99px; background: var(--surface-3); transition: background .2s var(--ease); flex: none; }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px;
  border-radius: 99px; background: var(--surface); box-shadow: var(--shadow-1);
  transition: transform .2s var(--ease);
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(19px); }
.themepick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 2px; }
.themepick button {
  aspect-ratio: 1; border-radius: 10px; border: 2px solid transparent;
  display: grid; place-items: center; font-size: 11px; color: #fff;
  position: relative; overflow: hidden;
}
.themepick button.on { border-color: var(--accent); }
.themepick button span { position: relative; z-index: 1; mix-blend-mode: difference; font-weight: 700; }
.kbd-hint { font-size: 12px; color: var(--text-mute); line-height: 1.9; padding: 0 6px; }
.kbd-hint kbd {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px;
  padding: 1px 6px; border-radius: 5px; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--text-dim);
}

/* 抽屉内目录 */
.toc-vol { margin-bottom: 14px; }
.toc-vol > h5 {
  font-size: 12px; letter-spacing: .12em; color: var(--text-mute);
  margin: 0 8px 6px; font-weight: 700;
}
.toc-vol .chap { padding: 9px 10px; }

/* ============================================================
   搜索
   ============================================================ */
.searchbox {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}
.searchbox .ic { color: var(--text-mute); }
.searchbox input {
  flex: 1; border: 0; background: none; outline: none;
  font: inherit; font-size: 16px; color: var(--text); min-width: 0;
}
.searchbox input::placeholder { color: var(--text-mute); }
.searchbox kbd {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px;
  padding: 3px 7px; border-radius: 6px; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--text-mute);
}
.search-filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 20px; }
.search-filters button {
  padding: 7px 14px; border-radius: 99px; font-size: 13px;
  background: var(--surface-2); color: var(--text-dim); border: 1px solid transparent;
}
.search-filters button.on { background: color-mix(in srgb, var(--accent) 16%, var(--surface-2)); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); font-weight: 600; }
.hit {
  display: block; padding: 15px 17px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  margin-bottom: 12px; transition: border-color .16s var(--ease), transform .16s var(--ease);
}
.hit:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-2px); }
.hit .h-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hit .h-book { font-size: 11.5px; color: var(--accent); font-weight: 700; letter-spacing: .06em; }
.hit .h-title { font-size: 15.5px; font-weight: 600; }
.hit .h-n { margin-left: auto; font-size: 11.5px; color: var(--text-mute); }
.hit .h-snips { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.hit .snip { font-size: 13.5px; color: var(--text-dim); line-height: 1.75; }
.hit mark { background: var(--mark); color: var(--text); border-radius: 3px; padding: 0 2px; }
.empty { text-align: center; padding: 60px 20px; color: var(--text-mute); }
.empty .big { font-size: 42px; opacity: .35; display: block; margin-bottom: 14px; }

/* 书签列表 */
.marks-grid { display: flex; flex-direction: column; gap: 12px; }
.markcard {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 15px 17px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.markcard .mc-main { flex: 1; min-width: 0; }
.markcard .mc-book { font-size: 11.5px; color: var(--accent); font-weight: 700; letter-spacing: .05em; }
.markcard .mc-title { font-size: 15px; font-weight: 600; margin-top: 2px; }
.markcard .mc-text { font-size: 13.5px; color: var(--text-dim); margin-top: 6px; line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.markcard .mc-time { font-size: 11.5px; color: var(--text-mute); margin-top: 6px; }

/* 关于页 */
.about p { font-size: 15px; line-height: 1.95; color: var(--text-dim); margin-bottom: 1em; }
.about h2 { font-size: 18px; margin: 2em 0 .8em; letter-spacing: .04em; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 20px 0; }
.fact { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); }
.fact b { display: block; font-size: 21px; font-variant-numeric: tabular-nums; }
.fact small { color: var(--text-mute); font-size: 12px; }
.kv-list { display: grid; gap: 10px; }
.kv-list div { display: flex; gap: 12px; font-size: 14px; }
.kv-list dt { color: var(--text-mute); min-width: 76px; }
.kv-list dd { color: var(--text-dim); }

/* 页脚 */
.sitefoot {
  display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 26px 16px 34px; font-size: 12.5px; color: var(--text-mute);
  border-top: 1px solid var(--line-soft);
}
.sitefoot .dot { opacity: .5; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 78px; transform: translateX(-50%) translateY(12px);
  z-index: 120; padding: 11px 20px; border-radius: 99px;
  background: var(--text); color: var(--bg); font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-2); opacity: 0; pointer-events: none;
  transition: opacity .22s var(--ease), transform .22s var(--ease);
  max-width: 82vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast[hidden] { display: none; }

/* 打印 */
@media print {
  .topbar, .sitefoot, .read-bar, .read-foot, .to-top, .drawer, .scrim, .toast { display: none !important; }
  .reader { position: static; }
  body { background: #fff; }
}

/* 移动端微调 */
@media (max-width: 560px) {
  .read-body { padding: 20px 18px 80px; }
  .read-body .dialog { flex-direction: column; gap: 0; }
  .read-body .dialog .speaker { min-width: 0; padding-top: 0; }
  .read-title { font-size: 12.5px; }
  .navbtn span { display: none; }
  .navbtn { padding: 9px 12px; }
  .bookhero .cover { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
