/* ============================================================
   背单词 H5 —— 移动端优先，适配微信内置浏览器
   ============================================================ */

:root {
  --brand: #2f6bff;
  --brand-dark: #1f4fd6;
  --brand-soft: #eaf0ff;
  --ok: #16a34a;
  --ok-soft: #e8f7ee;
  --bad: #e5484d;
  --bad-soft: #fdeced;
  --ink: #10192b;
  --ink-2: #4a5568;
  --ink-3: #8a94a6;
  --line: #e5e9f2;
  --bg: #f5f7fb;
  --card: #ffffff;
  --radius: 16px;
  --tap: 48px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  /* 表面与线条色：日间就是原来写死的那些值，夜间在 html[data-theme="dark"] 里整体换掉。
     抽成变量的唯一目的是让「护眼模式」能一处切换，日间外观必须一字不差。 */
  --bg-glass: rgba(245, 247, 251, .92);   /* 顶栏（半透明，滚动时能透出背景） */
  --input: #fbfcfe;                       /* 输入框、选项、词表项 */
  --input-focus: #ffffff;                 /* 输入框获得焦点时提亮 */
  --chip: #eef1f7;                        /* 选项前的按键小方块、配图占位 */
  --surface-2: #f8fafd;                   /* 卡片内的次级底色 */
  --track: #edf0f6;                       /* 进度条底槽 */
  --divider: #f0f3f8;
  --divider-soft: #f1f4f9;
  --axis: #d5dbe8;                        /* 图表的坐标轴 */
  --placeholder: #aeb6c6;
  --brand-2: #6f97ff;                     /* 品牌渐变的第二色 */
  --glow: rgba(47, 107, 255, .28);        /* 品牌色投影 */
  --chart-fill: rgba(47, 107, 255, .12);
  --chart-fill-ok: rgba(22, 163, 74, .12);
  --example-ink: #d4380d;                 /* 例句里强调的那个词 */
  --tag-new-bg: #eaf7ee;
  --scrim: rgba(16, 25, 43, .55);         /* 弹窗背后的遮罩 */
  --shadow: rgba(16, 25, 43, .28);
}

/* ---------- 夜间模式（「我的」里的护眼模式） ----------
   只换变量，不重写任何布局规则：
   - color-scheme 让滚动条、输入框光标、自动填充这些原生控件跟着变暗；
   - 深色下品牌色要提亮，否则按钮和链接在深底上糊成一片；
   - 圆角、间距、字号一律不动，两套模式共用同一份布局。
   由 app.js 的 applyTheme() 把 light/dark 写到 <html data-theme> 上。 */
