/* ============================================================
 * 素笺主题 — 图书馆富阅读器样式（port 自 candy library-detail.css）
 * ============================================================
 * 设计：对齐 candy 三栏图书馆阅读器（左 TOC+标注+书签 / 主 工具栏+四模式 / 右 搜索·关联·评论）。
 * 令牌：全部走 sujian --token + candy 兼容桥（theme-vars.css §138 已建 --gold/--font-size-* 等）。
 * 适配（与本仓库差异）：
 *   1) 全宽解除：sujian 外壳是 .sj-three-col(grid) / .sj-sidebar-left / .sj-sidebar-right / .sj-main，
 *      故隐藏左栏+右栏、令中主体铺满（candy 旧解除 .container/.page-layout-wrapper 在 sujian 不存在）。
 *   2) sticky top：sujian 导航在左竖栏（无桌面顶栏），故 toc/progress 取 top:0。
 *   3) 阅读主题调色板（护眼/米黄/夜间）引用的 --hx-* 在 sujian 兼容桥未定义，此处统一补齐，
 *      保证四套阅读主题在 sujian 下全部生效（守禁五：仅补桥、不改 candy 语义）。
 * 弹窗：统一用 .show 控制 display（不用 .hidden）。
 */

/* ===== 0.5 阅读主题调色板桥（sujian 兼容桥缺失的 --hx-* 字面量） ===== */
/* 仅补充 candy 阅读主题四套配色所需、且 sujian 未定义的 --hx-*；其余 --gold/--bg/--ink 等主值由兼容桥接管。
   作用域限本页（library-reader.css 只随 library 类型加载），不影响其它页面。 */
body.page-library-detail {
  --hx-94763e: var(--gold-hover, #94763e);   /* 标注保存钮 hover（candy 主值，无回退） */
  --hx-c8a96a: var(--gold-hover, #c8a96a);    /* 进度条渐变尾色（candy 主值，无回退） */
  /* 护眼 eye */
  --hx-e7f0e1: #e7f0e1; --hx-2e3a2a: #2e3a2a; --hx-dcebd3: #dcebd3; --hx-d2e3c8: #d2e3c8;
  --hx-9aab90: #9aab90; --hx-5b6b54: #5b6b54; --hx-8a7b3f: #8a7b3f;
  /* 米黄 paper */
  --hx-f6eeda: #f6eeda; --hx-4a3f2c: #4a3f2c; --hx-efe2c8: #efe2c8; --hx-e8d8ba: #e8d8ba;
  --hx-b9a986: #b9a986; --hx-8a7a5f: #8a7a5f; --hx-9c7b3f: #9c7b3f;
  /* 夜间 night */
  --hx-1c1c1e: #1c1c1e; --hx-c9c5bd: #c9c5bd; --hx-26262a: #26262a; --hx-2c2c30: #2c2c30;
  --hx-5f5d59: #5f5d59; --hx-8d8a84: #8d8a84; --hx-c9a24a: #c9a24a;
}

/* ===== 0. 全局：解除 sujian 三栏外壳对阅读器的宽度限制（全宽） ===== */
/* sujian 外壳：.sj-three-col(grid 左|中|右) / .sj-sidebar-left / .sj-sidebar-right / .sj-main。
   阅读器自包含三栏（.reader-wrap），故隐藏 sujian 左/右栏，令中主体铺满。 */
body.page-library-detail .sj-three-col {
  grid-template-columns: 0 minmax(0, 1fr) 0 !important;
  max-width: 100% !important;
  width: 100% !important;
}
body.page-library-detail .sj-sidebar-left,
body.page-library-detail .sj-sidebar-right {
  display: none !important;
}
body.page-library-detail .sj-main {
  padding: 0 !important;        /* 阅读器内部自带 48px 内边距 */
  max-width: 100% !important;
  width: 100% !important;
}

/* 阅读器自带全宽工具栏/底部栏，隐藏 sujian 通用浮动操作（若存在，避免遮挡正文） */
body.page-library-detail .float-actions,
body.page-library-detail .mobile-actions {
  display: none !important;
}

/* ===== 1. 阅读器主布局（flex 三栏） ===== */
.reader-wrap {
  display: flex;
  min-height: calc(100vh - 112px);
  position: relative;
}

/* --- 左侧目录 (220px) --- */
.toc-sidebar {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--line, rgba(28,27,25,.09));
  background: var(--bg, var(--hx-ffffff));
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
  padding: 16px 0;
  z-index: 1;
}
.toc-head {
  padding: 0 16px 12px;
  border-bottom: 1px solid var(--line, rgba(28,27,25,.09));
  margin-bottom: 8px;
}
.toc-sn { font-size: var(--fs-xs2); color: var(--faint, var(--hx-b7b2a8)); margin-bottom: 2px; }
.toc-book {
  font-family: var(--serif, "Noto Serif SC","Songti SC","SimSun",serif);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: 1.4;
  color: var(--ink, var(--hx-1c1b19));
}
.toc-chapter {
  display: block;
  padding: 8px 16px;
  font-size: var(--fs-sm);
  color: var(--muted, var(--hx-8c887f));
  text-decoration: none;
  transition: all .25s cubic-bezier(.2,.8,.2,1);
  border-left: 3px solid transparent;
  line-height: 1.5;
}
.toc-chapter:hover {
  background: var(--bg-soft, var(--hx-f7f6f3));
  color: var(--ink, var(--hx-1c1b19));
}
.toc-chapter.active {
  color: var(--ink, var(--hx-1c1b19));
  font-weight: var(--fw-medium);
  border-left-color: var(--gold, var(--hx-a9854a));
  background: rgba(169,133,74,.12);
}
.toc-empty {
  padding: 12px 16px;
  font-size: var(--font-size-xs);
  color: var(--faint, var(--hx-b7b2a8));
  font-style: italic;
}

/* --- 主内容区 --- */
.reader-main {
  flex: 1;
  min-width: 0;
  background: var(--bg, var(--hx-ffffff));
  display: flex;
  flex-direction: column;
}

/* 阅读工具栏（模式切换 / 字体 / 搜索） */
.reader-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 48px;
  border-bottom: 1px solid var(--line, rgba(28,27,25,.09));
  flex-wrap: wrap;
}
.rt-modes { display: flex; gap: 6px; }
.rt-mode {
  border: 1px solid var(--line, rgba(28,27,25,.14));
  background: var(--bg-soft, var(--hx-f6f3ee));
  color: var(--muted, var(--hx-6b6254));
  font-size: var(--fs-sm);
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}
.rt-mode:hover { color: var(--ink, var(--hx-1c1b19)); border-color: var(--gold, var(--hx-a9854a)); }
.rt-mode.active {
  background: var(--ink, var(--hx-1c1b19));
  color: var(--hx-ffffff);
  border-color: var(--ink, var(--hx-1c1b19));
}
.rt-tools { display: flex; align-items: center; gap: 6px; }
.rt-tool {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line, rgba(28,27,25,.14));
  background: var(--bg-soft, var(--hx-f6f3ee));
  color: var(--muted, var(--hx-6b6254));
  border-radius: var(--radius-2);
  cursor: pointer;
  font-size: var(--fs-sm);
  line-height: 1;
  transition: color .15s, border-color .15s, background .15s;
}
.rt-tool:hover { color: var(--ink, var(--hx-1c1b19)); border-color: var(--gold, var(--hx-a9854a)); }
.rt-tool.active { color: var(--gold, var(--hx-a9854a)); border-color: var(--gold, var(--hx-a9854a)); }
.rt-sep { width: 1px; height: 20px; background: var(--line, rgba(28,27,25,.14)); margin: 0 4px; }

