/* =========================================================
   算数星球 · 全站样式
   Follows outputs/design-system/MASTER.md
   Zero external assets. Flat fills only.
   ========================================================= */

/* ---------- 1. Tokens ---------- */
:root {
  --bg: #eff6ff;
  --bg-soft: #e4eefe;
  --card: #ffffff;
  --ink: #0f172a;
  --body: #3f4a5f;
  --muted: #f1f5fd;
  --border: #dbe6fb;
  --primary: #2563eb;
  --on-primary: #ffffff;
  --secondary: #f59e0b;
  --on-secondary: #0f172a;
  --accent: #ec4899;
  --on-accent: #0f172a;
  --success: #14804a;
  --danger: #cf2a1f;
  --ring: #2563eb;
  --clay-outline: #2e2a45;
  --clay-lo: rgba(15, 23, 42, .10);
  --clay-hi: rgba(255, 255, 255, .92);
  --focus-halo: rgba(37, 99, 235, .22);
  --focus-halo-soft: rgba(37, 99, 235, .14);

  --r-card: 22px;
  --r-ctl: 16px;
  --r-pill: 999px;
  --bw: 3px;
  --bounce: cubic-bezier(.34, 1.56, .64, 1);
  --ease: cubic-bezier(.22, .9, .28, 1);

  --font-round: "Baloo 2", "Comic Neue", ui-rounded, "Hiragino Maru Gothic ProN",
                "YouYuan", "幼圆", "STYuanti SC", "PingFang SC", "Microsoft YaHei",
                "Segoe UI", system-ui, sans-serif;

  --sidebar-w: 248px;
  --content-max: 1240px;
}

body.eye-care {
  --bg: #fbf3e4;
  --bg-soft: #f3e6d1;
  --card: #fffbf2;
  --ink: #2b2419;
  --body: #57493a;
  --muted: #f7edd9;
  --border: #e6d5b7;
  --primary: #b45309;
  --on-primary: #fffdf7;
  --secondary: #e8a400;
  --on-secondary: #3a2e14;
  --accent: #cf6a4a;
  --on-accent: #241c0c;
  --success: #47713c;
  --danger: #ab3b2b;
  --ring: #b45309;
  --clay-outline: #4a3a26;
  --clay-lo: rgba(43, 36, 25, .13);
  --clay-hi: rgba(255, 250, 240, .85);
  --focus-halo: rgba(180, 83, 9, .24);
  --focus-halo-soft: rgba(180, 83, 9, .16);
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { min-width: 320px; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-round);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .32s var(--ease), color .32s var(--ease);
}

img, svg { display: block; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--primary); text-decoration: none; }
button { color: inherit; }
h1, h2, h3, h4, p { margin: 0; }

::selection { background: var(--secondary); color: var(--on-secondary); }

:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 3px;
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: 16px; top: -80px;
  z-index: 1000;
  padding: 10px 18px;
  border: var(--bw) solid var(--clay-outline);
  border-radius: var(--r-pill);
  background: var(--secondary);
  color: var(--on-secondary);
  font-weight: 700;
  transition: top .2s var(--bounce);
}
.skip-link:focus { top: 16px; }

.icon {
  width: 22px; height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm { width: 18px; height: 18px; }
.icon-lg { width: 26px; height: 26px; }

/* ---------- 3. Primitives ---------- */
.clay-card {
  background: var(--card);
  border: var(--bw) solid var(--clay-outline);
  border-radius: var(--r-card);
  box-shadow: inset -3px -3px 10px var(--clay-lo), 0 8px 0 var(--clay-lo);
  transition: background-color .32s var(--ease), border-color .32s var(--ease),
              transform .2s var(--bounce);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 22px;
  border: var(--bw) solid var(--clay-outline);
  border-radius: var(--r-ctl);
  background: var(--card);
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  box-shadow: inset -2px -2px 7px var(--clay-lo), 0 5px 0 var(--clay-lo);
  transition: transform .2s var(--bounce), background-color .22s var(--ease),
              color .22s var(--ease), box-shadow .2s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: inset -2px -2px 7px var(--clay-lo), 0 7px 0 var(--clay-lo); }
.btn:active { transform: translateY(2px); box-shadow: inset -2px -2px 7px var(--clay-lo), 0 2px 0 var(--clay-lo); }
.btn:disabled { opacity: .62; cursor: not-allowed; transform: none; box-shadow: inset -2px -2px 7px var(--clay-lo), 0 4px 0 var(--clay-lo); }
.btn-primary { background: var(--secondary); color: var(--on-secondary); }
.btn-blue { background: var(--primary); color: var(--on-primary); }
.btn-dark { background: var(--clay-outline); color: var(--card); }
.btn-outline { background: var(--card); color: var(--primary); border-color: var(--primary); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--body); }
.btn-ghost:hover { background: var(--muted); box-shadow: none; }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: 14px; box-shadow: inset -2px -2px 6px var(--clay-lo), 0 3px 0 var(--clay-lo); }
.btn-lg { min-height: 58px; padding: 0 28px; font-size: 18px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 46px; height: 46px;
  padding: 0;
  border: var(--bw) solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--body);
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease, transform .18s var(--bounce);
}
.icon-btn:hover { background: var(--muted); color: var(--ink); }
.icon-btn:active { transform: scale(.94); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 4px 13px;
  border: 2px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--muted);
  color: var(--body);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.pill strong { color: var(--ink); }
.pill-accent { background: var(--card); border-color: var(--primary); color: var(--primary); }
.pill-success { background: var(--card); border-color: var(--success); color: var(--success); }
.pill-danger { background: var(--card); border-color: var(--danger); color: var(--danger); }

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 46px; height: 46px;
  flex: none;
  border: var(--bw) solid var(--clay-outline);
  border-radius: 15px;
  background: var(--secondary);
  color: var(--on-secondary);
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  box-shadow: inset -2px -2px 7px rgba(0, 0, 0, .14), 0 4px 0 var(--clay-lo);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 19px; font-weight: 800; letter-spacing: 0; }
.brand-sub { margin-top: 3px; font-size: 11px; font-weight: 700; color: var(--body); opacity: .78; letter-spacing: .08em; }

/* ---------- 4. Theme switch ---------- */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 5px 12px 5px 14px;
  border: 2px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--card);
  color: var(--body);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .28s var(--ease), border-color .28s var(--ease), color .28s var(--ease);
}
.theme-switch:hover { border-color: var(--primary); color: var(--primary); }
.theme-switch-track {
  position: relative;
  width: 40px; height: 23px;
  flex: none;
  border: 2px solid var(--clay-outline);
  border-radius: var(--r-pill);
  background: var(--muted);
  transition: background-color .26s var(--ease);
}
.theme-switch-knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 15px; height: 15px;
  border: 2px solid var(--clay-outline);
  border-radius: 50%;
  background: var(--secondary);
  transition: background-color .26s var(--ease), translate .3s var(--bounce);
}
body.eye-care .theme-switch-track { background: var(--secondary); }
body.eye-care .theme-switch-knob { background: var(--card); translate: 17px 0; }

