/* ============ 设计令牌 ============ */
:root {
  --bg: #f5f6fa;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, #e9e7ff 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 10%, #dff3ff 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --glass: rgba(255, 255, 255, 0.72);
  --text: #0f172a;
  --text-2: #475569;
  --muted: #7b8496;
  --border: #e4e7ef;
  --accent: #5b5bf0;
  --accent-2: #8b5cf6;
  --accent-soft: #ecebff;
  --on-accent: #fff;
  --ok: #10b981;
  --ok-soft: #e3f8f0;
  --bad: #ef4444;
  --bad-soft: #fdecec;
  --warn: #f59e0b;
  --warn-soft: #fff4dc;
  --info: #3b82f6;
  --info-soft: #e6f0ff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -8px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 2px 4px rgba(15, 23, 42, 0.04), 0 24px 48px -16px rgba(60, 50, 160, 0.25);
  --heat-0: #eceff5;
  --heat-1: #c7c9fb;
  --heat-2: #9a9cf6;
  --heat-3: #6d6ff1;
  --heat-4: #4b45d8;
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 24px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", Inter, Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --top-h: 60px;
  --tab-h: 64px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0b0d14;
  --bg-grad: radial-gradient(1000px 600px at 0% -10%, rgba(91, 91, 240, 0.18) 0%, transparent 60%),
    radial-gradient(800px 500px at 110% 0%, rgba(14, 165, 233, 0.1) 0%, transparent 55%);
  --surface: #141823;
  --surface-2: #1b2030;
  --glass: rgba(20, 24, 35, 0.72);
  --text: #e8eaf2;
  --text-2: #b4bbcc;
  --muted: #858da1;
  --border: #252b3b;
  --accent: #8b8cff;
  --accent-2: #b38bff;
  --accent-soft: #23234a;
  --on-accent: #0b0d14;
  --ok: #34d399;
  --ok-soft: #0f2c24;
  --bad: #f87171;
  --bad-soft: #351819;
  --warn: #fbbf24;
  --warn-soft: #33270c;
  --info: #60a5fa;
  --info-soft: #14233d;
  --shadow-sm: none;
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.02), 0 10px 30px -10px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.03), 0 30px 60px -20px rgba(0, 0, 0, 0.7);
  --heat-0: #1b2030;
  --heat-1: #2c2d63;
  --heat-2: #4446a3;
  --heat-3: #6667de;
  --heat-4: #9798ff;
  color-scheme: dark;
}

/* ============ 基础 ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.3s, color 0.3s;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 99; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ============ 顶栏 & 导航 ============ */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 12px;
  background: var(--glass);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: 0.02em; }
.brand img { border-radius: 9px; box-shadow: var(--shadow-sm); }
.brand small { margin-left: 6px; font-weight: 500; font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }
.tabs { margin-left: auto; display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 999px; }
.tab { display: flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; color: var(--text-2); font-weight: 600; font-size: 14px; transition: all 0.2s var(--ease); }
.tab svg { width: 18px; height: 18px; }
.tab:hover { color: var(--text); }
.tab[aria-current="page"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--text-2); transition: background 0.2s, color 0.2s, transform 0.2s; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(0.92); }
#themeBtn .moon { display: none; }
[data-theme="dark"] #themeBtn .sun { display: none; }
[data-theme="dark"] #themeBtn .moon { display: block; }

@media (max-width: 720px) {
  /* backdrop-filter 会让内部 fixed 元素相对顶栏定位，手机上去掉它，底部导航才能贴底 */
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); }
  .brand small { display: none; }
  #themeBtn { margin-left: auto; }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0;
    height: calc(var(--tab-h) + env(safe-area-inset-bottom));
    padding: 6px 12px env(safe-area-inset-bottom);
    border-radius: 0; justify-content: space-around;
    background: var(--glass);
    backdrop-filter: saturate(1.6) blur(16px);
    -webkit-backdrop-filter: saturate(1.6) blur(16px);
    border-top: 1px solid var(--border);
  }
  .tab { flex-direction: column; gap: 2px; padding: 6px 18px; font-size: 11px; background: none !important; box-shadow: none !important; }
  .tab svg { width: 22px; height: 22px; }
  body.studying .tabs { display: none; }
}

