/* =====================================================================
   精读 · 英语阅读与生词本
   界面样式：纸面质感、衬线阅读、克制的暖色强调
   ===================================================================== */

* { box-sizing: border-box; }

:root {
  --ui-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --read-font: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, "Songti SC", "Source Han Serif SC", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --read-size: 19px;
  --read-lh: 1.85;
  --read-width: 700px;

  --bg: #f3efe6;
  --bg-soft: #ebe5d8;
  --panel: #fbf8f1;
  --panel-2: #f6f1e6;
  --ink: #2b2520;
  --ink-2: #544c3e;
  --muted: #8b8271;
  --muted-2: #a29a8a;
  --line: #dcd3c0;
  --line-2: #e8e1d2;

  --accent: #a9502c;
  --accent-ink: #8c3d1d;
  --accent-soft: rgba(169, 80, 44, 0.10);
  --accent-soft-2: rgba(169, 80, 44, 0.16);
  --green: #3f6b52;
  --green-soft: rgba(63, 107, 82, 0.12);
  --gold: #a97f22;

  --shadow-sm: 0 1px 2px rgba(60, 45, 25, 0.07);
  --shadow: 0 10px 28px rgba(60, 45, 25, 0.10), 0 2px 6px rgba(60, 45, 25, 0.06);
  --shadow-lg: 0 26px 70px rgba(48, 36, 18, 0.20), 0 6px 16px rgba(48, 36, 18, 0.08);

  --radius: 14px;
  --radius-sm: 9px;
  --topbar-h: 60px;
  --rail-w: 270px;
}

html[data-theme="sepia"] {
  --bg: #eee0c6;
  --bg-soft: #e5d5b6;
  --panel: #f8eeda;
  --panel-2: #f2e6ce;
  --ink: #33291c;
  --ink-2: #5b4f3c;
  --muted: #8d7f66;
  --muted-2: #a5977e;
  --line: #d9c8a8;
  --line-2: #e6d8bd;
  --accent-soft: rgba(158, 74, 38, 0.12);
}

html[data-theme="night"] {
  --bg: #161513;
  --bg-soft: #1e1c19;
  --panel: #211f1b;
  --panel-2: #26231e;
  --ink: #e7e0d2;
  --ink-2: #bdb5a5;
  --muted: #8a8272;
  --muted-2: #756e60;
  --line: #383328;
  --line-2: #2c2922;
  --accent: #e08a63;
  --accent-ink: #eda17e;
  --accent-soft: rgba(224, 138, 99, 0.14);
  --accent-soft-2: rgba(224, 138, 99, 0.22);
  --green: #7fb595;
  --green-soft: rgba(127, 181, 149, 0.14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 26px 70px rgba(0, 0, 0, 0.6), 0 6px 16px rgba(0, 0, 0, 0.35);
}

html[data-font="sans"] {
  --read-font: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui-font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-soft-2); }

button { font-family: inherit; }
input, textarea, select { font-family: inherit; }

svg { flex: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------------- 布局 ---------------- */

.app { height: 100vh; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line-2);
  position: relative;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex: none;
}

.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--ink);
  color: var(--panel);
  font-family: var(--read-font);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -1px;
  box-shadow: inset 0 -1px 0 rgba(255,255,255,.12);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 16px; letter-spacing: .04em; font-weight: 650; }
.brand-text i { font-style: normal; font-size: 10.5px; color: var(--muted); letter-spacing: .02em; margin-top: 2px; }

.tabs {
  display: flex;
  gap: 1px;
  padding: 4px;
  background: var(--bg-soft);
  border-radius: 11px;
  margin-left: 6px;
}

.tab {
  position: relative;
  border: 0;
  background: transparent;
  height: 31px;
  padding: 0 15px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.tab:hover { color: var(--ink); }
.tab.is-active {
  background: var(--panel);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(60, 45, 25, .13);
}

.tab .count {
  font-size: 10.5px;
  font-weight: 650;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: inline-grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}
.tab .count:empty, .tab .count[data-zero="1"] { opacity: .45; }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.shell { flex: 1; display: flex; min-height: 0; }

.rail {
  width: var(--rail-w);
  flex: none;
  background: var(--panel);
  border-right: 1px solid var(--line-2);
  display: flex;
  flex-direction: column;
  min-height: 0;
  transition: margin-left .22s ease;
}

.rail-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 16px 8px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .12em;
  color: var(--muted);
  text-transform: uppercase;
}

.mini {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-2);
  width: 26px; height: 26px;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: grid; place-items: center;
  transition: .15s;
}
.mini:hover { border-color: var(--accent); color: var(--accent); }

.rail-list { flex: 1; overflow-y: auto; padding: 4px 10px 10px; }

.doc-item {
  position: relative;
  padding: 11px 34px 11px 12px;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background .13s;
}
.doc-item:hover { background: var(--panel-2); }
.doc-item.is-active { background: var(--accent-soft); }
.doc-item.is-active::before {
  content: "";
  position: absolute; left: 0; top: 12px; bottom: 12px;
  width: 2.5px; border-radius: 2px; background: var(--accent);
}
.doc-name {
  font-size: 13.5px; font-weight: 550; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 3px;
}
.doc-item.is-active .doc-name { color: var(--accent-ink); }
.doc-sub {
  font-size: 11.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 6px;
  font-variant-numeric: tabular-nums;
}
.doc-sub i { font-style: normal; opacity: .5; }
.doc-del {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border-radius: 7px; border: 0;
  background: transparent; color: var(--muted); cursor: pointer;
  opacity: 0; transition: .15s; display: grid; place-items: center;
}
.doc-item:hover .doc-del { opacity: 1; }
.doc-del:hover { background: rgba(0,0,0,.06); color: var(--accent); }