/* ---------- 5. Auth layout ---------- */
.auth-page { overflow-x: hidden; }

.auth-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 1fr);
}

.auth-stage {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 96px 32px 48px;
  background: var(--bg);
  transition: background-color .32s var(--ease);
}

.auth-brand { position: absolute; top: 30px; left: 34px; z-index: 3; }

.stage-confetti { position: absolute; inset: 0; pointer-events: none; }
.stage-confetti i {
  position: absolute;
  display: block;
  width: 13px; height: 13px;
  border-radius: 4px;
  background: var(--c, var(--secondary));
  opacity: .72;
  animation: confetti-float 7.5s var(--ease) infinite alternate;
}
.stage-confetti i:nth-child(3n) { width: 10px; height: 10px; border-radius: 50%; }
.stage-confetti i:nth-child(4n) { width: 21px; height: 9px; border-radius: var(--r-pill); }
.stage-confetti i.c-mid { display: none; }

@keyframes confetti-float {
  from { translate: 0 0; }
  to { translate: 0 -14px; }
}

.mascot-stage {
  position: relative;
  z-index: 2;
  width: min(100%, 430px);
}

.mascot-grid {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: center;
  align-items: center;
  column-gap: 34px;
  row-gap: 8px;
}

.mascot-slot { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.mascot-slot[data-slot="orange"] { width: 160px; transform: translateY(9px); }
.mascot-slot[data-slot="purple"] { width: 132px; transform: translateY(-15px); }
.mascot-slot[data-slot="black"] { width: 112px; transform: translateY(-2px); }
.mascot-slot[data-slot="yellow"] { width: 150px; transform: translateY(11px); }

.mascot-float { width: 100%; animation: mascot-float 5.8s ease-in-out infinite; }
.mascot-slot[data-slot="purple"] .mascot-float { animation-duration: 6.5s; animation-delay: -1.2s; }
.mascot-slot[data-slot="black"] .mascot-float { animation-duration: 5.2s; animation-delay: -2.4s; }
.mascot-slot[data-slot="yellow"] .mascot-float { animation-duration: 7s; animation-delay: -3.2s; }
body.eye-care .mascot-float { animation-duration: 8.3s; }

@keyframes mascot-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

.mascot {
  --ink-face: #2b2d38;
  --blush: rgba(236, 72, 153, .34);
  --edge: var(--clay-outline);
  width: 100%;
  cursor: pointer;
  outline: none;
  transform-origin: 50% 88%;
  transition: transform .38s var(--bounce);
  will-change: transform;
}
.mascot[data-char="black"] { --ink-face: #f6f2ea; --blush: rgba(255, 138, 150, .5); --edge: #fff3e0; }
.mascot svg { display: block; width: 100%; height: auto; }
body.eye-care .mascot svg { filter: saturate(.9) sepia(.05); }
.mascot:focus-visible { outline: 4px solid var(--ring); outline-offset: 8px; border-radius: 24px; }

.mascot-ground {
  width: 74%;
  height: 10px;
  margin-top: 1px;
  border-radius: var(--r-pill);
  background: var(--clay-lo);
}

.mascot-head { will-change: transform; }
.mascot .body-shape { stroke: var(--edge); stroke-width: 4.4; stroke-linejoin: round; }
.mascot .sclera { fill: #fff; stroke: var(--edge); stroke-width: 3.2; }
.mascot .sclera-group { transition: opacity .2s ease; }
.mascot .pupil-dot { fill: #23252f; }
.mascot .glint { fill: #fff; }
.mascot .eye {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform .28s var(--bounce);
}
.mascot .lid-shut, .mascot .lid-happy {
  fill: none;
  stroke: var(--ink-face);
  stroke-width: 4.6;
  stroke-linecap: round;
  opacity: 0;
  transition: opacity .2s ease;
}
.mascot .mouth-line {
  fill: none;
  stroke: var(--ink-face);
  stroke-width: 4.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: d .24s ease, opacity .2s ease;
}
.mascot[data-char="black"] .mouth-line { stroke-width: 3.8; }
.mascot .mouth-o {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity .2s ease, transform .22s ease;
}
.mascot .mouth-o path { fill: var(--ink-face); }
.mascot .blush { fill: var(--blush); opacity: 0; transition: opacity .28s ease; }

.mascot[data-expr="closed"] .sclera-group,
.mascot[data-expr="happy"] .sclera-group,
.mascot.blink .sclera-group { opacity: 0; }
.mascot[data-expr="closed"] .lid-shut,
.mascot.blink .lid-shut { opacity: 1; }
.mascot[data-expr="happy"] .lid-happy { opacity: 1; }
.mascot[data-expr="sad"] .eye { transform: scaleY(.55); }
.mascot[data-expr="peek"] .eye-left { transform: scaleY(.22); }
.mascot[data-expr="peek"] .eye-right { transform: scale(1.15); }
.mascot[data-expr="curious"] .mouth-line { opacity: 0; }
.mascot[data-expr="curious"] .mouth-o { opacity: 1; transform: scale(.62); }
.mascot[data-expr="happy"] .blush { opacity: 1; }
.mascot.singing .mouth-line { opacity: 0; }
.mascot.singing .mouth-o { opacity: 1; animation: mouth-chomp .34s ease-in-out infinite alternate; }
.mascot.is-curious { transform: translate(9px, -4px) rotate(2deg) scale(1.03); }
.mascot.is-peek { transform: translate(8px, -1px) rotate(3deg); }
.mascot.is-closed { transform: translateX(-4px) rotate(-1.5deg); }
.mascot:hover { transform: translateY(-7px) scale(1.04); }
.mascot.react-sad { animation: mascot-wobble .46s ease-in-out 3; }
.mascot.react-happy { animation: mascot-hop .52s var(--bounce) 3; }
.mascot.singing { animation: mascot-sway .72s ease-in-out infinite; }

@keyframes mouth-chomp {
  from { transform: scale(.55, .42); }
  to { transform: scale(1.15, 1.05); }
}
@keyframes mascot-wobble {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-8px) rotate(-3.5deg); }
  75% { transform: translateX(8px) rotate(3.5deg); }
}
@keyframes mascot-hop {
  0%, 100% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-18px) scale(1.03, .96); }
  62% { transform: translateY(0) scale(.98, 1.02); }
}
@keyframes mascot-sway {
  0%, 100% { transform: rotate(-2.5deg) translateY(0); }
  50% { transform: rotate(2.5deg) translateY(-7px); }
}

.note-float {
  position: fixed;
  z-index: 80;
  pointer-events: none;
  font-weight: 800;
  opacity: 0;
  animation: note-float 1s ease-out forwards;
}
@keyframes note-float {
  0% { opacity: 0; transform: translate(-50%, 5px) scale(.6) rotate(0); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -76px) scale(1.12) rotate(var(--rot, 8deg)); }
}

