/* ═══════════════════════════════════════════════════════════
   书斋 · 样式表
   自研（不参考 readest 界面源码）
   主题通过 <html data-theme="..."> 切换
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--c-text);
  background: var(--c-bg);
  user-select: none;
  -webkit-user-select: none;
}

/* ─────────── 主题变量 ─────────── */
:root {
  --font-ui: system-ui, -apple-system, "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-read-serif: Georgia, "Songti SC", "SimSun", "Noto Serif SC", serif;
  --font-read-sans: system-ui, "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --radius: 10px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --bar-h: 52px;
}

/* ⚠️ 主题变量块**只此一份**（在下方「主题调色」一节，1.2 起共 12 套）。
   这里原来还有一套四主题的旧块、色值与下面那份不一致 —— 正是「中间和四周
   颜色对不上」这类漂移的温床，已删除。加主题只改一处，check-web 有专项一致性检查。 */

/* ─────────── 通用 ─────────── */
.page { position: absolute; inset: 0; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
/* 全屏页面转场：淡入淡出（≥300ms，满足华为对"全屏页面转场动效时长"的要求） */
.page.page-in  { animation: page-in  .3s ease both; }
.page.page-out { animation: page-out .3s ease both; }
@keyframes page-in  { from { opacity: 0 } to { opacity: 1 } }
@keyframes page-out { from { opacity: 1 } to { opacity: 0 } }

.ico {
  width: 22px; height: 22px;
  fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

.btn-icon {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--c-text);
  cursor: pointer;
}
.btn-icon:active { background: var(--c-surface-2); }

/* ─────────── 书架页 ─────────── */
#page-library { padding-top: var(--safe-t); }

/* 内容区统一限宽居中（避免宽屏时右侧一大片空白） */
.lib-head, .lib-crumb, .lib-grid, .continue-row {
  width: 100%; max-width: 1200px; margin-left: auto; margin-right: auto;
}

.lib-head {
  flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 16px 10px calc(16px + var(--safe-l));
}
.lib-title { margin: 0; font-size: 21px; font-weight: 500; letter-spacing: .01em; }
.lib-tools { display: flex; align-items: center; gap: 2px; flex: none; }

/* 网格：固定封面比例 + 统一间距 + 每行最小宽度，保证窗口缩放时始终均匀对齐 */
.lib-grid {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 6px 16px calc(28px + var(--safe-b)) calc(16px + var(--safe-l));
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 22px 18px;
  align-content: start;
  -webkit-overflow-scrolling: touch;
}

/* 卡片：统一浅色底 + 圆角；悬停轻微上浮 */
.book, .folder-card, .folder-add {
  display: flex; flex-direction: column; gap: 8px;
  padding: 8px; border-radius: 12px;
  background: var(--c-surface); border: 1px solid transparent;
  box-sizing: border-box; text-align: start;
  cursor: pointer; transition: var(--motion), transform .16s ease, box-shadow .16s ease;
}
.folder-add { font-family: inherit; color: var(--c-text); }
@media (hover: hover) {
  .book:hover, .folder-card:hover, .folder-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px -12px rgba(0, 0, 0, .35);
  }
}
.book:active, .folder-card:active, .folder-add:active { transform: scale(.985); }

.book-cover {
  position: relative;
  aspect-ratio: 2 / 3;          /* 封面固定比例：原图比例再怪也裁切对齐 */
  border-radius: 8px;
  overflow: hidden;
  background: var(--c-surface-2);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .14);
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-cover .noimg {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 10px;
  font-size: 12px; line-height: 1.45; text-align: center;
  color: var(--c-muted);
  overflow: hidden;
}
.book-cover::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 3px;
  background: var(--c-accent);
  transform-origin: left;
  transform: scaleX(var(--pg, 0));
}
/* 标题固定占两行高度 —— 一到两行的标题都不会让底部参差不齐 */
.book-title, .folder-title {
  font-size: 13px; line-height: 1.35;
  min-height: 2.7em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
/* 元数据行：左边作者/格式（省略），右边进度 */
.book-meta, .folder-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  font-size: 11.5px; color: var(--c-muted); line-height: 1.3;
}
.book-author {
  min-width: 0; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.book-pct { flex: none; font-variant-numeric: tabular-nums; }
.book-del {
  position: absolute; top: 4px; right: 4px; z-index: 2;
  width: 24px; height: 24px; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .5); color: #fff;
  display: none; align-items: center; justify-content: center;
  cursor: pointer;
}
.book-del .ico { width: 14px; height: 14px; stroke-width: 2.4; }
.book.show-del .book-del { display: flex; }

.empty {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; color: var(--c-muted); text-align: center; padding: 20px;
}
.empty-ico { width: 56px; height: 56px; fill: none; stroke: currentColor; stroke-width: 1.2; opacity: .45; }
.empty-t { margin: 8px 0 0; font-size: 15px; color: var(--c-text); }
.empty-s { margin: 0; font-size: 13px; }

/* ─────────── 阅读页 ─────────── */
#page-reader { background: var(--c-read-bg); }

/* ⭐⭐ [1.7 #79 ④] 自定义背景图（网页层自己画，见 reader.html 的说明）。
   z-index 0 = 整棵阅读树最底：书页（#view-host, z-index 1）盖在它上面，
   而书页在自己背景透明处会把它透出来 —— 这正是原来「原生垫层」的位置。
   内置图仍由原生垫层画 ⇒ 没有自定义图时整块 hidden。 */
#bg-layer { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
#bg-layer > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* 黑罩：不透明度由 JS 按「遮罩透明度」设置写进来（与原生 bgScrimColor 同一档、同样**恒为黑罩**）。
   ⚠️ 放在本层里的原因是：自定义图模式下**原生那层罩子在网页之下**（被图盖住），
      所以这一屏的对比度保障只能由网页自己出。 */
#bg-layer > i { position: absolute; inset: 0; background: transparent; }

#view-host { position: absolute; inset: 0; }
#view-host foliate-view { width: 100%; height: 100%; display: block; }

/* 书页以外的空白区（单栏限宽时两侧的留白）也可以点，用来呼出工具栏 */
#view-host { z-index: 1; }
/* ⚠️ 把手势完全交给 JS：touch-action 必须 none，否则浏览器会把双指手势当成
   「平移」自己吃掉，根本不把 touchmove 派发给 JS → 我们的捏合永远收不到
   （真机踩过）。本机已用 zoomAccess(false) 关掉内核整页缩放，所以 none 不会
   放大整页；单指滑动翻页由 foliate 自己在 JS 里处理，也不受影响。 */
#view-host { touch-action: none; }

/* ⭐⭐ [1.3 五轮] 鱼干定的**图层规矩**（原话）：
     「为了防止一堆可能出现的问题，我想了个办法，把上下栏最底部处理，
       这样所有窗口都不用设置比它们高了……类似于画画的图层，如果设置为最低下，
       那么其它的图层都在这个上面了，窗口道理同。」
   于是把顶/底栏（`.rbar`）从 z-index 6 压到 **2**（只比书页高，比**任何**面板/浮窗低）：

     z-index 阶梯（网页层，数值越小越靠下）：
       0   ⬅#79 ④   #bg-layer        自定义背景图（取代原生垫层的位置）
       1            #view-host        书页本体
       2   ⬅此处     .rbar             顶/底栏（唯一一个"底"面板，书页之上、其余一切之下）
       4            .rhf              页眉/页脚细信息条（空间上避开了栏，不打架）
       7-8          #scrim / 侧栏     抽屉遮罩、目录与批注抽屉
       20           .sheet-wrap       阅读设置等主面板
       30           .more-menu        顶栏「更多」菜单
       60-71        toast / note-layer / note-card / sel-popup / dict-box
       99           全屏兜底层
   新加面板**只要 ≥3 就自动在上下栏之上**，不必再去算「我得比栏高多少」。
   ⚠️ 原生接管时（body.native-chrome）网页这套 `.rbar` 整个被隐藏，
      原生顶/底栏由 ArkUI 画在 Web **之上** —— 那一侧靠 `--nc-top/--nc-bottom`
      让位（原生是物理上层，压不下去，只能让）。 */