/* 模式容器 */
.reader-body { flex: 1; position: relative; }
.reader-mode { display: none; }
.reader-mode.active { display: block; }

/* ====== 文本模式 ====== */
.reader-text-wrap { padding: 20px 48px 32px; max-width:720px; }
.reader-text {
  font-size: var(--font-size-lg);
  line-height: 2.1;
  font-family: var(--serif, "Noto Serif SC","Songti SC","SimSun",serif);
  color: var(--ink, var(--hx-1c1b19));
}
.reader-text .chapter-title {
  text-align: center;
  font-size: var(--fs-2xl);
  font-weight: var(--fw-semibold);
  margin: 0 0 24px;
  letter-spacing: .04em;
}
.reader-text p { margin: 0 0 var(--reader-para, 10px); text-indent: 2em; }
.reader-text h2 {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  margin: 32px 0 16px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--gold, var(--hx-a9854a));
  color: var(--ink, var(--hx-1c1b19));
  line-height: 1.4;
}
.reader-text h3 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); margin: 24px 0 12px; color: var(--ink, var(--hx-1c1b19)); }
.reader-text blockquote {
  margin: 20px 0;
  padding: 14px 20px;
  border-left: 4px solid var(--gold, var(--hx-a9854a));
  background: var(--bg-soft, var(--hx-f7f6f3));
  color: var(--muted, var(--hx-8c887f));
  font-style: italic;
  border-radius: 0 10px 10px 0;
}
.reader-text img { max-width: 100%; height: auto; border-radius: var(--radius-2); }
.reader-text .reader-cover-float {
  float: right;
  width: 140px;
  margin: 0 0 16px 20px;
  border-radius: var(--radius-2);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(28,27,25,.1);
}
.reader-text .reader-cover-float img { width: 100%; display: block; }

/* 整书长卷：章节分区 + 锚点偏移（防止被顶部工具栏遮挡） */
.reader-chapter { scroll-margin-top: 70px; }
.reader-chapter + .reader-chapter {
  border-top: 1px solid var(--line, rgba(28,27,25,.07));
  margin-top: 30px;
  padding-top: 30px;
}
.reader-chapter .chapter-empty {
  color: var(--faint, var(--hx-b7b2a8));
  font-style: italic;
  text-indent: 0;
}

/* 正文交互词汇 */
.reader-text .word-dict {
  cursor: pointer;
  border-bottom: 1px dashed rgba(169,133,74,.3);
  transition: .15s;
  padding: 0 1px;
  border-radius: 2px;
}
.reader-text .word-dict:hover { background: rgba(169,133,74,.12); color: var(--gold, var(--hx-a9854a)); }

.key-term {
  border-bottom: 2px solid var(--gold, var(--hx-a9854a));
  cursor: pointer;
  padding: 1px 3px;
  border-radius: 3px;
  background: rgba(169,133,74,.08);
  transition: .15s;
  position: relative;
}
.key-term::after { content: "\25E6"; font-size: 9px; position: absolute; top: -2px; right: -4px; color: var(--gold, var(--hx-a9854a)); opacity: .6; }
.key-term:hover { background: rgba(169,133,74,.12); color: var(--gold, var(--hx-a9854a)); }

/* 搜索高亮 */
.search-hl { background: rgba(169,133,74,.3); padding: 0 2px; border-radius: 2px; transition: .2s; }
.search-hl.cur { background: var(--gold, var(--hx-a9854a)); color: var(--bg, var(--hx-ffffff)); }

/* 标注高亮 */
.ann-highlight { background: rgba(169,133,74,.18); cursor: pointer; border-radius: 2px; transition: .15s; }
.ann-highlight:hover { background: rgba(169,133,74,.3); }

/* ====== 影印模式 ====== */
.scan-layout { padding: 24px 48px 32px; display: flex; flex-direction: column; align-items: center; }
.scan-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.scan-toolbar button {
  font-size: var(--font-size-xs);
  padding: 4px 12px;
  border: 1px solid var(--line, rgba(28,27,25,.09));
  border-radius: var(--radius-sm);
  background: var(--bg, var(--hx-ffffff));
  color: var(--muted, var(--hx-8c887f));
  cursor: pointer;
  transition: all .25s cubic-bezier(.2,.8,.2,1);
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 4px;
}
.scan-toolbar button:hover { border-color: var(--gold, var(--hx-a9854a)); color: var(--gold, var(--hx-a9854a)); }
.s-zoom { font-size: var(--font-size-xs); color: var(--faint, var(--hx-b7b2a8)); min-width: 40px; text-align: center; }
.scan-page {
  background: var(--bg-deeper, var(--hx-f0eee9));
  border: 1px solid var(--line, rgba(28,27,25,.09));
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(28,27,25,.08);
  position: relative;
  max-width: 100%;
}
.scan-page img { display: block; max-width: 100%; height: auto; transition: transform .2s; transform-origin: top center; }
.scan-page .page-num {
  position: absolute;
  bottom: 12px;
  right: 16px;
  font-size: var(--font-size-xs);
  color: rgba(255,255,255,.7);
  background: rgba(0,0,0,.4);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
}
.scan-cap { margin-top: 10px; font-size: var(--font-size-xs); color: var(--faint, var(--hx-b7b2a8)); }
.scan-fig { margin: 0 0 16px; }
.scan-fig:last-child { margin-bottom: 0; }
.scan-fig .scan-page-img { display: block; max-width: 100%; height: auto; transition: transform .2s; transform-origin: top center; }
.scan-fig .scan-pagenum { margin: 8px 0 0; font-size: var(--font-size-xs); color: var(--faint, var(--hx-b7b2a8)); text-align: center; }

