/* ============ 四级词汇 · 记忆卡 ============ */

:root {
  --bg: #f7f4ed;
  --bg-2: #efe9dc;
  --card: #ffffff;
  --ink: #1c1a16;
  --ink-2: #4f4a42;
  --muted: #8c8579;
  --line: #e9e3d6;
  --accent: #17624f;
  --accent-2: #1f8a6e;
  --accent-soft: #e3f0ea;
  --red: #a8433a;
  --red-soft: #fbeceb;
  --amber: #8f6318;
  --amber-soft: #faf1de;
  --green: #2c6b45;
  --green-soft: #e8f4ec;
  --shadow-sm: 0 1px 2px rgba(40, 32, 18, 0.05), 0 6px 18px -10px rgba(40, 32, 18, 0.25);
  --shadow-md: 0 2px 6px rgba(40, 32, 18, 0.06), 0 18px 40px -18px rgba(40, 32, 18, 0.35);
  --f-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --f-word: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Songti SC", "Noto Serif CJK SC", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131211;
    --bg-2: #171614;
    --card: #1d1b18;
    --ink: #f1ede4;
    --ink-2: #c6bfb3;
    --muted: #8b8377;
    --line: #2e2a24;
    --accent: #63d1af;
    --accent-2: #35a987;
    --accent-soft: #1a2c26;
    --red: #e08b82;
    --red-soft: #2c1a18;
    --amber: #dcae62;
    --amber-soft: #2b2213;
    --green: #74c79b;
    --green-soft: #16241c;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px -10px rgba(0, 0, 0, 0.7);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.45), 0 18px 40px -18px rgba(0, 0, 0, 0.8);
  }
  #ringGrad stop:first-child { stop-color: #5fd3b0; }
  #ringGrad stop:last-child { stop-color: #2f9d7d; }
}

/* 暗色下需要覆盖基础样式的部分，放在文件末尾保证优先级 */


* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background-image:
    radial-gradient(1100px 600px at 50% -18%, rgba(31, 138, 110, 0.09), transparent 62%),
    radial-gradient(700px 420px at 100% 100%, rgba(200, 140, 60, 0.07), transparent 60%);
  background-attachment: fixed;
  overscroll-behavior-y: none;
}

button, input { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; touch-action: manipulation; }
h1, h2, h3, p { margin: 0; }

.app {
  position: relative;
  max-width: 460px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(14px, env(safe-area-inset-top)) 18px calc(22px + env(safe-area-inset-bottom));
}