.rbar {
  position: absolute; left: 0; right: 0; z-index: 2;
  display: flex; align-items: center; gap: 2px;
  min-height: var(--bar-h);
  padding: 2px 6px;
  background: var(--c-surface);
  border-color: var(--c-border);
  transition: transform .22s ease, opacity .22s ease;
}
.rbar-top {
  top: 0;
  padding-top: calc(2px + var(--safe-t));
  padding-left: calc(6px + var(--safe-l));
  padding-right: calc(6px + var(--safe-r));
  border-bottom: 1px solid var(--c-border);
}
.rbar-bottom {
  bottom: 0;
  padding-bottom: calc(2px + var(--safe-b));
  padding-left: calc(14px + var(--safe-l));
  padding-right: calc(14px + var(--safe-r));
  border-top: 1px solid var(--c-border);
  gap: 10px;
}
.rbar-mid { flex: 1; min-width: 0; padding: 0 4px; }
.rbar-title {
  font-size: 14px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rbar-sub {
  font-size: 11.5px; color: var(--c-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 工具栏隐藏态 */
body.ui-hidden .rbar-top { transform: translateY(-100%); opacity: 0; pointer-events: none; }body.ui-hidden .rbar-bottom { transform: translateY(100%); opacity: 0; pointer-events: none; }

.pg { flex: none; font-size: 12px; color: var(--c-muted); min-width: 30px; text-align: center; font-variant-numeric: tabular-nums; }
.slider { flex: 1; min-width: 0; accent-color: var(--c-accent); height: 22px; }

/* ─────────── 目录抽屉 ─────────── */
.drawer {
  position: absolute; z-index: 8;
  top: 0; bottom: 0; left: 0;
  width: min(84vw, 320px);
  display: flex; flex-direction: column;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  transform: translateX(-102%);
  transition: transform .26s ease;
  padding-top: var(--safe-t);
  padding-bottom: var(--safe-b);
}
.drawer.open { transform: none; }

.drawer-head {
  flex: none;
  display: flex; gap: 12px; align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--c-border);
}
.toc-cover {
  width: 46px; height: 66px; flex: none;
  object-fit: cover; border-radius: 4px;
  background: var(--c-surface-2);
}
.toc-cover:not([src]) { visibility: hidden; }
.toc-meta { min-width: 0; }
.toc-t { font-size: 14px; font-weight: 500; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.toc-a { font-size: 12px; color: var(--c-muted); margin-top: 3px; }

.toc-list {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 8px 6px 20px;
  -webkit-overflow-scrolling: touch;
}
.toc-list a, .toc-list span {
  display: block;
  padding: 9px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  line-height: 1.4;
  text-decoration: none;
  color: var(--c-text);
}
.toc-list a:active { background: var(--c-surface-2); }
.toc-list a.cur { background: var(--c-surface-2); color: var(--c-accent); font-weight: 500; }
.toc-list span { color: var(--c-muted); }
.toc-list ol, .toc-list li { margin: 0; padding: 0; list-style: none; }

/* 一行 = 折叠箭头 + 标题 */
.toc-list .row-toc { display: flex; align-items: center; gap: 2px; }
.toc-list .row-toc > a,
.toc-list .row-toc > .t { flex: 1; min-width: 0; }
.toc-list .toc-toggle,
.toc-list .toc-gap {
  flex: none; width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--c-muted);
  cursor: pointer;
}
.toc-list .toc-toggle .ico { width: 14px; height: 14px; transition: transform .16s ease; }
.toc-list [aria-expanded="false"] > .row-toc .toc-toggle .ico { transform: rotate(-90deg); }
.toc-list [aria-expanded="false"] > ol { display: none; }

.scrim {
  position: absolute; inset: 0; z-index: 7;
  background: var(--c-overlay);
  opacity: 0; pointer-events: none;
  transition: opacity .26s ease;
}
.scrim.open { opacity: 1; pointer-events: auto; }

/* ─────────── 设置面板 ─────────── */
.sheet-wrap { position: absolute; inset: 0; z-index: 20; }
.sheet-scrim { position: absolute; inset: 0; background: var(--c-overlay); }
/* ⭐⭐ [2026-11-06 鱼干：设置都用悬浮 + 淡入淡出]
   原来面板是「贴右边全高的抽屉」（手机形态）。网页/桌面改成**居中悬浮卡片**：
   四周留白、圆角、投影，进出都是淡入淡出 + 轻微缩放。
   ⚠️ 目录 / 书签 / 搜索 / 设置都共用这一套 .sheet，所以改一处全局生效。 */
.sheet {
  /* ⭐ [2026-11-06 鱼干：要侧悬浮，不要置中] 贴右侧、垂直居中、留 14px 边距的悬浮卡片。
     既不是贴边全高抽屉（手机上那套），也不是屏幕正中。 */
  position: absolute; right: 14px; left: auto; top: 50%;
  transform: translateY(-50%);
  width: min(88vw, 420px); max-width: 100%;
  max-height: min(88vh, 820px);
  display: flex; flex-direction: column;
  background: var(--c-surface);
  border-radius: 18px;
  border: 1px solid var(--c-border);
  box-shadow: 0 28px 70px rgba(0, 0, 0, .38);
  padding-bottom: 0;
  animation: sheet-in .22s cubic-bezier(.2, .8, .3, 1);
}
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(-50%) translateX(18px) scale(.98); }
  to   { opacity: 1; transform: translateY(-50%) translateX(0) scale(1); }
}
/* 关闭：先播 180ms 淡出，再由 JS 真正 hidden */
.sheet-wrap.closing .sheet { animation: sheet-out .18s ease forwards; }
.sheet-wrap.closing .sheet-scrim { animation: fade-out .18s ease forwards; }
@keyframes sheet-out { to { opacity: 0; transform: translateY(-50%) translateX(18px) scale(.98); } }
@keyframes fade-out { to { opacity: 0; } }
.sheet-scrim { animation: fade-in .2s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.sheet-head {
  flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 8px 12px 18px;
  border-bottom: 1px solid var(--c-border);
  font-size: 15px; font-weight: 500;
}
.sheet-body {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 6px 18px calc(20px + var(--safe-b));
}

.row { padding: 13px 0; border-bottom: 1px solid var(--c-border); }
.row:last-child { border-bottom: 0; }
.row-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13.5px; margin-bottom: 9px;
}
.row-val { color: var(--c-muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  flex: 1 1 0; min-width: 58px;
  padding: 9px 4px;
  font-size: 13px; font-family: inherit;
  color: var(--c-text);
  background: var(--c-surface-2);
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}
.seg button.on { border-color: var(--c-accent); color: var(--c-accent); font-weight: 500; }

input[type="range"].wide { width: 100%; accent-color: var(--c-accent); }

.switch {
  position: relative; width: 46px; height: 28px; flex: none;
  background: var(--c-surface-2); border-radius: 14px;
  border: 0; padding: 0; cursor: pointer;
  transition: background .18s ease;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .18s ease;
}
.switch.on { background: var(--c-accent); }
.switch.on::after { transform: translateX(18px); }

.danger-btn {
  display: block; width: 100%;
  padding: 12px; margin-top: 4px;
  font-size: 14px; font-family: inherit; color: #d94141;
  background: var(--c-surface-2); border: 0; border-radius: 8px; cursor: pointer;
}

.about { font-size: 12px; color: var(--c-muted); line-height: 1.9; }
.about code { font-size: 11.5px; background: var(--c-surface-2); padding: 1px 5px; border-radius: 4px; }

/* ─────────── Toast / 致命错误 ─────────── */
.toast-host {
  position: absolute; z-index: 60;
  left: 0; right: 0;
  /* ⭐ [1.7 需求①] 原先贴着底部（bottom:28px）会被阅读器原生底栏盖住 →
     用户看到「已经是最后一章了」这类提示被底栏遮掉。Web 里的 DOM 节点永远
     渲在原生浮层之下，没法靠 z-index 翻过原生栏；最稳的做法是把提示移到
     **屏幕中部的净空带**（顶栏与底栏之间），任何设备/栏高都不会被遮。
     用 top:50% + 自身上移半高做垂直居中，多条提示仍从中心向上叠。 */
  top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  max-width: 82%;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  /* ⚠️ 之前是 `color: var(--c-bg); background: var(--c-text)`（反色技巧），
     但 `--c-bg` 被 applyOuterThemeVars 覆盖成了「阅读背景色」，而 `--c-text` 是
     app 主题的「文字色」—— 两者来自不同来源，一旦「浅色 app 主题 + 深色阅读背景」
     就会同黑 ⇒ 黑底黑字、文字看不见（鱼干报的 Eliot.epub 黑横幅正是它：
     那本书目录只有 1 条，点「下一章」永远撞到边界 toast）。
     改成同一 `data-theme` 块里的 `--c-surface` / `--c-text`，二者 Guaranteed 对比，
     任何主题 / 阅读背景组合都可读。 */
  color: var(--c-text);
  background: var(--c-surface);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .28);
  opacity: .98;
  animation: toast-in .2s ease;
}
.toast.err { background: #c62828; color: #fff; }
/* ⭐ [1.4 A 组] 带按钮的提示条（util.js 的 toast opts.action）——
   `.toast-host` 整体 pointer-events:none（绝不能挡住正文），
   所以按钮必须**自己**把它打开，否则看着有按钮、按了没反应（本工程最忌讳的形态）。 */
.toast-with-act { display: flex; align-items: center; gap: 10px; border-radius: 14px; }
.toast-act {
  pointer-events: auto;
  flex: 0 0 auto;
  border: 0;
  padding: 2px 2px 2px 10px;
  margin-left: 2px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  border-left: 1px solid currentColor;
  opacity: .92;
  cursor: pointer;
}
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: .95; } }

.fatal {
  position: absolute; inset: 0; z-index: 99;
  background: #1b1b20; color: #ffd9d9;
  padding: calc(16px + var(--safe-t)) 16px 16px;
  overflow: auto;
}
.fatal pre { margin: 0; font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; font-family: ui-monospace, Menlo, Consolas, monospace; }

/* ═══════════════════════════════════════════════════════════
   新增：搜索面板 / 继续阅读 / 划词菜单 / 高亮列表
   ═══════════════════════════════════════════════════════════ */

