/* ============================================================
   词卡 · IELTS Vocabulary
   Design: index-card / dictionary drawer. Paper, ink, one green.
   ============================================================ */

:root {
  --bg: #F2F3EF;
  --surface: #FCFCF9;
  --surface-2: #E9EAE3;
  --surface-3: #DFE1D8;
  --ink: #1A1C19;
  --ink-2: #565C53;
  --ink-3: #878C82;
  --line: #DADBD2;
  --line-strong: #C3C5B9;
  --accent: #1F5C48;
  --accent-ink: #F4F7F2;
  --accent-soft: #DFEAE2;

  --new: #8D9087;
  --learning: #B0791F;
  --learning-soft: #F3E6CE;
  --familiar: #3B7C66;
  --familiar-soft: #DCEBE4;
  --mastered: #1E5A3C;
  --mastered-soft: #D9E9DE;
  --leech: #8C3B31;
  --leech-soft: #F2DFDA;
  --danger: #8C3B31;

  --shadow: 0 1px 2px rgba(26, 28, 25, .05), 0 8px 24px -12px rgba(26, 28, 25, .18);
  --shadow-sm: 0 1px 2px rgba(26, 28, 25, .06);
  --r: 12px;
  --r-sm: 8px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Songti SC", "Noto Serif CJK SC", serif;
  --sans: "Segoe UI", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

:root[data-theme="dark"] {
  --bg: #12140F;
  --surface: #1B1E18;
  --surface-2: #22261F;
  --surface-3: #2B2F27;
  --ink: #E7E8DF;
  --ink-2: #A7AC9F;
  --ink-3: #7B8074;
  --line: #2C3128;
  --line-strong: #3C4237;
  --accent: #7FBF9F;
  --accent-ink: #10170F;
  --accent-soft: #223327;
  --new: #868B7F;
  --learning: #DBA94F;
  --learning-soft: #332818;
  --familiar: #6DB79A;
  --familiar-soft: #172B24;
  --mastered: #7FC79B;
  --mastered-soft: #16291D;
  --leech: #D98A79;
  --leech-soft: #33201C;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px -16px rgba(0, 0, 0, .6);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #12140F;
    --surface: #1B1E18;
    --surface-2: #22261F;
    --surface-3: #2B2F27;
    --ink: #E7E8DF;
    --ink-2: #A7AC9F;
    --ink-3: #7B8074;
    --line: #2C3128;
    --line-strong: #3C4237;
    --accent: #7FBF9F;
    --accent-ink: #10170F;
    --accent-soft: #223327;
    --new: #868B7F;
    --learning: #DBA94F;
    --learning-soft: #332818;
    --familiar: #6DB79A;
    --familiar-soft: #172B24;
    --mastered: #7FC79B;
    --mastered-soft: #16291D;
    --leech: #D98A79;
    --leech-soft: #33201C;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px -16px rgba(0, 0, 0, .6);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
svg { display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.app { min-height: 100%; }
.sidebar { display: none; }
.topbar { display: none; }
.tabbar { display: none; }
.main { padding: 20px 18px calc(24px + env(safe-area-inset-bottom)); max-width: 1080px; margin: 0 auto; }

@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
  .sidebar {
    display: flex; flex-direction: column; gap: 26px;
    position: sticky; top: 0; height: 100vh; align-self: start;
    padding: 26px 18px 22px;
    border-right: 1px solid var(--line);
    background: var(--surface);
  }
  .main { padding: 40px 48px 72px; width: 100%; max-width: 1000px; }
  .tabbar { display: none !important; }
  .topbar { display: none !important; }
}

.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); }
.brand-mark { color: var(--accent); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--serif); font-size: 21px; letter-spacing: .06em; font-weight: 600; }
.brand-text span { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); margin-top: 4px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 11px; border-radius: var(--r-sm);
  color: var(--ink-2); font-size: 14px;
  transition: background .18s, color .18s;
}
.nav a svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.method-link { font-size: 12.5px; color: var(--ink-3); border-bottom: 1px solid var(--line); padding-bottom: 2px; width: fit-content; }
.method-link:hover { color: var(--ink-2); }
.streak-mini { font-size: 12.5px; color: var(--ink-2); }
.streak-mini b { font-family: var(--serif); font-size: 17px; color: var(--accent); margin-right: 4px; }