/* ============ 布局 ============ */
main {
  max-width: 920px; margin: 0 auto;
  padding: 20px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left));
  outline: none;
}
@media (max-width: 720px) { main { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 24px); } }
.view { animation: fadeUp 0.35s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow); }
.panel + .panel, .grid + .panel, .panel + .grid { margin-top: 16px; }
.panel h2 { margin: 0 0 14px; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.panel h2 .sub { margin-left: auto; font-size: 13px; font-weight: 500; color: var(--muted); }
.muted { color: var(--muted); }

/* ============ 首页 Hero ============ */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-lg); padding: 24px;
  color: #fff;
  background: linear-gradient(135deg, #5b5bf0 0%, #8b5cf6 55%, #c026d3 120%);
  box-shadow: var(--shadow-lg);
}
[data-theme="dark"] .hero { background: linear-gradient(135deg, #3a3ac4 0%, #6d3fd6 60%, #9a1fa8 130%); }
.hero::after {
  content: ""; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.25), transparent 70%);
  pointer-events: none;
}
.hero .date { font-size: 13px; opacity: 0.85; letter-spacing: 0.04em; }
.hero h1 { margin: 4px 0 18px; font-size: 24px; line-height: 1.3; font-weight: 750; }
.hero .nums { display: flex; gap: 28px; margin-bottom: 20px; }
.hero .num b { display: block; font-size: 34px; line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; }
.hero .num span { font-size: 13px; opacity: 0.85; }
.hero .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.seg { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--surface-2); gap: 2px; }
.seg button { padding: 7px 14px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--text-2); transition: all 0.2s var(--ease); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.hero .seg { background: rgba(255, 255, 255, 0.16); }
.hero .seg button { color: rgba(255, 255, 255, 0.85); }
.hero .seg button[aria-pressed="true"] { background: #fff; color: #4338ca; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 12px; font-weight: 650; font-size: 15px;
  background: var(--surface-2); color: var(--text); transition: transform 0.15s var(--ease), background 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.btn:hover { filter: brightness(1.03); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 8px 20px -8px var(--accent); }
.btn.white { background: #fff; color: #4338ca; box-shadow: 0 8px 24px -10px rgba(0, 0, 0, 0.4); }
.btn.ghost { background: transparent; border: 1px solid var(--border); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }

/* 范围选择 chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin: 0 -2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  background: var(--surface); color: var(--text-2); border: 1px solid var(--border); transition: all 0.2s var(--ease);
}
.chip .n { font-size: 12px; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip[aria-pressed="true"] .n { color: var(--accent); }

/* 统计格 */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(4, 1fr); margin-top: 16px; }
@media (max-width: 720px) { .grid { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .k { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .v small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 2px; }
.bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 99px; transition: width 0.6s var(--ease); }

/* 热力图 */
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 4px; overflow-x: auto; padding-bottom: 4px; justify-content: start; }
.heat i { width: 13px; height: 13px; border-radius: 3.5px; background: var(--heat-0); }
.heat i[data-l="1"] { background: var(--heat-1); }
.heat i[data-l="2"] { background: var(--heat-2); }
.heat i[data-l="3"] { background: var(--heat-3); }
.heat i[data-l="4"] { background: var(--heat-4); }
.heat i.today { outline: 1.5px solid var(--accent); outline-offset: 1px; }
.legend { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); margin-top: 10px; justify-content: flex-end; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* 错词榜 */
.hard-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.hard-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.hard-item b { font-size: 15px; }
.hard-item .x { font-size: 12.5px; color: var(--bad); text-decoration: line-through; text-decoration-thickness: 1.5px; font-family: var(--mono); }
.hard-item .cnt { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--bad); background: var(--bad-soft); padding: 2px 8px; border-radius: 99px; }
.empty { text-align: center; padding: 24px 12px; color: var(--muted); font-size: 14px; }
.empty .emo { font-size: 32px; display: block; margin-bottom: 6px; }