.rail-foot {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line-2);
  font-size: 11px;
  color: var(--muted-2);
  line-height: 1.6;
}
.rail-foot p { margin: 6px 0 0; }
.rail-stat { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rail-stat b { color: var(--ink-2); font-weight: 650; }

.main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  scroll-behavior: smooth;
  background: var(--bg);
}

.main::-webkit-scrollbar, .rail-list::-webkit-scrollbar, .pop::-webkit-scrollbar { width: 10px; height: 10px; }
.main::-webkit-scrollbar-thumb, .rail-list::-webkit-scrollbar-thumb, .pop::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 8px; border: 3px solid var(--bg);
}
.main::-webkit-scrollbar-thumb { border-color: var(--bg); }
.rail-list::-webkit-scrollbar-thumb { border-color: var(--panel); }

/* ---------------- 按钮 / 输入 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .06s;
  box-shadow: var(--shadow-sm);
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: #c8bba2; background: var(--panel-2); }
html[data-theme="night"] .btn:hover { border-color: var(--line); }
.btn:active { transform: translateY(1px); }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff8f1;
  box-shadow: 0 1px 0 rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.14);
}
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.danger { color: #a33; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.iconbtn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: .15s;
}
.iconbtn:hover { background: var(--panel-2); border-color: var(--line-2); }
.iconbtn svg { width: 18px; height: 18px; }

.tool {
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: .14s;
  display: inline-flex; align-items: center; gap: 5px;
}
.tool:hover { background: var(--panel); color: var(--ink); border-color: var(--line-2); }
.tool.is-on { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; font-weight: 600; }

.select {
  height: 34px;
  padding: 0 30px 0 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8271' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: var(--ink);
  font-size: 12.5px;
  appearance: none;
  cursor: pointer;
  outline: none;
}
.select:hover { border-color: #c8bba2; }

.search {
  display: flex; align-items: center; gap: 8px;
  height: 38px;
  padding: 0 13px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  flex: 1;
  max-width: 340px;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { width: 15px; height: 15px; color: var(--muted); }
.search input { border: 0; background: transparent; outline: none; font-size: 13.5px; color: var(--ink); width: 100%; }
.search input::placeholder { color: var(--muted-2); }

.chips { display: flex; gap: 6px; }
.chip {
  height: 32px; padding: 0 13px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  cursor: pointer;
  transition: .14s;
}
.chip:hover { background: var(--panel-2); }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--panel); font-weight: 550; }

/* ---------------- 阅读视图 ---------------- */

.view { animation: viewIn .25s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.docbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 40px 12px;
  max-width: calc(var(--read-width) + 120px);
  margin: 0 auto;
  background: linear-gradient(to bottom, var(--bg) 74%, color-mix(in srgb, var(--bg) 0%, transparent));
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  transition: border-color .2s;
  border-bottom: 1px solid transparent;
}
.docbar.is-stuck { border-bottom-color: var(--line-2); }

.docbar-title { min-width: 0; }
.docbar-title h1 {
  margin: 0;
  font-family: var(--read-font);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.doc-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 2px 7px;
  font-size: 11.5px; color: var(--muted);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.doc-meta span { white-space: nowrap; }
.doc-meta i { font-style: normal; opacity: .45; }
.doc-meta .dot-saved { color: var(--accent); }

.docbar-tools { display: flex; align-items: center; gap: 2px; flex: none; padding-bottom: 2px; }
.sizectl { display: flex; align-items: center; }

.reader {
  max-width: var(--read-width);
  margin: 0 auto;
  padding: 6px 40px 150px;
  min-height: 40vh;
}

.reader .para {
  font-family: var(--read-font);
  font-size: var(--read-size);
  line-height: var(--read-lh);
  margin: 0 0 1.02em;
  letter-spacing: .002em;
  color: var(--ink);
  overflow-wrap: break-word;
  text-wrap: pretty;
}
.reader .para.is-head {
  font-size: calc(var(--read-size) * 1.14);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .01em;
  margin: 1.9em 0 .8em;
}
.reader .para.is-head:first-child { margin-top: .15em; }
.reader .para.is-head.is-title {
  font-size: calc(var(--read-size) * 1.32);
  line-height: 1.32;
  letter-spacing: .005em;
  margin: .1em 0 1.15em;
}
.reader .para.is-item {
  padding-left: 1.65em;
  text-indent: -1.65em;
  margin-bottom: .55em;
}
.reader .para.is-item.is-head { padding-left: 0; text-indent: 0; }

.reader .w {
  cursor: pointer;
  border-radius: 3px;
  transition: background .12s;
  padding: 1px 0;
}
.reader .w:hover { background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft); }
.reader .w.is-saved {
  background: var(--accent-soft);
  box-shadow: inset 0 -1.5px 0 rgba(169, 80, 44, .42);
  border-radius: 2px;
}
html[data-theme="night"] .reader .w.is-saved { box-shadow: inset 0 -1.5px 0 rgba(224, 138, 99, .5); }
.reader .w.is-saved:hover { background: var(--accent-soft-2); }

.reader .sent { border-radius: 4px; transition: background .12s; }
.reader .sent:hover { background: rgba(128, 106, 70, .055); }
html[data-theme="night"] .reader .sent:hover { background: rgba(255, 255, 255, .04); }

.reader .sent-tr {
  display: block;
  font-size: .78em;
  line-height: 1.7;
  color: var(--ink-2);
  opacity: .88;
  border-left: 2px solid var(--line);
  padding: 2px 0 2px 12px;
  margin: 3px 0 10px;
  font-family: var(--ui-font);
}

.reader[data-compare="true"] .para { margin-bottom: 1.4em; }
.reader .sb { display: block; }
.reader .sb .sent-tr.is-inline { margin-bottom: 2px; }
.reader .sb .sent-tr.is-loading { color: var(--muted-2); font-style: italic; }

