/* ============================================================
   墨阅 · 本地小说阅读器  样式表
   ============================================================ */

/* ---------- 主题变量 ---------- */
:root {
  --accent: #635bff;
  --accent-soft: #8b7bff;
  --accent-ink: #ffffff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.05);
  --shadow-md: 0 6px 18px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.06);
  --shadow-lg: 0 18px 50px rgba(0,0,0,.18);
  --ease: cubic-bezier(.4,0,.2,1);
}

body[data-theme="light"] {
  --bg: #f4f2ec;
  --bg-grad1: #efeae0;
  --bg-grad2: #f7f5f0;
  --panel: #ffffff;
  --panel-2: #faf9f6;
  --text: #2a2a2a;
  --muted: #8a857d;
  --border: #e8e3d9;
  --hover: #f1eee6;
  --reader-bg: #fbfaf6;
  --reader-text: #2e2c27;
}
body[data-theme="sepia"] {
  --bg: #e9dec6;
  --bg-grad1: #e3d5b6;
  --bg-grad2: #f1e7cf;
  --panel: #f7efdc;
  --panel-2: #f3e9d2;
  --text: #4b3b29;
  --muted: #9b8a6c;
  --border: #ddcfac;
  --hover: #efe2c2;
  --reader-bg: #f4ecd8;
  --reader-text: #5b4636;
}
body[data-theme="green"] {
  --bg: #cfe6c9;
  --bg-grad1: #c2deba;
  --bg-grad2: #dcefd6;
  --panel: #e7f4e2;
  --panel-2: #dfefda;
  --text: #27413b;
  --muted: #6e8a76;
  --border: #bcdcb4;
  --hover: #d6ecd0;
  --reader-bg: #c7edcc;
  --reader-text: #1f3a33;
}
body[data-theme="dark"] {
  --bg: #14151a;
  --bg-grad1: #0f1014;
  --bg-grad2: #1a1c22;
  --panel: #1e1f26;
  --panel-2: #23252c;
  --text: #d7d9e0;
  --muted: #8b8d98;
  --border: #2c2e36;
  --hover: #2a2c34;
  --reader-bg: #1b1c21;
  --reader-text: #c6c8d2;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.35);
  --shadow-md: 0 6px 18px rgba(0,0,0,.5);
}

/* ---------- 基础重置 ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image: linear-gradient(160deg, var(--bg-grad1), var(--bg-grad2));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s var(--ease), color .3s var(--ease);
}
h1,h2,h3,h4 { margin: 0; font-weight: 600; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: rgba(128,128,128,.35); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(128,128,128,.55); background-clip: padding-box; border: 3px solid transparent; }

/* ---------- 视图切换 ---------- */
.view { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.view[hidden] { display: none !important; }

/* ============================================================
   书架视图
   ============================================================ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 18px clamp(16px, 4vw, 44px);
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
  width: 46px; height: 46px; border-radius: 13px;
  display: grid; place-items: center;
  font-size: 24px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, #b06bff 60%, #ff7eb3 120%);
  box-shadow: 0 6px 16px rgba(99,91,255,.45);
  letter-spacing: 0;
}
.brand-text h1 { font-size: 22px; letter-spacing: 1px; }
.brand-text p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }

.topbar-actions { display: flex; gap: 10px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); background: var(--panel-2);
  color: var(--text); padding: 9px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: transform .12s var(--ease), background .2s, box-shadow .2s, border-color .2s;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: var(--accent-ink); border-color: transparent;
  box-shadow: 0 6px 16px rgba(99,91,255,.35);
}
.btn-primary:hover { box-shadow: 0 8px 22px rgba(99,91,255,.45); filter: brightness(1.05); }
.btn-soft { background: var(--panel); }
.btn-ico { font-size: 16px; line-height: 1; }

.icon-btn {
  border: none; background: transparent; color: var(--text);
  width: 40px; height: 40px; border-radius: 11px; font-size: 18px;
  display: inline-grid; place-items: center;
  transition: background .18s, transform .12s;
}
.icon-btn:hover { background: var(--hover); }
.icon-btn:active { transform: scale(.94); }
.icon-btn:disabled { opacity: .3; cursor: not-allowed; pointer-events: none; }

/* ---------- 书架网格 ---------- */
.shelf-wrap { flex: 1; padding: 8px clamp(16px, 4vw, 44px) 24px; }
.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: clamp(16px, 2.4vw, 28px) clamp(14px, 2vw, 22px);
  padding-top: 18px;
}
.view-shelf.dragging .shelf-wrap { outline: 2px dashed var(--accent); outline-offset: -10px; border-radius: 16px; }

