/* 奥数冲刺营 · 设计系统 v2
   方向：现代教育 SaaS——干净冷灰底、白色卡片、品牌蓝主色、金色激励色。
   所有可调值集中在 :root。 */

:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --ink: #101828;
  --ink-2: #475467;
  --ink-3: #8a94a6;
  --line: #e4e8f1;
  --line-2: #eef1f7;

  --brand: #2563eb;
  --brand-700: #1d4ed8;
  --brand-soft: #eef4ff;
  --brand-line: #c9dbff;

  --gold: #d97706;
  --gold-soft: #fef3e2;
  --right: #16a34a;
  --right-soft: #e8f7ee;
  --wrong: #dc2626;
  --wrong-soft: #feecec;
  --warn: #b45309;
  --warn-soft: #fff6e6;
  --shade: #fde3e0;
  --shade-2: #d7e4fb;

  --font-display: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", system-ui, sans-serif;
  --font-body: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", "WenQuanYi Micro Hei", system-ui, sans-serif;
  --font-math: "Cambria Math", "STIX Two Math", "Times New Roman", "Songti SC", "SimSun", "Noto Serif CJK SC", serif;

  --fs-12: 0.75rem;
  --fs-14: 0.875rem;
  --fs-16: 1rem;
  --fs-20: 1.25rem;
  --fs-25: 1.5625rem;
  --fs-31: 1.9375rem;
  --fs-48: 3rem;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 12px 32px -20px rgba(16, 24, 40, 0.28);
  --shadow-lg: 0 4px 8px -4px rgba(16, 24, 40, 0.08), 0 24px 56px -24px rgba(16, 24, 40, 0.32);
  --dur: 150ms;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-16);
  line-height: 1.6;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 700; line-height: 1.3; letter-spacing: -0.015em; }