/* ─────────── 搜索面板（阅读页底部上滑）─────────── */
.search-panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  padding: 10px 12px calc(10px + var(--safe-b));
  transform: translateY(110%);
  transition: transform .22s ease;
  max-height: 62vh;
  display: flex;
  flex-direction: column;
}
.search-panel.open { transform: translateY(0); }
.search-bar { display: flex; align-items: center; gap: 6px; }
.search-input {
  flex: 1; min-width: 0;
  height: 38px; padding: 0 12px;
  border: 1px solid var(--c-border); border-radius: 19px;
  background: var(--c-bg); color: var(--c-text);
  font-size: 15px; outline: none;
}
.search-input:focus { border-color: var(--c-accent); }
.search-results { margin-top: 10px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sr-row {
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  border-bottom: 1px solid var(--c-border);
}
.sr-row:active { background: var(--c-surface-2); }
.sr-idx {
  display: inline-block; min-width: 22px; color: var(--c-muted);
  font-variant-numeric: tabular-nums; font-size: 13px;
}
.sr-ex {
  font-size: 14px; line-height: 1.5; color: var(--c-text);
}

/* ─────────── 书架：继续阅读（限宽浅色小卡，不用大面积纯色）─────────── */
.continue-row { flex: none; padding: 10px 16px 2px calc(16px + var(--safe-l)); }
.continue-card {
  position: relative;
  display: flex; gap: 12px; align-items: center;
  padding: 10px 12px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  border-radius: 14px;
  cursor: pointer;
  overflow: hidden;
  transition: var(--motion);
}
.continue-card:active { background: var(--c-surface-2); }
.continue-cover {
  width: 38px; height: 52px; border-radius: 6px;
  background: var(--c-surface-2); flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; text-align: center; overflow: hidden;
  color: var(--c-muted);
}
.continue-cover img { width: 100%; height: 100%; object-fit: cover; }
.continue-meta { min-width: 0; flex: 1; }
.continue-kicker { font-size: 11.5px; color: var(--c-muted); letter-spacing: .04em; }
.continue-title {
  font-size: 15px; font-weight: 600; margin: 1px 0 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.continue-prog { height: 3px; border-radius: 2px; background: var(--c-surface-2); overflow: hidden; }
.continue-prog > i { display: block; height: 100%; background: var(--c-accent); }
.continue-pct { font-size: 11.5px; color: var(--c-muted); margin-top: 5px; }

/* ─────────── 划词菜单（阅读页选区上方浮出）─────────── */
.sel-popup {
  position: absolute; z-index: 70;
  display: flex; gap: 2px;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: 10px; padding: 4px;
  box-shadow: 0 6px 20px rgba(0,0,0,.22);
  /* 位置由 JS 计算 */
  /* ⭐ [1.10 · 2026-10-20] 可拖动：禁掉浏览器默认手势，否则一拖就变成页面滚动/再次划词 */
  touch-action: none;
  cursor: default;
}
.sel-popup button {
  border: 0; background: transparent; color: var(--c-text);
  font-size: 13px; padding: 7px 12px; border-radius: 7px; cursor: pointer;
  font-family: inherit;
}
.sel-popup button:active { background: var(--c-surface-2); }
.sel-popup .sp-ico { color: var(--c-accent); }

/* ─────────────── [10-11] 脚注 / 尾注浮层 ───────────────
   点正文里的上标标注 → 弹这张卡看注释（不把人扔到章末）。
   图层按文件头的阶梯走 66（≥3 自动在上下栏之上）；原生接管时顶/底栏是 ArkUI 画在
   Web 之上的物理层，压不住，只能靠 --nc-top / --nc-bottom 让位。 */
.fn-pop { position: absolute; inset: 0; z-index: 66; }
.fn-pop[hidden] { display: none; }
.fn-scrim { position: absolute; inset: 0; background: transparent; }
.fn-card {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(18px + var(--nc-bottom, 0px) + var(--safe-b, 0px));
  width: min(560px, calc(100% - 32px));
  max-height: min(46vh, 340px);
  display: flex; flex-direction: column;
  background: var(--c-surface); color: var(--c-text);
  border: 1px solid var(--c-border); border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .26);
  overflow: hidden;
}
.fn-head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px 9px 14px; border-bottom: 1px solid var(--c-border);
  flex: none;
}
.fn-title {
  flex: 1; font-size: 13px; font-weight: 600; color: var(--c-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fn-acts { display: flex; align-items: center; gap: 6px; }
.fn-go, .fn-x {
  border: 0; border-radius: 9px; font-family: inherit; cursor: pointer;
  padding: 6px 12px; font-size: 13px;
}
.fn-go { background: var(--c-accent); color: #fff; }
.fn-x { background: var(--c-surface-2); color: var(--c-text); padding: 6px 10px; }
.fn-body {
  padding: 11px 14px 14px; overflow-y: auto; -webkit-overflow-scrolling: touch;
  font-size: 14px; line-height: 1.62; color: var(--c-text);
  word-break: break-word; overflow-wrap: anywhere;
}

/* ─────────── [1.7 需求①] 输入框的自建划词菜单 ───────────
   系统那条划词条（含「问问小艺」）已在 ArkTS 侧被 onCreateMenu 全拦，
   输入框里的 全选/复制/剪切/粘贴 改由这一条浮层承担（粘贴走原生安全控件）。
   视觉与 .sel-popup 同源：同一套底色/描边/圆角/投影，只是内容换成一排纯文字。 */
.edit-menu {
  position: absolute; z-index: 72;
  display: flex; gap: 2px;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: 10px; padding: 4px;
  box-shadow: 0 6px 20px rgba(0,0,0,.22);
  animation: sp-in .12s ease;
  /* 位置由 JS 计算 */
}
.edit-menu .em-item {
  border: 0; background: transparent; color: var(--c-text);
  font-size: 13px; padding: 7px 12px; border-radius: 7px; cursor: pointer;
  font-family: inherit;
}
.edit-menu .em-item:active { background: var(--c-surface-2); }
/* 没有选中文字时 复制 / 剪切 压暗（点一下不做事太假，所以照旧可点、只是看着不可用） */
.edit-menu .em-dim { opacity: .38; }

/* ─────────── 高亮列表（复用抽屉+列表）─────────── */
.hl-row { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--c-border); cursor: pointer; }
.hl-row:active { background: var(--c-surface-2); }
.hl-swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--c-accent); }
.hl-main { flex: 1; min-width: 0; }
.hl-text { font-size: 14px; line-height: 1.5; color: var(--c-text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hl-note { font-size: 12px; color: var(--c-muted); margin-top: 2px; }
.hl-del, .bm-del {
  border: 0; background: transparent; color: var(--c-muted);
  padding: 6px; border-radius: 6px; cursor: pointer; flex: none;
}
.hl-del:active, .bm-del:active { background: var(--c-surface-2); }

/* ─────────── 笔记输入弹层 ─────────── */
.note-layer {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 65;
  background: var(--c-surface); border-top: 1px solid var(--c-border);
  padding: 12px; transform: translateY(110%); transition: transform .2s ease;
}
.note-layer.open { transform: translateY(0); }
.note-layer textarea {
  width: 100%; min-height: 84px; resize: none;
  border: 1px solid var(--c-border); border-radius: 10px;
  padding: 10px; font-size: 14px; font-family: inherit;
  background: var(--c-bg); color: var(--c-text); outline: none;
}
.note-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.note-actions button {
  border: 0; border-radius: 8px; padding: 8px 16px; font-size: 14px;
  font-family: inherit; cursor: pointer;
}
.note-cancel { background: var(--c-surface-2); color: var(--c-text); }
.note-save { background: var(--c-accent); color: var(--c-on-accent); }

/* ─────────── 字典释义弹窗 ─────────── */
.dict-box {
  position: absolute; z-index: 71;
  width: min(340px, 82vw); max-height: 58vh; overflow-y: auto;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: 12px; padding: 12px 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  /* ⭐ [2026-10-28] 这个框现在能拖动（见 reader.js 的 enableDrag）：
     桌面端给个抓手光标提示一下。手机上没有光标，靠手感 —— 按下就拖是挪框，
     按住一会儿再拖是选字（复制释义），两条路由 JS 按时间分开。
     ⚠️ 别在这儿写 touch-action:none —— 释义一屏放不下时要能上下滚，
        那一条由 JS 在真正拖动的那几十毫秒里临时设。 */
  cursor: grab;
}
.dict-box:active { cursor: grabbing; }
.dict-word { font-size: 16px; font-weight: 700; margin-bottom: 4px; word-break: break-word; }
.dict-phon { font-size: 13px; color: var(--c-muted); margin-bottom: 6px; }
.dict-def { font-size: 14px; line-height: 1.6; color: var(--c-text);
  white-space: pre-wrap; word-break: break-word; }
.dict-empty { color: var(--c-muted); font-size: 13px; }
/* ⭐⭐ [1.7] 多词库合并查词：每个词库释义块前用来源名（词库名）标注，块间用虚线分隔；
   第一块（紧接词条名/音标）不要上分隔线。 */
.dict-src { font-size: 11px; color: var(--c-muted); margin-top: 8px; margin-bottom: 2px;
  padding-top: 6px; border-top: 1px dashed var(--c-border); letter-spacing: .02em; }
.dict-word + .dict-src, .dict-phon + .dict-src { border-top: none; padding-top: 0; margin-top: 2px; }

/* ─────────── 书签列表行 ─────────── */
.bm-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--c-border);
  cursor: pointer;
}
.bm-row:active { background: var(--c-surface-2); }
.bm-ch {
  flex: 1; min-width: 0; font-size: 14px; color: var(--c-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bm-frac {
  flex: none; font-size: 12px; color: var(--c-muted);
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════
   UI 设计系统（第二轮）
   只参考「设计语言」，不搬代码：
     · 表面分层 window / view / card
     · 圆角规范（卡片 10 / 面板 16 / 控件 8 / 胶囊 full）
     · 盒式列表（前缀·标题·后缀 + 分隔线）
     · 胶囊图标按钮；动效只用颜色，150ms
   ═══════════════════════════════════════════════════════════ */

/* ── 设计令牌 ── */
:root {
  --radius: 10px;
  --radius-card: 10px;
  --radius-sheet: 16px;
  --radius-field: 8px;
  --radius-pill: 999px;
  --motion: color .15s ease, background-color .15s ease, border-color .15s ease, opacity .15s ease;
}

/* ── 主题调色（1.2「气质」轮：12 套，8 明 4 暗）──
   ⭐ 每套的 --c-bg / --c-read-bg、--c-text / --c-read-text、--c-accent 必须与
      原生 common/ReaderPrefs.ets 的 READER_BGS **逐字一致**（check-web 专项比对）——
      原生 WebView 容器底色取的是那边那份，不一致就会出现「中间纸色、四周一圈白」。
   色值参照 readest themes.ts 的公开配色参数人工誊写（只取色值，不碰代码）。 */
html[data-theme="default"] {
  --c-bg: #ffffff; --c-surface: #f2f2f2; --c-surface-2: #e6e6e6;
  --c-text: #171717; --c-muted: #6b6b6b; --c-border: rgba(0, 0, 0, .12);
  --c-card: #ffffff; --c-accent: #0066cc; --c-on-accent: #ffffff;
  --c-overlay: rgba(0, 0, 0, .38);
  --c-read-bg: #ffffff; --c-read-text: #171717;
}
html[data-theme="xuan"] {
  --c-bg: #fdf8ef; --c-surface: #f5ecdb; --c-surface-2: #eadfc8;
  --c-text: #3b372e; --c-muted: #8a8171; --c-border: rgba(59, 55, 46, .14);
  --c-card: #fbf6ea; --c-accent: #b08d57; --c-on-accent: #ffffff;
  --c-overlay: rgba(59, 55, 46, .34);
  --c-read-bg: #fdf8ef; --c-read-text: #3b372e;
}
html[data-theme="sepia"] {
  --c-bg: #f1e8d0; --c-surface: #e9dfc2; --c-surface-2: #ddd0ab;
  --c-text: #5b4636; --c-muted: #8a7862; --c-border: rgba(91, 70, 54, .16);
  --c-card: #f4ecd8; --c-accent: #008b8b; --c-on-accent: #f4ffff;
  --c-overlay: rgba(91, 70, 54, .34);
  --c-read-bg: #f1e8d0; --c-read-text: #5b4636;
}
html[data-theme="grass"] {
  --c-bg: #d7dbbd; --c-surface: #ccd1ad; --c-surface-2: #bcc39a;
  --c-text: #232c16; --c-muted: #5c6647; --c-border: rgba(35, 44, 22, .16);
  --c-card: #e0e4c9; --c-accent: #177b4d; --c-on-accent: #f2fbf5;
  --c-overlay: rgba(35, 44, 22, .34);
  --c-read-bg: #d7dbbd; --c-read-text: #232c16;
}
html[data-theme="sky"] {
  --c-bg: #cedef5; --c-surface: #c1d4f0; --c-surface-2: #adc5e8;
  --c-text: #262d48; --c-muted: #5d6680; --c-border: rgba(38, 45, 72, .16);
  --c-card: #d8e5f8; --c-accent: #2d53e5; --c-on-accent: #ffffff;
  --c-overlay: rgba(38, 45, 72, .34);
  --c-read-bg: #cedef5; --c-read-text: #262d48;
}
html[data-theme="cherry"] {
  --c-bg: #f0d1d5; --c-surface: #e9c3c8; --c-surface-2: #dfb2b8;
  --c-text: #4e1609; --c-muted: #8a5a56; --c-border: rgba(78, 22, 9, .14);
  --c-card: #f4dce0; --c-accent: #de3838; --c-on-accent: #fff5f5;
  --c-overlay: rgba(78, 22, 9, .34);
  --c-read-bg: #f0d1d5; --c-read-text: #4e1609;
}
html[data-theme="sunset"] {
  --c-bg: #fff7f0; --c-surface: #fbeadb; --c-surface-2: #f5dcc7;
  --c-text: #423126; --c-muted: #8d7a6a; --c-border: rgba(66, 49, 38, .14);
  --c-card: #fffaf4; --c-accent: #fe6b64; --c-on-accent: #ffffff;
  --c-overlay: rgba(66, 49, 38, .34);
  --c-read-bg: #fff7f0; --c-read-text: #423126;
}
html[data-theme="lotus"] {
  --c-bg: #eceff4; --c-surface: #dfe4ec; --c-surface-2: #cfd6e2;
  --c-text: #2e3440; --c-muted: #6b7382; --c-border: rgba(46, 52, 64, .14);
  --c-card: #f2f4f8; --c-accent: #5e81ac; --c-on-accent: #ffffff;
  --c-overlay: rgba(46, 52, 64, .34);
  --c-read-bg: #eceff4; --c-read-text: #2e3440;
}
html[data-theme="moon"] {
  --c-bg: #222222; --c-surface: #2b2b2b; --c-surface-2: #3a3a3a;
  --c-text: #d6d6d6; --c-muted: #9a9a9a; --c-border: rgba(255, 255, 255, .14);
  --c-card: #1e1e1e; --c-accent: #77bbee; --c-on-accent: #14202b;
  --c-overlay: rgba(0, 0, 0, .55);
  --c-read-bg: #222222; --c-read-text: #d6d6d6;
}
html[data-theme="solar"] {
  --c-bg: #002b36; --c-surface: #073642; --c-surface-2: #0a4150;
  --c-text: #93a1a1; --c-muted: #657b83; --c-border: rgba(131, 148, 150, .18);
  --c-card: #06313c; --c-accent: #268bd2; --c-on-accent: #002b36;
  --c-overlay: rgba(0, 0, 0, .55);
  --c-read-bg: #002b36; --c-read-text: #93a1a1;
}
html[data-theme="nord"] {
  --c-bg: #2e3440; --c-surface: #3b4252; --c-surface-2: #434c5e;
  --c-text: #d8dee9; --c-muted: #7b8495; --c-border: rgba(216, 222, 233, .14);
  --c-card: #353c4a; --c-accent: #88c0d0; --c-on-accent: #2e3440;
  --c-overlay: rgba(0, 0, 0, .55);
  --c-read-bg: #2e3440; --c-read-text: #d8dee9;
}
/* 玄墨（纯黑）：给 OLED 屏省电、暗处更不刺眼。 */
html[data-theme="ink"] {
  --c-bg: #000000; --c-surface: #141416; --c-surface-2: #1f1f22;
  --c-text: #b9b9bd; --c-muted: #7c7c82; --c-border: rgba(255, 255, 255, .14);
  --c-card: #101012; --c-accent: #7aa2f7; --c-on-accent: #06101f;
  --c-overlay: rgba(0, 0, 0, .62);
  --c-read-bg: #000000; --c-read-text: #b9b9bd;
}

/* ── 盒式列表（设置面板）── */
.sheet-body { padding: 12px 16px calc(26px + var(--safe-b)); }
.group { margin: 0 0 18px; }
.group:last-child { margin-bottom: 0; }
.group-title {
  font-size: 12px; font-weight: 600; letter-spacing: .06em;
  color: var(--c-muted); margin: 0 4px 8px;
}
.group-card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  padding: 0 14px;
}
.group-card > .row { border-bottom: 1px solid var(--c-border); }
.group-card > .row:last-child { border-bottom: 0; }
.row { padding: 13px 0; }
.row-label { font-size: 14.5px; }
.row-val { font-size: 13px; }
.seg button { border-radius: var(--radius-field); transition: var(--motion); }
.about code { border-radius: 4px; }
.danger-btn { border-radius: var(--radius-field); transition: var(--motion); }

/* ── 书架卡片 ── */
.book-cover { border-radius: 8px; }
.book-title { font-weight: 500; }
.lib-title { font-weight: 600; letter-spacing: -.01em; }

/* ── 图标按钮：胶囊 + 颜色动效 ── */
.btn-icon { border-radius: var(--radius-pill); transition: var(--motion); }
.btn-icon:active { background: var(--c-surface-2); }
.continue-cover { border-radius: 7px; }

/* ── 抽屉 / 顶栏：统一圆角与动效 ── */
.drawer-head { padding: 14px 16px; }
.toast { transition: var(--motion); }
.toc-list a { border-radius: var(--radius-field); transition: var(--motion); }

/* ─────────── 页面缩放：变换层（固定版式 PDF/漫画）─────────── */
/* 包住 foliate-view，用 transform 做增量缩放与平移；
   transform-origin: 0 0 —— 锚点由 JS 按「捏合中心」算，不是固定左上角。 */
.zoom-layer {
  position: absolute; inset: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.zoom-layer foliate-view { width: 100%; height: 100%; display: block; }

/* ─────────── 底部工具栏：‹ 页码/总页 [进度条] › ─────────── */
.rbar-bottom { gap: 8px; }
.rbar-bottom .btn-icon { width: 38px; height: 38px; }
.rbar-bottom .btn-icon .ico { width: 20px; height: 20px; }
.pg-wrap {
  flex: none; display: inline-flex; align-items: center; gap: 2px;
  justify-content: center; min-width: 54px;
  font-size: 12.5px; color: var(--c-muted); font-variant-numeric: tabular-nums;
}
.pg-wrap .pg { min-width: 0; text-align: center; }
/* 底部栏现在只显示**一个**值（全书百分比），不再有「当前 / 总数」两个值，
   所以分隔符永久隐藏 —— 否则会剩一个孤零零的「/」，看着像缺了内容。
   （将来若要恢复「3 / 20」这种双值显示，把这一行放开即可。） */
.pg-sep { display: none; }

/* ─────────── 顶栏「更多」圆角菜单 ─────────── */
.more-menu {
  position: absolute; z-index: 30;
  top: calc(var(--bar-h) + var(--safe-t) + 6px);
  right: calc(8px + var(--safe-r));
  width: 202px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sheet);
  box-shadow: 0 14px 34px -12px rgba(0, 0, 0, .38);
  padding: 6px;
  display: flex; flex-direction: column;
  animation: mm-in .16s ease;
}
@keyframes mm-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.mm-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 11px 12px;
  border: 0; border-radius: var(--radius-field);
  background: transparent; color: var(--c-text);
  font-size: 14.5px; font-family: inherit; text-align: start;
  cursor: pointer; transition: var(--motion);
}
.mm-item:active { background: var(--c-surface-2); }
.mm-item[disabled] { opacity: .42; cursor: default; }
.mm-item .ico { width: 19px; height: 19px; flex: none; color: var(--c-muted); }
.mm-sep { height: 1px; background: var(--c-border); margin: 5px 8px; }

/* ─────────── 工具栏「唤出把手」（藏起来后的唯一入口）─────────── */
.bars-handle {
  position: absolute; z-index: 9;
  top: 0; left: 50%; transform: translateX(-50%);
  width: 78px; height: calc(22px + var(--safe-t));
  padding: var(--safe-t) 0 0;
  display: none; align-items: center; justify-content: center;
  border: 0; cursor: pointer;
  background: var(--c-surface);
  border-radius: 0 0 12px 12px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .20);
}
.bars-handle span { width: 34px; height: 4px; border-radius: 2px; background: var(--c-muted); opacity: .65; }
body.ui-hidden .bars-handle { display: flex; }