.auth-panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 92px 34px 42px;
  background: var(--bg-soft);
  border-left: var(--bw) solid var(--border);
  transition: background-color .32s var(--ease), border-color .32s var(--ease);
}

.auth-panel-top {
  position: absolute;
  top: 24px;
  right: 28px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-home-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  color: var(--body);
  font-size: 13px;
  font-weight: 700;
}
.auth-home-link:hover { background: var(--card); color: var(--primary); }

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 30px 30px 24px;
}

.auth-card-head { text-align: center; margin-bottom: 24px; }
.auth-card-badge {
  display: inline-grid;
  place-items: center;
  width: 56px; height: 56px;
  margin-bottom: 10px;
  border: var(--bw) solid var(--clay-outline);
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: inset -2px -2px 7px rgba(0, 0, 0, .14);
}
.auth-card-badge svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; }
.auth-card h1 { font-size: 27px; font-weight: 800; color: var(--ink); }
.auth-card-sub { margin-top: 6px; font-size: 15px; color: var(--body); }
.auth-card h1, .auth-card-sub { transition: opacity .2s ease; }
.auth-card-head.is-swapping h1, .auth-card-head.is-swapping .auth-card-sub { opacity: 0; }

/* 登录 / 注册：滑动指示块 + 面板过渡 */
.auth-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: min(100%, 268px);
  margin: 12px auto 16px;
  padding: 4px;
  border: 2px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--muted);
}
.auth-tabs-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 0;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  border: 2px solid var(--clay-outline);
  border-radius: var(--r-pill);
  background: var(--secondary);
  box-shadow: inset -2px -2px 5px rgba(0, 0, 0, .10);
  transition: translate .32s var(--bounce);
}
.auth-tabs[data-active="register"] .auth-tabs-thumb { translate: 100% 0; }
.auth-tab {
  position: relative;
  z-index: 1;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--body);
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: color .24s var(--ease);
}
.auth-tab:hover { color: var(--ink); }
.auth-tab[aria-selected="true"], .auth-tab[aria-selected="true"]:hover { color: var(--on-secondary); }

.auth-panels { position: relative; transition: height .34s var(--ease); }
.auth-panel-view { transition: opacity .26s ease, transform .3s var(--ease); }
.auth-panel-view[hidden] { display: none; }
.auth-panel-view.is-leaving {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}
.auth-panel-view.is-entering { opacity: 0; transform: translateY(10px); }

.auth-form { display: grid; gap: 16px; }

.field { display: grid; gap: 8px; }
.field label { font-size: 15px; font-weight: 700; color: var(--ink); }
.field-hint { font-size: 12px; color: var(--body); opacity: .85; }

.input-wrap { position: relative; }
.text-input {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: var(--bw) solid var(--clay-outline);
  border-radius: var(--r-ctl);
  background: var(--muted);
  color: var(--ink);
  font-size: 17px;
  box-shadow: inset -2px -2px 6px var(--clay-lo);
  transition: border-color .2s ease, background-color .28s var(--ease),
              box-shadow .2s ease, color .28s var(--ease);
}
.text-input::placeholder { color: var(--body); opacity: .75; }
.text-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--card);
  box-shadow: inset -2px -2px 6px var(--clay-lo), 0 0 0 4px var(--focus-halo);
}
.input-wrap .text-input { padding-right: 60px; }

.password-toggle {
  position: absolute;
  top: 50%; right: 5px;
  display: grid; place-items: center;
  width: 44px; height: 44px;
  padding: 0;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--body);
  cursor: pointer;
  transform: translateY(-50%);
  transition: background-color .18s ease, color .18s ease;
}
.password-toggle:hover { background: var(--focus-halo-soft); color: var(--primary); }
.password-toggle .eye-off { display: none; }
.password-toggle.is-visible .eye-on { display: none; }
.password-toggle.is-visible .eye-off { display: block; }

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin: 1px 0 2px;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  color: var(--body);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.check-row input { position: absolute; width: 0; height: 0; opacity: 0; }
.check-box {
  position: relative;
  width: 25px; height: 25px;
  flex: none;
  border: 2.5px solid var(--clay-outline);
  border-radius: 8px;
  background: var(--muted);
  box-shadow: inset -2px -2px 5px var(--clay-lo);
  transition: background-color .18s ease;
}
.check-box::after {
  content: "";
  position: absolute;
  left: 7px; top: 2px;
  width: 6px; height: 12px;
  border: solid var(--on-primary);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg) scale(.4);
  opacity: 0;
  transition: opacity .18s ease, transform .22s var(--bounce);
}
.check-row input:checked + .check-box { background: var(--primary); }
.check-row input:checked + .check-box::after { opacity: 1; transform: rotate(45deg) scale(1); }
.check-row input:focus-visible + .check-box { outline: 3px solid var(--ring); outline-offset: 2px; }

.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 2px;
  border-radius: 7px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
}
.text-link:hover { text-decoration: underline; }

.form-message {
  min-height: 22px;
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity .2s ease, transform .2s var(--bounce);
}
.form-message.is-visible { opacity: 1; transform: translateY(0); }
.form-message.is-error { color: var(--danger); }
.form-message.is-success { color: var(--success); }
.form-message.is-info { color: var(--body); }

.auth-footer {
  margin-top: 17px;
  padding-top: 17px;
  border-top: 2px solid var(--border);
  text-align: center;
  font-size: 14px;
  color: var(--body);
}
.auth-footer a { font-weight: 800; color: var(--primary); }

.demo-note {
  margin-top: 15px;
  padding: 10px 13px;
  border: 2px dashed var(--border);
  border-radius: 13px;
  background: var(--muted);
  color: var(--body);
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}
.demo-note strong { color: var(--ink); }

.session-continue {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 15px;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 13px;
  background: var(--muted);
  color: var(--body);
  font-size: 13px;
}
.session-continue.is-visible { display: flex; }
.session-continue a { font-weight: 800; color: var(--primary); white-space: nowrap; }

/* ---------- 6. App shell ---------- */
.app-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100dvh;
  padding: 24px 18px;
  background: var(--card);
  border-right: var(--bw) solid var(--border);
  transition: background-color .32s var(--ease), border-color .32s var(--ease);
}