/* ====== PDF 模式 ====== */
.pdf-layout { padding: 24px 48px 32px; display: flex; gap: 20px; align-items: flex-start; }
.pdf-thumbs {
  width: 120px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 500px;
  overflow-y: auto;
  padding-right: 8px;
}
.pdf-thumb {
  width: 100%;
  aspect-ratio: 3/4;
  border: 1px solid var(--line, rgba(28,27,25,.09));
  border-radius: var(--radius-xs);
  overflow: hidden;
  cursor: pointer;
  transition: all .25s cubic-bezier(.2,.8,.2,1);
  background: var(--bg-soft, var(--hx-f7f6f3));
}
.pdf-thumb:hover { border-color: var(--gold, var(--hx-a9854a)); }
.pdf-thumb.active { border-color: var(--gold, var(--hx-a9854a)); box-shadow: 0 0 0 2px rgba(169,133,74,.12); }
.pdf-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pdf-thumb .pt-placeholder { width: 100%; height: 100%; display: grid; place-items: center; font-size: var(--fs-xs); color: var(--faint, var(--hx-b7b2a8)); }
.pdf-viewer {
  flex: 1;
  border: 1px solid var(--line, rgba(28,27,25,.09));
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-deeper, var(--hx-f0eee9));
  box-shadow: 0 4px 20px rgba(28,27,25,.08);
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.pdf-viewer .pv-page {
  background: var(--bg, var(--hx-ffffff));
  padding: 40px 48px;
  max-width:720px;
  width: 100%;
  border-radius: var(--radius-xs);
  box-shadow: 0 2px 20px rgba(28,27,25,.06);
  font-family: var(--serif, "Noto Serif SC","Songti SC","SimSun",serif);
  font-size: var(--font-size-md);
  line-height: 2;
  color: var(--ink, var(--hx-1c1b19));
}
.pdf-viewer .pv-page p { text-indent: 2em; margin-bottom: 8px; }
.pdf-viewer--full { width: 100%; min-height: 70vh; }
.pdf-viewer--full .pdf-embed { width: 100%; height: 78vh; border: 0; }
.pdf-viewer .pv-dl { width: 30px; height: 30px; border: 1px solid var(--line, rgba(28,27,25,.09)); border-radius: var(--radius-sm); background: var(--bg, var(--hx-ffffff)); color: var(--muted, var(--hx-8c887f)); cursor: pointer; display: grid; place-items: center; transition: all .25s cubic-bezier(.2,.8,.2,1); text-decoration: none; }
.pdf-viewer .pv-dl:hover { border-color: var(--gold, var(--hx-a9854a)); color: var(--gold, var(--hx-a9854a)); }
.pdf-viewer .pv-dl svg { width: 14px; height: 14px; }
.pv-tools {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
}
.pv-tools button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line, rgba(28,27,25,.09));
  border-radius: var(--radius-sm);
  background: var(--bg, var(--hx-ffffff));
  color: var(--muted, var(--hx-8c887f));
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all .25s cubic-bezier(.2,.8,.2,1);
}
.pv-tools button:hover { border-color: var(--gold, var(--hx-a9854a)); color: var(--gold, var(--hx-a9854a)); }
.pv-tools button svg { width: 14px; height: 14px; }

/* ====== 翻译模式 ====== */
.trans-layout { padding: 20px 48px 32px; display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.trans-col { min-width: 0; }
.trans-col .tc-label {
  font-size: var(--fs-xs2);
  color: var(--faint, var(--hx-b7b2a8));
  letter-spacing: .06em;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line, rgba(28,27,25,.09));
  display: flex;
  align-items: center;
  gap: 6px;
}
.trans-col .tc-label.tc-label-gold { color: var(--gold, var(--hx-a9854a)); }
.trans-col .tc-body {
  font-family: var(--serif, "Noto Serif SC","Songti SC","SimSun",serif);
  font-size: var(--fs-md);
  line-height: 2.1;
  color: var(--ink, var(--hx-1c1b19));
}
.trans-col .tc-body p { text-indent: 2em; margin-bottom: 8px; }
.trans-note { padding: 0 48px 24px; font-size: var(--font-size-xs); color: var(--faint, var(--hx-b7b2a8)); text-indent: 0; }

/* 译文生成按钮 + AI 就绪对照结构 */
.trans-col .tc-gen {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border: 1px solid var(--line, rgba(28,27,25,.12));
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs2);
  font-family: inherit;
  color: var(--muted, var(--hx-8c887f));
  background: var(--bg, var(--hx-ffffff));
  cursor: pointer;
  transition: all .2s cubic-bezier(.2,.8,.2,1);
}
.trans-col .tc-gen:hover { border-color: var(--gold, var(--hx-a9854a)); color: var(--gold, var(--hx-a9854a)); }
.trans-col .tc-gen svg { width: 12px; height: 12px; }
.trans-col .tc-body .trans-empty { padding: 6px 0; }
.trans-col .tc-body .trans-empty p { text-indent: 0; font-size: var(--fs-sm); color: var(--muted, var(--hx-8c887f)); line-height: 1.9; margin: 0 0 6px; }
.trans-col .tc-body .trans-empty code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: var(--gold, var(--hx-a9854a));
  background: rgba(169,133,74,.08);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
}
.tc-row { padding: 11px 0; border-bottom: 1px dashed var(--line, rgba(28,27,25,.09)); }
.tc-row:last-child { border-bottom: 0; }
.tc-row .tc-src-line { text-indent: 2em; margin: 0 0 6px; font-family: var(--serif, "Noto Serif SC","Songti SC","SimSun",serif); color: var(--ink, var(--hx-1c1b19)); font-size: var(--fs-md); line-height: 2; }
.tc-row .tc-trans-line { text-indent: 2em; margin: 0; color: var(--muted, var(--hx-8c887f)); font-size: var(--font-size-md); line-height: 1.9; }

