@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;700;800&family=Nunito:wght@400;600;700;800&display=swap');
/* An element with the hidden attribute must stay hidden even when a class gives it a display value. */
[hidden] { display: none !important; }

:root {
  --bg: #F6F3EC;
  --bg-wash: #EFE9FB;
  --surface: #FFFFFF;
  --surface-2: #F3F1EA;
  --border: #E4E1D6;
  --text-primary: #2C2C2A;
  --text-secondary: #6B6A63;
  --text-muted: #9A988F;

  --purple: #7F77DD;
  --purple-light: #A79FF0;
  --purple-mid: #8F87E8;
  --purple-deep: #6a61cf;
  --purple-bg: #EEEDFE;
  --purple-dark: #3C3489;
  --teal: #1D9E75;
  --teal-bg: #E1F5EE;
  --teal-dark: #085041;
  --coral: #D85A30;
  --coral-bg: #FAECE7;
  --coral-dark: #993C1D;
  --amber: #EF9F27;
  --amber-bg: #FAEEDA;
  --amber-dark: #854F0B;
  --red: #E24B4A;
  --red-bg: #FCEBEB;
  --red-dark: #791F1F;

  /* ---- liquid-glass tokens: translucent surfaces over a soft color-mesh
     background, so backdrop-filter has something worth blurring ---- */
  --glass-surface: rgba(255, 255, 255, 0.52);
  --glass-surface-strong: rgba(255, 255, 255, 0.74);
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-highlight: rgba(255, 255, 255, 0.85);
  --glass-shadow: 0 10px 30px rgba(40, 35, 70, 0.10), 0 1px 2px rgba(40,35,70,.05);
  --glass-blur: 24px;
  --mesh-1: rgba(127,119,221,.32);
  --mesh-2: rgba(29,158,117,.20);
  --mesh-3: rgba(216,90,48,.15);

  --radius: 16px;
  --radius-pill: 999px;
  --font-display: "Baloo 2", "Nunito", sans-serif;
  --font-body: "Nunito", -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #131318;
  --bg-wash: #201C33;
  --surface: #212024;
  --surface-2: #2A292E;
  --border: #3A393F;
  --text-primary: #F1EFE8;
  --text-secondary: #B4B2A9;
  --text-muted: #7E7D77;

  --purple-bg: #2A2560;
  --purple-dark: #AFA9EC;
  --teal-bg: #0B3A30;
  --teal-dark: #5DCAA5;
  --coral-bg: #4A2415;
  --coral-dark: #F0997B;
  --amber-bg: #4A3208;
  --amber-dark: #FAC775;
  --red-bg: #4A1414;
  --red-dark: #F09595;

  --glass-surface: rgba(42, 41, 48, 0.55);
  --glass-surface-strong: rgba(42, 41, 48, 0.78);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-highlight: rgba(255, 255, 255, 0.12);
  --glass-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0,0,0,.3);
  --mesh-1: rgba(143, 135, 232, .28);
  --mesh-2: rgba(93, 202, 165, .16);
  --mesh-3: rgba(240, 153, 123, .12);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131318;
    --bg-wash: #201C33;
    --surface: #212024;
    --surface-2: #2A292E;
    --border: #3A393F;
    --text-primary: #F1EFE8;
    --text-secondary: #B4B2A9;
    --text-muted: #7E7D77;

    --purple-bg: #2A2560;
    --purple-dark: #AFA9EC;
    --teal-bg: #0B3A30;
    --teal-dark: #5DCAA5;
    --coral-bg: #4A2415;
    --coral-dark: #F0997B;
    --amber-bg: #4A3208;
    --amber-dark: #FAC775;
    --red-bg: #4A1414;
    --red-dark: #F09595;

    --glass-surface: rgba(42, 41, 48, 0.55);
    --glass-surface-strong: rgba(42, 41, 48, 0.78);
    --glass-border: rgba(255, 255, 255, 0.09);
    --glass-highlight: rgba(255, 255, 255, 0.12);
    --glass-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0,0,0,.3);
    --mesh-1: rgba(143, 135, 232, .28);
    --mesh-2: rgba(93, 202, 165, .16);
    --mesh-3: rgba(240, 153, 123, .12);
    color-scheme: dark;
  }
}

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

/* Kill the default focus ring on tap/click (that's the blue box) but keep
   one for keyboard navigation via :focus-visible, so accessibility doesn't
   just get thrown away along with the ugly default. */
button, a, input, select, textarea, [tabindex] {
  outline: none;
}
button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background:
    radial-gradient(900px 600px at 8% -8%, var(--mesh-1), transparent 60%),
    radial-gradient(800px 550px at 105% 4%, var(--mesh-2), transparent 55%),
    radial-gradient(750px 550px at 46% 108%, var(--mesh-3), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text-primary);
  padding-bottom: 3rem;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; }

/* ---- top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  padding: 6px 14px 6px 6px;
  border-radius: var(--radius-pill);
}

.badge-streak { background: var(--coral-bg); color: var(--coral-dark); }
.badge-xp { background: var(--amber-bg); color: var(--amber-dark); }

/* ---- 3D bubble icons: radial gradient + glow + glossy inner highlight ---- */
.icon-3d {
  --c1: #fff; --c2: #ccc; --c3: #999; --glow: rgba(0,0,0,.4);
  width: 26px; height: 26px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  position: relative; flex: none;
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,.85), rgba(255,255,255,0) 38%),
    radial-gradient(circle at 35% 30%, var(--c1), var(--c2) 55%, var(--c3) 100%);
  box-shadow: 0 0 9px 1px var(--glow), inset 0 -2px 3px rgba(0,0,0,.25);
}
.icon-3d svg { color: #fff; filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.icon-3d.flame { --c1:#FF9E6E; --c2:#D85A30; --c3:#A83E1D; --glow: rgba(216,90,48,.55); }
.icon-3d.bolt  { --c1:#FFD98A; --c2:#EF9F27; --c3:#B4740F; --glow: rgba(239,159,39,.55); }
.icon-3d.purple{ --c1:#C3BDF5; --c2:#7F77DD; --c3:#544BB8; --glow: rgba(127,119,221,.5); }
.icon-3d.teal  { --c1:#7BDDB8; --c2:#1D9E75; --c3:#0F6E56; --glow: rgba(29,158,117,.5); }

.icon-3d.sm { width: 40px; height: 40px; border-radius: 15px; }
.icon-3d.sm.square {
  background:
    radial-gradient(circle at 32% 26%, rgba(255,255,255,.8), rgba(255,255,255,0) 40%),
    radial-gradient(circle at 35% 30%, var(--c1), var(--c2) 55%, var(--c3) 100%);
}

@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.22); }
  100% { transform: scale(1); }
}
.pop { animation: pop .35s ease; }

.theme-toggle {
  border: 1px solid var(--glass-border);
  background: var(--glass-surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  color: var(--text-secondary);
  width: 38px; height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
  transition: transform .1s ease;
}
.theme-toggle:active { transform: scale(0.92); }

/* ---- goal progress ---- */
.goal-block {
  margin: 12px 0 4px; background: var(--glass-surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border: 1px solid var(--glass-border); border-radius: 22px;
  padding: 16px 18px; box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
}
.goal-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; font-weight: 600;
}
.goal-label strong { color: var(--text-primary); font-family: var(--font-display); font-size: 15px; }
.goal-bar {
  height: 10px; border-radius: var(--radius-pill);
  background: var(--purple-bg); overflow: hidden;
}
.goal-fill {
  height: 100%; border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--purple), var(--purple-light));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45);
  transition: width .4s ease;
}

