@font-face {
  font-family: "Literata";
  src: url("/fonts/literata.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("/fonts/literata-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --page: #f5f6f2;
  --surface: #fbfbf9;
  --ink: #24313b;
  --muted: #6a7580;
  --line: #d9ddd5;
  --accent: #2e5b4e;
  --accent-ink: #ffffff;
  --accent-soft: #e3ece7;
  --danger: #a33a3a;
  --hl-yellow: #f9e27d;
  --hl-green: #bfe3b4;
  --hl-blue: #bbd5f0;
  --hl-pink: #f3c6d2;
  --flash: #f2b84b;
  --serif: "Literata", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Noto Serif SC", "Songti SC", serif;
  --sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --ink-max: #000;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --page: #16191c;
    --surface: #1e2226;
    --ink: #dce1e4;
    --muted: #8e99a2;
    --line: #2f353a;
    --accent: #8dc2ae;
    --accent-ink: #13201b;
    --accent-soft: #23312c;
    --danger: #e08a8a;
    --hl-yellow: rgba(232, 197, 60, 0.38);
    --hl-green: rgba(120, 190, 110, 0.36);
    --hl-blue: rgba(100, 160, 230, 0.36);
    --hl-pink: rgba(230, 120, 160, 0.36);
    --flash: rgba(242, 184, 75, 0.7);
    --ink-max: #fff;
    color-scheme: dark;
  }
}
:root[data-theme="white"] { --page: #fff; --surface: #fafafa; --ink: #1a1a1a; --line: #dedede; }
:root[data-theme="sepia"] { --page: #f4ecd8; --surface: #efe5cc; --ink: #3b2f22; --muted: #7a6a55; --line: #ddd0b3; --accent: #7a4a1e; --accent-soft: #e9dcbc; }
:root[data-theme="green"] { --page: #cfe6d0; --surface: #c3dcc4; --ink: #1f2a20; --muted: #4f6450; --line: #aecbb0; --accent: #2b5a3a; --accent-soft: #b8d6ba; }
:root[data-theme="gray"] { --page: #e4e5e3; --surface: #dadbd8; --ink: #202224; --muted: #5d6166; --line: #c6c8c4; }
:root[data-theme="dark"], :root[data-theme="black"] {
  --page: #16191c; --surface: #1e2226; --ink: #dce1e4; --muted: #8e99a2; --line: #2f353a;
  --accent: #8dc2ae; --accent-ink: #13201b; --accent-soft: #23312c; --danger: #e08a8a;
  --hl-yellow: rgba(232, 197, 60, 0.38); --hl-green: rgba(120, 190, 110, 0.36);
  --hl-blue: rgba(100, 160, 230, 0.36); --hl-pink: rgba(230, 120, 160, 0.36);
  --flash: rgba(242, 184, 75, 0.7); --ink-max: #fff; color-scheme: dark;
}
:root[data-theme="black"] { --page: #000; --surface: #0b0b0b; --ink: #c9c9c9; --line: #262626; }
:root[data-dark] { --ink-max: #fff; }

*, *::before, *::after { box-sizing: inherit; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 布局 ---------- */
.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr) 360px;
  height: 100%;
}
.topbar { display: none; }
.library, .panel {
  background: var(--surface);
  overflow-y: auto;
  min-height: 0;
}
.library { border-right: 1px solid var(--line); padding: 28px 18px; }
.panel { border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.reader { overflow-y: auto; min-height: 0; scroll-behavior: smooth; position: relative; background: var(--read-bg, var(--page)); }
.reader-tools { position: sticky; top: 0; height: 0; display: flex; justify-content: flex-end; z-index: 5; }
.reader-tools .icon-btn { margin: 12px 14px 0 0; font-family: var(--serif); }
.reader:has(#book[hidden]) .reader-tools { display: none; }
@media (prefers-reduced-motion: reduce) { .reader { scroll-behavior: auto; } }

.brand { margin: 2px 0 26px 2px; }
.logo { display: block; height: 30px; width: auto; }
.logo-sm { height: 20px; margin: 0 auto; }
.logo-empty { height: 44px; margin: 0 auto 18px; opacity: 0.85; }
:root[data-dark] .logo { filter: invert(1); }
.shelf + .shelf { margin-top: 22px; }
.shelf-title {
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em;
  color: var(--muted); margin: 0 0 6px 4px;
}
.book-list .bp { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; margin-top: 5px; }
.book-list .bp-bar { flex: 1; height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.book-list .bp-bar > i { display: block; height: 100%; background: var(--accent); }
.book-list .bp-ch { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-list { list-style: none; margin: 0; padding: 0; }
.book-list button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  padding: 10px 10px 10px 12px;
  border-left: 3px solid transparent;
  border-radius: 0 6px 6px 0;
}
.book-list button:hover { background: var(--accent-soft); }
.book-list button[aria-current="true"] { border-left-color: var(--accent); background: var(--accent-soft); }
.book-list .bt { display: block; font-family: var(--serif); font-size: 16px; line-height: 1.3; }
.book-list .ba { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.library-hint { color: var(--muted); font-size: 13px; margin-top: 28px; }

/* ---------- 正文 ---------- */
.reader-empty { display: grid; place-content: center; text-align: center; height: 100%; color: var(--muted); font-family: var(--serif); font-size: 18px; }
.book {
  max-width: var(--read-width, 34em);
  margin: 0 auto;
  padding: 56px 28px 40vh;
  font-family: var(--serif);
  font-size: var(--read-size, 19px);
  line-height: var(--read-lh, 1.75);
  font-weight: var(--read-weight, 400);
  word-spacing: var(--read-word-spacing, 0);
  color: var(--read-fg, var(--ink));
  color: color-mix(in srgb, var(--read-fg, var(--ink)), var(--ink-max) var(--read-contrast, 0%));
}
.book p { text-align: var(--read-align, left) !important; hyphens: var(--read-hyphens, auto) !important; -webkit-hyphens: var(--read-hyphens, auto); }
.book h1, .book h2 { break-after: avoid; }

/* 状态栏 */
.statusbar {
  position: sticky; bottom: 0; z-index: 4;
  display: flex; justify-content: space-between; gap: 16px;
  padding: 6px 18px; font-size: 12px; color: var(--muted);
  background: var(--read-bg, var(--page));
  border-top: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.statusbar .sb-left { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.statusbar .sb-right { display: flex; gap: 14px; white-space: nowrap; }

/* 翻页模式：多栏横向分页 */
:root.paged .reader { overflow: hidden; display: flex; flex-direction: column; scroll-behavior: auto; }
:root.paged .book {
  flex: 1; min-height: 0; max-width: none; width: 100%; margin: 0;
  padding-top: 44px; padding-bottom: 20px;
  column-fill: auto; overflow: hidden;
}
:root.paged .statusbar { position: static; }
.book-head { margin-bottom: 3.2em; }
.book-head h1 { font-size: 2.1em; line-height: 1.15; font-weight: 500; margin: 0 0 0.3em; }
.book-head .author { color: var(--muted); font-style: italic; margin: 0; }
.book .part {
  font-size: 1.35em;
  font-weight: 500;
  margin: 2.8em 0 0.4em;
  color: var(--ink);
}
.book h2 {
  font-size: 1.15em;
  font-weight: 600;
  margin: 2.6em 0 1.2em;
  color: var(--accent);
}
.book p { margin: 0 0 0.9em; text-align: left; hyphens: auto; }
.book p + p { text-indent: 1.5em; }

.hl {
  border-radius: 2px;
  cursor: pointer;
  background: linear-gradient(transparent 38%, var(--c) 38%, var(--c) 92%, transparent 92%);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.hl.c-yellow, .swatch.c-yellow { --c: var(--hl-yellow); }
.hl.c-green, .swatch.c-green { --c: var(--hl-green); }
.hl.c-blue, .swatch.c-blue { --c: var(--hl-blue); }
.hl.c-pink, .swatch.c-pink { --c: var(--hl-pink); }
.hl.has-note { text-decoration: underline dotted var(--muted); text-underline-offset: 0.25em; }
.vw { border-bottom: 1.5px dashed var(--accent); }
.target, .hl.flash {
  animation: flash 2.4s ease-out 1;
  border-radius: 3px;
}
.target { background: var(--flash); }
@keyframes flash {
  0%, 30% { box-shadow: 0 0 0 4px var(--flash); background-color: var(--flash); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .target, .hl.flash { animation: none; box-shadow: 0 0 0 3px var(--flash); }
}

/* ---------- 面板 ---------- */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 0 12px;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}
.tabs button {
  border: 0;
  background: none;
  padding: 16px 12px 12px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  position: relative;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab-dot {
  position: absolute; top: 12px; right: 2px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger);
}
.pane { padding: 16px; }
.item-list { list-style: none; margin: 0; padding: 0; }
.item-list li { border-bottom: 1px solid var(--line); }
.item-list li:last-child { border-bottom: 0; }
.empty-note { color: var(--muted); font-size: 14px; padding: 8px 0; }

.annot-item {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; padding: 14px 4px 14px 14px;
  border-left: 4px solid var(--c);
}
.annot-item:hover { background: var(--accent-soft); }
.annot-item .q {
  font-family: var(--serif);
  font-size: 15px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.annot-item .n { margin-top: 6px; font-size: 14px; white-space: pre-wrap; }
.meta { display: flex; gap: 10px; align-items: center; margin-top: 8px; color: var(--muted); font-size: 12px; }

.badge { display: inline-flex; align-items: center; gap: 5px; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.badge.synced::before { background: #3f9a6b; }
.badge.pending::before { background: #d9a43a; }
.badge.error::before { background: var(--danger); }
.badge.error { color: var(--danger); }

.vocab-item { padding: 12px 2px; }
.vocab-item .vh { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.vocab-item .vl { font-family: var(--serif); font-size: 18px; font-weight: 600; }
.vocab-item.known .vl { color: var(--muted); text-decoration: line-through; }
.vocab-item .vp { color: var(--muted); font-style: italic; font-size: 13px; }
.vocab-item .vm { font-size: 14px; }
.ctx {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; padding: 4px 0; margin-top: 4px;
  font-family: var(--serif); font-size: 14px; color: var(--muted);
}
.ctx:hover { color: var(--ink); }
.vocab-actions { display: flex; gap: 6px; margin-top: 8px; }

.sync-summary { font-size: 14px; margin-bottom: 12px; }
.sync-summary .state { font-size: 16px; font-weight: 600; display: block; margin-bottom: 4px; }
.sync-summary .err { color: var(--danger); white-space: pre-wrap; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.settings { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 4px; }
.settings h3 { font-size: 14px; margin: 18px 0 8px; }
.settings label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.settings label.check { color: var(--ink); display: flex; gap: 8px; align-items: center; }
.settings input:not([type="checkbox"]), .settings select {
  display: block; width: 100%; margin-top: 4px;
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--page); color: var(--ink);
}
.settings small { display: block; margin-top: 4px; }
.form-msg { font-size: 13px; min-height: 1.5em; white-space: pre-wrap; }
.form-msg.ok { color: #3f9a6b; }
.form-msg.bad { color: var(--danger); }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
}
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.small { padding: 2px 9px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.icon-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 5px 10px; }

/* ---------- 浮层 ---------- */
.sel-toolbar, .wordcard {
  position: fixed;
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(20, 30, 40, 0.18);
}
.sel-toolbar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; }
.sel-toolbar[hidden], .wordcard[hidden] { display: none; }
.swatch {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--surface);
  background: var(--c);
  box-shadow: 0 0 0 1px var(--line);
  padding: 0;
  display: inline-block;
}
.tb-sep { width: 1px; height: 20px; background: var(--line); margin: 0 2px; }
.tb-btn { border: 0; background: none; padding: 4px 8px; border-radius: 6px; font-size: 14px; }
.tb-btn:hover { background: var(--accent-soft); }

.wordcard { width: min(340px, calc(100vw - 24px)); padding: 16px; font-size: 14px; }
.wc-head { display: flex; align-items: baseline; gap: 8px; }
.wc-word { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.wc-pos { color: var(--muted); font-style: italic; }
.wc-speak { margin-left: auto; }
.wc-sentence { font-family: var(--serif); color: var(--muted); margin: 8px 0; }
.wc-ai { background: var(--accent-soft); border-radius: 6px; padding: 8px 10px; margin: 8px 0; }
.wc-ai p { margin: 0 0 4px; }
.wc-ai p:last-child { margin: 0; }
.wordcard label { display: block; color: var(--muted); font-size: 12px; margin-top: 8px; }
.wordcard input {
  display: block; width: 100%; margin-top: 3px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--page);
}
.wc-actions { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.wordcard { max-height: min(78vh, 640px); overflow-y: auto; }
.wc-pron { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.wc-pron a, .wc-pron button {
  font-size: 12px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--page); color: var(--ink); text-decoration: none;
}
.wc-pron a:hover, .wc-pron button:hover { border-color: var(--accent); }
.wc-ai { min-height: 1.5em; white-space: normal; }
.wc-ai .ai-line { margin: 0 0 4px; }
.wc-ai .ai-label { font-weight: 600; }
.wc-ai .ai-wait { color: var(--muted); }
.wc-ai .ai-err { color: var(--danger); font-size: 13px; }
.wc-ai .ai-tag { float: right; font-size: 11px; color: var(--muted); }
.wc-actions .spacer { flex: 1; }

.note-dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  width: min(520px, calc(100vw - 24px));
  padding: 20px;
}
.note-dialog::backdrop { background: rgba(10, 15, 20, 0.35); }
.nd-quote {
  margin: 0 0 14px; padding-left: 12px;
  border-left: 3px solid var(--accent);
  font-family: var(--serif); font-size: 16px;
  max-height: 9em; overflow-y: auto; white-space: pre-wrap;
}
.nd-colors { display: flex; gap: 10px; margin-bottom: 10px; }
.nd-colors input { position: absolute; opacity: 0; pointer-events: none; }
.nd-colors label { cursor: pointer; }
.nd-colors input:checked + .swatch { box-shadow: 0 0 0 2px var(--accent); }
.nd-colors input:focus-visible + .swatch { outline: 2px solid var(--accent); outline-offset: 2px; }
.note-dialog textarea {
  width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--page); resize: vertical; line-height: 1.6;
}
.nd-actions { display: flex; gap: 8px; margin-top: 12px; }
.nd-actions .spacer { flex: 1; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: var(--ink); color: var(--page);
  padding: 9px 16px; border-radius: 8px; font-size: 14px; z-index: 50;
  max-width: calc(100vw - 32px);
}

/* ---------- 响应式：≥1100 三栏；768 至 1099 正文加笔记栏（如 MatePad Paper 竖屏）；<768 抽屉 ---------- */
@media (max-width: 1099px) {
  .topbar {
    display: flex; align-items: center; gap: 10px;
    position: fixed; top: 0; left: 0; right: 0; z-index: 20;
    padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top, 0px));
    background: var(--surface); border-bottom: 1px solid var(--line);
  }
  body::before {
    content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
    z-index: 21; background: var(--surface);
  }
  .topbar-title { flex: 1; text-align: center; font-family: var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .reader-tools { display: none; }
  .shell { display: grid; grid-template-columns: minmax(0, 1fr) 320px; height: 100%; padding-top: 52px; }
  .library {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
    width: min(360px, 88vw); padding: 24px 16px;
    transform: translateX(-102%); transition: transform 0.22s ease;
  }
  .library.open { transform: none; }
  #openPanel { display: none; }
  .scrim { position: fixed; inset: 0; background: rgba(10, 15, 20, 0.35); z-index: 35; }
}
@media (max-width: 767px) {
  .shell { display: block; }
  .reader { height: 100%; }
  #openPanel { display: inline-block; }
  .panel {
    position: fixed; top: 0; bottom: 0; right: 0; z-index: 40;
    width: min(360px, 88vw); padding-top: env(safe-area-inset-top, 0px);
    transform: translateX(102%); transition: transform 0.22s ease;
  }
  .panel.open { transform: none; }
  .book { padding: 32px 20px 40vh; }
}
@media (prefers-reduced-motion: reduce) {
  .library, .panel { transition: none; }
}

/* ---------- 墨水屏模式 ---------- */
:root.eink {
  --page: #fff; --surface: #fff; --ink: #000; --muted: #000; --line: #000;
  --accent: #000; --accent-ink: #fff; --accent-soft: #fff; --danger: #000; --ink-max: #000;
}
:root.eink *, :root.eink *::before, :root.eink *::after {
  animation: none !important; transition: none !important; box-shadow: none !important; scroll-behavior: auto !important;
}
:root.eink .hl { background: none !important; text-decoration-thickness: 2px; text-underline-offset: 0.22em; }
:root.eink .hl.c-yellow { text-decoration-line: underline; text-decoration-style: solid; }
:root.eink .hl.c-green { text-decoration-line: underline; text-decoration-style: double; }
:root.eink .hl.c-blue { text-decoration-line: underline; text-decoration-style: wavy; text-decoration-thickness: 1.5px; }
:root.eink .hl.c-pink { text-decoration: none; outline: 1.5px solid #000; outline-offset: 1px; }
:root.eink .vw { border-bottom: 1.5px dashed #000; }
:root.eink .target, :root.eink .hl.flash { background: none !important; outline: 3px solid #000; outline-offset: 2px; }
:root.eink .badge::before { background: #000 !important; }
:root.eink .badge.pending::before { background: #fff !important; border: 1.5px solid #000; }
:root.eink .btn, :root.eink .icon-btn, :root.eink .tb-btn, :root.eink .tabs button { min-height: 40px; border-width: 1.5px; }
:root.eink .sel-toolbar, :root.eink .wordcard, :root.eink .note-dialog, :root.eink .read-dialog { border: 2px solid #000; }
:root.eink .annot-item { border-left-color: #000 !important; }
:root.eink .bp-bar > i { background: #000; }
:root.eink .note-dialog::backdrop, :root.eink .read-dialog::backdrop, :root.eink .scrim { background: transparent; }

/* ---------- 阅读设置弹窗 ---------- */
.read-dialog {
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink);
  width: min(460px, calc(100vw - 20px)); max-height: calc(100vh - 40px); padding: 0 18px 16px;
}
.read-dialog::backdrop { background: rgba(10, 15, 20, 0.3); }
.rd-head { position: sticky; top: 0; background: var(--surface); display: flex; align-items: center; gap: 8px; padding: 14px 0 10px; z-index: 1; }
.rd-head h3 { margin: 0; flex: 1; font-size: 16px; }
.read-dialog h4 { font-size: 13px; color: var(--muted); margin: 16px 0 6px; font-weight: 600; }
.rd-themes { border: 0; padding: 0; margin: 0 0 10px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rd-themes legend { font-size: 13px; color: var(--muted); margin-bottom: 6px; padding: 0; }
.rd-themes label { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; cursor: pointer; }
.rd-themes input { position: absolute; opacity: 0; pointer-events: none; }
.rd-themes .chip { width: 100%; height: 34px; border-radius: 8px; border: 1px solid var(--line); display: grid; place-items: center; font-family: var(--serif); font-size: 15px; }
.rd-themes input:checked + .chip { outline: 2px solid var(--accent); outline-offset: 2px; }
.rd-themes input:focus-visible + .chip { outline: 2px dashed var(--accent); }
.rd-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; margin: 6px 0 10px; }
.rd-color { display: flex; align-items: center; gap: 4px; }
.rd-color input { width: 34px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; }
.rd-range { display: grid; grid-template-columns: 5em 1fr 3.5em; align-items: center; gap: 8px; font-size: 13px; margin: 4px 0; }
.rd-range input { width: 100%; accent-color: var(--accent); }
.rd-range output { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.rd-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; margin: 4px 0; }
.rd-checks label { display: flex; align-items: center; gap: 6px; }
.rd-select { display: block; font-size: 13px; margin: 6px 0; }
.rd-select select { display: block; width: 100%; margin-top: 4px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--page); color: var(--ink); }
.rd-note { font-size: 12px; color: var(--muted); margin: 6px 0 0; }

/* ---------- 查词卡片 v0.4 ---------- */
.wc-ipa { font-family: "Literata", "Charis SIL", "Doulos SIL", "Lucida Sans Unicode", serif; color: var(--accent); font-size: 15px; }
.wc-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; margin-top: 4px; }
.wc-tag { border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; font-size: 11px; }
.wc-link { border: 0; background: none; color: var(--accent); font-size: 12px; padding: 0; text-decoration: underline; text-underline-offset: 2px; }
.wc-lemma-input { width: 9em !important; display: inline-block !important; font-family: var(--serif); font-size: 18px !important; padding: 2px 6px !important; }
.wc-hit { background: none; color: inherit; font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.wc-meaning { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; }
.wc-meaning .wc-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.wc-meaning .wc-label .spacer { flex: 1; }
.wc-meaning-text { margin: 4px 0 0; font-size: 14px; white-space: pre-wrap; }

/* ---------- v0.5：AI 按需按钮、更新提示 ---------- */
.wc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.wc-chips button {
  font-size: 12px; padding: 3px 10px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
}
.wc-chips button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.wc-ai .ai-line + .ai-line { margin-top: 6px; }
.update-banner {
  position: fixed; top: calc(10px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%);
  z-index: 60; border: 0; border-radius: 999px; padding: 8px 18px;
  background: var(--accent); color: var(--accent-ink); font-size: 14px;
}

.wordcard { max-height: none; }
.wordcard .wc-actions { position: sticky; bottom: -16px; margin: 12px -16px -16px; padding: 10px 16px 14px; background: var(--surface); border-top: 1px solid var(--line); }

/* ---------- v0.6：书库文件夹、封面、目录、按章阅读 ---------- */
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.folder-list { list-style: none; margin: 0 0 10px; padding: 0; }
.folder-list li { display: flex; align-items: center; }
.folder-list button.fd {
  flex: 1; display: flex; align-items: center; gap: 6px; text-align: left; border: 0; background: none;
  padding: 5px 8px; border-radius: 6px; font-size: 14px; color: var(--ink);
}
.folder-list button.fd:hover, .folder-list li.drop-over button.fd { background: var(--accent-soft); }
.folder-list button.fd[aria-current="true"] { background: var(--accent-soft); font-weight: 600; }
.folder-list .fd-count { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 400; }
.folder-list .fd-del { border: 0; background: none; color: var(--muted); padding: 2px 6px; font-size: 13px; }
.folder-list .fd-del:hover { color: var(--danger); }
.book-list li { display: flex; align-items: stretch; gap: 2px; }
.book-list li > button[data-book] { flex: 1; min-width: 0; display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.book-list .bc { grid-row: span 3; width: 34px; height: 48px; border-radius: 3px; object-fit: cover; background: var(--line); }
.book-list .bc-none { display: grid; place-items: center; font-family: var(--serif); color: var(--muted); font-size: 16px; }
.book-list .bt, .book-list .ba, .book-list .bp, .book-list .bp-ch { grid-column: 2; }
.book-list .bf { grid-column: 2; font-size: 11px; color: var(--muted); }
.book-list li.unsupported button[data-book] { opacity: 0.55; cursor: not-allowed; }
.book-list .bm { border: 0; background: none; color: var(--muted); padding: 0 6px; font-size: 16px; border-radius: 6px; }
.book-list .bm:hover { background: var(--accent-soft); color: var(--ink); }
.book-list li.dragging { opacity: 0.4; }
.reader-tools { gap: 8px; }
.reader-tools .icon-btn:first-child { margin-right: 0; }
.toc-list { list-style: none; margin: 0; padding: 0 0 8px; }
.toc-list li button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 6px 8px; border-radius: 6px; font-size: 14px; color: var(--ink); }
.toc-list li button:hover { background: var(--accent-soft); }
.toc-list li.toc-part { font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 8px 2px; }
.toc-list li button[aria-current="true"] { font-weight: 600; color: var(--accent); }
.book .book-sub { color: var(--muted); font-size: 0.8em; margin: 0 0 1.2em; font-style: italic; }
.chapter-nav { display: flex; justify-content: space-between; gap: 12px; margin: 3em 0 0; font-family: var(--sans); break-inside: avoid; }
.chapter-nav button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 14px; font-size: 14px; color: var(--ink); }
.chapter-nav button:disabled { opacity: 0.35; }
.book-list .bm { width: auto; flex: none; display: flex; align-items: center; border-left: 0; padding: 0 8px; }

/* ---------- v0.7：书中图片、封面与书籍信息 ---------- */
.book p.img-para { text-indent: 0 !important; text-align: center !important; margin: 1.2em 0; break-inside: avoid; }
.book-img { max-width: 100%; max-height: 70vh; height: auto; cursor: zoom-in; border-radius: 2px; }
:root.paged .book-img { max-height: 60vh; }
:root.eink .book-img, :root.eink .bc, :root.eink .bd-cover { filter: grayscale(1) contrast(1.1); }
.img-viewer { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; }
.img-viewer::backdrop { background: rgba(0, 0, 0, 0.8); }
.img-viewer img { display: block; max-width: 96vw; max-height: 92vh; cursor: zoom-out; background: #fff; }
.book-dialog { width: min(560px, calc(100vw - 20px)); }
.bd-sec { border-top: 1px solid var(--line); padding-top: 4px; }
.bd-cover-row { display: flex; gap: 14px; align-items: flex-start; }
.bd-cover { width: 96px; height: 136px; object-fit: cover; border-radius: 4px; background: var(--line); flex: none; }
.bd-fields { flex: 1; min-width: 0; }
.bd-fields input, .bd-search input, .bd-more input {
  display: block; width: 100%; margin-top: 4px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--page); color: var(--ink);
}
.bd-search { display: flex; gap: 8px; margin: 12px 0 8px; align-items: center; }
.bd-search input { margin-top: 0; }
.bd-cands { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; max-height: 280px; overflow-y: auto; }
.bd-cands button { border: 1px solid var(--line); background: var(--page); border-radius: 6px; padding: 4px; font-size: 11px; color: var(--muted); text-align: center; }
.bd-cands button:hover { border-color: var(--accent); }
.bd-cands img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 3px; background: var(--line); margin-bottom: 3px; }
.bd-more { align-items: center; margin-top: 10px; }
.bd-more input { width: auto; flex: 1; min-width: 140px; margin-top: 0; }
.bd-upload { cursor: pointer; }

/* v0.7 修复：工具栏高度为 0 时按钮被拉伸压扁，文字掉到框外 */
.reader-tools { align-items: flex-start; }
.reader-tools .icon-btn { line-height: 1.4; }
/* 批注列表：删除按钮 */
.item-list li.annot-row { display: flex; align-items: stretch; }
.item-list li.annot-row .annot-item { flex: 1; min-width: 0; }
.annot-del { border: 0; background: none; color: var(--muted); padding: 0 10px; font-size: 13px; border-radius: 6px; }
.annot-del:hover { color: var(--danger); background: var(--accent-soft); }
.known-group summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 10px 2px; }
.bd-search .btn { flex: none; white-space: nowrap; }

/* ---------- v0.8：书库界面与阅读界面、可拖动折叠的侧栏、标签、生词本、全书进度 ---------- */
:root { --lw: 260px; --rw: 360px; --tag-red: #e5484d; --tag-orange: #f76b15; --tag-yellow: #d4a00a; --tag-green: #30a46c; --tag-blue: #0090ff; --tag-purple: #8e4ec6; }
body.view-library .reader-only { display: none !important; }
body.view-reader .library-only { display: none !important; }

@media (min-width: 1100px) {
  .shell { grid-template-columns: var(--lw) 6px minmax(0, 1fr) 6px var(--rw); }
  .shell.left-collapsed { grid-template-columns: 0 0 minmax(0, 1fr) 6px var(--rw); }
  .shell.right-collapsed { grid-template-columns: var(--lw) 6px minmax(0, 1fr) 0 0; }
  .shell.left-collapsed.right-collapsed { grid-template-columns: 0 0 minmax(0, 1fr) 0 0; }
  .shell.left-collapsed #library, .shell.left-collapsed #resizeLeft,
  .shell.right-collapsed #panel, .shell.right-collapsed #resizeRight { display: none; }
}
.resizer { cursor: col-resize; background: transparent; position: relative; z-index: 3; touch-action: none; }
.resizer::after { content: ""; position: absolute; inset: 0 2px; background: var(--line); }
.resizer:hover::after, .resizer.dragging::after, .resizer:focus-visible::after { background: var(--accent); }
body.resizing { cursor: col-resize; user-select: none; }
.library { display: flex; flex-direction: column; padding: 0; position: relative; border-right: 0; }
.panel { border-left: 0; position: relative; }
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 16px 16px; }
.tag-pane { flex: none; max-height: 38%; overflow-y: auto; border-top: 1px solid var(--line); padding: 10px 16px 14px; }
.collapse-btn { position: absolute; top: 8px; right: 8px; border: 0; background: none; color: var(--muted); font-size: 16px; padding: 2px 8px; border-radius: 6px; z-index: 2; }
.collapse-btn:hover { background: var(--accent-soft); color: var(--ink); }
.tabs .collapse-right { position: static; margin: 0 4px 0 -6px; align-self: center; }
.expand-btn { position: fixed; top: 50%; transform: translateY(-50%); z-index: 15; border: 1px solid var(--line); background: var(--surface); color: var(--muted); padding: 14px 4px; font-size: 13px; }
.expand-left { left: 0; border-left: 0; border-radius: 0 8px 8px 0; }
.expand-right { right: 0; border-right: 0; border-radius: 8px 0 0 8px; }
.main-area { min-height: 0; min-width: 0; display: flex; flex-direction: column; }
.main-area > .reader { flex: 1; min-height: 0; }

/* 书库界面 */
.library-main { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 32px 48px; background: var(--page); }
.lib-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.lib-head h1 { font-family: var(--serif); font-weight: 500; font-size: 26px; margin: 0; flex: 1; min-width: 8em; }
.lib-head input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); min-width: 220px; }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 18px; list-style: none; padding: 0; margin: 0; }
.book-row { display: flex; gap: 16px; overflow-x: auto; list-style: none; padding: 2px 2px 10px; margin: 0 0 22px; }
.book-row li { flex: 0 0 150px; }
.book-grid li, .book-row li { display: block !important; position: relative; }
.book-grid li > button[data-book], .book-row li > button[data-book] {
  display: flex !important; flex-direction: column; align-items: stretch; gap: 3px; width: 100%; padding: 6px; border-left: 0 !important; border-radius: 8px; text-align: left;
}
.book-grid .bc, .book-row .bc { width: 100%; height: auto; aspect-ratio: 2 / 3; border-radius: 4px; box-shadow: 0 2px 8px rgba(20, 30, 40, 0.15); margin-bottom: 6px; }
.book-grid .bc-none, .book-row .bc-none { display: grid; place-items: center; font-size: 42px; }
.book-grid .bt, .book-row .bt { font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-grid .bm, .book-row .bm { position: absolute; top: 10px; right: 10px; background: var(--surface); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); height: 26px; }
.btags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.btag { font-size: 10px; border-radius: 999px; padding: 0 6px; border: 1px solid var(--tc, var(--line)); color: var(--tc, var(--muted)); }

/* 标签 */
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 2px 9px 2px 6px; font-size: 12px; color: var(--ink); }
.tag[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
.tag .tdot { width: 10px; height: 10px; border-radius: 50%; background: var(--tc, transparent); border: 1px solid var(--tc, var(--muted)); cursor: pointer; }
.tag .tcount { color: var(--muted); font-weight: 400; }
.tag-empty { color: var(--muted); font-size: 12px; }
.bd-tags { display: flex; flex-wrap: wrap; gap: 6px; min-height: 8px; }
.bd-tags .tag button { border: 0; background: none; color: var(--muted); padding: 0 0 0 2px; font-size: 13px; }

/* 阅读界面左栏 */
.side-book { display: flex; gap: 10px; align-items: center; margin: 14px 0 16px; }
.side-book img { width: 44px; height: 64px; object-fit: cover; border-radius: 3px; background: var(--line); }
.side-book .sbt { font-family: var(--serif); font-size: 15px; line-height: 1.3; }
.side-book .sba { color: var(--muted); font-size: 12px; }

/* 生词本 */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 8px; }
.seg button { border: 0; background: none; padding: 4px 14px; font-size: 13px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.vb-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.vb-filters select, .vb-filters input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.vb-count { color: var(--muted); font-size: 13px; }
.vb-list li.vocab-item { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; }
.vb-ipa { color: var(--accent); font-size: 13px; }

/* 全书进度条 */
.statusbar { bottom: 3px; }
.book-progress { position: sticky; bottom: 0; height: 3px; background: var(--line); z-index: 4; }
.book-progress i { display: block; height: 100%; width: 0; background: var(--accent); }
:root.paged .book-progress { position: static; }

@media (max-width: 1099px) {
  .resizer, .collapse-btn:not(.collapse-right), .expand-btn { display: none !important; }
  .tabs .collapse-right { display: none; }
  .view-library .shell { grid-template-columns: minmax(0, 1fr); }
  .view-library .panel {
    position: fixed; top: 0; bottom: 0; right: 0; z-index: 40; width: min(360px, 88vw);
    transform: translateX(102%); transition: transform 0.22s ease;
  }
  .view-library .panel.open { transform: none; }
  .view-library #openPanel { display: inline-block; }
  .library-main { padding: 16px 16px 40px; }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 16px 12px; }
}
@media (min-width: 1100px) {
  /* 每个区域固定在自己的列，侧栏隐藏时其他区域不会错位 */
  .shell > #library { grid-column: 1; grid-row: 1; }
  .shell > #resizeLeft { grid-column: 2; grid-row: 1; }
  .shell > .main-area { grid-column: 3; grid-row: 1; }
  .shell > #resizeRight { grid-column: 4; grid-row: 1; }
  .shell > #panel { grid-column: 5; grid-row: 1; }
}
@media (max-width: 767px) {
  /* 手机：阅读区和书库区自己滚动，而不是整个页面滚动 */
  .main-area { height: 100%; }
  .main-area > .reader, .main-area > .library-main { height: 100%; }
}
/* 窄屏抽屉：上面为折叠按钮加的 position: relative 不能覆盖抽屉的固定定位 */
@media (max-width: 1099px) {
  .library { position: fixed; }
}
@media (max-width: 767px) {
  .panel { position: fixed; }
}

/* ---------- v0.9 ---------- */
/* 55：最近阅读卡片固定宽度，长章节名不再把卡片和封面撑大 */
.book-row li { flex: 0 0 150px; width: 150px; min-width: 0; overflow: hidden; }
.book-row li > button[data-book], .book-grid li > button[data-book] { min-width: 0; }
.book-row .bp-ch, .book-grid .bp-ch { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
/* 53：工具栏开关显示当前状态 */
.reader-tools .icon-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
/* 回收站 */
.trash-view .trash-item { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; }
.trash-item .tt { flex: 1; min-width: 0; }
.trash-item .tt b { display: block; font-family: var(--serif); font-weight: 500; }
.trash-item .tt span { color: var(--muted); font-size: 12px; }

/* ---------- v0.10：好句、书签、问答 ---------- */
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs button[role="tab"] { padding-left: 9px; padding-right: 9px; white-space: nowrap; }
.annot-item .good-star { color: #d4a00a; margin-right: 4px; }
.nd-good { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.mark-item { display: flex; align-items: stretch; }
.mark-item .mk { flex: 1; text-align: left; border: 0; background: none; padding: 12px 6px; }
.mark-item .mk:hover { background: var(--accent-soft); }
.mark-item .mk b { display: block; font-size: 13px; color: var(--accent); font-weight: 600; }
.mark-item .mk span { font-family: var(--serif); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.last-read { position: relative; }
.last-read::before {
  content: "上次读到这里"; position: absolute; left: -0.2em; top: -1.5em; font: 12px var(--sans); color: var(--accent);
  border-top: 2px solid var(--accent); padding-top: 2px; width: 100%;
}
.qa-pane { display: flex; flex-direction: column; }
.qa-empty { color: var(--muted); font-size: 14px; }
.qa-passage { margin: 0 0 8px; padding-left: 10px; border-left: 3px solid var(--accent); font-family: var(--serif); font-size: 14px; max-height: 7.5em; overflow-y: auto; white-space: pre-wrap; }
.qa-passage img { max-width: 100%; max-height: 140px; display: block; }
.qa-opts { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin: 4px 0; }
.qa-opts label { display: flex; align-items: center; gap: 4px; }
.qa-log { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.qa-log li { max-width: 92%; padding: 8px 11px; border-radius: 12px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.qa-log li.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.qa-log li.ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.qa-log li.ai.err { color: var(--danger); }
.qa-log .qa-src { display: block; font-size: 12px; margin-top: 6px; }
.qa-log .qa-src a { color: var(--accent); word-break: break-all; }
.qa-log .qa-actions { display: flex; gap: 8px; margin-top: 6px; align-items: center; white-space: normal; }
.qa-log .qa-saved { color: var(--muted); font-size: 12px; }
.qa-form { display: flex; gap: 8px; align-items: flex-end; position: sticky; bottom: 0; background: var(--surface); padding: 8px 0 4px; }
.qa-form textarea { flex: 1; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--page); color: var(--ink); resize: vertical; font-size: 14px; }
.img-viewer { position: fixed; }
.img-ask { position: absolute; right: 10px; bottom: 10px; }
/* 标签栏可横向滚动后，不能被右栏的纵向布局压缩 */
.tabs { flex: none; }

.wc-ai strong, .qa-log strong { font-weight: 700; }
.wc-ai code, .qa-log code { font-size: 0.92em; background: var(--accent-soft); border-radius: 3px; padding: 0 3px; }

/* ---------- v0.11：全局搜索、按作者、短评、卡片对齐、配色 ---------- */
.gsearch { display: flex; gap: 6px; align-items: center; }
.gsearch select, .gsearch input { padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); }
.gsearch input { min-width: 220px; }
.search-view .sr { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; }
.search-view .sr:hover { border-color: var(--accent); }
.search-view .sr b { font-family: var(--serif); font-weight: 500; }
.search-view .sr .sm { color: var(--muted); font-size: 12px; margin-left: 6px; }
.search-view .sr .ss { display: block; font-family: var(--serif); font-size: 14px; margin-top: 4px; }
.search-view mark { background: var(--hl-yellow); color: inherit; border-radius: 2px; }
.author-group summary { cursor: pointer; padding: 5px 8px; font-size: 14px; border-radius: 6px; list-style: none; }
.author-group summary::-webkit-details-marker { display: none; }
.author-group summary:hover { background: var(--accent-soft); }
/* 卡片对齐：书名两行、作者一行、短评两行、阅读位置一行，进度条在底部同一条线 */
.book-grid li > button[data-book], .book-row li > button[data-book] { height: 100%; }
.book-grid .bt, .book-row .bt { min-height: 2.6em; }
.book-grid .ba, .book-row .ba { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.4em; }
.brev { font-family: var(--serif); font-style: italic; font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-row .bp-ch { min-height: 1.4em; }
.book-grid .bp, .book-row .bp { margin-top: auto; }
.book-row li { display: flex !important; }
.rd-hex { width: 6.5em; margin-left: 6px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 5px; font-family: ui-monospace, monospace; font-size: 12px; background: var(--page); color: var(--ink); }
.rd-hex.bad { border-color: var(--danger); }
.rd-themes .mytheme { position: relative; }
.rd-themes .mytheme button { position: absolute; top: -6px; right: -6px; border: 0; border-radius: 50%; width: 16px; height: 16px; font-size: 11px; line-height: 16px; padding: 0; background: var(--line); color: var(--ink); }

/* ---------- v0.12：PDF、整章朗读 ---------- */
.tts-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(40px + env(safe-area-inset-bottom, 0px)); z-index: 45;
  display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px;
  box-shadow: 0 6px 24px rgba(20, 30, 40, 0.18); font-size: 13px; }
.tts-rate { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.tts-rate select { border: 1px solid var(--line); border-radius: 6px; background: var(--page); color: var(--ink); padding: 2px 4px; }
.tts-where { color: var(--muted); max-width: 14em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book p.tts-now { background: color-mix(in srgb, var(--accent) 7%, transparent); border-radius: 4px; }
::highlight(tts) { background-color: color-mix(in srgb, var(--accent) 28%, transparent); }
:root.eink ::highlight(tts) { background-color: transparent; text-decoration: underline 2px; }

/* ---------- v0.13：返回原处、进度拖动、本书内搜索 ---------- */
.reader { overflow-anchor: none; }
.book-progress { cursor: pointer; touch-action: none; }
.book-progress::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; bottom: -2px; }
.book-progress:hover, .book-progress.dragging { height: 6px; }
.progress-tip { position: absolute; bottom: 14px; transform: translateX(-50%); white-space: nowrap; background: var(--ink); color: var(--page);
  font-size: 12px; padding: 4px 9px; border-radius: 6px; pointer-events: none; }
.return-btn { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(44px + env(safe-area-inset-bottom, 0px)); z-index: 44;
  border: 1px solid var(--accent); background: var(--surface); color: var(--accent); border-radius: 999px; padding: 7px 16px; font-size: 13px;
  box-shadow: 0 4px 16px rgba(20, 30, 40, 0.15); }
.find-form { display: flex; gap: 6px; margin-bottom: 6px; }
.find-form input { flex: 1; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--page); color: var(--ink); }
.find-bar { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.find-bar label { display: flex; align-items: center; gap: 4px; margin-right: auto; }
.find-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.find-item:hover, .find-item[aria-current="true"] { background: var(--accent-soft); }
.find-item b { display: block; font-size: 12px; color: var(--accent); font-weight: 600; }
.find-item span { font-family: var(--serif); font-size: 14px; }
.find-item mark { background: var(--hl-yellow); color: inherit; }

/* ---------- v0.13：PDF 原版阅读 ---------- */
:root.pdf-original .reader { overflow-y: auto !important; display: block !important; }
:root.pdf-original .reader-tools { flex-wrap: wrap; justify-content: flex-end; }
.pdf-view { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 56px 16px 60px; }
.pdf-page { position: relative; overflow: hidden; background: #fff; box-shadow: 0 2px 10px rgba(20, 30, 40, 0.16); flex: none; }
.pdf-inner { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.pdf-inner canvas { display: block; }
.pdf-hl-layer { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: multiply; }
.pdf-hl { position: absolute; border-radius: 2px; background: var(--hl-yellow); opacity: 0.55; }
.pdf-hl.c-green { background: var(--hl-green); } .pdf-hl.c-blue { background: var(--hl-blue); } .pdf-hl.c-pink { background: var(--hl-pink); }
.pdf-target { position: absolute; background: var(--accent); opacity: 0.3; border-radius: 2px; animation: pdf-flash 1.2s ease 2; }
@keyframes pdf-flash { 50% { opacity: 0.6; } }
.pdf-vw { position: absolute; height: 0; border-bottom: 1.5px dashed var(--accent); }
.pdf-view .textLayer { position: absolute; text-align: initial; inset: 0; overflow: clip; opacity: 1; line-height: 1; text-size-adjust: none; transform-origin: 0 0; z-index: 2; }
.pdf-view .textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.pdf-view .textLayer span.markedContent { top: 0; height: 0; }
.pdf-view .textLayer ::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.pdf-view .textLayer br::selection { background: transparent; }
.pdf-view.dark .pdf-page { background: #111; }
.pdf-view.dark canvas { filter: invert(0.88) hue-rotate(180deg); }
.pdf-view.dark .pdf-hl-layer { mix-blend-mode: screen; }
:root.eink .pdf-view canvas { filter: grayscale(1) contrast(1.15); }
:root.eink .pdf-page { box-shadow: none; border: 1px solid #000; }
.pdf-tools { display: inline-flex; gap: 6px; align-items: center; }
.pdf-page-input { width: 3.6em; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); text-align: center; }
.pdf-page-total { color: var(--muted); font-size: 12px; }
.toc-list .toc-pg { float: right; color: var(--muted); font-size: 12px; margin-left: 8px; }
/* 原版模式下正文元素是隐藏的，工具栏仍要显示 */
:root.pdf-original .reader-tools { display: flex !important; }
@media (max-width: 1099px) {
  /* 窄屏顶栏已有目录、Aa、笔记，这里只放 PDF 的缩放、页码和模式切换 */
  :root.pdf-original .reader-tools > :not(#pdfTools):not(#toolsMode) { display: none; }
}
/* 进度条的扩大点击区域必须相对进度条本身定位（翻页模式下进度条不是 sticky），否则会盖住整个阅读区 */
.book-progress { position: relative; }
.main-area > .reader:not(.x) .book-progress { position: sticky; }
:root.paged .book-progress { position: relative; }

/* ---------- v0.14：书目信息、作者合并 ---------- */
.bd-two { display: grid; grid-template-columns: 1fr 6em; gap: 8px; }
.bd-metas { list-style: none; margin: 4px 0 8px; padding: 0; max-height: 300px; overflow-y: auto; }
.bd-metas li { display: flex; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; }
.bd-metas img { width: 40px; height: 58px; object-fit: cover; border-radius: 3px; background: var(--line); flex: none; }
.bd-metas .mi { flex: 1; min-width: 0; font-size: 13px; }
.bd-metas .mi b { display: block; font-family: var(--serif); font-weight: 500; font-size: 14px; }
.bd-metas .mi span { display: block; color: var(--muted); }
.author-suggest { margin: 4px 0 6px; padding: 8px; border: 1px dashed var(--accent); border-radius: 8px; font-size: 12px; }
.author-suggest .as-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 6px; }
.author-suggest .as-row span { flex: 1 1 100%; }
.author-suggest button { font-size: 11px; padding: 2px 6px; }

/* ---------- v0.14：导入的词典 ---------- */
.dict-admin { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 4px; }
.dict-admin h3 { font-size: 15px; margin: 12px 0 4px; }
.dict-list { list-style: none; margin: 8px 0; padding: 0; }
.dict-list li { display: flex; align-items: center; gap: 6px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.dict-list .dn { flex: 1; min-width: 0; }
.dict-list .dn b { display: block; font-weight: 600; }
.dict-list .dn span { color: var(--muted); font-size: 12px; }
.dict-list .dn .err { color: var(--danger); }
.dict-list button { border: 1px solid var(--line); background: var(--surface); border-radius: 5px; padding: 2px 6px; font-size: 12px; color: var(--ink); }
.dict-mode { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 0 auto; font-size: 13px; }
.wc-dtabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 6px; }
.wc-dtabs button { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 3px 9px; font-size: 12px; color: var(--ink); }
.wc-dtabs button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.wc-dtabs button:disabled { opacity: 0.4; cursor: default; }
.wc-dict iframe { width: 100%; border: 0; min-height: 60px; max-height: 360px; display: block; background: transparent; }
.wc-dict h5 { margin: 10px 0 2px; font-size: 12px; color: var(--muted); }
.wc-dict .row-btns { margin: 4px 0 0; }
/* 原版模式：工具栏是一条有底色的独立工具条，正文从它下面开始，不再被按钮压住 */
:root.pdf-original .reader-tools {
  height: auto; align-items: center; flex-wrap: wrap; gap: 6px; padding: 6px 12px;
  background: var(--read-bg, var(--page)); border-bottom: 1px solid var(--line);
}
:root.pdf-original .reader-tools .icon-btn { margin: 0; }
:root.pdf-original .pdf-tools { flex-wrap: wrap; }
:root.pdf-original .pdf-page-input { height: 30px; box-sizing: border-box; }
:root.pdf-original .pdf-view { padding-top: 18px; }

.wc-dict iframe { max-height: none; overflow: hidden; }

.folder-list .fd-tog { flex: none; width: 18px; border: 0; background: none; color: var(--muted); padding: 0; font-size: 11px; cursor: pointer; }
.folder-list .fd-tog:hover { color: var(--ink); }

/* ---------- v0.14.2：封面完整显示（不裁切），底部对齐 ---------- */
.book-list .bcw { grid-row: span 3; width: 34px; height: 48px; display: flex; align-items: flex-end; justify-content: center; }
.book-list .bcw .bc { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; grid-row: auto; }
.book-grid .bcw, .book-row .bcw { width: 100%; height: auto; aspect-ratio: 2 / 3; margin-bottom: 6px; }
.book-grid .bcw .bc, .book-row .bcw .bc {
  width: auto; height: auto; max-width: 100%; max-height: 100%; aspect-ratio: auto; margin: 0;
  object-fit: contain; border-radius: 4px; box-shadow: 0 2px 8px rgba(20, 30, 40, 0.18);
}
/* "⋯"按钮：有鼠标的设备上只在移到这本书上时出现；触屏一直显示，但更小、半透明 */
.book-grid .bm, .book-row .bm { opacity: 0.75; height: 22px; padding: 0 6px; font-size: 13px; top: 8px; right: 8px; }
@media (hover: hover) {
  .book-grid .bm, .book-row .bm { opacity: 0; transition: opacity 0.15s; }
  .book-grid li:hover .bm, .book-row li:hover .bm, .book-grid .bm:focus-visible, .book-row .bm:focus-visible { opacity: 1; }
}

.pdf-err { position: absolute; left: 16px; right: 16px; top: 40%; text-align: center; color: #b00; font: 14px system-ui, sans-serif; background: #fff8f6; border: 1px solid #f0c8c0; border-radius: 8px; padding: 10px; z-index: 3; }

.opening-note { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 60; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 22px; font-size: 15px; box-shadow: 0 8px 30px rgba(20, 30, 40, 0.2); }

/* ---------- v0.15：书籍面板排版 ---------- */
.bd-fields label.rd-select { display: block; margin-bottom: 8px; }
.bd-fields textarea { display: block; width: 100%; margin-top: 4px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--page); color: var(--ink); font: inherit; font-size: 14px; resize: vertical; min-height: 3.2em; box-sizing: border-box; }
.book-dialog input[type="checkbox"] { display: inline-block; width: auto; margin: 0; flex: none; }
.book-dialog .nd-good { display: flex; align-items: center; justify-content: flex-start; gap: 6px; width: auto; margin: 4px 0 8px; font-size: 13px; color: var(--muted); }
.book-dialog .bd-search .nd-good { margin: 0; white-space: nowrap; }
.bd-hint { margin: -4px 0 8px; }

.lib-sort { display: inline-flex; gap: 6px; align-items: center; }
.lib-sort select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); }
.removed-note { margin: 8px auto; max-width: 36em; padding: 10px 14px; border: 1px solid #e2b7a8; background: #fff6f2; color: #8a3a1e; border-radius: 8px; font-size: 14px; }

/* ---------- v0.15：评分与短评 ---------- */
.stars { display: inline-flex; gap: 1px; vertical-align: middle; }
.stars button { border: 0; background: none; padding: 0 1px; font-size: 16px; line-height: 1; color: var(--line); cursor: pointer; }
.stars button.on { color: #e0a800; }
.stars.big button { font-size: 26px; }
.bstars { color: #e0a800; font-size: 12px; letter-spacing: 1px; cursor: pointer; }
.brev { cursor: pointer; }
.side-rate { margin: -6px 0 14px; }
.side-rate .side-review { font-family: var(--serif); font-size: 13px; color: var(--muted); margin: 4px 0 0; cursor: text; white-space: pre-wrap; }
.side-rate .side-review.empty { font-style: italic; opacity: 0.7; }
.side-rate textarea, .rate-dialog textarea, .finish-card textarea { display: block; width: 100%; box-sizing: border-box; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--page); color: var(--ink); font: inherit; font-size: 14px; margin-top: 6px; }
.rate-dialog { width: min(420px, calc(100vw - 24px)); }
.finish-card { position: fixed; right: 20px; bottom: calc(52px + env(safe-area-inset-bottom, 0px)); z-index: 46; width: min(340px, calc(100vw - 40px));
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: 0 10px 30px rgba(20, 30, 40, 0.2); }
.finish-card b { display: block; margin-bottom: 6px; }

/* ---------- v0.16：外部访问、修改历史、备份 ---------- */
.token-name { flex: 1; min-width: 8em; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--page); color: var(--ink); }
#apiAdmin select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.token-new { margin: 8px 0; padding: 10px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent-soft); font-size: 13px; }
.token-new code { display: block; word-break: break-all; font-size: 12px; background: var(--page); padding: 6px 8px; border-radius: 6px; margin: 4px 0 6px; user-select: all; }
.hist-list { list-style: none; margin: 6px 0 12px; padding: 0; max-height: 320px; overflow-y: auto; }
.hist-list li { display: flex; gap: 8px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.hist-list .hm { flex: 1; min-width: 0; }
.hist-list .hm span { display: block; color: var(--muted); font-size: 12px; }
.hist-list .hm b { font-weight: 600; }
.hist-list button { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 5px; padding: 2px 6px; font-size: 12px; color: var(--ink); }

/* ---------- v0.17：极简线条图标 ---------- */
.icon-btn.ic { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 34px; padding: 0; }
.icon-btn.ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.ic[aria-pressed="true"] svg { stroke-width: 2; }
#toolsMark[aria-pressed="true"] svg path { fill: currentColor; }
/* 朗读：正在朗读时图标高亮，声波一闪一闪 */
.speak-btn[aria-pressed="true"] { background: var(--accent); color: var(--page); border-color: var(--accent); }
.speak-btn[aria-pressed="true"] svg .w1 { animation: wave 1.2s ease-in-out infinite; }
.speak-btn[aria-pressed="true"] svg .w2 { animation: wave 1.2s ease-in-out 0.3s infinite; }
@keyframes wave { 50% { opacity: 0.25; } }
:root.eink .speak-btn[aria-pressed="true"] svg path { animation: none; }
/* ---------- 目录跟随阅读位置 ---------- */
.toc-list button[aria-current="true"] { position: relative; }
.toc-list button[aria-current="true"]::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: var(--accent); }
.toc-list .toc-part.cur-anc, .toc-list button.cur-anc { color: var(--accent); font-weight: 600; }
.toc-pct { display: block; font-size: 11px; color: var(--accent); font-weight: 500; margin-top: 2px; }

/* ---------- v0.17：你的笔记和原文明显区分 ---------- */
.item-list .n, .wc-annot .n {
  position: relative; margin-top: 8px; padding: 7px 10px 7px 10px; border-radius: 8px;
  background: var(--accent-soft); color: var(--ink); font-family: var(--sans, system-ui, sans-serif); font-weight: 600; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap;
}
.item-list .n::before, .wc-annot .n::before {
  content: "笔记"; display: inline-block; margin-right: 6px; padding: 0 5px; border-radius: 4px; vertical-align: 1px;
  background: var(--accent); color: var(--page); font-size: 10.5px; font-weight: 600; line-height: 1.6;
}
.item-list .q { font-family: var(--serif); color: var(--muted); }

/* ---------- v0.17：连接诊断、同步失败原因 ---------- */
.diag-box { margin: 10px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.diag-box ul { list-style: none; margin: 6px 0; padding: 0; }
.diag-box li { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; border-bottom: 1px solid var(--line); }
.diag-box li .du { flex: 1; min-width: 0; word-break: break-all; }
.diag-box li .du span { display: block; color: var(--muted); font-size: 12px; }
.diag-box .ok { color: #2f7d4f; font-weight: 600; }
.diag-box .no { color: var(--danger); font-weight: 600; }
.badge.error { cursor: pointer; text-decoration: underline dotted; }

/* ---------- v0.17：搜索结果按书分组 ---------- */
.sr-book { display: flex; align-items: baseline; gap: 8px; padding: 12px 6px 4px; border-bottom: 1px solid var(--line); }
.sr-book b { font-family: var(--serif); font-size: 15px; }
.sr-book .sm { margin-left: auto; color: var(--muted); font-size: 12px; }
.sr-tag { font-size: 11px; color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 0 4px; }
#searchList .sr mark { background: var(--hl-yellow); color: inherit; }

/* ---------- v0.18：PDF 划线颜色均匀 ---------- */
.pdf-hl-group { position: absolute; inset: 0; opacity: 0.42; pointer-events: none; }
.pdf-hl-group .pdf-hl { opacity: 1; border-radius: 2px; }
.pdf-view.dark .pdf-hl-group { opacity: 0.55; }

/* v0.18 的统一画框已撤回：封面按原比例完整显示、底部对齐（v0.14.2 的方式） */

.dict-status { font-size: 13px; padding: 8px 10px; border-radius: 8px; margin: 6px 0; }
.dict-status.ok { color: var(--muted); padding: 0; }
.dict-status.warn { border: 1px solid #e0b96a; background: #fff8e8; color: #6b4a10; }
.dict-status .dl { display: block; font-size: 12px; margin-top: 4px; color: var(--muted); }

/* ---------- v0.19：快捷键提示（只在有鼠标和键盘的设备上显示） ---------- */
@media (hover: hover) and (pointer: fine) {
  [data-key]::after { content: attr(data-key); margin-left: 5px; padding: 0 4px; border: 1px solid currentColor; border-radius: 3px; font-size: 10px; line-height: 1.4; opacity: 0.55; font-family: ui-monospace, monospace; }
}
.toast-act { margin-left: 10px; border: 1px solid currentColor; background: none; color: inherit; border-radius: 5px; padding: 1px 8px; font: inherit; cursor: pointer; }

/* ---------- v0.19：阅读统计 ---------- */
.btime { display: block; font-size: 11.5px; color: var(--muted); }
.stats-view { max-width: 760px; }
.st-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 6px 0 18px; }
.st-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.st-card b { display: block; font-size: 20px; font-family: var(--serif); }
.st-card span { font-size: 12px; color: var(--muted); }
.st-bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.st-bars i { flex: 1; background: var(--accent); opacity: 0.75; border-radius: 3px 3px 0 0; min-height: 1px; }
.st-bars i.today { opacity: 1; }
.st-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin: 3px 0 16px; }
.st-books { list-style: none; padding: 0; margin: 0; }
.st-books li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.st-books .bt2 { flex: 1; min-width: 0; font-family: var(--serif); }
.st-books .bar { width: 120px; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.st-books .bar i { display: block; height: 100%; background: var(--accent); }
.st-books .tm { width: 7em; text-align: right; color: var(--muted); font-size: 12px; }
.stats-view h3 { font-size: 15px; margin: 4px 0 6px; }
.stats-view .rd-note { margin-bottom: 14px; }

/* ---------- v0.20：英式、美式发音 ---------- */
.wc-says { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 2px 0 6px; }
.wc-say { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 2px 0; color: var(--ink); font-size: 13px; cursor: pointer; }
.wc-say svg { width: 17px; height: 17px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.wc-say .wc-ipa { margin-left: 2px; }
.wc-say.real svg { stroke: #c0392b; } /* 有词典真人录音 */
.vb-says { display: inline-flex; gap: 4px; margin: 0 6px; }
.vb-says .wc-say { font-size: 11px; }
.vb-says .wc-say svg { width: 14px; height: 14px; }

/* ---------- v0.20：离线暂存 ---------- */
.offline-badge { position: fixed; left: 14px; bottom: calc(40px + env(safe-area-inset-bottom, 0px)); z-index: 47; background: #fff4dc; color: #6b4a10;
  border: 1px solid #e0b96a; border-radius: 999px; padding: 4px 12px; font-size: 12.5px; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); }

/* ---------- v0.21：点 logo 回到全部书籍 ---------- */
.logo-btn { border: 0; background: none; padding: 0; margin: 0; cursor: pointer; display: inline-flex; border-radius: 6px; }
.logo-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- v0.22：加入生词本放在词典页签那一行的右上角 ---------- */
.wc-tabrow { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0 4px; }
.wc-tabrow .wc-dtabs { flex: 1; min-width: 0; margin: 0; }
.wc-tabrow .wc-dtabs[hidden] { display: block; visibility: hidden; height: 0; }
.wc-vocab { margin-left: auto; display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; align-items: center; flex: none; max-width: 55%; }
.wc-vocab .btn.small { padding: 3px 10px; font-size: 12.5px; }
.wc-invocab { font-size: 12px; color: var(--accent); }

/* ---------- v0.22：拖动查词卡片 ---------- */
@media (min-width: 701px) {
  #wordcard .wc-head { cursor: grab; touch-action: none; user-select: none; }
  #wordcard.dragging { box-shadow: 0 14px 40px rgba(20, 30, 40, 0.3); }
  #wordcard.dragging .wc-head { cursor: grabbing; }
}

/* ---------- v0.22：书籍 / 网摘切换 ---------- */
.kind-tabs { display: flex; gap: 4px; margin: 0 0 8px; padding: 3px; background: var(--line); border-radius: 9px; }
.kind-tabs button { flex: 1; border: 0; background: none; border-radius: 7px; padding: 5px 8px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.kind-tabs button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.st-bars i.clip { background: #c9893a; }
.st-bar { flex: 1; display: flex; flex-direction: column-reverse; height: 100%; }
.st-bar i { flex: none; width: 100%; }

/* ---------- v0.22：批注的实线下划线（132）。生词是虚线（用下边框画，位置更低，不重叠） ---------- */
#book .hl.ul { text-decoration-line: underline; text-decoration-style: solid; text-decoration-thickness: 2px; text-underline-offset: 3px; }
#book .hl.ul.c-yellow { text-decoration-color: #b8860b; }
#book .hl.ul.c-green { text-decoration-color: #2e7d32; }
#book .hl.ul.c-blue { text-decoration-color: #1565c0; }
#book .hl.ul.c-pink { text-decoration-color: #ad1457; }
#book .hl.ul.vw { padding-bottom: 3px; }
:root.eink #book .hl.ul { text-decoration-color: #000; }
.pdf-ul { position: absolute; border-bottom: 2.5px solid; pointer-events: none; }
.pdf-ul.c-yellow { border-color: #b8860b; } .pdf-ul.c-green { border-color: #2e7d32; }
.pdf-ul.c-blue { border-color: #1565c0; } .pdf-ul.c-pink { border-color: #ad1457; }
.tb-under u { text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* ---------- v0.23：只有下划线、没有底色的批注（133） ---------- */
#book .hl.c-none { background: none; }
#book .hl.ul.c-none { text-decoration-color: var(--ink); }
.pdf-hl.c-none { background: transparent !important; }
.pdf-ul.c-none { border-color: var(--ink); }
.swatch.c-none, .dot.c-none { background: none; border: 1px solid var(--muted); }

.say-src { font-size: 11.5px; color: var(--muted); }

/* ---------- v0.23：上传书籍（139） ---------- */
.upload-btn { margin-left: 12px; vertical-align: middle; }
.upload-dialog { width: min(560px, 92vw); }
.upload-dialog label { display: block; margin: 8px 0; }
.upload-dialog select, .upload-dialog input { width: 100%; box-sizing: border-box; padding: 6px 8px; margin-top: 4px; }
.up-list { list-style: none; padding: 0; margin: 10px 0; max-height: 40vh; overflow: auto; }
.up-list li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.up-list .bar { height: 4px; background: var(--line); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.up-list .bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.up-list .st { float: right; color: var(--muted); }
.up-list .st.bad { color: #b33; }
body.dragging-files #library { outline: 3px dashed var(--accent); outline-offset: -8px; }

/* ---------- v0.24：删除广告（140） ---------- */
.edit-dialog { width: min(680px, 94vw); }
.ed-mode { display: flex; gap: 16px; flex-wrap: wrap; margin: 6px 0; font-size: 13.5px; }
.ed-list { list-style: none; padding: 0; margin: 8px 0; max-height: 52vh; overflow: auto; border-top: 1px solid var(--line); }
.ed-list li { display: flex; gap: 8px; padding: 7px 2px; border-bottom: 1px solid var(--line); font-size: 13px; align-items: flex-start; }
.ed-list li.ed-book { font-weight: 600; background: var(--line); padding: 5px 8px; }
.ed-list .ed-txt { flex: 1; min-width: 0; }
.ed-list .ed-ch { color: var(--muted); font-size: 11.5px; display: block; }
.ed-list .ed-warn { color: #b05b00; font-size: 11.5px; display: block; }
.ed-list mark { background: #ffd666; }
.ed-list li.off .ed-txt { opacity: .45; text-decoration: none; }
.ed-list li:not(.off) .ed-txt .ed-body { text-decoration: line-through; text-decoration-color: rgba(176, 40, 40, .6); }
.clean-ads { display: block; width: 100%; margin: 0 0 8px; border: 1px dashed var(--line); background: none; border-radius: 8px; padding: 5px; font: inherit; font-size: 12.5px; color: var(--muted); cursor: pointer; }
/* 图片窗口：图片下方单独一行工具栏（141） */
#imgViewer[open] { display: flex; flex-direction: column; }
#imgViewer .img-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; background: var(--surface, #fff); border-top: 1px solid var(--line); }
#imgViewer .img-tools .img-ask { position: static; }
#imgViewer .img-tools .spacer { flex: 1; }
.img-del { display: flex; gap: 8px; flex-wrap: wrap; }
.img-del .btn { padding: 7px 14px; font-size: 14px; }
.ed-thumb { max-width: 160px; max-height: 120px; border: 1px solid var(--line); border-radius: 4px; display: block; }
.ed-list li:not(.off) .ed-txt .ed-body:has(img) { text-decoration: none; }
.ed-list li.ed-only-sel:not(.off) .ed-txt .ed-body { text-decoration: none; }
.ed-list mark.ed-sel { background: #ffd666; text-decoration: line-through; text-decoration-color: #b33; }
.tb-del { color: #b33; }
#imgViewer[open] { min-width: min(560px, 94vw); }