/* ===== 2. 四操作按钮 ===== */
/* .card-acts / .card-act 基础样式由 sujian 全局组件（components 类）统一提供，此处仅保留 library 专属容器间距。 */
.card-acts-bar { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 12px 48px; border-top: 1px solid var(--line, rgba(28,27,25,.09)); }

/* ===== 3. 底部导航 ===== */
.reader-footer {
  border-top: 1px solid var(--line, rgba(28,27,25,.09));
  padding: 16px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cn-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: 1px solid var(--line, rgba(28,27,25,.09));
  border-radius: var(--radius-pill);
  color: var(--muted, var(--hx-8c887f));
  cursor: pointer;
  transition: all .25s cubic-bezier(.2,.8,.2,1);
  font-size: var(--fs-sm);
  font-family: inherit;
  background: var(--bg, var(--hx-ffffff));
  text-decoration: none;
}
.cn-btn:hover { border-color: var(--gold, var(--hx-a9854a)); color: var(--gold, var(--hx-a9854a)); }
.cn-btn:disabled { opacity: .3; cursor: default; pointer-events: none; }
.cn-btn svg { width: 14px; height: 14px; }
.cn-center { font-size: var(--font-size-xs); color: var(--faint, var(--hx-b7b2a8)); }

/* ===== 4. 右侧辅助栏 (340px) ===== */
.reader-extra {
  width: 340px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 0;
  border-left: 1px solid var(--line, rgba(28,27,25,.09));
  background: var(--bg, var(--hx-ffffff));
}

/* ===== 父级 Tab（搜索 / 关联 / 评论） ===== */
.extra-tabs {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.et-bar {
  display: flex;
  border-bottom: 1px solid var(--line, rgba(28,27,25,.09));
  padding: 0 20px;
  flex-shrink: 0;
}
.et-item {
  flex: 1;
  text-align: center;
  font-size: var(--font-size-sm);
  padding: 12px 0 10px;
  background: none;
  border: none;
  color: var(--muted, var(--hx-8c887f));
  cursor: pointer;
  position: relative;
  transition: .2s;
  font-family: inherit;
}
.et-item:hover { color: var(--ink, var(--hx-1c1b19)); }
.et-item.active { color: var(--ink, var(--hx-1c1b19)); font-weight: var(--fw-medium); }
.et-item.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold, var(--hx-a9854a));
  border-radius: 1px;
}
.et-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.et-pane { display: none; animation: libFadeIn .35s ease; }
.et-pane.active { display: block; }

/* 搜索 Pane 内搜索框 */
.et-pane[data-extra-tab="search"] { padding: 0; }
.et-pane .search-box {
  position: static;
  width: 100%;
  top: auto;
  right: auto;
  height: auto;
  max-height: none;
  overflow: visible;
  border-left: none;
  background: transparent;
  box-shadow: none;
}

/* 子 Tab：搜本篇 / 搜本书 / 搜全库 / 查字典 */
.search-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 0;
  border-bottom: 1px solid var(--line, rgba(28,27,25,.09));
}
.st-item {
  flex: 1;
  text-align: center;
  font-size: var(--fs-sm);
  padding: 8px 2px 10px;
  background: none;
  border: none;
  color: var(--muted, var(--hx-8c887f));
  cursor: pointer;
  position: relative;
  transition: .2s;
  font-family: inherit;
  white-space: nowrap;
}
.st-item:hover { color: var(--ink, var(--hx-1c1b19)); }
.st-item.active { color: var(--ink, var(--hx-1c1b19)); font-weight: var(--fw-medium); }
.st-item.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 6px;
  right: 6px;
  height: 2px;
  background: var(--gold, var(--hx-a9854a));
  border-radius: 1px;
}

/* 灰底圆角搜索框 */
.sp-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 16px 10px;
  padding: 6px 10px;
  background: var(--bg-soft, var(--hx-f7f6f3));
  border: 1px solid transparent;
  border-radius: 20px;
  transition: border-color .2s, box-shadow .2s;
}
.sp-input-wrap:focus-within {
  border-color: var(--gold, var(--hx-a9854a));
  box-shadow: 0 0 0 3px rgba(169,133,74,.12);
}
.sp-input-wrap input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: var(--font-size-sm);
  color: var(--ink, var(--hx-1c1b19));
  outline: none;
  padding: 4px 2px;
  font-family: inherit;
}
.sp-input-wrap input::placeholder { color: var(--faint, var(--hx-b7b2a8)); }
.sp-submit,
.sp-close {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted, var(--hx-8c887f));
  cursor: pointer;
  transition: .2s;
  flex-shrink: 0;
}
.sp-submit:hover { background: var(--gold, var(--hx-a9854a)); color: #fff; }
.sp-close:hover { background: rgba(28,27,25,.08); color: var(--ink, var(--hx-1c1b19)); }
.sp-submit svg,
.sp-close svg { width: 14px; height: 14px; }

/* 高级检索 */
.sp-adv-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 16px 10px;
  padding: 4px 0;
  background: none;
  border: none;
  font-size: var(--font-size-xs);
  color: var(--muted, var(--hx-8c887f));
  cursor: pointer;
  transition: .2s;
  font-family: inherit;
}
.sp-adv-toggle:hover { color: var(--gold, var(--hx-a9854a)); }
.sp-adv-toggle svg { transition: transform .2s; }
.sp-adv-toggle.open svg { transform: rotate(180deg); }
.sp-adv-panel {
  display: none;
  margin: 0 16px 12px;
  padding: 12px;
  background: var(--bg-soft, var(--hx-f7f6f3));
  border-radius: var(--radius-2);
  font-size: var(--fs-sm);
}
.sp-adv-panel.open { display: block; }
.sp-adv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
}
.sp-adv-row + .sp-adv-row { border-top: 1px solid var(--line, rgba(28,27,25,.06)); }
.sp-adv-row label { color: var(--muted, var(--hx-8c887f)); }
.sp-adv-row select {
  border: 1px solid var(--line, rgba(28,27,25,.12));
  border-radius: var(--radius-xs);
  padding: 4px 8px;
  font-size: var(--fs-sm);
  background: var(--bg, var(--hx-ffffff));
  color: var(--ink, var(--hx-1c1b19));
  font-family: inherit;
}
.sp-adv-row span { color: var(--ink, var(--hx-1c1b19)); }