/* ---- exam track toggle ---- */
.exam-track-block {
  margin: 12px 0 4px; background: var(--glass-surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border: 1px solid var(--glass-border); border-radius: 22px;
  padding: 12px 14px; box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
}
.exam-track-label {
  font-size: 12px; color: var(--text-secondary); font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; margin: 2px 6px 8px;
}
.exam-track-tabs { display: flex; gap: 8px; }
.exam-track-tab {
  flex: 1; padding: 10px 8px; border-radius: 14px; border: 1.5px solid var(--glass-border);
  background: transparent; color: var(--text-secondary); font-weight: 800;
  font-size: 14px; cursor: pointer; font-family: var(--font-display);
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.exam-track-tab.active[data-track="CAT"] { border-color: var(--purple); color: var(--purple); background: var(--purple-bg); }
.exam-track-tab.active[data-track="NMAT"] { border-color: var(--teal); color: var(--teal); background: var(--teal-bg); }

/* ---- countdown widget ---- */
.countdown-block {
  margin: 12px 0 4px; background: var(--glass-surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border: 1px solid var(--glass-border); border-radius: 22px;
  padding: 14px 18px; box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
  display: flex; align-items: center; gap: 12px;
}
.countdown-days {
  font-family: var(--font-display); font-weight: 800; font-size: 22px; color: var(--purple);
  line-height: 1;
}
.countdown-text { font-size: 13px; color: var(--text-secondary); font-weight: 600; }
.countdown-text strong { color: var(--text-primary); }

/* ---- weekly accuracy chart ---- */
.chart-card {
  margin: 14px 0; background: var(--glass-surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border: 1px solid var(--glass-border); border-radius: 22px;
  padding: 16px 18px; box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
}
.chart-card h2 { font-size: 15px; margin: 0 0 2px; }
.chart-card .hint { margin: 0 0 12px; }
.chart-bar-label { font-size: 10px; fill: var(--text-muted); font-family: var(--font-body); }
.chart-bar-value { font-size: 10px; fill: var(--text-secondary); font-weight: 700; font-family: var(--font-body); }

/* ---- mock test ---- */
.mock-timer-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin: 14px 0; gap: 10px;
}
.mock-timer {
  font-family: var(--font-display); font-weight: 800; font-size: 18px;
  padding: 7px 16px; border-radius: var(--radius-pill);
  background: var(--purple-bg); color: var(--purple);
  border: 1px solid var(--glass-border);
}
.mock-timer.low { background: var(--red-bg); color: var(--red-dark); animation: flicker 1.4s ease-in-out infinite; }
.mock-qcounter { font-size: 13px; color: var(--text-secondary); font-weight: 700; }
.mock-nav-row { display: flex; gap: 8px; margin-top: 14px; }

.mock-tools { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.mock-tool {
  font-family: var(--font-body); font-weight: 800; font-size: 13px; cursor: pointer;
  padding: 8px 14px; border-radius: var(--radius-pill); border: 1.5px solid var(--border);
  background: var(--surface-2); color: var(--text-secondary);
}
.mock-tool.on { background: var(--purple-bg); border-color: var(--purple); color: var(--purple-dark); }
.mock-tool:disabled { opacity: .45; cursor: default; }
.mock-hint { font-size: 12px; color: var(--text-muted); text-align: center; margin: 12px 0 0; }
.mock-review-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }

/* question palette: the numbers along the bottom of the screen, like the real exam */
body.has-palette .wrap { padding-bottom: 96px; }
#mock-palette { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; flex-direction: column; align-items: stretch; }
.pal-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -6px 20px rgba(40, 35, 70, .10);
}
.pal-toggle {
  flex: none; font-family: var(--font-body); font-weight: 800; font-size: 12.5px; cursor: pointer;
  padding: 9px 12px; border-radius: 12px; border: 1.5px solid var(--purple); background: var(--purple-bg); color: var(--purple-dark);
}
.pal-strip { flex: 1; min-width: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 3px 2px; justify-content: flex-start; }
.pal-strip::-webkit-scrollbar { display: none; }
@media (min-width: 700px) { .pal-strip { justify-content: flex-end; } }
.pal-num {
  flex: none; width: 36px; height: 36px; border-radius: 10px; font-family: var(--font-body); font-weight: 800; font-size: 14px;
  cursor: pointer; border: 1.5px solid var(--border); background: var(--surface-2); color: var(--text-muted); padding: 0;
}
.pal-num.answered { background: var(--teal-bg); border-color: var(--teal); color: var(--teal-dark); }
.pal-num.unanswered { background: var(--red-bg); border-color: var(--red); color: var(--red-dark); }
.pal-num.marked { background: var(--purple-bg); border-color: var(--purple); color: var(--purple-dark); border-radius: 50%; }
.pal-num.answered-marked { background: var(--purple-bg); border-color: var(--teal); color: var(--purple-dark); border-radius: 50%; box-shadow: inset 0 -5px 0 var(--teal); }
.pal-num.current { outline: 2.5px solid var(--purple-dark); outline-offset: 1px; }
.pal-sheet {
  background: var(--surface); border-top: 1px solid var(--border); border-radius: 18px 18px 0 0; padding: 14px 14px 10px;
  max-height: 55vh; overflow-y: auto; box-shadow: 0 -10px 30px rgba(40, 35, 70, .16);
}
.pal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; font-weight: 700; color: var(--text-secondary); margin-bottom: 12px; }
.pal-dot { display: inline-block; width: 11px; height: 11px; border-radius: 4px; margin-right: 5px; vertical-align: -1px; border: 1.5px solid var(--border); background: var(--surface-2); }
.pal-dot.answered { background: var(--teal-bg); border-color: var(--teal); }
.pal-dot.unanswered { background: var(--red-bg); border-color: var(--red); }
.pal-dot.marked { background: var(--purple-bg); border-color: var(--purple); border-radius: 50%; }
.pal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 8px; justify-items: center; }
.pal-submit { width: 100%; margin-top: 14px; }
.mock-nav-row .btn { margin-top: 0; flex: 1; }
.mock-result-score {
  text-align: center; padding: 10px 0 4px;
}
.mock-result-score .big { font-family: var(--font-display); font-size: 40px; font-weight: 800; }
.mock-result-score .sub { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }
.mock-topic-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 0; border-top: 0.5px solid var(--border); font-size: 13.5px;
}
.mock-topic-row:first-of-type { border-top: none; }
.mock-topic-row .count { font-weight: 800; color: var(--text-secondary); }
.mock-review-item {
  background: var(--glass-surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border: 1px solid var(--glass-border); border-radius: 20px;
  padding: 14px; margin-top: 10px;
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
}
.mock-review-item .q-text { font-size: 13.5px; margin: 0 0 8px; font-weight: 600; }
.mock-review-item .answer-line { font-size: 12.5px; margin: 3px 0; }
.mock-review-item .answer-line.wrong { color: var(--red-dark); }
.mock-review-item .answer-line.right { color: var(--teal-dark); }
.mock-review-item .explanation { font-size: 12.5px; color: var(--text-secondary); margin-top: 6px; line-height: 1.5; }

/* ---- weak topics ---- */
.weak-topics-card {
  background: var(--glass-surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: 22px; padding: 16px 18px; margin: 4px 0 20px;
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
}
.weak-topics-card h2 { font-size: 15px; margin: 0 0 4px; font-family: var(--font-display); }
.weak-topics-card .hint { font-size: 12.5px; color: var(--text-secondary); margin: 0 0 10px; line-height: 1.5; }
.weak-topic-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 0; border-top: 0.5px solid var(--border);
}
.weak-topic-row:first-of-type { border-top: none; padding-top: 4px; }
.weak-topic-name { font-weight: 700; font-size: 13.5px; }
.weak-topic-acc { font-size: 11.5px; color: var(--red-dark); font-weight: 800; display: block; margin-top: 1px; }
.weak-topic-practice {
  font-size: 12px; font-weight: 800; color: var(--purple); text-decoration: none;
  padding: 6px 12px; border-radius: var(--radius-pill); background: var(--purple-bg); white-space: nowrap;
}

/* ---- topic cards (home) ---- */
h1 { font-size: 23px; margin: 20px 0 4px; letter-spacing: -.01em; }
.subtitle { color: var(--text-secondary); font-size: 14px; margin: 0 0 16px; }

.topic-sections { display: block; }
.topic-grid { display: flex; flex-direction: column; gap: 10px; }

.section-heading {
  font-family: var(--font-display); font-size: 19px; font-weight: 700;
  margin: 26px 0 4px; padding-top: 16px; border-top: 0.5px solid var(--border);
}
.topic-sections > .section-heading:first-child,
#formula-sections > .section-heading:first-child { margin-top: 6px; padding-top: 0; border-top: none; }
.section-subheading {
  font-size: 11px; font-weight: 800; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em; margin: 12px 0 2px;
}
.topic-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--glass-surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: 20px; padding: 13px 15px 13px 13px;
  text-decoration: none; color: inherit;
  cursor: pointer;
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.topic-card:hover { box-shadow: 0 14px 34px rgba(40,35,70,.14), inset 0 1px 0 var(--glass-highlight); transform: translateY(-2px); background: var(--glass-surface-strong); }
.topic-card:active { transform: scale(0.98); }
.topic-card-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topic-card-main { display: flex; align-items: center; gap: 12px; }
.topic-name { font-weight: 800; font-size: 15px; font-family: var(--font-display); }
.topic-meta { font-size: 12px; color: var(--text-muted); margin-top: 1px; font-weight: 600; }
.topic-card-main .topic-name, .topic-card-main .topic-meta { display: block; }
.topic-arrow { color: var(--text-muted); flex: none; }
.topic-progress-track { height: 5px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; }
.topic-progress-fill { height: 100%; background: linear-gradient(90deg, var(--teal), #4FC79A); border-radius: var(--radius-pill); transition: width .4s ease; }
.topic-today-badge {
  display: inline-flex; align-items: center; gap: 3px; align-self: flex-start;
  font-size: 10.5px; font-weight: 800; color: var(--text-muted);
  background: var(--surface-2); padding: 3px 8px; border-radius: var(--radius-pill);
}
.topic-today-badge.met { color: var(--teal-dark); background: var(--teal-bg); }
.topic-today-badge svg { flex: none; }

.mock-cta {
  margin-top: 24px; padding: 20px; border-radius: 24px;
  background: linear-gradient(135deg, var(--purple), var(--purple-deep));
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  text-decoration: none; cursor: pointer; border: none; width: 100%;
  font: inherit; box-shadow: 0 10px 28px color-mix(in srgb, var(--purple) 45%, transparent), inset 0 1px 0 rgba(255,255,255,.35);
}
.mock-cta strong { display: block; font-family: var(--font-display); font-size: 16px; }
.mock-cta span { font-size: 12px; opacity: 0.85; }
.mock-cta:disabled { opacity: .55; cursor: default; box-shadow: none; }

/* ---- practice screen ---- */
.progress-row { display: flex; align-items: center; gap: 8px; margin: 14px 0; }
.progress-track { flex: 1; height: 7px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--teal), #4FC79A); border-radius: var(--radius-pill); transition: width .3s ease; }
.progress-count { font-size: 12px; color: var(--text-muted); white-space: nowrap; font-weight: 700; }

.q-card {
  background: var(--glass-surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: 26px; padding: 22px; margin-top: 8px;
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
  animation: card-in .25s ease;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.tag-row { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tag {
  font-size: 11px; font-weight: 800; padding: 4px 11px;
  border-radius: var(--radius-pill); letter-spacing: .01em;
  background: var(--coral-bg); color: var(--coral-dark);
}
.tag.review { background: var(--amber-bg); color: var(--amber-dark); }
.tag.goal { background: var(--purple-bg); color: var(--purple); }
.tag.cat-level {
  background: linear-gradient(135deg, #2C2C2A, #54524A); color: #FFD98A;
  font-weight: 800; box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}
.tag.nmat-level {
  background: linear-gradient(135deg, #1B3A5C, #2F5C8A); color: #9FD3FF;
  font-weight: 800; box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}

.bookmark-btn {
  margin-left: auto; width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid var(--glass-border); background: var(--glass-surface);
  color: var(--text-secondary); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform .1s ease, color .15s ease, border-color .15s ease;
}
.bookmark-btn:active { transform: scale(0.9); }
.bookmark-btn.active { color: var(--amber-dark); border-color: var(--amber-dark); background: var(--amber-bg); }

.q-text { font-size: 17px; line-height: 1.55; margin: 0 0 18px; font-weight: 600; white-space: pre-line; }  /* numbered sentences (para jumbles) stay on their own lines */

.group-panel {
  background: var(--surface-2); border-radius: 16px; padding: 14px 16px;
  margin-bottom: 14px; font-size: 13px; line-height: 1.6; color: var(--text-primary);
  white-space: pre-wrap; font-family: "SFMono-Regular", Consolas, monospace;
  border: 1px solid var(--border);
}
.group-panel-label {
  font-size: 11px; font-weight: 800; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px;
  font-family: var(--font-body);
}

.options { display: flex; flex-direction: column; gap: 9px; }
.option-btn {
  display: flex; align-items: center; justify-content: space-between;
  border: 1.5px solid var(--glass-border); background: var(--glass-surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  color: var(--text-primary);
  border-radius: 16px; padding: 13px 16px;
  font-size: 15px; font-weight: 700; text-align: left;
  cursor: pointer; font-family: var(--font-body);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}
.option-btn { transition: border-color .12s ease, transform .1s ease, background .12s ease; }
.option-btn:hover { border-color: var(--purple); }
.option-btn:active { transform: scale(0.98); }
.option-btn.selected { border-color: var(--purple); background: var(--purple-bg); }
.option-btn.correct { border-color: var(--teal); background: var(--teal-bg); color: var(--teal-dark); animation: pop .3s ease; }
.option-btn.incorrect { border-color: var(--red); background: var(--red-bg); color: var(--red-dark); }
.option-btn:disabled { cursor: default; }
.option-btn:disabled:hover { border-color: var(--glass-border); }
.option-btn.correct:disabled:hover, .option-btn.incorrect:disabled:hover { border-color: currentColor; }

.tita-row { display: flex; gap: 8px; }
.tita-row input {
  flex: 1; border: 1.5px solid var(--glass-border); border-radius: 16px;
  padding: 13px 16px; font-size: 15px; background: var(--glass-surface); color: var(--text-primary);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  font-family: var(--font-body); font-weight: 700;
}
.tita-row input:focus { outline: none; border-color: var(--purple); }

.btn {
  border: none; border-radius: var(--radius-pill);
  padding: 14px 20px; font-size: 15px; font-weight: 800;
  cursor: pointer; font-family: var(--font-display);
  transition: transform .1s ease, box-shadow .1s ease;
  letter-spacing: .01em;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(180deg, var(--purple-mid), var(--purple));
  color: #fff; width: 100%; margin-top: 16px;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--purple) 42%, transparent), inset 0 1px 0 rgba(255,255,255,.4);
}
.btn-primary:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
.btn-ghost {
  background: var(--glass-surface); color: var(--text-secondary); border: 1.5px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}

.feedback {
  margin-top: 16px; padding: 14px 16px; border-radius: 18px;
  font-size: 14px; line-height: 1.55;
  animation: card-in .25s ease;
  border: 1px solid transparent;
}
.feedback.correct { background: var(--teal-bg); color: var(--teal-dark); border-color: rgba(29,158,117,.25); }
.feedback.incorrect { background: var(--red-bg); color: var(--red-dark); border-color: rgba(226,75,74,.25); }
.feedback strong { font-family: var(--font-display); font-size: 15px; }
.feedback .xp-line { font-family: var(--font-display); font-weight: 800; margin-top: 8px; font-size: 15px; }

.flag-row { display: flex; gap: 8px; margin-top: 12px; }
.flag-btn {
  flex: 1; font-size: 12px; font-weight: 700; padding: 8px 10px; border-radius: var(--radius-pill);
  border: 1.5px solid var(--glass-border); background: var(--glass-surface); color: var(--text-secondary);
  cursor: pointer; font-family: var(--font-body);
  transition: transform .1s ease;
}
.flag-btn:active { transform: scale(0.96); }
.flag-btn:disabled { opacity: 0.7; cursor: default; }
.flag-btn.active-good { border-color: var(--teal); color: var(--teal-dark); background: var(--teal-bg); }
.flag-btn.active-bad { border-color: var(--red); color: var(--red-dark); background: var(--red-bg); }

.ai-ask { margin-top: 14px; }
.ai-ask-panel { margin-top: 10px; }
.ai-ask-input {
  width: 100%; border: 1.5px solid var(--glass-border); border-radius: 14px;
  padding: 10px 12px; font-size: 14px; background: var(--glass-surface); color: var(--text-primary);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  font-family: var(--font-body); font-weight: 500; resize: vertical; min-height: 44px;
}
.ai-ask-input:focus { outline: none; border-color: var(--purple); }
.ai-ask-response {
  margin-top: 10px; padding: 12px 14px; border-radius: 16px;
  background: var(--purple-bg); color: var(--text-primary); font-size: 13.5px; line-height: 1.55;
  white-space: pre-wrap;
}
.ai-ask-response.loading { color: var(--text-muted); font-style: italic; }
.ai-ask-response.error { background: var(--red-bg); color: var(--red-dark); }

/* ---- in-practice calculator modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,18,30,.38);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 50;
}
.modal-backdrop[hidden] { display: none; }
.calc-modal {
  width: 100%; max-width: 420px; border-radius: 26px 26px 0 0;
  margin: 0; max-height: 88vh; overflow-y: auto;
  padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  animation: card-in .22s ease;
}
.calc-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; font-family: var(--font-display); font-weight: 800; font-size: 15px;
}
.calc-modal-close {
  background: var(--surface-2); border: none; border-radius: 50%;
  width: 30px; height: 30px; font-size: 18px; line-height: 1; cursor: pointer; color: var(--text-secondary);
}

.back-link {
  display: inline-flex; align-items: center; gap: 4px; margin: 14px 0; color: var(--text-secondary);
  text-decoration: none; font-size: 13px; font-weight: 700;
}

.empty-state { text-align: center; color: var(--text-secondary); padding: 40px 0; font-weight: 600; }

/* ---- settings / generate panel ---- */
.settings-card {
  background: var(--glass-surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: 22px; padding: 18px; margin-top: 14px;
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
}
.settings-card h2 { font-size: 16px; margin: 0 0 4px; }
.settings-card .hint { font-size: 12.5px; color: var(--text-secondary); margin: 0 0 14px; line-height: 1.55; }

.form-group { margin-bottom: 12px; }
.form-label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; font-weight: 700; }
.form-input, .form-select {
  width: 100%; border: 1.5px solid var(--glass-border); border-radius: 14px;
  padding: 10px 12px; font-size: 14px; background: var(--glass-surface); color: var(--text-primary);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  font-family: var(--font-body); font-weight: 600;
}
.form-input:focus, .form-select:focus { outline: none; border-color: var(--purple); }
/* On Windows Chrome/Edge, the OPEN option list of a <select> is drawn by the OS, not this page -- CSS cannot reach its
   highlight colour. accent-color is the one hook browsers expose into native form chrome, so it keeps what it can
   (checkboxes, radios, range sliders, and in newer Chromium builds the select's own accent) matching the brand purple. */
.form-select { accent-color: var(--purple); color-scheme: light dark; }
[data-theme="dark"] .form-select { color-scheme: dark; }
.form-row { display: flex; gap: 8px; }
.form-row .form-group { flex: 1; }

.key-status { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-top: 6px; font-weight: 700; }
.key-status.saved { color: var(--teal-dark); }
.key-status.missing { color: var(--text-muted); }

/* ---- auth / login ---- */
.auth-wrap { max-width: 380px; margin: 0 auto; padding-top: 8vh; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.auth-tab {
  flex: 1; padding: 10px; border-radius: 14px; border: 1.5px solid var(--glass-border);
  background: var(--glass-surface); color: var(--text-secondary); font-weight: 700;
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  font-size: 13px; cursor: pointer; font-family: var(--font-body);
}
.auth-tab.active { border-color: var(--purple); color: var(--purple); background: var(--purple-bg); }
.auth-hint { font-size: 12.5px; color: var(--text-secondary); margin: 0 0 14px; line-height: 1.55; }
.auth-seo-blurb { font-size: 12.5px; color: var(--text-secondary); margin: 0 0 18px; line-height: 1.6; }
.auth-seo-blurb strong { color: var(--text-primary); }
.auth-error { color: var(--red); font-size: 13px; font-weight: 700; margin-top: 10px; }
.auth-remember {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  color: var(--text-secondary); font-weight: 600; margin: 2px 0 14px; cursor: pointer;
}
.auth-remember input { width: 16px; height: 16px; accent-color: var(--purple); }
.auth-remember[hidden] { display: none; }
.auth-link {
  display: block; width: 100%; text-align: center; background: none; border: none;
  color: var(--purple); font-size: 12.5px; font-weight: 700; font-family: var(--font-body);
  cursor: pointer; margin-top: 12px; padding: 4px;
}
.auth-link[hidden] { display: none; }

.gen-log { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.gen-log-item {
  font-size: 12px; padding: 8px 10px; border-radius: 10px;
  background: var(--surface-2); line-height: 1.4;
}
.gen-log-item.ok { border-left: 3px solid var(--teal); }
.gen-log-item.review { border-left: 3px solid var(--amber); }
.gen-log-item.error { border-left: 3px solid var(--red); }

.gen-progress { font-size: 12px; color: var(--text-secondary); margin-top: 10px; font-weight: 700; }

/* ---- formula reference ---- */
.formula-search {
  width: 100%; border: 1.5px solid var(--glass-border); border-radius: var(--radius-pill);
  padding: 12px 18px; font-size: 15px; font-family: var(--font-body); font-weight: 600;
  background: var(--glass-surface); color: var(--text-primary); margin: 14px 0 4px;
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}
.formula-search:focus { outline: none; border-color: var(--purple); }

.formula-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 16px; }

.formula-card {
  background: var(--glass-surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: 22px; padding: 16px 18px;
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
}
.formula-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.formula-card-head h3 { margin: 0; font-size: 16px; }

.formula-item { padding: 9px 0; border-top: 0.5px solid var(--border); }
.formula-item:first-of-type { border-top: none; padding-top: 2px; }
.formula-label { font-size: 12.5px; font-weight: 800; color: var(--text-secondary); margin-bottom: 2px; }
.formula-expr {
  font-family: "SFMono-Regular", Consolas, monospace; font-size: 13.5px;
  color: var(--text-primary); line-height: 1.5;
}
.hidden { display: none !important; }

/* ==================================================================
   Motion: idle life, entrances, celebration
   ================================================================== */

/* streak flame flickers gently -- never fully still */
@keyframes flicker {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.05) rotate(-2deg); }
  50% { transform: scale(0.97) rotate(1deg); }
  75% { transform: scale(1.03) rotate(2deg); }
}
.icon-3d.flame { animation: flicker 2.6s ease-in-out infinite; }

/* topic cards + option buttons stagger in on load */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.topic-card, .option-btn { animation: rise-in .38s cubic-bezier(.2,.8,.3,1.2) backwards; }

/* bouncier button press than a flat scale */
.btn:active, .option-btn:active, .theme-toggle:active, .flag-btn:active {
  transition: transform .08s cubic-bezier(.34,1.56,.64,1);
}

/* number pop used by animateNumber() whenever a stat changes */
@keyframes number-bump {
  0% { transform: scale(1); }
  30% { transform: scale(1.35); }
  60% { transform: scale(0.95); }
  100% { transform: scale(1); }
}
.number-bump { display: inline-block; animation: number-bump .4s cubic-bezier(.34,1.56,.64,1); }

/* confetti particle -- position/color/travel set inline per-piece by JS */
.confetti-piece {
  position: fixed; top: 0; left: 0; width: 8px; height: 8px;
  border-radius: 2px; pointer-events: none; z-index: 999;
  opacity: 1;
  animation: confetti-fly .9s cubic-bezier(.15,.7,.3,1) forwards;
}
@keyframes confetti-fly {
  0% { transform: translate(var(--x0), var(--y0)) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translate(var(--x1), var(--y1)) rotate(var(--spin)) scale(.4); opacity: 0; }
}

/* goal-complete celebration toast */
.celebrate-toast {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%) translateY(-30px);
  background: linear-gradient(135deg, var(--purple), var(--purple-deep)); color: #fff;
  padding: 12px 20px; border-radius: var(--radius-pill);
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
  box-shadow: 0 10px 28px color-mix(in srgb, var(--purple) 50%, transparent), inset 0 1px 0 rgba(255,255,255,.4);
  display: flex; align-items: center; gap: 8px;
  z-index: 1000; opacity: 0;
  animation: toast-in .45s cubic-bezier(.2,.8,.3,1.2) forwards, toast-out .4s ease 2.6s forwards;
}
@keyframes toast-in { to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(-50%) translateY(-20px); } }

/* skeleton loading shimmer, replaces plain "Loading..." text */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 16px;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.skeleton-card { height: 58px; margin-bottom: 10px; }
.skeleton-line { height: 14px; margin-bottom: 8px; }

@media (prefers-reduced-motion: reduce) {
  .icon-3d.flame, .topic-card, .option-btn, .confetti-piece, .celebrate-toast, .skeleton {
    animation: none !important;
  }
}

/* ---- mixed practice / weak-topics / profile accents share the glass look
   via the rules above; nothing extra needed here ---- */

/* ---- calculator ---- */
.calc-card {
  background: var(--glass-surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: 26px; padding: 16px; margin-top: 14px;
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
}

.calc-display {
  position: relative; background: var(--surface-2); border-radius: 18px;
  padding: 18px 16px 14px; margin-bottom: 12px; text-align: right;
  border: 1px solid var(--border);
}
.calc-mem-badge {
  position: absolute; top: 10px; left: 14px;
  font-family: var(--font-display); font-size: 12px; font-weight: 800;
  color: var(--purple-dark); background: var(--purple-bg);
  padding: 2px 8px; border-radius: var(--radius-pill);
}
.calc-expr {
  font-size: 14px; color: var(--text-secondary); font-weight: 600;
  min-height: 18px; word-break: break-all; font-family: "SFMono-Regular", Consolas, monospace;
}
.calc-result {
  font-family: var(--font-display); font-size: 32px; font-weight: 700;
  margin-top: 4px; word-break: break-all;
}

.calc-grid { display: grid; gap: 8px; margin-bottom: 8px; }
.calc-grid-5 { grid-template-columns: repeat(5, 1fr); }
.calc-grid-4 { grid-template-columns: repeat(4, 1fr); }

.calc-btn {
  border: 1px solid var(--glass-border); border-radius: 14px; background: var(--glass-surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  color: var(--text-primary); font-family: var(--font-body); font-weight: 700;
  font-size: 14px; padding: 12px 4px; cursor: pointer;
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  transition: transform .08s cubic-bezier(.34,1.56,.64,1), background .1s ease;
}
.calc-btn:active { transform: scale(0.93); background: var(--border); }
.calc-btn.calc-op { background: var(--purple-bg); color: var(--purple-dark); font-size: 16px; }
.calc-btn.calc-toggle { background: var(--teal-bg); color: var(--teal-dark); font-size: 12px; }
.calc-btn.calc-toggle.calc-btn-active { background: var(--teal); color: #fff; }
.calc-btn.calc-mem { background: var(--amber-bg); color: var(--amber-dark); font-size: 12px; }
.calc-btn.calc-clear-btn { background: var(--red-bg); color: var(--red-dark); }
.calc-btn.calc-back-btn { background: var(--red-bg); color: var(--red-dark); font-size: 16px; }
.calc-btn.calc-equals {
  background: linear-gradient(180deg, var(--purple-mid), var(--purple)); color: #fff;
  font-size: 18px; box-shadow: 0 4px 14px color-mix(in srgb, var(--purple) 45%, transparent), inset 0 1px 0 rgba(255,255,255,.4);
}
.calc-btn.calc-fn { font-size: 12.5px; }

/* ==================================================================
   Responsive breakpoints -- placed last so they win the cascade over
   the single-column base rules above, instead of losing to them.
   ================================================================== */
/* ---- accent themes (unlocked with XP) ----
   Everything is derived from one color so a theme can never half-apply.
   These rules sit after the light/dark token blocks so they win the cascade. */
:root[data-accent="ocean"]  { --accent: #2F80ED; }
:root[data-accent="forest"] { --accent: #2E9E5B; }
:root[data-accent="sunset"] { --accent: #E8743B; }
:root[data-accent="rose"]   { --accent: #DB4F86; }
:root[data-accent="gold"]   { --accent: #C99A12; }
:root[data-accent="ocean"], :root[data-accent="forest"], :root[data-accent="sunset"],
:root[data-accent="rose"], :root[data-accent="gold"] {
  --purple: var(--accent);
  --purple-light: color-mix(in srgb, var(--accent) 62%, white);
  --purple-mid: color-mix(in srgb, var(--accent) 80%, white);
  --purple-deep: color-mix(in srgb, var(--accent) 78%, black);
  --purple-bg: color-mix(in srgb, var(--accent) 14%, var(--surface));
  --purple-dark: color-mix(in srgb, var(--accent) 55%, var(--text-primary));
  --mesh-1: color-mix(in srgb, var(--accent) 30%, transparent);
}

/* ---- show/hide password ---- */
.pw-wrap { position: relative; }
.pw-wrap .form-input { padding-right: 68px; }
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--purple); font-weight: 800; font-size: 12.5px;
  font-family: var(--font-body); cursor: pointer; padding: 8px 10px; border-radius: 10px;
}
.pw-toggle:active { background: var(--purple-bg); }

/* ---- one-time credentials card + code inputs ---- */
.cred-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; margin-bottom: 8px; border-radius: 14px;
  background: var(--purple-bg); border: 1px solid var(--glass-border);
}
.cred-box span { font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.cred-box strong { font-family: var(--font-display); font-size: 20px; letter-spacing: .02em; word-break: break-all; text-align: right; }
.code-input { text-align: center; font-family: var(--font-display); font-size: 20px; font-weight: 800; letter-spacing: .25em; text-transform: uppercase; }

/* ---- segmented control ---- */
.seg { display: flex; gap: 6px; margin: 4px 0 14px; }
.seg-btn {
  flex: 1; padding: 9px 8px; border-radius: 14px; border: 1.5px solid var(--glass-border);
  background: var(--glass-surface); color: var(--text-secondary); font-weight: 800; font-size: 13px;
  cursor: pointer; font-family: var(--font-body);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
}
.seg-btn.active { border-color: var(--purple); color: var(--purple); background: var(--purple-bg); }

/* ---- small glass buttons / inline forms ---- */
.btn-sm { padding: 7px 14px; font-size: 12.5px; border-radius: 12px; margin-top: 0; width: auto; }
.inline-form { display: flex; gap: 8px; margin-bottom: 10px; }
.inline-form .form-input { flex: 1; min-width: 0; }
.inline-form .btn { margin-top: 0; width: auto; padding: 0 18px; white-space: nowrap; }
.status-line { font-size: 12.5px; font-weight: 700; min-height: 18px; margin: 4px 2px 12px; color: var(--text-secondary); }
.status-line.ok { color: var(--teal-dark); }
.status-line.err { color: var(--red); }

/* ---- level card (home) ---- */
.level-card {
  display: flex; align-items: center; gap: 12px; margin: 12px 0 4px; padding: 14px 16px;
  background: var(--glass-surface); border: 1px solid var(--glass-border); border-radius: 22px;
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
  text-decoration: none; color: inherit;
}
.level-card-body { flex: 1; min-width: 0; }
.level-card-title { font-family: var(--font-display); font-weight: 800; font-size: 15px; }
.level-card-sub { font-size: 12px; color: var(--text-secondary); font-weight: 600; margin-top: 2px; }
.xp-bar { height: 7px; border-radius: var(--radius-pill); background: var(--purple-bg); overflow: hidden; margin-top: 8px; }
.xp-bar > div {
  height: 100%; border-radius: var(--radius-pill); width: 0%;
  background: linear-gradient(90deg, var(--purple), var(--purple-light)); transition: width .5s ease;
}

/* ---- leaderboard & friends ---- */
.lb-list { display: flex; flex-direction: column; gap: 8px; }
.lb-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--glass-surface); border: 1px solid var(--glass-border); border-radius: 18px;
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
}
.lb-row.me { border-color: var(--purple); background: var(--purple-bg); }
.lb-rank {
  width: 28px; text-align: center; font-family: var(--font-display); font-weight: 800;
  font-size: 16px; color: var(--text-secondary);
}
.lb-rank.r1 { color: #D4A017; }
.lb-rank.r2 { color: #9A9AA5; }
.lb-rank.r3 { color: #B87333; }
.lb-info { flex: 1; min-width: 0; }
.lb-name { font-weight: 800; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-sub { font-size: 11.5px; color: var(--text-secondary); font-weight: 600; margin-top: 1px; }
.lb-xp { font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--purple); text-align: right; }
.lb-xp small { display: block; font-family: var(--font-body); font-size: 10.5px; color: var(--text-muted); font-weight: 700; }
.row-actions { display: flex; gap: 6px; }

/* ---- profile / rewards ---- */
.profile-hero { text-align: center; padding: 8px 0 4px; }
.profile-hero .icon-3d { margin: 0 auto 10px; }
.profile-name { font-family: var(--font-display); font-weight: 800; font-size: 22px; }
.profile-sub { font-size: 13px; color: var(--text-secondary); font-weight: 600; margin-top: 2px; }
.unlock-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.unlock-item {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 6px 10px; border-radius: 16px; border: 1.5px solid var(--glass-border);
  background: var(--glass-surface); cursor: pointer; font-family: var(--font-body); color: var(--text-primary);
  font-size: 11.5px; font-weight: 700; text-align: center;
}
.unlock-item.locked { opacity: .5; cursor: default; }
.unlock-item.equipped { border-color: var(--purple); background: var(--purple-bg); }
.unlock-item .need { font-size: 10.5px; color: var(--text-muted); font-weight: 700; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(255,255,255,.5); box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.title-list { display: flex; flex-wrap: wrap; gap: 8px; }
.title-chip {
  padding: 7px 13px; border-radius: var(--radius-pill); border: 1.5px solid var(--glass-border);
  background: var(--glass-surface); color: var(--text-primary); font-size: 12.5px; font-weight: 700;
  cursor: pointer; font-family: var(--font-body);
}
.title-chip.locked { opacity: .45; cursor: default; }
.title-chip.equipped { border-color: var(--purple); color: var(--purple); background: var(--purple-bg); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.toggle-row p { margin: 0; font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.switch { position: relative; width: 48px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; border-radius: 28px; background: var(--border); cursor: pointer; transition: background .2s ease;
}
.switch span::after {
  content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; border-radius: 50%;
  background: #fff; transition: transform .2s ease; box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.switch input:checked + span { background: var(--purple); }
.switch input:checked + span::after { transform: translateX(20px); }

/* ---- versus (local multiplayer) ---- */
.pbadge {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 28px; height: 28px; border-radius: 50%; color: #fff; font-family: var(--font-display);
  font-weight: 800; font-size: 13px; box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 2px 8px rgba(0,0,0,.25);
}
.pbadge.big { width: 64px; height: 64px; font-size: 28px; margin: 0 auto 14px; display: flex; }
.pbadge.p0 { background: linear-gradient(180deg, #8F87E8, #5B52C4); }
.pbadge.p1 { background: linear-gradient(180deg, #3FBF94, #178A66); }
.pbadge.p2 { background: linear-gradient(180deg, #F29A6B, #D9622D); }
.pbadge.p3 { background: linear-gradient(180deg, #5AA2F5, #2467C9); }
.vs-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 10px; }
.vs-who { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 15px; min-width: 0; }
.vs-who span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-timer {
  font-family: var(--font-display); font-weight: 800; font-size: 16px; padding: 6px 14px;
  border-radius: var(--radius-pill); background: var(--purple-bg); color: var(--purple); flex-shrink: 0;
}
.vs-timer.low { background: var(--red-bg); color: var(--red); }
.vs-progress { font-size: 12px; font-weight: 700; color: var(--text-secondary); margin-bottom: 8px; }
.handoff { text-align: center; padding: 34px 10px 10px; }
.handoff h2 { font-size: 22px; margin: 0 0 6px; }
.handoff p { color: var(--text-secondary); margin: 0 0 22px; font-size: 14px; }
.name-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.name-row .form-input { flex: 1; min-width: 0; }
.verdict { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; margin-bottom: 6px; border: 1px solid var(--glass-border); background: var(--glass-surface); }
.verdict.ok { border-color: rgba(29,158,117,.45); background: var(--teal-bg); }
.verdict.bad { border-color: rgba(226,75,74,.35); background: var(--red-bg); }
.verdict-main { flex: 1; min-width: 0; font-size: 13.5px; }
.verdict-main small { display: block; color: var(--text-secondary); font-weight: 600; }
.verdict-pts { font-family: var(--font-display); font-weight: 800; font-size: 15px; }
.winner-banner { text-align: center; padding: 18px 10px 8px; }
.winner-banner h1 { margin: 6px 0 2px; }
.review-q { font-size: 13px; padding: 10px 0; border-top: 1px solid var(--glass-border); }
.review-q:first-child { border-top: none; }

/* ---- teacher tools ---- */
.btn-danger {
  background: transparent; color: var(--red); border: 1.5px solid var(--red);
  border-radius: var(--radius-pill); padding: 12px 18px; font-weight: 800; font-family: var(--font-body);
  font-size: 14px; cursor: pointer;
}
.btn-danger:active { background: var(--red-bg); }
.cred-row {
  display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 8px; padding: 9px 0;
  border-top: 1px solid var(--glass-border); font-size: 14px; word-break: break-all;
}
.cred-row strong { font-family: var(--font-display); }
/* ---- present mode (classroom screen) ---- */
.present-q { font-family: var(--font-display); font-weight: 800; font-size: clamp(26px, 5vw, 44px); line-height: 1.3; margin: 10px 0 20px; }
.present-options { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 18px; }
.present-opt {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 20px;
  border: 2px solid var(--glass-border); background: var(--glass-surface);
  font-size: clamp(20px, 3.4vw, 32px); font-weight: 700;
}
.present-opt.correct { border-color: var(--teal); background: var(--teal-bg); color: var(--teal-dark); }
.present-letter {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 44px; height: 44px; border-radius: 50%; background: var(--purple-bg); color: var(--purple);
  font-family: var(--font-display); font-weight: 800;
}
.present-controls { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.present-controls .btn { flex: 1; min-width: 110px; margin-top: 0; }
@media (min-width: 900px) { .present-options { grid-template-columns: 1fr 1fr; } }

/* ---- read-aloud button on kids' practice ---- */
.speak-btn {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; cursor: pointer;
  border: 1.5px solid var(--glass-border); background: var(--glass-surface); color: var(--purple);
  display: flex; align-items: center; justify-content: center;
}
.speak-btn:active { transform: scale(0.9); }

details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
@media print {
  .no-print, .topbar { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .settings-card { box-shadow: none !important; border: 1px solid #999 !important; background: #fff !important; backdrop-filter: none !important; }
  .cred-row strong, .hint, h1, h2 { color: #000 !important; }
}

@media (min-width: 700px) {
  .wrap { max-width: 900px; padding: 0 32px; }
  .topic-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .q-card, .settings-card { max-width: 640px; margin-left: auto; margin-right: auto; }
  .calc-card { max-width: 400px; margin-left: auto; margin-right: auto; }
  .formula-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1000px) {
  .wrap { max-width: 1080px; }
  .topic-grid { grid-template-columns: repeat(3, 1fr); }
  .formula-grid { grid-template-columns: repeat(3, 1fr); }
}

/* =====================================================================
   LIQUID GLASS SYSTEM
   Four depths of glass, each a little more present than the last:

     clear    ambient containers   - barely there: light blur, faint tint
     frost    everyday cards       - the default surface
     raised   top bar, level card  - closest to the viewer: more blur, brighter rim
     well     inputs, option rows  - recessed into a card, not blurred

   Colour is used with meaning, as a tint inside the glass rather than a
   fill on top of it: purple = progress / primary, teal = goals / correct,
   amber = time / XP, coral = streaks / attention. Every blurred surface also
   gets a thin rim of light (bright top-left, soft bottom-right) and a very
   fine frosted grain. Motion is limited to a few purposeful moments: cards
   settle in, a sliding glass thumb on tabs, a highlight that follows the
   pointer, and a single sheen across progress bars.
   ===================================================================== */
:root {
  --spring: cubic-bezier(.34, 1.4, .64, 1);
  --ease-out: cubic-bezier(.2, .7, .2, 1);

  /* depth: fill, blur, saturation, drop shadow */
  --clear-fill: rgba(255, 255, 255, .34);  --clear-blur: 10px; --clear-sat: 125%;
  --frost-fill: rgba(255, 255, 255, .60);  --frost-blur: 16px; --frost-sat: 140%;
  --raised-fill: rgba(255, 255, 255, .78); --raised-blur: 24px; --raised-sat: 165%;
  --well-fill: rgba(40, 35, 90, .045);

  --clear-shadow: 0 1px 4px rgba(50, 45, 100, .05);
  --frost-shadow: 0 4px 18px rgba(50, 45, 100, .08), 0 1px 3px rgba(50, 45, 100, .06);
  --raised-shadow: 0 10px 30px rgba(50, 45, 100, .12), 0 2px 6px rgba(50, 45, 100, .07);

  /* edges: a hairline, a top highlight, a faint underside */
  --edge: rgba(255, 255, 255, .72);
  --edge-soft: rgba(60, 50, 120, .08);
  --inset: inset 0 1px 0 rgba(255, 255, 255, .85), inset 0 -1px 0 rgba(60, 50, 120, .05);
  --rim-hi: rgba(255, 255, 255, .95);
  --rim-lo: rgba(110, 100, 190, .16);
  --glow: rgba(255, 255, 255, .26);

  /* tints */
  --tone-purple: var(--purple);
  --tone-teal: var(--teal);
  --tone-amber: var(--amber);
  --tone-coral: var(--coral);
  --tint-clear: 6%; --tint-frost: 9%; --tint-raised: 14%;

  /* frosted grain: fine dark specks that read as a matte, etched surface */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .2 0 0 0 0 .18 0 0 0 0 .4 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  /* the wash the glass sits on: two soft, still pools of colour */
  --orb-a: rgba(140, 125, 255, .17);
  --orb-b: rgba(40, 190, 150, .11);
}
[data-theme="dark"] {
  --clear-fill: rgba(255, 255, 255, .035);
  --frost-fill: rgba(255, 255, 255, .06);
  --raised-fill: rgba(255, 255, 255, .10);
  --well-fill: rgba(0, 0, 0, .22);
  --clear-shadow: 0 1px 4px rgba(0, 0, 0, .18);
  --frost-shadow: 0 4px 18px rgba(0, 0, 0, .28), 0 1px 3px rgba(0, 0, 0, .2);
  --raised-shadow: 0 10px 30px rgba(0, 0, 0, .4), 0 2px 6px rgba(0, 0, 0, .25);
  --edge: rgba(255, 255, 255, .11);
  --edge-soft: rgba(255, 255, 255, .06);
  --inset: inset 0 1px 0 rgba(255, 255, 255, .10), inset 0 -1px 0 rgba(0, 0, 0, .25);
  --rim-hi: rgba(255, 255, 255, .42);
  --rim-lo: rgba(255, 255, 255, .06);
  --glow: rgba(255, 255, 255, .12);
  --tint-clear: 7%; --tint-frost: 10%; --tint-raised: 17%;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --orb-a: rgba(130, 112, 255, .15);
  --orb-b: rgba(40, 190, 150, .09);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --clear-fill: rgba(255, 255, 255, .035);
    --frost-fill: rgba(255, 255, 255, .06);
    --raised-fill: rgba(255, 255, 255, .10);
    --well-fill: rgba(0, 0, 0, .22);
    --clear-shadow: 0 1px 4px rgba(0, 0, 0, .18);
    --frost-shadow: 0 4px 18px rgba(0, 0, 0, .28), 0 1px 3px rgba(0, 0, 0, .2);
    --raised-shadow: 0 10px 30px rgba(0, 0, 0, .4), 0 2px 6px rgba(0, 0, 0, .25);
    --edge: rgba(255, 255, 255, .11);
    --edge-soft: rgba(255, 255, 255, .06);
    --inset: inset 0 1px 0 rgba(255, 255, 255, .10), inset 0 -1px 0 rgba(0, 0, 0, .25);
    --rim-hi: rgba(255, 255, 255, .42);
    --rim-lo: rgba(255, 255, 255, .06);
    --glow: rgba(255, 255, 255, .12);
    --tint-clear: 7%; --tint-frost: 10%; --tint-raised: 17%;
    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    --orb-a: rgba(130, 112, 255, .15);
    --orb-b: rgba(40, 190, 150, .09);
  }
}

/* ---- the wash behind the glass ---- */
body::before, body::after {
  content: ""; position: fixed; z-index: -1; pointer-events: none;
  width: 60vmax; height: 60vmax; border-radius: 50%;
}
body::before { top: -24vmax; left: -20vmax; background: radial-gradient(circle, var(--orb-a), transparent 65%); }
body::after { bottom: -26vmax; right: -22vmax; background: radial-gradient(circle, var(--orb-b), transparent 65%); }

/* ---- shared glass behaviour ---------------------------------------- */
.exam-track-block, .chart-card, .formula-card,
.settings-card, .goal-block, .countdown-block, .weak-topics-card, .topic-card, .q-card, .calc-card, .mock-review-item,
.level-card, .feedback, .topbar,
.badge, .theme-toggle, .btn-ghost, .speak-btn {
  --tone: transparent;
  --tint: 0%;
  background: var(--grain), color-mix(in srgb, var(--tone) var(--tint), var(--fill));
  background-size: 140px 140px, auto;
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  border: 1px solid var(--edge);
  box-shadow: var(--inset), var(--shadow);
}
/* the rim of light: a 1px gradient ring, brighter top-left than bottom-right */
.exam-track-block::before, .chart-card::before, .formula-card::before,
.settings-card::before, .goal-block::before, .countdown-block::before, .weak-topics-card::before, .topic-card::before,
.q-card::before, .calc-card::before, .mock-review-item::before,
.level-card::before, .feedback::before, .topbar::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(145deg, var(--rim-hi), transparent 32%, transparent 68%, var(--rim-lo));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.exam-track-block, .chart-card, .formula-card,
.settings-card, .goal-block, .countdown-block, .weak-topics-card, .topic-card, .q-card, .calc-card, .mock-review-item,
.level-card, .feedback { position: relative; }

/* ---- depth 1: clear ---- */
.exam-track-block, .chart-card, .formula-card {
  --fill: var(--clear-fill); --blur: var(--clear-blur); --sat: var(--clear-sat); --shadow: var(--clear-shadow);
  border-radius: 22px;
}
/* ---- depth 2: frost ---- */
.settings-card, .goal-block, .countdown-block, .weak-topics-card, .topic-card, .q-card, .calc-card, .mock-review-item {
  --fill: var(--frost-fill); --blur: var(--frost-blur); --sat: var(--frost-sat); --shadow: var(--frost-shadow);
  border-radius: 22px;
}
.topic-card { border-radius: 20px; }
.mock-review-item { border-radius: 18px; }
/* ---- depth 3: raised ---- */
.level-card, .feedback, .topbar {
  --fill: var(--raised-fill); --blur: var(--raised-blur); --sat: var(--raised-sat); --shadow: var(--raised-shadow);
}
.level-card { border-radius: 22px; }
.topbar {
  position: sticky; top: 8px; z-index: 30; margin: 8px 0 6px; padding: 6px 8px 6px 10px; border-radius: 20px;
}
/* small round controls sit at the frost depth with a lighter blur */
.theme-toggle, .btn-ghost, .speak-btn, .auth-tab {
  --fill: var(--frost-fill); --blur: 12px; --sat: 140%;
  --shadow: 0 1px 4px rgba(50, 45, 100, .08);
}
.topbar .theme-toggle { box-shadow: var(--inset); }

/* ---- colour: tint inside the glass, chosen for meaning ---- */
.exam-track-block { --tone: var(--tone-purple); --tint: var(--tint-clear); }
.level-card { --tone: var(--tone-purple); --tint: var(--tint-raised); }
.goal-block { --tone: var(--tone-teal); --tint: var(--tint-frost); }
.countdown-block { --tone: var(--tone-amber); --tint: var(--tint-frost); }
.weak-topics-card { --tone: var(--tone-coral); --tint: var(--tint-frost); }
.badge-streak { --tone: var(--tone-coral); --tint: 22%; color: var(--coral-dark); --fill: var(--frost-fill); --blur: 10px; --sat: 150%; --shadow: none; }
.badge-xp { --tone: var(--tone-amber); --tint: 26%; color: var(--amber-dark); --fill: var(--frost-fill); --blur: 10px; --sat: 150%; --shadow: none; }
.topic-card[data-tone="purple"] { --tone: var(--tone-purple); --tint: 7%; }
.topic-card[data-tone="teal"] { --tone: var(--tone-teal); --tint: 7%; }
.topic-card[data-tone="flame"] { --tone: var(--tone-coral); --tint: 7%; }
.topic-card[data-tone="bolt"] { --tone: var(--tone-amber); --tint: 8%; }

/* ---- depth 4: well (recessed into a card) ---- */
.option-btn, .tita-row input, .form-input, .form-select, .seg-btn, .exam-track-tab,
.lb-row, .cred-box, .formula-search, .present-opt, .verdict {
  background: var(--well-fill);
  -webkit-backdrop-filter: none; backdrop-filter: none;
  border: 1px solid var(--edge-soft);
  box-shadow: inset 0 1px 2px rgba(40, 35, 90, .08), 0 1px 0 var(--edge);
}
[data-theme="dark"] .option-btn, [data-theme="dark"] .tita-row input, [data-theme="dark"] .form-input, [data-theme="dark"] .form-select,
[data-theme="dark"] .seg-btn, [data-theme="dark"] .exam-track-tab, [data-theme="dark"] .lb-row, [data-theme="dark"] .cred-box,
[data-theme="dark"] .formula-search, [data-theme="dark"] .present-opt, [data-theme="dark"] .verdict {
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .35), 0 1px 0 rgba(255, 255, 255, .05);
}
.option-btn { border-radius: 16px; }
.lb-row { border-radius: 18px; }
.seg-btn, .exam-track-tab, .auth-tab { border-radius: var(--radius-pill); }
.form-input, .form-select { border-radius: 14px; }
.form-input:focus, .form-select:focus, .tita-row input:focus, .formula-search:focus {
  border-color: var(--purple);
  box-shadow: inset 0 1px 2px rgba(40, 35, 90, .08), 0 0 0 3px color-mix(in srgb, var(--purple) 20%, transparent);
}

/* ---- states: tinted glass ---- */
.option-btn.selected, .lb-row.me {
  background: color-mix(in srgb, var(--purple) 15%, var(--well-fill));
  border-color: color-mix(in srgb, var(--purple) 55%, transparent); color: var(--purple-dark);
}
.option-btn.correct, .present-opt.correct { background: color-mix(in srgb, var(--teal) 17%, var(--well-fill)); border-color: var(--teal); box-shadow: none; }
.option-btn.incorrect { background: color-mix(in srgb, var(--red) 14%, var(--well-fill)); border-color: var(--red); box-shadow: none; }
.option-btn:hover:not(:disabled) { border-color: color-mix(in srgb, var(--purple) 55%, transparent); }

/* ---- primary action: coloured glass with a lit top edge ---- */
.btn-primary, .mock-cta {
  position: relative; overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0) 55%),
    linear-gradient(180deg, color-mix(in srgb, var(--purple-mid) 94%, transparent), color-mix(in srgb, var(--purple) 94%, transparent));
  border: 1px solid color-mix(in srgb, var(--purple-deep) 45%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -1px 0 rgba(30, 20, 110, .25), 0 4px 14px color-mix(in srgb, var(--purple) 28%, transparent);
  text-shadow: none;
}
.mock-cta { border-radius: 22px; }
.btn-primary:disabled { opacity: .5; box-shadow: none; }
.btn-danger { background: color-mix(in srgb, var(--red) 6%, transparent); box-shadow: none; }

/* ---- tabs and segmented controls: a sliding glass thumb (glass.js) ---- */
.glass-tabs { position: relative; isolation: isolate; }
.glass-tabs > button { position: relative; z-index: 1; }
.glass-thumb {
  position: absolute; z-index: 0; pointer-events: none; border-radius: var(--radius-pill);
  left: 0; top: 0; transform: translate(var(--l, 0), var(--t, 0)); will-change: transform; width: var(--w, 0); height: var(--h, 0); opacity: 0;
  --tone: var(--purple);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .35), rgba(255, 255, 255, 0) 60%),
    color-mix(in srgb, var(--tone) 22%, var(--frost-fill));
  border: 1px solid color-mix(in srgb, var(--tone) 55%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 2px 8px color-mix(in srgb, var(--tone) 22%, transparent);
}
.glass-thumb[data-tone="teal"] { --tone: var(--teal); }
.glass-thumb.ready { opacity: 1; transition: transform .45s var(--spring), width .45s var(--spring), height .3s ease, border-color .3s ease, background .3s ease; }
.glass-tabs .seg-btn.active, .glass-tabs .exam-track-tab.active, .glass-tabs .auth-tab.active {
  background: transparent; border-color: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none;
}
/* before the script has placed the thumb, the active tab still shows its state */
.seg-btn.active, .auth-tab.active { background: color-mix(in srgb, var(--purple) 15%, var(--well-fill)); border-color: color-mix(in srgb, var(--purple) 55%, transparent); color: var(--purple-dark); }
.exam-track-tab.active[data-track="CAT"] { background: color-mix(in srgb, var(--purple) 15%, var(--well-fill)); border-color: color-mix(in srgb, var(--purple) 55%, transparent); color: var(--purple-dark); }
.exam-track-tab.active[data-track="NMAT"] { background: color-mix(in srgb, var(--teal) 15%, var(--well-fill)); border-color: color-mix(in srgb, var(--teal) 55%, transparent); color: var(--teal-dark); }
.glass-tabs .seg-btn.active, .glass-tabs .exam-track-tab.active, .glass-tabs .auth-tab.active { background: transparent; border-color: transparent; }
.exam-track-tab { color: var(--text-secondary); }

/* ---- a highlight that follows the pointer, on things you can press ---- */
.topic-card::after, .level-card::after, .btn-primary::after, .mock-cta::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 0%), var(--glow), transparent 65%);
  transition: opacity .3s ease;
}
@media (hover: hover) {
  .topic-card:hover::after, .level-card:hover::after, .btn-primary:hover::after, .mock-cta:hover::after { opacity: 1; }
  .topic-card:hover, .level-card:hover { transform: translateY(-1px); box-shadow: var(--inset), 0 8px 26px rgba(50, 45, 100, .13), 0 1px 3px rgba(50, 45, 100, .06); }
}
.topic-card:active::after, .btn-primary:active::after { opacity: 1; }

/* ---- progress: clean tubes, one sheen when the fill lands ---- */
.goal-bar, .xp-bar, .topic-progress-track { background: color-mix(in srgb, var(--text-primary) 8%, transparent); box-shadow: inset 0 1px 2px rgba(40, 35, 90, .10); }
.goal-fill, .xp-bar > div, .topic-progress-fill { position: relative; overflow: hidden; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45); }
.goal-fill::after, .xp-bar > div::after, .topic-progress-fill::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-110%);
  background: linear-gradient(100deg, transparent 25%, rgba(255, 255, 255, .55) 50%, transparent 75%);
  animation: g-sheen 1.3s .5s var(--ease-out) 1 forwards;
}
@keyframes g-sheen { to { transform: translateX(110%); } }

/* ---- motion: settle in, spring back ---- */
@keyframes g-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.exam-track-block, .goal-block, .countdown-block, .chart-card, .weak-topics-card, .level-card, .settings-card, .formula-card {
  animation: g-rise .5s var(--ease-out) backwards;
}
.wrap > :nth-child(3) { animation-delay: .04s; } .wrap > :nth-child(4) { animation-delay: .08s; }
.wrap > :nth-child(5) { animation-delay: .12s; } .wrap > :nth-child(6) { animation-delay: .16s; }
.wrap > :nth-child(7) { animation-delay: .20s; } .wrap > :nth-child(8) { animation-delay: .24s; }
.topic-card, .level-card, .option-btn, .btn, .theme-toggle, .seg-btn, .lb-row, .mock-cta {
  transition: transform .35s var(--spring), box-shadow .25s ease, background .2s ease, border-color .2s ease;
}
.topic-card:active, .level-card:active, .option-btn:active, .btn:active, .seg-btn:active, .mock-cta:active { transform: scale(.975); transition-duration: .1s; }

/* ---- hairlines ---- */
.review-q, .cred-row, .mock-topic-row, .weak-topic-row, .formula-item, .section-heading { border-top-color: var(--edge-soft); }

/* ---- legibility ---- */
.speak-btn { color: var(--purple-dark); }
[data-theme="dark"] { --text-muted: #A09E96; --text-secondary: #C4C2BA; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --text-muted: #A09E96; --text-secondary: #C4C2BA; }
}

/* ---- narrow phones: let the bar wrap instead of clipping ---- */
@media (max-width: 430px) {
  .topbar { flex-wrap: wrap; row-gap: 6px; padding: 6px 8px; }
  .topbar > div { gap: 5px !important; }
  .topbar .theme-toggle { width: 34px; height: 34px; }
  .topbar .badge { font-size: 13.5px; padding: 4px 11px 4px 4px; gap: 5px; }
}

/* ---- fallbacks ---- */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --clear-fill: rgba(255, 255, 255, .8); --frost-fill: rgba(255, 255, 255, .9); --raised-fill: rgba(255, 255, 255, .96); }
  [data-theme="dark"] { --clear-fill: rgba(40, 39, 48, .85); --frost-fill: rgba(44, 43, 52, .92); --raised-fill: rgba(54, 53, 64, .96); }
}
@media (prefers-reduced-transparency: reduce) {
  :root { --clear-fill: rgba(255, 255, 255, .9); --frost-fill: rgba(255, 255, 255, .94); --raised-fill: rgba(255, 255, 255, .98); }
  [data-theme="dark"] { --clear-fill: rgba(40, 39, 48, .94); --frost-fill: rgba(44, 43, 52, .96); --raised-fill: rgba(54, 53, 64, .98); }
  .exam-track-block, .chart-card, .formula-card, .settings-card, .goal-block, .countdown-block, .weak-topics-card, .topic-card,
  .q-card, .calc-card, .mock-review-item, .level-card, .feedback, .topbar, .badge, .theme-toggle, .btn-ghost, .speak-btn {
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .exam-track-block, .goal-block, .countdown-block, .chart-card, .weak-topics-card, .level-card, .settings-card, .formula-card,
  .goal-fill::after, .xp-bar > div::after, .topic-progress-fill::after { animation: none; }
  .topic-card, .level-card, .option-btn, .btn, .theme-toggle, .seg-btn, .lb-row, .mock-cta, .glass-thumb.ready { transition: none; }
}
@media print {
  body::before, body::after, .glass-thumb { display: none; }
  .topbar { position: static; }
}


/* =====================================================================
   TOUCH & MOTION
   Bouncy but unhurried. Everything you can press sinks under your finger
   quickly and springs back slowly with a small overshoot. Each kind of
   thing has its own personality:

     topic rows      squish; the icon wiggles, the arrow nudges, a tinted ripple spreads
     level card/CTA  tilt toward your finger in 3D
     buttons         squash flat and spring back
     answer options  pop when chosen, jelly when right, wobble when wrong
     tabs            a glass thumb slides between them (glass.js)
     progress bars   fill with a soft overshoot
     new cards       drop in with a little bounce

   glass.js adds .is-down while a finger is on something, plus the pointer
   position and tilt as CSS variables. Plain :active rules cover the case
   where the script hasn't run.
   ===================================================================== */
@property --rr { syntax: "<length>"; inherits: false; initial-value: 220px; }

:root {
  --bounce: cubic-bezier(.34, 1.45, .64, 1);
  --press: cubic-bezier(.2, .8, .3, 1);
}
/* a real spring where the browser supports it: a soft ~8% overshoot, then settles */
@supports (transition-timing-function: linear(0, 1)) {
  :root { --bounce: linear(0, .22 4%, .62 10%, .93 17%, 1.07 24%, 1.085 28%, 1.06 34%, 1.02 42%, .99 52%, .995 62%, 1.002 76%, 1); }
}

/* ---- everything pressable: quick down, slow springy up ---- */
.topic-card, .level-card, .mock-cta, .btn, .option-btn, .theme-toggle, .seg-btn, .exam-track-tab, .auth-tab, .lb-row, .speak-btn, .badge {
  transition: transform .7s var(--bounce), box-shadow .3s ease, background .2s ease, border-color .2s ease;
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
}
.topic-card:active, .topic-card.is-down,
.btn:active, .btn.is-down,
.option-btn:active, .option-btn.is-down,
.theme-toggle:active, .theme-toggle.is-down,
.seg-btn:active, .seg-btn.is-down, .exam-track-tab:active, .exam-track-tab.is-down, .auth-tab:active, .auth-tab.is-down,
.lb-row:active, .lb-row.is-down, .speak-btn:active, .speak-btn.is-down, .badge.is-down {
  transition: transform .14s var(--press), box-shadow .2s ease, background .2s ease, border-color .2s ease;
}

/* topic rows: squish */
.topic-card:active, .topic-card.is-down { transform: scale(.955) translateY(1px); }
.topic-card .icon-3d, .topic-card .topic-arrow { transition: transform .75s var(--bounce); }
.topic-card:active .icon-3d, .topic-card.is-down .icon-3d { transform: scale(1.14) rotate(-9deg); transition-duration: .16s; transition-timing-function: var(--press); }
.topic-card:active .topic-arrow, .topic-card.is-down .topic-arrow { transform: translateX(6px); transition-duration: .16s; transition-timing-function: var(--press); }
.topic-card[data-tone="purple"] { --rip: var(--purple); }
.topic-card[data-tone="teal"] { --rip: var(--teal); }
.topic-card[data-tone="flame"] { --rip: var(--coral); }
.topic-card[data-tone="bolt"] { --rip: var(--amber); }

/* level card and the big call-to-action: tilt toward the finger */
.level-card, .level-card:hover, .level-card:active,
.mock-cta, .mock-cta:hover, .mock-cta:active {
  transform: perspective(800px) rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg)) scale(var(--sc, 1));
  transform-origin: center;
}
.level-card:active, .level-card.is-down, .mock-cta:active, .mock-cta.is-down { --sc: .968; }
.level-card.is-down, .mock-cta.is-down { transition: transform .12s var(--press), box-shadow .2s ease, background .2s ease; }
.level-card .icon-3d { transition: transform .75s var(--bounce); }
.level-card.is-down .icon-3d { transform: scale(1.12) rotate(8deg); transition-duration: .16s; transition-timing-function: var(--press); }
.mock-cta .topic-arrow { transition: transform .75s var(--bounce); }
.mock-cta.is-down .topic-arrow { transform: translateX(8px); transition-duration: .16s; transition-timing-function: var(--press); }

/* buttons: squash flat, spring back */
.btn:active, .btn.is-down { transform: scale(.94, .91); }
.theme-toggle:active, .theme-toggle.is-down { transform: scale(.88); }
.theme-toggle svg { transition: transform .75s var(--bounce); }
.theme-toggle:active svg, .theme-toggle.is-down svg { transform: rotate(-28deg) scale(.82); transition-duration: .14s; transition-timing-function: var(--press); }
.speak-btn:active, .speak-btn.is-down { transform: scale(.86); }
.badge.is-down { transform: scale(.93); }

/* answer options: a firmer, smaller press; pop / jelly / wobble come from glass.js */
.option-btn:active, .option-btn.is-down { transform: scale(.972) translateY(1px); }
.seg-btn:active, .seg-btn.is-down, .exam-track-tab:active, .exam-track-tab.is-down, .auth-tab:active, .auth-tab.is-down { transform: scale(.95); }

/* leaderboard / list rows: a light nudge */
.lb-row:active, .lb-row.is-down { transform: scale(.982) translateX(2px); }

/* ---- touch ripple, tinted to the card (the same layer as the pointer highlight) ---- */
.topic-card::after, .level-card::after, .btn-primary::after, .mock-cta::after {
  background: radial-gradient(circle var(--rr) at var(--mx, 50%) var(--my, 0%), var(--ripple, var(--glow)), transparent 70%);
}
.topic-card.rip, .level-card.rip, .btn-primary.rip, .mock-cta.rip { --ripple: color-mix(in srgb, var(--rip, var(--purple)) 26%, transparent); }
.btn-primary.rip, .mock-cta.rip { --ripple: rgba(255, 255, 255, .38); }
.topic-card.rip::after, .level-card.rip::after, .btn-primary.rip::after, .mock-cta.rip::after { animation: g-ripple .75s var(--press) 1; }
@keyframes g-ripple {
  from { --rr: 0px; opacity: .95; }
  to { --rr: 360px; opacity: 0; }
}

/* ---- arrivals: cards drop in and settle ---- */
@keyframes rise-in {
  0% { opacity: 0; transform: translateY(18px) scale(.96); }
  55% { opacity: 1; transform: translateY(-3px) scale(1.012); }
  80% { transform: translateY(1px) scale(.997); }
  100% { opacity: 1; transform: none; }
}
@keyframes g-rise {
  0% { opacity: 0; transform: translateY(18px) scale(.97); }
  55% { opacity: 1; transform: translateY(-3px) scale(1.01); }
  80% { transform: translateY(1px); }
  100% { opacity: 1; transform: none; }
}
@keyframes card-in {
  0% { opacity: 0; transform: translateY(14px) scale(.97); }
  60% { opacity: 1; transform: translateY(-2px) scale(1.008); }
  100% { opacity: 1; transform: none; }
}
.topic-card, .option-btn { animation-duration: .65s; animation-timing-function: ease-out; }
.exam-track-block, .goal-block, .countdown-block, .chart-card, .weak-topics-card, .level-card, .settings-card, .formula-card { animation-duration: .7s; animation-timing-function: ease-out; }
.q-card, .feedback { animation-duration: .5s; animation-timing-function: ease-out; }
.topic-grid > .topic-card:nth-child(2) { animation-delay: .05s; } .topic-grid > .topic-card:nth-child(3) { animation-delay: .10s; }
.topic-grid > .topic-card:nth-child(4) { animation-delay: .15s; } .topic-grid > .topic-card:nth-child(5) { animation-delay: .20s; }
.topic-grid > .topic-card:nth-child(6) { animation-delay: .25s; } .topic-grid > .topic-card:nth-child(7) { animation-delay: .30s; }
.topic-grid > .topic-card:nth-child(8) { animation-delay: .35s; }
.options > .option-btn:nth-child(2) { animation-delay: .06s; } .options > .option-btn:nth-child(3) { animation-delay: .12s; }
.options > .option-btn:nth-child(4) { animation-delay: .18s; }

/* ---- progress fills overshoot a little, then settle ---- */
.goal-fill, .xp-bar > div, .topic-progress-fill { transition: width 1s var(--bounce); }

/* ---- calm it all down for anyone who asked ---- */
@media (prefers-reduced-motion: reduce) {
  .topic-card, .level-card, .mock-cta, .btn, .option-btn, .theme-toggle, .seg-btn, .exam-track-tab, .auth-tab, .lb-row, .speak-btn, .badge,
  .topic-card .icon-3d, .topic-card .topic-arrow, .level-card .icon-3d, .mock-cta .topic-arrow, .theme-toggle svg { transition: none; }
  .topic-card:active, .topic-card.is-down, .btn:active, .btn.is-down, .option-btn:active, .option-btn.is-down,
  .level-card:active, .level-card.is-down, .mock-cta:active, .mock-cta.is-down { transform: none; --sc: 1; }
  .topic-card.rip::after, .level-card.rip::after, .btn-primary.rip::after, .mock-cta.rip::after { animation: none; }
}

/* the arrow on the purple call-to-action was grey on purple and almost invisible */
.mock-cta .topic-arrow { color: #fff; opacity: .9; }


/* =====================================================================
   CHILD-FRIENDLY LOOK (body.kids, set by auth.js for student accounts)
   Bigger things to read and tap, rounder shapes, a warmer sunny-and-sky
   backdrop, thicker friendlier progress bars, and a gentle (never red)
   response to a wrong answer. The same glass system underneath.
   ===================================================================== */
body.kids {
  font-size: 17px;
  --orb-a: rgba(255, 168, 84, .30);
  --orb-b: rgba(76, 184, 255, .26);
}
[data-theme="dark"] body.kids { --orb-a: rgba(255, 150, 70, .20); --orb-b: rgba(70, 170, 255, .18); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.kids { --orb-a: rgba(255, 150, 70, .20); --orb-b: rgba(70, 170, 255, .18); }
}
body.kids h1 { font-size: 31px; margin-top: 22px; }
body.kids .subtitle { font-size: 16px; font-weight: 700; color: var(--text-secondary); }

/* big, easy targets */
body.kids .topbar { padding: 8px 10px 8px 12px; border-radius: 26px; }
body.kids .theme-toggle { width: 46px; height: 46px; }
body.kids .badge { font-size: 17px; padding: 6px 16px 6px 6px; }
body.kids .btn { min-height: 58px; font-size: 18px; border-radius: 22px; }
body.kids .btn-sm { min-height: 44px; }

/* sections and topic cards */
body.kids .section-heading { font-size: 25px; margin-top: 30px; }
body.kids .topic-grid { gap: 14px; }
body.kids .topic-card { padding: 16px 18px 16px 16px; border-radius: 28px; gap: 12px; }
body.kids .topic-name { font-size: 19px; }
body.kids .topic-meta { font-size: 14px; font-weight: 700; }
body.kids .icon-3d.sm { width: 56px; height: 56px; border-radius: 21px; }
body.kids .icon-3d.sm svg { width: 27px; height: 27px; }
body.kids .topic-progress-track, body.kids .xp-bar { height: 12px; }
body.kids .topic-progress-fill, body.kids .xp-bar > div { background: linear-gradient(90deg, #FFB84D, #FF7E5F); }
body.kids .level-card { border-radius: 28px; padding: 18px 20px; }
body.kids .level-card-title { font-size: 18px; }
body.kids .level-card-sub { font-size: 14px; }

/* the question */
body.kids .q-card { padding: 24px 22px; border-radius: 32px; }
body.kids .q-text { font-size: 23px; line-height: 1.45; font-weight: 800; margin-bottom: 18px; }
body.kids .tag { font-size: 14px; padding: 5px 12px; }
body.kids .speak-btn { width: 48px; height: 48px; }
body.kids .bookmark-btn { width: 40px; height: 40px; }
body.kids .options { gap: 12px; }
body.kids .option-btn { min-height: 66px; font-size: 20px; font-weight: 800; border-radius: 24px; padding: 16px 22px; }
body.kids .option-btn.selected { border-width: 3px; }
body.kids .option-btn.correct { border-width: 3px; box-shadow: 0 0 0 5px color-mix(in srgb, var(--teal) 22%, transparent); }
/* a wrong answer is a gentle amber, not an alarming red */
body.kids .option-btn.incorrect {
  background: color-mix(in srgb, var(--amber) 22%, var(--well-fill)); border-color: var(--amber); color: var(--amber-dark);
}
body.kids .feedback { font-size: 18px; line-height: 1.5; border-radius: 26px; padding: 18px 20px; }
body.kids .feedback strong { font-size: 21px; }
body.kids .feedback.incorrect { background: color-mix(in srgb, var(--amber) 20%, var(--lg-fill, transparent)); color: var(--amber-dark); border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
body.kids .feedback.correct { box-shadow: 0 0 0 5px color-mix(in srgb, var(--teal) 16%, transparent); }
body.kids .tita-row input { min-height: 62px; font-size: 20px; border-radius: 22px; }

/* homework and tabs */
body.kids .lb-row { padding: 16px 18px; border-radius: 24px; }
body.kids .seg-btn, body.kids .auth-tab { min-height: 52px; font-size: 16px; }
body.kids .empty-state { font-size: 18px; }

@media (max-width: 430px) {
  body.kids .topbar { border-radius: 26px; }
  body.kids .theme-toggle { width: 42px; height: 42px; }
  body.kids .q-text { font-size: 22px; }
}


/* timer chip on Reading Comprehension questions */
.tag.timer { background: var(--purple-bg); color: var(--purple); font-weight: 800; font-variant-numeric: tabular-nums; min-width: 52px; text-align: center; }
.tag.timer.low { background: var(--amber-bg); color: var(--amber-dark); }
.tag.timer.up { background: var(--red-bg); color: var(--red-dark); animation: flicker 1.4s ease-in-out infinite; }


/* =====================================================================
   CLASS GAMES: the teacher's classroom screen (.cg-host) and the student's device (.cg-stage.kid)
   Four answer colours and four team colours, each readable on its own and not only by colour (letters on every tile).
   ===================================================================== */
:root {
  --cg-a: #E5484D; --cg-b: #3E63DD; --cg-c: #F5A524; --cg-d: #30A46C;
  --cg-t0: #E5484D; --cg-t1: #3E63DD; --cg-t2: #30A46C; --cg-t3: #E5A00D;
}
.cg-host .wrap { max-width: 1100px; }
.cg-stage { padding: 6px 0 30px; }
.cg-kicker { font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-secondary); }
.cg-title { font-family: var(--font-display); font-size: clamp(30px, 6vw, 52px); line-height: 1.1; margin: 8px 0 6px; text-align: center; }
.cg-sub { text-align: center; color: var(--text-secondary); font-size: clamp(15px, 2.2vw, 20px); margin: 4px 0 14px; }
.cg-sub.big { font-size: clamp(20px, 4vw, 30px); color: var(--text-primary); }
.cg-hint { color: var(--text-muted); font-size: 14px; font-weight: 700; text-align: center; }
.cg-stage > .cg-kicker { text-align: center; display: block; }
.cg-count { text-align: center; font-size: clamp(16px, 2.4vw, 22px); font-weight: 800; margin: 14px 0; }
.cg-count span { font-family: var(--font-display); font-size: clamp(40px, 8vw, 72px); color: var(--purple); margin-right: 6px; }
.cg-chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 10px 0 18px; min-height: 44px; }
.cg-chip { background: var(--purple-bg); color: var(--purple-dark); font-weight: 800; padding: 10px 18px; border-radius: 999px; font-size: clamp(15px, 2.2vw, 20px); animation: rise-in .5s ease backwards; }
.cg-facts { text-align: center; color: var(--text-secondary); font-weight: 700; margin-bottom: 12px; }
.cg-actions { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 18px; }
.cg-actions .btn { margin-top: 0; width: auto; min-width: 190px; padding: 14px 28px; text-decoration: none; }

.cg-topline { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 10px; }
.cg-clock { font-family: var(--font-display); font-weight: 800; font-size: clamp(30px, 6vw, 56px); min-width: 78px; text-align: center; padding: 2px 18px; border-radius: 18px; background: var(--purple-bg); color: var(--purple-dark); font-variant-numeric: tabular-nums; }
.cg-clock.low { background: var(--red-bg); color: var(--red-dark); animation: flicker 1s ease-in-out infinite; }
.cg-clock.ok { font-size: clamp(16px, 2.4vw, 24px); background: var(--teal-bg); color: var(--teal-dark); padding: 8px 18px; }

.cg-q { font-family: var(--font-display); font-weight: 800; font-size: clamp(26px, 5vw, 46px); line-height: 1.25; margin: 10px 0 20px; text-align: center; }
.cg-q.small { font-size: clamp(22px, 6vw, 30px); }
.cg-options { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 760px) { .cg-options { grid-template-columns: 1fr 1fr; } }
.cg-opt { position: relative; display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-radius: 22px; font-weight: 800; font-size: clamp(18px, 2.8vw, 28px); color: #fff; overflow: hidden; }
.cg-opt.o0, .cg-ans.o0 { background: var(--cg-a); } .cg-opt.o1, .cg-ans.o1 { background: var(--cg-b); }
.cg-opt.o2, .cg-ans.o2 { background: var(--cg-c); color: #3d2a00; } .cg-opt.o3, .cg-ans.o3 { background: var(--cg-d); }
.cg-opt.o4, .cg-ans.o4 { background: #8E4EC6; } .cg-opt.o5, .cg-ans.o5 { background: #0894B3; }
.cg-letter { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.28); font-family: var(--font-display); flex: none; color: inherit; }
.cg-opt.dim { opacity: .38; filter: saturate(.5); }
.cg-opt.right { box-shadow: 0 0 0 6px color-mix(in srgb, var(--teal) 55%, transparent); transform: scale(1.015); }
.cg-votes { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 38%; }
.cg-votes span { display: block; height: 14px; border-radius: 999px; background: rgba(255,255,255,.7); min-width: 4px; transition: width .6s var(--bounce); }
.cg-votes b { font-family: var(--font-display); }
.cg-progress { height: 14px; border-radius: 999px; background: color-mix(in srgb, var(--text-primary) 10%, transparent); overflow: hidden; margin: 20px 0 6px; }
.cg-progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--purple), var(--teal)); border-radius: 999px; transition: width .5s ease; }
.cg-answered { text-align: center; font-weight: 800; color: var(--text-secondary); font-size: clamp(15px, 2.2vw, 20px); }
.cg-explain { text-align: center; color: var(--text-secondary); font-size: clamp(15px, 2.2vw, 20px); margin: 16px auto; max-width: 760px; }

.cg-board { display: flex; flex-direction: column; gap: 8px; margin: 14px auto; max-width: 640px; }
.cg-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 18px; background: var(--lg-fill, rgba(255,255,255,.5)); border: 1px solid var(--lg-edge, var(--border)); font-weight: 800; font-size: clamp(16px, 2.2vw, 22px); }
.cg-row.top { background: color-mix(in srgb, var(--amber) 16%, var(--lg-fill, transparent)); }
.cg-row.me { border-color: var(--purple); box-shadow: 0 0 0 3px color-mix(in srgb, var(--purple) 22%, transparent); }
.cg-rank { width: 34px; height: 34px; border-radius: 50%; background: var(--purple-bg); color: var(--purple-dark); display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-display); flex: none; }
.cg-row.top .cg-rank { background: var(--amber); color: #3d2a00; }
.cg-rowname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cg-pts { font-family: var(--font-display); color: var(--purple); }

.cg-team { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: 13px; font-weight: 800; color: #fff; vertical-align: middle; }
.cg-team.t0 { background: var(--cg-t0); } .cg-team.t1 { background: var(--cg-t1); } .cg-team.t2 { background: var(--cg-t2); } .cg-team.t3 { background: var(--cg-t3); color: #3d2a00; }
.cg-teams { max-width: 640px; margin: 12px auto; display: flex; flex-direction: column; gap: 8px; }
.cg-teamrow { display: grid; grid-template-columns: 120px 1fr 48px; gap: 10px; align-items: center; }
.cg-stage.kid .cg-teamrow { grid-template-columns: 1fr auto; }
.cg-teambar { height: 18px; border-radius: 999px; background: color-mix(in srgb, var(--text-primary) 8%, transparent); overflow: hidden; }
.cg-teambar div { height: 100%; border-radius: 999px; transition: width .6s var(--bounce); }
.cg-teambar .t0 { background: var(--cg-t0); } .cg-teambar .t1 { background: var(--cg-t1); } .cg-teambar .t2 { background: var(--cg-t2); } .cg-teambar .t3 { background: var(--cg-t3); }

.cg-podium { display: flex; justify-content: center; align-items: flex-end; gap: 14px; margin: 24px 0 12px; }
.cg-pod { text-align: center; width: clamp(96px, 24vw, 190px); animation: rise-in .8s ease backwards; }
.cg-pod.p1 { animation-delay: .5s; } .cg-pod.p2 { animation-delay: .25s; } .cg-pod.p3 { animation-delay: 0s; }
.cg-podname { font-weight: 800; font-size: clamp(15px, 2.6vw, 24px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cg-podpts { color: var(--text-secondary); font-weight: 800; margin-bottom: 6px; }
.cg-podblock { border-radius: 18px 18px 0 0; display: flex; align-items: flex-start; justify-content: center; font-family: var(--font-display); font-size: clamp(30px, 6vw, 54px); color: #fff; padding-top: 8px; }
.cg-pod.p1 .cg-podblock { height: clamp(120px, 24vw, 190px); background: linear-gradient(180deg, #F5C542, #E5A00D); }
.cg-pod.p2 .cg-podblock { height: clamp(90px, 18vw, 140px); background: linear-gradient(180deg, #C8CDD6, #9AA3B2); }
.cg-pod.p3 .cg-podblock { height: clamp(64px, 13vw, 100px); background: linear-gradient(180deg, #E0A878, #B97A45); }

/* ---- the student's device ---- */
.cg-stage.kid { max-width: 560px; margin: 0 auto; }
.cg-answers { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 8px; }
.cg-ans { display: flex; align-items: center; gap: 14px; min-height: 84px; border: none; border-radius: 26px; padding: 16px 20px; color: #fff; font-family: var(--font-display); font-weight: 800; font-size: clamp(20px, 5.4vw, 26px); text-align: left; cursor: pointer; box-shadow: 0 6px 0 rgba(0,0,0,.18); transition: transform .5s var(--bounce), box-shadow .2s; }
.cg-ans.o2 { color: #3d2a00; }
.cg-ans:active:not(:disabled) { transform: translateY(4px) scale(.98); box-shadow: 0 2px 0 rgba(0,0,0,.18); }
.cg-ans:disabled { opacity: .45; }
.cg-ans.picked { opacity: 1; transform: scale(1.03); box-shadow: 0 0 0 6px rgba(255,255,255,.7), 0 0 0 10px var(--purple); }
.cg-locked { text-align: center; padding: 30px 0; }
.cg-lockicon { width: 90px; height: 90px; border-radius: 50%; margin: 10px auto 6px; background: var(--teal); color: #fff; display: flex; align-items: center; justify-content: center; animation: pop .6s ease; }
.cg-result { border-radius: 30px; padding: 18px 20px 14px; margin: 8px 0 12px; text-align: center; }
.cg-result.good { background: color-mix(in srgb, var(--teal) 22%, var(--lg-fill, transparent)); }
.cg-result.try, .cg-result.miss { background: color-mix(in srgb, var(--amber) 22%, var(--lg-fill, transparent)); }
.cg-explain { font-size: 17px; color: var(--text-secondary); }
.cg-rankline { text-align: center; font-size: 19px; font-weight: 800; margin: 6px 0; }
.cg-count.big span { color: var(--teal); }

@media (prefers-reduced-motion: reduce) { .cg-pod, .cg-chip, .cg-clock.low, .cg-lockicon { animation: none; } }
@media print { .cg-actions { display: none; } }


/* the "Game time!" banner on a student's home screen */
.game-card { border-color: color-mix(in srgb, var(--coral) 55%, transparent); animation: g-rise .6s var(--ease-out) backwards; }
.game-join { background: var(--coral); color: #fff; font-family: var(--font-display); font-weight: 800; padding: 10px 18px; border-radius: 999px; white-space: nowrap; font-size: 16px; }
body.kids .game-card .level-card-title { font-size: 21px; }

/* ---- photo questions, homework timer, class leaderboard ---- */
.q-photo { display: block; max-width: 100%; max-height: 42vh; margin: 8px auto 12px; border-radius: 14px; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.25); object-fit: contain; }
.cg-stage:not(.kid) .q-photo { max-height: 38vh; }
.speed-chip { display: inline-flex; align-items: center; gap: 4px; min-width: 64px; justify-content: center; padding: 3px 12px; border-radius: 999px; font-weight: 800; background: rgba(127,119,221,.18); color: var(--text-primary); }
.speed-chip.low { background: #e5484d; color: #fff; animation: speedpulse .6s ease-in-out infinite alternate; }
@keyframes speedpulse { from { transform: scale(1); } to { transform: scale(1.08); } }
.lb-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 14px; margin: 6px 0; background: color-mix(in srgb, var(--text-primary) 6%, transparent); }
.lb-row.me { outline: 2px solid #7F77DD; background: color-mix(in srgb, #7F77DD 18%, transparent); }
.lb-rank { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: #f5a623; color: #3d2a00; flex: none; }
.lb-row .lb-name { flex: 1; font-weight: 700; }

/* practice: Previous / Submit side by side, and the "was that a guess?" row */
.practice-nav { margin-top: 12px; }
.practice-nav .btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.guess-row { display: flex; gap: 8px; margin-top: 12px; }
.guess-row .btn { margin-top: 0; flex: 1; }
.guess-row .btn-ghost { flex: 2; }

/* ---- weekly report (teacher) ---- */
.rep-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.rep-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 14px 0; }
.rep-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px; }
.rep-big { font-family: var(--font-display); font-weight: 800; font-size: 28px; line-height: 1.1; }
.rep-big span { font-size: 16px; color: var(--text-muted); }
.rep-cap { font-size: 12px; color: var(--text-secondary); font-weight: 700; margin-top: 2px; }
.rep-delta { display: block; font-size: 11.5px; font-weight: 800; margin-top: 4px; }
.rep-delta.up, .rep-arrow.up { color: var(--teal-dark); }
.rep-delta.down, .rep-arrow.down { color: var(--red-dark); }
.rep-delta.flat { color: var(--text-muted); }
.rep-arrow { font-style: normal; font-size: 11px; font-weight: 800; }
.rep-card { margin-top: 12px; }
.rep-line { font-size: 13.5px; line-height: 1.6; margin: 6px 0; }
.rep-tag { display: inline-block; font-size: 11.5px; font-weight: 800; padding: 3px 10px; border-radius: 999px; margin-right: 6px; }
.rep-tag.good, .rep-chip.good { background: var(--teal-bg); color: var(--teal-dark); }
.rep-tag.bad, .rep-chip.bad { background: var(--red-bg); color: var(--red-dark); }
.rep-tag.idle, .rep-chip.idle { background: var(--surface-2); color: var(--text-secondary); }
.rep-chip.ok { background: var(--purple-bg); color: var(--purple-dark); }
.rep-chip { font-size: 11.5px; font-weight: 800; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.rep-topic { display: flex; align-items: center; gap: 10px; font-size: 13.5px; margin: 8px 0; }
.rep-topic > span:first-child { flex: 1; min-width: 0; }
.rep-topic small { color: var(--text-muted); }
.rep-meter { flex: 0 0 90px; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.rep-meter i { display: block; height: 100%; background: var(--purple); border-radius: 99px; }
.rep-students { display: grid; gap: 10px; }
@media (min-width: 700px) { .rep-students { grid-template-columns: repeat(2, 1fr); } .rep-tiles { grid-template-columns: repeat(4, 1fr); } }
.rep-student { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px; }
.rep-student-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rep-student-nums { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--text-secondary); margin: 8px 0 4px; }
.rep-student-nums b { color: var(--text-primary); font-size: 14px; }
.rep-student-actions { display: flex; gap: 8px; margin-top: 10px; }
.rep-student-actions .btn { margin-top: 0; }
.rep-spark, .rc-days { display: flex; align-items: flex-end; gap: 4px; height: 56px; margin: 6px 0 2px; }
.rep-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; position: relative; }
.rep-bar { width: 100%; max-width: 22px; min-height: 2px; background: var(--purple-light); border-radius: 4px 4px 0 0; }
.rep-bar-n { font-size: 9.5px; color: var(--text-muted); height: 11px; line-height: 11px; }
.rep-bar-d { font-size: 9.5px; color: var(--text-muted); }
.rep-spark .rep-bar-col, .rc-days .rep-bar-col { height: 100%; }

/* report card: always black on white, so it reads the same on screen and on paper */
.rc-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(15, 12, 30, .55); display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 20px 12px; }
.rc-modal { width: 100%; max-width: 520px; min-width: 0; box-sizing: border-box; }
.rc-modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.rc-modal-actions .btn { margin-top: 0; flex: 1; }
.rc { box-sizing: border-box; max-width: 100%; background: #fff; color: #222; border-radius: 16px; padding: 22px 22px 18px; font-family: var(--font-body); border: 1px solid #ddd; }
.rc-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 10px; border-bottom: 2px solid #7F77DD; padding-bottom: 8px; }
.rc-brand { font-family: var(--font-display); font-weight: 800; font-size: 20px; color: #3C3489; }
.rc-kind { font-size: 12px; color: #666; font-weight: 700; }
.rc-name { font-family: var(--font-display); font-weight: 800; font-size: 26px; margin-top: 14px; }
.rc-sub { color: #555; font-size: 13px; margin-bottom: 14px; }
.rc-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.rc-tiles div { background: #f4f2fc; border-radius: 12px; padding: 10px 6px; text-align: center; }
.rc-tiles b { display: block; font-family: var(--font-display); font-size: 22px; color: #3C3489; }
.rc-tiles span { display: block; font-size: 10.5px; line-height: 1.25; color: #555; font-weight: 700; }
.rc-verdict { font-size: 14.5px; line-height: 1.55; margin: 14px 0 8px; }
.rc-days .rep-bar { background: #A79FF0; }
.rc-days .rep-bar-n, .rc-days .rep-bar-d { color: #666; }
.rc-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; padding: 7px 0; border-top: 1px solid #eee; }
.rc-row b { color: #333; }
.rc-row span { text-align: right; }
.rc-comment { margin-top: 14px; font-size: 13px; }
.rc-lines { height: 54px; margin-top: 4px; background: repeating-linear-gradient(to bottom, transparent 0, transparent 26px, #bbb 26px, #bbb 27px); }
.rc-foot { margin-top: 10px; font-size: 11px; color: #777; text-align: center; }
#cards { display: none; }
@media print {
  body.printing-cards .wrap > *:not(#cards), body.printing-cards .rc-backdrop { display: none !important; }
  body.printing-cards #cards { display: block !important; }
  body.printing-cards .wrap { max-width: none; padding: 0; }
  body.printing-cards .rc { border: none; border-radius: 0; page-break-after: always; break-after: page; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.printing-cards .rc:last-child { page-break-after: auto; break-after: auto; }
}

/* free plan (CAT / NMAT): the question counter and the banner */
.tag.free { background: var(--teal-bg); color: var(--teal-dark); }
.tag.free.low { background: var(--amber-bg); color: var(--amber-dark); }
.plan-banner { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 12px 0; padding: 11px 16px; border-radius: 16px; text-decoration: none; font-size: 13.5px; color: var(--text-primary);
  background: linear-gradient(135deg, var(--purple-bg), var(--teal-bg)); border: 1px solid var(--glass-border, var(--border)); }
.plan-banner .plan-cta { flex: none; font-weight: 800; color: #fff; background: var(--purple); padding: 6px 14px; border-radius: 99px; }

/* kids home: join another class */
.join-card { margin: 12px 0; padding: 14px 16px; border-radius: 20px; background: linear-gradient(145deg, rgba(255,255,255,.12), rgba(255,255,255,.04)); border: 1px solid var(--glass-border, var(--border)); }
.join-text { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; } .join-text span { font-size: 13.5px; color: var(--text-secondary); font-weight: 600; }
.join-form { display: flex; gap: 8px; } .join-form .form-input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; text-align: center; }
.join-form .btn { margin-top: 0; width: auto; padding: 0 22px; }
.join-card .status-line { min-height: 0; margin-top: 6px; }
.join-card .status-line:empty { display: none; }

/* ---- solid icons: flat, saturated colour with a white symbol (replaces the glossy bubble look) ---- */
.icon-3d, .icon-3d.sm.square {
  background: var(--solid, #888);
  box-shadow: 0 4px 10px color-mix(in srgb, var(--solid, #888) 38%, transparent);
}
.icon-3d.flame  { --solid: #F0592A; }
.icon-3d.bolt   { --solid: #F5A111; }
.icon-3d.purple { --solid: #6F5CE6; }
.icon-3d.teal   { --solid: #0FA67A; }
.icon-3d svg { filter: none; }
.badge .icon-3d { box-shadow: none; }

/* =====================================================================
   Clean, light-first look. Opaque cards on a calm background, strong text
   contrast, no blur (faster and easier to read). Light is the default;
   dark is the same layout with dark surfaces. Everything above that used
   frosted glass now reads these variables, so this block restyles it all.
   ===================================================================== */
:root {
  --bg: #F4F5FB; --surface: #FFFFFF; --surface-2: #EEF0F8; --border: #E1E4F0;
  --text-primary: #17172B; --text-secondary: #4B4B66; --text-muted: #74748E;
  --purple: #6F5CE6; --purple-mid: #7C6BEA; --purple-deep: #5B49D1; --purple-bg: #ECE9FD; --purple-dark: #3F31A8;
  --teal-dark: #06604A; --coral-dark: #9A2F12; --amber-dark: #7A4700;

  --glass-surface: #FFFFFF; --glass-surface-strong: #FFFFFF; --glass-border: #E1E4F0; --glass-highlight: transparent;
  --glass-shadow: 0 1px 2px rgba(23, 23, 60, .05), 0 8px 22px rgba(23, 23, 60, .07); --glass-blur: 0px;
  --clear-fill: #FFFFFF; --frost-fill: #FFFFFF; --raised-fill: #FFFFFF; --well-fill: #EEF0F8;
  --clear-blur: 0px; --frost-blur: 0px; --raised-blur: 0px; --clear-sat: 100%; --frost-sat: 100%; --raised-sat: 100%;
  --clear-shadow: 0 1px 2px rgba(23, 23, 60, .05);
  --frost-shadow: 0 1px 2px rgba(23, 23, 60, .05), 0 6px 18px rgba(23, 23, 60, .06);
  --raised-shadow: 0 2px 4px rgba(23, 23, 60, .06), 0 12px 28px rgba(23, 23, 60, .10);
  --edge: #E1E4F0; --edge-soft: #E1E4F0; --inset: none; --rim-hi: transparent; --rim-lo: transparent; --glow: rgba(111, 92, 230, .07);
  --grain: linear-gradient(transparent, transparent);
  --mesh-1: transparent; --mesh-2: transparent; --mesh-3: transparent; --orb-a: transparent; --orb-b: transparent;
}
:root[data-theme="dark"] {
  --bg: #0E0F1C; --surface: #171829; --surface-2: #20223A; --border: #2B2E4A;
  --text-primary: #F3F3FB; --text-secondary: #BDBED4; --text-muted: #9092AC;
  --purple-bg: #2A2563; --purple-dark: #BDB6FF;
  --teal-dark: #5FD3AE; --coral-dark: #FFA283; --amber-dark: #FFC878;

  --glass-surface: #171829; --glass-surface-strong: #1D1F36; --glass-border: #2B2E4A;
  --glass-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 22px rgba(0, 0, 0, .35);
  --clear-fill: #171829; --frost-fill: #171829; --raised-fill: #1D1F36; --well-fill: #0E0F1C;
  --clear-shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --frost-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .3);
  --raised-shadow: 0 2px 4px rgba(0, 0, 0, .35), 0 12px 28px rgba(0, 0, 0, .45);
  --edge: #2B2E4A; --edge-soft: #2B2E4A; --glow: rgba(255, 255, 255, .06);
}
body { background: var(--bg); background-attachment: scroll; }
body::before, body::after { display: none; }
*, *::before, *::after { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
.goal-fill::after, .xp-bar > div::after, .topic-progress-fill::after { display: none; }

/* solid primary buttons */
.btn-primary, .mock-cta {
  background: var(--purple); border: none; color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--purple) 32%, transparent);
}
.btn-primary:hover, .mock-cta:hover { background: var(--purple-mid); }
.chip.active { background: var(--purple); border-color: var(--purple); box-shadow: 0 4px 12px color-mix(in srgb, var(--purple) 30%, transparent); }

/* icons: bigger, thicker, high-contrast colours */
.icon-3d.flame  { --solid: #E24A1B; }
.icon-3d.bolt   { --solid: #E08400; }
.icon-3d.purple { --solid: #6F5CE6; }
.icon-3d.teal   { --solid: #0B8F68; }
.icon-3d svg *[stroke] { stroke-width: 2.3; }
.icon-3d.sm svg { width: 25px; height: 25px; }
.tile .icon-3d.sm { width: 48px; height: 48px; border-radius: 16px; }
.tile .icon-3d.sm svg { width: 27px; height: 27px; }
.tile-name { font-size: 17px; }
.tile-meta, .topic-meta, .hero-sub { color: var(--text-secondary); font-weight: 700; }
.theme-toggle { color: var(--text-primary); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle svg *[stroke] { stroke-width: 2.2; }

/* tab bar: dark-enough labels, a solid pill on the current tab */
.tabbar a { color: var(--text-secondary); font-size: 11.5px; }
.tabbar a svg { width: 25px; height: 25px; }
.tabbar a svg *[stroke] { stroke-width: 2.2; }
.tabbar a.active, [data-theme="dark"] .tabbar a.active { color: #fff; background: var(--purple); }
.tabbar { box-shadow: 0 -1px 0 var(--border), 0 10px 30px rgba(23, 23, 60, .16); }

/* the hero: a soft tint instead of a gradient glow */
.hero { background: linear-gradient(135deg, color-mix(in srgb, var(--purple) 14%, var(--raised-fill)), var(--raised-fill) 70%); }

/* =====================================================================
   Tactile layer: buttons and cards you can feel pressing. A solid colour,
   a darker lower edge, and a quick press-down. Same everywhere.
   ===================================================================== */
.btn { border-radius: 16px; font-weight: 800; letter-spacing: .005em; }
.btn-primary, .mock-cta {
  background: var(--purple); color: #fff; border: none;
  box-shadow: 0 4px 0 var(--purple-deep);
  transition: transform .08s ease, box-shadow .08s ease, background .15s ease;
}
.btn-primary:hover, .mock-cta:hover { background: var(--purple-mid); }
.btn-primary:active, .mock-cta:active { transform: translateY(3px) scale(1); box-shadow: 0 1px 0 var(--purple-deep); }
.btn-primary:disabled { background: var(--border); color: var(--text-muted); box-shadow: 0 4px 0 color-mix(in srgb, var(--border) 70%, #000); }
.btn-ghost, .btn-secondary {
  background: var(--surface); color: var(--text-primary);
  border: 1.5px solid var(--border); border-bottom-width: 3.5px; box-shadow: none;
}
.btn-ghost:active, .btn-secondary:active { transform: translateY(2px); border-bottom-width: 1.5px; }
.btn-danger { border-bottom-width: 3.5px; }

.q-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: 22px; box-shadow: none; }
.option-btn {
  background: var(--surface); border: 1.5px solid var(--border); border-bottom-width: 3.5px; border-radius: 14px;
  box-shadow: none; padding: 13px 16px; font-weight: 800;
}
.option-btn:hover:not(:disabled) { border-color: var(--purple); background: color-mix(in srgb, var(--purple) 6%, var(--surface)); }
.option-btn:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 1.5px; }
.option-btn.selected { border-color: var(--purple); background: color-mix(in srgb, var(--purple) 12%, var(--surface)); color: var(--purple-dark); }
.option-btn.correct { border-color: var(--teal); background: color-mix(in srgb, var(--teal) 14%, var(--surface)); color: var(--teal-dark); }
.option-btn.incorrect { border-color: var(--coral); background: color-mix(in srgb, var(--coral) 12%, var(--surface)); color: var(--coral-dark); }
.tita-row input { background: var(--surface); border: 1.5px solid var(--border); border-bottom-width: 3.5px; border-radius: 14px; box-shadow: none; }
.tag.cat-level { background: #26263D; color: #FFD98A; box-shadow: none; }
.tag.nmat-level { background: #1B3A5C; color: #9FD3FF; box-shadow: none; }
.tag { background: var(--surface-2); color: var(--text-secondary); }

.progress-track, .goal-bar, .topic-progress-track { height: 10px; background: var(--surface-2); box-shadow: none; }
.progress-fill, .goal-fill, .topic-progress-fill { background: var(--teal); box-shadow: none; }

/* cards: a flat border and a slightly heavier lower edge */
.topic-card, .level-card, .settings-card, .chart-card, .weak-topics-card, .goal-block, .countdown-block, .exam-track-block, .lb-row {
  border: 1.5px solid var(--border); border-bottom-width: 3px; box-shadow: none;
}
.tile { border: 1.5px solid var(--border); border-bottom-width: 4px; box-shadow: none; background: var(--surface); }
.tile .tile-name { color: var(--text-primary); }
.hero { border: 1.5px solid var(--border); border-bottom-width: 4px; box-shadow: none; }
.tabbar { border: 1.5px solid var(--border); box-shadow: 0 8px 24px rgba(23, 23, 60, .12); }
.topbar { border: 1.5px solid var(--border); box-shadow: none; }

/* topic rows: a percentage ring instead of a bar and an arrow */
.ring-pct {
  --p: 0; flex: none; width: 46px; height: 46px; border-radius: 50%; position: relative;
  background: conic-gradient(var(--teal) calc(var(--p) * 1%), var(--surface-2) 0);
  display: flex; align-items: center; justify-content: center;
}
.ring-pct::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--surface); }
.ring-pct span { position: relative; font-size: 11.5px; font-weight: 800; color: var(--text-primary); }
.ring-pct.done { background: var(--teal); }
.ring-pct.done::before { background: var(--teal); }
.ring-pct.done span { color: #fff; }

/* a stats strip: three numbers across the top of a screen */
.stat-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 14px; }
.stat-strip > div { background: var(--surface); border: 1.5px solid var(--border); border-bottom-width: 3px; border-radius: 16px; padding: 10px 12px; }
.stat-strip b { display: block; font-family: var(--font-display); font-size: 24px; line-height: 1.1; }
.stat-strip span { font-size: 12px; font-weight: 800; color: var(--text-secondary); }
.stat-strip .warn b { color: var(--coral); }
.stat-strip .info b { color: var(--purple); }

/* ---- mock test: exam-style, easy to read ---- */
.mock-timer-bar { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 10px; }
.mock-timer { background: #26263D; color: #fff; border-radius: 12px; padding: 7px 14px; font-family: var(--font-display); font-size: 18px; letter-spacing: .02em; border-bottom: 3px solid #14142A; }
.mock-timer.low { background: var(--coral); border-bottom-color: #A93216; color: #fff; }
.mock-qcounter { background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px; padding: 5px 11px; color: var(--text-primary); }
.group-panel { max-height: 32vh; overflow: auto; background: var(--surface-2); border: 1.5px solid var(--border); border-left: 4px solid var(--purple); border-radius: 12px; font-size: 12.5px; }
.mock-tool { background: var(--surface); border: 1.5px solid var(--border); border-bottom-width: 3px; border-radius: 12px; font-weight: 800; color: var(--text-secondary); }
.mock-tool.on { background: color-mix(in srgb, var(--purple) 12%, var(--surface)); border-color: var(--purple); color: var(--purple-dark); }
.pal-bar { background: var(--surface); border-top: 1.5px solid var(--border); box-shadow: 0 -6px 20px rgba(23, 23, 60, .08); }
.pal-num { border-radius: 9px; border: 1.5px solid var(--border); border-bottom-width: 3px; background: var(--surface); color: var(--text-secondary); font-weight: 800; }
.pal-num.answered { background: var(--teal); border-color: #066A4B; color: #fff; }
.pal-num.unanswered { background: var(--coral); border-color: #A93216; color: #fff; }
.pal-num.marked { background: var(--purple); border-color: var(--purple-deep); color: #fff; border-radius: 50%; }
.pal-num.answered-marked { background: var(--purple); border-color: var(--teal); color: #fff; border-radius: 50%; box-shadow: 0 3px 0 var(--teal); }
.pal-dot.answered { background: var(--teal); border-color: #066A4B; }
.pal-dot.unanswered { background: var(--coral); border-color: #A93216; }
.pal-dot.marked { background: var(--purple); border-color: var(--purple-deep); }
.pal-toggle { background: var(--surface); border: 1.5px solid var(--border); border-bottom-width: 3px; border-radius: 10px; font-weight: 800; }

/* ---- fill in the blanks ---- */
.q-text.fill-text { line-height: 2.2; }
.blank-slot, .blank-input {
  display: inline-block; vertical-align: baseline; min-width: 92px; min-height: 38px; margin: 0 4px; padding: 3px 12px;
  border: 0; border-bottom: 3px solid var(--purple); border-radius: 10px 10px 4px 4px;
  background: color-mix(in srgb, var(--purple) 9%, var(--surface)); color: var(--text-primary);
  font: inherit; font-weight: 800; text-align: center; cursor: pointer;
}
.blank-input { width: 130px; cursor: text; }
.blank-input:focus { outline: none; background: color-mix(in srgb, var(--purple) 16%, var(--surface)); }
.blank-slot.filled { background: var(--surface); border: 1.5px solid var(--purple); border-bottom-width: 3px; color: var(--purple-dark); }
.blank-slot.right, .blank-input.right { background: color-mix(in srgb, var(--teal) 16%, var(--surface)); border-color: var(--teal); color: var(--teal-dark); }
.blank-slot.wrong, .blank-input.wrong { background: color-mix(in srgb, var(--coral) 12%, var(--surface)); border-color: var(--coral); color: var(--coral-dark); text-decoration: line-through; }
.blank-fix { display: inline-block; margin: 0 4px 0 -2px; padding: 2px 10px; border-radius: 99px; background: var(--teal); color: #fff; font-size: .8em; font-weight: 800; }
.word-bank { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; padding: 14px; border-radius: 16px; background: var(--surface-2); border: 1.5px dashed var(--border); }
.bank-word {
  padding: 10px 16px; border-radius: 12px; border: 1.5px solid var(--border); border-bottom-width: 3.5px; background: var(--surface);
  color: var(--text-primary); font: inherit; font-weight: 800; font-size: 15px; cursor: pointer; transition: transform .08s ease;
}
.bank-word:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 1.5px; }
.bank-word:disabled { opacity: .3; cursor: default; border-bottom-width: 1.5px; }
body.kids .bank-word { font-size: 18px; padding: 12px 18px; }
body.kids .blank-slot, body.kids .blank-input { min-height: 46px; font-size: 1em; }

/* the small drawing pad on a teacher's doubt reply */
.draw-wrap { margin-top: 10px; padding: 10px; border-radius: 14px; background: var(--surface-2); border: 1.5px solid var(--border); }
.draw-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.draw-group { display: flex; gap: 6px; align-items: center; }
.draw-btn { height: 32px; padding: 0 10px; border-radius: 9px; cursor: pointer; font: inherit; font-weight: 800; font-size: 11.5px; color: var(--text-secondary); background: var(--surface); border: 1.5px solid var(--border); border-bottom-width: 2.5px; display: inline-flex; align-items: center; justify-content: center; }
.draw-btn.on { color: #fff; background: var(--purple); border-color: var(--purple-deep); }
.draw-swatch { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid var(--surface); box-shadow: 0 0 0 1.5px var(--border); }
.draw-swatch.on { box-shadow: 0 0 0 2.5px var(--purple); }
.draw-sheet { position: relative; border-radius: 10px; overflow: hidden; background: #fff; border: 1.5px solid var(--border); }
.draw-sheet canvas { display: block; touch-action: none; cursor: crosshair; }

/* a drawn reply shown to a student */
.doubt-reply-img { display: block; width: 100%; max-width: 320px; border-radius: 12px; margin-top: 8px; border: 1.5px solid var(--border); cursor: zoom-in; }


/* full-screen look at a drawn doubt answer */
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(10, 10, 20, .88); display: flex; align-items: center; justify-content: center; padding: 20px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; background: #fff; }

/* passages and LRDI sets in practice: readable text, real tables */
.group-panel.readable { white-space: normal; font-family: var(--font-body); font-size: 15px; line-height: 1.65; max-height: 46vh; }
.group-panel.readable p { margin: 0 0 10px; }
.group-panel.readable .group-panel-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gp-table-wrap { overflow-x: auto; margin: 4px 0 10px; }
.gp-table { border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.gp-table th, .gp-table td { border: 1px solid var(--border); padding: 5px 9px; text-align: center; white-space: nowrap; }
.gp-table th { background: var(--surface); font-weight: 800; }

/* Inside the Play Store app nothing offers a purchase (Google Play billing rules); payments happen on the website. */
.in-app .pay-only { display: none !important; }
.app-only { display: none; }
.in-app .app-only { display: block; }