/* ---------- 登录页 ---------- */
.auth {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: var(--bg);
  background-image: radial-gradient(900px 520px at 50% -12%, rgba(31, 138, 110, 0.12), transparent 62%);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: max(28px, env(safe-area-inset-top)) 20px calc(28px + env(safe-area-inset-bottom));
}
.auth-inner {
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100dvh - 56px);
}
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-logo {
  width: 58px; height: 58px;
  margin: 0 auto 14px;
  border-radius: 18px;
  display: grid; place-items: center;
  font-family: var(--f-word);
  font-size: 28px;
  color: #f7fbf8;
  background: linear-gradient(160deg, var(--accent-2), var(--accent));
  box-shadow: 0 16px 34px -16px rgba(23, 98, 79, 0.75);
}
.auth-head h1 { font-size: 21px; font-weight: 700; letter-spacing: 0.2px; }
.auth-sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px 18px 16px;
  box-shadow: var(--shadow-md);
}
.field { display: block; margin-bottom: 13px; }
.field-label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 6px; letter-spacing: 0.3px; }
.field input {
  width: 100%;
  height: 48px;
  border-radius: 13px;
  border: 1.5px solid var(--line);
  background: var(--bg);
  padding: 0 14px;
  font-size: 16px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-pass { position: relative; display: block; }
.field-pass input { padding-right: 60px; }
.eye {
  position: absolute;
  right: 5px; top: 50%;
  transform: translateY(-50%);
  height: 36px;
  padding: 0 11px;
  font-size: 12px;
  color: var(--muted);
  border-radius: 9px;
}
.eye:active { background: var(--accent-soft); color: var(--accent); }
.auth-msg { min-height: 17px; font-size: 12.5px; margin: 0 0 10px; color: var(--muted); }
.auth-msg.is-bad { color: var(--red); }
.auth-msg.is-ok { color: var(--green); }
.auth-alt { text-align: center; font-size: 13px; color: var(--muted); margin-top: 14px; }
.auth-alt button { color: var(--accent); font-weight: 600; padding: 4px 2px; }
.auth-accounts { margin-top: 20px; }
.auth-accounts-title { font-size: 11.5px; color: var(--muted); margin-bottom: 8px; letter-spacing: 0.3px; }
.account-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.account-chip {
  height: 36px;
  padding: 0 15px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
}
.account-chip:active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.auth-tip { text-align: center; font-size: 11px; color: var(--muted); line-height: 1.8; margin-top: 22px; }

.acct-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 5px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.sheet-btn-row { display: flex; gap: 8px; margin-top: 6px; }
.sheet-btn-row .btn { flex: 1; }
.pwd-form { margin-top: 4px; }

/* ---------- 启动遮罩 ---------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  transition: opacity 0.35s ease, visibility 0.35s;
}
.boot.is-off { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-ico {
  width: 62px; height: 62px;
  border-radius: 20px;
  display: grid; place-items: center;
  font-family: var(--f-word);
  font-size: 30px;
  color: #f7fbf8;
  background: linear-gradient(160deg, var(--accent-2), var(--accent));
  box-shadow: 0 16px 34px -16px rgba(23, 98, 79, 0.8);
  animation: bootPulse 1.6s ease-in-out infinite;
}
@keyframes bootPulse { 50% { transform: translateY(-3px) scale(1.02); } }
.boot-txt { font-size: 12.5px; color: var(--muted); letter-spacing: 0.4px; }


/* ---------- 限时速记 ---------- */
.cram-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 12px;
  border-radius: 18px;
  text-align: left;
  background: linear-gradient(140deg, var(--accent-soft), var(--card) 70%);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  box-shadow: var(--shadow-sm);
  transition: transform 0.14s ease;
}
.cram-entry:active { transform: scale(0.98); }
.cram-entry-ico {
  width: 38px; height: 38px;
  flex: none;
  border-radius: 12px;
  display: grid; place-items: center;
  color: var(--accent);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.cram-entry-ico svg { width: 19px; height: 19px; }
.cram-entry-txt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.cram-entry-txt b { font-size: 14.5px; font-weight: 650; }
.cram-entry-txt span { font-size: 11.5px; color: var(--muted); }
.cram-entry-go { color: var(--muted); font-size: 20px; line-height: 1; }

.cram-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.cram-clock {
  flex: 1;
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.cram-clock.is-low { color: var(--red); }
.cram-count { font-size: 12px; color: var(--muted); min-width: 44px; text-align: right; }
.cram-progress { margin-bottom: 10px; }
.cram-tip { font-size: 11.5px; color: var(--muted); text-align: center; margin-bottom: 8px; }

.cram-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px;
}
.cram-list { display: flex; flex-direction: column; }
.cram-row {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}
.cram-i {
  width: 26px;
  flex: none;
  text-align: right;
  font-size: 10.5px;
  color: var(--muted);
  padding-top: 5px;
  font-variant-numeric: tabular-nums;
}
.cram-main { flex: 1; min-width: 0; }
.cram-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cram-word { font-family: var(--f-word); font-size: 17.5px; font-weight: 600; letter-spacing: -0.1px; }
.cram-phon { font-size: 11px; color: var(--muted); }
.cram-def { font-size: 12.5px; color: var(--ink-2); margin-top: 1px; line-height: 1.5; }

.cram-foot { padding-top: 12px; }

.cram-opts { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 16px; }
.cram-opt {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: transform 0.14s;
}
.cram-opt:active { transform: scale(0.98); }
.cram-opt b {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  min-width: 38px;
}
.cram-opt span { font-size: 12.5px; color: var(--muted); }

/* ---------- 视图 ---------- */
.view {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  animation: viewIn 0.26s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.view.is-active { display: flex; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  margin-bottom: 18px;
}
.topbar h1 {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.2px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.3px;
  flex: 1;
  min-width: 0;
}
.brand .dot {
  width: 9px; height: 9px; border-radius: 3px;
  background: linear-gradient(150deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.brand .count {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.04);
}
@media (prefers-color-scheme: dark) { .brand .count { background: rgba(255,255,255,0.07); } }

.top-actions { display: flex; align-items: center; gap: 8px; }

.streak {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 650;
  color: var(--amber);
  padding: 6px 10px 6px 8px;
  border-radius: 999px;
  background: var(--amber-soft);
  font-variant-numeric: tabular-nums;
}
.streak svg { width: 14px; height: 14px; }
.streak.is-cold { color: var(--muted); background: rgba(0, 0, 0, 0.04); }
@media (prefers-color-scheme: dark) { .streak.is-cold { background: rgba(255,255,255,0.06); } }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: var(--ink-2);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, background 0.2s;
}
.icon-btn:active { transform: scale(0.93); }
.icon-btn svg { width: 19px; height: 19px; }

.back-btn { font-size: 22px; line-height: 1; padding-bottom: 3px; }

/* ---------- 今日卡片 ---------- */
.hero {
  background: var(--card);
  border-radius: 26px;
  padding: 20px 20px 18px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  right: -60px; top: -80px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 68%);
  pointer-events: none;
}
.hero-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.hero-head > div:first-child { min-width: 0; }
.hero-label { font-size: 12px; color: var(--muted); letter-spacing: 0.3px; margin-bottom: 3px; }
.hero-title { font-size: 19px; font-weight: 680; letter-spacing: 0.2px; }
.hero-badge {
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
  font-weight: 550;
}

.hero-body {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 14px 0 16px;
}
.ring-wrap { position: relative; width: 132px; height: 132px; flex: none; }
.ring { width: 132px; height: 132px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9.5; stroke-linecap: round; }
.ring-bg { stroke: var(--line); }
.ring-fg {
  stroke: url(#ringGrad);
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 0.7s cubic-bezier(0.2, 0.8, 0.25, 1);
}
.ring-text {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
}
.ring-num { font-size: 27px; font-weight: 700; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.ring-total { font-size: 14px; font-weight: 500; color: var(--muted); }
.ring-cap { font-size: 10.5px; color: var(--muted); letter-spacing: 0.6px; }

.hero-side { flex: 1; display: flex; flex-direction: column; gap: 9px; }
.mini {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 7px 11px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.025);
  font-size: 12px;
  color: var(--muted);
}
@media (prefers-color-scheme: dark) { .mini { background: rgba(255,255,255,0.04); } }
.mini b { font-size: 15px; color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 50px;
  padding: 0 20px;
  border-radius: 15px;
  font-size: 15.5px;
  font-weight: 620;
  letter-spacing: 0.2px;
  transition: transform 0.14s ease, opacity 0.2s, background 0.2s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.975); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn-block { display: flex; width: 100%; }
.btn-primary {
  color: #f7fbf8;
  background: linear-gradient(160deg, var(--accent-2), var(--accent));
  box-shadow: 0 10px 22px -12px rgba(23, 98, 79, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.btn-ghost {
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line);
}
.btn-soft { color: var(--accent); background: var(--accent-soft); }
.btn-sm { height: 40px; padding: 0 14px; font-size: 13.5px; border-radius: 12px; }
.btn svg { width: 18px; height: 18px; }

/* ---------- 四宫格 ---------- */
.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}
.tile {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 15px 14px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: transform 0.14s ease;
  position: relative;
}
.tile:active { transform: scale(0.975); }
.tile-ico {
  width: 36px; height: 36px;
  border-radius: 11px;
  display: grid; place-items: center;
  flex: none;
  background: var(--accent-soft);
  color: var(--accent);
}
.tile-ico svg { width: 18px; height: 18px; }
.tile-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tile-txt b { font-size: 13.5px; font-weight: 620; }
.tile-txt span { font-size: 11px; color: var(--muted); }
.tile em {
  position: absolute;
  top: 10px; right: 10px;
  font-style: normal;
  font-size: 10.5px;
  font-weight: 650;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 7px;
  min-width: 20px;
  text-align: center;
}
.tile em:empty { display: none; }

/* ---------- 面板 / 图表 ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px 18px 12px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 620; margin-bottom: 12px;
}
.panel-head .muted { font-size: 11.5px; font-weight: 500; }
.muted { color: var(--muted); }

.chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 74px;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; min-height: 0; }
.bar {
  width: 100%;
  max-width: 26px;
  border-radius: 6px 6px 4px 4px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  opacity: 0.28;
  min-height: 4px;
  transition: height 0.6s cubic-bezier(0.2, 0.8, 0.25, 1), opacity 0.3s;
}
.bar.is-on { opacity: 1; }
.bar.is-today { box-shadow: 0 0 0 2px var(--accent-soft); }
.bar-day { font-size: 10px; color: var(--muted); }
.bar-day.is-today { color: var(--accent); font-weight: 650; }

.footnote {
  margin-top: auto;
  padding-top: 16px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
}

/* ---------- 闪卡 ---------- */
.learn-top { margin-bottom: 14px; }
.progress {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 0.35s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.counter { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }

.card-stage {
  perspective: 1500px;
  height: clamp(320px, 58dvh, 520px);
  margin-bottom: 16px;
  display: flex;
}
.flashcard {
  position: relative;
  flex: 1;
  min-width: 0;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.2, 0.85, 0.3, 1);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.flashcard.is-flipped { transform: rotateY(180deg); }
.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 26px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 24px 22px;
}
.face.front { justify-content: center; align-items: center; gap: 6px; }
.face.back { transform: rotateY(180deg); justify-content: center; gap: 8px; padding-bottom: 46px; }
.face::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(600px 240px at 50% -8%, var(--accent-soft), transparent 70%);
  opacity: 0.85;
  pointer-events: none;
}
.face > * { position: relative; }

.speaker {
  position: absolute;
  top: 16px; right: 16px;
  width: 40px; height: 40px;
  border-radius: 13px;
  display: grid; place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  transition: transform 0.15s ease;
  z-index: 3;
}
.speaker:active { transform: scale(0.9); }
.speaker svg { width: 19px; height: 19px; }
.speaker.is-playing { animation: pulse 0.9s ease infinite; }
@keyframes pulse { 50% { transform: scale(0.94); } }

.word {
  font-family: var(--f-word);
  font-size: clamp(34px, 11vw, 46px);
  font-weight: 600;
  letter-spacing: -0.6px;
  line-height: 1.12;
  text-align: center;
  word-break: break-word;
}
.word-sm {
  font-family: var(--f-word);
  font-size: 21px;
  color: var(--muted);
  letter-spacing: -0.2px;
}
.phon {
  font-size: 15px;
  color: var(--muted);
  letter-spacing: 0.2px;
  text-align: center;
  margin-top: 4px;
}
.face.back .phon { text-align: left; margin: 0; font-size: 14px; }
.hint {
  margin-top: 22px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.4px;
  animation: breathe 2.6s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

.def {
  font-size: 20px;
  line-height: 1.62;
  color: var(--ink);
  letter-spacing: 0.2px;
  overflow-y: auto;
  padding-right: 2px;
  flex: 0 1 auto;
  max-height: 64%;
  word-break: break-word;
}
.def .pos {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 1px 6px;
  margin-right: 6px;
  vertical-align: 2px;
}

.rate-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}
.rate {
  height: 56px;
  border-radius: 16px;
  font-size: 14.5px;
  font-weight: 620;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid transparent;
  transition: transform 0.14s ease, opacity 0.25s, filter 0.2s;
}
.rate small { font-size: 10px; font-weight: 500; opacity: 0.66; letter-spacing: 0.3px; }
.rate:active { transform: scale(0.96); }
.rate.again { background: var(--red-soft); color: var(--red); border-color: color-mix(in srgb, var(--red) 16%, transparent); }
.rate.hard { background: var(--amber-soft); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 16%, transparent); }
.rate.good { background: var(--green-soft); color: var(--green); border-color: color-mix(in srgb, var(--green) 16%, transparent); }
.rate-row.is-locked .rate { opacity: 0.34; pointer-events: none; }