/* ─────────── 缩放提示（沉浸光感胶囊）───────────
   项目 compatibleSdk 是 API 22，系统的沉浸光感（systemMaterial）用不了 ——
   照 Glass.ets 的「组合拳」思路在网页层逼近同一质感：
   backdrop-filter 模糊+提饱和 ≈ 光感；半透明底 + 1vp 边缘高光描边 + 内侧顶部高光 ≈ 玻璃折光；
   胶囊圆角。只在**用户操作**（捏合 / 双击 / Ctrl±）时出现，程序性下发不再闪它。 */
/* ─────────── 滚动位置小条（临时排查用；开关同上）───────────
   贴在右边缘的一条细轨道 + 滑块。滑块高度 = 视口占内容的比例，位置 = 已滚过的比例。
   ⚠️ pointer-events:none —— 绝不吃触摸（右边缘正好是"下一页"热区！）。
   ⚠️ 只给文字书滚动模式用（分页模式有原生进度条）。 */
.scroll-ind {
  position: absolute; z-index: 44;
  right: 2px; top: 8px; bottom: 8px; width: 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, .12);
  pointer-events: none;
}
.scroll-ind-thumb {
  position: absolute; left: 0; right: 0; top: 0;
  height: 14%;
  border-radius: 3px;
  background: rgba(0, 122, 255, .75);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .35);
}
body.is-dark-reader .scroll-ind { background: rgba(255, 255, 255, .14); }

/* ─────────── 诊断浮层（临时排查用；开关见 reader.js 的 TAP_OSD）───────────
   贴在底部、小字号、半透明深底、**不加 backdrop 模糊**、**pointer-events:none**：
     · 不明显遮挡正文（旧版复用 .zoom-hint 时是居中 + 模糊，看着像"灰色圆球盖住字"）；
     · 绝不吃触摸（那样会自己吞掉下一次点按，反而制造"点不动"）。
   ⚠️ 上架前把 reader.js 的 TAP_OSD 改成 false —— 那时这个元素根本不会被显示。 */
.tap-osd {
  position: absolute; z-index: 45;
  left: 10px; right: 10px; bottom: 6px;
  padding: 6px 10px; border-radius: 10px;
  background: rgba(12, 12, 14, .84);
  color: #F2F2F4; font-size: 12px; line-height: 1.5;
  font-variant-numeric: tabular-nums;
  word-break: break-all; text-align: left;
  pointer-events: none;
}
body.native-chrome .tap-osd { bottom: 96px; }

/* ══ [2026-11-14 · 鱼干需求文档第三条] 阅读区**一律不要滚动条** ══
   截图里"屏幕正中央那条白色胶囊"就是它：竖排时内容比容器窄，滚动条贴着内容右边，
   视觉上就像悬在正文中间。滚动/翻页本来都由手势驱动，滚动条在阅读页没有任何用处。
   ⚠️ 必须写在外层（书页 iframe 的 scrolling=no，那边本来就没有滚动条），
      所以要盖住 #view-host 及其所有后代（foliate 的 scroller 也在这棵树下）。
   ⚠️ scrollbar-width 只管 Firefox 系；::-webkit-scrollbar 管 ArkWeb/Chromium 系，两条都要。 */
#view-host, #view-host *, body, html {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
#view-host::-webkit-scrollbar, #view-host *::-webkit-scrollbar,
body::-webkit-scrollbar, html::-webkit-scrollbar {
  width: 0 !important; height: 0 !important; display: none !important;
}

/* ⚠️⚠️ [2026-11-14 · 鱼干需求文档第三条] 原来这个提示是 left/top 50% **居中**的，
   带 backdrop 模糊 + 白渐变，压在正文正中间 —— 竖排时正好盖住字，看着像个"巨大的白色胶囊"。
   ⇒ 挪到**底部**、缩小、降低不透明度：提示只是闪 1 秒的回执，不该占用阅读区。
   ⚠️ 与 reader.html 里那条注释同源（诊断上屏也是"贴底、绝不复用居中胶囊"）。 */
.zoom-hint {
  position: absolute; z-index: 40;
  left: 50%; top: auto; bottom: 96px;
  transform: translateX(-50%);
  padding: 5px 12px; border-radius: 999px;
  color: #fff; font-size: 12px; font-variant-numeric: tabular-nums;
  letter-spacing: .3px;
  background: linear-gradient(145deg, rgba(60, 60, 66, .38), rgba(22, 22, 26, .52));
  border: 1px solid rgba(255, 255, 255, .28);
  box-shadow: 0 10px 28px -12px rgba(0, 0, 0, .5),
              inset 0 1px 0 rgba(255, 255, 255, .22);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  backdrop-filter: blur(24px) saturate(1.6);
  pointer-events: none;
}
/* 不支持 backdrop-filter 的老内核：底色加深保可读（纯 CSS 降级） */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .zoom-hint { background: rgba(10, 10, 12, .82); }
}

/* ─────────── 打开 / 排版中的居中提示 ─────────── */
.loading {
  position: absolute; z-index: 40;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; border-radius: var(--radius-sheet);
  background: var(--c-card);
  border: 1px solid var(--c-border);
  box-shadow: 0 16px 40px -18px rgba(0, 0, 0, .45);
  pointer-events: none;
}
.loading-spin {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-accent);
  animation: szspin .8s linear infinite;
}
@keyframes szspin { to { transform: rotate(360deg); } }
.loading-text { font-size: 14px; color: var(--c-muted); }

/* ─────────── 左侧栏：目录 ｜ 书签 ｜ 笔记（分页）─────────── */
.side-drawer { width: min(88vw, 340px); }
.sd-tabs {
  flex: none; display: flex; align-items: stretch; gap: 4px;
  padding: 8px; border-bottom: 1px solid var(--c-border);
}
.sd-tab {
  flex: 1; padding: 9px 4px;
  border: 0; border-radius: var(--radius-field);
  background: transparent; color: var(--c-muted);
  font-size: 14px; font-family: inherit; cursor: pointer;
  transition: var(--motion);
}
.sd-tab.on { background: var(--c-surface-2); color: var(--c-text); font-weight: 600; }
.sd-close { flex: none; width: 34px; height: 34px; align-self: center; }
.sd-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* 笔记页：整本书的随记输入框 */
.sd-note { flex: none; padding: 12px 12px 4px; }
.sd-note-input {
  width: 100%; min-height: 92px; max-height: 28vh; resize: vertical;
  border: 1px solid var(--c-border); border-radius: var(--radius-field);
  padding: 10px; font-size: 14px; line-height: 1.6; font-family: inherit;
  background: var(--c-card); color: var(--c-text); outline: none;
}
.sd-note-input:focus { border-color: var(--c-accent); }
.sd-sub {
  flex: none; padding: 10px 14px 4px;
  font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--c-muted);
}

/* ─────────── 右侧批注栏（随记 + 高亮，置顶常驻）───────────
   复用 .drawer 的基底（absolute / flex 列 / 过渡），但锚定在右边滑入。
   .drawer 基类的 left:0 / border-right / translateX(-102%) 全被这里覆盖。 */
.anno-drawer {
  z-index: 8;
  top: 0; bottom: 0; right: 0; left: auto;
  width: min(88vw, 360px);
  flex-direction: column;
  background: var(--c-surface);
  border-right: none;
  border-left: 1px solid var(--c-border);
  transform: translateX(102%);
  padding-top: var(--safe-t);
  padding-bottom: var(--safe-b);
}
.anno-drawer.open { transform: none; }

.anno-head {
  flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 8px 10px 16px;
  border-bottom: 1px solid var(--c-border);
  font-size: 15px; font-weight: 500; color: var(--c-text);
}
.anno-head .btn-icon { width: 36px; height: 36px; }

.anno-body {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.anno-sub {
  flex: none;
  font-size: 12px; font-weight: 600; letter-spacing: .06em;
  color: var(--c-muted);
}
.anno-note { flex: none; padding: 4px 12px 8px; }
.anno-note .anno-sub { padding: 8px 0 6px; }
.anno-hl {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  margin-top: 4px;
  border-top: 1px solid var(--c-border);
}
.anno-hl .anno-sub { padding: 12px 16px 6px; }
.hl-list {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 4px 8px 16px;
  -webkit-overflow-scrolling: touch;
}

/* ─────────── 批注栏「停靠」模式（电脑 / 平板：常驻不遮正文）───────────
   鱼干要的 readest 那种：右侧**一直**有一个可以随手记的地方，而不是点开才滑出来。

   实现要点（都踩过的坑）：
     · 宽度**由原生下发**（`__reader.setAnnoDock(w)`，w=0 表示不常驻）→ 只此一处真相源，
       网页自己不猜设备类型（判宽度在 Web 组件里不可靠：分屏/侧栏都会改内容区宽度）。
     · `#view-host` 右边让出面板宽度 → foliate 的 ResizeObserver 自动重排，
       和「页眉页脚让高度」用的是同一套机制（见 §页眉页脚那段）。
       ⚠️ **千万别给 right 加 transition**：重排是跟着尺寸变化连续触发的，
          加了过渡等于让引擎在动画期间反复重排（卡顿 + 位置错乱）。
     · 常驻时**不要遮罩**：有遮罩就等于「点正文先关面板」，正文点不动。
     · 面板自己的 ✕ 在常驻模式下藏起来：收起/展开交给原生顶栏那颗「批注」（唯一入口，
       否则网页和原生各记一份开合状态，必然对不上）。
     · `--nc-top` / `--nc-bottom` = 原生顶/底栏占掉的高度（原生 setChromeInsets 下发），
       面板要**让开这两条**，否则它的表头会被原生顶栏盖住（原生 chrome 在 Web 之上）。 */
body.anno-dock #anno-drawer {
  display: flex;
  width: var(--anno-w, 360px);
  transform: none;
  transition: none;
  padding-top: max(var(--nc-top, 0px), var(--safe-t));
  padding-bottom: max(var(--nc-bottom, 0px), var(--safe-b));
}
body.anno-dock #view-host { right: var(--anno-w, 360px); }
body.anno-dock .rbar { right: calc(var(--anno-w, 360px) + var(--safe-r)); }
body.anno-dock .rhf { right: var(--anno-w, 360px); }
body.anno-dock #scrim { display: none !important; }
body.anno-dock #anno-close { display: none; }

/* 原生壳里（不管常驻还是浮层）都要让开原生顶/底栏，否则表头的 ✕ 会压在顶栏底下点不着。
   ⚠️ `display` 那条例外写在下面 §一「原生接管模式」的 hide 列表之后 ——
      同一个选择器，靠源序覆盖，写在前面会被 `display:none !important` 吃掉。 */
body.native-chrome #anno-drawer {
  padding-top: max(var(--nc-top, 0px), var(--safe-t));
  padding-bottom: max(var(--nc-bottom, 0px), var(--safe-b));
}

/* ─────────── 高亮 / 批注卡片（readest 风格）───────────
   左缘一条彩色竖条（颜色即高亮色），右边是原文摘录 + 可选笔记 + 时间 + 编辑/删除。 */
