/* ============================================================================
   词冲 WordRush 3500 — 样式表
   零依赖手写 CSS：设计令牌 → 基础 → 布局 → 组件 → 页面 → 响应式
   ========================================================================== */

/* ------------------------------------------------------------ 设计令牌 */
:root {
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-soft: #eef2ff;
  --brand-ink: #312e81;
  --accent: #0891b2;

  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --bad: #dc2626;
  --bad-soft: #fee2e2;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --gold: #eab308;

  --bg: #f5f6fa;
  --bg-2: #eceef5;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --line: #e4e6ef;
  --line-2: #d3d7e4;
  --ink: #14161f;
  --ink-2: #4a5060;
  /* 次要文字（hint / sub / 音标）也要满足 WCAG AA：
     #646b79 在 #f5f6fa 上约 5.0:1，#858b9c 只有 3.2:1，手机上看很吃力 */
  --ink-3: #646b79;

  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;
  --r-pill: 999px;

  --sh-1: 0 1px 2px rgba(16, 20, 40, .06), 0 1px 3px rgba(16, 20, 40, .04);
  --sh-2: 0 4px 12px rgba(16, 20, 40, .07), 0 1px 3px rgba(16, 20, 40, .05);
  --sh-3: 0 14px 38px rgba(16, 20, 40, .13), 0 4px 10px rgba(16, 20, 40, .06);
  --sh-brand: 0 8px 22px rgba(79, 70, 229, .28);

  --fs: 1;                       /* 字号缩放，设置里可调 */
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-en: "Iowan Old Style", "Palatino Linotype", Georgia, ui-serif, serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;

  --top-h: 62px;
  --tab-h: 0px;
  --maxw: 1080px;
  --ease: cubic-bezier(.22, .8, .28, 1);
}

[data-theme="dark"] {
  --brand: #818cf8;
  --brand-2: #a78bfa;
  --brand-soft: #232447;
  --brand-ink: #c7d2fe;
  --accent: #22d3ee;

  --ok: #4ade80;
  --ok-soft: #14351f;
  --bad: #f87171;
  --bad-soft: #3b1a1a;
  --warn: #fbbf24;
  --warn-soft: #3a2c0c;

  --bg: #0e1017;
  --bg-2: #12141d;
  --surface: #171a24;
  --surface-2: #1d2130;
  --line: #262b3a;
  --line-2: #343a4d;
  --ink: #eef0f6;
  --ink-2: #a9b0c2;
  /* 深色下同理：#7c8499 在 #0e1017 上约 5.1:1（原 #6f778c 只有 4.25:1） */
  --ink-3: #7c8499;

  --sh-1: 0 1px 2px rgba(0, 0, 0, .4);
  --sh-2: 0 4px 14px rgba(0, 0, 0, .45);
  --sh-3: 0 16px 44px rgba(0, 0, 0, .6);
  --sh-brand: 0 8px 24px rgba(0, 0, 0, .5);
}

/* ------------------------------------------------------------ 基础 */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: calc(16px * var(--fs));
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(900px 480px at 8% -8%, color-mix(in srgb, var(--brand) 11%, transparent), transparent 70%),
    radial-gradient(700px 420px at 96% 4%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%);
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.28; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 2.5px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

*::selection { background: color-mix(in srgb, var(--brand) 26%, transparent); }

/* 作者样式里的 display:grid/flex 会盖掉浏览器默认的 [hidden]，这里强制兜底 */
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }

/* ------------------------------------------------------------ 布局骨架 */
.app { min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--top-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 clamp(12px, 3vw, 26px);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand-mark {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 11px; font-weight: 800; font-size: .95rem; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: var(--sh-brand);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.02rem; letter-spacing: .01em; }
.brand-text small { font-size: .68rem; color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; }

.mainnav { display: flex; gap: 2px; margin-left: 8px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a {
  padding: 8px 14px; border-radius: var(--r-pill); font-size: .9rem; font-weight: 600;
  color: var(--ink-2); white-space: nowrap; transition: background .16s, color .16s;
}
.mainnav a:hover { background: var(--surface-2); color: var(--ink); }
.mainnav a.is-active { background: var(--brand-soft); color: var(--brand-ink); }
[data-theme="dark"] .mainnav a.is-active { color: var(--brand); }

.topbar-actions { display: flex; gap: 6px; flex: none; }
.iconbtn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: var(--r-sm); background: var(--surface-2);
  border: 1px solid var(--line); font-size: .74rem; font-weight: 800;
  letter-spacing: .04em; color: var(--ink-2);
  transition: transform .14s var(--ease), background .16s, color .16s;
}
.iconbtn:hover { background: var(--bg-2); color: var(--ink); transform: translateY(-1px); }
.iconbtn:active { transform: translateY(0) scale(.96); }

.view {
  flex: 1; width: 100%; max-width: var(--maxw);
  margin: 0 auto; padding: clamp(16px, 2.6vw, 28px) clamp(12px, 3vw, 26px);
  padding-bottom: calc(40px + var(--tab-h));
  outline: none;
  animation: viewIn .26s var(--ease);
}
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.tabbar { display: none; }

/* ------------------------------------------------------------ 通用组件 */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-1);
}
.card-pad { padding: clamp(16px, 2.4vw, 24px); }

