/* 复习本 · 纸质词典风格
   纸底 + 墨色 + 两种"印章色"：深青 = 熟 / 答对，赭红 = 不熟 / 答错，赭黄 = 模糊 */

@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/SourceSerif4-wght.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/SourceSerif4-wght-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Serif SC";
  src: local("Noto Serif SC"), local("NotoSerifSC-Regular"), local("Source Han Serif SC"), local("Songti SC"), local("SimSun");
}

:root {
  --paper: #F1ECDE;
  --paper-2: #E6DCC4;
  --surface: #F7F3E8;
  --ink: #1A1A18;
  --muted: #736D5A;
  --line: #C8BEA4;
  --line-soft: #DCD3BC;
  --teal: #1B4B5A;
  --teal-soft: color-mix(in oklch, var(--teal) 12%, var(--paper));
  --sienna: #A04A2A;
  --sienna-soft: color-mix(in oklch, var(--sienna) 12%, var(--paper));
  --ochre: #8C6D2E;
  --ochre-soft: color-mix(in oklch, var(--ochre) 14%, var(--paper));
  --on-accent: #F7F3E8;
  --shadow-card: 0 12px 32px rgba(26, 26, 24, 0.10), 0 1px 0 rgba(26, 26, 24, 0.04);
  --shadow-pop: 0 18px 40px rgba(26, 26, 24, 0.16);

  --serif: "Source Serif 4", "Serif SC", "Noto Serif SC", "SimSun", serif;
  --serif-zh: "Serif SC", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --ui: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  --mono: "Cascadia Mono", "Consolas", monospace;

  --s1: 4px; --s2: 8px; --s3: 16px; --s4: 24px; --s5: 32px; --s6: 48px; --s7: 96px;
  --r: 2px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-fast: 150ms;
  --t-mid: 240ms;
  color-scheme: light;
}

[data-theme="dark"] {
  --paper: #1C1A17;
  --paper-2: #26231E;
  --surface: #23201B;
  --ink: #ECE6D6;
  --muted: #A39C88;
  --line: #4A443A;
  --line-soft: #35312A;
  --teal: #7FB3C2;
  --sienna: #DD8A68;
  --ochre: #CFAE68;
  --on-accent: #1C1A17;
  --shadow-card: 0 12px 32px rgba(0, 0, 0, 0.35);
  --shadow-pop: 0 18px 40px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 50% -200px, color-mix(in srgb, var(--surface) 70%, transparent), transparent),
    var(--paper);
  color: var(--ink);
  font: 16px/1.6 var(--ui);
  text-wrap: pretty;
  -webkit-font-smoothing: antialiased;
}
/* 纸张纹理：极淡的噪点，不影响可读性 */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .4 0 0 0 0 .3 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  z-index: 0;
}
[data-theme="dark"] body::before { mix-blend-mode: screen; opacity: .15; }

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--s3); top: var(--s3); z-index: 99; background: var(--surface); padding: var(--s2) var(--s3); }