.learn-foot {
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 14px;
  min-height: 17px;
}

/* ---------- 测验 ---------- */
.quiz-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 26px 0 22px;
  position: relative;
}
.q-word {
  font-family: var(--f-word);
  font-size: clamp(32px, 10vw, 42px);
  font-weight: 600;
  letter-spacing: -0.5px;
  text-align: center;
}
.q-phon { font-size: 14px; color: var(--muted); }
.quiz-head .speaker { position: absolute; top: 8px; right: 0; }

.options { display: flex; flex-direction: column; gap: 9px; }
.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  font-size: 15px;
  line-height: 1.45;
  text-align: left;
  transition: transform 0.14s, background 0.2s, border-color 0.2s;
  min-height: 58px;
}
.opt:active { transform: scale(0.985); }
.opt-k {
  width: 26px; height: 26px;
  flex: none;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.045);
}
@media (prefers-color-scheme: dark) { .opt-k { background: rgba(255,255,255,0.07); } }
.opt.is-correct { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 38%, transparent); }
.opt.is-correct .opt-k { background: var(--green); color: #fff; }
.opt.is-wrong { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 38%, transparent); }
.opt.is-wrong .opt-k { background: var(--red); color: #fff; }
.opt.is-dim { opacity: 0.5; }
.options.is-locked .opt { pointer-events: none; }

.quiz-foot {
  margin-top: 18px;
  padding-top: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
}
.quiz-msg { flex: 1; font-size: 13px; color: var(--muted); }
.quiz-msg b { color: var(--ink); }

/* ---------- 拼写 ---------- */
.spell-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 0 10px;
}
.speaker-big {
  width: 84px; height: 84px;
  border-radius: 28px;
  display: grid; place-items: center;
  color: var(--accent);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  transition: transform 0.15s;
}
.speaker-big:active { transform: scale(0.94); }
.speaker-big svg { width: 34px; height: 34px; }
.speaker-big.is-playing { animation: pulse 0.9s ease infinite; }
.spell-hint { font-size: 13px; color: var(--muted); }
.spell-def {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-2);
  text-align: center;
  min-height: 24px;
  padding: 0 10px;
}
.spell-tip { font-size: 12px; color: var(--muted); letter-spacing: 2px; }