.read-progress {
  position: fixed;
  left: 0; right: 0; top: var(--topbar-h);
  height: 2px;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s;
}
.read-progress.is-on { opacity: 1; }
.read-progress i {
  display: block; height: 100%; width: 0;
  background: var(--accent);
  opacity: .55;
  transition: width .15s linear;
}

/* 欢迎页 */

.welcome { max-width: 780px; margin: 3vh auto 0; padding: 0 40px 80px; }
.welcome-inner {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 22px;
  padding: 46px 48px 40px;
  box-shadow: var(--shadow-sm);
}
.welcome-eyebrow {
  font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--accent); font-weight: 650; margin-bottom: 14px;
}
.welcome h1 {
  font-family: var(--read-font);
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.16;
  margin: 0 0 14px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.welcome-sub { font-size: 14.5px; line-height: 1.75; color: var(--ink-2); margin: 0 0 28px; max-width: 54ch; }
.welcome-sub b { color: var(--ink); font-weight: 650; }

.dropzone {
  border: 1.5px dashed var(--line);
  background: var(--bg-soft);
  border-radius: 15px;
  padding: 30px 24px;
  text-align: center;
  cursor: pointer;
  transition: .18s;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { width: 30px; height: 30px; color: var(--accent); margin-bottom: 4px; }
.dropzone b { font-size: 14.5px; font-weight: 600; }
.dropzone span { font-size: 12px; color: var(--muted); }

.welcome-actions { display: flex; gap: 10px; margin: 20px 0 6px; flex-wrap: wrap; }
.welcome-tips {
  display: flex; gap: 22px; flex-wrap: wrap;
  margin-top: 26px; padding-top: 20px;
  border-top: 1px solid var(--line-2);
  font-size: 12.5px; color: var(--muted);
}
.welcome-tips kbd {
  font-family: var(--ui-font);
  font-size: 11px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  margin-right: 5px;
  color: var(--ink-2);
}

/* ---------------- 页面通用头部 ---------------- */

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 42px 40px 6px;
}
.page-head h1 {
  font-family: var(--read-font);
  font-size: 30px;
  margin: 0 0 5px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.page-sub { margin: 0; font-size: 13px; color: var(--muted); }
.page-actions { display: flex; gap: 9px; flex: none; }

/* ---------------- 生词本 ---------------- */

.stats {
  max-width: 1040px;
  margin: 22px auto 0;
  padding: 0 40px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 13px;
  padding: 15px 17px;
  box-shadow: var(--shadow-sm);
}
.stat b {
  display: block;
  font-family: var(--read-font);
  font-size: 27px;
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.stat span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 5px; letter-spacing: .02em; }
.stat.accent b { color: var(--accent); }
.stat.green b { color: var(--green); }

.filterbar {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px 40px 14px;
  display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 12;
  background: linear-gradient(to bottom, var(--bg) 78%, color-mix(in srgb, var(--bg) 0%, transparent));
}
.filterbar .chips { margin-left: auto; }
.filterbar .select { flex: none; }

.vocab-list { max-width: 1040px; margin: 0 auto; padding: 0 40px 100px; }

.vrow {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 13px;
  padding: 13px 14px 13px 12px;
  margin-bottom: 9px;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.vrow:hover { border-color: var(--line); box-shadow: var(--shadow-sm); }
.vrow.is-done { opacity: .72; }
.vrow.is-done .vword { color: var(--muted); }

.vcheck {
  flex: none;
  width: 24px; height: 24px;
  margin-top: 2px;
  border-radius: 7px;
  border: 1.5px solid var(--line);
  background: transparent;
  color: transparent;
  cursor: pointer;
  display: grid; place-items: center;
  transition: .15s;
}
.vcheck:hover { border-color: var(--green); }
.vcheck svg { width: 13px; height: 13px; }
.vrow.is-done .vcheck { background: var(--green); border-color: var(--green); color: #fff; }

.vmain { flex: 1; min-width: 0; cursor: pointer; }
.vtop { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.vword {
  font-family: var(--read-font);
  font-size: 18.5px;
  font-weight: 600;
  letter-spacing: .005em;
  color: var(--ink);
  line-height: 1.25;
}
.vph { font-size: 12px; color: var(--muted); font-family: var(--mono); letter-spacing: -.01em; }
.vtags { display: flex; gap: 4px; }
.vtag {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-soft);
  color: var(--muted);
  text-transform: uppercase;
}
.vtag.hot { background: var(--accent-soft); color: var(--accent-ink); }

.vzh {
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.6;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.vzh .pos { color: var(--accent); font-style: italic; margin-right: 3px; }
.vmeta {
  font-size: 11px; color: var(--muted-2); margin-top: 5px;
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.vmeta i { font-style: normal; opacity: .5; }

.vact { display: flex; gap: 2px; flex: none; align-items: center; opacity: 0; transition: opacity .15s; }
.vrow:hover .vact { opacity: 1; }
.vact .iconbtn { width: 30px; height: 30px; border-radius: 8px; }
.vact .iconbtn svg { width: 15px; height: 15px; }
.vact .iconbtn:hover { color: var(--accent); }

.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}
.empty .empty-mark {
  width: 54px; height: 54px; margin: 0 auto 16px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  display: grid; place-items: center;
  color: var(--muted-2);
}
.empty .empty-mark svg { width: 24px; height: 24px; }
.empty h3 { font-family: var(--read-font); font-size: 19px; color: var(--ink-2); margin: 0 0 6px; font-weight: 600; }
.empty p { margin: 0; font-size: 13px; }

/* ---------------- 句子本 ---------------- */

.sentence-list { max-width: 860px; margin: 0 auto; padding: 22px 40px 110px; }
.scard {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 12px;
  position: relative;
  transition: .15s;
}
.scard:hover { border-color: var(--line); box-shadow: var(--shadow-sm); }
.scard .en {
  font-family: var(--read-font);
  font-size: 17px;
  line-height: 1.7;
  margin: 0 0 8px;
  color: var(--ink);
}
.scard .zh {
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink-2);
  margin: 0;
  padding-left: 12px;
  border-left: 2px solid var(--line);
}
.scard .meta { font-size: 11px; color: var(--muted-2); margin-top: 10px; display: flex; gap: 7px; align-items: center; }
.scard .meta i { font-style: normal; opacity: .5; }
.scard .sc-del { position: absolute; top: 12px; right: 12px; opacity: 0; transition: .15s; }
.scard:hover .sc-del { opacity: 1; }

/* ---------------- 复习闪卡 ---------------- */

.review-wrap { max-width: 720px; margin: 0 auto; padding: 30px 40px 110px; }

.rv-progress {
  height: 4px; background: var(--line-2); border-radius: 4px; overflow: hidden; margin-bottom: 8px;
}
.rv-progress i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .25s; }
.rv-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-bottom: 26px; font-variant-numeric: tabular-nums; }

.flash {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 20px;
  min-height: 320px;
  padding: 44px 40px 34px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
  cursor: pointer;
  transition: box-shadow .2s;
}
.flash:hover { box-shadow: var(--shadow); }
.flash-word {
  font-family: var(--read-font);
  font-size: clamp(38px, 6vw, 56px);
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.1;
  word-break: break-word;
}
.flash-ph { font-family: var(--mono); font-size: 13px; color: var(--muted); margin-top: 10px; }
.flash-hint { margin-top: auto; font-size: 12px; color: var(--muted-2); letter-spacing: .04em; }
.flash-reveal {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line-2);
  animation: reveal .22s ease both;
}
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.flash-reveal .entry { font-size: 16px; line-height: 1.7; color: var(--ink); margin-bottom: 6px; }
.flash-reveal .entry .pos { color: var(--accent); font-style: italic; margin-right: 4px; }
.flash-reveal .ex { font-size: 12.5px; color: var(--muted); line-height: 1.65; margin-top: 10px; }
.flash-reveal .ex em { color: var(--ink-2); font-style: normal; }

.rv-actions { display: flex; gap: 10px; margin-top: 18px; }
.rv-actions .btn { flex: 1; height: 46px; font-size: 14px; }
.rv-done { text-align: center; padding: 70px 20px; }
.rv-done h2 { font-family: var(--read-font); font-size: 26px; font-weight: 600; margin: 0 0 10px; }
.rv-done p { color: var(--muted); margin: 0 0 24px; }

/* ---------------- 弹卡（单词 / 句子） ---------------- */

#popupLayer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }

.pop {
  position: fixed;
  width: 380px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 18px 20px 16px;
  pointer-events: auto;
  animation: popIn .16s ease both;
  overscroll-behavior: contain;
}
@keyframes popIn { from { opacity: 0; transform: translateY(4px) scale(.985); } to { opacity: 1; transform: none; } }
.pop.wide { width: 500px; }
.pop.is-loading { min-height: 120px; }

.pop-close {
  position: absolute; top: 10px; right: 10px;
  width: 26px; height: 26px; border-radius: 7px;
  border: 0; background: transparent; color: var(--muted);
  cursor: pointer; display: grid; place-items: center;
}
.pop-close:hover { background: var(--bg-soft); color: var(--ink); }
.pop-close svg { width: 14px; height: 14px; }

.wc-head { padding-right: 24px; }
.wc-word {
  font-family: var(--read-font);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.15;
  word-break: break-word;
}
.wc-word .proto { font-size: 13px; color: var(--muted); font-family: var(--ui-font); margin-left: 8px; font-weight: 400; }

.wc-phon { display: flex; align-items: center; gap: 12px; margin-top: 5px; flex-wrap: wrap; }
.wc-ph { font-family: var(--mono); font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.wc-ph b { font-weight: 500; color: var(--muted-2); font-family: var(--ui-font); font-size: 10px; letter-spacing: .08em; }
.speaker {
  border: 0; background: transparent; color: var(--muted);
  width: 22px; height: 22px; border-radius: 6px;
  display: grid; place-items: center; cursor: pointer; padding: 0;
}
.speaker:hover { background: var(--accent-soft); color: var(--accent); }
.speaker svg { width: 14px; height: 14px; }

.wc-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 9px; }
.tag {
  font-size: 9.5px; font-weight: 650; letter-spacing: .05em;
  padding: 2px 6px; border-radius: 4px;
  background: var(--bg-soft); color: var(--muted);
}
.tag.exam { background: var(--accent-soft); color: var(--accent-ink); }

.wc-body { margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line-2); }
.wc-entry { display: flex; gap: 8px; font-size: 14px; line-height: 1.65; margin-bottom: 7px; color: var(--ink); }
.wc-entry .pos { color: var(--accent); font-style: italic; flex: none; min-width: 26px; font-size: 13px; padding-top: 1px; font-weight: 550; }
.wc-entry .en-def { color: var(--ink-2); font-size: 13px; }