.sidebar .brand { padding: 2px 7px 0; }
.sidebar-nav { display: flex; flex-direction: column; gap: 8px; }
.nav-label {
  margin: 5px 10px 2px;
  color: var(--body);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  opacity: .85;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 49px;
  padding: 0 13px;
  border: 2px solid transparent;
  border-radius: 14px;
  color: var(--body);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color .2s var(--ease), color .2s var(--ease),
              transform .18s var(--bounce), border-color .2s ease;
}
.nav-item:hover { background: var(--muted); color: var(--ink); transform: translateX(2px); }
.nav-item[aria-current="page"] {
  background: var(--secondary);
  border-color: var(--clay-outline);
  color: var(--on-secondary);
  box-shadow: inset -2px -2px 6px rgba(0, 0, 0, .12), 0 3px 0 var(--clay-lo);
}
.nav-item .icon { width: 21px; height: 21px; }

.sidebar-spacer { flex: 1; }
.sidebar-tip {
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: var(--muted);
  color: var(--body);
  font-size: 12px;
  line-height: 1.55;
}
.sidebar-tip strong { display: block; margin-bottom: 3px; color: var(--ink); font-size: 13px; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: var(--muted);
}
.avatar {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  flex: none;
  border: 2.5px solid var(--clay-outline);
  border-radius: 13px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 17px;
  font-weight: 800;
}
.avatar-lg { width: 48px; height: 48px; border-radius: 15px; }
.sidebar-user-copy { min-width: 0; flex: 1; }
.sidebar-user-name { overflow: hidden; color: var(--ink); font-size: 14px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-role { color: var(--body); font-size: 12px; font-weight: 600; }

.main-col { min-width: 0; display: flex; flex-direction: column; }

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 78px;
  padding: 12px 30px;
  background: var(--bg);
  border-bottom: 2px solid var(--border);
  transition: background-color .32s var(--ease), border-color .32s var(--ease);
}
.topbar-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-title strong { font-size: 15px; font-weight: 800; color: var(--ink); }
.topbar-divider { width: 2px; height: 22px; border-radius: 2px; background: var(--border); }
.topbar-date { color: var(--body); font-size: 13px; font-weight: 600; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 5px 4px 11px;
  border: 2px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--card);
}
.user-chip-copy { display: flex; flex-direction: column; line-height: 1.2; }
.user-chip-name { font-size: 13px; font-weight: 800; color: var(--ink); }
.user-chip-role { font-size: 12px; color: var(--body); font-weight: 600; }

.mobile-nav-toggle { display: none; }

.page {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 30px 30px 48px;
  animation: page-rise .35s var(--ease) both;
}
@keyframes page-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 24px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
}
.page-head h1 { font-size: 29px; font-weight: 800; line-height: 1.2; color: var(--ink); }
.page-head p { margin-top: 7px; max-width: 620px; color: var(--body); font-size: 14px; }
.page-head-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.today-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 2px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--card);
  color: var(--body);
  font-size: 13px;
  font-weight: 700;
}

/* ---------- 7. Dashboard ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 92px;
  padding: 15px;
}
.stat-icon {
  display: grid;
  place-items: center;
  width: 48px; height: 48px;
  flex: none;
  border: 2.5px solid var(--clay-outline);
  border-radius: 15px;
  background: var(--muted);
  color: var(--primary);
}
.stat-icon.is-yellow { background: var(--secondary); color: var(--on-secondary); }
.stat-icon.is-pink { background: var(--accent); color: var(--on-accent); }
.stat-icon.is-blue { background: var(--primary); color: var(--on-primary); }
.stat-label { color: var(--body); font-size: 12px; font-weight: 700; }
.stat-value { margin-top: 2px; color: var(--ink); font-size: 23px; font-weight: 800; line-height: 1.2; }
.stat-value small { font-size: 12px; font-weight: 700; color: var(--body); }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(260px, .75fr);
  gap: 18px;
  margin-bottom: 24px;
}

.daily-card {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 236px;
  padding: 28px 30px;
  background: var(--clay-outline);
  color: var(--card);
}
.daily-copy { max-width: 500px; }
.daily-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  color: var(--secondary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
}
.daily-card h2 { font-size: 29px; line-height: 1.25; font-weight: 800; }
.daily-card p { margin-top: 8px; max-width: 450px; color: var(--card); opacity: .85; font-size: 14px; }
.daily-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.daily-card .btn-outline { background: transparent; color: var(--card); border-color: var(--card); box-shadow: none; }

.goal-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 150px; height: 150px;
  flex: none;
}
.goal-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.goal-ring .ring-track { fill: none; stroke: var(--card); stroke-opacity: .22; stroke-width: 11; }
.goal-ring .ring-progress {
  fill: none;
  stroke: var(--secondary);
  stroke-width: 11;
  stroke-linecap: round;
  transition: stroke-dashoffset .7s var(--ease);
}
.goal-ring-copy { position: relative; z-index: 2; text-align: center; color: var(--card); }
.goal-ring-copy strong { display: block; font-size: 36px; line-height: 1; font-weight: 800; }
.goal-ring-copy span { display: block; margin-top: 5px; font-size: 12px; font-weight: 700; opacity: .8; }

.streak-card { padding: 22px; display: flex; flex-direction: column; justify-content: space-between; }
.streak-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.streak-title { color: var(--ink); font-size: 16px; font-weight: 800; }
.streak-sub { color: var(--body); font-size: 12px; }
.streak-flame { display: grid; place-items: center; width: 48px; height: 48px; border: 2.5px solid var(--clay-outline); border-radius: 15px; background: var(--secondary); color: var(--on-secondary); }
.week-dots { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; margin: 22px 0 10px; }
.day-dot { display: flex; flex-direction: column; align-items: center; gap: 7px; flex: 1; color: var(--body); font-size: 12px; font-weight: 700; }
.day-dot i {
  display: block;
  width: 26px; height: 26px;
  border: 2px solid var(--border);
  border-radius: 9px;
  background: var(--muted);
}
.day-dot.is-done i { border-color: var(--clay-outline); background: var(--secondary); box-shadow: inset -2px -2px 5px rgba(0,0,0,.12); }
.streak-note { padding-top: 12px; border-top: 2px solid var(--border); color: var(--body); font-size: 12px; }

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin: 28px 0 14px;
}
.section-heading h2 { color: var(--ink); font-size: 20px; font-weight: 800; }
.section-heading p { margin-top: 3px; color: var(--body); font-size: 13px; }
.section-heading a { font-size: 13px; font-weight: 800; color: var(--primary); white-space: nowrap; }

.mode-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 202px;
  padding: 18px;
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
}
.mode-card:hover { transform: translateY(-5px); }
.mode-symbol {
  display: grid;
  place-items: center;
  width: 58px; height: 58px;
  border: var(--bw) solid var(--clay-outline);
  border-radius: 17px;
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}
.mode-addsub .mode-symbol { background: var(--secondary); color: var(--on-secondary); font-size: 26px; }
.mode-muldiv .mode-symbol { background: var(--primary); color: var(--on-primary); font-size: 26px; }
.mode-mixed .mode-symbol { background: var(--accent); color: var(--on-accent); font-size: 17px; letter-spacing: 0; }
.mode-card h3 { margin-top: 15px; font-size: 18px; font-weight: 800; }
.mode-card p { margin-top: 5px; color: var(--body); font-size: 12px; line-height: 1.55; }
.mode-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 14px; color: var(--primary); font-size: 13px; font-weight: 800; }
.mode-card-foot .icon { width: 18px; height: 18px; transition: transform .2s var(--bounce); }
.mode-card:hover .mode-card-foot .icon { transform: translateX(4px); }

.single-ops {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 16px 20px;
  background: var(--card);
}
.single-ops-copy strong { display: block; color: var(--ink); font-size: 14px; font-weight: 800; }
.single-ops-copy span { display: block; margin-top: 2px; color: var(--body); font-size: 12px; }
.single-ops-links { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.op-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 14px;
  border: 2px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--card);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition: border-color .18s ease, color .18s ease, transform .18s var(--bounce);
}
.op-link:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }
.op-link b {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid var(--clay-outline);
  border-radius: 7px;
  background: var(--muted);
  color: var(--primary);
  font-size: 14px;
  font-weight: 800;
}

.bottom-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 18px; margin-top: 24px; }
.recent-card { padding: 20px; }
.recent-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.recent-head h2 { font-size: 18px; font-weight: 800; }
.recent-head a { font-size: 12px; font-weight: 800; color: var(--primary); }
.recent-list { display: grid; gap: 8px; }
.recent-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 11px;
  min-height: 58px;
  padding: 8px 10px;
  border: 2px solid var(--border);
  border-radius: 13px;
  background: var(--muted);
  color: inherit;
  text-decoration: none;
  transition: background-color .18s ease, border-color .18s ease;
}
.recent-item:hover { background: var(--card); border-color: var(--primary); }
.recent-symbol { display: grid; place-items: center; width: 38px; height: 38px; border: 2px solid var(--clay-outline); border-radius: 11px; background: var(--card); color: var(--primary); font-size: 18px; font-weight: 800; }
.recent-copy { min-width: 0; }
.recent-copy strong { display: block; color: var(--ink); font-size: 13px; font-weight: 800; }
.recent-copy span { display: block; margin-top: 2px; color: var(--body); font-size: 12px; }
.recent-score { color: var(--ink); font-size: 14px; font-weight: 800; }
.recent-time { color: var(--body); font-size: 12px; font-weight: 600; }

.review-cta { padding: 22px; display: flex; flex-direction: column; justify-content: space-between; background: var(--bg-soft); }
.review-cta-icon { display: grid; place-items: center; width: 50px; height: 50px; border: 2.5px solid var(--clay-outline); border-radius: 15px; background: var(--primary); color: var(--on-primary); }
.review-cta h2 { margin-top: 13px; font-size: 18px; font-weight: 800; }
.review-cta p { margin-top: 5px; color: var(--body); font-size: 12px; }
.review-cta .btn { margin-top: 16px; width: 100%; }

.empty-card { padding: 26px; text-align: center; color: var(--body); font-size: 13px; }

/* ---------- 8. Practice ---------- */
.practice-page { max-width: 1120px; }