.hl-card {
  display: flex;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  margin-bottom: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: var(--motion);
}
.hl-card:active { background: var(--c-surface-2); }
/* ⭐ [1.3 五轮] 点书上的标注 → 不弹批注卡（鱼干：「完全不弹批注卡」），
   改成「右侧列表里把这一条闪一下」。闪 = 2 秒的一次性动画，用完由 JS 摘掉类名。 */
.hl-card.flash { border-color: var(--c-accent); box-shadow: 0 0 0 2px var(--c-accent); }
@keyframes hl-flash { 0%, 100% { background: var(--c-card); } 40% { background: var(--c-surface-2); } }
.hl-card.flash { animation: hl-flash 1.1s ease 2; }
.hl-card-bar { flex: none; width: 4px; }   /* 颜色由 JS 内联写入 */
.hl-card-body { flex: 1; min-width: 0; padding: 10px 12px; }
.hl-card-text {
  font-size: 13.5px; line-height: 1.55; color: var(--c-text);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.hl-card-note {
  margin-top: 6px; padding-top: 6px;
  border-top: 1px dashed var(--c-border);
  font-size: 13px; line-height: 1.5; color: var(--c-text);
}
.hl-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px; gap: 8px;
}
.hl-card-time { font-size: 11.5px; color: var(--c-muted); flex: 1; min-width: 0; }
.hl-card-actions { display: flex; gap: 2px; flex: none; }
.hl-card-btn {
  border: 0; background: transparent; color: var(--c-muted);
  width: 30px; height: 30px; border-radius: 6px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.hl-card-btn .ico { width: 16px; height: 16px; stroke-width: 1.8; }
.hl-card-btn:active { background: var(--c-surface-2); }
.hl-card-del:hover, .hl-card-del:active { color: #d94141; }

/* 笔记输入弹层标题（编辑已有笔记时显示「编辑笔记」）*/
.note-layer-title {
  font-size: 14px; font-weight: 600;
  margin: 2px 2px 10px; color: var(--c-text);
}

/* 顶栏「批注」按钮激活态（与加书签星星同款强调色）*/
#btn-anno.on { color: var(--c-accent); }


/* ─────────── 划词工具条（图标一排 + 颜色一排）─────────── */
.sel-popup {
  flex-direction: column; gap: 4px;
  padding: 6px; border-radius: var(--radius-sheet);
  animation: sp-in .12s ease;
}
@keyframes sp-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.sp-row { display: flex; gap: 2px; }
.sel-popup .sp-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 34px; padding: 0;
  border-radius: var(--radius-field);
  color: var(--c-text);
}
.sel-popup .sp-btn .ico { width: 19px; height: 19px; stroke-width: 1.7; }
.sel-popup .sp-btn:active { background: var(--c-surface-2); }
.sp-colors { display: flex; gap: 8px; padding: 2px 6px 0; justify-content: center; }
.sel-popup .sp-dot {
  width: 20px; height: 20px; padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, .18);
}
.sel-popup .sp-dot.on { box-shadow: 0 0 0 2px var(--c-card), 0 0 0 3.5px var(--c-accent); }

/* ─────────── 1.3 划词菜单：样式一行（高亮/下划线/波浪线/字色）─────────── */
.sp-styles { gap: 4px; justify-content: center; padding: 0 4px; }
.sel-popup .sp-style {
  display: inline-flex; align-items: center; gap: 5px;
  height: 32px; padding: 0 9px;
  border-radius: var(--radius-field);
  color: var(--c-text);
  font-size: 12px;
}
.sel-popup .sp-style:active { background: var(--c-surface-2); }
.sel-popup .sp-style.on {
  background: var(--c-surface);
  box-shadow: inset 0 0 0 1.5px var(--c-accent);
}
.sp-glyph { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; }
.sp-style-txt { font-size: 12px; line-height: 1; }
/* 「+」自定义颜色 */
.sel-popup .sp-dot-add {
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px dashed var(--c-border);
  color: var(--c-muted);
}
.sel-popup .sp-dot-add .ico { width: 13px; height: 13px; stroke-width: 2; }

/* ─────────── 1.3 自定义颜色选择器 ─────────── */
.cp-layer { gap: 10px; }
.cp-grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 7px;
  max-height: 168px; overflow-y: auto; padding: 2px;
}
.cp-swatch {
  height: 26px; padding: 0; border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, .14);
}
.cp-swatch:active { transform: scale(.92); }
.cp-row { display: flex; align-items: center; gap: 10px; }
.cp-preview {
  flex: none; width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--c-border);
}
.cp-input {
  flex: 1; min-width: 0; height: 34px; padding: 0 10px;
  border-radius: var(--radius-field);
  border: 1px solid var(--c-border);
  background: var(--c-surface-2); color: var(--c-text);
  font-size: 14px; font-family: ui-monospace, monospace;
}

/* ─────────── 1.3 改样式 / 改颜色 面板 ─────────── */
.ms-row { display: flex; flex-direction: column; gap: 6px; }
.ms-title { font-size: 12px; color: var(--c-muted); }
.ms-items { display: flex; flex-wrap: wrap; gap: 6px; }
.ms-btn {
  height: 32px; padding: 0 12px;
  border-radius: var(--radius-field);
  border: 1px solid var(--c-border);
  background: var(--c-surface-2); color: var(--c-text);
  font-size: 13px;
}
.ms-btn.on { background: var(--c-surface); box-shadow: inset 0 0 0 1.5px var(--c-accent); }
.ms-dot {
  width: 26px; height: 26px; padding: 0; border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, .18);
}
.ms-dot.on { box-shadow: 0 0 0 2px var(--c-card), 0 0 0 3.5px var(--c-accent); }
.ms-dot-add {
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px dashed var(--c-border); color: var(--c-muted);
}
.ms-dot-add .ico { width: 14px; height: 14px; stroke-width: 2; }

/* ─────────── 1.3 批注卡：样式徽标 / 章节 ─────────── */
.hl-card-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.hl-card-style {
  flex: none;
  font-size: 10.5px; line-height: 1; padding: 3px 6px; border-radius: 4px;
  background: var(--c-surface-2); color: var(--c-muted);
}
.hl-card-ch {
  flex: 1; min-width: 0;
  font-size: 11px; color: var(--c-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* ⭐ 八轮续：工具区从「排序 + 导出」变成「筛选 + 排序 + 导出」，窄栏（手机抽屉 / 360px 侧栏）
   放不下时会横向溢出 → 允许换行（工具区整体落到第二行、右对齐），而不是把计数挤没。 */
.anno-sub-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; row-gap: 6px; }
.anno-tools { display: flex; gap: 6px; flex: none; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.btn-mini {
  height: 26px; padding: 0 10px;
  border-radius: 13px;
  border: 1px solid var(--c-border);
  background: var(--c-surface-2); color: var(--c-muted);
  font-size: 11.5px;
}
.btn-mini:active { background: var(--c-surface); color: var(--c-text); }

/* ── 随包字体：霞鹜文楷（OFL 1.1，见 web/fonts/OFL.txt 与 THIRD-PARTY-NOTICES）──
   ⚠️ 与 `settings.js` 里那份 @font-face **同名同源、必须保持一致**：
      那份是注入进「书页 iframe」的；这份是**顶层文档**用的 —— 金句卡片画在顶层 canvas 上，
      canvas 拿不到 iframe 里的字体声明。
   ⚠️ 这个字体 24MB，但 @font-face 是**惰性**的：顶层正文用的是应用字体栈，不会匹配到它，
      所以启动时**不会**下载；只有金句卡片真的选了「文楷」，JS 调 `document.fonts.load()` 才拉取。 */
@font-face {
  font-family: 'LXGW WenKai';
  src: url('/fonts/LXGWWenKai-Regular.ttf') format('truetype');
  font-display: swap;
}

/* ─────────── 1.3 金句卡片 ─────────── */
.quote-card { gap: 12px; }
/* 卡片预览：canvas 是 3:4 的「替换元素」→ 用 max-width/max-height 双限即可自动等比缩放，
   不再靠 `height:100%` 去猜父高（矮窗/高窗都会算出怪高度）。
   `min(38vh, 340px)` = 高屏不虚胖、矮屏不挤压。 */
.qc-stage { display: flex; justify-content: center; }
.qc-canvas {
  display: block;
  max-width: 100%;
  max-height: min(38vh, 340px);
  width: auto; height: auto;
  border-radius: 12px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .18);
}
.qc-themes { display: flex; gap: 12px; justify-content: center; }
.qc-theme {
  width: 30px; height: 30px; padding: 0; border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, .18);
  flex: none;
}
.qc-theme.on { box-shadow: 0 0 0 2px var(--c-card), 0 0 0 3.5px var(--c-accent); }

/* 金句卡片：字体 / 字号 两个下选框（八轮续） */
.qc-fonts { display: flex; gap: 10px; }
.qc-field { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.qc-field-label { flex: none; font-size: 12.5px; color: var(--c-muted); }
.qc-sel {
  flex: 1; min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  background: var(--c-surface-2); color: var(--c-text);
  font-size: 13px; font-family: inherit;
}
.qc-sel:focus { outline: none; border-color: var(--c-accent); }

/* ───── 1.3 七/八轮：金句卡片「编辑界面」置中浮窗（与分享浮窗同款外观）─────
   ⭐ 八轮：整体改「纵向 flex + 统一 gap、子项不伸缩」——之前每个子元素自己写零散 margin，
     偏偏最显眼的卡片预览一个 margin 都没有 → 全挤成一坨。现在间距只有「一处来源」，
     加减内容不用再逐个补 margin。 */
.qc-box {
  position: absolute; left: 50%; top: 50%;
  width: min(400px, 92vw);
  max-height: 90vh; overflow-y: auto;
  transform: translate(-50%, -50%) scale(.96);
  opacity: 0;
  transition: opacity .16s ease, transform .16s ease;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
  padding: 20px 22px 18px;
  display: flex; flex-direction: column; gap: 16px;
}
.qc-box > * { flex: none; }                      /* 子项不参与伸缩，超高就整体滚动 */
.qc-box .share-card-head { margin-bottom: 0; }   /* 间距交给 gap，去掉各自 margin 叠罗汉 */
.qc-box .share-withbook { margin-bottom: 0; }
.share-card-wrap.open .qc-box { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* 编辑区：原文 / 批注两个 textarea（margin 归零，间距统一由 .qc-box 的 gap 给） */
.qc-edit {
  display: block; width: 100%;
  margin: 0;
  padding: 11px 13px;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  background: var(--c-surface-2); color: var(--c-text);
  font-size: 14px; line-height: 1.55;
  font-family: inherit;
  resize: vertical; min-height: 52px;
}
.qc-edit.note { min-height: 44px; font-size: 13px; color: var(--c-muted); }
.qc-edit:focus { outline: none; border-color: var(--c-accent); }

/* 按钮行：取消 / 分享 / 保存到相册（布局属性放这里，颜色各自管，避开优先级踩踏）
   ⭐ 三个并排要能塞进最窄的手机 → 默认不换行；窄屏再用媒体查询收字号/内边距，
      避免「保存到相册」被折成两行（截图里那个）。 */
.qc-actions { display: flex; gap: 10px; }
.qc-actions button {
  flex: 1;
  padding: 12px 10px; font-size: 14px; font-family: inherit;
  border: 0; border-radius: 11px; cursor: pointer;
  white-space: nowrap;
}
.qc-share { background: var(--c-accent); color: var(--c-on-accent); }

/* 极窄屏（小手机 / 窄桌面窗口）：收紧内边距与按钮，保持三按钮同一行 */
@media (max-width: 400px) {
  .qc-box { padding: 16px 15px 15px; gap: 14px; }
  .qc-actions { gap: 7px; }
  .qc-actions button { padding: 11px 6px; font-size: 13px; }
}

/* 金句卡片编辑浮窗：分组标题 + 文本框 / 滑杆 / 文件 / 勾选（1.7 大改补齐，浏览器兜底用） */
.qc-grp { font-size: 12px; font-weight: 600; color: var(--c-muted); letter-spacing: .04em; margin-top: 2px; }
.qc-input {
  flex: 1; min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--c-border); border-radius: 10px;
  background: var(--c-surface-2); color: var(--c-text);
  font-size: 13px; font-family: inherit;
}
.qc-input:focus { outline: none; border-color: var(--c-accent); }
.qc-range { flex: 1; min-width: 0; accent-color: var(--c-accent); }
.qc-file { flex: 1; min-width: 0; font-size: 12px; color: var(--c-muted); }
.qc-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--c-text); cursor: pointer; }
.qc-chk { flex: none; width: 16px; height: 16px; accent-color: var(--c-accent); }