.wc-forms { margin-top: 10px; font-size: 11.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.wc-forms b { font-weight: 500; color: var(--muted-2); }

.wc-more { margin-top: 12px; border-top: 1px solid var(--line-2); padding-top: 10px; }
.wc-more summary {
  list-style: none; cursor: pointer;
  font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 5px;
  user-select: none;
}
.wc-more summary::-webkit-details-marker { display: none; }
.wc-more summary::before { content: "›"; display: inline-block; transition: transform .15s; font-size: 14px; line-height: 1; }
.wc-more[open] summary::before { transform: rotate(90deg); }
.wc-more summary:hover { color: var(--ink-2); }
.wc-sec { margin-top: 12px; }
.wc-sec h4 {
  margin: 0 0 6px; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted-2); font-weight: 650;
}
.wc-sec .line { font-size: 12.5px; line-height: 1.6; color: var(--ink-2); margin-bottom: 5px; }
.wc-sec .line b { color: var(--ink); font-weight: 550; }
.wc-sec .line .zh { color: var(--muted); }
.wc-sec .ex-item { margin-bottom: 8px; }
.wc-sec .ex-item .e { font-family: var(--read-font); font-size: 13.5px; line-height: 1.55; color: var(--ink); }
.wc-sec .ex-item .z { font-size: 12px; line-height: 1.55; color: var(--muted); margin-top: 1px; }