html { color-scheme: light; }
html[data-theme="dark"] {
  color-scheme: dark;

  --brand: #6b9dff;
  --brand-dark: #4f7ff0;
  --brand-soft: #1d2942;
  --brand-2: #8fb4ff;
  --glow: rgba(0, 0, 0, .45);

  --ok: #4ade80;
  --ok-soft: #16301f;
  --bad: #f87171;
  --bad-soft: #3a1c1f;
  --tag-new-bg: #16301f;

  --ink: #e7ecf6;
  --ink-2: #b6c0d0;
  --ink-3: #8d99ad;
  --placeholder: #6b788c;

  --bg: #0f1420;
  --card: #182030;
  --bg-glass: rgba(15, 20, 32, .92);
  --surface-2: #1e2739;
  --input: #1e2739;
  --input-focus: #24304a;
  --chip: #2a3446;
  --track: #263048;

  --line: #2b3547;
  --divider: #232c3d;
  --divider-soft: #232c3d;
  --axis: #3a465e;

  --chart-fill: rgba(107, 157, 255, .18);
  --chart-fill-ok: rgba(74, 222, 128, .16);
  --example-ink: #ffa77a;

  --scrim: rgba(0, 0, 0, .62);
  --shadow: rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- 关键修复：显式让 [hidden] 生效 ----------
   作者样式里的 display 会覆盖 UA 的 [hidden]{display:none}，
   因此每个可隐藏容器都必须显式声明隐藏态。 */
[hidden] { display: none !important; }

/* ---------- 顶部栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg-glass);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px 0;
}
/* 顶栏第一行居中：标语（「为了…而每日奋斗！」）要像一句口号那样落在屏幕中间，
   页面名也跟着一起居中，切 tab 时文字才不会左右横跳。 */
.topbar__text { display: flex; align-items: baseline; gap: 8px; justify-content: center; }
.topbar__title { font-size: 17px; font-weight: 700; }
.topbar__meta { font-size: 13px; color: var(--ink-3); }
/* 标题位改当目标标语用（见 app.js 的 renderTopbarTitle）：
   目标最长 20 字，加上「为了…而每日奋斗！」共 29 字，窄屏放不下就用省略号，
   不许折成两行把整个顶栏撑高。 */
.topbar__title--goal {
  font-size: 15px; color: var(--brand);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar__tabs { display: flex; gap: 4px; margin-top: 8px; }
/* 窄屏顶栏上的积分徽章：与 PC 左侧面板同一个数，宽屏时脚本把它收起来，
   免得同一个数字在一屏里出现两次。 */
.topbar__points {
  display: inline-flex; align-items: baseline; gap: 4px;
  margin: 6px 0 0;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12.5px;
  white-space: nowrap;
}
.topbar__points-value { font-size: 15px; font-variant-numeric: tabular-nums; }
.tab {
  flex: 1; min-height: 40px; border: 0; background: transparent;
  font: inherit; font-size: 14px; color: var(--ink-3);
  border-radius: 10px 10px 0 0; cursor: pointer;
  position: relative; font-weight: 600;
}
.tab.is-active { color: var(--brand); }
.tab.is-active::after {
  content: ""; position: absolute; left: 22%; right: 22%; bottom: 0;
  height: 3px; border-radius: 3px 3px 0 0; background: var(--brand);
}

/* ---------- 主区域 ---------- */
.main { flex: 1; padding: 16px 16px calc(24px + var(--safe-b)); }
.screen { max-width: 480px; margin: 0 auto; display: grid; gap: 14px; }

/* ---------- 登录首屏 ---------- */
.hero { text-align: center; padding: 22px 0 6px; }
.hero__logo {
  width: 60px; height: 60px; margin: 0 auto 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 800; font-size: 24px;
  border-radius: 18px; box-shadow: 0 8px 20px var(--glow);
}
.hero__title { margin: 0 0 4px; font-size: 24px; }
.hero__desc { margin: 0; color: var(--ink-3); font-size: 14px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: grid; gap: 14px;
}
.card__title { margin: 0; font-size: 18px; }
.card__desc { margin: 0; color: var(--ink-3); font-size: 13px; }

/* ---------- 背词页：PC 左侧的排行榜 ----------
   这块是给电脑浏览器看的。窄屏（手机）上布局退回单列、面板整块 display:none，
   脚本那边也不会去拉数据。断点 900px 与 app.js 的 RANK_MEDIA 是同一个数，要改一起改。 */
.study-layout { display: grid; }
.study-main { display: grid; gap: 14px; }
/* 左侧栏（积分 + 排行榜）：默认整块收起，宽屏时由脚本摘掉 hidden。 */
.study-side { display: none; }
.rank { display: none; }

.rank__title { font-size: 16px; }
.rank__row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 46px 46px 46px;
  align-items: center; gap: 4px;
  padding: 7px 2px;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.rank__row--head {
  padding-bottom: 6px; font-size: 11.5px; font-weight: 600; color: var(--ink-3);
  border-bottom: 1px solid var(--line);
}
.rank__list { margin: 0; padding: 0; list-style: none; }
.rank__list li + li { border-top: 1px solid var(--divider); }
.rank__no { color: var(--ink-3); font-weight: 700; }
.rank__name {
  font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rank__num { text-align: right; color: var(--ink-2); }
/* 自己那一行高亮，不然一屏名字里找不到自己 */
.rank__row--me { background: var(--brand-soft); border-radius: 8px; }
.rank__row--me .rank__name { color: var(--brand); }
.rank__note { margin: 0; font-size: 11.5px; line-height: 1.5; color: var(--ink-3); }

@media (min-width: 900px) {
  #screen-study { max-width: 820px; }
  .study-layout {
    grid-template-columns: 300px minmax(0, 480px);
    justify-content: center;   /* 两栏整体居中，不贴着左边 */
    align-items: start;
    gap: 18px;
  }
  /* 左侧栏：整块 sticky，顶部留出顶栏高度。两张卡片各粘各的会叠在一起，
     所以粘的是容器，里面照常上下排。 */
  .study-side:not([hidden]) {
    display: grid;
    gap: 14px;
    align-content: start;
    position: sticky;
    top: 96px;
  }
  /* 只有脚本确认「宽屏 + 数据到手」才摘掉 hidden，这里顺势把面板放出来。 */
  .rank:not([hidden]) {
    display: grid; gap: 10px;
    padding: 14px 12px;
  }
}

/* ---------- 积分 ---------- */
.points { padding: 14px 12px; }
.points__title { font-size: 16px; }
.points__value {
  display: flex; align-items: baseline; gap: 4px;
  margin: 4px 0 6px;
  font-variant-numeric: tabular-nums;
}
.points__number {
  font-size: 34px; font-weight: 700; line-height: 1.1; color: var(--brand);
}
.points__unit { font-size: 13px; color: var(--ink-3); }
/* 答对时冒出来的「+2」：往上飘一下再消失，位置不占地方。 */
.points__gain { margin-left: 2px; font-size: 14px; font-weight: 700; color: var(--ok); }
.points__note { margin: 0 0 10px; font-size: 11.5px; line-height: 1.5; color: var(--ink-3); }

/* ---------- 背词统计 ---------- */
.stats-panel { padding: 14px 12px; }
.stats-panel__title { font-size: 16px; }
.stats-panel__list { margin: 4px 0 6px; padding: 0; list-style: none; }
.stats-panel__row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 5px 0;
  font-size: 13px;
}
.stats-panel__row + .stats-panel__row { border-top: 1px solid var(--divider); }
.stats-panel__label { color: var(--ink-2); }
.stats-panel__value {
  font-weight: 700; color: var(--ink);
  font-variant-numeric: tabular-nums;   /* 数字等宽：刷新时不会左右抖 */
}
/* 效率的单位：跟在数字后面但弱化；没数据时由脚本把它整块隐藏。 */
.stats-panel__unit { margin-left: 2px; font-size: 11.5px; font-weight: 400; color: var(--ink-3); }
.stats-panel__note { margin: 0; font-size: 11.5px; color: var(--ink-3); }

/* 数字跳一下：最轻的一个动作，说明积分刚涨了。 */
.points__number.is-bump,
.topbar__points-value.is-bump { animation: points-bump 0.32s ease-out; }
.points__gain.is-bump { animation: points-gain 0.9s ease-out; }

@keyframes points-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.28); }
  100% { transform: scale(1); }
}