/* ───── [1.7 · UI 重构] 金句卡片：书籍信息行内（开关+输入）、自定义色、次按钮、主按钮阴影 ───── */
.qc-inline { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.qc-inline .qc-input { flex: 1; }
.qc-color { flex: none; width: 40px; height: 30px; padding: 0; border: 1px solid var(--c-border);
  border-radius: 8px; background: none; cursor: pointer; }
.qc-save { background: var(--c-surface-2); color: var(--c-text); }
.qc-share.on { box-shadow: 0 4px 12px rgba(47, 107, 255, .35); font-weight: 600; }

/* ─────────── 1.3 导出 Markdown 兜底框 ─────────── */
.export-card { gap: 10px; }
.export-ta {
  width: 100%; height: 40vh; min-height: 180px;
  padding: 10px; border-radius: 8px;
  border: 1px solid var(--c-border);
  background: var(--c-surface-2); color: var(--c-text);
  font-size: 12.5px; line-height: 1.55;
  font-family: ui-monospace, monospace;
  resize: none;
}

/* ─────────── 书签星星：当前位置已加书签 → 填充变色 ─────────── */
#btn-add-bm.on { color: var(--c-accent); }
#btn-add-bm.on .ico { fill: var(--c-accent); stroke: var(--c-accent); }

/* ═══════════════════════════════════════════════════════════
   第三轮：主页文件夹 / 主题弹层 / 批注卡 / 划词删除
   ═══════════════════════════════════════════════════════════ */

/* ─────────── 书架顶栏：搜索框 + 返回 ─────────── */
.lib-head { gap: 8px; }
.lib-back { flex: none; }
.lib-search {
  flex: 1; min-width: 0;
  height: 38px; padding: 0 15px;
  /* 提高对比度：浅灰底换成页面底色 + 更实的描边，避免「几乎看不见」 */
  border: 1px solid var(--c-surface-2); border-radius: var(--radius-pill);
  background: var(--c-bg); color: var(--c-text);
  font-size: 14px; font-family: inherit; outline: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .05);
}
.lib-search::placeholder { color: var(--c-muted); opacity: 1; }
.lib-search:focus { border-color: var(--c-accent); }
.lib-search::-webkit-search-cancel-button { -webkit-appearance: none; }

/* 面包屑（进入文件夹后显示） */
.lib-crumb {
  flex: none;
  display: flex; align-items: center; gap: 7px;
  padding: 0 16px 8px calc(16px + var(--safe-l));
  font-size: 13px; color: var(--c-muted);
}
.crumb-seg { cursor: pointer; }
.crumb-seg:active { color: var(--c-accent); }
.crumb-sep { color: var(--c-border); }
.crumb-cur { color: var(--c-text); font-weight: 600; }
.crumb-n { margin-left: auto; font-variant-numeric: tabular-nums; }

/* ─────────── 文件夹卡片（封面聚合）───────────
   与书卡同构：封面区（拼图）+ 两行标题 + 元数据行，所以高度完全对齐。 */
.fc-collage {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 8px; overflow: hidden;
  background: var(--c-surface-2);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .14);
  display: grid; gap: 1px;
}
.fc-cell { overflow: hidden; background: var(--c-card); }
.fc-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fc-cell .noimg {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--c-muted); text-align: center; padding: 4px;
}
/* 0 本：空文件夹图标 */
.fc-n0 .fc-empty {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: center;
  color: var(--c-muted);
}
.fc-empty .ico { width: 34px; height: 34px; stroke-width: 1.4; opacity: .7; }
/* 1 本 */
.fc-n1 { grid-template-columns: 1fr; }
/* 2 本：左右分栏 */
.fc-n2 { grid-template-columns: 1fr 1fr; }
/* 3 本：左大右两小 */
.fc-n3 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.fc-n3 .fc-cell:nth-child(1) { grid-row: 1 / 3; }
/* 4 本：田字格 */
.fc-n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }

/* 右上角：常驻的册数角标（区分文件夹 vs 单本书） */
.fc-badge {
  position: absolute; top: 5px; right: 5px; z-index: 3;
  padding: 2px 7px; border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, .62); color: #fff;
  font-size: 11px; font-variant-numeric: tabular-nums;
}
/* >4 本：田字格上盖一层暗色遮罩，居中显示 +N */
.fc-shade {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .5); color: #fff;
  font-size: 20px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
/* 元数据行：文件夹只显示聚合进度（册数已在封面角标上） */
.folder-prog { font-variant-numeric: tabular-nums; }

/* 末尾常驻的「＋ 新建文件夹」占位卡：与书卡同尺寸 */
.folder-add { align-items: stretch; }
.fa-box {
  aspect-ratio: 2 / 3;
  border: 1.5px dashed var(--c-border); border-radius: 8px;
  background: transparent; color: var(--c-muted);
  display: flex; align-items: center; justify-content: center;
  transition: var(--motion);
}
.fa-box .ico { width: 26px; height: 26px; stroke-width: 1.5; }
.folder-add:hover .fa-box { border-color: var(--c-accent); color: var(--c-accent); }
.folder-add .folder-title { text-align: center; color: var(--c-muted); font-weight: 400; }

/* 拖拽悬停：封面高亮放大 */
.folder-card.drop-hover .fc-collage {
  transform: scale(1.04);
  box-shadow: 0 0 0 2px var(--c-accent), 0 10px 24px -8px rgba(0, 0, 0, .4);
}
.book.dragging { opacity: .45; }

/* 书封上的操作按钮（历史遗留类，现由「选择态」取代，保留以免样式引用报错） */
.book-ren { right: 30px; }
.book-mov { right: 56px; }

/* ─────────── 书架「选择态」（像文件管理器）─────────── */
/* 选中的格子：灰底 + 强调色描边（和参考截图里那张卡片一致） */
.book.sel, .folder-card.sel {
  background: var(--c-surface-2);
  box-shadow: 0 0 0 1.5px var(--c-accent);
}
.book img { -webkit-user-drag: none; }

/* 选择态里禁止网格滚动（拖动 = 涂抹多选，不是翻页） */
body.sel-mode .lib-grid { touch-action: none; }
body.sel-mode .book { cursor: pointer; }