h1 { font-size: var(--fs-31); }
h2 { font-size: var(--fs-25); }
h3 { font-size: var(--fs-20); }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.muted { color: var(--ink-2); }
.subtle { color: var(--ink-3); font-size: var(--fs-14); letter-spacing: 0.01em; }
.num { font-variant-numeric: tabular-nums; }
.boot { padding: 48px 24px; text-align: center; color: var(--ink-2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 外框 ---------- */
.app { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 60px; padding: 0 16px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-20); letter-spacing: -0.01em; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  box-shadow: 0 4px 12px -4px rgba(37, 99, 235, 0.5);
}
.topbar .who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar .who .name { font-size: var(--fs-14); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main { max-width: 1064px; margin: 0 auto; padding: 20px 16px 96px; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 56px; padding: 0 2px;
  font-size: var(--fs-12); letter-spacing: 0.02em; color: var(--ink-3); text-decoration: none;
}
.tabbar a svg { transition: transform var(--dur) ease-out; }
.tabbar a.active { color: var(--brand); font-weight: 600; }
.tabbar a.active svg { transform: translateY(-1px) scale(1.06); }
.sidebar { display: none; }

@media (min-width: 1024px) {
  .app.has-nav { display: grid; grid-template-columns: 244px minmax(0, 1fr); }
  .topbar { position: static; grid-column: 1 / -1; height: 64px; padding: 0 28px; }
  .sidebar {
    display: block; position: sticky; top: 0; align-self: start;
    height: calc(100vh - 64px); padding: 20px 14px; overflow-y: auto;
    border-right: 1px solid var(--line); background: var(--surface);
  }
  .sidebar a {
    position: relative;
    display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 12px; margin-bottom: 3px;
    border-radius: var(--r-sm); color: var(--ink-2); text-decoration: none; font-weight: 500; letter-spacing: 0.01em;
    transition: background-color var(--dur) ease-out, color var(--dur) ease-out;
  }
  .sidebar a:hover { background: var(--surface-2); color: var(--ink); }
  .sidebar a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
  .sidebar a.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
  .main { width: 100%; padding: 32px 40px 72px; }
  .tabbar { display: none; }
}

/* ---------- 基础组件 ---------- */
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); padding: 22px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { color: var(--ink-2); margin-top: 4px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 30px 0 14px; }
.section-title h2 { font-size: var(--fs-20); }
.section-title:first-child { margin-top: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
  background: var(--brand); color: #fff; font-weight: 600; letter-spacing: 0.02em; text-decoration: none;
  transition: transform 80ms ease-out, background-color var(--dur) ease-out, box-shadow var(--dur) ease-out;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.35);
}
.btn:hover { background: var(--brand-700); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { border-color: var(--brand-line); color: var(--brand); background: var(--brand-soft); }
.btn.ghost { background: transparent; color: var(--ink-2); box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.accent { background: var(--brand); box-shadow: 0 4px 14px -6px rgba(37, 99, 235, 0.55); }
.btn.accent:hover { background: var(--brand-700); }
.btn.danger { background: var(--wrong); box-shadow: 0 1px 2px rgba(220, 38, 38, 0.4); }
.btn.danger:hover { background: #b91c1c; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: var(--fs-14); border-radius: 8px; }
.btn.wide { width: 100%; }
.icon { width: 20px; height: 20px; flex: none; }
.icon.sm { width: 16px; height: 16px; }
.icon.lg { width: 28px; height: 28px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-size: var(--fs-14); letter-spacing: 0.01em;
  transition: border-color var(--dur) ease-out, color var(--dur) ease-out, background-color var(--dur) ease-out;
}
.chip:hover { border-color: var(--brand-line); color: var(--brand); }
.chip[aria-pressed="true"], .chip.active { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-line); font-weight: 600; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; white-space: nowrap;
  font-size: var(--fs-12); letter-spacing: 0.01em; background: #eef1f6; color: var(--ink-2); font-weight: 500;
}
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.accent { background: var(--wrong-soft); color: var(--wrong); }
.badge.ok { background: var(--right-soft); color: var(--right); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.gold { background: var(--gold-soft); color: var(--gold); }

.field { display: grid; gap: 6px; }
.field > span, .field > label { font-size: var(--fs-14); font-weight: 500; color: var(--ink-2); letter-spacing: 0.01em; }
.field .hint { font-size: var(--fs-14); color: var(--ink-3); }
.field .error { font-size: var(--fs-14); color: var(--wrong); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; color: var(--ink);
  transition: border-color var(--dur) ease-out, box-shadow var(--dur) ease-out;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.input.invalid, .textarea.invalid { border-color: var(--wrong); }
.form-grid { display: grid; gap: 16px; }
.form-error { padding: 12px 14px; border-radius: var(--r-sm); background: var(--wrong-soft); color: var(--wrong); }

.empty { display: grid; justify-items: center; gap: 8px; padding: 44px 20px; text-align: center; }
.empty .icon-wrap { width: 60px; height: 60px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-3); }
.empty h3 { font-size: var(--fs-20); }
.empty p { color: var(--ink-2); max-width: 36em; }
.empty .btn { margin-top: 8px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button {
  min-height: 44px; padding: 0 14px; border: 0; background: none; color: var(--ink-2);
  font-weight: 500; letter-spacing: 0.01em; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

.progress { height: 8px; border-radius: 999px; background: #e8edf5; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #3b82f6, #2563eb); }

.toast-region { position: fixed; left: 50%; bottom: 88px; z-index: 60; transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
@media (min-width: 1024px) { .toast-region { bottom: 28px; } }
.toast { padding: 12px 16px; border-radius: 10px; background: #101828; color: #fff; box-shadow: var(--shadow-lg); pointer-events: auto; }
.toast.error { background: var(--wrong); }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(16, 24, 40, 0.5); display: grid; place-items: center; padding: 16px; }
.modal { width: min(92vw, 460px); max-height: 86vh; overflow-y: auto; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 26px; }
.modal h2 { font-size: var(--fs-20); margin-bottom: 8px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* ---------- 题目 ---------- */
.q-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.q-text { font-size: var(--fs-20); line-height: 1.85; overflow-wrap: anywhere; }
.q-text.sm { font-size: var(--fs-16); line-height: 1.7; }
.mx { font-family: var(--font-math); }
.katex { font-size: 1.12em; }
.tex { font-family: var(--font-math); color: var(--wrong); }
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: -0.55em; margin: 0 0.12em; font-size: 0.86em; line-height: 1.15; font-family: var(--font-math); }
.frac .den { border-top: 1px solid currentColor; padding: 0 0.2em; }
.frac .num { padding: 0 0.2em; }
.ol { text-decoration: overline; }
sup, sub { font-size: 0.7em; }
.figure { margin: 16px 0; padding: 14px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-sm); display: flex; justify-content: center; }
.figure svg { max-width: 100%; height: auto; max-height: 300px; color: var(--ink); stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.figure svg .h { stroke: var(--ink-3); stroke-width: 1; }
.figure svg .d { stroke-dasharray: 4 3; }
.figure svg .f { fill: var(--shade); }
.figure svg .f2 { fill: var(--shade-2); }
.figure svg .no { stroke: none; }
.figure svg text { stroke: none; fill: var(--ink); font-size: 13px; font-family: var(--font-body); }
.figure svg .ti { font-family: var(--font-math); font-style: italic; font-size: 14px; }
.figure svg .tm { font-size: 12px; }

.options { display: grid; gap: 10px; margin-top: 20px; }
.option {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; min-height: 54px; padding: 13px 15px; text-align: left;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: border-color var(--dur) ease-out, background-color var(--dur) ease-out, box-shadow var(--dur) ease-out;
}
.option:hover { border-color: var(--brand-line); box-shadow: var(--shadow-sm); }
.option[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand) inset; }
.option .key { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); font-weight: 600; font-size: var(--fs-14); color: var(--ink-2); }
.option[aria-pressed="true"] .key { background: var(--brand); color: #fff; }
.option.locked { pointer-events: none; }
.option.is-answer { border-color: var(--right); background: var(--right-soft); }
.option.is-answer .key { background: var(--right); color: #fff; }
.option.is-wrong { border-color: var(--wrong); background: var(--wrong-soft); }
.option.is-wrong .key { background: var(--wrong); color: #fff; }
.option > .body { flex: 1 1 auto; min-width: 0; padding-top: 1px; }

.answer-row { display: flex; align-items: center; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.answer-row .input { flex: 1 1 200px; min-width: 0; font-family: var(--font-math); font-size: var(--fs-20); }
.answer-row .unit { color: var(--ink-2); }
.answer-help { margin-top: 6px; font-size: var(--fs-14); color: var(--ink-3); }

.hints { display: grid; gap: 8px; margin-top: 16px; }
.hint { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--gold-soft); }
.hint .icon { margin-top: 4px; color: var(--gold); }

/* ---------- 做题反馈 ---------- */
.feedback { margin-top: 20px; padding: 20px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); animation: rise 200ms ease-out both; }
.feedback.bad { border-color: rgba(220, 38, 38, 0.22); background: #fffafa; }
.feedback.good { border-color: rgba(22, 163, 74, 0.25); background: #f6fdf9; }
.verdict-banner { display: flex; gap: 14px; align-items: flex-start; }
.verdict-banner strong { font-size: var(--fs-25); display: block; letter-spacing: -0.01em; }
.feedback.good .verdict-banner strong { color: var(--right); }
.feedback.bad .verdict-banner strong { color: var(--wrong); }
.verdict-banner p { color: var(--ink-2); margin-top: 2px; }
.mark { width: 40px; height: 40px; flex: none; color: var(--wrong); }
.feedback.good .mark { color: var(--right); }
.mark path { stroke: currentColor; stroke-width: 3.4; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 140; stroke-dashoffset: 140; animation: draw 320ms ease-out 60ms forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.answer-line { margin-top: 12px; }
.answer-line b { font-family: var(--font-math); font-size: var(--fs-20); color: var(--right); font-weight: 600; }
.solution { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.solution ol { margin: 0; padding-left: 1.4em; display: grid; gap: 6px; }
.causes { margin-top: 18px; }
.causes-head b { display: block; font-size: var(--fs-16); }
.causes-head .subtle { display: block; margin-top: 2px; }
.causes-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.causes-list .chip[aria-pressed="true"] { background: var(--wrong-soft); border-color: rgba(220, 38, 38, 0.4); color: var(--wrong); font-weight: 600; }
.ai-box { margin-top: 16px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); }
.ai-box .head { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 6px; }
.ai-box ul { margin: 6px 0 0; padding-left: 1.2em; }
.ai-box .err { color: var(--wrong); }
.ai-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.upload { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.upload img { width: 72px; height: 54px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line); }

/* 答错后的“学会它”体验 */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
@media (max-width: 640px) { .compare { grid-template-columns: 1fr; } }
.compare-cell { border-radius: var(--r-sm); padding: 12px 16px; border: 1px solid; }
.compare-cell .label { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-12); letter-spacing: 0.06em; color: var(--ink-3); font-weight: 600; }
.compare-cell .value { font-family: var(--font-math); font-size: var(--fs-25); margin-top: 4px; overflow-wrap: anywhere; }
.compare-cell.bad { background: var(--wrong-soft); border-color: rgba(220, 38, 38, 0.3); }
.compare-cell.bad .value { color: var(--wrong); text-decoration: line-through; }
.compare-cell.good { background: var(--right-soft); border-color: rgba(22, 163, 74, 0.3); }
.compare-cell.good .value { color: var(--right); }

.learn { margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; }
.learn-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.learn-head b { font-size: var(--fs-16); }
.learn-head .subtle { margin-left: auto; }
ol.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
ol.steps > li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: start; }
ol.steps .no { width: 26px; height: 26px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-family: var(--font-math); font-size: var(--fs-14); font-weight: 600; margin-top: 2px; }
ol.steps > li > div { min-width: 0; overflow-wrap: anywhere; padding-top: 2px; }
.pitfall-box { display: flex; gap: 10px; margin-top: 14px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--warn-soft); }
.pitfall-box b { display: block; font-size: var(--fs-14); color: var(--warn); }
.pitfall-box p { color: var(--ink-2); font-size: var(--fs-14); margin-top: 2px; }
.method-link { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: var(--fs-14); color: var(--ink-2); }
.method-link a { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; color: var(--brand); font-weight: 600; }

.ai-box.explain { border-color: rgba(217, 119, 6, 0.3); background: #fffcf5; }
.ai-box.explain .head { color: var(--gold); }
.misconception { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: var(--fs-14); margin-bottom: 8px; }

/* ---------- 练习页面 ---------- */
.session-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.timer { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-math); font-size: var(--fs-25); font-variant-numeric: tabular-nums; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 4px 14px; box-shadow: var(--shadow-sm); }
.timer.low { color: var(--wrong); border-color: rgba(220, 38, 38, 0.4); }
.session-grid { display: grid; gap: 16px; }
.session-grid.with-palette { grid-template-columns: minmax(0, 1fr) 280px; }
.session-grid:not(.with-palette) #stage { max-width: 860px; margin: 0 auto; width: 100%; }
.session-progress { height: 6px; border-radius: 999px; background: #e8edf5; overflow: hidden; margin-top: 10px; max-width: 420px; }
.session-progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #3b82f6, #2563eb); transition: width 300ms ease-out; }
.palette .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.palette button { position: relative; min-width: 40px; min-height: 40px; border-radius: var(--r-sm); border: 1px solid var(--line); background: #fff; font-weight: 600; font-variant-numeric: tabular-nums; transition: border-color var(--dur) ease-out; }
.palette button:hover { border-color: var(--brand-line); }
.palette button.answered { background: var(--brand); color: #fff; border-color: var(--brand); }
.palette button.current { outline: 2px solid var(--brand); outline-offset: 2px; }
.palette button.marked::after { content: ""; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--wrong); }
.palette .legend { margin-top: 10px; font-size: var(--fs-12); color: var(--ink-3); display: flex; gap: 12px; flex-wrap: wrap; }
.session-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.loading { display: grid; justify-items: center; gap: 12px; padding: 48px 20px; color: var(--ink-2); text-align: center; }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--brand); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (min-width: 1024px) {
  .session-grid.with-palette { grid-template-columns: minmax(0, 1fr) 280px; align-items: start; }
  .palette { position: sticky; top: 24px; }
}

/* ---------- 结果 ---------- */
.result-hero { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; }
.ring { position: relative; width: 132px; height: 132px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .bg { stroke: #e8edf5; }
.ring .fg { stroke: var(--brand); stroke-linecap: round; stroke-dasharray: 339.3; stroke-dashoffset: var(--offset); animation: fill 500ms ease-out 100ms both; }
@keyframes fill { from { stroke-dashoffset: 339.3; } to { stroke-dashoffset: var(--offset); } }
.ring .label { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-math); font-size: var(--fs-31); font-variant-numeric: tabular-nums; }
.stamp { display: inline-block; padding: 2px 14px; border: 3px solid var(--brand); border-radius: 8px; color: var(--brand); font-weight: 700; font-size: var(--fs-25); transform: rotate(-5deg); animation: stamp 250ms ease-out both; background: var(--brand-soft); }
@keyframes stamp { from { opacity: 0; transform: rotate(-5deg) scale(1.5); } to { opacity: 1; transform: rotate(-5deg) scale(1); } }
.stats-list { display: grid; gap: 10px; }
.stat-row { display: grid; grid-template-columns: 5.5em minmax(0, 1fr) 3.5em; align-items: center; gap: 12px; font-size: var(--fs-14); }
.stat-row .progress > span { background: var(--ink-2); }
.wrong-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line-2); }
.wrong-item:first-child { border-top: 0; }
.wrong-item .stem { flex: 1 1 auto; min-width: 0; color: var(--ink-2); overflow-wrap: anywhere; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: min(92vw, 400px); }
.login h1 { margin-bottom: 4px; }
.login .lead { color: var(--ink-2); margin-bottom: 24px; }
.login form { display: grid; gap: 16px; }
.login .brand-mark { margin-bottom: 12px; width: 44px; height: 44px; border-radius: 12px; }

/* ---------- 今日 ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; padding: 26px 28px;
  border-radius: var(--r-lg); color: #fff; border: 0;
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 55%, #3b82f6 100%);
  box-shadow: 0 16px 40px -20px rgba(37, 99, 235, 0.65);
}
.hero .eyebrow { font-size: var(--fs-12); letter-spacing: 0.08em; color: rgba(255, 255, 255, 0.72); margin-bottom: 6px; font-weight: 500; }
.hero h1 { font-size: var(--fs-25); }
.hero p { margin-top: 6px; color: rgba(255, 255, 255, 0.85); }
.hero .count { font-family: var(--font-math); font-size: var(--fs-48); line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: #fff; white-space: nowrap; }
.hero .count small { font-family: var(--font-body); font-size: var(--fs-16); letter-spacing: 0; color: rgba(255, 255, 255, 0.85); margin-left: 4px; }
.hero .count.muted { color: rgba(255, 255, 255, 0.6); font-size: var(--fs-31); }
.streak { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; background: rgba(255, 255, 255, 0.16); border-radius: 999px; padding: 6px 14px; }
.tasks { display: grid; gap: 10px; }
.task { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); transition: border-color var(--dur) ease-out, box-shadow var(--dur) ease-out; }
.task:hover { border-color: var(--brand-line); box-shadow: var(--shadow); }
.task .icon-wrap { width: 42px; height: 42px; border-radius: 11px; background: var(--brand-soft); display: grid; place-items: center; color: var(--brand); }
.task h3 { font-family: var(--font-body); font-size: var(--fs-16); font-weight: 600; letter-spacing: 0.01em; }
.task p { color: var(--ink-2); font-size: var(--fs-14); margin-top: 2px; }
.task .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.task.done { opacity: 0.75; }
.task.done .icon-wrap { background: var(--right-soft); color: var(--right); }
@media (max-width: 640px) {
  .task { grid-template-columns: 44px minmax(0, 1fr); }
  .task .meta { grid-column: 2; justify-content: flex-start; }
  .hero { grid-template-columns: minmax(0, 1fr); }
}
.mastery { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.mastery a { display: grid; gap: 6px; padding: 15px; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); color: inherit; transition: border-color var(--dur) ease-out, box-shadow var(--dur) ease-out, transform var(--dur) ease-out; }
.mastery a:hover { border-color: var(--brand-line); box-shadow: var(--shadow); transform: translateY(-1px); }
.mastery .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.mastery .top b { font-weight: 600; }
.mastery .top .num { font-family: var(--font-math); font-size: var(--fs-20); }

/* ---------- 专项 ---------- */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.module-card {
  display: grid; gap: 10px; padding: 20px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  transition: border-color var(--dur) ease-out, box-shadow var(--dur) ease-out, transform var(--dur) ease-out;
}
.module-card:hover { border-color: var(--brand-line); box-shadow: var(--shadow); transform: translateY(-2px); }
.module-card .head { display: flex; align-items: center; gap: 10px; }
.module-card .short { font-family: var(--font-math); color: var(--brand); font-size: var(--fs-20); width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); display: grid; place-items: center; }
.module-card h2 { font-size: var(--fs-25); }
.module-card p { color: var(--ink-2); font-size: var(--fs-14); min-height: 2.8em; }
.module-card .counts { font-size: var(--fs-14); color: var(--ink-3); display: flex; gap: 12px; flex-wrap: wrap; }

.card { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.card + .card { margin-top: 12px; }
.card h3 { margin-bottom: 8px; }
.card details > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.card details > summary::-webkit-details-marker { display: none; }
.card details[open] > summary { margin-bottom: 8px; }
.card ul, .card ol { margin: 6px 0 0; padding-left: 1.3em; display: grid; gap: 4px; }
.card .idea { color: var(--ink-2); }
.card .label { font-size: var(--fs-12); letter-spacing: 0.08em; color: var(--ink-3); margin: 12px 0 2px; }
.card .pitfalls li { color: var(--warn); }

.qrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line-2); }
.qrow:first-child { border-top: 0; }
.qrow .stem { color: var(--ink-2); min-width: 0; overflow-wrap: anywhere; }
.qrow .status { font-size: var(--fs-14); white-space: nowrap; }
.qrow .status.ok { color: var(--right); }
.qrow .status.bad { color: var(--wrong); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.pick { display: grid; gap: 12px; }
.count-input { width: 84px; text-align: center; }

/* ---------- 错题本 ---------- */
.wrong-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 14px 0; border-top: 1px solid var(--line-2); }
.wrong-row:first-child { border-top: 0; }
.wrong-row .top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.wrong-row .actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.wrong-row.mastered { opacity: 0.7; }
.stage { display: inline-flex; gap: 4px; align-items: center; }
.stage i { width: 8px; height: 8px; border-radius: 50%; background: #e0e5ee; }
.stage i.on { background: var(--brand); }
.due { font-size: var(--fs-14); color: var(--ink-3); }
.due.now { color: var(--wrong); font-weight: 600; }
@media (max-width: 640px) {
  .wrong-row { grid-template-columns: minmax(0, 1fr); }
  .wrong-row .actions { flex-direction: row; flex-wrap: wrap; }
}

/* ---------- 学情 ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.kpi { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.kpi .v { font-family: var(--font-math); font-size: var(--fs-31); line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpi .l { color: var(--ink-2); font-size: var(--fs-14); margin-top: 2px; }
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-i