/* ============ 学习页 ============ */
.study { max-width: 640px; margin: 0 auto; }
.study-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.counters { display: flex; gap: 12px; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; }
.counters .c-new { color: var(--info); }
.counters .c-learn { color: var(--bad); }
.counters .c-due { color: var(--ok); }
.counters span[data-cur="1"] { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.study-top .grow { flex: 1; }
.mode-tag { font-size: 12.5px; color: var(--muted); padding: 4px 10px; background: var(--surface-2); border-radius: 99px; }

.scene { perspective: 1600px; }
.flip {
  position: relative; display: grid;
  transform-style: preserve-3d;
  transition: transform 0.6s var(--ease);
}
.flip.flipped { transform: rotateY(180deg); }
.face {
  grid-area: 1 / 1;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: 28px 24px;
  min-height: 380px; display: flex; flex-direction: column;
}
.face.back { transform: rotateY(180deg); }
.card-enter { animation: cardIn 0.45s var(--ease); }
@keyframes cardIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
.shake { animation: shake 0.4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.badge { font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); }
.badge.new { background: var(--info-soft); color: var(--info); }
.badge.learn { background: var(--bad-soft); color: var(--bad); }
.badge.review { background: var(--ok-soft); color: var(--ok); }

.prompt-zh { font-size: 24px; font-weight: 750; line-height: 1.35; margin: 4px 0 6px; }
.prompt-zh .pos { font-size: 14px; font-weight: 600; color: var(--accent); margin-right: 8px; font-style: italic; }
.example { font-size: 16px; color: var(--text-2); line-height: 1.7; margin: 10px 0 0; }
.example .blank {
  display: inline-block; min-width: 4.5em; border-bottom: 2px dashed var(--accent);
  color: var(--accent); text-align: center; font-family: var(--mono); font-size: 14px; letter-spacing: 0.12em; line-height: 1.3;
}
.example mark { background: linear-gradient(transparent 55%, var(--accent-soft) 55%); color: var(--text); font-weight: 700; padding: 0 2px; }
.meta-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin-top: 12px; }

.speak { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 650; font-size: 13px; }
.speak:active { transform: scale(0.95); }
.speak.playing svg { animation: pulse 0.9s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.spacer { flex: 1; min-height: 16px; }

/* 拼写输入 */
.spell-box { position: relative; margin-top: 18px; }
.spell-input {
  width: 100%; height: 58px; padding: 0 18px; border-radius: 14px;
  font-family: var(--mono); font-size: 22px; letter-spacing: 0.06em;
  background: var(--surface-2); border: 2px solid transparent; transition: border-color 0.2s, background 0.2s;
}
.spell-input::placeholder { color: var(--muted); opacity: 0.6; letter-spacing: 0.25em; }
.spell-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.spell-input.ok { border-color: var(--ok); }
.spell-input.bad { border-color: var(--bad); }
.spell-actions { display: flex; gap: 10px; margin-top: 12px; }
.spell-actions .btn.primary { flex: 1; }
.hint-line { margin-top: 10px; font-size: 13px; color: var(--muted); font-family: var(--mono); letter-spacing: 0.2em; min-height: 20px; }

/* 选择题 */
.options { display: grid; gap: 10px; margin-top: 18px; grid-template-columns: 1fr 1fr; }
@media (max-width: 420px) { .options { grid-template-columns: 1fr; } }
.opt {
  height: 56px; border-radius: 14px; background: var(--surface-2); border: 2px solid transparent;
  font-family: var(--mono); font-size: 18px; font-weight: 600; letter-spacing: 0.03em; transition: all 0.18s var(--ease);
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 12px;
}
.opt kbd { font-family: var(--font); font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; }
.opt:hover { border-color: var(--accent); }
.opt.ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.opt.bad { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); text-decoration: line-through; }

/* 背面 */
.answer-word { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.answer-word h2 { margin: 0; font-size: 36px; font-weight: 800; letter-spacing: 0.01em; line-height: 1.2; word-break: break-word; }
.answer-word .alt { font-size: 14px; color: var(--muted); }
.answer-zh { margin: 6px 0 0; font-size: 16px; color: var(--text-2); }
.answer-zh .pos { color: var(--accent); font-style: italic; font-weight: 600; margin-right: 6px; }

.diff { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 16px; font-family: var(--mono); font-size: 20px; font-weight: 700; }
.diff span { min-width: 1.15em; padding: 3px 2px; text-align: center; border-radius: 6px; line-height: 1.2; position: relative; }
.diff .ok { color: var(--ok); background: var(--ok-soft); }
.diff .sub { color: var(--bad); background: var(--bad-soft); }
.diff .miss { color: var(--warn); background: var(--warn-soft); outline: 1.5px dashed var(--warn); outline-offset: -1.5px; }
.diff .extra { color: var(--bad); text-decoration: line-through; opacity: 0.7; background: transparent; }
.diff .sub::after { content: attr(data-u); position: absolute; left: 0; right: 0; top: -15px; font-size: 11px; text-decoration: line-through; opacity: 0.8; }
.diff-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; }
.diff-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