/* 搜索状态与结果 */
.et-pane .sp-status {
  padding: 8px 16px;
  font-size: var(--font-size-xs);
  color: var(--faint, var(--hx-b7b2a8));
  border-bottom: none;
}
.et-pane .sp-results { padding: 0 0 12px; }
.et-pane .sp-result {
  padding: 10px 16px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background .2s, border-color .2s;
}
.et-pane .sp-result:hover {
  background: rgba(169,133,74,.08);
  border-left-color: var(--gold, var(--hx-a9854a));
}
.et-pane .sp-result .sr-line { font-size: var(--fs-sm); line-height: 1.75; color: var(--ink, var(--hx-1c1b19)); }
.et-pane .sp-result .sr-line .sr-hl { background: rgba(169,133,74,.3); padding: 0 1px; border-radius: 2px; }

/* 辞典面板（查字典 Tab） */
.dict-panel { display: none; }
.dict-status {
  padding: 20px 16px;
  font-size: var(--fs-sm);
  color: var(--muted, var(--hx-8c887f));
  text-align: center;
}
.dict-section-title {
  padding: 10px 16px 6px;
  font-size: var(--font-size-xs);
  font-weight: var(--fw-medium);
  color: var(--muted, var(--hx-8c887f));
  text-transform: uppercase;
  letter-spacing: .5px;
}
.dict-items {
  display: flex;
  flex-direction: column;
  padding: 0 16px 12px;
  gap: 6px;
}
.dict-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-2);
  border: none;
  background: transparent;
  color: var(--ink, var(--hx-1c1b19));
  font-size: var(--font-size-sm);
  text-align: left;
  cursor: pointer;
  transition: background .2s;
  font-family: inherit;
}
.dict-item:hover, .dict-item.active {
  background: rgba(169,133,74,.08);
}
.dict-item.active { color: var(--gold, var(--hx-a9854a)); font-weight: var(--fw-medium); }
.di-name { flex: 0 0 auto; }
.di-pinyin {
  font-size: var(--font-size-xs);
  color: var(--muted, var(--hx-8c887f));
  font-style: normal;
}
.dict-detail { padding: 0 16px 16px; }
.dd-card {
  background: var(--bg-soft, var(--hx-f7f6f3));
  border-radius: var(--radius-3);
  padding: 16px;
}
.dd-head { margin-bottom: 10px; }
.dd-name {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  color: var(--ink, var(--hx-1c1b19));
  line-height: 1.3;
}
.dd-pinyin {
  margin-top: 4px;
  font-size: var(--fs-sm);
  color: var(--muted, var(--hx-8c887f));
  letter-spacing: .5px;
}
.dd-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  background: rgba(169,133,74,.12);
  color: var(--gold, var(--hx-a9854a));
  font-size: var(--font-size-xs);
  margin-bottom: 10px;
}
.dd-desc {
  font-size: var(--fs-sm);
  line-height: 1.85;
  color: var(--ink, var(--hx-1c1b19));
  margin-bottom: 12px;
}
.dd-desc.dd-empty { color: var(--muted, var(--hx-8c887f)); font-style: italic; }
.dd-source {
  font-size: var(--fs-xs2);
  color: var(--faint, var(--hx-b7b2a8));
  margin-bottom: 10px;
}
.dd-more {
  display: inline-block;
  font-size: var(--font-size-xs);
  color: var(--gold, var(--hx-a9854a));
  text-decoration: none;
}
.dd-more:hover { text-decoration: underline; }

/* 右侧通用卡片 */
.extra-card {
  background: var(--bg, var(--hx-ffffff));
  border-top: 1px solid var(--line, rgba(28,27,25,.09));
  padding: 16px 20px 20px;
}
.extra-card:first-child { border-top: none; }

/* 评论区整合到右侧窄栏（复用素笺原生 sj-comments 标记） */
.reader-extra .sj-comments { margin: 0; padding: 0 16px; }
.reader-extra .sj-section-title {
  font-size: var(--font-size-md);
  margin-bottom: 14px;
  gap: 6px;
  display: flex;
  align-items: center;
}
.reader-extra .sj-section-title::before { width: 3px; height: 14px; }
.reader-extra .sj-comments-count { font-size: var(--font-size-xs); }
.reader-extra .sj-comment-form { gap: 10px; margin-bottom: 16px; }
.reader-extra .sj-comment-form textarea { min-height: 64px; padding: 10px 12px; font-size: var(--fs-sm); }
.reader-extra .sj-comment-form-actions { margin-top: 8px; }
.reader-extra .sj-widget-empty { font-size: var(--fs-sm); padding: 12px 0; margin-bottom: 16px; }
.reader-extra .sj-comment-list {
  max-height: 420px;
  overflow-y: auto;
  gap: 0;
  padding-right: 4px;
}
.reader-extra .sj-comment-item {
  gap: 10px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line, rgba(0,0,0,.06));
  border-radius: 0;
  padding: 14px 0;
}
.reader-extra .sj-comment-item:last-child { border-bottom: none; }
.reader-extra .sj-comment-item .cm-name { font-size: var(--fs-sm); }
.reader-extra .sj-comment-item .cm-time { font-size: var(--fs-xs2); }
.reader-extra .sj-comment-item .cm-content { font-size: var(--fs-sm); line-height: 1.7; }
.reader-extra .sj-comment-login { font-size: var(--fs-sm); padding: 12px; margin-bottom: 16px; }

/* 关联 Tab */
.book-tabs { border-top: none; }
.bt-bar {
  display: flex;
  gap: 16px;
  padding: 14px 20px 0;
  border-bottom: 1px solid var(--line, rgba(28,27,25,.09));
}
.bt-item {
  font-size: var(--fs-sm);
  padding: 8px 0 10px;
  background: none;
  border: none;
  color: var(--muted, var(--hx-8c887f));
  cursor: pointer;
  position: relative;
  transition: .2s;
  font-family: inherit;
}
.bt-item:hover { color: var(--ink, var(--hx-1c1b19)); }
.bt-item.active { color: var(--ink, var(--hx-1c1b19)); font-weight: var(--fw-medium); }
.bt-item.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold, var(--hx-a9854a));
  border-radius: 1px;
}
.bt-content { padding: 16px 20px 8px; }
.bt-pane { display: none; animation: libFadeIn .35s ease; }
.bt-pane.active { display: block; }
@keyframes libFadeIn { from{opacity:0;transform:translateY(4px)} to{opacity:1;transform:translateY(0)} }