.wc-note { margin-top: 12px; }
.wc-note-input {
  width: 100%;
  min-height: 54px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  font-family: var(--ui-font);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg-soft);
  outline: none;
}
.wc-note-input:focus { border-color: var(--accent); background: var(--panel); }

.wc-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line-2); }
.wc-actions .btn { flex: none; }
.wc-actions .btn.primary { flex: 1; }
.wc-hint { font-size: 11px; color: var(--muted-2); }

.wc-error { font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.wc-error .err-msg { color: #a33; font-size: 12.5px; margin-top: 4px; }

.skel { border-radius: 5px; background: linear-gradient(90deg, var(--bg-soft) 25%, var(--panel-2) 37%, var(--bg-soft) 63%); background-size: 400% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.skel-word { height: 30px; width: 160px; margin-bottom: 10px; }
.skel-line { height: 12px; width: 100%; margin-bottom: 8px; }
.skel-line.short { width: 60%; }

/* 句子卡 */
.sc-kicker { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); font-weight: 650; margin-bottom: 9px; }
.sc-en {
  font-family: var(--read-font);
  font-size: 16px;
  line-height: 1.65;
  margin: 0 0 10px;
  color: var(--ink);
}
.sc-zh {
  font-size: 14px;
  line-height: 1.8;
  margin: 0;
  color: var(--ink-2);
  padding-left: 11px;
  border-left: 2px solid var(--accent-soft-2);
  min-height: 1.8em;
}
.sc-zh.is-loading { color: var(--muted-2); font-style: italic; }
.sc-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.sc-src { font-size: 10.5px; color: var(--muted-2); margin-left: auto; }

.sel-pill {
  position: fixed;
  z-index: 61;
  display: flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 13px;
  background: var(--ink);
  color: var(--panel);
  border: 0;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  box-shadow: var(--shadow);
  animation: popIn .14s ease both;
}
.sel-pill:hover { background: var(--accent); }
.sel-pill svg { width: 14px; height: 14px; }

/* ---------------- 弹窗 / 模态框 ---------------- */

.modal-layer {
  position: fixed; inset: 0;
  z-index: 80;
  background: rgba(38, 30, 20, .40);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 26px;
  animation: fade .16s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-layer[hidden] { display: none; }

.modal {
  width: min(660px, 100%);
  max-height: min(88vh, 920px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn .2s cubic-bezier(.2,.8,.3,1) both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
.modal.wide { width: min(860px, 100%); }

.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line-2);
}
.modal-head h2 { margin: 0; font-size: 16.5px; font-weight: 650; letter-spacing: .01em; flex: 1; }
.modal-head .iconbtn { width: 32px; height: 32px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; gap: 9px; justify-content: flex-end;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line-2);
}
.modal-foot .spacer { margin-right: auto; }

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field > label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 7px; letter-spacing: .02em; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 6px; line-height: 1.55; }
.input, .textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input:focus, .textarea:focus { border-color: var(--accent); background: var(--panel); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { min-height: 150px; resize: vertical; line-height: 1.65; font-size: 13px; }

.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--bg-soft); border-radius: 9px; }
.seg button {
  border: 0; background: transparent; height: 28px; padding: 0 12px;
  border-radius: 7px; font-size: 12.5px; color: var(--ink-2); cursor: pointer;
}
.seg button.is-on { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm); }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.switch input { display: none; }
.switch .sw {
  width: 38px; height: 22px; border-radius: 12px; background: var(--line);
  position: relative; transition: .18s; flex: none;
}
.switch .sw::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: .18s;
}
.switch input:checked + .sw { background: var(--accent); }
.switch input:checked + .sw::after { transform: translateX(16px); }