/* ---------------------------------------------------------------- 报头 */
.masthead {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: var(--s5);
  padding: var(--s3) clamp(var(--s3), 4vw, var(--s6)) 0;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.wordmark { display: flex; align-items: baseline; gap: var(--s2); text-decoration: none; padding-bottom: 12px; }
.wordmark-en { font: italic 600 26px/1 var(--serif); letter-spacing: -.01em; }
.wordmark-zh { font: 13px/1 var(--serif-zh); color: var(--muted); letter-spacing: .2em; }
.tabs { display: flex; gap: var(--s4); }
.tabs a {
  position: relative; padding: 0 2px 12px; text-decoration: none; color: var(--muted);
  font-size: 15px; letter-spacing: .08em; transition: color var(--t-fast);
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); }
.tabs a[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--ink);
}
.masthead-meta { display: flex; align-items: center; gap: var(--s3); padding-bottom: 10px; color: var(--muted); font-size: 13px; }
.meta-day { font-family: var(--serif); font-style: italic; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border: 1px solid transparent; border-radius: var(--r); background: none; color: var(--muted); cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.icon-btn:hover { color: var(--ink); border-color: var(--line); }

main { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: var(--s5) clamp(var(--s3), 4vw, var(--s6)) var(--s7); outline: none; }

/* ---------------------------------------------------------------- 通用元素 */
.kicker { font-size: 12px; letter-spacing: .22em; color: var(--muted); text-transform: uppercase; }
.h-display { font: 400 clamp(40px, 6vw, 72px)/1 var(--serif); letter-spacing: -.02em; margin: 0; }
.h-section { font: 600 22px/1.3 var(--serif); margin: 0 0 var(--s2); }
.muted { color: var(--muted); }
.serif { font-family: var(--serif); }
.rule { border: 0; border-top: 1px solid var(--line); margin: var(--s4) 0; }
.num { font-family: var(--serif); font-variant-numeric: tabular-nums lining-nums; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s4);
  border: 1px solid var(--ink); border-radius: var(--r); background: transparent; color: var(--ink);
  font-size: 15px; letter-spacing: .04em; cursor: pointer; text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast), opacity var(--t-fast);
}
.btn:hover { background: var(--paper-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: color-mix(in oklch, var(--ink) 85%, var(--teal)); }
.btn-quiet { border-color: var(--line); color: var(--muted); }
.btn-quiet:hover { color: var(--ink); border-color: var(--ink); background: transparent; }
.btn-danger { border-color: var(--sienna); color: var(--sienna); }
.btn-danger:hover { background: var(--sienna); color: var(--on-accent); }
.btn-sm { min-height: 34px; padding: 0 var(--s3); font-size: 13px; }
.kbd {
  display: inline-block; min-width: 20px; padding: 0 5px; border: 1px solid currentColor; border-radius: 2px;
  font: 11px/18px var(--mono); text-align: center; opacity: .6;
}
.btn-link { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 13px; }
.btn-link:hover { color: var(--ink); }

.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); }
.input, .select {
  min-height: 40px; padding: 0 var(--s3); border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); transition: border-color var(--t-fast);
}
.input:hover, .select:hover { border-color: var(--muted); }
.input:focus, .select:focus { border-color: var(--ink); outline: none; }
.input-num { width: 80px; text-align: center; font-family: var(--serif); font-size: 17px; }
textarea.input { padding: var(--s2) var(--s3); min-height: 80px; resize: vertical; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; flex-wrap: wrap; }
.seg button {
  min-height: 38px; padding: 0 var(--s3); border: 0; border-right: 1px solid var(--line); background: transparent;
  color: var(--muted); cursor: pointer; font-size: 14px; transition: background var(--t-fast), color var(--t-fast);
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip {
  min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent;
  color: var(--muted); font: italic 14px var(--serif); cursor: pointer; transition: all var(--t-fast);
}
.chip[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); background: var(--paper-2); }

.panel { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r); padding: var(--s4); }
.empty { padding: var(--s6) var(--s4); text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r); }
.empty .serif { font-size: 22px; color: var(--ink); margin-bottom: var(--s2); }

.toast {
  position: fixed; left: 50%; bottom: var(--s5); z-index: 60; transform: translate(-50%, 20px);
  max-width: min(560px, 90vw); padding: 12px var(--s4); background: var(--ink); color: var(--paper); border-radius: var(--r);
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity var(--t-mid), transform var(--t-mid) var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--sienna); color: var(--on-accent); }

.score-bar { position: relative; height: 3px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
.score-bar i { position: absolute; inset: 0 auto 0 0; background: var(--sienna); }
.score-bar i[data-band="mid"] { background: var(--ochre); }
.score-bar i[data-band="high"] { background: var(--teal); }

/* ---------------------------------------------------------------- 复习：书桌 */
.desk { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: var(--s6); align-items: start; }
.desk-hero { padding-top: var(--s4); }
.desk-hero .count { font: 300 clamp(120px, 16vw, 200px)/.85 var(--serif); letter-spacing: -.04em; margin: var(--s3) 0 var(--s2); font-variant-numeric: lining-nums; }
.desk-hero .count small { font-size: .22em; font-weight: 400; letter-spacing: 0; color: var(--muted); margin-left: var(--s2); }
.desk-stats { display: flex; gap: var(--s5); margin: var(--s4) 0 var(--s5); color: var(--muted); font-size: 14px; }
.desk-stats b { display: block; font: 400 28px/1.1 var(--serif); color: var(--ink); }
.resume {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s3) var(--s4); margin-bottom: var(--s4); border: 1px solid var(--ink); background: var(--paper-2);
}
.resume p { margin: 0; }
.picker h3 { margin: 0 0 var(--s3); font: 600 18px var(--serif); }
.picker .row { display: grid; gap: 6px; margin-bottom: var(--s4); }
.picker .row > label, .picker .row > .label { font-size: 13px; color: var(--muted); }
.range-row { display: flex; align-items: center; gap: var(--s2); }
.preview-line { font-size: 14px; color: var(--muted); min-height: 22px; margin: 0 0 var(--s3); }
.preview-line b { color: var(--ink); font-family: var(--serif); font-size: 17px; }
.presets { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.preset { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r); }
.preset button { background: none; border: 0; cursor: pointer; padding: 6px 10px; font-size: 13px; color: var(--muted); }
.preset button:first-child { color: var(--ink); }
.preset button:last-child { border-left: 1px solid var(--line); }