@media (max-width: 899px) {
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 30;
    padding: calc(10px + env(safe-area-inset-top)) 18px 10px;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
  }
  .brand-small .brand-text strong { font-size: 18px; }
  .topbar-right { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
  .topbar-right svg { width: 15px; height: 15px; stroke: var(--learning); fill: none; stroke-width: 1.6; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
    padding: 5px 2px calc(5px + env(safe-area-inset-bottom));
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 0; color: var(--ink-3); font-size: 10.5px; }
  .tabbar a svg { width: 21px; height: 21px; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a.active { color: var(--accent); }
  .main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
}

/* ---------- generic ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 26px; letter-spacing: .01em; }
.page-head .sub { color: var(--ink-3); font-size: 13px; margin-top: 4px; }
@media (min-width: 900px) { .page-head h1 { font-size: 30px; } }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 30px 0 12px; }
.section-title h2 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .1em; color: var(--ink-2); }
.section-title .more { font-size: 12.5px; color: var(--ink-3); }
.section-title .more:hover { color: var(--ink-2); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.panel-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-row:last-child { border-bottom: 0; }
.panel-row .label { font-size: 14px; }
.panel-row .hint { font-size: 12px; color: var(--ink-3); margin-top: 3px; line-height: 1.45; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 500;
  transition: transform .12s, background .16s, border-color .16s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn svg { width: 17px; height: 17px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px; font-size: 11.5px; line-height: 1.7;
  background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.chip.learning { background: var(--learning-soft); color: var(--learning); }
.chip.familiar { background: var(--familiar-soft); color: var(--familiar); }
.chip.mastered { background: var(--mastered-soft); color: var(--mastered); }
.chip.leech { background: var(--leech-soft); color: var(--leech); }
.chip.new { background: var(--surface-2); color: var(--ink-3); }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.new { background: var(--new); }
.dot.learning { background: var(--learning); }
.dot.familiar { background: var(--familiar); }
.dot.mastered { background: var(--mastered); }
.dot.leech { background: var(--leech); }

.num { font-variant-numeric: tabular-nums; }

.empty { padding: 40px 20px; text-align: center; color: var(--ink-3); font-size: 13.5px; }

/* ---------- today ---------- */
.today-date { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.today-date h1 { font-size: 30px; }
.today-date .weekday { font-size: 13px; color: var(--ink-3); letter-spacing: .08em; }
.streak-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); border: 1px solid var(--line); background: var(--surface); padding: 5px 11px; border-radius: 999px; }
.streak-pill b { font-family: var(--serif); font-size: 15px; color: var(--accent); }