.bt-item-row {
  display: block;
  padding: 10px 0;
  border-bottom: 1px solid var(--line, rgba(28,27,25,.09));
  text-decoration: none;
  transition: .2s;
}
.bt-item-row:last-child { border-bottom: none; }
.bt-item-row:hover { opacity: .75; }
.bt-row-title { font-weight: var(--fw-medium); color: var(--ink, var(--hx-1c1b19)); font-size: var(--font-size-sm); }
.bt-row-desc { font-size: var(--font-size-xs); color: var(--muted, var(--hx-8c887f)); margin-top: 2px; }

/* 关联图片网格 */
.img-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.img-cell {
  display: block;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-deeper, var(--hx-f0eee9));
  cursor: pointer;
  position: relative;
  transition: all .25s cubic-bezier(.2,.8,.2,1);
}
.img-cell:hover { transform: scale(1.02); box-shadow: 0 4px 16px rgba(28,27,25,.1); }
.img-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-cell .img-cap {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 6px;
  background: rgba(28,27,25,.7);
  color: var(--bg, var(--hx-ffffff));
  font-size: var(--fs-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 引用嵌入卡片 */
.embed-card-small {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--line, rgba(28,27,25,.09));
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: var(--bg-soft, var(--hx-f7f6f3));
  cursor: pointer;
  text-decoration: none;
  transition: all .25s cubic-bezier(.2,.8,.2,1);
  margin-bottom: 12px;
}
.embed-card-small:hover { border-color: rgba(169,133,74,.3); box-shadow: 0 4px 16px rgba(28,27,25,.06); }
.embed-card-small .ec-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-2);
  background: rgba(169,133,74,.12);
  color: var(--gold, var(--hx-a9854a));
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.embed-card-small .ec-icon svg { width: 18px; height: 18px; }
.embed-card-small .ec-body-small { flex: 1; min-width: 0; }
.embed-card-small .ec-source { font-size: var(--fs-xs2); color: var(--faint, var(--hx-b7b2a8)); margin-bottom: 2px; }
.embed-card-small .ec-quote { font-size: var(--fs-sm); color: var(--muted, var(--hx-8c887f)); line-height: 1.6; }
.embed-card-small .ec-quote::before { content: "\201C"; color: var(--gold, var(--hx-a9854a)); }
.embed-card-small .ec-quote::after { content: "\201D"; color: var(--gold, var(--hx-a9854a)); }
.embed-card-small .ec-link { font-size: var(--fs-xs2); color: var(--gold, var(--hx-a9854a)); margin-top: 4px; }
.embed-card-small .ec-link svg { width: 12px; height: 12px; }