/* ---------------------------------------------------------------- 复习：卡片 */
.study { max-width: 760px; margin: 0 auto; }
.study-top { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s4); font-size: 13px; color: var(--muted); }
.study-top .progress { flex: 1; height: 2px; background: var(--line-soft); position: relative; }
.study-top .progress i { position: absolute; inset: 0 auto 0 0; background: var(--ink); transition: width var(--t-mid) var(--ease); }
.study-top .count { font-family: var(--serif); font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.mode-tag { font-size: 12px; letter-spacing: .12em; padding: 2px 8px; border: 1px solid var(--line); border-radius: var(--r); }
.mode-tag.retry { border-color: var(--ochre); color: var(--ochre); }

.card {
  position: relative; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-card);
  padding: clamp(var(--s4), 5vw, var(--s6)); min-height: 420px;
  animation: card-in var(--t-mid) var(--ease);
}
.card.undo-in { animation: card-back var(--t-mid) var(--ease); }
@keyframes card-in { from { opacity: 0; transform: translateX(18px); } }
@keyframes card-back { from { opacity: 0; transform: translateX(-18px); } }
.card-head { text-align: center; margin-bottom: var(--s5); }
.headword { font: 500 clamp(44px, 7vw, 64px)/1.05 var(--serif); letter-spacing: -.01em; margin: 0; overflow-wrap: anywhere; }
.phonetic { font: italic 18px var(--serif); color: var(--muted); margin-top: var(--s2); }
.phonetic .pos { font-style: italic; margin-left: var(--s2); color: var(--ink); }
.prompt-zh { font: 500 clamp(26px, 3.6vw, 34px)/1.45 var(--serif-zh); margin: 0; }
.prompt-pos { font: italic 17px var(--serif); color: var(--muted); margin-top: var(--s2); }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.opt {
  position: relative; display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: var(--s3);
  min-height: 64px; padding: var(--s3); text-align: left;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}
.opt:hover:not([disabled]) { border-color: var(--ink); }
.opt:active:not([disabled]) { transform: scale(.995); }
.opt[disabled] { cursor: default; }
.opt .k { font: 12px var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 2px; text-align: center; line-height: 22px; }
.opt .t { font: 17px/1.45 var(--serif-zh); }
.opt.en .t { font: 21px/1.3 var(--serif); }
.opt .src { display: block; margin-top: 2px; font: italic 13px var(--serif); color: var(--muted); }
.opt.is-correct { border-color: var(--teal); background: var(--teal-soft); }
.opt.is-correct .k { border-color: var(--teal); color: var(--teal); }
.opt.is-wrong { border-color: var(--sienna); background: var(--sienna-soft); }
.opt.is-wrong .k { border-color: var(--sienna); color: var(--sienna); }
.opt.is-correct::after, .opt.is-wrong::after {
  position: absolute; right: var(--s3); top: 50%; transform: translateY(-50%); font: 600 18px var(--ui);
}
.opt.is-correct::after { content: "✓"; color: var(--teal); }
.opt.is-wrong::after { content: "✗"; color: var(--sienna); }
.opt.dim { opacity: .55; }

.self-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); margin-top: var(--s5); }
.self-btn {
  display: grid; gap: 4px; justify-items: center; min-height: 84px; padding: var(--s3);
  border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); cursor: pointer;
  transition: all var(--t-fast);
}
.self-btn b { font: 600 20px var(--serif-zh); }
.self-btn small { font-size: 12px; color: var(--muted); }
.self-btn.know:hover, .self-btn.know.chosen { border-color: var(--teal); background: var(--teal-soft); color: var(--teal); }
.self-btn.fuzzy:hover, .self-btn.fuzzy.chosen { border-color: var(--ochre); background: var(--ochre-soft); color: var(--ochre); }
.self-btn.wrong:hover, .self-btn.wrong.chosen { border-color: var(--sienna); background: var(--sienna-soft); color: var(--sienna); }
.self-btn[disabled] { cursor: default; }
.self-btn[disabled]:not(.chosen) { opacity: .4; }

/* 组考察 */
.match { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: var(--s4); }
.match-col { display: grid; gap: var(--s2); align-content: start; }
.m-word, .m-mean {
  position: relative; min-height: 56px; padding: 10px var(--s3); text-align: left;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); cursor: pointer; transition: all var(--t-fast);
}
.m-word { font: 20px/1.3 var(--serif); }
.m-word small { display: block; font: italic 13px var(--serif); color: var(--muted); }
.m-mean { font: 15px/1.5 var(--serif-zh); }
.m-word.active { border-color: var(--ink); box-shadow: inset 3px 0 0 var(--ink); }
.m-word .tag, .m-mean .tag {
  position: absolute; right: 8px; top: 8px; min-width: 22px; height: 22px; padding: 0 5px;
  display: grid; place-items: center; font: 600 12px var(--mono); background: var(--ink); color: var(--paper); border-radius: 2px;
}
.m-mean.used { background: var(--paper-2); }
.m-word.ok, .m-mean.ok { border-color: var(--teal); background: var(--teal-soft); }
.m-word.bad { border-color: var(--sienna); background: var(--sienna-soft); }
.m-mean.decoy { border-style: dashed; opacity: .7; }
.match-foot { display: flex; justify-content: space-between; align-items: center; margin-top: var(--s4); font-size: 13px; color: var(--muted); }