.section { margin-top: 26px; }
.section:first-child { margin-top: 0; }
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.section-head h2 { font-size: 1.06rem; }
.section-head .sub { font-size: .82rem; color: var(--ink-3); margin-top: 2px; }

.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: clamp(1.4rem, 4vw, 1.9rem); }
.page-head .sub { color: var(--ink-2); font-size: .9rem; margin-top: 6px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 20px; border-radius: var(--r-pill);
  font-weight: 700; font-size: .91rem; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  transition: transform .14s var(--ease), box-shadow .16s, background .16s, border-color .16s, opacity .16s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--sh-2); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; border-color: transparent; box-shadow: var(--sh-brand);
}
.btn-ok { background: var(--ok); color: #fff; border-color: transparent; }
.btn-bad { background: var(--bad); color: #fff; border-color: transparent; }
.btn-warn { background: var(--warn); color: #fff; border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); box-shadow: none; }
.btn-sm { padding: 7px 13px; font-size: .82rem; }
.btn-lg { padding: 15px 30px; font-size: 1.02rem; }
.btn-block { width: 100%; }

/* 徽标 */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: .7rem; font-weight: 700; letter-spacing: .02em;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.badge-brand { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
[data-theme="dark"] .badge-brand { color: var(--brand); }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }

/* 表单 */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: .84rem; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: .76rem; color: var(--ink-3); line-height: 1.5; }

.input, .select, .textarea {
  width: 100%; padding: 10px 14px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line);
  transition: border-color .16s, box-shadow .16s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
.select { appearance: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: right 15px center, right 10px center;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.textarea { min-height: 130px; resize: vertical; font-family: var(--mono); font-size: .82rem; line-height: 1.6; }

/* 开关 */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.switch:last-child { border-bottom: 0; }
.switch-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.switch-text b { font-size: .9rem; font-weight: 600; }
.switch-text span { font-size: .77rem; color: var(--ink-3); line-height: 1.45; }
.toggle {
  flex: none; width: 46px; height: 27px; border-radius: 99px; position: relative;
  background: var(--line-2); transition: background .2s var(--ease);
}
.toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 21px; height: 21px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .22s var(--ease);
}
.toggle[aria-checked="true"] { background: var(--brand); }
.toggle[aria-checked="true"]::after { transform: translateX(19px); }

/* 分段控件 */
.segmented { display: inline-flex; padding: 3px; gap: 3px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); }
.segmented button {
  padding: 7px 15px; border-radius: var(--r-pill); font-size: .83rem; font-weight: 600;
  color: var(--ink-2); transition: background .16s, color .16s;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
.segmented button:hover:not([aria-pressed="true"]) { color: var(--ink); }

/* 进度条 */
.bar { height: 8px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .45s var(--ease); }
.bar.thin { height: 5px; }
.bar.ok > span { background: linear-gradient(90deg, var(--ok), #4ade80); }

/* 环形进度 */
.ring { position: relative; display: grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-linecap: round; }
.ring .track { stroke: var(--line); }
.ring .val { stroke: url(#ringgrad); transition: stroke-dasharray .6s var(--ease); }
.ring-label { position: absolute; display: grid; place-items: center; text-align: center; line-height: 1.1; }
.ring-label b { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
.ring-label small { font-size: .68rem; color: var(--ink-3); font-weight: 600; }

/* 空状态 */
.empty { text-align: center; padding: 54px 22px; color: var(--ink-3); }
.empty .emoji { font-size: 2.6rem; margin-bottom: 12px; }
.empty h3 { font-size: 1.02rem; color: var(--ink-2); margin-bottom: 6px; }
.empty p { font-size: .87rem; max-width: 40ch; margin: 0 auto; line-height: 1.7; }

/* 网格 */
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

/* 统计小卡 */
.stat { padding: 15px 17px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.stat b { display: block; font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.2; }
.stat span { font-size: .76rem; color: var(--ink-3); font-weight: 600; }
.stat.is-brand b { color: var(--brand); }
.stat.is-ok b { color: var(--ok); }
.stat.is-bad b { color: var(--bad); }
.stat.is-warn b { color: var(--warn); }

/* 表格 */
.table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 700; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { font-variant-numeric: tabular-nums; }

/* Toast */
.toaster { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  padding: 11px 20px; border-radius: var(--r-pill); font-size: .87rem; font-weight: 600;
  background: var(--ink); color: var(--bg); box-shadow: var(--sh-3);
  animation: toastIn .26s var(--ease);
}
[data-theme="dark"] .toast { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line-2); }
.toast.ok { background: var(--ok); color: #fff; }
.toast.bad { background: var(--bad); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.95); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------ 首页 */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-xl); padding: clamp(20px, 3.4vw, 32px);
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; box-shadow: var(--sh-brand);
  display: grid; gap: 22px; grid-template-columns: 1fr auto; align-items: center;
}
.hero::after {
  content: ""; position: absolute; right: -70px; top: -90px; width: 280px; height: 280px;
  border-radius: 50%; background: rgba(255, 255, 255, .13);
}
.hero::before {
  content: ""; position: absolute; right: 60px; bottom: -110px; width: 200px; height: 200px;
  border-radius: 50%; background: rgba(255, 255, 255, .08);
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(1.35rem, 4vw, 1.85rem); margin-bottom: 8px; }
.hero .lede { font-size: .9rem; opacity: .9; max-width: 46ch; line-height: 1.65; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.hero .btn { background: rgba(255, 255, 255, .17); color: #fff; border-color: rgba(255, 255, 255, .28); backdrop-filter: blur(6px); }
.hero .btn:hover { background: rgba(255, 255, 255, .26); }
.hero .btn-solid { background: #fff; color: var(--brand-ink); border-color: transparent; }
[data-theme="dark"] .hero .btn-solid { color: #312e81; }

.hero-dial { display: grid; place-items: center; gap: 4px; }
.hero-dial .ring .track { stroke: rgba(255, 255, 255, .25); }
.hero-dial .ring .val { stroke: #fff; }
.hero-dial .ring-label b { color: #fff; }
.hero-dial .ring-label small { color: rgba(255, 255, 255, .78); }

.book-grid { display: grid; gap: 13px; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.book-card {
  position: relative; display: flex; flex-direction: column; gap: 9px;
  padding: 17px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
  transition: transform .16s var(--ease), box-shadow .18s, border-color .18s;
  text-align: left; width: 100%;
}
.book-card:hover { transform: translateY(-3px); box-shadow: var(--sh-2); border-color: var(--line-2); }
.book-card.is-current { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }
.book-card h3 { font-size: .95rem; }
.book-card .desc { font-size: .79rem; color: var(--ink-3); line-height: 1.6; flex: 1; }
.book-card .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .74rem; color: var(--ink-3); }
.book-card .spark { display: flex; align-items: center; gap: 9px; }

.daybars { display: flex; align-items: flex-end; gap: 6px; height: 74px; }
.daybar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.daybar i {
  display: block; width: 100%; max-width: 34px; border-radius: 5px 5px 3px 3px;
  background: linear-gradient(180deg, var(--brand), color-mix(in srgb, var(--brand) 55%, var(--surface)));
  min-height: 3px; transition: height .5s var(--ease);
}
.daybar.is-today i { background: linear-gradient(180deg, var(--brand-2), var(--brand)); }
.daybar em { font-size: .63rem; font-style: normal; color: var(--ink-3); font-weight: 600; }

/* ------------------------------------------------------------ 练习页 */
.practice { max-width: 720px; margin: 0 auto; }
.practice-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.practice-bar .bar { flex: 1; }
.practice-bar .count { font-size: .8rem; color: var(--ink-3); font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }

/* 词卡 */
.wordcard {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xl); box-shadow: var(--sh-2);
  padding: clamp(22px, 4vw, 40px); text-align: center;
  animation: cardIn .3s var(--ease);
}
@keyframes cardIn { from { opacity: 0; transform: scale(.975) translateY(10px); } to { opacity: 1; transform: none; } }
.wordcard .pos { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); margin-bottom: 12px; }
.wordcard .word {
  font-family: var(--font-en); font-weight: 700;
  font-size: clamp(2.1rem, 8vw, 3.4rem); line-height: 1.1;
  letter-spacing: -.022em; word-break: break-word;
}
.wordcard .phon { margin-top: 10px; font-family: var(--mono); font-size: .98rem; color: var(--ink-3); }
.wordcard .speak-row { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.speak-btn {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-ink); font-size: 1.1rem;
  transition: transform .15s var(--ease), background .16s;
}
[data-theme="dark"] .speak-btn { color: var(--brand); }
.speak-btn:hover { transform: scale(1.08); }
.speak-btn:active { transform: scale(.94); }
.speak-btn.is-playing { animation: pulse .8s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 45%, transparent); } 50% { box-shadow: 0 0 0 12px transparent; } }

.reveal { margin-top: 26px; padding-top: 24px; border-top: 1px dashed var(--line-2); text-align: left; animation: revealIn .3s var(--ease); }
@keyframes revealIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.meaning { font-size: 1.12rem; line-height: 1.75; }
.meaning .pos-tag { display: inline-block; font-size: .74rem; font-weight: 800; color: var(--brand); margin-right: 5px; vertical-align: 1px; }

.detail-block { margin-top: 20px; }
.detail-block > h4 {
  font-size: .72rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 9px; font-weight: 800;
  display: flex; align-items: center; gap: 7px;
}
.detail-block > h4::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.sent { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; }
.sent:last-child { border-bottom: 0; padding-bottom: 0; }
.sent .txt { flex: 1; }
.sent .en { font-size: .92rem; line-height: 1.65; }
.sent .cn { font-size: .84rem; color: var(--ink-3); margin-top: 3px; }
.sent .play { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-3); font-size: .78rem; }
.sent .play:hover { background: var(--brand-soft); color: var(--brand-ink); }

.phrase-list { display: grid; gap: 7px; }
.phrase-list li { display: flex; gap: 12px; font-size: .88rem; padding: 7px 11px; border-radius: var(--r-xs); background: var(--surface-2); }
.phrase-list li b { font-family: var(--font-en); font-weight: 600; flex: none; }
.phrase-list li span { color: var(--ink-3); }

.syno-list { display: grid; gap: 8px; }
.syno-list li { font-size: .87rem; }
.syno-list .tag { font-size: .7rem; font-weight: 800; color: var(--brand); margin-right: 6px; }
.syno-list .hw { color: var(--ink-3); }
.syno-list .hw b { color: var(--accent); font-weight: 600; font-family: var(--font-en); }

.mnemonic { font-size: .87rem; line-height: 1.7; padding: 12px 15px; border-radius: var(--r-sm); background: var(--warn-soft); color: var(--ink-2); border-left: 3px solid var(--warn); }
[data-theme="dark"] .mnemonic { color: var(--ink-2); }

.hint-cover { font-family: var(--mono); letter-spacing: .34em; color: var(--ink-3); font-size: .95rem; }

/* 判定按钮组 */
.judge-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 26px; }
.judge-row .btn { flex-direction: column; gap: 3px; padding: 15px 10px; border-radius: var(--r-md); }
.judge-row .btn small { font-size: .68rem; font-weight: 600; opacity: .72; }

/* 选择题 */
.quiz-stem { text-align: center; margin-bottom: 24px; }
.quiz-stem .q { font-size: .8rem; color: var(--ink-3); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 12px; }
.quiz-stem .head { font-family: var(--font-en); font-size: clamp(1.7rem, 6vw, 2.6rem); font-weight: 700; line-height: 1.15; }
.quiz-stem .head.cn { font-family: var(--font); font-size: clamp(1.25rem, 4.5vw, 1.7rem); }
.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
  padding: 14px 17px; border-radius: var(--r-md);
  background: var(--surface); border: 1.5px solid var(--line);
  font-size: .95rem; transition: transform .13s var(--ease), border-color .16s, background .16s, box-shadow .16s;
}
.option:hover:not(:disabled) { border-color: var(--brand); transform: translateX(2px); box-shadow: var(--sh-1); }
.option .key {
  flex: none; width: 27px; height: 27px; border-radius: 8px; display: grid; place-items: center;
  background: var(--surface-2); font-size: .76rem; font-weight: 800; color: var(--ink-3);
}
.option .txt { flex: 1; min-width: 0; line-height: 1.5; }
.option.is-right { border-color: var(--ok); background: var(--ok-soft); }
.option.is-right .key { background: var(--ok); color: #fff; }
.option.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.option.is-wrong .key { background: var(--bad); color: #fff; }
.option:disabled { cursor: default; }

/* 拼写题 */
.spell-box { margin-top: 8px; }
.spell-input {
  width: 100%; text-align: center; font-family: var(--mono);
  font-size: clamp(1.3rem, 5.5vw, 1.9rem); letter-spacing: .1em;
  padding: 15px; border-radius: var(--r-md); background: var(--surface);
  border: 2px solid var(--line); transition: border-color .16s, box-shadow .16s;
}
.spell-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
.spell-input.is-right { border-color: var(--ok); background: var(--ok-soft); }
.spell-input.is-wrong { border-color: var(--bad); background: var(--bad-soft); animation: shake .38s var(--ease); }
.spell-mask { font-family: var(--mono); font-size: clamp(1.3rem, 5.5vw, 1.9rem); letter-spacing: .22em; color: var(--ink-3); text-align: center; padding: 15px; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }

/* 反馈条 */
.feedback { margin-top: 18px; padding: 14px 17px; border-radius: var(--r-md); font-size: .89rem; line-height: 1.65; animation: revealIn .24s var(--ease); }
.feedback.ok { background: var(--ok-soft); color: var(--ink-2); border-left: 3px solid var(--ok); }
.feedback.bad { background: var(--bad-soft); color: var(--ink-2); border-left: 3px solid var(--bad); }
.feedback b { color: var(--ink); }
.feedback .ans { font-family: var(--font-en); font-weight: 700; font-size: 1.05rem; }

/* ------------------------------------------------------------ 打字冲刺 */
.typing-stage { text-align: center; }
.type-target {
  font-family: var(--font-en); font-size: clamp(1.7rem, 6.5vw, 3rem);
  font-weight: 700; letter-spacing: .01em; line-height: 1.35;
  word-break: break-word; margin: 14px 0 6px;
}
.type-target .ch { position: relative; transition: color .1s; }
.type-target .ch.pending { color: var(--ink-3); }
.type-target .ch.done { color: var(--ok); }
.type-target .ch.bad { color: var(--bad); text-decoration: underline wavy var(--bad); }
.type-target .caret {
  display: inline-block; width: 2.5px; height: 1em; vertical-align: -.12em;
  background: var(--brand); margin: 0 -1px; animation: caret .95s steps(1) infinite; border-radius: 2px;
}
@keyframes caret { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.type-input {
  width: 100%; margin-top: 20px; padding: 15px 18px; border-radius: var(--r-md);
  font-family: var(--mono); font-size: 1.15rem; letter-spacing: .04em;
  background: var(--surface); border: 2px solid var(--line); text-align: center;
}
.type-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
.type-input.is-shake { animation: shake .3s var(--ease); }

.type-cn { font-size: 1.1rem; color: var(--ink-2); margin-top: 8px; }
.type-meter { display: flex; justify-content: center; gap: 22px; margin-top: 18px; flex-wrap: wrap; }
.type-meter div { text-align: center; }
.type-meter b { display: block; font-size: 1.28rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.type-meter span { font-size: .68rem; color: var(--ink-3); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }

.combo-pop {
  position: fixed; pointer-events: none; z-index: 80;
  font-size: 2rem; font-weight: 800; color: var(--brand);
  text-shadow: 0 2px 14px color-mix(in srgb, var(--brand) 45%, transparent);
  animation: comboUp .85s var(--ease) forwards;
}
@keyframes comboUp { from { opacity: 1; transform: translate(-50%, 0) scale(.7); } to { opacity: 0; transform: translate(-50%, -76px) scale(1.25); } }

/* ------------------------------------------------------------ 词库浏览 */
.browse-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.browse-tools .input { flex: 1; min-width: 190px; }
.letterbar { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 14px; }
.letterbar button {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: var(--r-xs);
  font-size: .77rem; font-weight: 700; color: var(--ink-3); transition: background .14s, color .14s;
}
.letterbar button:hover { background: var(--surface-2); color: var(--ink); }
.letterbar button.is-on { background: var(--brand); color: #fff; }

.wordlist { display: grid; gap: 6px; }
.wordrow {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
  padding: 11px 15px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color .15s, transform .13s var(--ease), box-shadow .15s;
}
.wordrow:hover { border-color: var(--brand); transform: translateX(3px); box-shadow: var(--sh-1); }
.wordrow .w { font-family: var(--font-en); font-weight: 700; font-size: 1rem; min-width: 8ch; }
.wordrow .ph { font-family: var(--mono); font-size: .76rem; color: var(--ink-3); flex: none; }
.wordrow .t { flex: 1; font-size: .84rem; color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wordrow .marks { display: flex; gap: 5px; flex: none; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.s0 { background: var(--line-2); }
.dot.s1 { background: var(--warn); }
.dot.s2 { background: var(--accent); }
.dot.s3 { background: var(--ok); }
.dot.star { background: var(--gold); }
.starbtn {
  width: 32px; height: 32px; display: grid; place-items: center;
  font-size: 1rem; color: var(--line-2); line-height: 1; border-radius: 50%;
  transition: transform .14s, color .14s, background .14s;
}
.starbtn:hover { transform: scale(1.14); background: var(--surface-2); }
.starbtn.on { color: var(--gold); }

.pager { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 20px; }
.pager .info { font-size: .82rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ 设置页 */
.settings-grid { display: grid; gap: 16px; }
.setting-row { display: flex; flex-direction: column; gap: 8px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row > .top { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.setting-row b { font-size: .9rem; font-weight: 600; }
.setting-row .hint { font-size: .77rem; color: var(--ink-3); line-height: 1.5; }
.range { width: 100%; accent-color: var(--brand); }
.range-val { font-size: .84rem; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }

.danger-zone { border-color: color-mix(in srgb, var(--bad) 38%, var(--line)); }

/* ------------------------------------------------------------ 全屏层 */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: var(--bg); overflow-y: auto;
  animation: overlayIn .22s var(--ease);
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.overlay-inner { max-width: 720px; margin: 0 auto; padding: clamp(16px, 3vw, 30px) clamp(12px, 3vw, 26px) 60px; }
.overlay-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.overlay-head h2 { font-size: 1.05rem; }

/* 结算页 */
.result-hero { text-align: center; padding: 34px 20px; }
.result-hero .big { font-size: 3.4rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; background: linear-gradient(135deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.result-hero .cap { font-size: .8rem; color: var(--ink-3); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-top: 8px; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 11px; margin-top: 26px; }
.result-list { display: grid; gap: 6px; max-height: 320px; overflow-y: auto; }
.result-list li { display: flex; align-items: center; gap: 11px; padding: 9px 13px; border-radius: var(--r-xs); background: var(--surface-2); font-size: .86rem; }
.result-list li .w { font-family: var(--font-en); font-weight: 700; min-width: 7ch; }
.result-list li .m { font-size: .78rem; color: var(--ink-3); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 模式选择卡 */
.mode-grid { display: grid; gap: 13px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.mode-card {
  display: flex; flex-direction: column; gap: 8px; padding: 19px;
  border-radius: var(--r-md); background: var(--surface); border: 1.5px solid var(--line);
  text-align: left; transition: transform .16s var(--ease), border-color .18s, box-shadow .18s;
}
.mode-card:hover { transform: translateY(-3px); border-color: var(--brand); box-shadow: var(--sh-2); }
.mode-card .ico { font-size: 1.6rem; }
.mode-card h3 { font-size: .97rem; }
.mode-card p { font-size: .79rem; color: var(--ink-3); line-height: 1.6; }

/* 图例 */
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .76rem; color: var(--ink-3); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

canvas.chart { width: 100%; display: block; }

/* ------------------------------------------------------------ 响应式 */
@media (max-width: 860px) {
  :root { --tab-h: 62px; }
  .mainnav { display: none; }
  .topbar { gap: 10px; }
  .brand-text small { display: none; }

  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    height: var(--tab-h); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: saturate(1.7) blur(16px);
    -webkit-backdrop-filter: saturate(1.7) blur(16px);
    border-top: 1px solid var(--line);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; font-size: .63rem; font-weight: 700; color: var(--ink-3);
  }
  .tabbar a .ico { font-size: 1.24rem; line-height: 1; }
  .tabbar a.is-active { color: var(--brand); }

  .hero { grid-template-columns: 1fr; text-align: left; }
  .hero-dial { justify-self: center; }
  .judge-row { gap: 8px; }
  .judge-row .btn { padding: 13px 6px; }
  .judge-row .btn small { display: none; }
  .wordrow .t { display: none; }
  .wordrow .ph { display: none; }
}

@media (max-width: 420px) {
  .brand-text { display: none; }
  .judge-row { grid-template-columns: 1fr; }
}

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

@media print {
  .topbar, .tabbar, .toaster, .overlay { display: none !important; }
  body { background: #fff; }
}