@keyframes points-gain {
  0% { opacity: 0; transform: translateY(6px); }
  25% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-12px); }
}

/* 作答卡与结果卡共用同一条高度基线：卡片至少有这么高、主按钮贴底，
   这样点完「提交」瞬间换成「下一个」时按钮不会跳位，手指不用移动。
   JS 还会把结果卡的高度对齐到作答卡的实际高度（题目长的时候更高）。

   基线必须高于「结果卡最高的内容」——否则结果卡内容一旦超过作答卡，
   min-height 失效，按钮就会被顶下去（配图 + 多行释义时最容易踩到）。 */
.card--question,
.card--result {
  display: flex;
  flex-direction: column;
  min-height: 400px;
}
.card--question { gap: 12px; }

/* ---------- 表单 ---------- */
.field { display: grid; gap: 6px; }
.field__label { font-size: 13px; color: var(--ink-2); font-weight: 600; }
input[type="tel"], input[type="password"], input[type="text"], .spell__input {
  width: 100%; min-height: var(--tap);
  padding: 0 14px; font: inherit; font-size: 16px;
  color: var(--ink); background: var(--input);
  border: 1px solid var(--line); border-radius: 12px;
  transition: border-color .15s, background .15s;
}
input:focus { outline: none; border-color: var(--brand); background: var(--input-focus); }
input::placeholder { color: var(--placeholder); }