.spell-form { display: flex; gap: 9px; margin-top: 22px; }
.spell-form input {
  flex: 1;
  height: 52px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--card);
  padding: 0 16px;
  font-size: 18px;
  letter-spacing: 2px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  color: var(--ink);
  min-width: 0;
}
.spell-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.spell-form input::placeholder { letter-spacing: 0.5px; font-size: 14px; }
.spell-form input.is-ok { border-color: var(--green); background: var(--green-soft); }
.spell-form input.is-bad { border-color: var(--red); background: var(--red-soft); }

.spell-result {
  margin-top: 18px;
  min-height: 40px;
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
}
.spell-result .ans {
  font-family: var(--f-word);
  font-size: 22px;
  display: block;
  margin-top: 4px;
}
.spell-result.is-ok { color: var(--green); }
.spell-result.is-bad { color: var(--red); }

/* ---------- 列表 ---------- */
.searchbar { position: relative; margin-bottom: 10px; }
.searchbar input {
  width: 100%;
  height: 44px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 0 14px 0 38px;
  font-size: 14px;
  outline: none;
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.searchbar input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.searchbar svg {
  position: absolute; left: 13px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.chips { display: flex; gap: 7px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--line);
  transition: all 0.18s;
}
.chip.is-on { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }

.list { display: flex; flex-direction: column; gap: 1px; flex: 1; min-height: 0; }
.list-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; }
.row-top { display: flex; align-items: baseline; gap: 8px; }
.row-w { font-family: var(--f-word); font-size: 17px; font-weight: 600; letter-spacing: -0.1px; }
.row-p { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-d { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-tag {
  font-size: 10px;
  padding: 3px 7px;
  border-radius: 6px;
  flex: none;
  font-weight: 600;
}
.row-tag.new { color: var(--muted); background: rgba(0, 0, 0, 0.045); }
.row-tag.learning { color: var(--amber); background: var(--amber-soft); }
.row-tag.known { color: var(--green); background: var(--green-soft); }
@media (prefers-color-scheme: dark) { .row-tag.new { background: rgba(255,255,255,0.07); } }

.row-del {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: grid; place-items: center;
  color: var(--muted);
  flex: none;
}
.row-del:active { background: var(--red-soft); color: var(--red); }

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.8;
}
.empty b { display: block; font-size: 16px; color: var(--ink-2); margin-bottom: 6px; font-weight: 620; }

.sticky-foot {
  padding-top: 14px;
  display: flex;
  gap: 10px;
  background: linear-gradient(to bottom, transparent, var(--bg) 40%);
}

/* ---------- 底部弹层 ---------- */
.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 10, 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: maskIn 0.22s ease;
  padding: 0;
}
.sheet-mask[hidden] { display: none; }
@keyframes maskIn { from { opacity: 0; } }
.sheet {
  width: 100%;
  max-width: 460px;
  background: var(--bg);
  border-radius: 26px 26px 0 0;
  padding: 10px 20px calc(22px + env(safe-area-inset-bottom));
  animation: sheetIn 0.3s cubic-bezier(0.2, 0.85, 0.3, 1);
  max-height: 88dvh;
  overflow-y: auto;
}
@keyframes sheetIn { from { transform: translateY(100%); } }
.sheet-grab {
  width: 38px; height: 4px;
  border-radius: 999px;
  background: var(--line);
  margin: 0 auto 16px;
}
.sheet h2 { font-size: 17px; font-weight: 680; margin-bottom: 4px; }
.sheet .sub { font-size: 12.5px; color: var(--muted); margin-bottom: 18px; }
.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.setting:last-of-type { border-bottom: 0; }
.setting-label { font-size: 14.5px; font-weight: 550; }
.setting-desc { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.seg {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.045);
  flex: none;
}
@media (prefers-color-scheme: dark) { .seg { background: rgba(255,255,255,0.06); } }
.seg button {
  min-width: 38px;
  height: 30px;
  padding: 0 9px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--muted);
  transition: all 0.18s;
}
.seg button.is-on { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }

.sheet-danger {
  margin-top: 18px;
  width: 100%;
  height: 46px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 550;
  color: var(--red);
  background: var(--red-soft);
}
.sheet-close { margin-top: 10px; width: 100%; height: 46px; border-radius: 13px; font-size: 14.5px; font-weight: 600; color: var(--ink-2); background: rgba(0,0,0,0.045); }
@media (prefers-color-scheme: dark) { .sheet-close { background: rgba(255,255,255,0.07); } }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: #26221c;
  color: #f7f4ed;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 80;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
  max-width: 82vw;
  text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 完成页 ---------- */
.done {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding-bottom: 40px;
}
.done-ico {
  width: 76px; height: 76px;
  border-radius: 26px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 6px;
  font-size: 32px;
}
.done h2 { font-size: 21px; font-weight: 680; }
.done p { font-size: 13.5px; color: var(--muted); line-height: 1.7; max-width: 260px; }
.done-stats { display: flex; gap: 26px; margin: 14px 0 20px; }
.done-stats div { display: flex; flex-direction: column; gap: 3px; }
.done-stats b { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.done-stats span { font-size: 11px; color: var(--muted); }

/* 窄屏微调 */
@media (max-width: 360px) {
  .app { padding-left: 14px; padding-right: 14px; }
  .hero { padding: 16px 15px 15px; border-radius: 22px; }
  .hero-title { font-size: 17px; }
  .hero-badge { font-size: 10px; padding: 4px 8px; }
  .ring-wrap, .ring { width: 116px; height: 116px; }
  .hero-body { gap: 12px; }
  .tile { padding: 13px 11px; gap: 9px; border-radius: 16px; }
  .tile-ico { width: 30px; height: 30px; border-radius: 9px; }
  .tile-ico svg { width: 15px; height: 15px; }
  .tile-txt b { font-size: 12.5px; white-space: nowrap; }
  .tile-txt span { font-size: 10px; }
  .word { font-size: 32px; }
}

@media (max-height: 700px) {
  .card-stage { height: clamp(270px, 44dvh, 340px); }
  .hero { padding: 16px 16px 14px; }
  .ring-wrap, .ring { width: 112px; height: 112px; }
  .ring-num { font-size: 23px; }
}

@media (prefers-color-scheme: dark) {
  .btn-primary {
    color: #07241c;
    background: linear-gradient(160deg, #7ce0bf, #3fae8c);
    box-shadow: 0 10px 22px -14px rgba(99, 209, 175, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
  .bar { background: linear-gradient(180deg, #5fd3b0, #35a987); }
}