.ledger { margin-top: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.ledger-head { padding: 16px 18px 12px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.ledger-head .title { font-family: var(--serif); font-size: 18px; }
.ledger-head .note { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.ledger-progress { min-width: 108px; text-align: right; }
.ledger-progress .pct { font-family: var(--serif); font-size: 26px; line-height: 1; }
.ledger-progress .pct small { font-size: 14px; color: var(--ink-3); }
.ledger-progress .lbl { font-size: 11px; color: var(--ink-3); margin-top: 5px; letter-spacing: .06em; }

.task-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 13px 18px; border-top: 1px solid var(--line); }
.task-row .box { width: 18px; height: 18px; border: 1.4px solid var(--line-strong); border-radius: 4px; display: grid; place-items: center; color: var(--ink-3); }
.task-row.done .box { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.task-row.done .box svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2.4; fill: none; }
.task-row .name { font-size: 14.5px; }
.task-row.done .name { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.task-row .desc { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.task-row .count { font-size: 13px; color: var(--ink-2); text-align: right; white-space: nowrap; }
.task-row .count b { font-size: 17px; font-family: var(--serif); font-weight: 600; color: var(--ink); }

.ledger-foot { padding: 15px 18px 18px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ledger-foot .btn.primary { flex: 1 1 220px; padding: 13px 18px; font-size: 15px; }
.ledger-foot .btn { flex: 0 0 auto; }

.load-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 2px; }
.load-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.load-col .when { font-size: 10.5px; color: var(--ink-3); letter-spacing: .03em; }
.load-col .bar-wrap { height: 74px; width: 100%; display: flex; align-items: flex-end; }
.load-col .bar { width: 100%; background: var(--surface-3); border-radius: 4px 4px 2px 2px; min-height: 3px; }
.load-col .bar.today { background: var(--accent); }
.load-col .bar .seg-rev { background: var(--surface-3); }
.load-col .n { font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.mastery-strip { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-3); }
.mastery-legend { display: flex; flex-wrap: wrap; gap: 14px 22px; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); }
.mastery-legend span { display: inline-flex; align-items: center; gap: 7px; }
.mastery-legend b { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }

.mini-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 900px) { .mini-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat-tile { padding: 14px 16px; }
.stat-tile .k { font-size: 11.5px; color: var(--ink-3); letter-spacing: .04em; }
.stat-tile .v { font-family: var(--serif); font-size: 25px; margin-top: 4px; line-height: 1.1; }
.stat-tile .v small { font-family: var(--sans); font-size: 12px; color: var(--ink-3); margin-left: 4px; }

/* ---------- study ---------- */
.study-wrap { max-width: 760px; margin: 0 auto; }
.study-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.study-top .exit { flex: 0 0 auto; }
.progress-line { flex: 1 1 auto; height: 4px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress-line > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .25s ease; }
.progress-count { flex: 0 0 auto; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.card-stage { position: relative; }
.word-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 22px 22px 20px;
  min-height: clamp(340px, 60vh, 540px);
  display: flex; flex-direction: column;
}
.word-card::before {
  content: attr(data-ch);
  position: absolute; left: -1px; top: 18px;
  writing-mode: vertical-rl;
  padding: 9px 4px;
  font-size: 10px; letter-spacing: .12em; color: var(--accent);
  background: var(--accent-soft);
  border-radius: 0 5px 5px 0;
  border: 1px solid var(--line); border-left: 0;
}
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-left: 14px; font-size: 12px; color: var(--ink-3); }
.card-meta .theme { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.word-line { padding-left: 14px; margin-top: 22px; }
.word { margin: 0; font-family: var(--serif); font-weight: 600; font-size: clamp(30px, 6vw, 46px); line-height: 1.12; letter-spacing: .005em; overflow-wrap: anywhere; }
.word.long { font-size: clamp(23px, 5vw, 34px); letter-spacing: -.005em; }
.word .hl { color: var(--accent); }
.phon-line { display: flex; align-items: center; gap: 10px; margin-top: 8px; color: var(--ink-2); font-family: var(--serif); font-size: 15px; letter-spacing: .02em; }
.icon-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--accent); }
.icon-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; }
.icon-btn.speaking { color: var(--accent); border-color: var(--accent); }