.practice-welcome { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr); gap: 18px; }

.type-switch { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.type-option {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 66px;
  padding: 10px 14px;
  border: var(--bw) solid var(--border);
  border-radius: var(--r-ctl);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  transition: border-color .2s ease, background-color .24s var(--ease),
              color .24s var(--ease), transform .2s var(--bounce), box-shadow .2s ease;
}
.type-option:hover { border-color: var(--primary); transform: translateY(-2px); }
.type-option.is-active {
  background: var(--secondary);
  border-color: var(--clay-outline);
  color: var(--on-secondary);
  box-shadow: inset -2px -2px 6px rgba(0, 0, 0, .12), 0 4px 0 var(--clay-lo);
}
.type-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border: 2px solid var(--clay-outline);
  border-radius: 12px;
  background: var(--muted);
  color: var(--primary);
  font-size: 17px;
  font-weight: 800;
}
.type-option.is-active .type-icon { background: var(--card); color: var(--ink); }
.type-copy { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.type-copy strong { font-size: 14px; font-weight: 800; }
.type-copy small { margin-top: 2px; color: var(--body); font-size: 12px; }
.type-option.is-active .type-copy small { color: var(--on-secondary); opacity: .88; }

.start-card { padding: 30px; }
.mode-kicker { display: flex; align-items: center; gap: 9px; color: var(--primary); font-size: 12px; font-weight: 800; letter-spacing: .07em; }
.start-card h2 { margin-top: 10px; font-size: 29px; font-weight: 800; line-height: 1.25; }
.start-card > p { margin-top: 8px; max-width: 560px; color: var(--body); font-size: 14px; }
.start-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.start-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

.mode-hero { display: grid; place-items: center; padding: 28px; background: var(--bg-soft); }
.mode-hero-symbol {
  display: grid;
  place-items: center;
  width: 136px; height: 136px;
  border: var(--bw) solid var(--clay-outline);
  border-radius: 38px;
  background: var(--secondary);
  color: var(--on-secondary);
  font-size: 62px;
  font-weight: 800;
  line-height: 1;
  box-shadow: inset -5px -5px 14px rgba(0, 0, 0, .12), 0 10px 0 var(--clay-lo);
}
.mode-hero-label { margin-top: 18px; color: var(--ink); font-size: 16px; font-weight: 800; }
.mode-hero-sub { margin-top: 3px; color: var(--body); font-size: 12px; }

.practice-board { display: none; }
.practice-board.is-active { display: block; }
.practice-welcome.is-hidden { display: none; }

.practice-topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.practice-mode-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 15px; border: 2px solid var(--border); border-radius: var(--r-pill); background: var(--card); color: var(--ink); font-size: 13px; font-weight: 800; }
.timer-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 15px; border: 2px solid var(--clay-outline); border-radius: var(--r-pill); background: var(--card); color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 800; }
.timer-chip .icon { width: 18px; height: 18px; color: var(--primary); }

.practice-layout { display: grid; grid-template-columns: minmax(0, 1fr) 292px; gap: 18px; align-items: start; }

.question-card { display: flex; flex-direction: column; min-height: 490px; padding: 28px; }
.question-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.question-count { color: var(--body); font-size: 13px; font-weight: 700; }
.progress-bar { height: 10px; margin-top: 10px; border: 2px solid var(--border); border-radius: var(--r-pill); background: var(--muted); overflow: hidden; }
.progress-bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--secondary); transition: width .3s var(--ease); }