/* 无内容占位 */
.no-content {
  padding: 60px 20px;
  text-align: center;
  color: var(--faint, var(--hx-b7b2a8));
  font-size: var(--fs-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.no-content .icon { opacity: .45; }
.no-content .icon svg { width: 40px; height: 40px; }

/* ===== 6. 字典弹窗 ===== */
.dict-popup {
  display: none;
  position: fixed;
  z-index: 100;
  background: var(--bg, var(--hx-ffffff));
  border: 1px solid var(--line, rgba(28,27,25,.09));
  border-radius: var(--radius-md);
  box-shadow: 0 8px 30px rgba(28,27,25,.12);
  overflow: hidden;
  max-width: 360px;
}
.dict-popup.show { display: block; }
.dict-popup .dp-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 10px; }
.dict-popup .dp-word { font-family: var(--serif, "Noto Serif SC","Songti SC","SimSun",serif); font-size: var(--fs-2xl); font-weight: var(--fw-semibold); color: var(--ink, var(--hx-1c1b19)); line-height: 1; }
.dict-popup .dp-pinyin { font-size: var(--fs-sm); color: var(--muted, var(--hx-8c887f)); }
.dict-popup .dp-divider { height: 1px; background: var(--line, rgba(28,27,25,.09)); margin: 0 16px; }
.dict-popup .dp-body { padding: 12px 16px 16px; }
.dict-popup .dp-def { font-size: 13.5px; color: var(--muted, var(--hx-8c887f)); line-height: 1.8; }
.dict-popup .dp-def .dp-label { font-weight: var(--fw-semibold); color: var(--ink, var(--hx-1c1b19)); margin-right: 4px; }
.dict-popup .dp-example {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--bg-soft, var(--hx-f7f6f3));
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--ink, var(--hx-1c1b19));
  line-height: 1.7;
  border-left: 3px solid rgba(169,133,74,.12);
}
.dict-popup .dp-example .dp-label { font-weight: var(--fw-semibold); color: var(--ink, var(--hx-1c1b19)); }
.dict-popup .dp-etym {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line, rgba(28,27,25,.09));
  font-size: var(--font-size-xs);
  color: var(--faint, var(--hx-b7b2a8));
  line-height: 1.6;
}
.dp-tax { display: flex; gap: 5px; padding: 2px 16px 6px; flex-wrap: wrap; }
.tax-pill {
  font-size: var(--fs-xs);
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: rgba(169,133,74,.12);
  color: var(--gold, var(--hx-a9854a));
  border: 1px solid rgba(169,133,74,.12);
}
.dp-actions { display: flex; gap: 6px; padding: 0 16px 14px; flex-wrap: wrap; }
.dp-act {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border: 1px solid var(--line, rgba(28,27,25,.09));
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs2);
  font-family: inherit;
  cursor: pointer;
  color: var(--muted, var(--hx-8c887f));
  background: var(--bg, var(--hx-ffffff));
  transition: all .25s cubic-bezier(.2,.8,.2,1);
}
.dp-act:hover { border-color: var(--gold, var(--hx-a9854a)); color: var(--gold, var(--hx-a9854a)); }
.dp-act svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ===== 7. 关键词弹窗 ===== */
.kw-popup {
  display: none;
  position: fixed;
  z-index: 100;
  background: var(--bg, var(--hx-ffffff));
  border: 1px solid var(--line, rgba(28,27,25,.09));
  border-radius: var(--radius-md);
  box-shadow: 0 8px 30px rgba(28,27,25,.12);
  overflow: hidden;
  width: 380px;
}
.kw-popup.show { display: block; }
.kw-popup .kp-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 6px; }
.kw-popup .kp-word { font-family: var(--serif, "Noto Serif SC","Songti SC","SimSun",serif); font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--ink, var(--hx-1c1b19)); }
.kw-popup .kp-tax { display: flex; gap: 4px; padding: 0 16px 8px; flex-wrap: wrap; }
.kw-popup .kp-body { padding: 4px 16px 10px; font-size: var(--fs-sm); color: var(--muted, var(--hx-8c887f)); line-height: 1.8; }
.kw-popup .kp-img { margin: 4px 16px 8px; border-radius: var(--radius-sm); overflow: hidden; max-height: 120px; }
.kw-popup .kp-img img { width: 100%; height: 120px; object-fit: cover; display: block; }
.kw-popup .kp-actions { display: flex; gap: 6px; padding: 0 16px 14px; flex-wrap: wrap; }
.kp-act {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid var(--line, rgba(28,27,25,.09));
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-family: inherit;
  cursor: pointer;
  color: var(--muted, var(--hx-8c887f));
  background: var(--bg, var(--hx-ffffff));
  transition: all .25s cubic-bezier(.2,.8,.2,1);
}
.kp-act:hover { border-color: var(--gold, var(--hx-a9854a)); color: var(--gold, var(--hx-a9854a)); }
.kp-act svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ===== 8. 标注弹窗 ===== */
.ann-popup {
  display: none;
  position: fixed;
  z-index: 100;
  background: var(--bg, var(--hx-ffffff));
  border: 1px solid var(--line, rgba(28,27,25,.09));
  border-radius: var(--radius-md);
  box-shadow: 0 8px 30px rgba(28,27,25,.12);
  overflow: hidden;
  width: 300px;
}
.ann-popup.show { display: block; }
.ann-popup .ap-head { padding: 12px 16px 8px; font-size: var(--fs-sm); font-weight: var(--fw-semibold); border-bottom: 1px solid var(--line, rgba(28,27,25,.09)); }
.ann-popup .ap-preview {
  padding: 10px 16px;
  font-size: var(--fs-sm);
  color: var(--muted, var(--hx-8c887f));
  line-height: 1.6;
  max-height: 60px;
  overflow: hidden;
  background: var(--bg-soft, var(--hx-f7f6f3));
  margin: 0 16px 8px;
  border-radius: var(--radius-sm);
}
.ann-popup textarea {
  width: calc(100% - 32px);
  margin: 0 16px;
  padding: 8px;
  border: 1px solid var(--line, rgba(28,27,25,.09));
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-family: inherit;
  resize: vertical;
  outline: none;
  color: var(--ink, var(--hx-1c1b19));
  background: var(--bg, var(--hx-ffffff));
  min-height: 50px;
}
.ann-popup textarea:focus { border-color: var(--gold, var(--hx-a9854a)); }
.ann-popup .ap-actions { display: flex; gap: 8px; padding: 10px 16px 14px; }
.ann-popup .ap-actions button {
  flex: 1;
  padding: 7px 0;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  cursor: pointer;
  font-family: inherit;
  transition: all .25s cubic-bezier(.2,.8,.2,1);
}
.ap-save { border: none; background: var(--gold, var(--hx-a9854a)); color: var(--bg, var(--hx-ffffff)); }
.ap-save:hover { background: var(--hx-94763e); }
.ap-cancel { border: 1px solid var(--line, rgba(28,27,25,.09)); background: var(--bg, var(--hx-ffffff)); color: var(--muted, var(--hx-8c887f)); }
.ap-cancel:hover { background: var(--bg-soft, var(--hx-f7f6f3)); }
.ap-tax { padding: 6px 16px 4px; border-top: 1px solid var(--line, rgba(28,27,25,.09)); margin-top: 6px; }
.ap-tax .at-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.ap-tax .at-label { font-size: var(--fs-xs2); color: var(--faint, var(--hx-b7b2a8)); width: 36px; flex-shrink: 0; }
.at-pill {
  font-size: var(--fs-xs);
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line, rgba(28,27,25,.09));
  color: var(--muted, var(--hx-8c887f));
  cursor: pointer;
  transition: .15s;
  background: var(--bg, var(--hx-ffffff));
}
.at-pill:hover { border-color: var(--gold, var(--hx-a9854a)); color: var(--gold, var(--hx-a9854a)); }
.at-pill.selected { background: rgba(169,133,74,.12); border-color: var(--gold, var(--hx-a9854a)); color: var(--gold, var(--hx-a9854a)); }

/* ===== 9. 左侧标注列表 ===== */
.ann-section {
  border-top: 1px solid var(--line, rgba(28,27,25,.09));
  margin-top: 8px;
  padding-top: 12px;
}
.ann-section .as-head { display: flex; align-items: center; justify-content: space-between; padding: 0 16px 8px; }
.ann-section .as-head h6 { font-size: var(--font-size-xs); font-weight: var(--fw-semibold); color: var(--ink, var(--hx-1c1b19)); }
.ann-section .as-head .as-count { font-size: var(--fs-xs2); color: var(--faint, var(--hx-b7b2a8)); }
.ann-list { padding: 0 16px; }
.ann-item { padding: 8px 0; border-bottom: 1px solid var(--line, rgba(28,27,25,.09)); cursor: pointer; transition: .2s; }
.ann-item:last-child { border-bottom: none; }
.ann-item:hover { opacity: .8; }
.ann-item .ai-text { font-size: 12.5px; color: var(--ink, var(--hx-1c1b19)); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ann-item .ai-note { font-size: var(--fs-xs2); color: var(--gold, var(--hx-a9854a)); margin-top: 2px; }
.ann-empty { font-size: var(--font-size-xs); color: var(--faint, var(--hx-b7b2a8)); padding: 16px; text-align: center; }

/* ===== 10.5 阅读主题 / 进度 / 书签 / 弹层 / 提示 ===== */

/* --- 阅读主题：在 .reader-wrap 上重定义 token，整页联动 --- */
.reader-wrap[data-reading-theme="eye"] {
  --bg: var(--hx-e7f0e1); --ink: var(--hx-2e3a2a); --bg-soft: var(--hx-dcebd3); --bg-deeper: var(--hx-d2e3c8);
  --line: rgba(46,58,42,.12); --faint: var(--hx-9aab90); --muted: var(--hx-5b6b54); --gold: var(--hx-8a7b3f);
}
.reader-wrap[data-reading-theme="paper"] {
  --bg: var(--hx-f6eeda); --ink: var(--hx-4a3f2c); --bg-soft: var(--hx-efe2c8); --bg-deeper: var(--hx-e8d8ba);
  --line: rgba(74,63,44,.12); --faint: var(--hx-b9a986); --muted: var(--hx-8a7a5f); --gold: var(--hx-9c7b3f);
}
.reader-wrap[data-reading-theme="night"] {
  --bg: var(--hx-1c1c1e); --ink: var(--hx-c9c5bd); --bg-soft: var(--hx-26262a); --bg-deeper: var(--hx-2c2c30);
  --line: rgba(201,197,189,.14); --faint: var(--hx-5f5d59); --muted: var(--hx-8d8a84); --gold: var(--hx-c9a24a);
}
.reader-wrap[data-reading-theme="night"] .reader-text img,
.reader-wrap[data-reading-theme="night"] .reader-cover-float { box-shadow: none; }

/* --- 阅读进度条 --- */
.reading-progress {
  position: sticky;
  top: 0;
  height: 3px;
  background: var(--line, rgba(28,27,25,.09));
  z-index: 5;
}
.reading-progress .rp-bar {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold, var(--hx-a9854a)), var(--hx-c8a96a));
  transition: width .12s linear;
}