.settings-section { margin-bottom: 24px; }
.settings-section:last-child { margin-bottom: 0; }
.settings-section > h3 {
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted-2); margin: 0 0 12px; font-weight: 650;
}
.srow { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.srow:last-child { border-bottom: 0; }
.srow .sl { font-size: 13px; color: var(--ink); }
.srow .sd { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.srow .sr { flex: none; display: flex; align-items: center; gap: 6px; }

.fontsize-preview { font-family: var(--read-font); }

/* 粘贴 / 添加弹窗 */
.filedrop {
  border: 1.5px dashed var(--line);
  border-radius: 13px;
  padding: 26px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: .15s;
  background: var(--bg-soft);
}
.filedrop:hover, .filedrop.is-over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.filedrop b { display: block; color: var(--ink); font-size: 14px; margin-bottom: 4px; }

.filetypes { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.filetypes span {
  font-size: 10.5px; color: var(--muted); border: 1px solid var(--line);
  padding: 2px 7px; border-radius: 5px; background: var(--panel);
}

/* ---------------- 提示条 ---------------- */

.toasts {
  position: fixed;
  bottom: 26px; left: 50%; transform: translateX(-50%);
  z-index: 120;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: var(--panel);
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  animation: toastIn .2s ease both;
  max-width: 70vw;
  display: flex; align-items: center; gap: 8px;
}
.toast.ok { background: var(--green); color: #f2f7f3; }
.toast.err { background: #8f3a2e; color: #fdf3f0; }
.toast.out { animation: toastOut .2s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* ---------------- 拖拽遮罩 ---------------- */

.drag-mask {
  position: fixed; inset: 0; z-index: 150;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(38, 30, 20, .48);
  backdrop-filter: blur(5px);
}
.drag-mask.is-on { display: flex; }
.drag-mask > div {
  border: 2px dashed rgba(255, 248, 238, .55);
  border-radius: 24px;
  padding: 54px 70px;
  text-align: center;
  color: #fff8ee;
  display: flex; flex-direction: column; gap: 8px;
  background: rgba(255, 248, 238, .06);
}
.drag-mask b { font-size: 22px; font-family: var(--read-font); font-weight: 600; }
.drag-mask span { font-size: 12px; opacity: .7; letter-spacing: .06em; }

/* ---------------- 打印界面（预览框架） ---------------- */

.printv {
  position: fixed; inset: 0; z-index: 100;
  background: #3b352c;
  display: flex; flex-direction: column;
}
.printv-bar {
  flex: none;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
  z-index: 2;
}
.printv-bar .pv-title { font-size: 14px; font-weight: 650; margin-right: 6px; display: flex; align-items: center; gap: 8px; }
.printv-bar .pv-title span { font-size: 11px; color: var(--muted); font-weight: 400; }
.pv-group { display: flex; align-items: center; gap: 6px; }
.pv-group > label { font-size: 11.5px; color: var(--muted); }
.pv-input {
  height: 32px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg-soft); color: var(--ink); padding: 0 10px; font-size: 12.5px;
  outline: none; width: 150px;
}
.pv-input:focus { border-color: var(--accent); }
.pv-spacer { flex: 1; }
.pv-note { font-size: 11px; color: var(--muted); max-width: 300px; line-height: 1.4; }

.printv-stage {
  flex: 1; overflow: auto;
  padding: 26px 20px 60px;
  background:
    radial-gradient(circle at 50% 0, rgba(255,255,255,.05), transparent 60%),
    #3b352c;
}
.printv-pages { display: flex; flex-direction: column; align-items: center; gap: 22px; }

.pv-pagewrap { position: relative; box-shadow: 0 18px 50px rgba(0,0,0,.42); background: #fff; }
.pv-pagewrap .pp { transform-origin: top left; }

.pv-loading { color: rgba(255,255,255,.6); font-size: 13px; padding: 60px; }

/* ---------------- 响应式 ---------------- */

@media (max-width: 1080px) {
  .brand-text i { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .rail-btn { display: grid; }
  .rail {
    position: fixed;
    left: 0; top: var(--topbar-h); bottom: 0;
    z-index: 70;
    margin-left: calc(-1 * var(--rail-w) - 10px);
    box-shadow: var(--shadow-lg);
  }
  .rail.is-open { margin-left: 0; }
  .rail-scrim {
    position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 65;
    background: rgba(30, 24, 16, .35);
  }
  .brand { flex: 1; }
  .tabs { order: 3; width: 100%; overflow-x: auto; margin: 0; }
  .topbar { flex-wrap: wrap; height: auto; min-height: var(--topbar-h); padding: 8px 14px; gap: 10px; }
  .top-actions { position: absolute; right: 12px; top: 10px; }
  .topbar .tabs { margin-top: 2px; }
  .shell { height: calc(100vh - 108px); }
  .docbar { padding: 12px 20px 10px; }
  .reader { padding: 4px 22px 120px; }
  .welcome { padding: 0 18px 60px; margin-top: 12px; }
  .welcome-inner { padding: 30px 24px 26px; border-radius: 18px; }
  .page-head { padding: 26px 20px 4px; flex-wrap: wrap; }
  .page-head h1 { font-size: 25px; }
  .stats { padding: 0 20px; grid-template-columns: repeat(2, 1fr); }
  .filterbar { padding: 14px 20px 10px; flex-wrap: wrap; }
  .filterbar .search { max-width: none; width: 100%; }
  .filterbar .chips { margin-left: 0; }
  .vocab-list, .sentence-list, .review-wrap { padding-left: 20px; padding-right: 20px; }
  .vact { opacity: 1; }
  .docbar-tools .tool { padding: 0 7px; }
}

@media (max-width: 640px) {
  .brand-text b { font-size: 15px; }
  .top-actions .btn.primary span { display: none; }
  .top-actions .btn.primary { width: 40px; padding: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat { padding: 12px 13px; }
  .stat b { font-size: 22px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .pop { width: calc(100vw - 20px) !important; left: 10px !important; }
  .reader { padding: 4px 18px 120px; }
  .docbar-title h1 { font-size: 17px; }
  .printv-bar { padding: 8px 10px; gap: 6px; }
  .pv-input { width: 110px; }
}

@media (max-width: 900px) {
  .rail-btn { display: grid; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* 打印时只输出打印页 */
@media print {
  .topbar, .rail, .main, .modal-layer, .toasts, #popupLayer, .drag-mask, .printv-bar { display: none !important; }
}

/* ------------------------------------------------------------------ */
/* 生词本切换                                                           */
/* ------------------------------------------------------------------ */

.bookbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
  padding: 18px 40px 0;
}
.bookchip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: transparent; color: var(--ink-2);
  font-size: 12.5px; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.bookchip:hover { border-color: var(--muted-2); color: var(--ink); }
.bookchip.is-on { background: var(--ink); color: #fff; border-color: var(--ink); }
.bookchip .n { font-size: 10.5px; opacity: .62; }
.bookchip.is-on .n { opacity: .8; }
.bookbar .book-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.bookbar .book-actions .btn { height: 30px; font-size: 12px; padding: 0 11px; }
.bookbar .iconbtn { width: 30px; height: 30px; }

/* ------------------------------------------------------------------ */
/* 悬浮查词窗                                                           */
/* ------------------------------------------------------------------ */

.quick-fab {
  position: fixed; right: 26px; bottom: 26px; z-index: 45;
  display: inline-flex; align-items: center; gap: 7px;
  height: 44px; padding: 0 17px 0 15px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--panel); color: var(--ink);
  box-shadow: var(--shadow); cursor: pointer;
  font-size: 13px; font-weight: 500;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.quick-fab:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.quick-fab svg { width: 17px; height: 17px; color: var(--accent); }
.quick-fab.is-open { background: var(--ink); color: #fff; border-color: var(--ink); }
.quick-fab.is-open svg { color: #fff; }

.quick-panel {
  position: fixed; right: 26px; bottom: 82px; z-index: 70;
  width: 396px; max-width: calc(100vw - 32px);
  max-height: min(72vh, 560px);
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 16px; box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.quick-panel[hidden] { display: none; }
.qk-head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px 9px 14px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  cursor: grab; user-select: none;
}
.qk-head:active { cursor: grabbing; }
.qk-title { font-size: 12.5px; font-weight: 600; letter-spacing: .04em; }
.qk-kbd {
  margin-left: auto; font-size: 10.5px; color: var(--muted);
  border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 5px;
}
.qk-close { width: 26px; height: 26px; font-size: 16px; line-height: 1; }
.qk-body {
  display: flex; flex-direction: column; gap: 9px;
  padding: 12px; overflow: auto;
}
.qk-input {
  width: 100%; resize: vertical; min-height: 58px; max-height: 150px;
  padding: 9px 10px; border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--bg); color: var(--ink);
  font: inherit; font-size: 14px; line-height: 1.55;
}
.qk-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.qk-tools { display: flex; gap: 8px; align-items: center; }
.qk-book { flex: 1; min-width: 0; }
.qk-result { font-size: 13.5px; line-height: 1.62; }
.qk-tip { margin: 0; font-size: 11.5px; color: var(--muted-2); line-height: 1.5; }

.qk-word { display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px; }
.qk-word b { font-family: var(--read-font); font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.qk-ph { font-size: 12px; color: var(--muted); }
.qk-tags { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.qk-tag {
  font-size: 9.5px; padding: 1px 6px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.qk-senses { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.qk-word .speaker { align-self: center; }
.qk-speakrow { display: flex; gap: 8px; margin-top: 9px; }
.qk-sense .pos { color: var(--accent); font-style: italic; margin-right: 5px; font-size: 11.5px; }
.qk-src {
  font-family: var(--read-font); font-size: 12.5px; color: var(--muted);
  max-height: 120px; overflow: auto; margin-bottom: 6px;
}
.qk-zh { font-size: 14px; }
.qk-addrow { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.qk-addrow .hint { font-size: 11px; color: var(--muted-2); }
.qk-loading { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.qk-loading i {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--line-2); border-top-color: var(--accent);
  animation: qkspin .8s linear infinite;
}
@keyframes qkspin { to { transform: rotate(360deg); } }
.qk-err { color: #a3372a; font-size: 12.5px; }

@media (max-width: 900px) {
  .bookbar { padding: 14px 20px 0; }
}
@media (max-width: 640px) {
  .bookbar { padding: 12px 20px 0; }
  .bookbar .book-actions { margin-left: 0; }
  .quick-fab { right: 14px; bottom: 14px; height: 40px; padding: 0 14px; }
  .quick-panel { right: 10px; left: 10px; bottom: 64px; width: auto; max-width: none; max-height: 74vh; }
}

/* 复习：范围 / 每日目标 / 连续天数 */
.rv-top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 18px; margin-bottom: 18px;
}
.rv-scope { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rv-due { font-size: 12px; color: var(--muted); }
.rv-goal { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--muted); }
.rv-goal i {
  display: block; width: 108px; height: 5px; border-radius: 999px;
  background: var(--line); overflow: hidden;
}
.rv-goal i b { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .3s; }
.rv-streak { color: var(--accent); }

@media (max-width: 640px) {
  .rv-goal i { width: 72px; }
  .rv-top { margin-bottom: 14px; }
}

/* ---------------- 划词工具条（按钮组） ---------------- */
.sel-pill:hover { background: var(--ink); }
.sel-pill .sp-act {
  display: inline-flex; align-items: center; gap: 5px;
  height: 30px; padding: 0 11px; border: 0; border-radius: 7px;
  background: transparent; color: inherit;
  font: inherit; font-size: 12.5px; font-weight: 550; cursor: pointer;
}
.sel-pill .sp-act:hover { background: rgba(255, 255, 255, .16); }
.sel-pill .sp-act + .sp-act { position: relative; }
.sel-pill .sp-act + .sp-act::before {
  content: ''; position: absolute; left: -1px; top: 7px; bottom: 7px;
  width: 1px; background: rgba(255, 255, 255, .18);
}

/* ---------------- 朗读 / 段落定位 ---------------- */
.reader .sent.is-speaking {
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-soft);
  border-radius: 3px;
}
.reader .para.is-flash { animation: paraFlash 1.6s ease both; }
@keyframes paraFlash {
  0%, 35% { background: var(--accent-soft-2); }
  100% { background: transparent; }
}
body.is-reading-aloud [data-act="read-aloud"] {
  color: var(--accent); background: var(--accent-soft);
}

/* ---------------- 目录 / 搜索 / 书签 ---------------- */
.nav-wrap { display: flex; flex-direction: column; gap: 16px; }
.nav-search {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--line-2); background: var(--panel);
  border-radius: 10px; padding: 0 12px;
}
.nav-search > span { color: var(--muted); display: inline-flex; }
.nav-search .input { border: 0; background: transparent; padding: 9px 0; box-shadow: none; }
.nav-search .input:focus { outline: none; }
.nav-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.nav-sec h4 {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 8px; font-size: 12.5px; letter-spacing: .04em;
  color: var(--muted); font-weight: 600;
}
.nav-sec h4 .btn { margin-left: auto; }
.nav-list {
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  max-height: 240px; overflow: auto; padding: 4px;
}
.nav-jump {
  display: block; width: 100%; text-align: left;
  border: 0; background: transparent; color: var(--ink-2);
  padding: 7px 9px; border-radius: 7px;
  font: inherit; font-size: 13px; line-height: 1.45; cursor: pointer;
}
.nav-jump:hover { background: var(--accent-soft); color: var(--accent); }
.nav-jump.is-title { font-weight: 650; color: var(--ink); }
.nav-item { display: flex; align-items: center; gap: 2px; }
.nav-item .nav-jump { flex: 1; }
.nav-del {
  flex: none; width: 26px; height: 26px; border: 0; background: transparent;
  color: var(--muted-2); border-radius: 6px; cursor: pointer;
  display: grid; place-items: center;
}
.nav-del:hover { background: var(--accent-soft); color: var(--accent); }
.nav-hit { font-size: 12.5px; color: var(--ink-2); }
.nav-hit mark { background: var(--accent-soft-2); color: var(--ink); border-radius: 2px; }
.nav-hit .nav-p { color: var(--muted-2); font-size: 11px; margin-right: 6px; }
.nav-empty { padding: 14px 10px; color: var(--muted); font-size: 12.5px; text-align: center; }
.nav-hits .nav-list { max-height: 190px; }
@media (max-width: 720px) {
  .nav-grid { grid-template-columns: 1fr; }
  .nav-list { max-height: 170px; }
}

/* ---------------- 生词本批量 / 自定义释义 ---------------- */
.batchbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 12px; padding: 9px 12px;
  border: 1px solid var(--line-2); border-radius: 11px;
  background: var(--panel); box-shadow: var(--shadow-sm);
}
.batchbar b { font-size: 13px; color: var(--accent); margin-right: 4px; }
.batchbar .spacer { flex: 1; }
.batchbar .select { width: auto; min-width: 130px; height: 30px; }
.vpick {
  flex: none; width: 22px; height: 22px; margin-right: 2px;
  border: 1px solid var(--line-2); border-radius: 6px;
  background: var(--panel); color: transparent;
  display: grid; place-items: center; cursor: pointer;
}
.vrow.is-picked { border-color: var(--accent); background: var(--accent-soft); }
.vrow.is-picked .vpick { background: var(--accent); border-color: var(--accent); color: #fff; }
.vrow.is-selectable { cursor: pointer; }
.wc-override {
  margin: 10px 0 2px; padding: 9px 11px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 8px 8px 0;
  font-size: 13.5px; line-height: 1.55; display: flex; gap: 8px;
}
.wc-override .pos { flex: none; }
.wc-actions { flex-wrap: wrap; }
@media (max-width: 640px) {
  .batchbar .select { flex: 1; min-width: 110px; }
}

/* 句子本工具条 */
.scard .sc-tools {
  position: absolute; top: 10px; right: 10px;
  display: flex; gap: 2px; opacity: 0; transition: .15s;
}
.scard:hover .sc-tools { opacity: 1; }
.scard .sc-tools .sc-del { position: static; opacity: 1; }
.scard .zh.is-missing { color: var(--muted-2); font-style: italic; }

/* 划词工具条内的按钮 */
.sel-pill { padding: 4px; gap: 2px; height: auto; cursor: default; }
.sel-pill .sp-act {
  display: inline-flex; align-items: center; gap: 5px;
  height: 27px; padding: 0 9px; border: 0; border-radius: 6px;
  background: transparent; color: inherit; font: inherit; font-size: 12px;
  font-weight: 550; cursor: pointer; white-space: nowrap;
}
.sel-pill .sp-act:hover { background: rgba(255,255,255,.16); color: #fff; }
.sel-pill .sp-act + .sp-act { border-left: 1px solid rgba(255,255,255,.18); border-radius: 0 6px 6px 0; }

/* 复习卡发音 */
.flash-word { display: flex; align-items: center; justify-content: center; gap: 12px; }
.flash-speak {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: color .15s, border-color .15s;
}
.flash-speak:hover { color: var(--accent); border-color: var(--accent); }
.flash-speak svg { width: 16px; height: 16px; }
.rv-plan { font-size: 10.5px; color: var(--muted-2); font-family: var(--mono); letter-spacing: .02em; white-space: nowrap; }

/* ---------------- 登录遮罩（云同步） ---------------- */
body.sync-locked { overflow: hidden; }
.sync-gate {
  position: fixed; inset: 0; z-index: 400;
  display: grid; place-items: center; padding: 22px;
  background: var(--bg);
  background-image: radial-gradient(1100px 560px at 18% -10%, rgba(169, 80, 44, .11), transparent 62%);
}
.sync-gate[hidden] { display: none; }
.sg-card {
  width: min(440px, 100%);
  padding: 34px 32px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.sg-brand {
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-size: 23px; letter-spacing: .1em; color: var(--accent);
  margin-bottom: 26px;
}
.sg-brand span {
  font-family: var(--ui, system-ui, sans-serif);
  font-size: 9px; letter-spacing: .28em; color: var(--muted);
  margin-left: 10px; vertical-align: middle;
}
.sg-card h1 {
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-size: 26px; font-weight: 600; line-height: 1.35;
  margin: 0 0 10px; color: var(--ink);
}
.sg-intro { font-size: 13.5px; line-height: 1.8; color: var(--muted); margin: 0 0 22px; }
.sg-card form { display: flex; flex-direction: column; gap: 8px; }
.sg-card label { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.sg-card .input { width: 100%; }
.sg-card .btn { width: 100%; height: 44px; margin-top: 10px; }
.sg-error { margin: 2px 0 0; color: #b23b2e; font-size: 12.5px; line-height: 1.6; }
.sg-foot {
  margin: 22px 0 0; padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 11.5px; line-height: 1.7; color: var(--muted);
}