.equation {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  min-height: 150px;
  margin: 25px 0 15px;
  color: var(--ink);
  font-size: 64px;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.equation .operator { display: grid; place-items: center; width: 62px; height: 62px; border: 2.5px solid var(--clay-outline); border-radius: 18px; background: var(--secondary); color: var(--on-secondary); font-size: 38px; }
.equation .equals { color: var(--body); font-size: 44px; }

.answer-row { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.answer-input {
  width: min(100%, 240px);
  height: 78px;
  padding: 0 18px;
  border: var(--bw) solid var(--clay-outline);
  border-radius: 20px;
  background: var(--muted);
  color: var(--ink);
  font-size: 38px;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: inset -3px -3px 8px var(--clay-lo);
  transition: background-color .2s ease, box-shadow .2s ease;
}
.answer-input:focus { outline: none; background: var(--card); box-shadow: inset -3px -3px 8px var(--clay-lo), 0 0 0 4px var(--focus-halo); }
.answer-input.is-correct { border-color: var(--success); }
.answer-input.is-wrong { border-color: var(--danger); }
.answer-submit { min-width: 112px; height: 78px; border-radius: 20px; font-size: 18px; }

.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; width: min(100%, 350px); margin: 18px auto 0; }
.keypad button {
  min-height: 54px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font-size: 21px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset -2px -2px 5px var(--clay-lo);
  transition: transform .14s var(--bounce), background-color .16s ease, border-color .16s ease;
}
.keypad button:hover { border-color: var(--primary); background: var(--muted); }
.keypad button:active { transform: scale(.95); }
.keypad .key-clear { color: var(--danger); font-size: 15px; }
.keypad .key-submit { background: var(--secondary); color: var(--on-secondary); border-color: var(--clay-outline); font-size: 16px; }

.question-feedback {
  min-height: 28px;
  margin-top: 12px;
  color: var(--body);
  font-size: 15px;
  font-weight: 800;
  text-align: center;
}
.question-feedback.is-correct { color: var(--success); }
.question-feedback.is-wrong { color: var(--danger); }

.session-panel { padding: 20px; }
.session-panel h2 { font-size: 16px; font-weight: 800; }
.session-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 13px; }
.session-stat { padding: 11px; border: 2px solid var(--border); border-radius: 13px; background: var(--muted); }
.session-stat span { display: block; color: var(--body); font-size: 12px; font-weight: 700; }
.session-stat strong { display: block; margin-top: 3px; color: var(--ink); font-size: 21px; font-weight: 800; }
.session-divider { margin: 18px 0 13px; border: 0; border-top: 2px solid var(--border); }
.session-caption { color: var(--body); font-size: 12px; font-weight: 800; letter-spacing: .07em; }
.progress-text {
  margin-top: 6px;
  color: var(--body);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
/* 50 题的作答地图：10 列 × 5 行小方块 */
.progress-dots { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; margin-top: 7px; }
.progress-dot { aspect-ratio: 1; border: 2px solid var(--border); border-radius: 4px; background: var(--muted); }
.progress-dot.is-current { border-color: var(--primary); background: var(--card); box-shadow: 0 0 0 2px var(--focus-halo); }
.progress-dot.is-correct { border-color: var(--success); background: var(--success); }
.progress-dot.is-wrong { border-color: var(--danger); background: var(--danger); }
.practice-tip { margin-top: 16px; padding: 12px; border-radius: 13px; background: var(--bg-soft); color: var(--body); font-size: 12px; line-height: 1.55; }
.practice-tip strong { color: var(--ink); }
.quit-btn { width: 100%; margin-top: 14px; }

.practice-complete {
  display: none;
  padding: 42px 30px;
  text-align: center;
  background: var(--card);
}
.practice-complete.is-visible { display: block; }
.complete-badge { display: inline-grid; place-items: center; width: 84px; height: 84px; margin: 0 auto 12px; border: var(--bw) solid var(--clay-outline); border-radius: 50%; background: var(--secondary); color: var(--on-secondary); box-shadow: inset -3px -3px 9px rgba(0,0,0,.12); }
.complete-badge .icon { width: 38px; height: 38px; stroke-width: 2.3; }
.practice-complete h2 { font-size: 30px; font-weight: 800; }
.practice-complete p { margin-top: 6px; color: var(--body); font-size: 14px; }
.complete-score { margin-top: 18px; color: var(--primary); font-size: 48px; font-weight: 800; line-height: 1; }
.complete-score small { color: var(--body); font-size: 16px; }
.complete-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

/* ---------- 9. Result ---------- */
.result-page { max-width: 1080px; }

.result-hero {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  align-items: center;
  gap: 28px;
  padding: 28px;
  background: var(--bg-soft);
}
.score-ring { position: relative; display: grid; place-items: center; width: 210px; height: 210px; margin: 0 auto; }
.score-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring .score-track { fill: none; stroke: var(--card); stroke-width: 14; }
.score-ring .score-progress { fill: none; stroke: var(--primary); stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset .75s var(--ease); }
.score-ring-copy { position: relative; z-index: 2; text-align: center; }
.score-ring-copy strong { display: block; color: var(--ink); font-size: 57px; font-weight: 800; line-height: 1; }
.score-ring-copy span { display: block; margin-top: 5px; color: var(--body); font-size: 13px; font-weight: 700; }
.stars { display: flex; align-items: center; gap: 5px; margin-bottom: 9px; }
.star { width: 23px; height: 23px; color: var(--border); fill: currentColor; }
.star.is-filled { color: var(--secondary); }
.result-copy h1, .result-copy .result-title { font-size: 30px; font-weight: 800; line-height: 1.2; }
.result-copy > p { margin-top: 7px; max-width: 560px; color: var(--body); font-size: 14px; }
.result-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 19px; }

.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 17px; }
.result-stat { padding: 17px; text-align: center; }
.result-stat span { display: block; color: var(--body); font-size: 12px; font-weight: 700; }
.result-stat strong { display: block; margin-top: 4px; color: var(--ink); font-size: 25px; font-weight: 800; }

.result-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: 18px; margin-top: 17px; }
.review-card { padding: 20px; }
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.review-head h2 { font-size: 18px; font-weight: 800; }
.review-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.review-tools .filter-chip { min-height: 44px; }
.review-list { display: grid; gap: 8px; margin-top: 13px; }
.review-item { border: 2px solid var(--border); border-radius: 12px; background: var(--muted); overflow: hidden; }
.review-item summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 49px; padding: 8px 12px; cursor: pointer; list-style: none; }
.review-item summary::-webkit-details-marker { display: none; }
.review-item summary strong { color: var(--ink); font-size: 13px; font-weight: 800; }
.review-item summary span { color: var(--body); font-size: 12px; font-weight: 700; }
.review-item[open] summary { border-bottom: 2px solid var(--border); }
.review-body { padding: 10px 12px; color: var(--body); font-size: 12px; }
.review-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: var(--r-pill); font-size: 12px; font-weight: 800; }
.review-badge.is-ok { background: var(--success); color: var(--on-primary); }
.review-badge.is-no { background: var(--danger); color: var(--on-primary); }