/* ---------- 按钮 ---------- */
.btn {
  min-height: var(--tap); padding: 0 18px;
  font: inherit; font-size: 16px; font-weight: 600;
  /* 按钮不继承父级文字颜色，基类也必须给一个：否则裸用 .btn 时是黑字。 */
  color: var(--ink);
  border: 0; border-radius: 12px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform .08s ease, opacity .15s, background .15s;
}
.btn:active { transform: scale(.985); }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); }
.btn--ghost { background: var(--brand-soft); color: var(--brand); }
.btn--block { width: 100%; }
.btn--grow { flex: 1; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.fineprint { margin: 0; font-size: 12px; color: var(--ink-3); text-align: center; }

/* ---------- 提示 ---------- */
.alert {
  margin: 0; padding: 10px 12px; border-radius: 10px;
  font-size: 14px; line-height: 1.45;
}
.alert--error { background: var(--bad-soft); color: var(--bad); }

/* ---------- 词表选择 ---------- */
.vocab-list { display: grid; gap: 10px; }
.vocab {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 62px; padding: 12px 16px;
  background: var(--input); border: 1.5px solid var(--line); border-radius: 12px;
  /* 同 .choice：按钮不继承文字颜色，漏写就会在夜间模式下变成黑字。 */
  color: var(--ink);
  font: inherit; text-align: left; cursor: pointer;
}
.vocab:active { border-color: var(--brand); background: var(--brand-soft); }
.vocab__name { font-size: 16px; font-weight: 600; }
.vocab__count { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.vocab__check { color: var(--brand); font-size: 18px; font-weight: 700; }

/* ---------- 任务概览 ---------- */
.card--plan { gap: 16px; }
.plan__head { display: grid; gap: 4px; }
.progress { display: flex; align-items: center; gap: 10px; }
.progress__bar {
  flex: 1; height: 8px; border-radius: 99px; background: var(--track); overflow: hidden;
}
.progress__fill {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: 99px; transition: width .3s ease;
}
.progress__text { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- 答题 ---------- */
.quiz-head { display: flex; align-items: center; gap: 12px; }
.quiz-head .progress { flex: 1; }
.tag {
  flex-shrink: 0; padding: 3px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600;
  background: var(--brand-soft); color: var(--brand);
}
.tag--new { background: var(--tag-new-bg); color: var(--ok); }

.question__type { margin: 0; font-size: 13px; color: var(--ink-3); }
.question__prompt {
  margin: 0; font-size: 32px; font-weight: 700; line-height: 1.25;
  word-break: break-word;
}
.question__prompt--zh { font-size: 22px; font-weight: 600; }
.question__phonetic { margin: 0; font-size: 20px; color: var(--ink-2); font-family: "Times New Roman", serif; }

/* 选项 */
.choices { display: grid; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 10px;
  min-height: 54px; padding: 12px 14px; width: 100%;
  background: var(--input); border: 1.5px solid var(--line); border-radius: 12px;
  /* 必须显式写 color：<button> 不继承父级文字颜色，UA 默认给黑色，
     夜间模式下就会变成黑字深底、A/B/C/D 的内容完全看不清。 */
  color: var(--ink);
  font: inherit; font-size: 15px; text-align: left; cursor: pointer;
}
.choice__key {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 7px;
  display: grid; place-items: center;
  background: var(--chip); color: var(--ink-2);
  font-size: 12px; font-weight: 700;
}
.choice__text { flex: 1; word-break: break-word; }
.choice.is-selected { border-color: var(--brand); background: var(--brand-soft); }
.choice.is-selected .choice__key { background: var(--brand); color: #fff; }
.choice.is-right { border-color: var(--ok); background: var(--ok-soft); }
.choice.is-right .choice__key { background: var(--ok); color: #fff; }
.choice.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.choice.is-wrong .choice__key { background: var(--bad); color: #fff; }
.choice[disabled] { cursor: default; }

/* 输入题 */
.spell { display: grid; }
.spell__input { font-size: 18px; text-align: center; letter-spacing: .5px; }

.quiz-actions { display: flex; gap: 10px; margin-top: auto; }

/* ---------- 结果卡 ---------- */
.card--result { gap: 14px; border-color: var(--line); }
/* 主按钮贴卡片底部：与作答卡的「提交」对齐，连点时手指不用移动。 */
.card--result .btn--block { margin-top: auto; }
.result__head { display: flex; align-items: center; gap: 10px; }
.result__badge {
  flex-shrink: 0; padding: 4px 12px; border-radius: 99px;
  font-size: 13px; font-weight: 700; color: #fff; background: var(--ok);
}
.result__badge--bad { background: var(--bad); }
.result__reason { margin: 0; font-size: 15px; font-weight: 600; }
.result__body {
  display: flex; align-items: center; gap: 14px; padding: 14px;
  background: var(--surface-2); border-radius: 12px; text-align: center;
}
/* 单词在左、配图在右；图没加载出来时会先占一块浅色底，不会让文字跳位。 */
.result__text { flex: 1; display: grid; gap: 4px; min-width: 0; }
.result__picture {
  flex-shrink: 0; width: 88px; height: 88px;
  object-fit: cover; border-radius: 10px; background: var(--chip);
}
.result__word { font-size: 26px; font-weight: 700; word-break: break-word; }

/* 答错对照：单词下方的两行——正确（绿勾）在上，你写的（红叉）在下。
   勾/叉紧跟在文字后面，标签与文字之间留一点间距才分得清谁对应谁。 */
.answer-compare {
  display: grid; gap: 4px; margin-top: 2px;
  text-align: left;
}
.answer-compare__item {
  display: flex; align-items: baseline; gap: 6px;
  font-size: 15px; font-weight: 600; word-break: break-word;
}
.answer-compare__text { min-width: 0; }
.answer-compare__mark {
  flex-shrink: 0; font-size: 15px; font-weight: 800; line-height: 1;
}
.answer-compare__item--ok { color: var(--ok); }
.answer-compare__item--bad { color: var(--bad); }
.result__phonetic { font-size: 16px; color: var(--ink-2); font-family: "Times New Roman", serif; }
#result-phonetic { font-size: 26px; }

.boost__actions { display: flex; gap: 10px; margin-top: 10px; }

.boost__actions .btn { flex: 1; }

/* 顺序背诵：按钮上方那条提示。放在这里是因为学生看完单词、手伸向「下一词」
   之前正好读到——提醒他动笔写，比只在心里过一遍记得牢。 */
.recite__tip {
  margin: 16px 0 0;
  font-size: 13px; font-weight: 600; color: var(--brand);
  text-align: center;
}
.recite__nav { display: flex; gap: 10px; margin-top: 14px; }

.recite__nav .btn { flex: 1; }

.result__example { margin-top: 10px; font-size: 15px; line-height: 1.6; color: var(--ink-1); text-align: left; }

.result__example-translation { margin-top: 4px; font-size: 14px; line-height: 1.6; color: var(--ink-2); text-align: left; }

.result__example-term { color: var(--example-ink); font-weight: 600; }
.result__meaning { font-size: 16px; }

/* 拼写对比：你写的在上、正确单词在下，对不上的字母标红。
   每个字符占同样宽度（等宽字体 + 固定格子），两行才会严丝合缝地对齐。 */
.spell-diff {
  display: grid; gap: 2px; margin-top: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 18px; line-height: 1.5; letter-spacing: 0;
}
.spell-diff__row { display: flex; justify-content: center; }
.spell-diff__char { display: inline-block; min-width: .62em; text-align: center; }
.spell-diff__char--wrong { color: var(--bad); font-weight: 700; }
.result__next { margin: 0; font-size: 13px; color: var(--ink-3); text-align: center; }
/* 词汇量：已掌握是确切值，推测值只是参照，所以不抢眼。 */
.result__vocab {
  margin: 0; padding-top: 2px; font-size: 13px; color: var(--ink-3);
  text-align: center; font-variant-numeric: tabular-nums;
}

/* ---------- 报告 ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px; display: grid; gap: 2px;
}
.stat__value { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat__label { font-size: 12px; color: var(--ink-3); }
.stat--ok .stat__value { color: var(--ok); }
.stat--brand .stat__value { color: var(--brand); }

.hard-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hard {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; background: var(--surface-2); border-radius: 10px;
}
.hard__term { font-weight: 700; }
.hard__meaning { font-size: 13px; color: var(--ink-2); }
.hard__wrong { font-size: 12px; color: var(--bad); font-weight: 600; white-space: nowrap; }

/* ---------- 报告图表 ---------- */
/* 用 padding 撑出 320:132 的宽高比，不依赖 SVG 的 height:auto——
   微信 X5 内核下那个写法会算出 0 高度，三张图就整片空白。 */
.chart {
  position: relative;
  width: 100%;
  padding-top: 41.25%;
}
.chart--empty { padding-top: 0; min-height: 118px; }
.chart__svg {
  position: absolute; top: 0; left: 0;
  display: block; width: 100%; height: 100%;
}
.chart__bar { fill: var(--brand); }
.chart__area { fill: var(--chart-fill); }
.chart__line {
  fill: none; stroke: var(--brand); stroke-width: 2;
  stroke-linejoin: round; stroke-linecap: round;
  /* viewBox 与容器宽度不成 1:1，不加这个线宽会跟着缩放粗细不一。 */
  vector-effect: non-scaling-stroke;
}
.chart--mastered .chart__area { fill: var(--chart-fill-ok); }
.chart--mastered .chart__line { stroke: var(--ok); }
.chart__grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart__axis { stroke: var(--axis); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart__tick { fill: var(--ink-3); font-size: 10px; font-variant-numeric: tabular-nums; }
.chart__empty { margin: 0; padding: 26px 0; text-align: center; color: var(--ink-3); font-size: 13px; }

/* ---------- 攻克（从背错到背对） ---------- */

/* 这一页是给学生正反馈的，标题卡加一条绿色左边框，进门先「祝贺」一下。 */
.recovered__hero { border-left: 3px solid var(--ok); }

.recovered__list { margin: 12px 0 0; padding: 0; list-style: none; }

.recovered__row { padding: 12px 0; border-top: 1px solid var(--divider); }

.recovered__row:first-child { border-top: 0; }

.recovered__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }

.recovered__term { font-size: 17px; font-weight: 700; }

.recovered__phonetic { color: var(--ink-3); font-size: 13px; }

/* 徽章推到最右边：「这个词现在什么状态」一行之内就能扫到。 */
.recovered__badge {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 12px;
}

.recovered__meaning { margin: 4px 0 7px; color: var(--ink-2); font-size: 14px; }

/* 答题轨迹：允许换行，背了很多次的词（序列很长）也不会撑破卡片。 */
.recovered__track { display: flex; flex-wrap: wrap; gap: 2px; }

.recovered__mark {
  width: 18px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
}

.recovered__mark--ok { background: var(--ok-soft); color: var(--ok); }

.recovered__mark--bad { background: var(--bad-soft); color: var(--bad); }

.recovered__meta { margin-top: 7px; color: var(--ink-3); font-size: 12.5px; }

/* ---------- 我的：每轮背词数量 / 护眼模式（两组按钮共用这套样式） ---------- */
.capacity { display: flex; flex-wrap: wrap; gap: 8px; }
.capacity__option {
  flex: 1 1 4.2em; min-height: 44px;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--input); color: var(--ink);
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}
.capacity__option:active { border-color: var(--brand); }
.capacity__option.is-active {
  border-color: var(--brand); background: var(--brand-soft); color: var(--brand);
}
/* 每轮词数是一个两位数，三列排布在窄屏上也留有足够的点按面积。 */
#capacity-picker .capacity__option {
  flex: 1 1 calc((100% - 16px) / 3); min-height: 56px; padding: 6px 4px;
  line-height: 1.25;
}

/* ---------- 积分商城 ---------- */
.store__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.store__balance {
  margin: 0;
  font-size: 15px; font-weight: 700; color: var(--brand);
  font-variant-numeric: tabular-nums;
}
.store-list {
  display: grid; gap: 10px;
  margin: 8px 0 14px; padding: 0; list-style: none;
}
.store-row {
  display: grid; gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}
.store-row__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.store-row__name { font-weight: 700; }
.store-row__price { font-size: 12.5px; color: var(--ink-3); }
.store-row__buy,
.store-row__play { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.store-row__minutes {
  min-width: 64px; text-align: center;
  font-size: 13px; font-variant-numeric: tabular-nums;
}
.store-row__cost {
  margin-left: auto;
  font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.store-row__pending { font-size: 13px; font-weight: 600; color: var(--ok); }
.store-row__next { margin: 0; font-size: 12.5px; color: var(--ink-3); }
/* 商城行里的按钮比主按钮小一号：一屏好几行，主按钮的尺寸会把行撑得很高。 */
.btn--tight { padding: 5px 12px; font-size: 13px; }

/* 全屏盖住整个应用：游戏期间不该还能点到下面的按钮。
   用 top/left/right/bottom 而不是 inset，老内核（微信 X5）更稳。

   布局刻意不用「grid 的 1fr + iframe height:100%」——部分手机内核在这种嵌套下
   会把 iframe 高度算成 0，游戏就整片空白。改成顶栏固定高度、iframe 绝对定位铺满。 */
.game-overlay {
  --bar-h: calc(52px + env(safe-area-inset-top, 0px));
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 100;
  background: #0b1220;
}
.game-overlay__bar {
  position: absolute; top: 0; left: 0; right: 0; height: var(--bar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: env(safe-area-inset-top, 0px) 14px 0;
  box-sizing: border-box;
  background: #101a2e; color: #fff; font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.game-overlay__left { color: #cbd5e6; }
#game-timer { color: #ffd08a; font-weight: 700; }
.game-overlay__exit {
  min-height: 36px; padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .28); border-radius: 10px;
  background: transparent; color: #fff; font: inherit; font-size: 13px; cursor: pointer;
}
.game-overlay__exit:active { background: rgba(255, 255, 255, .12); }
.game-overlay__frame {
  position: absolute; top: var(--bar-h); left: 0; right: 0; bottom: 0;
  width: 100%;
  /* iframe 是替换元素：height:auto 会退化成它的内在高度（150px），
     而不是被上下边距撑满——必须显式算出来，否则游戏被挤在一条窄框里。
     100% 是相对整个覆盖层（= 视口），所以减掉顶栏就正好铺满剩余区域。 */
  height: calc(100% - var(--bar-h));
  display: block; border: 0; background: #000;
}
.game-overlay__hint {
  position: absolute; left: 16px; right: 16px; bottom: 24px;
  margin: 0; padding: 12px 14px; border-radius: 12px;
  background: rgba(255, 255, 255, .12); color: #e6ecf7;
  font-size: 13px; line-height: 1.6; text-align: center;
}
.game-overlay__hint a { color: #ffd08a; }

/* ---------- 我的：背过的单词 ---------- */
.word-table { display: grid; gap: 6px; }
.word-table__head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 2px 8px; border-bottom: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--ink-3);
}
/* 列头本身就是排序开关：点一下换个方向。 */
.word-table__sort {
  display: inline-flex; align-items: center; gap: 4px;
  border: 0; background: transparent; font: inherit; font-weight: 600;
  color: var(--brand); cursor: pointer; padding: 4px 8px; border-radius: 8px;
}
.word-table__sort:active { background: var(--brand-soft); }
.word-table__list {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 0; max-height: 460px; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.word-table__row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 2px; border-bottom: 1px solid var(--divider-soft);
}
.word-table__row:last-child { border-bottom: 0; }
.word-table__word { display: grid; gap: 1px; min-width: 0; }
.word-table__term { font-weight: 600; word-break: break-word; }
.word-table__meaning { font-size: 12px; color: var(--ink-3); }
.word-table__score {
  flex-shrink: 0; font-weight: 700; color: var(--brand);
  font-variant-numeric: tabular-nums;
}
.word-table__row--mastered .word-table__score { color: var(--ok); }

/* ---------- 登录后提示补齐登录方式的弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; background: var(--scrim);
}
.modal__card {
  width: 100%; max-width: 340px;
  padding: 22px 20px 18px; border-radius: var(--radius);
  background: var(--card); box-shadow: 0 18px 44px var(--shadow);
}
.modal__title { margin: 0 0 8px; font-size: 19px; }
.modal__desc { margin: 0 0 16px; font-size: 13.5px; line-height: 1.6; color: var(--ink-3); }
.modal__card .btn + .btn { margin-top: 8px; }

/* ---------- 我的 ---------- */
.profile { display: flex; align-items: center; gap: 12px; }
.profile__avatar {
  width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 700; font-size: 18px;
}
.profile__phone { margin: 0; font-weight: 700; font-size: 16px; }
.profile__sub { margin: 2px 0 0; font-size: 13px; color: var(--ink-3); }

/* ---------- 加载态 ---------- */
.is-loading { position: relative; pointer-events: none; opacity: .65; }