.book-card {
  position: relative; cursor: pointer; user-select: none;
  border-radius: var(--radius); background: transparent; border: none;
  text-align: left; padding: 0;
  transition: transform .25s var(--ease);
  animation: cardIn .4s var(--ease) both;
}
.book-card:hover { transform: translateY(-6px); }
.book-card:active { transform: translateY(-2px) scale(.995); }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.cover {
  position: relative; aspect-ratio: 3 / 4.2;
  border-radius: 12px; overflow: hidden;
  box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 16px 14px; color: #fff;
}
.cover::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(255,255,255,.22), rgba(0,0,0,.12));
  mix-blend-mode: overlay;
}
.cover-spine {
  position: absolute; left: 7px; top: 0; bottom: 0; width: 2px;
  background: rgba(255,255,255,.45); box-shadow: 1px 0 0 rgba(0,0,0,.18);
}
.cover-title {
  position: relative; font-size: 17px; font-weight: 700; line-height: 1.35;
  text-shadow: 0 1px 4px rgba(0,0,0,.35);
  word-break: break-word; max-height: 5.1em; overflow: hidden;
  padding-left: 10px;
}
.cover-meta {
  position: relative; font-size: 11px; opacity: .88;
  padding-left: 10px; max-height: 2.6em; overflow: hidden;
}
.cover-pct {
  position: absolute; top: 10px; right: 10px;
  background: rgba(0,0,0,.32); color: #fff;
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px;
  backdrop-filter: blur(4px);
}
.book-info { padding: 10px 4px 0; }
.book-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.book-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.progress-bar {
  margin-top: 8px; height: 4px; border-radius: 999px;
  background: var(--border); overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  transition: width .5s var(--ease);
}
.card-menu {
  position: absolute; top: 8px; left: 8px; z-index: 3;
  width: 28px; height: 28px; border-radius: 50%;
  border: none; background: rgba(0,0,0,.3); color: #fff;
  font-size: 14px; line-height: 1; backdrop-filter: blur(4px);
  opacity: 0; transform: scale(.8);
  transition: opacity .18s, transform .18s, background .18s;
}
.book-card:hover .card-menu { opacity: 1; transform: scale(1); }
.card-menu:hover { background: rgba(0,0,0,.55); }

/* ---------- 空状态 ---------- */
.empty-state {
  text-align: center; padding: 12vh 20px; color: var(--muted);
}
.empty-state .empty-ill { font-size: 64px; filter: grayscale(.1); }
.empty-state h2 { color: var(--text); margin: 14px 0 8px; font-size: 20px; }
.empty-state p { margin: 6px 0; font-size: 14px; }
.empty-state code {
  background: var(--panel); border: 1px solid var(--border);
  padding: 1px 7px; border-radius: 6px; font-size: 12.5px;
}
.empty-tip { font-size: 12.5px !important; opacity: .85; }
.footnote {
  text-align: center; color: var(--muted); font-size: 12px;
  padding: 18px; border-top: 1px solid var(--border);
}

/* ============================================================
   阅读器视图
   ============================================================ */
.view-reader {
  height: 100dvh;          /* 固定高度，替代 min-height */
  min-height: unset;       /* 取消最小高度限制 */
  overflow: hidden;        /* 防止整个视图滚动 */
  display: flex;
  flex-direction: column;
  background: var(--reader-bg);
}
.reader-topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px clamp(12px, 3vw, 28px);
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--reader-bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.ico-back { font-size: 22px; line-height: 1; }
.ico-back-text { font-size: 14px; }
.reader-title { flex: 1; min-width: 0; text-align: center; }
.reader-book-title {
  font-size: 15px; font-weight: 600; color: var(--reader-text);
  display: inline-block; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.reader-actions { display: flex; gap: 4px; }

.read-progress { height: 3px; background: var(--border); position: relative; }
.read-progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  transition: width .25s var(--ease);
}