/* 答案卡 */
.answer { margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--line); animation: reveal var(--t-mid) var(--ease); }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } }
.answer-entry + .answer-entry { margin-top: var(--s4); padding-top: var(--s4); border-top: 1px dashed var(--line); }
.answer-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.answer-word { font: 600 28px/1.2 var(--serif); }
.answer-word .ph { font: italic 15px var(--serif); color: var(--muted); margin-left: var(--s2); }
.answer-meaning { font: 18px/1.6 var(--serif-zh); margin: var(--s2) 0; }
.answer-meaning .pos { font: italic 16px var(--serif); color: var(--muted); margin-right: var(--s2); }
.colls { list-style: none; margin: var(--s2) 0 0; padding: 0; display: grid; gap: 4px; }
.colls li { display: flex; gap: var(--s3); align-items: baseline; font-size: 15px; }
.colls .en { font: italic 16px var(--serif); }
.colls .zh { color: var(--muted); }
.verdict { display: flex; align-items: center; gap: var(--s3); font-size: 13px; color: var(--muted); }
.stamp {
  display: inline-block; padding: 2px 10px; border: 1.5px solid currentColor; border-radius: 2px;
  font: 600 13px var(--serif-zh); letter-spacing: .15em; transform: rotate(-2deg);
}
.stamp.know { color: var(--teal); } .stamp.fuzzy { color: var(--ochre); } .stamp.wrong { color: var(--sienna); }
.score-move { font: 500 22px var(--serif); color: var(--ink); font-variant-numeric: tabular-nums; }
.score-move .arrow { color: var(--muted); margin: 0 4px; font-size: 16px; }
.score-move .up { color: var(--teal); } .score-move .down { color: var(--sienna); }
.answer-note { margin-top: var(--s2); font-size: 13px; color: var(--muted); }
.answer-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-top: var(--s5); flex-wrap: wrap; }

.study-bottom { display: flex; justify-content: space-between; margin-top: var(--s3); font-size: 12px; color: var(--muted); }
.study-bottom .keys span { margin-right: var(--s3); }

/* 本轮总结 */
.summary { max-width: 760px; margin: 0 auto; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); margin: var(--s4) 0; }
.summary-grid > div { padding: var(--s4) var(--s3); border-right: 1px solid var(--line-soft); }
.summary-grid > div:last-child { border-right: 0; }
.summary-grid b { display: block; font: 300 44px/1 var(--serif); margin-bottom: 6px; }
.summary-grid span { font-size: 13px; color: var(--muted); }
.movers { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); }
.movers ol { list-style: none; padding: 0; margin: var(--s2) 0 0; }
.movers li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line-soft); font-family: var(--serif); }