/* 底部操作条：已选 N 本 ｜ 重命名 / 收纳 / 删除 / 取消 */
.sel-bar {
  position: absolute; z-index: 40;
  left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px calc(10px + var(--safe-b)) calc(14px + var(--safe-l));
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  box-shadow: 0 -6px 20px -12px rgba(0, 0, 0, .4);
  animation: selbar-in .18s ease;
}
@keyframes selbar-in { from { transform: translateY(100%); } to { transform: none; } }
.sel-count { flex: none; font-size: 14px; color: var(--c-text); font-weight: 500; }
.sel-acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.sel-bar-btn {
  border: 0; border-radius: var(--radius-field);
  padding: 9px 14px;
  background: var(--c-surface-2); color: var(--c-text);
  font-size: 13.5px; font-family: inherit; cursor: pointer;
  transition: var(--motion);
}
.sel-bar-btn:active { background: var(--c-border); }
.sel-bar-btn.danger { color: #d94141; }

/* ─────────── 批注展示卡（点书上的高亮弹出，持久）─────────── */
.note-card-wrap { position: absolute; inset: 0; z-index: 66; }
.note-card-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .18); }
.note-card {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 68vh;
  display: flex; flex-direction: column;
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  padding: 14px 16px calc(14px + var(--safe-b));
  transform: translateY(110%);
  transition: transform .2s ease;
  overflow: hidden;
}
.note-card-wrap.open .note-card { transform: translateY(0); }
.note-card-head {
  flex: none;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.note-card-title { font-size: 14px; font-weight: 600; color: var(--c-text); }
.note-card-time { font-size: 11.5px; color: var(--c-muted); }
/* 摘录：左缘彩色竖条（高亮色），可多行 */
.note-card-text {
  flex: none;
  max-height: 18vh; overflow-y: auto;
  padding: 6px 10px; margin-bottom: 10px;
  border-left: 3px solid var(--c-accent); border-radius: 4px;
  background: var(--c-card);
  font-size: 13.5px; line-height: 1.6; color: var(--c-text);
}
/* 笔记全文：可滚动，多长都看得完 */
.note-card-note {
  flex: 1; min-height: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  font-size: 14.5px; line-height: 1.75; color: var(--c-text);
  white-space: pre-wrap; word-break: break-word;
  margin-bottom: 12px;
}

/* ─────────── 分享浮窗（置中，手机 / 电脑统一；1.3 七轮）───────────
   之前复用 .note-card（底部横条）+ 未定义样式的 nc-row → 丑。
   独立成 .share-card：置中、小而聚焦，不再复用批注卡的底部弹出布局。
   ⚠️ 选择器全部单类名（0,1,0），且不复用 .sel-popup/.note-actions 等容器
      —— 避免容器级 `xxx button` 规则压过来（专题⑯B 的教训）。 */
.share-card-wrap { position: absolute; inset: 0; z-index: 66; }
.share-card {
  position: absolute; left: 50%; top: 50%;
  width: min(320px, 86vw);
  transform: translate(-50%, -50%) scale(.96);
  opacity: 0;
  transition: opacity .16s ease, transform .16s ease;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
  padding: 16px 18px 14px;
}
.share-card-wrap.open .share-card { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.share-card-head { display: flex; align-items: center; margin-bottom: 12px; }
.share-card-title { font-size: 14.5px; font-weight: 600; color: var(--c-text); }
.share-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.share-row {
  display: flex; align-items: center;
  width: 100%; padding: 11px 12px;
  font-size: 14px; font-family: inherit; color: var(--c-text);
  background: var(--c-surface-2); border: 0; border-radius: 10px; cursor: pointer;
  text-align: start;
}
.share-row:active { background: var(--c-border); }
.share-withbook {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--c-muted);
  margin-bottom: 12px; cursor: pointer;
  user-select: none; -webkit-user-select: none;
}
.share-withbook input { width: 15px; height: 15px; margin: 0; accent-color: var(--c-accent); flex: none; }
.share-actions { display: flex; justify-content: flex-end; }
.share-cancel {
  padding: 7px 16px; font-size: 13px; font-family: inherit;
  color: var(--c-muted); background: transparent;
  border: 1px solid var(--c-border); border-radius: 8px; cursor: pointer;
}
.share-cancel:active { background: var(--c-surface-2); }

/* ─────────── 设置面板里的整行按钮 ─────────── */
.lib-row-btn {
  display: block; width: 100%;
  padding: 12px; margin-top: 4px;
  font-size: 14px; font-family: inherit; color: var(--c-text);
  background: var(--c-surface-2); border: 0; border-radius: 8px; cursor: pointer;
  text-align: start;
}
.lib-row-btn:active { background: var(--c-surface-2); }

/* 空状态里的示例书按钮（重渲染时按 class 清除，避免越攒越多） */
.empty-btn { border: 0; }
.empty-btn-ghost { border: 0; }

/* ═══════════════════════════════════════════════════════════
   阅读器「页眉 / 页脚」
   细信息条：12px、弱化灰、flex + space-between；颜色全走主题变量。
   开启时给 #view-host 让出高度（foliate 用 ResizeObserver 会自动重排）。
   ═══════════════════════════════════════════════════════════ */
:root { --hf-h: 26px; }

.rhf {
  position: absolute; left: 0; right: 0; z-index: 4;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: var(--hf-h);
  padding: 2px calc(14px + var(--safe-r)) 2px calc(14px + var(--safe-l));
  font-size: 12px; line-height: 1.4;
  color: var(--c-muted);
  background: var(--c-read-bg);
  transition: top .18s ease, bottom .18s ease;
  pointer-events: none;         /* 别挡着翻页/选词 */
}
.rhf-top { top: calc(var(--bar-h) + var(--safe-t)); }
.rhf-bottom { bottom: calc(var(--bar-h) + var(--safe-b)); position: absolute; }
body.ui-hidden .rhf-top { top: var(--safe-t); }
body.ui-hidden .rhf-bottom { bottom: var(--safe-b); }

.rhf-t {
  min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rhf-left, .rhf-right { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.rhf-right { flex: none; }
.rhf-batt { display: inline-flex; align-items: center; gap: 4px; }
.rhf-batt-ico { width: 15px; height: 15px; stroke-width: 1.5; }

/* 最底层的细进度条 */
.rhf-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px; background: transparent;
}
.rhf-bar > i { display: block; height: 100%; width: 0; background: var(--c-accent); }
.rhf-bar.off { display: none; }

/* 阅读区让位：页眉/页脚各占一条（工具栏可见时再让出工具栏高度） */
#view-host { transition: top .18s ease, bottom .18s ease; }
body.hf-top #view-host { top: calc(var(--bar-h) + var(--safe-t) + var(--hf-h)); }
body.ui-hidden.hf-top #view-host { top: calc(var(--safe-t) + var(--hf-h)); }
body.hf-bottom #view-host { bottom: calc(var(--bar-h) + var(--safe-b) + var(--hf-h)); }
body.ui-hidden.hf-bottom #view-host { bottom: calc(var(--safe-b) + var(--hf-h)); }

/* 窄屏（手机竖屏）：信息太多就只留最多 3 项，先隐次要的（剩余时间/页数/电量百分比） */
@media (max-width: 480px) {
  .rhf-minor { display: none; }
}

/* 设置面板里的小字提示（置灰说明） */
.row-hint { font-size: 12.5px; color: var(--c-muted); line-height: 1.5; }

/* ═══════════════════════════════════════════════════════════
   设置面板控件：Tab / 步进器 / 下拉 / 图标单选组
   ═══════════════════════════════════════════════════════════ */
.sheet-tabs {
  display: flex; gap: 4px;
  padding: 4px 0 10px;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 6px;
}
.sheet-tab {
  flex: 1; padding: 9px 4px;
  border: 0; border-radius: var(--radius-field);
  background: transparent; color: var(--c-muted);
  font-size: 14px; font-family: inherit; cursor: pointer;
  transition: var(--motion);
}
.sheet-tab.on { background: var(--c-surface-2); color: var(--c-text); font-weight: 600; }

/* 步进器：[−] 数值 [+] */
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper.off { opacity: .45; }
.step-btn {
  width: 40px; height: 34px; flex: none;
  border: 1px solid var(--c-border); border-radius: var(--radius-field);
  background: var(--c-surface-2); color: var(--c-text);
  font-size: 18px; line-height: 1; font-family: inherit; cursor: pointer;
}
.step-btn:active { background: var(--c-border); }
.step-btn[disabled] { opacity: .5; cursor: default; }
.step-val {
  flex: 1; text-align: center; font-size: 14px;
  font-variant-numeric: tabular-nums; color: var(--c-text);
}

/* 下拉菜单 */
.sel-field {
  width: 100%; height: 38px; padding: 0 10px;
  border: 1px solid var(--c-border); border-radius: var(--radius-field);
  background: var(--c-bg); color: var(--c-text);
  font-size: 14px; font-family: inherit; outline: none;
}
.sel-field:focus { border-color: var(--c-accent); }

/* 图标单选组 */
.iseg { display: flex; gap: 6px; }
.iseg.off { opacity: .45; }
.iseg-btn {
  flex: 1; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--c-border); border-radius: var(--radius-field);
  background: var(--c-surface-2); color: var(--c-text); cursor: pointer;
  transition: var(--motion);
}
.iseg-btn .ico { width: 19px; height: 19px; stroke-width: 1.6; }
.iseg-btn.on { border-color: var(--c-accent); color: var(--c-accent); background: var(--c-bg); }
.iseg-btn[disabled] { cursor: default; }

/* ═══════════════════════════════════════════════════════════
   §一 原生接管模式（body.native-chrome）

   原生壳在页面加载完成后经 JSBridge 调 __reader.hideWebChrome(true)，
   给 <body> 加上 .native-chrome。此后网页退化为「纯内容渲染器」：
   隐藏自身的顶/底栏、唤出把手、更多菜单、目录/批注侧栏、搜索面板与页眉页脚，
   进度/章节/目录改由 rsBridge 上报原生，由原生绘制顶部工具栏与底部进度条。

   ⚠️ 故意【不隐藏】#sheet（网页版阅读设置面板）：浏览器预览（tools/serve.py，无原生壳）
      时它仍由 #btn-reader-settings 唤出；真机上设置面板是原生的（§27.3），网页面板没人调用、
      默认 hidden，不藏也碍不着事。（原调试入口 __reader.openSettings 已在发布版清理时删除。）
   ═══════════════════════════════════════════════════════════ */
body.native-chrome .rbar,
body.native-chrome .bars-handle,
body.native-chrome .more-menu,
body.native-chrome #toc-drawer,
body.native-chrome #anno-drawer,
body.native-chrome #search-panel,
body.native-chrome #scrim,
body.native-chrome .rhf {
  display: none !important;
}

/* ⛔ [1.3 九轮] 这里原来有一条**例外**：`body.native-chrome #anno-drawer { display: flex !important }`
   —— 那时原生顶栏那颗「批注」按钮是去开关**网页这条**栏的。
   现在批注栏整条搬成原生了（原生的 annoPane / annoSheetOverlay），原生壳里网页这条
   必须**彻底不出现**：
     · 留着会看到两条批注栏（一条原生、一条网页）；
     · 网页那条的「筛选 / 排序」是浏览器原生 `<select>`，外观完全不受应用 CSS 控制 ——
       正是鱼干说「太难看了」「一看就是网页」的直接来源。
   所以整条撤掉，让上面那句 `display:none !important` 照旧吃掉它。
   浏览器预览（tools/serve.py，没有原生壳 → 没有 native-chrome 这个类）完全不受影响。 */

/* 原生底栏占了底部空间：缩放提示上移，避免与其重叠 */
body.native-chrome .zoom-hint { bottom: 104px; }

/* ═══════════════════════════════════════════════════════════
   1.3 二轮（2026-09-25）：划词菜单颜色区 / 各面板的「出法」
   ═══════════════════════════════════════════════════════════ */

/* ─────────── 划词菜单颜色区：一排 4 预设 +（展开后）一排 4 自定义 ───────────
   鱼干的要求：右边一个「收起/展开」，收起只有一排；展开变 4×2，下面那排是自定义色位；
   下面那排右边再给一个「编辑」，进去管理自定义颜色。 */
.sp-colors-wrap { display: flex; flex-direction: column; gap: 5px; padding: 2px 4px 0; }
.sp-colors-row { display: flex; align-items: center; gap: 6px; }
.sp-colors-row .sp-colors { flex: 1; min-width: 0; }
/* ⚠️⚠️ 这两个「收起/展开」「编辑」必须写成 `.sel-popup .xxx`（两个类）。
   上面第 490 行有一条 `.sel-popup button { padding: 7px 12px }` ——
   它一条**元素**选择器，优先级 (0,1,1) 比单类名 (0,1,0) 高，
   于是 `padding: 0` 被吃掉：26px 的方框里塞 24px 内边距 → 图标被压成 0 宽 →
   **按钮在界面上等于不存在**（鱼干两轮都说「只能选择 4 种颜色」，就是这个）。
   ⇒ 凡是在 `.sel-popup` 里自己定尺寸的按钮，选择器必须带 `.sel-popup` 前缀。 */
.sel-popup .sp-colors-more, .sel-popup .sp-colors-edit {
  flex: none; width: 26px; height: 26px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--c-border); border-radius: 50%; background: var(--c-card);
  color: var(--c-muted); cursor: pointer;
  font-family: inherit;
  transition: var(--motion);
}
.sel-popup .sp-colors-more .ico, .sel-popup .sp-colors-edit .ico { width: 15px; height: 15px; stroke-width: 2; }
.sel-popup .sp-colors-more:active, .sel-popup .sp-colors-edit:active { background: var(--c-surface-2); }
/* 展开态：箭头反色，一眼看出「现在能看到两排」 */
.sel-popup .sp-colors-more[aria-expanded="true"] { color: var(--c-accent); border-color: var(--c-accent); }
/* 空的色位：虚线圈 + 加号（点它去挑一个自定义颜色） */
.sel-popup .sp-slot-empty {
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px dashed var(--c-border); color: var(--c-muted);
}
.sel-popup .sp-slot-empty .ico { width: 12px; height: 12px; stroke-width: 2; }
/* 「删除」图标常显：没命中目标时压暗（点了会给一句说明，不是假按钮） */
.sel-popup .sp-btn-dim { opacity: .42; }

/* ─────────── 取色器里的自定义色板（编辑模式才显示）─────────── */
.cp-empty { font-size: 12px; color: var(--c-muted); }
/* ⭐ [1.3 五轮] 取色器的「说明 + 当前选中态」——
   两段式之后必须让用户一眼看出「我刚点的是预览，还没生效」。 */
.cp-hint { font-size: 12px; line-height: 1.5; color: var(--c-muted); }
.cp-swatch.on { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.cp-chips-box { width: 100%; }
.cp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 4px 4px 8px; border-radius: 999px;
  border: 1px solid var(--c-border); background: var(--c-card);
  font-size: 12px; color: var(--c-text);
}
.cp-chip-dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); flex: none; }
.cp-chip-hex { font-variant-numeric: tabular-nums; }
.cp-chip-x {
  border: 0; background: transparent; color: var(--c-muted);
  width: 22px; height: 22px; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.cp-chip-x .ico { width: 13px; height: 13px; stroke-width: 2.2; }
.cp-chip-x:active { background: var(--c-surface-2); }
.cp-empty { font-size: 12px; color: var(--c-muted); }

/* ─────────── 面板的「出法」（鱼干定的总规矩）───────────
   电脑 / 平板：**从左右两侧出来**（这里是右侧，淡入 + 轻微位移，跟 Aa 阅读设置一个手感）；
   手机：**从下往上淡入**。
   ⚠️ `.note-layer` 被「写笔记」和「自定义颜色」共用，规则写它身上最省事；
      `.note-card`（批注卡 / 修改标注）继续当**浮窗**（他自己也说「要么就是浮窗」）。 */
@media (min-width: 640px) {
  .note-layer {
    left: auto; right: 0; top: 0; bottom: 0;
    width: min(42vw, 360px);
    border-top: 0; border-left: 1px solid var(--c-border);
    transform: translateX(102%); opacity: 0;
    transition: transform .24s ease, opacity .24s ease;
    display: flex; flex-direction: column; gap: 10px;
    overflow-y: auto;
    padding-top: calc(12px + var(--safe-t));
    padding-bottom: calc(12px + var(--safe-b));
  }
  .note-layer.open { transform: none; opacity: 1; }
  .note-layer textarea { flex: 1; min-height: 150px; resize: none; }
  .note-layer .note-actions { margin-top: auto; }
  /* 电脑上批注栏常驻时，写笔记的面板摆在它**左边** —— 写的时候还看得见批注列表 */
  body.anno-dock .note-layer { right: var(--anno-w, 360px); }
}

/* ─────────── 小屏（手机）：批注栏也改成「从下方淡入」───────────
   鱼干：「小屏的笔记比较尴尬」。原来的右侧抽屉在手机上是盖住大半屏的卡片，
   跟阅读设置一样从下往上更顺手；手机上的**目录/书签**保持侧边（他明确说那是特例）。 */
@media (max-width: 639px) {
  body #anno-drawer.anno-drawer,
  body.native-chrome #anno-drawer.anno-drawer {
    left: 0; right: 0; top: auto; bottom: 0;
    width: auto; height: 84%;
    border-left: 0;
    border-top: 1px solid var(--c-border);
    border-radius: 16px 16px 0 0;
    transform: translateY(102%);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, .22);
    /* ⭐ 底部抽屉**不**给顶栏让位：它不是从上面下来的，让位只会在顶部留一条空白 */
    padding-top: 0;
    padding-bottom: var(--safe-b);
  }
  body #anno-drawer.anno-drawer.open { transform: none; }
}

/* ⭐ [1.5] 图片背景：把正文这条链路上的容器**全部打通**成透明，
   让原生垫在 WebView 下方的那张背景图透出来（见 reader.js applyOuterThemeVars）。
   为什么不能只靠注入 CSS 里的 html/body background：
     foliate 的 view / paginator 会给自己那层容器上背景色，只透明 html/body
     仍会被它盖住 —— 症状是「设了图片背景却还是纯色」，而且一眼看不出是谁盖的。
   开关由 JS 打在 <html data-bgimg="1"> 上；退出图片模式会自动摘掉。
   ⚠️ 只列已知容器，别用 `*` 通配：那会把插画、高亮、代码块的底色一起洗掉。 */
html[data-bgimg="1"],
html[data-bgimg="1"] body,
html[data-bgimg="1"] #page-reader,
html[data-bgimg="1"] #reader-main,
html[data-bgimg="1"] .reader-shell,
html[data-bgimg="1"] foliate-view,
html[data-bgimg="1"] foliate-paginator,
html[data-bgimg="1"] .epub-container {
  background: transparent !important;
}

