/* 拾词 WordLoop · 样式 */
:root {
  --paper: #f6f4ef;
  --paper-2: #fffdf9;
  --ink: #1c1a17;
  --ink-2: #43403a;
  --muted: #8a847a;
  --line: rgba(28, 26, 23, 0.09);
  --line-2: rgba(28, 26, 23, 0.14);
  --accent: #0f6b5c;
  --accent-2: #0b5749;
  --accent-soft: #e4f1ed;
  --accent-ink: #0a4c40;
  --ok: #15803d;
  --ok-soft: #eaf7ee;
  --bad: #b3402a;
  --bad-soft: #fcf0ec;
  --gold: #b07a26;
  --gold-soft: #fbf1de;
  --radius: 24px;
  --shadow-sm: 0 1px 2px rgba(28, 26, 23, 0.05), 0 2px 8px -4px rgba(28, 26, 23, 0.08);
  --shadow: 0 1px 2px rgba(28, 26, 23, 0.04), 0 18px 44px -24px rgba(28, 26, 23, 0.28);
  --shadow-lg: 0 30px 80px -30px rgba(28, 26, 23, 0.45);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Songti SC", "Noto Serif SC", serif;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
button, .btn, .opt, .chip, .mode-chip, .goal-chip { touch-action: manipulation; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 6% -12%, #e7f2ee 0%, rgba(231, 242, 238, 0) 62%),
    radial-gradient(900px 480px at 106% -4%, #f7efdf 0%, rgba(247, 239, 223, 0) 58%),
    var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p { margin: 0; }
button { font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: 15px; color: var(--ink); }
code { font-family: "Cascadia Code", Consolas, monospace; font-size: 0.9em; background: rgba(28, 26, 23, 0.06); padding: 1px 6px; border-radius: 6px; }
[hidden] { display: none !important; }

::selection { background: #cde9e0; }

/* ---------- 布局 ---------- */
#app { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 30px 10px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.main {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 30px 72px;
}

/* ---------- 顶栏 ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, #14806d, #0b5749);
  color: #fff;
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1;
  box-shadow: 0 6px 14px -6px rgba(11, 87, 73, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 17px; letter-spacing: 0.06em; font-weight: 700; }
.brand-text i { font-style: normal; font-size: 10.5px; letter-spacing: 0.18em; color: var(--muted); text-transform: uppercase; }

.nav {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.7);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  margin-left: 8px;
}
.nav-btn {
  border: 0;
  background: none;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14.5px;
  color: var(--ink-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background 0.18s, color 0.18s;
}
.nav-btn:hover { background: rgba(28, 26, 23, 0.04); }
.nav-btn.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(28, 26, 23, 0.12); font-weight: 600; }
.nav-btn .badge {
  font-size: 11px;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(28, 26, 23, 0.07);
  color: var(--muted);
  font-weight: 500;
}
.nav-btn.active .badge { background: var(--accent-soft); color: var(--accent-ink); }

.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.streak {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid rgba(176, 122, 38, 0.18);
  padding: 6px 12px;
  border-radius: 999px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.8);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 17px;
  transition: 0.16s;
}
.icon-btn:hover { background: #fff; border-color: var(--line-2); transform: translateY(-1px); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 15px; }

/* ---------- 通用 ---------- */
.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.muted { color: var(--muted); font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  padding: 12px 22px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fff;
  color: var(--ink);
  transition: transform 0.12s, background 0.18s, box-shadow 0.18s, border-color 0.18s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, #127766, var(--accent));
  color: #fff;
  box-shadow: 0 8px 20px -10px rgba(15, 107, 92, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.btn.primary:hover { background: linear-gradient(180deg, #147f6d, var(--accent-2)); }
.btn.soft { background: #fff; border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.btn.soft:hover { border-color: rgba(15, 107, 92, 0.4); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: rgba(28, 26, 23, 0.05); }
.btn.lg { padding: 15px 30px; font-size: 16px; }
.btn.sm { padding: 8px 15px; font-size: 13.5px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font-size: 13.5px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(15, 107, 92, 0.3);
  text-underline-offset: 3px;
}
.link:hover { text-decoration-color: currentColor; }

/* ---------- 首页 ---------- */
.home { display: flex; flex-direction: column; gap: 22px; }

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 210px;
  gap: 30px;
  align-items: center;
  padding: 46px 48px;
  border-radius: 30px;
  overflow: hidden;
  background:
    radial-gradient(600px 260px at 88% 0%, rgba(228, 241, 237, 0.9), rgba(228, 241, 237, 0) 70%),
    linear-gradient(155deg, #fffdf8 0%, #f7fbf8 100%);
  border: 1px solid rgba(15, 107, 92, 0.1);
  box-shadow: var(--shadow);
}
.hero::before {
  content: "";
  position: absolute;
  right: -60px;
  bottom: -120px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(176, 122, 38, 0.1), rgba(176, 122, 38, 0) 70%);
  pointer-events: none;
}
.hero-main { position: relative; z-index: 1; }
.eyebrow {
  font-size: 12.5px;
  letter-spacing: 0.16em;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
}
.hero h1 {
  margin: 14px 0 0;
  font-size: clamp(30px, 4.2vw, 44px);
  line-height: 1.18;
  letter-spacing: -0.01em;
  font-weight: 700;
}
.hero h1 em {
  font-family: var(--serif);
  font-style: normal;
  color: var(--accent);
  font-size: 1.12em;
  padding: 0 2px;
}
.hero .lead { margin-top: 12px; color: var(--ink-2); font-size: 16px; line-height: 1.7; max-width: 46ch; }
.hero .row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.hero .hint { margin-top: 18px; font-size: 13px; color: var(--muted); letter-spacing: 0.02em; }
.hero .hint b { color: var(--ink-2); font-weight: 600; }

.goal-row { display: flex; align-items: center; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.goal-label { font-size: 12.5px; color: var(--muted); letter-spacing: 0.06em; }
.goal-chips { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(28, 26, 23, 0.05); }
.goal-chip {
  border: 0;
  background: none;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  cursor: pointer;
  transition: 0.15s;
}
.goal-chip:hover { background: rgba(255, 255, 255, 0.75); }
.goal-chip.active { background: #fff; color: var(--accent-ink); font-weight: 700; box-shadow: 0 1px 3px rgba(28, 26, 23, 0.14); }
.goal-unit { font-size: 12.5px; color: var(--muted); }

.mode-row { margin-top: 12px; }
.mode-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px 7px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.7);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: 0.16s;
}
.mode-chip:hover { border-color: rgba(15, 107, 92, 0.35); color: var(--ink-2); }
.mode-chip .tick {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(28, 26, 23, 0.07);
  color: transparent;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-style: normal;
  transition: 0.16s;
}
.mode-chip.on { background: #fff; border-color: rgba(15, 107, 92, 0.38); color: var(--accent-ink); font-weight: 600; box-shadow: var(--shadow-sm); }
.mode-chip.on .tick { background: var(--accent); color: #fff; }

.ring-wrap { position: relative; width: 160px; height: 160px; justify-self: center; }
.ring { width: 100%; height: 100%; display: block; }
.ring-bg { fill: none; stroke: rgba(15, 107, 92, 0.11); stroke-width: 9; }
.ring-fg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 9;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  pointer-events: none;
}
.ring-label strong { font-family: var(--serif); font-size: 38px; line-height: 1; font-weight: 600; color: var(--ink); }
.ring-label span { font-size: 12.5px; color: var(--muted); letter-spacing: 0.06em; }

.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-radius: 18px;
  background: rgba(255, 253, 249, 0.75);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.sc-ico {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.sc-ico svg { width: 20px; height: 20px; }
.sc-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sc-name { font-size: 13px; color: var(--muted); letter-spacing: 0.04em; }
.sc-val { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sc-val small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.sc-bar { height: 3px; border-radius: 99px; background: rgba(28, 26, 23, 0.07); overflow: hidden; margin-top: 3px; }
.sc-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

.duo { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; align-items: stretch; }

.panel { padding: 24px 26px; border-radius: 22px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.panel-head h3 { font-size: 15px; font-weight: 700; letter-spacing: 0.02em; }
.panel-head span { font-size: 12.5px; color: var(--muted); }

.bars { display: flex; align-items: flex-end; gap: 10px; height: 118px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 7px; height: 100%; }
.bar i {
  display: block;
  width: 100%;
  max-width: 42px;
  border-radius: 8px;
  background: rgba(15, 107, 92, 0.16);
  min-height: 5px;
  transition: height 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.bar.on i { background: linear-gradient(180deg, #2f9a85, var(--accent)); }
.bar span { font-size: 11.5px; color: var(--muted); }
.bar.today span { color: var(--accent-ink); font-weight: 700; }
.bars-empty {
  height: 118px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(28, 26, 23, 0.025);
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.recent-list { display: flex; flex-direction: column; gap: 2px; }
.recent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 8px;
  border-radius: 12px;
  cursor: pointer;
  border: 0;
  background: none;
  text-align: left;
  width: 100%;
}
.recent-row:hover { background: rgba(28, 26, 23, 0.035); }
.recent-row b { font-family: var(--serif); font-size: 16px; font-weight: 600; }
.recent-row span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-row em { margin-left: auto; font-style: normal; font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.tip-card {
  padding: 18px 22px;
  border-radius: 18px;
  background: rgba(176, 122, 38, 0.07);
  border: 1px solid rgba(176, 122, 38, 0.16);
  color: #6d4f1c;
  font-size: 13.5px;
  line-height: 1.7;
}
.tip-card b { color: #5a3f12; }

/* ---------- 词库 ---------- */
.lib { display: flex; flex-direction: column; gap: 18px; }
.lib-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.lib-head h2 { font-size: 26px; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; }
.lib-head h2 .count {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 3px 11px;
  font-variant-numeric: tabular-nums;
}
.lib-head p { margin-top: 7px; font-size: 13.5px; }
.lib-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 15px;
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.85);
  border: 1px solid var(--line);
  flex: 1;
  min-width: 220px;
  max-width: 380px;
  color: var(--muted);
}
.search svg { width: 16px; height: 16px; flex: none; }
.search input { border: 0; background: none; outline: none; width: 100%; font-size: 14.5px; color: var(--ink); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.6);
  color: var(--ink-2);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: 0.16s;
}
.chip:hover { border-color: var(--line-2); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.word-list { display: flex; flex-direction: column; gap: 8px; }
.word-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.1fr) minmax(160px, 1.6fr) 118px 96px;
  gap: 16px;
  align-items: center;
  padding: 15px 20px;
  border-radius: 18px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: 0.16s;
}
.word-row:hover { border-color: rgba(15, 107, 92, 0.24); box-shadow: 0 6px 22px -14px rgba(28, 26, 23, 0.3); }
.row-word { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.row-word b { font-family: var(--serif); font-size: 20px; font-weight: 600; letter-spacing: 0.01em; overflow: hidden; text-overflow: ellipsis; }
.row-word .phon { font-size: 12px; color: var(--muted); font-family: var(--serif); white-space: nowrap; }
.row-meaning { font-size: 14.5px; color: var(--ink-2); line-height: 1.55; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row-meaning.empty { color: #b9b2a6; font-style: italic; }
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status.new { background: #eef2f8; color: #3a5c86; }
.status.due { background: var(--gold-soft); color: var(--gold); }
.status.learning { background: var(--accent-soft); color: var(--accent-ink); }
.status.mastered { background: #eef2ee; color: #4c6b4f; }
.row-due { font-size: 12px; color: var(--muted); white-space: nowrap; }
.row-meta { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; min-width: 0; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.row-actions .icon-btn { width: 32px; height: 32px; border: 0; background: none; color: var(--muted); border-radius: 9px; }
.row-actions .icon-btn:hover { background: rgba(28, 26, 23, 0.06); color: var(--ink); }
.row-actions .icon-btn.danger:hover { background: var(--bad-soft); color: var(--bad); }

.empty-state {
  text-align: center;
  padding: 70px 24px;
  border-radius: var(--radius);
  border: 1px dashed var(--line-2);
  background: rgba(255, 253, 249, 0.5);
}
.empty-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 30px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(15, 107, 92, 0.14);
}
.empty-state h3 { font-size: 19px; font-weight: 700; }
.empty-state p { margin: 9px auto 22px; color: var(--muted); font-size: 14px; max-width: 42ch; line-height: 1.7; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- 训练 ---------- */
.session { max-width: 760px; margin: 0 auto; animation: fadeUp 0.35s cubic-bezier(0.22, 1, 0.36, 1); }
.shead { display: flex; align-items: center; gap: 16px; margin: 4px 0 16px; }
.shead .icon-btn { width: 36px; height: 36px; font-size: 15px; }
.sbar { flex: 1; height: 6px; border-radius: 99px; background: rgba(28, 26, 23, 0.08); overflow: hidden; }
.sbar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #2f9a85, var(--accent));
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.scount { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; font-weight: 600; }
.scount span { color: var(--muted); font-weight: 400; }

.steps { display: flex; align-items: center; gap: 8px; margin: 0 0 20px; padding-left: 52px; }
.step {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--muted);
  padding: 5px 11px 5px 5px;
  border-radius: 999px;
  transition: 0.2s;
}
.step i {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10.5px;
  font-style: normal;
  background: rgba(28, 26, 23, 0.07);
  color: var(--muted);
}
.step.now { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.step.now i { background: var(--accent); color: #fff; }
.step.done { color: var(--accent); }
.step.done i { background: rgba(15, 107, 92, 0.14); color: var(--accent); }

.stage {
  padding: 38px 42px 34px;
  border-radius: 28px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  animation: cardIn 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.mode-tag {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 26px;
}
.mode-tag i {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-style: normal;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0;
}
.mode-tag i svg { width: 13px; height: 13px; }

.prompt .word {
  font-family: var(--serif);
  font-size: clamp(38px, 6.4vw, 58px);
  line-height: 1.08;
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.prompt .phon { margin-top: 10px; font-family: var(--serif); font-size: 16px; color: var(--muted); letter-spacing: 0.02em; }
.prompt .meaning { margin-top: 14px; font-size: 15.5px; color: var(--ink-2); line-height: 1.6; }

.audio-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: 0.16s;
  flex: none;
}
.audio-btn:hover { background: var(--accent-soft); border-color: transparent; }
.audio-btn svg { width: 19px; height: 19px; }
.audio-btn.playing { background: var(--accent); color: #fff; border-color: transparent; animation: softPulse 1.4s ease-in-out infinite; }

.options { display: flex; flex-direction: column; gap: 10px; margin-top: 30px; }
.opt {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  padding: 15px 18px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 16px;
  line-height: 1.45;
  cursor: pointer;
  transition: 0.15s;
  color: var(--ink);
}
.opt:hover:not([disabled]) { border-color: rgba(15, 107, 92, 0.4); background: #f6fbf9; transform: translateY(-1px); }
.opt .key {
  width: 27px;
  height: 27px;
  flex: none;
  border-radius: 8px;
  background: #f4f2ec;
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.opt .opt-text { flex: 1; min-width: 0; }
.opt[disabled] { cursor: default; }
.opt.correct { border-color: #8fd0ac; background: var(--ok-soft); }
.opt.correct .key { background: var(--ok); color: #fff; }
.opt.wrong { border-color: #e8ab9c; background: var(--bad-soft); animation: shake 0.4s; }
.opt.wrong .key { background: var(--bad); color: #fff; }

.feedback { margin-top: 22px; min-height: 30px; font-size: 14.5px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; line-height: 1.5; }
.feedback.ok { color: var(--ok); }
.feedback.bad { color: var(--bad); }
.feedback .btn { padding: 8px 17px; font-size: 13.5px; }
.feedback .fb-answer { color: var(--ink-2); }

.kbd-hint { text-align: center; margin-top: 16px; font-size: 12px; color: #b0a99d; letter-spacing: 0.03em; }

/* 听音 */
.listen-stage { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0 4px; }
.speaker {
  position: relative;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 0;
  background: radial-gradient(circle at 34% 28%, #f2faf7, var(--accent-soft));
  color: var(--accent);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: 0.2s;
  box-shadow: 0 14px 34px -18px rgba(15, 107, 92, 0.8), inset 0 0 0 1px rgba(15, 107, 92, 0.12);
}
.speaker svg { width: 40px; height: 40px; }
.speaker:hover { transform: scale(1.03); }
.speaker.playing { animation: ringWave 1.5s ease-out infinite; }
.listen-tip { margin-top: 18px; color: var(--ink-2); font-size: 15px; }
.sub-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.sub-actions .link { color: var(--muted); font-size: 13px; text-decoration: none; padding: 4px 8px; border-radius: 8px; }
.sub-actions .link:hover { color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.sub-actions .link + .link { position: relative; }
.sub-actions .link + .link::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 50%;
  width: 3px;
  height: 3px;
  margin-top: -1.5px;
  border-radius: 50%;
  background: var(--line-2);
}

.answer-form { display: flex; gap: 10px; margin-top: 26px; }
.answer-form input {
  flex: 1;
  min-width: 0;
  padding: 15px 20px;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: #fff;
  font-size: 18px;
  font-family: var(--serif);
  letter-spacing: 0.02em;
  outline: none;
  transition: 0.16s;
}
.answer-form input::placeholder { font-family: var(--sans); font-size: 15px; color: #bbb4a8; letter-spacing: 0; }
.answer-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(15, 107, 92, 0.1); }
.hint-slot { margin-top: 12px; font-size: 13px; color: var(--gold); min-height: 20px; letter-spacing: 0.02em; }
.reveal {
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: 16px;
  background: #fbf9f4;
  border: 1px solid var(--line);
}
.reveal .word { font-family: var(--serif); font-size: 26px; display: flex; align-items: center; gap: 12px; }
.reveal .phon { color: var(--muted); font-size: 13.5px; margin-top: 4px; font-family: var(--serif); }
.reveal .meaning { margin-top: 8px; font-size: 14.5px; color: var(--ink-2); }

/* 跟读 */
.mic-stage { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 34px; }
.mic {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 0;
  background: radial-gradient(circle at 34% 28%, #f2faf7, var(--accent-soft));
  color: var(--accent);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: 0.2s;
  box-shadow: 0 14px 34px -18px rgba(15, 107, 92, 0.8), inset 0 0 0 1px rgba(15, 107, 92, 0.12);
}
.mic svg { width: 34px; height: 34px; }
.mic:hover { color: var(--accent-ink); transform: scale(1.03); }
.mic.listening { background: var(--bad); color: #fff; animation: micPulse 1.3s ease-out infinite; }
.mic[disabled] { opacity: 0.4; cursor: not-allowed; }
.mic-tip { font-size: 13.5px; color: var(--muted); text-align: center; }
.heard { margin-top: 20px; min-height: 26px; text-align: center; font-size: 14.5px; color: var(--ink-2); }
.heard b { font-family: var(--serif); font-size: 18px; color: var(--ink); }
.heard .score { color: var(--accent); font-weight: 700; }
.wave { display: inline-flex; align-items: flex-end; gap: 3px; height: 16px; }
.wave i { width: 3px; background: var(--accent); border-radius: 2px; animation: wave 0.9s ease-in-out infinite; }
.wave i:nth-child(1) { height: 7px; animation-delay: 0ms; }
.wave i:nth-child(2) { height: 14px; animation-delay: 120ms; }
.wave i:nth-child(3) { height: 9px; animation-delay: 240ms; }
.wave i:nth-child(4) { height: 12px; animation-delay: 360ms; }

.selfcheck { display: flex; gap: 10px; margin-top: 26px; flex-wrap: wrap; }
.selfcheck .btn { flex: 0 1 auto; min-width: 132px; }

/* 录音对比 */
.rec-tools { margin-top: 18px; }
.rec-btn {
  width: 100%;
  border: 1px dashed var(--line-2);
  background: rgba(255, 253, 249, 0.7);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13.5px;
  color: var(--ink-2);
  cursor: pointer;
  transition: 0.16s;
}
.rec-btn:hover { border-color: var(--accent); color: var(--accent-ink); background: #fff; }
.rec-btn:disabled { opacity: 0.6; cursor: default; }
.rec-out { margin-top: 12px; }
.rec-audio { width: 100%; height: 40px; }
.rec-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* 语音体检 */
.vc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.vc-row:last-child { border-bottom: 0; }
.vc-row > .vc-name { flex: 1; min-width: 0; }
.vc-name { font-size: 14px; line-height: 1.5; }
.vc-name small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.vc-state {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  flex: none;
}
.vc-state.ok { background: var(--ok-soft); color: var(--ok); }
.vc-state.bad { background: var(--bad-soft); color: var(--bad); }
.vc-state.idle { background: rgba(28, 26, 23, 0.06); color: var(--muted); }

/* 小结 */
.recap { display: flex; flex-direction: column; }
.recap .word { font-family: var(--serif); font-size: clamp(34px, 5.6vw, 50px); line-height: 1.1; }
.recap .phon { font-family: var(--serif); color: var(--muted); margin-top: 8px; font-size: 15px; }
.recap .meaning { margin-top: 14px; font-size: 18px; color: var(--ink-2); line-height: 1.6; }
.score-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 26px; }
.score-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid var(--line);
  color: var(--ink-2);
  background: #fff;
}
.score-chip i { width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 10px; color: #fff; }
.score-chip.good i { background: var(--ok); }
.score-chip.half i { background: var(--gold); }
.score-chip.bad i { background: var(--bad); }
.next-due { margin-top: 22px; font-size: 13.5px; color: var(--muted); }
.next-due b { color: var(--ink-2); font-weight: 600; }
.recap .btn { align-self: flex-start; margin-top: 26px; }

/* ---------- 完成页 ---------- */
.done-wrap { max-width: 640px; margin: 20px auto 0; text-align: center; animation: fadeUp 0.4s; }
.done-card { padding: 52px 44px; border-radius: 30px; }
.big-check {
  width: 84px;
  height: 84px;
  margin: 0 auto 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: 0 0 0 10px rgba(15, 107, 92, 0.06);
  animation: popIn 0.5s cubic-bezier(0.22, 1.4, 0.36, 1);
}
.big-check svg { width: 38px; height: 38px; }
.done-card h2 { font-size: 27px; letter-spacing: -0.01em; }
.done-card .done-sub { margin-top: 10px; color: var(--muted); font-size: 14.5px; line-height: 1.7; }
.done-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 32px 0 8px; }
.done-stat { padding: 16px 10px; border-radius: 16px; background: #faf8f3; border: 1px solid var(--line); }
.done-stat b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.done-stat span { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.done-actions { display: flex; gap: 10px; justify-content: center; margin-top: 30px; flex-wrap: wrap; }
.done-tail { margin-top: 26px; font-size: 13px; color: var(--muted); }

.ss-list { text-align: left; margin-top: 26px; display: flex; flex-direction: column; gap: 1px; max-height: 260px; overflow: auto; }
.ss-row { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; font-size: 14px; }
.ss-row:nth-child(odd) { background: rgba(28, 26, 23, 0.025); }
.ss-row b { font-family: var(--serif); font-size: 16px; font-weight: 600; }
.ss-row .ss-dots { margin-left: auto; display: flex; gap: 4px; }
.ss-row .ss-dots i { width: 8px; height: 8px; border-radius: 50%; background: #ded9cf; }
.ss-row .ss-dots i.good { background: var(--ok); }
.ss-row .ss-dots i.half { background: var(--gold); }
.ss-row .ss-dots i.bad { background: var(--bad); }

/* ---------- 弹窗 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(28, 26, 23, 0.38);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.18s;
}
.modal {
  width: min(560px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: var(--paper-2);
  border-radius: 24px;
  padding: 28px 30px;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.modal h3 { font-size: 20px; letter-spacing: -0.01em; }
.modal .modal-sub { margin-top: 8px; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; }
.modal-foot .right { display: flex; gap: 9px; margin-left: auto; }

.field { display: block; margin-top: 18px; }
.field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 7px; letter-spacing: 0.03em; }
.field input,
.field textarea,
.modal textarea,
.modal select {
  width: 100%;
  padding: 12px 15px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: #fff;
  outline: none;
  transition: 0.16s;
  font-size: 15px;
  line-height: 1.6;
  resize: vertical;
}
.field input:focus,
.field textarea:focus,
.modal textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(15, 107, 92, 0.09); }
.field input[type="range"] { padding: 0; border: 0; box-shadow: none; accent-color: var(--accent); }
.modal textarea { font-family: var(--serif); font-size: 16px; min-height: 170px; }

.set-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row .set-label { font-size: 14.5px; }
.set-row .set-label small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.set-row .mode-chips { max-width: 300px; gap: 6px; justify-content: flex-end; }
.set-row .mode-chip { padding: 6px 11px 6px 7px; font-size: 12.5px; }
.stepper { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: #fff; }
.stepper button { width: 34px; height: 34px; border: 0; background: none; cursor: pointer; font-size: 17px; color: var(--ink-2); }
.stepper button:hover { background: rgba(28, 26, 23, 0.05); }
.stepper span { min-width: 38px; text-align: center; font-size: 14.5px; font-variant-numeric: tabular-nums; font-weight: 600; }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(28, 26, 23, 0.16);
  transition: 0.2s;
  pointer-events: none;
}
.switch i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: 0.2s;
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); }

.set-select { max-width: 260px; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 16px);
  background: #221f1a;
  color: #fff;
  font-size: 13.5px;
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s, transform 0.24s;
  z-index: 90;
  max-width: min(90vw, 520px);
  text-align: center;
  line-height: 1.5;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 动画 ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px) scale(0.995); }
  to { opacity: 1; transform: none; }
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
@keyframes softPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(15, 107, 92, 0.3); }
  50% { box-shadow: 0 0 0 8px rgba(15, 107, 92, 0); }
}
@keyframes ringWave {
  0% { box-shadow: 0 14px 34px -18px rgba(15, 107, 92, 0.8), 0 0 0 0 rgba(15, 107, 92, 0.22); }
  70% { box-shadow: 0 14px 34px -18px rgba(15, 107, 92, 0.8), 0 0 0 22px rgba(15, 107, 92, 0); }
  100% { box-shadow: 0 14px 34px -18px rgba(15, 107, 92, 0.8), 0 0 0 0 rgba(15, 107, 92, 0); }
}
@keyframes micPulse {
  0% { box-shadow: 0 0 0 0 rgba(179, 64, 42, 0.32); }
  70% { box-shadow: 0 0 0 24px rgba(179, 64, 42, 0); }
  100% { box-shadow: 0 0 0 0 rgba(179, 64, 42, 0); }
}
@keyframes wave {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1); }
}

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

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 34px 30px; gap: 24px; }
  .ring-wrap { justify-self: start; width: 120px; height: 120px; }
  .ring-label strong { font-size: 28px; }
  .duo { grid-template-columns: 1fr; }
  .mode-grid { grid-template-columns: 1fr; }
  .word-row { grid-template-columns: 1fr auto; grid-template-areas: "word meta" "meaning meaning" "actions actions"; row-gap: 10px; }
  .row-word { grid-area: word; }
  .row-meaning { grid-area: meaning; }
  .row-meta { grid-area: meta; align-items: flex-end; }
  .row-actions { grid-area: actions; justify-content: flex-start; }
}

@media (max-width: 640px) {
  .topbar { padding: max(14px, env(safe-area-inset-top)) 16px 8px; gap: 10px; }
  .main { padding: 8px 16px calc(56px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
  .brand-mark { width: 34px; height: 34px; font-size: 18px; }
  .brand-text b { font-size: 15px; white-space: nowrap; }
  .brand-text i { display: none; }
  .nav { margin-left: 0; flex: none; }
  .nav-btn { padding: 7px 10px; font-size: 13px; white-space: nowrap; }
  .nav-btn .badge { display: none; }
  .top-right { gap: 8px; }
  .streak { padding: 5px 9px; font-size: 12.5px; white-space: nowrap; }
  .goal-row { gap: 8px; margin-top: 18px; }
  .goal-chip { padding: 5px 10px; }
  .goal-unit { display: none; }
  .mode-row { margin-top: 10px; }
  .mode-chips { gap: 6px; }
  .mode-chip { padding: 6px 10px 6px 7px; font-size: 12.5px; }
  .hero { padding: 28px 22px; border-radius: 24px; }
  .hero .row .btn { width: 100%; }
  .stage { padding: 28px 22px 26px; min-height: 380px; border-radius: 22px; }
  .steps { padding-left: 0; }
  .step { padding: 4px 8px 4px 4px; font-size: 11.5px; }
  .answer-form { flex-direction: column; }
  .answer-form .btn { width: 100%; }
  .recap .btn { align-self: stretch; }
  .modal { padding: 24px 20px; }
  .done-card { padding: 38px 22px; }
  .done-stats { gap: 8px; }
  .done-stat b { font-size: 20px; }
  .lib-head h2 { font-size: 22px; }
  .search { max-width: none; }
}