.insight-card { padding: 20px; display: flex; flex-direction: column; gap: 13px; }
.insight-card h2 { font-size: 18px; font-weight: 800; }
.insight-row { display: flex; align-items: flex-start; gap: 10px; color: var(--body); font-size: 12px; line-height: 1.55; }
.insight-icon { display: grid; place-items: center; width: 35px; height: 35px; flex: none; border: 2px solid var(--border); border-radius: 11px; background: var(--muted); color: var(--primary); }
.insight-row strong { color: var(--ink); }

/* ---------- 10. Parent ---------- */
.parent-page { max-width: 1180px; }

.parent-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.parent-summary .stat-card { min-height: 102px; }

.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 14px; flex-wrap: wrap; }
.filter-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 13px;
  border: 2px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--card);
  color: var(--body);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .18s var(--bounce);
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip[aria-pressed="true"] { background: var(--primary); border-color: var(--clay-outline); color: var(--on-primary); transform: translateY(-1px); }
.filter-count { opacity: 1; font-size: 12px; font-variant-numeric: tabular-nums; }

.parent-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 18px; }
.chart-card { padding: 22px; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.chart-head h2 { font-size: 18px; font-weight: 800; }
.chart-head p { margin-top: 3px; color: var(--body); font-size: 12px; }
.chart-legend { display: inline-flex; align-items: center; gap: 6px; color: var(--body); font-size: 12px; font-weight: 700; white-space: nowrap; }
.legend-swatch { width: 13px; height: 13px; border: 2px solid var(--clay-outline); border-radius: 4px; background: var(--secondary); }

.bar-chart {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 7px;
  height: 230px;
  margin-top: 17px;
  padding: 24px 4px 31px;
  border-bottom: 2px solid var(--border);
}
.chart-bar {
  position: relative;
  display: flex;
  flex: 1;
  align-items: flex-end;
  justify-content: center;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.bar-fill {
  display: block;
  width: min(100%, 42px);
  min-height: 10px;
  border: 2px solid var(--clay-outline);
  border-radius: 8px 8px 3px 3px;
  background: var(--primary);
  box-shadow: inset -2px -2px 5px rgba(0, 0, 0, .14);
  transition: transform .18s var(--bounce), background-color .18s ease;
}
.chart-bar:hover .bar-fill, .chart-bar:focus-visible .bar-fill { transform: translateY(-4px); background: var(--secondary); }
.bar-value { position: absolute; top: -19px; left: 50%; color: var(--ink); font-size: 12px; font-weight: 800; transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.bar-label { position: absolute; bottom: -29px; left: 50%; color: var(--body); font-size: 11px; font-weight: 700; white-space: nowrap; transform: translateX(-50%); }
.bar-tooltip {
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  z-index: 5;
  padding: 5px 8px;
  border: 2px solid var(--clay-outline);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity .16s ease, transform .16s ease;
}
.chart-bar:hover .bar-tooltip, .chart-bar:focus-visible .bar-tooltip { opacity: 1; transform: translate(-50%, 0); }
.chart-empty { display: grid; place-items: center; height: 190px; color: var(--body); font-size: 13px; text-align: center; }

.records-card { padding: 22px; grid-column: 1 / -1; }
.records-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.records-head h2 { font-size: 18px; font-weight: 800; }
.records-head p { color: var(--body); font-size: 12px; }
.table-wrap { margin-top: 13px; overflow-x: auto; border: 2px solid var(--border); border-radius: 14px; }
.records-table { width: 100%; min-width: 570px; border-collapse: collapse; font-size: 13px; }
.records-table caption { text-align: left; }
.records-table th { padding: 11px 12px; background: var(--muted); color: var(--body); font-size: 12px; font-weight: 800; text-align: left; white-space: nowrap; }
.records-table td { padding: 11px 12px; border-top: 2px solid var(--border); color: var(--ink); vertical-align: middle; }
.records-table tbody tr:hover { background: var(--muted); }
.mode-tag { display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 3px 9px; border: 2px solid var(--border); border-radius: var(--r-pill); background: var(--card); color: var(--body); font-size: 12px; font-weight: 800; white-space: nowrap; }
.score-cell { font-weight: 800; font-variant-numeric: tabular-nums; }
.time-cell { font-variant-numeric: tabular-nums; color: var(--body); }

.parent-side { display: grid; gap: 18px; align-content: start; }
.parent-child-card { padding: 20px; }
.child-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px; border: 2px solid var(--border); border-radius: 14px; background: var(--muted); }
.child-row .avatar { width: 48px; height: 48px; border-radius: 15px; }
.child-name { color: var(--ink); font-size: 15px; font-weight: 800; }
.child-meta { color: var(--body); font-size: 12px; }
.parent-tip { padding: 20px; background: var(--bg-soft); }
.parent-tip h2 { font-size: 17px; font-weight: 800; }
.parent-tip p { margin-top: 6px; color: var(--body); font-size: 12px; line-height: 1.6; }

/* ---------- 11. Dialog ---------- */
dialog.modal {
  width: min(92vw, 430px);
  padding: 0;
  border: 0;
  border-radius: var(--r-card);
  background: transparent;
  color: var(--ink);
}
dialog.modal::backdrop { background: rgba(15, 23, 42, .54); backdrop-filter: blur(3px); }
.modal-card { padding: 24px; }
.modal-card h2 { font-size: 21px; font-weight: 800; }
.modal-card p { margin-top: 7px; color: var(--body); font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; flex-wrap: wrap; }

/* ---------- 12. Responsive ---------- */
@media (max-width: 1240px) {
  .mode-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  :root { --sidebar-w: 218px; }
  .app-topbar { padding-inline: 22px; }
  .page { padding-inline: 22px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.45fr) minmax(240px, .75fr); }
  .practice-layout { grid-template-columns: minmax(0, 1fr) 266px; }
  .parent-grid { grid-template-columns: minmax(0, 1fr) 260px; }
}

@media (max-width: 920px) {
  .auth-shell { grid-template-columns: minmax(0, 1fr); }
  .auth-stage { min-height: 380px; padding: 82px 20px 26px; }
  .auth-brand { top: 20px; left: 20px; }
  .auth-panel { border-left: 0; border-top: var(--bw) solid var(--border); padding: 74px 20px 38px; }
  .auth-panel-top { top: 16px; right: 18px; }
  .mascot-stage { width: min(100%, 360px); }
  .mascot-slot[data-slot="orange"] { width: 108px; }
  .mascot-slot[data-slot="purple"] { width: 88px; }
  .mascot-slot[data-slot="black"] { width: 74px; }
  .mascot-slot[data-slot="yellow"] { width: 100px; }
  .mascot-grid { column-gap: 18px; }

  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 25;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px 16px;
    height: auto;
    padding: 10px 16px;
    border-right: 0;
    border-bottom: var(--bw) solid var(--border);
  }
  .sidebar .brand-mark { width: 38px; height: 38px; border-radius: 12px; font-size: 18px; }
  .sidebar .brand-name { font-size: 16px; }
  .sidebar .brand-sub { display: none; }
  .sidebar-nav { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; width: 100%; }
  .nav-label, .sidebar-spacer, .sidebar-tip, .sidebar-user { display: none; }
  .nav-item {
    justify-content: center;
    min-height: 44px;
    padding: 0 7px;
    font-size: 12px;
    gap: 6px;
  }
  .nav-item .icon { width: 17px; height: 17px; }
  .nav-item:hover { transform: none; }
  .app-topbar { position: static; min-height: 62px; padding: 10px 18px; }
  .topbar-date, .topbar-divider { display: none; }
  .user-chip-copy { display: none; }
  .user-chip { padding: 4px; border: 0; background: transparent; }
  .user-chip .avatar { width: 40px; height: 40px; }
  .page { padding: 22px 18px 38px; }
  .help-page .page { max-width: none; }

  .page-head { margin-bottom: 20px; }
  .page-head h1 { font-size: 26px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .daily-card { min-height: 220px; }
  .bottom-grid { grid-template-columns: minmax(0, 1fr); }
  .practice-welcome { grid-template-columns: minmax(0, 1fr); }
  .mode-hero { display: none; }
  .practice-layout { grid-template-columns: minmax(0, 1fr); }
  .session-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
  .session-panel h2, .session-divider, .session-caption, .progress-dots, .practice-tip, .quit-btn { grid-column: 1 / -1; }
  .session-divider { margin: 3px 0 1px; }
  .quit-btn { margin-top: 0; }
  .result-hero { grid-template-columns: 190px minmax(0, 1fr); gap: 20px; }
  .score-ring { width: 170px; height: 170px; }
  .score-ring-copy strong { font-size: 47px; }
  .parent-grid { grid-template-columns: minmax(0, 1fr); }
  .parent-side { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .page-head { flex-direction: column; gap: 13px; }
  .page-head-actions { width: 100%; }
  .today-chip { flex: 1; justify-content: center; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { min-height: 84px; padding: 12px; }
  .stat-icon { width: 42px; height: 42px; border-radius: 13px; }
  .stat-value { font-size: 21px; }
  .daily-card { align-items: flex-start; flex-direction: column; gap: 18px; }
  .goal-ring { width: 126px; height: 126px; align-self: flex-end; margin-top: -8px; }
  .mode-grid { grid-template-columns: 1fr; }
  .mode-card { min-height: 188px; padding: 15px; }
  .type-switch { grid-template-columns: minmax(0, 1fr); }
  .single-ops { align-items: flex-start; flex-direction: column; }
  .result-hero { grid-template-columns: minmax(0, 1fr); text-align: center; }
  .result-copy { text-align: center; }
  .result-copy > p { margin-inline: auto; }
  .stars, .result-meta, .result-actions { justify-content: center; }
  .result-grid { grid-template-columns: minmax(0, 1fr); }
  .parent-summary { grid-template-columns: 1fr 1fr; }
  .parent-side { grid-template-columns: minmax(0, 1fr); }
  .chart-card { overflow: hidden; }
  .bar-label { font-size: 11px; }
  .app-topbar { padding-inline: 15px; }
  .theme-switch span:last-child { display: none; }
}

@media (max-width: 560px) {
  .auth-stage { min-height: 330px; padding-top: 78px; }
  .auth-card { padding: 24px 18px 20px; }
  .auth-card h1 { font-size: 24px; }
  .auth-panel { padding: 72px 14px 30px; }
  .auth-panel-top { top: 12px; right: 12px; }
  .auth-home-link span { display: none; }
  .auth-home-link { width: 44px; padding: 0; justify-content: center; }
  .mascot-stage { width: 282px; }
  .mascot-slot[data-slot="orange"] { width: 90px; }
  .mascot-slot[data-slot="purple"] { width: 74px; }
  .mascot-slot[data-slot="black"] { width: 61px; }
  .mascot-slot[data-slot="yellow"] { width: 84px; }
  .mascot-grid { column-gap: 12px; row-gap: 2px; }
  .stage-confetti i.c-mid { display: none; }
  .sidebar { grid-template-columns: auto 1fr; padding: 9px 12px; }
  .sidebar .brand-sub { display: none; }
  .sidebar-nav {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .sidebar-nav::-webkit-scrollbar { display: none; }
  .nav-item { flex: 0 0 auto; min-width: 94px; }
  .topbar-title strong { font-size: 13px; }
  .page { padding-inline: 14px; }
  .page-head h1 { font-size: 23px; }
  .stats-grid { grid-template-columns: 1fr; }
  .mode-grid { grid-template-columns: 1fr; }
  .mode-card { min-height: 168px; }
  .daily-card h2 { font-size: 25px; }
  .daily-actions { width: 100%; }
  .daily-actions .btn { flex: 1; }
  .practice-topbar { align-items: stretch; }
  .practice-mode-chip, .timer-chip { flex: 1; justify-content: center; }
  .question-card { padding: 20px 14px; min-height: 500px; }
  .equation { gap: 8px; font-size: 44px; margin-top: 18px; }
  .equation .operator { width: 48px; height: 48px; border-radius: 14px; font-size: 29px; }
  .equation .equals { font-size: 34px; }
  .answer-input { width: 150px; height: 68px; font-size: 32px; }
  .answer-submit { height: 68px; min-width: 100px; }
  .keypad { width: 100%; }
  .keypad button { min-height: 52px; }
  .session-panel { grid-template-columns: 1fr 1fr; padding: 16px; }
  .complete-actions .btn { flex: 1; }
  .result-hero { padding: 20px 14px; }
  .result-stats { grid-template-columns: 1fr 1fr; }
  .result-stat:last-child { grid-column: 1 / -1; }
  .parent-summary { grid-template-columns: 1fr 1fr; }
  .filter-bar { align-items: flex-start; flex-direction: column; }
  .filter-group { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; scrollbar-width: none; }
  .filter-group::-webkit-scrollbar { display: none; }
  .filter-chip { flex: 0 0 auto; }
  .bar-chart { gap: 3px; height: 190px; }
  .bar-fill { width: 80%; }
  .bar-value { font-size: 11px; }
  .bar-label { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .mascot-float, .stage-confetti i, .mascot.singing, .mascot.react-sad,
  .mascot.react-happy, .note-float, .page { animation: none; }
  .mascot, .btn, .theme-switch-knob, .theme-switch-track,
  .bar-fill, .progress-bar span, .score-ring .score-progress { transition-duration: .01ms; }
}