.reader-content {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  scroll-behavior: smooth;
  padding: 0px 40px 80px;
}
.chapter-text {
  max-width: 1080px; margin: 0 auto;
  font-size: var(--reader-font-size, 20px);
  line-height: var(--reader-line-height, 1.9);
  color: var(--reader-text);
  letter-spacing: .02em;
}
.chapter-text[data-font="serif"],
.reader-content[data-font="serif"] .chapter-text {
  font-family: "Noto Serif SC","Source Han Serif SC","Songti SC","STSong",SimSun,serif;
}
.reader-content[data-font="sans"] .chapter-text {
  font-family: "PingFang SC","Microsoft YaHei","Hiragino Sans GB",system-ui,sans-serif;
}
.reader-content[data-font="kai"] .chapter-text {
  font-family: "KaiTi","楷体","STKaiti","华文楷体","AR PL KaitiM GB",serif;
}
.reader-content[data-font="li"] .chapter-text {
  font-family: "LiSu","隶书","STLiti","华文隶书","Baoli",serif;
}
.chapter-text .chapter-title {
  font-size: 1.5em; font-weight: 700; text-align: center;
  margin: 0 0 1.6em; padding: 8px 0 .8em 0;
  border-bottom: 1px solid var(--border); letter-spacing: .04em;
  position: sticky;
  top: 0px;
  background: var(--reader-bg);
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* 当抽屉打开时，禁用章节标题的 sticky 定位 */
body.drawer-open .chapter-text .chapter-title {
  position: static;
}
.chapter-text p {
  margin: 0 0 1em; text-indent: 2em;
  word-break: break-word;
}
/* 正文插图（txt 内嵌 <img> 标签） */
.chapter-text img.illust {
  max-width: 100%; height: auto;
  display: inline-block; vertical-align: middle;
  border-radius: 8px;
  margin: .3em auto;
}
.chapter-text p.illust-only {
  text-indent: 0; text-align: center;
  margin: 1.2em 0;
}
/* 整段插图：加载中/失败时保留占位框，不致布局跳动 */
.chapter-text p.illust-only img.illust {
  min-height: 3em;
  background: var(--border, rgba(128,128,128,.15));
}

.chapter-nav {
  max-width: 720px; margin: 40px auto 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding-top: 24px; border-top: 1px solid var(--border);
}
.chapter-progress-label {
  font-size: 13px; color: var(--muted); text-align: center; flex: 1;
}

/* ============================================================
   抽屉 / 遮罩 / 弹窗
   ============================================================ */
.backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(10,12,20,.45); backdrop-filter: blur(2px);
  opacity: 0; animation: fadeIn .25s var(--ease) forwards;
}
.backdrop[hidden] { display: none; }
@keyframes fadeIn { to { opacity: 1; } }

.drawer {
  position: fixed; top: 0; bottom: 0; z-index: 50;
  width: min(360px, 86vw); background: var(--panel);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: slideIn .3s var(--ease);
}
.drawer[hidden] { display: none; }
.drawer-left { left: 0; border-right: 1px solid var(--border); }
.drawer-right { right: 0; border-left: 1px solid var(--border); }
@keyframes slideInLeft { from { transform: translateX(-100%); } to { transform: none; } }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: none; } }
.drawer-left { animation: slideInLeft .3s var(--ease); }
.drawer-right { animation: slideInRight .3s var(--ease); }

.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.drawer-head h3 { font-size: 17px; }

.toc-search-wrap { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.toc-search {
  width: 100%; padding: 9px 13px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--panel-2);
  color: var(--text); font-size: 14px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.toc-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,91,255,.18); }

.toc-list {
  flex: 1; overflow-y: auto; list-style: none; margin: 0; padding: 6px 8px 24px;
}
.toc-list li {
  padding: 10px 14px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 14.5px; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  overflow: hidden;
  transition: background .15s, color .15s;
}
.toc-list li:hover { background: var(--hover); }
.toc-list li.active {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent); font-weight: 600;
}

/* ---------- 设置面板 ---------- */
.settings-body { padding: 8px 18px 28px; overflow-y: auto; }
.setting { padding: 18px 0; border-bottom: 1px dashed var(--border); }
.setting:last-child { border-bottom: none; }
.setting-label {
  display: block; font-size: 13.5px; color: var(--muted);
  margin-bottom: 12px; font-weight: 500;
}
.setting-label span { color: var(--accent); font-weight: 600; }

.theme-swatches { display: flex; gap: 12px; }
.swatch {
  width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--border);
  background: linear-gradient(135deg, var(--s1), var(--s2));
  position: relative; transition: transform .15s, border-color .2s, box-shadow .2s;
}
.swatch:hover { transform: scale(1.08); }
.swatch.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,91,255,.25); }

.stepper { display: flex; align-items: center; gap: 12px; }
.step-btn {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  font-size: 18px; line-height: 1;
  transition: background .18s, transform .12s;
}
.step-btn:hover { background: var(--hover); }
.step-btn:active { transform: scale(.92); }
.range {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 6px; border-radius: 999px; background: var(--border); outline: none;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--panel); cursor: pointer;
  box-shadow: 0 2px 6px rgba(99,91,255,.5);
}
.range::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: var(--accent);
  border: 3px solid var(--panel); cursor: pointer;
}