.tip { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--text); font-size: 14.5px; display: flex; gap: 10px; }
.tip svg { color: var(--warn); margin-top: 1px; }
.wrongs { margin-top: 14px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); }
.wrongs s { font-family: var(--mono); font-size: 14px; color: var(--bad); background: var(--bad-soft); padding: 2px 8px; border-radius: 6px; text-decoration-thickness: 1.5px; }
.wrongs s.mine { outline: 1.5px solid var(--bad); }

.retype { margin-top: 16px; padding: 14px; border-radius: 14px; border: 1px dashed var(--border); }
.retype p { margin: 0 0 8px; font-size: 13.5px; color: var(--text-2); }
.retype .spell-input { height: 50px; font-size: 19px; }

/* 评分条 */
.rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.rate button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  height: 62px; border-radius: 14px; font-weight: 700; font-size: 15px; background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow); transition: transform 0.15s var(--ease), border-color 0.2s, background 0.2s;
}
.rate button small { font-size: 11.5px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.rate button:active { transform: scale(0.96); }
.rate .r1 { color: var(--bad); }
.rate .r2 { color: var(--warn); }
.rate .r3 { color: var(--ok); }
.rate .r4 { color: var(--info); }
.rate button.suggest { border-width: 2px; border-color: currentColor; }
.rate button kbd { display: none; }
@media (hover: hover) { .rate button kbd { display: inline; position: absolute; } }
.reveal-btn { margin-top: 16px; }
.kbd-hint { text-align: center; font-size: 12px; color: var(--muted); margin-top: 12px; }
@media (hover: none) { .kbd-hint { display: none; } }

.done { text-align: center; padding: 48px 20px; }
.done .emo { font-size: 56px; }
.done h2 { margin: 10px 0 6px; font-size: 22px; }
.done p { color: var(--muted); margin: 0 0 20px; }
.done .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ============ 词库 ============ */
.search {
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 12px;
}
.search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 16px; min-width: 0; }
.search svg { color: var(--muted); }
.list { margin-top: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.item { border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: 0; }
.item > button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 13px 16px; text-align: left; }
.item > button:hover { background: var(--surface-2); }
.item .w { font-weight: 700; font-size: 16px; }
.item .z { color: var(--muted); font-size: 13.5px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); flex: none; }
.dot.learn { background: var(--bad); }
.dot.review { background: var(--ok); }
.dot.mature { background: var(--accent); }
.item .chev { transition: transform 0.25s var(--ease); color: var(--muted); width: 18px; }
.item.open .chev { transform: rotate(90deg); }
.detail { display: none; padding: 0 16px 16px 36px; }
.item.open .detail { display: block; animation: fadeUp 0.25s var(--ease); }
.detail .tip { margin-top: 0; }
.detail .row { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.list-foot { text-align: center; color: var(--muted); font-size: 13px; padding: 14px; }
.legend-dots { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin: 4px 2px 0; flex-wrap: wrap; }
.legend-dots span { display: inline-flex; align-items: center; gap: 6px; }

/* ============ 设置 ============ */
.set-row { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.set-row:last-child { border-bottom: 0; padding-bottom: 0; }
.set-row:first-of-type { padding-top: 0; }
.set-row .lbl { flex: 1; min-width: 160px; }
.set-row .lbl b { display: block; font-weight: 650; }
.set-row .lbl span { font-size: 13px; color: var(--muted); }
.switch { position: relative; width: 50px; height: 30px; border-radius: 99px; background: var(--border); transition: background 0.25s; flex: none; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.25s var(--ease); }
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.about { font-size: 13.5px; color: var(--text-2); line-height: 1.7; }
.about p { margin: 0 0 8px; }

/* ============ Toast ============ */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 12px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg); transition: all 0.3s var(--ease); max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 720px) { .toast { bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom)); } body.studying .toast { bottom: calc(24px + env(safe-area-inset-bottom)); } }

/* ============ 小屏微调 ============ */
@media (max-width: 480px) {
  main { padding-top: 14px; }
  .hero { padding: 20px; }
  .hero h1 { font-size: 21px; }
  .hero .num b { font-size: 30px; }
  .face { padding: 22px 18px; min-height: 340px; }
  .prompt-zh { font-size: 21px; }
  .answer-word h2 { font-size: 30px; }
  .rate button { height: 58px; font-size: 14px; }
  .panel { padding: 16px; border-radius: 20px; }
}

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