/* --- 书签列表（左侧目录下方） --- */
.bm-section {
  border-top: 1px solid var(--line, rgba(28,27,25,.09));
  margin-top: 8px;
  padding-top: 12px;
}
.bm-section .bm-head { display: flex; align-items: center; justify-content: space-between; padding: 0 16px 8px; }
.bm-section .bm-head h6 { font-size: var(--font-size-xs); font-weight: var(--fw-semibold); color: var(--ink, var(--hx-1c1b19)); margin: 0; }
.bm-section .bm-head .bm-count { font-size: var(--fs-xs2); color: var(--faint, var(--hx-b7b2a8)); }
.bm-list { padding: 0 16px; }
.bm-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--line, rgba(28,27,25,.09));
  cursor: pointer; transition: .2s;
}
.bm-item:last-child { border-bottom: none; }
.bm-item:hover { opacity: .8; }
.bm-item .bm-text { flex: 1; font-size: 12.5px; color: var(--ink, var(--hx-1c1b19)); line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm-del, .ann-item .bm-del {
  flex-shrink: 0; width: 18px; height: 18px; line-height: 16px; text-align: center;
  font-size: var(--font-size-sm); color: var(--faint, var(--hx-b7b2a8)); border-radius: var(--radius-xs); cursor: pointer;
  transition: .15s;
}
.bm-del:hover, .ann-item .bm-del:hover { background: rgba(169,133,74,.14); color: var(--gold, var(--hx-a9854a)); }
.bm-empty { font-size: var(--font-size-xs); color: var(--faint, var(--hx-b7b2a8)); padding: 12px 0; text-align: center; }

/* --- 阅读设置 / 主题 弹层 --- */
.lib-popover {
  display: none;
  position: fixed;
  z-index: 110;
  background: var(--bg, var(--hx-ffffff));
  border: 1px solid var(--line, rgba(28,27,25,.12));
  border-radius: var(--radius-3);
  box-shadow: 0 10px 36px rgba(28,27,25,.14);
  padding: 12px 14px;
  min-width: 188px;
}
.lib-popover.show { display: block; animation: libPopIn .18s ease; }
@keyframes libPopIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.lib-popover .lp-title { font-size: var(--font-size-xs); font-weight: var(--fw-semibold); color: var(--ink, var(--hx-1c1b19)); margin-bottom: 10px; }
.lib-popover .lp-themes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lp-theme {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--line, rgba(28,27,25,.12)); border-radius: var(--radius-2);
  background: var(--bg-soft, var(--hx-f6f3ee)); color: var(--muted, var(--hx-6b6254)); cursor: pointer;
  font-size: 12.5px; font-family: inherit; transition: .2s;
}
.lp-theme:hover { border-color: var(--gold, var(--hx-a9854a)); color: var(--ink, var(--hx-1c1b19)); }
.lp-theme.active { border-color: var(--gold, var(--hx-a9854a)); color: var(--gold, var(--hx-a9854a)); background: rgba(169,133,74,.1); }
.lpt-swatch { width: 16px; height: 16px; border-radius: var(--radius-xs); flex-shrink: 0; border: 1px solid rgba(0,0,0,.1); }
.lpt-swatch.t-day { background: var(--hx-ffffff); }
.lpt-swatch.t-eye { background: var(--hx-e7f0e1); }
.lpt-swatch.t-paper { background: var(--hx-f6eeda); }
.lpt-swatch.t-night { background: var(--hx-1c1c1e); }
.lib-popover .lp-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.lib-popover .lp-row:last-child { margin-bottom: 0; }
.lib-popover .lp-row label { font-size: 12.5px; color: var(--muted, var(--hx-8c887f)); width: 42px; flex-shrink: 0; }
.lib-popover .lp-row input[type="range"] { flex: 1; accent-color: var(--gold, var(--hx-a9854a)); }
.lib-popover .lp-val { font-size: var(--fs-xs2); color: var(--faint, var(--hx-b7b2a8)); width: 28px; text-align: right; font-variant-numeric: tabular-nums; }

/* --- 轻提示 --- */
.lib-toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(12px);
  background: rgba(28,27,25,.92); color: var(--hx-ffffff); font-size: var(--fs-sm); line-height: 1;
  padding: 10px 18px; border-radius: var(--radius-pill); z-index: 200;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.lib-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 10. 响应式适配 ===== */
@media (max-width:980px) {
    .toc-sidebar, .reader-extra { display: none; }
    .reader-text-wrap { padding: 16px 20px 24px; }
    .scan-layout { padding: 16px 20px; }
    .pdf-layout { flex-direction: column; padding: 16px 20px; }
    .pdf-thumbs { width: 100%; flex-direction: row; overflow-x: auto; max-height: none; }
    .pdf-thumb { width: 60px; flex-shrink: 0; }
    .trans-layout { grid-template-columns: 1fr; }
    .reader-footer { padding: 12px 20px; }
    .card-acts-bar { padding: 12px 20px; }
}
@media (max-width:720px) {
    .reader-main { padding: 0; }
    .reader-text-wrap { padding: 12px 16px 20px; }
    .reader-text .reader-cover-float { float: none; width: 100%; margin: 0 0 16px; }
    .reader-text { font-size: var(--fs-md); }
    .scan-layout { padding: 12px 16px; }
    .pdf-layout { padding: 12px 16px; }
    .trans-layout { padding: 12px 16px 20px; }
    .cn-btn { padding: 6px 14px; font-size: var(--font-size-xs); }
}