.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button {
  border: none; background: transparent; color: var(--muted);
  padding: 7px 18px; border-radius: 8px; font-size: 14px; font-weight: 500;
  transition: all .18s var(--ease);
}
.seg button.active { background: var(--accent); color: #fff; box-shadow: 0 3px 8px rgba(99,91,255,.35); }

/* ---------- 卡片菜单 ---------- */
.card-popover {
  position: fixed; z-index: 60; min-width: 168px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: 6px; overflow: hidden;
  animation: popIn .15s var(--ease);
}
.card-popover[hidden] { display: none; }
@keyframes popIn { from { opacity: 0; transform: scale(.95) translateY(-4px); } to { opacity: 1; transform: none; } }
.card-popover button {
  display: block; width: 100%; text-align: left;
  border: none; background: transparent; color: var(--text);
  padding: 9px 12px; border-radius: 8px; font-size: 14px;
  transition: background .15s, color .15s;
}
.card-popover button:hover { background: var(--hover); }
.card-popover button.danger { color: #e5484d; }
.card-popover button.danger:hover { background: rgba(229,72,77,.1); }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 70;
  display: grid; place-items: center; padding: 20px;
  background: rgba(10,12,20,.5); backdrop-filter: blur(3px);
  animation: fadeIn .2s var(--ease);
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(440px, 94vw); background: var(--panel);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  overflow: hidden; animation: popIn .25s var(--ease);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 16px 18px 20px; }
.modal-body dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; font-size: 14px; }
.modal-body dt { color: var(--muted); }
.modal-body dd { margin: 0; color: var(--text); word-break: break-word; }
.modal-body .badge {
  display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent);
}

/* ---------- 轻提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(20px);
  z-index: 90; background: rgba(30,32,40,.94); color: #fff;
  padding: 11px 20px; border-radius: 999px; font-size: 14px;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s var(--ease);
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 640px) {
  .brand-text p { display: none; }
  .shelf { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .ico-back-text { display: none; }
  .btn-primary .btn-ico { font-size: 18px; }
  #btn-import { padding: 9px 14px; }
  .drawer { width: 88vw; }
}
@media (max-width: 380px) {
  .shelf { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   缓存目录状态按钮
   ============================================================ */
.btn-ghost {
  background: transparent; border-color: var(--border);
  display: inline-flex; align-items: center; gap: 8px;
}
.cache-chip { padding: 8px 14px; font-size: 13px; }
.cache-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: var(--muted); position: relative;
}
.cache-dot.on { background: #34c759; box-shadow: 0 0 0 3px rgba(52,199,89,.22); }
.cache-dot.warn { background: #ff9f0a; box-shadow: 0 0 0 3px rgba(255,159,10,.22); }
.cache-dot.off { background: var(--muted); }
@media (max-width: 640px) {
  .cache-chip #cache-label { display: none; }
  .cache-chip { padding: 9px 12px; }
}

/* ============================================================
   全文搜索面板
   ============================================================ */
.search-body { padding: 12px 14px 24px; display: flex; flex-direction: column; flex: 1; min-height: 0; }
.search-input-row { display: flex; gap: 8px; }
.search-input-row .toc-search { flex: 1; }
.search-input-row .btn { padding: 9px 16px; }
.search-opts { display: flex; gap: 16px; margin: 12px 0 4px; }
.chk {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted); cursor: pointer; user-select: none;
}
.chk input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.search-status {
  font-size: 12.5px; color: var(--muted); padding: 8px 2px 4px;
  border-bottom: 1px solid var(--border); margin-bottom: 6px;
}
.search-status .err { color: #e5484d; }
.search-results { flex: 1; overflow-y: auto; padding: 4px 0; }
.search-item {
  padding: 10px 10px; border-radius: var(--radius-sm); cursor: pointer;
  transition: background .15s;
}
.search-item:hover { background: var(--hover); }
.search-item-ch {
  font-size: 12px; color: var(--accent); margin-bottom: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.search-item-snip {
  font-size: 13.5px; color: var(--text); line-height: 1.6;
  word-break: break-word;
}
mark {
  background: rgba(255,214,0,.5); color: inherit;
  border-radius: 3px; padding: 0 1px;
}
body[data-theme="dark"] mark { background: rgba(255,196,0,.32); }

/* 阅读时搜索/跳转命中的段落高亮闪烁 */
.chapter-text p.flash {
  animation: flash 1.6s var(--ease);
  border-radius: 6px;
}
@keyframes flash {
  0% { background: rgba(255,214,0,.55); }
  100% { background: transparent; }
}

/* 通用：警示徽章 */
.badge.warn { background: rgba(255,159,10,.18); color: #b7791f; }
body[data-theme="dark"] .badge.warn { color: #ffbf47; }

/* ============================================================
   阅读进度浮层
   ============================================================ */
.progress-overlay {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 25;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--shadow-md);
  display: flex;
  gap: 20px;
  pointer-events: none;
  opacity: 0;
  animation: progressFadeIn .25s var(--ease) forwards;
}
.progress-overlay[hidden] {
  display: none;
}
@keyframes progressFadeIn {
  to { opacity: 1; }
}
.progress-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.progress-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.progress-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 640px) {
  .progress-overlay {
    bottom: 16px;
    right: 16px;
    padding: 10px 14px;
    gap: 16px;
  }
  .progress-value {
    font-size: 16px;
  }
}