.prompt { margin-top: 26px; padding-left: 14px; color: var(--ink-3); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.prompt .rule { flex: 1 1 auto; height: 1px; background: var(--line); }
.word-card.revealed .prompt { display: none; }
.reveal-cta { margin: auto 0 0 14px; align-self: flex-start; }
.word-card.revealed .reveal-cta { display: none; }

.answer { padding-left: 14px; margin-top: 18px; animation: fade .22s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.def { font-size: 16px; line-height: 1.7; }
.def .pos { color: var(--accent); font-family: var(--serif); font-style: italic; margin-right: 2px; }
.def-sep { color: var(--line-strong); margin: 0 6px; }
.example { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.example .en { font-family: var(--serif); font-size: 15px; line-height: 1.65; color: var(--ink); }
.example .en .hl { background: var(--accent-soft); color: var(--ink); border-radius: 3px; padding: 0 2px; }
.example .cn { margin-top: 6px; font-size: 13.5px; color: var(--ink-2); }
.extra { margin: 14px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.extra li { font-size: 13px; color: var(--ink-2); display: flex; gap: 8px; line-height: 1.6; }
.extra .tag { flex: 0 0 auto; color: var(--accent); font-family: var(--serif); }

.gradebar { margin-top: 14px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.grade { border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-sm); padding: 10px 6px 9px; text-align: center; transition: background .15s, border-color .15s, transform .1s; }
.grade:hover { transform: translateY(-1px); }
.grade .g { display: block; font-size: 13.5px; font-weight: 600; }
.grade .n { display: block; font-size: 10.5px; color: var(--ink-3); margin-top: 3px; font-variant-numeric: tabular-nums; }
.grade.g1:hover { background: var(--leech-soft); border-color: var(--leech); }
.grade.g2:hover { background: var(--learning-soft); border-color: var(--learning); }
.grade.g3:hover { background: var(--familiar-soft); border-color: var(--familiar); }
.grade.g4:hover { background: var(--mastered-soft); border-color: var(--mastered); }
.grade.g1 .g { color: var(--leech); }
.grade.g2 .g { color: var(--learning); }
.grade.g3 .g { color: var(--familiar); }
.grade.g4 .g { color: var(--mastered); }

.hint-keys { margin-top: 10px; text-align: center; font-size: 11.5px; color: var(--ink-3); }
@media (max-width: 560px) { .hint-keys { display: none; } }

/* spelling / quiz */
.spell-box { margin-top: 22px; padding-left: 14px; }
.spell-input { width: 100%; padding: 13px 14px; border-radius: var(--r-sm); border: 1.5px solid var(--line-strong); background: var(--surface); font-family: var(--serif); font-size: 20px; letter-spacing: .02em; }
.spell-input:focus { border-color: var(--accent); outline: none; }
.spell-actions { display: flex; gap: 10px; margin-top: 12px; }
.spell-feedback { margin-top: 14px; padding: 12px 14px; border-radius: var(--r-sm); font-size: 13.5px; }
.spell-feedback.ok { background: var(--mastered-soft); color: var(--mastered); }
.spell-feedback.bad { background: var(--leech-soft); color: var(--leech); }
.spell-feedback .ans { font-family: var(--serif); font-size: 20px; display: block; margin-top: 4px; }

.quiz-options { display: grid; gap: 9px; margin-top: 20px; padding-left: 14px; }
.opt { text-align: left; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-sm); padding: 12px 14px; font-size: 14.5px; display: flex; gap: 10px; align-items: flex-start; }
.opt .k { flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; font-size: 11px; color: var(--ink-3); }
.opt:hover { border-color: var(--accent); }
.opt.correct { border-color: var(--mastered); background: var(--mastered-soft); }
.opt.wrong { border-color: var(--leech); background: var(--leech-soft); }
.opt.dim { opacity: .5; }

/* session summary */
.summary { text-align: center; padding: 28px 20px 24px; }
.summary .eyebrow { font-size: 11.5px; letter-spacing: .16em; color: var(--ink-3); }
.summary h2 { font-family: var(--serif); font-size: 30px; margin: 8px 0 4px; }
.summary .line { color: var(--ink-2); font-size: 13.5px; }
.summary .figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 24px 0 22px; }
.summary .figures div { padding: 12px 6px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.summary .figures b { display: block; font-family: var(--serif); font-size: 24px; }
.summary .figures span { font-size: 11px; color: var(--ink-3); }
.summary .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* start screen */
.start { max-width: 560px; margin: 6vh auto 0; text-align: center; }
.start h2 { font-family: var(--serif); font-size: 28px; margin: 0 0 6px; }
.start p { color: var(--ink-2); font-size: 14px; margin: 0 0 22px; }
.mode-list { display: grid; gap: 10px; text-align: left; }
.mode-btn { display: flex; align-items: center; gap: 14px; padding: 15px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.mode-btn:hover { border-color: var(--accent); background: var(--surface); box-shadow: var(--shadow-sm); }
.mode-btn .ico { width: 38px; height: 38px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; color: var(--accent); flex: 0 0 auto; }
.mode-btn .ico svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; }
.mode-btn .t { font-size: 14.5px; font-weight: 600; }
.mode-btn .d { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.mode-btn .go { margin-left: auto; color: var(--ink-3); }
.mode-btn .go svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.mode-btn[disabled] { opacity: .5; }

/* ---------- library ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 8px; }
.filter { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; color: var(--ink-2); }
.filter.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.search-row { display: flex; gap: 8px; margin: 12px 0; }
.search { flex: 1 1 auto; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.search svg { width: 16px; height: 16px; stroke: var(--ink-3); fill: none; stroke-width: 1.6; flex: 0 0 auto; }
.search input { flex: 1 1 auto; min-width: 0; border: 0; background: transparent; outline: none; font-size: 14px; }
.select { padding: 9px 10px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); font-size: 13px; max-width: 46vw; }

.word-list { border-top: 1px solid var(--line); }
.word-row { display: grid; grid-template-columns: 10px minmax(0, 1.1fr) minmax(0, 1.5fr) auto; gap: 12px; align-items: center; padding: 11px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.word-row:hover { background: var(--surface-2); }
.word-row .w { font-family: var(--serif); font-size: 16px; overflow-wrap: anywhere; }
.word-row .w small { display: block; font-family: var(--sans); font-size: 11px; color: var(--ink-3); }
.word-row .m { font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.word-row .due { font-size: 11.5px; color: var(--ink-3); text-align: right; white-space: nowrap; }
.load-more { margin: 18px auto; display: block; }
.list-count { font-size: 12px; color: var(--ink-3); }

/* ---------- stats ---------- */
.heat-legend { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-3); }
.heat-scroll { overflow-x: auto; padding-bottom: 4px; }
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px); gap: 3px; width: max-content; }
.heat-cell { width: 12px; height: 12px; border-radius: 2px; background: var(--surface-3); }
.heat-1 { background: color-mix(in srgb, var(--accent) 22%, var(--surface-3)); }
.heat-2 { background: color-mix(in srgb, var(--accent) 42%, var(--surface-3)); }
.heat-3 { background: color-mix(in srgb, var(--accent) 66%, var(--surface-3)); }
.heat-4 { background: var(--accent); }
.heat-month { display: grid; grid-auto-flow: column; gap: 3px; font-size: 10px; color: var(--ink-3); margin-bottom: 4px; }

.chart { width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart-legend { display: flex; gap: 16px; font-size: 11.5px; color: var(--ink-2); margin-top: 10px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 5px; }

.big-num { font-family: var(--serif); font-size: 34px; line-height: 1; }
.stat-pair { display: flex; gap: 30px; flex-wrap: wrap; }
.stat-pair > div .k { font-size: 11.5px; color: var(--ink-3); }
.stat-pair > div .v { font-family: var(--serif); font-size: 22px; margin-top: 3px; }

.leech-list { display: flex; flex-direction: column; }
.leech-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.leech-row .w { font-family: var(--serif); font-size: 15px; min-width: 0; overflow-wrap: anywhere; }
.leech-row .d { font-size: 12px; color: var(--ink-2); flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leech-row .n { font-size: 11.5px; color: var(--leech); white-space: nowrap; }

/* ---------- settings ---------- */
.set-group { margin-bottom: 22px; }
.set-group h2 { font-size: 12px; letter-spacing: .1em; color: var(--ink-3); margin: 0 0 8px; font-weight: 600; }
.field { display: grid; gap: 6px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; }
.field .l { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.field .l span { font-size: 14px; }
.field .l small { font-size: 11.5px; color: var(--ink-3); }
.field input[type="range"] { width: 100%; accent-color: var(--accent); }
.field select, .field input[type="text"], .field input[type="number"] { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); font-size: 13.5px; }
.field .row-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.seg button { flex: 1 1 0; padding: 7px 6px; border: 0; background: var(--surface); font-size: 12.5px; color: var(--ink-2); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }

/* ---------- method ---------- */
.method { max-width: 760px; }
.method h2 { font-family: var(--serif); font-size: 22px; margin: 30px 0 10px; }
.method h3 { font-size: 14px; margin: 22px 0 8px; color: var(--accent); letter-spacing: .02em; }
.method p, .method li { font-size: 14px; color: var(--ink-2); line-height: 1.75; }
.method ul { padding-left: 18px; }
.method .quote { border-left: 2px solid var(--accent); padding: 8px 0 8px 16px; font-family: var(--serif); font-size: 16px; color: var(--ink); }
.method table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 10px 0; }
.method th, .method td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; }
.method th { color: var(--ink-3); font-weight: 500; font-size: 12px; }

/* ---------- sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(10, 12, 9, .42); display: flex; align-items: flex-end; justify-content: center; padding: 0; }
@media (min-width: 720px) { .sheet-backdrop { align-items: center; padding: 24px; } }
.sheet {
  width: 100%; max-width: 620px; max-height: 88vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px 16px 0 0; box-shadow: var(--shadow);
  padding: 20px 20px calc(22px + env(safe-area-inset-bottom));
  animation: sheetUp .24s cubic-bezier(.2,.8,.3,1) both;
}
@media (min-width: 720px) { .sheet { border-radius: var(--r); animation: fade .2s ease both; } }
@keyframes sheetUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet .head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sheet .word { font-size: 30px; }
.sheet .phon { font-family: var(--serif); color: var(--ink-2); margin-top: 2px; }
.sheet .close { flex: 0 0 auto; }
.sheet .body { margin-top: 16px; }
.sheet .body .def { font-size: 15px; }
.sheet .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.sheet .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 80; background: var(--ink); color: var(--surface); font-size: 13px; padding: 9px 16px; border-radius: 999px; box-shadow: var(--shadow); max-width: 86vw; text-align: center; }
@media (min-width: 900px) { .toast { bottom: 28px; } }

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

/* print */
@media print {
  .sidebar, .tabbar, .topbar, .gradebar, .btn { display: none !important; }
  body { background: #fff; }
  .main { padding: 0; max-width: none; }
}