/* ---------------------------------------------------------------- 词库 */
.lib-head { display: flex; align-items: end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s4); flex-wrap: wrap; }
.lib-tools { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.lib-tools .input { width: 200px; }
.lib-sub { display: flex; gap: var(--s4); margin-bottom: var(--s3); border-bottom: 1px solid var(--line); }
.lib-sub button { background: none; border: 0; padding: 0 2px 10px; color: var(--muted); cursor: pointer; font-size: 14px; position: relative; }
.lib-sub button[aria-pressed="true"] { color: var(--ink); }
.lib-sub button[aria-pressed="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--ink); }
.lib-hint { font-size: 13px; color: var(--muted); margin: 0 0 var(--s3); }

.grid-wrap { position: relative; user-select: none; padding: var(--s3); margin: 0 calc(-1 * var(--s3)); min-height: 300px; cursor: crosshair; }
.word-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: var(--s2); }
.wcard {
  position: relative; display: grid; gap: 6px; padding: 12px 14px 10px; text-align: left; cursor: pointer;
  border: 1px solid var(--line-soft); border-radius: var(--r); background: var(--surface);
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}
.wcard:hover { border-color: var(--muted); }
.wcard .w { font: 500 19px/1.2 var(--serif); overflow-wrap: anywhere; }
.wcard .m { font: 13px/1.45 var(--serif-zh); color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.wcard .meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.wcard .meta .sc { font-family: var(--serif); font-size: 14px; color: var(--ink); }
.wcard .due-dot { position: absolute; top: 10px; right: 10px; width: 6px; height: 6px; border-radius: 50%; background: var(--sienna); }
.wcard.grad::before { content: "可毕业"; position: absolute; top: 8px; right: 8px; font-size: 10px; letter-spacing: .1em; color: var(--teal); border: 1px solid var(--teal); padding: 0 4px; }
.wcard.selected { border-color: var(--ink); background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--ink); }
.wcard.selected::after { content: "✓"; position: absolute; left: -7px; top: -7px; width: 18px; height: 18px; display: grid; place-items: center; background: var(--ink); color: var(--paper); font-size: 11px; border-radius: 50%; }
.marquee { position: absolute; border: 1px solid var(--teal); background: color-mix(in srgb, var(--teal) 10%, transparent); pointer-events: none; z-index: 5; }

.actionbar {
  position: fixed; left: 50%; bottom: var(--s4); z-index: 30; transform: translate(-50%, 140%);
  display: flex; align-items: center; gap: var(--s3); padding: 10px 10px 10px var(--s4);
  background: var(--ink); color: var(--paper); border-radius: var(--r); box-shadow: var(--shadow-pop);
  transition: transform var(--t-mid) var(--ease);
}
.actionbar.show { transform: translate(-50%, 0); }
.actionbar .n { font: 600 18px var(--serif); }
.actionbar .btn { border-color: color-mix(in srgb, var(--paper) 40%, transparent); color: var(--paper); min-height: 38px; padding: 0 var(--s3); font-size: 14px; }
.actionbar .btn:hover { background: color-mix(in srgb, var(--paper) 14%, transparent); }
.actionbar .btn-primary { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.actionbar .btn-primary:hover { background: var(--paper-2); }

.group-list { display: grid; gap: var(--s2); }
.group-row { display: grid; grid-template-columns: 1fr auto auto; gap: var(--s3); align-items: center; padding: 12px var(--s3); border: 1px solid var(--line-soft); background: var(--surface); }
.group-row .gname { font: 600 16px var(--serif); }
.group-row .gwords { font: italic 14px var(--serif); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 11px; letter-spacing: .1em; padding: 1px 6px; border: 1px solid var(--line); color: var(--muted); }

.grad-table { width: 100%; border-collapse: collapse; }
.grad-table th, .grad-table td { padding: 10px 8px; border-bottom: 1px solid var(--line-soft); text-align: left; font-size: 14px; }
.grad-table th { font-weight: 400; color: var(--muted); font-size: 12px; letter-spacing: .1em; }
.grad-table td.w { font: 500 17px var(--serif); }

/* 抽屉 */
.drawer-back { position: fixed; inset: 0; z-index: 40; background: rgba(26, 26, 24, .25); opacity: 0; transition: opacity var(--t-mid); }
.drawer-back.show { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41; width: min(520px, 100vw); overflow-y: auto;
  padding: var(--s5); background: var(--surface); box-shadow: var(--shadow-pop);
  transform: translateX(100%); transition: transform var(--t-mid) var(--ease);
}
.drawer.show { transform: none; }
.drawer .close { position: absolute; top: var(--s3); right: var(--s3); }
.checklist { list-style: none; padding: 0; margin: var(--s2) 0; display: grid; gap: 6px; }
.checklist li { display: grid; grid-template-columns: 22px 1fr auto; gap: var(--s2); font-size: 14px; align-items: center; }
.checklist .ok { color: var(--teal); } .checklist .no { color: var(--sienna); }
.hist { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: var(--s2); }
.hist td { padding: 6px 4px; border-bottom: 1px solid var(--line-soft); }
.hist .r-know { color: var(--teal); } .hist .r-fuzzy { color: var(--ochre); } .hist .r-wrong { color: var(--sienna); }

/* 对话框 */
dialog { border: 0; padding: 0; border-radius: var(--r); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); width: min(520px, 92vw); }
dialog::backdrop { background: rgba(26, 26, 24, .35); }
.dlg { padding: var(--s5); display: grid; gap: var(--s3); }
.dlg h3 { margin: 0; font: 600 20px var(--serif); }
.dlg .acts { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s2); }
.dlg .words-preview { font: italic 15px/1.6 var(--serif); color: var(--muted); max-height: 96px; overflow: auto; }