/* ═══════════ [1.8 · 翻页特效] 方案 B：纯 CSS 位移 ═══════════
   ⚠️⚠️ 为什么放弃了 View Transitions（`::view-transition-*`）：
   实测（日志 2026-10-14 13:51）——`startViewTransition` **确实执行了**
   （`[TURN-FX] 走 View Transition · 特效=slide`），但画面毫无变化。
   根因：**书页正文在 iframe 里**（foliate 是「一节一个 iframe」），
   而 VT 的**根快照抓不到 iframe 的内容** ⇒ 新旧两张快照都是同一张背景，
   动画等于在播两张相同的图。这条路对「iframe 分节渲染」的架构走不通。

   ✅ 方案 B：不靠快照，直接对**书页容器**做 CSS 变换。
   步骤（见 reader.js 的 wrap）：① 瞬移到新页 → ② 把容器搬到「起点」→ ③ 下一帧搬回「原位」，
   中间那一下就是动效。不依赖内核版本、不依赖快照、也不会被 iframe 挡住。
   ⚠️ 与 readest 的 slide 有一处**刻意差异**：旧页不会留在下面（那需要快照）。
   表现出来就是「新页从右边滑进来」，观感一致、代价为零。 */

/* 跑动效时容器才挂 transition（平时不挂，免得影响正常滚动的性能） */
.sz-fx { transition: transform 0.26s cubic-bezier(0.22, 0.61, 0.36, 1); will-change: transform; }
.sz-fx-slide { transform: translateX(100%); }
.sz-fx-slide-back { transform: translateX(-100%); }
/* 掀页：绕书脊那侧转出来 + 一点压暗（真·卷纸要逐像素变形，不成比例） */
.sz-fx-curl { transform: perspective(1500px) rotateY(-55deg); filter: brightness(0.82); }
.sz-fx-curl-back { transform: perspective(1500px) rotateY(55deg); filter: brightness(0.82); }
/* 动效期间别让书页容器吃手势（否则连着翻会互相打断） */
.sz-fx-on { touch-action: none; }

/* ═══════════ [1.8 · 仿真书缝] 跨页中缝（左右两栏中间那道沟）═════════
   做法对标经典双页阅读器的 gutter shadow：两栏内缘各一条由深到浅的内阴影
   （模拟纸面弯进书脊），正中一条 1px 折痕。纯渐变、不吃事件、零 JS 常驻。
   ⚠️ #page-gutter 自己写了 display:flex，会盖掉 UA 的 [hidden]{display:none}
      ⇒ 必须显式补一条 [hidden] 规则，否则 hidden 属性压不住它（永远显示）。 */
#page-gutter {
  position: fixed;
  left: 50%;
  top: 0;
  bottom: 0;
  width: var(--gutter-w, 34px);
  transform: translateX(-50%);
  /* 与 #view-host 同级（1）但声明在后 ⇒ 压在书页上；页眉页脚是 2，压在其下 */
  z-index: 1;
  pointer-events: none;
  display: flex;
  --gutter-ink: .16;
}
#page-gutter[hidden] { display: none; }
/* ⭐ [1.8 · 掀页] 演折页的 700ms 里把书缝藏起来（浮层盖住整窗，缝还亮着 = 纸上凭空多一道缝）。
   独立属性，不碰 hidden —— hidden 由 updateGutter() 按 key 记忆写，会卡住不放。 */
#page-gutter[data-curl] { display: none; }
#page-gutter .pg-half { flex: 1; }
#page-gutter .pg-left { background: linear-gradient(to left, rgba(0,0,0,var(--gutter-ink)), rgba(0,0,0,0)); }
#page-gutter .pg-right { background: linear-gradient(to right, rgba(0,0,0,var(--gutter-ink)), rgba(0,0,0,0)); }
#page-gutter .pg-creas {
  position: absolute; left: 50%; top: 0; bottom: 0;
  width: 1px; transform: translateX(-.5px);
  background: rgba(0,0,0,.30);
}
@media (prefers-color-scheme: dark) {
  #page-gutter { --gutter-ink: .34; }
  #page-gutter .pg-creas { background: rgba(255,255,255,.07); }
}

/* ⭐ [2026-10-22] 拖进度条的「B站式」实时预览浮框（滑块上方，随拇指移动） */
.pg-preview {
  position: fixed;
  z-index: 60;
  transform: translateX(-50%);
  min-width: 96px;
  max-width: 70vw;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--c-surface-2, #2b2b2b);
  color: var(--c-text, #fff);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .28);
  text-align: center;
  pointer-events: none;          /* 不挡滑块操作 */
  user-select: none;
  -webkit-user-select: none;
}
.pg-preview .pg-pv-pct {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
}
.pg-preview .pg-pv-chap {
  margin-top: 2px;
  font-size: 12px;
  opacity: .82;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ⭐ [2026-11-06] 「外观」页：纸色九宫格 + 背景图小按钮（与手机端同一套观感） */
.themes-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 4px 0 14px; }
.theme-chip { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; cursor: pointer; padding: 6px 0; border-radius: 10px; }
.theme-chip .theme-dot { width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .22); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .22), 0 1px 2px rgba(0, 0, 0, .12); }
.theme-chip.on .theme-dot { box-shadow: 0 0 0 2px var(--c-surface), 0 0 0 4px var(--c-accent, #c0605e); }
.theme-chip .theme-name { font-size: 11.5px; color: var(--c-muted); }
.theme-chip.on .theme-name { color: var(--c-text); font-weight: 600; }
.mini-btn { border: 1px solid var(--c-border); background: transparent; color: var(--c-text); border-radius: 999px; padding: 6px 14px; font-size: 13px; cursor: pointer; }
.mini-btn:hover { border-color: var(--c-accent, #c0605e); }
.row input[type="range"] { flex: 1; min-width: 0; }

/* ═══════════════════════════════════════════════════════════════
   [2026-11-07] 「主题与背景」独立面板（js/appearance.js）
   尺寸/比例/间距**照抄鸿蒙端 1.10 的 pages/ReaderTheme.ets**：
     · 分段条 38 高 / 内边距 3 / 圆角 11；子项 32 高 / 圆角 9
     · 卡片 CARD_RATIO = 0.78（宽:高），3 列，列间距 8 / 行间距 10，圆角 10
     · 微型阅读页：「书斋」9px + 三条 1.5px 正文线（86%/70%/78%，透明度 .42/.30/.22）
     · 选中：2px 主色描边 + 18×18 勾徽标（右下偏移 4）
     · 字色卡：25% 宽，光环 42、色圆 32、名字 10.5
   全部自成一 .apv-* 命名空间，不依赖「阅读设置」那套 .row/.hint（那套 .row 是 block、
   .hint 根本没定义，混用会排版塌）。
   ═══════════════════════════════════════════════════════════════ */

/* ── 顶部分段条 ── */
.apv-seg {
  display: flex; align-items: center; gap: 0;
  height: 38px; padding: 3px; box-sizing: border-box;
  margin: 2px 0 10px; border-radius: 11px;
  background: var(--c-surface-2);
}
.apv-seg button {
  flex: 1 1 0; height: 32px; border: 0; border-radius: 9px;
  background: transparent; color: var(--c-muted);
  font: inherit; font-size: 14px; cursor: pointer;
}
.apv-seg button.on {
  background: var(--c-surface); color: var(--c-text);
  font-weight: 500; box-shadow: 0 1px 2px rgba(0, 0, 0, .10);
}

/* ── 卡片网格（纯色 / 图片共用） ── */
.apv-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px 8px; padding: 2px 0 4px;
}
.apv-card {
  display: flex; flex-direction: column; gap: 5px;
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; color: inherit; text-align: center;
}
.apv-thumb {
  position: relative; display: block;
  width: 100%; aspect-ratio: 0.78; box-sizing: border-box;
  border-radius: 10px; overflow: hidden;
  border: 1px solid rgba(0, 0, 0, .12);
  background: var(--c-surface-2);
}
.apv-card.on .apv-thumb { border: 2px solid var(--c-accent, #c0605e); }

/* 微型阅读页 */
.apv-page {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; gap: 4px;
  padding: 9px 8px 0; box-sizing: border-box; text-align: left;
}
.apv-page-t { font-size: 9px; font-weight: 500; line-height: 1.25; letter-spacing: .02em; }
.apv-line { display: block; height: 1.5px; border-radius: .75px; }

/* 选中徽标 */
.apv-badge {
  position: absolute; right: 4px; top: 4px;
  width: 18px; height: 18px; border-radius: 9px;
  background: var(--c-accent, #c0605e); color: #fff;
  font-size: 11px; line-height: 18px; text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}

.apv-card-name {
  font-size: 11.5px; color: var(--c-muted);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.apv-card.on .apv-card-name { color: var(--c-accent, #c0605e); font-weight: 500; }

/* 图片页：图 + 纸色蒙层 + 「添加 / 换图」虚线卡 */
.apv-thumb-img { position: absolute; inset: 0; background-size: cover; background-position: center; }
.apv-thumb-scrim { position: absolute; inset: 0; display: block; }
.apv-thumb-add {
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--c-border); background: transparent;
  color: var(--c-muted);
}
.apv-thumb-add b { font-size: 13px; font-weight: 500; }

/* ── 文字颜色：实景预览（App：高 120 / 圆角 12） ── */
.apv-preview {
  position: relative; display: flex; align-items: center;
  height: 120px; box-sizing: border-box; padding: 0 14px;
  margin: 0 0 12px; border: 1px solid var(--c-border);
  border-radius: 12px; overflow: hidden;
}
.apv-preview-bg, .apv-preview-scrim { position: absolute; inset: 0; display: block; }
.apv-preview-bg { background-size: cover; background-position: center; }
.apv-preview-t { position: relative; width: 100%; }
.apv-preview-t b { display: block; font-size: 15px; font-weight: 500; margin-bottom: 4px; }
.apv-preview-t span { display: block; font-size: 12px; opacity: .72; }

/* ── 文字颜色：色卡（25% 宽 / 光环 42 / 色圆 32 / 名字 10.5） ── */
.apv-group-h {
  font-size: 12px; font-weight: 500; color: var(--c-muted);
  margin: 2px 0 4px;
}
.apv-inks {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px 6px; padding: 0 0 10px;
}
.apv-ink {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 0; background: none; padding: 2px 0; cursor: pointer;
  font: inherit; width: 100%;
}
.apv-ring {
  display: flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 21px; box-sizing: border-box;
}
.apv-ink.on .apv-ring { border: 2px solid var(--c-accent, #c0605e); }
.apv-ink-dot {
  display: block; width: 32px; height: 32px; border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, .18);
}
.apv-ink-dot.auto { background: linear-gradient(90deg, #171717 0 50%, #e8e8ea 50% 100%); }
.apv-ink-name {
  font-size: 10.5px; color: var(--c-muted);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.apv-ink.on .apv-ink-name { color: var(--c-accent, #c0605e); font-weight: 500; }

/* ── 面板内的一行（本面板自己的，不复用 .row） ── */
.apv-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--c-border);
}
.apv-row:last-child { border-bottom: 0; }
.apv-row-k { font-size: 13.5px; color: var(--c-text); white-space: nowrap; }
.apv-row input[type="range"] { flex: 1 1 auto; min-width: 0; }
.apv-hint { margin: 0; padding: 8px 0 2px; font-size: 12px; line-height: 1.6; color: var(--c-muted); }
.apv-hint.bad { color: #c0605e; }
.apv-mini {
  border: 1px solid var(--c-border); background: transparent; color: var(--c-text);
  border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 13px; cursor: pointer;
}
.apv-mini:hover { border-color: var(--c-accent, #c0605e); }

/* ── 自定义字色：HEX + RGB ── */
.apv-hex-row { justify-content: flex-start; }
.apv-hex-dot { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--c-border); }
.apv-hex {
  flex: 1 1 auto; min-width: 0; padding: 8px 10px;
  border: 1px solid var(--c-border); border-radius: 8px;
  background: var(--c-surface-2); color: var(--c-text);
  font: inherit; font-variant-numeric: tabular-nums; letter-spacing: .06em;
}
.apv-rgb .apv-row { padding: 8px 0; }

/* ── [2026-11-07 第二轮] 图片页签：固定 6 格 + 悬停删除 ──
   ① `.apv-grid-img` 给一个最小高度：图片 0 张时也要把面板撑住，
      否则整个二级窗口会缩成一条 —— 鱼干：「就算没有图片，我们也要把它撑大」。
   ② 叉叉只在**鼠标悬停**时露出来（触屏没有 hover，用 @media hover:none 常显）。 */
.apv-grid-img { min-height: 300px; align-content: start; }
.apv-x {
  position: absolute; left: 4px; top: 4px; z-index: 2;
  width: 20px; height: 20px; padding: 0; border: 0; border-radius: 10px;
  background: rgba(0, 0, 0, .55); color: #fff;
  font: inherit; font-size: 13px; line-height: 20px; text-align: center;
  cursor: pointer; opacity: 0; transition: opacity .15s ease;
}
.apv-thumb:hover .apv-x { opacity: 1; }
.apv-x:hover { background: rgba(0, 0, 0, .78); }
@media (hover: none) { .apv-x { opacity: 1; } }