/* ---------------------------------------------------------------- 统计 */
.stats-head { display: flex; justify-content: space-between; align-items: end; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s4); }
.overview { display: grid; grid-template-columns: repeat(6, 1fr); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); margin-bottom: var(--s6); }
.overview > div { padding: var(--s3) var(--s3) var(--s4); border-right: 1px solid var(--line-soft); }
.overview > div:last-child { border-right: 0; }
.overview b { display: block; font: 300 40px/1.05 var(--serif); margin: 6px 0 2px; font-variant-numeric: lining-nums; }
.overview span { font-size: 12px; color: var(--muted); letter-spacing: .08em; }
.analysis { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--s5); padding: var(--s5) 0; border-bottom: 1px solid var(--line-soft); }
.analysis .no { font: italic 14px var(--serif); color: var(--muted); }
.analysis h3 { margin: 4px 0 var(--s3); font: 600 22px/1.3 var(--serif); }
.analysis .concl { font: 15.5px/1.75 var(--serif-zh); margin: 0; }
.analysis .why { font-size: 13px; color: var(--muted); margin-top: var(--s3); }
.analysis figure { margin: 0; }
.analysis img { width: 100%; height: auto; display: block; border-radius: var(--r); }
.analysis.na { grid-template-columns: 300px 1fr; opacity: .75; }
.analysis.na .placeholder { display: grid; place-items: center; min-height: 120px; border: 1px dashed var(--line); color: var(--muted); font-size: 14px; padding: var(--s3); text-align: center; }
.skeleton { background: linear-gradient(90deg, var(--paper-2), var(--surface), var(--paper-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; min-height: 220px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------------------------------------------------------- 文章 */
.art-list { display: grid; gap: 0; border-top: 1px solid var(--ink); }
.art-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: var(--s4); align-items: center; padding: var(--s3) 0; border-bottom: 1px solid var(--line-soft); }
.art-row .id { font: italic 22px var(--serif); color: var(--muted); }
.art-row .title { font: 600 19px/1.3 var(--serif); }
.art-row .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.art-row .sub i { font-family: var(--serif); }
.art-row .acts { display: flex; gap: var(--s2); flex-wrap: wrap; justify-content: flex-end; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.status.running { color: var(--ochre); }
.status.running::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 1.2s infinite; }
.status.error { color: var(--sienna); }
@keyframes pulse { 50% { opacity: .25; } }
.reader { max-width: 760px; margin: var(--s5) auto 0; }
.reader h2 { font: 600 34px/1.2 var(--serif); margin: 0; }
.reader .zh-title { font: 18px var(--serif-zh); color: var(--muted); margin: var(--s2) 0 var(--s5); }
.reader .pair { margin-bottom: var(--s4); }
.reader .en { font: 19px/1.75 var(--serif); margin: 0; }
.reader .en b { color: var(--teal); font-weight: 600; }
.reader .zh { font: 15px/1.8 var(--serif-zh); color: var(--muted); margin: var(--s2) 0 0; padding-left: var(--s3); border-left: 1px solid var(--line); }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); margin: var(--s4) 0 var(--s5); }
.how div { padding-top: var(--s3); border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.how b { display: block; font: italic 600 15px var(--serif); color: var(--ink); margin-bottom: 4px; }

/* ---------------------------------------------------------------- 设置 */
.settings { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--s6); }
.settings nav { position: sticky; top: 100px; align-self: start; display: grid; gap: var(--s2); }
.settings nav a { text-decoration: none; color: var(--muted); font-size: 14px; }
.settings nav a:hover { color: var(--ink); }
.set-sec { padding-bottom: var(--s5); margin-bottom: var(--s5); border-bottom: 1px solid var(--line-soft); scroll-margin-top: 100px; }
.set-sec p.desc { margin: 0 0 var(--s3); font-size: 14px; color: var(--muted); }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--s3); }
.intervals { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: end; }
.intervals label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); text-align: center; }
.intervals .input-num { width: 64px; }
.env { font: 13px/1.8 var(--mono); color: var(--muted); }
.env b { color: var(--ink); font-weight: 400; }
.grammar-list { display: grid; gap: var(--s2); margin-top: var(--s3); }
.grammar-row { display: grid; grid-template-columns: auto 1fr auto; gap: var(--s3); align-items: center; padding: 8px var(--s3); border: 1px solid var(--line-soft); background: var(--surface); }
.grammar-row .gn { font-weight: 600; }
.grammar-row .gd { font-size: 13px; color: var(--muted); }
.form-inline { display: grid; grid-template-columns: 180px 1fr auto; gap: var(--s2); }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 960px) {
  .desk { grid-template-columns: 1fr; gap: var(--s4); }
  .analysis, .analysis.na { grid-template-columns: 1fr; gap: var(--s3); }
  .overview { grid-template-columns: repeat(3, 1fr); }
  .overview > div:nth-child(3) { border-right: 0; }
  .settings { grid-template-columns: 1fr; }
  .settings nav { position: static; display: flex; flex-wrap: wrap; gap: var(--s3); }
}
@media (max-width: 720px) {
  .options { grid-template-columns: 1fr; }
  .match { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .movers { grid-template-columns: 1fr; }
  .art-row { grid-template-columns: 1fr; gap: var(--s2); }
  .art-row .acts { justify-content: flex-start; }
  .how { grid-template-columns: 1fr; }
  .form-inline { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- 词组多选、登录 */
.group-chips .chip { font-style: normal; font-family: var(--ui); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.group-chips .chip small { font: 12px var(--serif); color: var(--muted); }
.group-chips { max-height: 168px; overflow-y: auto; padding: 2px; }
.chips-tools { display: flex; gap: var(--s3); margin-top: 2px; }
.tab-ico { display: none; }

.login-body { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; }
.login { position: relative; z-index: 1; width: min(360px, 100% - 32px); padding: var(--s4) 0; }
.login-mark { justify-content: center; padding-bottom: var(--s5); }
.login-mark .wordmark-en { font-size: 44px; }
.login-card { display: grid; gap: var(--s3); padding: var(--s4); background: var(--surface); box-shadow: var(--shadow-card); border-radius: var(--r); }
.login-card .input { min-height: 48px; font-size: 17px; }
.login-card .btn { min-height: 48px; }
.login-err { margin: 0; min-height: 20px; color: var(--sienna); font-size: 14px; }
.login-foot { text-align: center; font-size: 13px; margin-top: var(--s3); }

/* 触屏：没有悬停，按下才有反馈；键盘提示没用 */
@media (hover: none), (pointer: coarse) {
  .kbd, .study-bottom .keys { display: none; }
  .opt:hover:not([disabled]) { border-color: var(--line); }
  .opt:active:not([disabled]) { border-color: var(--ink); background: var(--paper-2); }
  .self-btn.know:hover:not(.chosen), .self-btn.fuzzy:hover:not(.chosen), .self-btn.wrong:hover:not(.chosen) {
    border-color: var(--line); background: var(--paper); color: inherit;
  }
  .self-btn.know:active { border-color: var(--teal); background: var(--teal-soft); }
  .self-btn.fuzzy:active { border-color: var(--ochre); background: var(--ochre-soft); }
  .self-btn.wrong:active { border-color: var(--sienna); background: var(--sienna-soft); }
  .wcard:hover { border-color: var(--line-soft); }
  .grid-wrap { cursor: default; }
  button, a, .wcard { -webkit-tap-highlight-color: transparent; }
}

/* ---------------------------------------------------------------- 手机 */
@media (max-width: 720px) {
  :root { --nav-h: 58px; --safe-b: env(safe-area-inset-bottom, 0px); }
  .kbd, .study-bottom .keys { display: none; }
  body { font-size: 15px; }
  .masthead {
    grid-template-columns: 1fr auto; align-items: center; gap: var(--s2);
    padding: calc(env(safe-area-inset-top, 0px) + 8px) var(--s3) 8px;
    /* backdrop-filter 会让 fixed 子元素（底部标签栏）相对报头定位，手机上换成实色背景 */
    backdrop-filter: none; background: var(--paper);
  }
  .wordmark { padding-bottom: 0; }
  .wordmark-en { font-size: 22px; }
  .masthead-meta { padding-bottom: 0; gap: var(--s2); }
  .meta-day { font-size: 12px; }

  /* 底部标签栏：拇指够得着 */
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 0;
    height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
  }
  .tabs a { display: grid; place-items: center; align-content: center; gap: 2px; padding: 0; font-size: 11px; letter-spacing: .1em; }
  .tabs a[aria-current="page"]::after { top: 0; bottom: auto; left: 30%; right: 30%; }
  .tab-ico { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

  main { padding: var(--s3) var(--s3) calc(var(--nav-h) + var(--safe-b) + var(--s5)); }
  .h-display { font-size: 34px !important; }
  .toast { bottom: calc(var(--nav-h) + var(--safe-b) + 12px); }

  /* 书桌 */
  .desk-hero { padding-top: 0; }
  .desk-hero .count { font-size: 88px; margin: var(--s2) 0; }
  .desk-hero .count small { font-size: 15px; display: block; margin: 8px 0 0; }
  .desk-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s2); margin: var(--s3) 0; font-size: 12px; }
  .desk-stats b { font-size: 22px; }
  .desk-hero > p.muted { display: none; }
  .resume { flex-direction: column; align-items: stretch; padding: var(--s3); }
  .resume .btn { flex: 1; min-height: 44px; }
  .picker { padding: var(--s3); }
  .picker .row { margin-bottom: var(--s3); }
  .seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); width: 100%; }
  .seg button { min-height: 42px; padding: 0 4px; border-bottom: 1px solid var(--line); }
  .chip { min-height: 36px; }
  #pk-start { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 8px); min-height: 50px; font-size: 16px; z-index: 3; }

  /* 学习卡片：单列、大按钮，「下一个」固定在拇指位置 */
  .study-top { margin-bottom: var(--s3); gap: var(--s2); }
  .card { min-height: 0; padding: var(--s4) var(--s3); box-shadow: 0 6px 18px rgba(26, 26, 24, .08); }
  .card > div:first-child { margin-bottom: var(--s3) !important; flex-wrap: wrap; gap: 8px; }
  .card-head { margin-bottom: var(--s4); }
  .headword { font-size: clamp(34px, 11vw, 46px); }
  .phonetic { font-size: 16px; }
  .prompt-zh { font-size: 22px; }
  .options { grid-template-columns: 1fr; gap: 10px; }
  .opt { min-height: 56px; grid-template-columns: 24px 1fr; gap: 12px; padding: 12px 40px 12px 14px; }
  .opt .t { font-size: 16px; }
  .opt.en .t { font-size: 19px; }
  .self-actions { gap: 10px; margin-top: var(--s4); }
  .self-btn { min-height: 76px; padding: 12px 6px; }
  .self-btn small { font-size: 11px; }
  .match { grid-template-columns: 1fr; gap: var(--s3); }
  .m-word, .m-mean { min-height: 50px; }
  .match-foot { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b)); background: var(--surface); padding: 10px 0; margin-top: var(--s3); }
  .match-foot .btn { min-height: 46px; padding: 0 var(--s5); }
  .answer { margin-top: var(--s4); }
  .answer-word { font-size: 24px; }
  .answer-meaning { font-size: 16px; }
  .colls li { flex-direction: column; gap: 0; }
  .answer-foot {
    position: sticky; bottom: calc(var(--nav-h) + var(--safe-b)); z-index: 3;
    margin: var(--s4) calc(-1 * var(--s3)) calc(-1 * var(--s4)); padding: 10px var(--s3);
    background: var(--surface); border-top: 1px solid var(--line-soft);
  }
  .answer-foot .btn { flex: 1; min-height: 50px; font-size: 16px; }
  .study-bottom { justify-content: center; margin-top: var(--s3); }
  #undo-btn { font-size: 14px; padding: 10px; }
  .summary-grid b { font-size: 34px; }

  /* 词库 */
  .lib-head { align-items: stretch; gap: var(--s3); }
  .lib-tools { width: 100%; }
  .lib-tools .input:not(.input-num) { width: auto; flex: 1 1 100%; min-height: 44px; }
  .lib-tools .input-num { width: 72px; flex: 0 0 72px; }
  .lib-tools .select { flex: 1; min-height: 40px; }
  .lib-sub { overflow-x: auto; }
  .lib-sub button { white-space: nowrap; padding-bottom: 12px; font-size: 15px; }
  .grid-wrap { padding: var(--s2) 0; margin: 0; min-height: 0; }
  .word-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .wcard { padding: 10px 12px 8px; }
  .wcard .w { font-size: 17px; }
  .actionbar {
    left: 8px; right: 8px; width: auto; transform: translateY(160%); bottom: calc(var(--nav-h) + var(--safe-b) + 8px);
    display: grid; grid-template-columns: auto 1fr 1fr; gap: 6px; padding: 8px;
  }
  .actionbar.show { transform: none; }
  .actionbar > span { grid-row: span 2; align-self: center; padding: 0 6px; font-size: 12px; text-align: center; }
  .actionbar > span .n { display: block; font-size: 22px; }
  .actionbar .btn { min-height: 40px; padding: 0 6px; }
  .group-row { grid-template-columns: 1fr; gap: 8px; }
  .grad-table th:nth-child(n+5), .grad-table td:nth-child(n+5) { display: none; }
  .drawer { top: auto; max-height: 88vh; width: 100vw; padding: var(--s4) var(--s3) calc(var(--s4) + var(--safe-b)); border-radius: 12px 12px 0 0; transform: translateY(100%); }
  .drawer .headword { font-size: 36px !important; }
  dialog { width: calc(100vw - 24px); max-height: 86vh; }
  .dlg { padding: var(--s4) var(--s3); }
  .dlg .set-grid { grid-template-columns: 1fr 1fr !important; }

  /* 统计 / 文章 / 设置 */
  .overview { grid-template-columns: repeat(3, 1fr); margin-bottom: var(--s4); }
  .overview > div { padding: 10px 8px; }
  .overview > div:nth-child(-n+3) { border-bottom: 1px solid var(--line-soft); }
  .overview b { font-size: 28px; }
  .overview + p.muted { margin: 0 0 8px !important; }
  .analysis { padding: var(--s4) 0; }
  .analysis h3 { font-size: 19px; }
  .stats-head .btn, .art-row .acts .btn { min-height: 44px; }
  .reader .en { font-size: 17px; }
  .settings nav { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 6px; position: sticky; top: 52px; z-index: 5; background: var(--paper); }
  .settings nav a { white-space: nowrap; }
  .set-grid { grid-template-columns: 1fr 1fr; gap: var(--s2); }
  .intervals .input-num { width: 52px; }
  .input, .select { min-height: 44px; font-size: 16px; }  /* 16px 防止 iOS 聚焦时放大页面 */
}
@media (max-width: 360px) {
  .desk-stats { grid-template-columns: repeat(2, 1fr); }
  .word-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
