/* =============================================================
   OctoPrep v2 — design system
   Mobile-first, energetic, brand: yellow #f0c000 / near-black #111.
   One stylesheet powers all four screens + the practice HUD + Pattern Lab.
   ============================================================= */

/* ---- reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --yellow: #f0c000;
  --yellow-dk: #d4a900;
  --yellow-soft: #fff6d6;
  --ink: #111111;
  --ink-soft: #2a2a2a;
  --bg: #ffffff;
  --bg-alt: #f6f6f4;
  --surface: #ffffff;
  --line: #e7e7e2;
  --line-dk: #d6d6cf;
  --text: #18181b;
  --muted: #6b6b6b;
  --muted-2: #767676;   /* F23: was #9a9a9a (2.81:1) -> ~4.5:1 on white */

  --correct: #15803d;
  --correct-bg: #e9faef;
  --correct-line: #8fe3ab;
  --wrong: #c2261b;
  --wrong-bg: #fdecea;
  --wrong-line: #f3b4ad;

  --blue: #2563eb;
  --purple: #7c3aed;
  --teal: #0d9488;

  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 3px rgba(17,17,17,.07);
  --shadow: 0 6px 20px rgba(17,17,17,.09);
  --shadow-lg: 0 16px 44px rgba(17,17,17,.16);
  --shadow-yellow: 0 8px 22px rgba(240,192,0,.38);

  --tap: 52px;            /* min tap target */
  --maxw: 560px;
  --header-h: 56px;

  --ease: cubic-bezier(.22,.61,.36,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
  --spring: cubic-bezier(.34,1.56,.64,1);
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-alt);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
ul { list-style: none; }

/* X1: visible keyboard-focus ring on every interactive surface */
.btn:focus-visible,
.choice:focus-visible,
.mode-card:focus-visible,
.skill-node:focus-visible,
.hud-back:focus-visible,
.brand-btn:focus-visible,
.header-gear:focus-visible,
.grid-input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

/* X1/F25: visually-hidden but screen-reader-available content */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =============================================================
   Sticky branded header
   ============================================================= */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  /* F24: respect notch / rounded-corner safe areas.
     On screens wider than the content column, pad the sides so the header's
     content (logo / streak / gear) lines up with .app-main instead of being
     stranded at the screen edges. The max() keeps mobile/tablet padding at 16px. */
  padding: env(safe-area-inset-top, 0px)
           max(calc(16px + env(safe-area-inset-right, 0px)), calc((100% - var(--maxw)) / 2 + 16px))
           0
           max(calc(16px + env(safe-area-inset-left, 0px)), calc((100% - var(--maxw)) / 2 + 16px));
  background: var(--ink);
  box-shadow: 0 2px 14px rgba(0,0,0,.22);
}
.app-header img {
  width: 30px; height: 30px;
  object-fit: contain;
  display: block;
}
.app-header .brand {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: .14em;
  color: var(--yellow);
}
.app-header .brand-btn {
  background: none; border: none; cursor: pointer;
  padding: 6px 2px; min-height: 44px;   /* WCAG 2.5.5 min tap target */
  display: inline-flex; align-items: center;
}
.app-header .header-spacer { flex: 1; }
.app-header .header-streak {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .9rem; font-weight: 700;
  color: #fff;
  padding: 4px 10px;
  background: rgba(255,255,255,.08);
  border-radius: var(--r-pill);
}
.app-header .header-gear {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;   /* WCAG 2.5.5 min tap target */
  font-size: 1.3rem; line-height: 1;
  color: #fff;
  background: rgba(255,255,255,.08);
  border-radius: 50%;
}
.app-header .header-gear:hover { background: rgba(255,255,255,.16); }

/* =============================================================
   Screen container & routing
   ============================================================= */
.app-main {
  max-width: var(--maxw);
  margin: 0 auto;
  /* F24: keep content clear of the home indicator + side safe areas */
  padding: 18px
           calc(16px + env(safe-area-inset-right, 0px))
           calc(96px + env(safe-area-inset-bottom, 0px))
           calc(16px + env(safe-area-inset-left, 0px));
  position: relative;
}

.screen { display: none; }
.screen.active {
  display: block;
  animation: screen-in .34s var(--ease-out);
}
@keyframes screen-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.screen-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.01em;
  margin: 4px 0 16px;
}
.section-label {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin: 22px 0 10px;
}

/* =============================================================
   Buttons
   ============================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 22px;
  border-radius: var(--r-pill);
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  border: 2px solid var(--line-dk);
  transition: transform .12s var(--ease), box-shadow .18s var(--ease),
    background .18s, border-color .18s;
  user-select: none;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--ink);
  box-shadow: var(--shadow-yellow);
}
.btn-primary:active { box-shadow: 0 3px 12px rgba(240,192,0,.4); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-block { display: flex; width: 100%; }
.btn-lg { min-height: 58px; font-size: 1.08rem; }
.btn-sm { min-height: 40px; font-size: .9rem; padding: 0 16px; }

/* =============================================================
   HOME — Mission Control
   ============================================================= */
.mc-hero {
  background: linear-gradient(150deg, var(--ink) 0%, #1d1d20 100%);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 22px 22px 26px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.mc-hero::after {
  content: "";
  position: absolute;
  right: -40px; top: -40px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(240,192,0,.28), transparent 70%);
  pointer-events: none;
}
.mc-hello { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--yellow); font-weight: 700; }
.mc-level-row { display: flex; align-items: baseline; gap: 10px; margin-top: 4px; }
.mc-level { font-size: 2rem; font-weight: 800; line-height: 1; }
.mc-level small { font-size: .85rem; font-weight: 600; color: var(--muted-2); }

/* XP bar */
.xp-bar {
  position: relative;
  height: 14px;
  border-radius: var(--r-pill);
  background: rgba(255,255,255,.14);
  margin-top: 14px;
  overflow: hidden;
}
.xp-bar > span {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--yellow-dk), var(--yellow));
  transition: width .9s var(--ease-out);
}
.xp-meta { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted-2); margin-top: 6px; }

/* streak chip */
.streak {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 800; font-size: .95rem;
  color: var(--ink);
  background: var(--yellow);
  padding: 7px 14px;
  border-radius: var(--r-pill);
}
.streak .flame { font-size: 1.1rem; filter: drop-shadow(0 1px 2px rgba(0,0,0,.2)); }
.streak.cold { background: rgba(255,255,255,.12); color: #fff; }

/* readiness gauge */
.readiness-gauge {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  margin-top: 16px;
  box-shadow: var(--shadow-sm);
}
.rg-dial {
  --pct: 0;
  flex: 0 0 96px;
  width: 96px; height: 96px;
  border-radius: 50%;
  background:
    radial-gradient(closest-side, #fff 78%, transparent 79% 100%),
    conic-gradient(var(--yellow) calc(var(--pct) * 1%), var(--line) 0);
  display: grid; place-items: center;
  position: relative;
  transition: background .9s var(--ease-out);
}
.rg-score { font-size: 1.55rem; font-weight: 800; line-height: 1; }
.rg-score small { display: block; font-size: .6rem; font-weight: 700; letter-spacing: .08em; color: var(--muted-2); text-transform: uppercase; }
.rg-text h3 { font-size: 1.02rem; font-weight: 800; }
.rg-text p { font-size: .85rem; color: var(--muted); margin-top: 2px; }
.rg-range { font-size: .72rem; color: var(--muted-2); margin-top: 6px; }

/* mode cards */
.mode-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 4px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  transition: transform .14s var(--ease), box-shadow .2s var(--ease), border-color .2s;
  min-height: 96px;
  overflow: hidden;
}
.mode-card:active { transform: scale(.97); }
.mode-card:hover { box-shadow: var(--shadow); border-color: var(--line-dk); }
.mode-card .mc-icon { font-size: 1.5rem; }
.mode-card .mc-name { font-weight: 800; font-size: 1.02rem; }
.mode-card .mc-sub { font-size: .82rem; color: var(--muted); line-height: 1.35; }

/* primary (Pattern Lab) — full-width hero card */
.mode-card.primary {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--yellow) 0%, #ffd633 100%);
  border-color: var(--yellow-dk);
  box-shadow: var(--shadow-yellow);
  min-height: 124px;
  padding: 22px;
}
.mode-card.primary .mc-name { font-size: 1.3rem; }
.mode-card.primary .mc-sub { color: #5a4700; font-weight: 600; }
.mode-card.primary .mc-tag {
  position: absolute; top: 14px; right: 14px;
  font-size: .62rem; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase;
  background: var(--ink); color: var(--yellow);
  padding: 4px 9px; border-radius: var(--r-pill);
}
.mode-card.primary .mc-icon { font-size: 1.9rem; }

.mode-card.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: auto; }
.mode-card.wide .mc-icon { font-size: 1.4rem; }
.mode-card.wide .mc-body { flex: 1; }
.mode-card.wide .chev { color: var(--muted-2); font-size: 1.4rem; }

/* badges shelf */
.badge-shelf { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .8rem; font-weight: 700;
  padding: 7px 12px;
  border-radius: var(--r-pill);
  background: var(--yellow-soft);
  border: 1px solid var(--yellow);
  color: #7a5e00;
}
.badge .b-ico { font-size: 1rem; }
.badge.locked { background: var(--bg-alt); border-color: var(--line); color: var(--muted-2); filter: grayscale(.6); opacity: .7; }
.badge.pop { animation: badge-pop .6s var(--spring) both; }
@keyframes badge-pop {
  0% { transform: scale(0) rotate(-14deg); opacity: 0; }
  60% { transform: scale(1.18) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}

/* =============================================================
   SKILL MAP
   ============================================================= */
.domain-block { margin-bottom: 26px; }
.domain-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.domain-head h2 { font-size: 1.05rem; font-weight: 800; }
.domain-head .dom-stat { font-size: .78rem; color: var(--muted-2); font-weight: 700; }

.skill-node {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-dk);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  transition: transform .12s var(--ease), box-shadow .2s, border-color .2s;
}
.skill-node:active { transform: scale(.985); }
.skill-node:hover { box-shadow: var(--shadow); }
.sn-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sn-label { font-weight: 700; font-size: .98rem; }
.sn-pct { font-size: .82rem; font-weight: 800; color: var(--muted); flex: none; }
.sn-tags { display: flex; gap: 6px; margin-top: 4px; }
.sn-flag {
  font-size: .64rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 7px; border-radius: var(--r-pill);
}
.sn-flag.weak { background: var(--wrong-bg); color: var(--wrong); }
.sn-flag.pattern { background: #ede9fe; color: var(--purple); }
.sn-flag.mastered { background: var(--correct-bg); color: var(--correct); }

.skill-node.weak { border-left-color: var(--wrong); }
.skill-node.mastered { border-left-color: var(--correct); }

/* mastery bar (reused on home, map, results) */
.mastery-bar {
  position: relative;
  height: 9px;
  border-radius: var(--r-pill);
  background: var(--line);
  margin-top: 10px;
  overflow: hidden;
}
.mastery-bar > span {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--yellow-dk), var(--yellow));
  transition: width 1s var(--ease-out);
}
.mastery-bar.is-weak > span { background: linear-gradient(90deg, #e8835a, #f0a64a); }
.mastery-bar.is-mastered > span { background: linear-gradient(90deg, #16a34a, #4ade80); }
.mastery-bar.animate > span { animation: bar-fill 1s var(--ease-out) both; }
@keyframes bar-fill { from { width: var(--from, 0); } to { width: var(--to); } }

/* =============================================================
   PRACTICE — HUD + question card
   ============================================================= */
.hud {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;          /* responsive: chips drop below on narrow / landscape */
}
/* F21: 44px hit target (a11y min) with a 40px visible circle via padding.
   Unscoped from .hud so the SAME button works on the Skill Map (.map-head),
   where it previously collapsed to bare-glyph size (~6x16px). */
.hud-back {
  width: 44px; height: 44px; flex: none;
  padding: 2px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 1.2rem; color: var(--ink);
  background-clip: padding-box;
}
.hud .hud-meta { flex: 1; min-width: 0; }
.hud .hud-mode { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); }
.hud .hud-count { font-size: .95rem; font-weight: 800; }
.hud .hud-combo {
  display: inline-flex; align-items: center; gap: 5px;
  font-weight: 800; font-size: .92rem;
  padding: 6px 12px; border-radius: var(--r-pill);
  background: var(--yellow-soft); color: #7a5e00; border: 1px solid var(--yellow);
  transition: transform .2s var(--spring);
}
.hud .hud-combo.hot { background: var(--yellow); color: var(--ink); transform: scale(1.06); }
.hud .hud-combo.hidden { display: none; }
.hud .hud-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 800; font-size: 1.05rem;
  padding: 6px 12px; border-radius: var(--r-pill);
  background: var(--ink); color: #fff;
}
.hud .hud-timer.warn { background: var(--wrong); animation: timer-pulse 1s infinite; }
@keyframes timer-pulse { 50% { opacity: .6; } }

/* session progress */
.progress {
  position: relative;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--line);
  overflow: hidden;
  margin-bottom: 18px;
}
.progress > span {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0;
  background: linear-gradient(90deg, var(--ink), #3a3a3a);
  border-radius: var(--r-pill);
  transition: width .45s var(--ease-out);
}
.progress.pattern-prog > span { background: linear-gradient(90deg, var(--purple), #a78bfa); }

/* question card */
.q-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  animation: card-in .34s var(--ease-out);
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(18px) scale(.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.q-tags { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.q-chip {
  font-size: .68rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  padding: 4px 9px; border-radius: var(--r-pill);
  background: var(--bg-alt); color: var(--muted);
}
.q-chip.same-pattern { background: #ede9fe; color: var(--purple); }
.q-chip.spot-it { background: var(--ink); color: var(--yellow); }
.q-chip.diff-hard { background: var(--wrong-bg); color: var(--wrong); }
.q-chip.diff-medium { background: #fff3d6; color: #7a5a00; }  /* F23: was #946c00 (4.32:1) -> ~5.4:1 */
.q-chip.diff-easy { background: var(--correct-bg); color: var(--correct); }

.q-stem {
  font-size: 1.16rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: pre-wrap;       /* preserve line breaks + ASCII math */
  word-break: break-word;
}

/* choices */
.choices { margin-top: 18px; display: grid; gap: 10px; }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  min-height: var(--tap);
  padding: 12px 16px;
  border-radius: var(--r);
  background: var(--bg);
  border: 2px solid var(--line);
  font-size: 1.02rem;
  color: var(--text);
  transition: transform .1s var(--ease), border-color .15s, background .15s, box-shadow .15s;
}
.choice:active { transform: scale(.985); }
.choice:not(:disabled):hover { border-color: var(--line-dk); }
.choice .ch-letter {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; font-size: .9rem;
  background: var(--bg-alt); color: var(--muted);
  border: 1px solid var(--line);
  transition: all .15s;
}
.choice .ch-text { flex: 1; white-space: pre-wrap; word-break: break-word; }
.choice .ch-mark { flex: none; font-size: 1.2rem; opacity: 0; }

.choice.selected { border-color: var(--ink); background: #fafafa; }
.choice.selected .ch-letter { background: var(--ink); color: #fff; border-color: var(--ink); }

.choice.correct {
  border-color: var(--correct-line);
  background: var(--correct-bg);
  animation: choice-correct .5s var(--spring);
}
.choice.correct .ch-letter { background: var(--correct); color: #fff; border-color: var(--correct); }
.choice.correct .ch-mark { opacity: 1; color: var(--correct); }
@keyframes choice-correct {
  0% { transform: scale(1); }
  40% { transform: scale(1.035); }
  100% { transform: scale(1); }
}

.choice.wrong {
  border-color: var(--wrong-line);
  background: var(--wrong-bg);
  animation: shake .42s var(--ease);
}
.choice.wrong .ch-letter { background: var(--wrong); color: #fff; border-color: var(--wrong); }
.choice.wrong .ch-mark { opacity: 1; color: var(--wrong); }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
.choice:disabled { cursor: default; }

/* grid input */
.grid-wrap { margin-top: 18px; }
.grid-input {
  width: 100%;
  min-height: 60px;
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: .04em;
  color: var(--ink);
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: var(--r);
  padding: 12px 14px;
  transition: border-color .15s, background .15s, box-shadow .15s;
  font-variant-numeric: tabular-nums;
}
.grid-input:focus { outline: none; border-color: var(--yellow); box-shadow: 0 0 0 4px rgba(240,192,0,.2); }
.grid-input.correct { border-color: var(--correct); background: var(--correct-bg); color: var(--correct); animation: choice-correct .5s var(--spring); }
.grid-input.wrong { border-color: var(--wrong); background: var(--wrong-bg); color: var(--wrong); animation: shake .42s var(--ease); }
.grid-hint { font-size: .78rem; color: var(--muted-2); text-align: center; margin-top: 8px; }

/* feedback block (correct answer + explanation) */
.feedback {
  margin-top: 16px;
  border-radius: var(--r);
  padding: 16px;
  border: 1px solid var(--line);
  animation: fb-in .3s var(--ease-out) both;
}
@keyframes fb-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.feedback.ok { background: var(--correct-bg); border-color: var(--correct-line); }
.feedback.no { background: var(--wrong-bg); border-color: var(--wrong-line); }
.fb-head { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1rem; margin-bottom: 6px; }
.feedback.ok .fb-head { color: var(--correct); }
.feedback.no .fb-head { color: var(--wrong); }
.fb-answer { font-weight: 700; margin-bottom: 8px; }
.fb-answer b { color: var(--ink); }
.fb-explain { font-size: .92rem; color: var(--ink-soft); white-space: pre-wrap; }
.fb-tip { font-size: .82rem; color: var(--muted); margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line-dk); }

/* action row */
.q-actions { margin-top: 18px; display: flex; gap: 10px; }

/* floating XP / combo popups */
/* F22: keep popups off the question stem AND the HUD (incl. landscape) by
   pinning them near the top, and stagger XP vs combo so they don't overlap. */
.xp-pop, .combo-pop {
  position: fixed;
  left: 50%;
  top: min(22%, 160px);
  transform: translateX(-50%);
  z-index: 80;
  pointer-events: none;
  font-weight: 800;
  white-space: nowrap;
}
.xp-pop {
  color: var(--ink);
  background: var(--yellow);
  padding: 8px 18px;
  border-radius: var(--r-pill);
  font-size: 1.2rem;
  box-shadow: var(--shadow-yellow);
  animation: float-up 1.05s var(--ease-out) forwards;
}
/* F22: was #fff on a transparent (white) bg -> invisible. Now a solid dark chip
   with yellow text, offset above the XP pop so the two don't collide. */
.combo-pop {
  top: min(13%, 96px);
  color: var(--yellow);
  background: var(--ink);
  padding: 8px 18px;
  border-radius: var(--r-pill);
  font-size: 1.5rem;
  box-shadow: var(--shadow-lg);
  animation: combo-burst 1.1s var(--ease-out) forwards;
}
.combo-pop .x { color: #fff; font-size: .95rem; margin-left: 4px; letter-spacing: .04em; }
@keyframes float-up {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px) scale(.7); }
  18% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.05); }
  35% { transform: translateX(-50%) translateY(-4px) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-70px) scale(.95); }
}
@keyframes combo-burst {
  0% { opacity: 0; transform: translateX(-50%) scale(.4) rotate(-8deg); }
  25% { opacity: 1; transform: translateX(-50%) scale(1.25) rotate(3deg); }
  45% { transform: translateX(-50%) scale(1) rotate(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-50px) scale(.95); }
}

/* =============================================================
   PATTERN LAB — blueprint card + win screen
   ============================================================= */
.blueprint {
  background: linear-gradient(160deg, #1b1530 0%, var(--ink) 100%);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 24px 22px;
  box-shadow: var(--shadow-lg);
  animation: card-in .4s var(--ease-out);
}
.bp-eyebrow { font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--yellow); }
.bp-title { font-size: 1.4rem; font-weight: 800; margin: 6px 0 16px; line-height: 1.25; }
.bp-tell {
  background: rgba(240,192,0,.12);
  border: 1px solid rgba(240,192,0,.35);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 18px;
}
.bp-tell .lab { font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--yellow); display: block; margin-bottom: 4px; }
.bp-tell p { font-size: 1rem; line-height: 1.5; white-space: pre-wrap; }
.bp-steps-lab { font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 10px; }
.bp-step {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  align-items: flex-start;
}
.bp-step .num {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--yellow); color: var(--ink);
  font-weight: 800; font-size: .85rem;
}
.bp-step .txt { font-size: .96rem; line-height: 1.5; color: #e9e9ec; white-space: pre-wrap; }
.blueprint .btn { margin-top: 10px; }

/* pattern stage chip in HUD */
.pattern-stage {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--purple);
}

/* win / results celebration */
.win-card, .results-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 26px 22px;
  box-shadow: var(--shadow);
  text-align: center;
}
.win-burst {
  font-size: 3.4rem;
  animation: badge-pop .7s var(--spring) both;
}
.win-card h2 { font-size: 1.5rem; font-weight: 800; margin: 6px 0 4px; }
.win-card p { color: var(--muted); }
.win-mastery { margin: 20px auto 6px; max-width: 320px; text-align: left; }
.win-mastery .lab { font-size: .78rem; font-weight: 700; color: var(--muted); display: flex; justify-content: space-between; }

/* =============================================================
   RESULTS
   ============================================================= */
.results-card .res-score {
  font-size: 3rem; font-weight: 800; line-height: 1;
}
.results-card .res-score small { font-size: 1.1rem; color: var(--muted-2); font-weight: 700; }
.results-card .res-sub { color: var(--muted); margin-top: 4px; }

.res-stats { display: flex; gap: 10px; justify-content: center; margin: 20px 0; flex-wrap: wrap; }
.res-stat {
  flex: 1; min-width: 90px;
  background: var(--bg-alt);
  border-radius: var(--r);
  padding: 14px 10px;
}
.res-stat .v { font-size: 1.5rem; font-weight: 800; }
.res-stat .v.xp { color: var(--yellow-dk); }
.res-stat .k { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-2); margin-top: 2px; }

.res-deltas { text-align: left; margin-top: 8px; }
.delta-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}
.delta-row:last-child { border-bottom: none; }
.delta-row .d-label { flex: 1; font-weight: 700; font-size: .95rem; }
.delta-row .d-bar { flex: 0 0 110px; }
.delta-row .d-change { flex: none; font-size: .82rem; font-weight: 800; }
.delta-row .d-change.up { color: var(--correct); }
.delta-row .d-change.flat { color: var(--muted-2); }
.delta-row .d-change.down { color: var(--wrong); }

.res-newbadges { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

.results-cta { display: grid; gap: 10px; margin-top: 22px; }

/* =============================================================
   Empty / utility states
   ============================================================= */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.empty-state .ic { font-size: 2.6rem; margin-bottom: 10px; }
.empty-state h2,
.empty-state h3 { color: var(--text); font-weight: 800; font-size: 1.3rem; margin-bottom: 6px; }
.empty-state p { max-width: 36ch; margin: 0 auto; }
.empty-state .results-cta { margin-top: 24px; }

.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 90;
  background: var(--ink); color: #fff;
  padding: 12px 20px; border-radius: var(--r-pill);
  font-weight: 700; font-size: .9rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s var(--ease-out);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* =============================================================
   F32d — even mode cards: pin content to the top
   ============================================================= */
.mode-card { justify-content: flex-start; }
.mode-card .mc-sub { margin-top: auto; }   /* push sub to fill, keep name/icon aligned */
.mode-card.primary .mc-sub { margin-top: 6px; }

/* =============================================================
   Map / Settings header rows (Back chip + title)
   ============================================================= */
.map-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.map-head .screen-title { margin: 0; }

/* =============================================================
   Readiness empty state (F15)
   ============================================================= */
.rg-score.rg-empty { color: var(--muted-2); }

/* =============================================================
   Recent sessions recap (critic-5)
   ============================================================= */
.recap-list { display: grid; gap: 8px; }
.recap-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px 14px;
  font-size: .88rem;
  box-shadow: var(--shadow-sm);
}
.recap-row .recap-mode { font-weight: 800; flex: 1; }
.recap-row .recap-score { font-weight: 800; }
.recap-row .recap-xp { color: var(--yellow-dk); font-weight: 700; }
.recap-row .recap-when { color: var(--muted-2); font-size: .78rem; min-width: 56px; text-align: right; }

/* =============================================================
   Badge shelf — show name + how-to-earn (F32c)
   ============================================================= */
.badge { flex-direction: column; align-items: flex-start; max-width: 100%; }
.badge .b-name { font-weight: 800; }
.badge .b-how { font-size: .68rem; font-weight: 600; color: var(--muted); }
.badge.locked .b-how { color: var(--muted-2); }

/* =============================================================
   Win tally (F20)
   ============================================================= */
.win-tally { font-weight: 800; font-size: 1.05rem; margin-top: 6px; }

/* =============================================================
   HUD "Show the tell" collapsible (F31)
   ============================================================= */
.hud-tell {
  flex: 0 0 100%;
  order: 9;
  margin-top: 6px;
  background: var(--ink); color: #fff;
  border-radius: var(--r-sm);
  padding: 8px 12px;
}
.hud-tell summary {
  cursor: pointer;
  font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--yellow);
  list-style: none;
}
.hud-tell summary::-webkit-details-marker { display: none; }
.hud-tell summary::before { content: "▸ "; }
.hud-tell[open] summary::before { content: "▾ "; }
.hud-tell-body { font-size: .88rem; line-height: 1.45; margin-top: 6px; white-space: pre-wrap; color: #e9e9ec; }

/* =============================================================
   Check button nudge + grid invalid (F10/F13)
   ============================================================= */
.check-btn[aria-disabled="true"] { opacity: .55; }
.check-btn.nudge { animation: shake .4s var(--ease); }
.grid-input.invalid {
  border-color: var(--yellow-dk);
  box-shadow: 0 0 0 4px rgba(240,192,0,.25);
  animation: shake .4s var(--ease);
}

/* =============================================================
   Per-question review (F11)
   ============================================================= */
.review-block { margin-top: 18px; text-align: left; }
.review-block > summary {
  cursor: pointer;
  font-size: .8rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
  padding: 8px 0;
}
.review-list { display: grid; gap: 10px; margin-top: 8px; }
.review-item {
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-dk);
  border-radius: var(--r);
  padding: 12px 14px;
  background: var(--surface);
}
.review-item.ok { border-left-color: var(--correct); }
.review-item.no { border-left-color: var(--wrong); }
.review-item.blank { border-left-color: var(--muted-2); }
.rv-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.rv-icon { font-weight: 800; }
.review-item.ok .rv-icon { color: var(--correct); }
.review-item.no .rv-icon { color: var(--wrong); }
.review-item.blank .rv-icon { color: var(--muted-2); }
.rv-n { font-weight: 800; font-size: .82rem; color: var(--muted); }
.rv-stem { font-size: .9rem; white-space: pre-wrap; }
.rv-ans { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; font-size: .84rem; font-weight: 700; }
.rv-yours { color: var(--ink); }
.rv-correct { color: var(--correct); }
.rv-explain { font-size: .82rem; color: var(--muted); margin-top: 6px; white-space: pre-wrap; }

/* =============================================================
   Settings / Profile (F19, B1)
   ============================================================= */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.settings-card h2 { font-size: 1.05rem; font-weight: 800; margin-bottom: 10px; }
.settings-card .set-note { font-size: .86rem; color: var(--muted); margin-bottom: 12px; }
.settings-card .btn { margin-top: 10px; }
.set-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.set-stats > div { background: var(--bg-alt); border-radius: var(--r); padding: 12px; text-align: center; }
.set-stats b { display: block; font-size: 1.4rem; font-weight: 800; }
.set-stats span { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-2); }
.set-lastbackup { font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
.settings-card.danger { border-color: var(--wrong-line); }
.btn-danger { background: var(--wrong); border-color: var(--wrong); color: #fff; }
.btn-danger:active { box-shadow: 0 3px 12px rgba(194,38,27,.35); }

/* =============================================================
   Overlays — intro (F17) + resume prompt (F05)
   ============================================================= */
.overlay {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(17,17,17,.55);
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  animation: fb-in .25s var(--ease-out) both;
}
.overlay-sheet {
  width: 100%;
  max-width: min(var(--maxw), 620px);   /* overlays stay readable even when --maxw is wide */
  /* landscape / short viewports: keep the sheet on-screen and scrollable */
  max-height: calc(100dvh - 32px - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 24px 22px;
  box-shadow: var(--shadow-lg);
  animation: screen-in .3s var(--ease-out) both;
}
.overlay-sheet h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 8px; }
.overlay-lead { color: var(--muted); margin-bottom: 14px; }
.overlay-note { font-size: .84rem; color: var(--muted); margin: 12px 0; }
.overlay-sheet .btn { margin-top: 10px; }
.intro-list { display: grid; gap: 14px; margin: 6px 0 8px; }
.intro-list li { display: flex; gap: 12px; align-items: flex-start; font-size: .92rem; line-height: 1.45; }
.intro-list li .ic { font-size: 1.4rem; flex: none; }
.intro-list li b { font-weight: 800; }
.resume-where {
  font-weight: 800; font-size: 1rem;
  background: var(--bg-alt); border-radius: var(--r);
  padding: 12px 14px; margin: 8px 0 4px;
}

@media (min-width: 620px) {
  .overlay { align-items: center; }
}

/* =============================================================
   Larger screens
   ============================================================= */
@media (min-width: 620px) {
  .app-main { padding-top: 26px; }
  .mode-grid { gap: 14px; }
}

/* tablet (≈768) — a touch more breathing room, content stays centered */
@media (min-width: 768px) {
  :root { --maxw: 620px; }
  .screen-title { font-size: 1.7rem; }
  .mc-hero { padding: 26px 26px 30px; }
  .q-card { padding: 26px 26px; }
}

/* =============================================================
   Narrow phones (≤360px) — prevent overflow, keep tap targets sane
   ============================================================= */
@media (max-width: 360px) {
  .app-main {
    padding-left: calc(12px + env(safe-area-inset-left, 0px));
    padding-right: calc(12px + env(safe-area-inset-right, 0px));
  }
  .mode-grid { gap: 10px; }
  .mode-card { padding: 14px; min-height: 88px; }
  .mode-card.primary { padding: 18px; }
  .q-stem { font-size: 1.08rem; }
  .grid-input { font-size: 1.4rem; }
  .readiness-gauge { gap: 14px; padding: 16px; }
  .rg-dial { flex-basis: 84px; width: 84px; height: 84px; }
  .res-stats { gap: 8px; }
  .res-stat { min-width: 78px; }
  /* keep the timed HUD legible: smaller chips, allow wrapping */
  .hud .hud-timer, .hud .hud-combo { font-size: .9rem; padding: 5px 10px; }
}

/* =============================================================
   Landscape / short viewports — avoid vertical overflow + popup/HUD overlap
   ============================================================= */
@media (orientation: landscape) and (max-height: 520px) {
  .app-main {
    padding-top: 10px;
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  }
  .mc-hero { padding: 16px 18px 18px; }
  .readiness-gauge { padding: 12px 16px; margin-top: 12px; }
  .q-card { padding: 16px 18px; }
  .blueprint { padding: 16px 18px; }
  .win-card, .results-card { padding: 18px; }
  /* popups: in a short landscape window the centered HUD + stem fill the upper
     area, so anchor the transient floats to the top-right corner (clear of the
     header brand on the left and the question content in the center). */
  .xp-pop, .combo-pop {
    left: auto;
    right: calc(12px + env(safe-area-inset-right, 0px));
    transform: none;
  }
  .combo-pop { top: 60px; font-size: 1.05rem; padding: 5px 12px; }
  .xp-pop { top: 104px; font-size: .95rem; padding: 5px 12px; }
  /* override the translateX(-50%) baked into the float keyframes */
  @keyframes float-up {
    0% { opacity: 0; transform: translateY(8px) scale(.8); }
    20% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-30px) scale(.95); }
  }
  @keyframes combo-burst {
    0% { opacity: 0; transform: scale(.6); }
    25% { opacity: 1; transform: scale(1.1); }
    100% { opacity: 0; transform: translateY(-26px) scale(.95); }
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  /* reduce-motion: popups appear/disappear without the float animation but must
     still auto-clear (JS removes them on a timer) — keep them visible meanwhile. */
  .xp-pop, .combo-pop { opacity: 1 !important; }
}

/* cloud-save status chip (Settings) */
.sync-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .82rem; font-weight: 700;
  padding: 6px 12px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--bg-alt); color: var(--muted);
  margin: 2px 0 10px;
}
.sync-chip.synced  { background: var(--correct-bg); border-color: var(--correct-line); color: var(--correct); }
.sync-chip.syncing { background: var(--bg-alt); border-color: var(--line-dk); color: var(--muted); }
.sync-chip.offline { background: var(--yellow-soft); border-color: var(--yellow-dk); color: var(--yellow-dk); }
.sync-chip.off     { background: var(--bg-alt); border-color: var(--line); color: var(--muted-2); }

/* refresher card — plain-English topic primer (Pattern Lab intro / timed pre-flight / 📖 overlay).
   Theme-neutral container so it works on the app background AND inside the light overlay sheet. */
.refresher-card { padding: 2px 0 0; }
.rf-eyebrow { font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--yellow-dk); }
.rf-title { font-size: 1.4rem; font-weight: 800; margin: 5px 0 16px; line-height: 1.2; }
.rf-block { margin: 0 0 15px; }
.rf-lab { display: block; font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 6px; }
.rf-block > p { margin: 0; font-size: 1rem; line-height: 1.5; color: var(--text); }
.rf-step { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; }
.rf-num { flex: none; width: 23px; height: 23px; border-radius: 50%; background: var(--yellow-soft); color: var(--yellow-dk); font-weight: 800; font-size: .8rem; display: flex; align-items: center; justify-content: center; }
.rf-txt { font-size: .98rem; line-height: 1.45; color: var(--text); }
.rf-traps ul { margin: 0; padding-left: 18px; }
.rf-traps li { font-size: .94rem; line-height: 1.45; color: var(--ink-soft); margin: 5px 0; }
.rf-nailed { display: flex; gap: 9px; align-items: flex-start; background: var(--correct-bg); border: 1px solid var(--correct-line); border-radius: var(--r); padding: 11px 13px; font-size: .96rem; line-height: 1.4; color: var(--correct); font-weight: 600; }
.rf-check { font-weight: 800; }
.refresher-card .btn { margin-top: 18px; }

/* in-HUD 📖 refresher re-open button */
.hud-refresher { font-size: .8rem; font-weight: 800; background: var(--yellow-soft); color: var(--yellow-dk); border: 1px solid var(--yellow-dk); border-radius: var(--r-pill); padding: 5px 12px; cursor: pointer; min-height: 0; }

/* Larger screens: grow the layout generously so it actually uses a wide monitor
   instead of sitting in a thin strip. Header + content stay aligned (both --maxw).
   The font scales up too, so the whole UI feels bigger, not just wider. Reading-
   heavy bits (question text, overlays) are capped separately for readability. */
@media (min-width: 1100px) {
  :root { --maxw: 940px; }
}
@media (min-width: 1500px) {
  :root { --maxw: 1100px; }
  html { font-size: 17px; }
}
@media (min-width: 1900px) {
  :root { --maxw: 1240px; }
  html { font-size: 18px; }
}
/* The home dashboard uses the full wide column, but the drill experience
   (questions, refresher, blueprint, HUD) stays at a balanced, readable width and
   centered — a 1240px-wide question card with a one-line stem looks stretched. */
@media (min-width: 1100px) {
  #screen-practice { max-width: 860px; margin-left: auto; margin-right: auto; }
}

/* graphing calculator (Desmos) — resizable toggle panel */
.hud-calc { font-size: .8rem; font-weight: 800; background: var(--ink); color: #fff; border: none; border-radius: var(--r-pill); padding: 6px 12px; cursor: pointer; min-height: 0; }
.calc-panel { position: fixed; z-index: 200; background: var(--surface); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.calc-panel.hidden { display: none; }
/* mobile: bottom sheet — drag the header up/down to resize height */
.calc-panel { left: 0; right: 0; bottom: 0; height: 82vh; height: 82dvh; border-top-left-radius: 18px; border-top-right-radius: 18px; }
.calc-head { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 16px 8px 10px 16px; border-bottom: 1px solid var(--line); flex: none; cursor: ns-resize; touch-action: none; user-select: none; -webkit-user-select: none; }
.calc-grip-bar { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 42px; height: 5px; border-radius: 3px; background: var(--line-dk); }
.calc-title { font-weight: 800; }
.calc-close { width: 40px; height: 40px; border: none; background: none; font-size: 1.05rem; cursor: pointer; color: var(--muted); border-radius: 50%; }
.calc-close:hover { background: var(--bg-alt); }
.calc-mount { flex: 1; min-height: 0; position: relative; }
.calc-loading { padding: 18px 16px; color: var(--muted); font-size: .9rem; }
.calc-edge { display: none; }
body.calc-resizing { user-select: none; -webkit-user-select: none; }
/* desktop: right dock — drag the left edge to resize width; content is pushed so they never overlap */
@media (min-width: 900px) {
  .calc-panel { left: auto; top: 0; bottom: 0; height: 100vh; height: 100dvh; width: 600px; padding-left: 12px; border-radius: 0; border-left: 1px solid var(--line); box-shadow: -8px 0 28px rgba(17,17,17,.12); }
  body.calc-open { padding-right: var(--calc-w, 600px); }
  .calc-head { cursor: default; padding-top: 10px; }
  .calc-grip-bar { display: none; }
  .calc-edge { display: block; position: absolute; left: 0; top: 0; bottom: 0; width: 12px; cursor: ew-resize; touch-action: none; z-index: 3; }
  .calc-edge::before { content: ""; position: absolute; left: 4px; top: 50%; transform: translateY(-50%); width: 4px; height: 46px; border-radius: 3px; background: var(--line-dk); }
  .calc-edge:hover::before { background: var(--yellow-dk); }
}

/* "How it works" explainer (composed hack text + auto Desmos visual) */
.explainer { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line-dk); }
.exp-eyebrow { font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--yellow-dk); margin-bottom: 6px; }
.exp-hack { font-weight: 700; font-size: 1rem; line-height: 1.45; margin-bottom: 12px; }
.exp-block { margin: 0 0 12px; }
.exp-lab { display: block; font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 5px; }
.exp-block > p { margin: 0; font-size: .96rem; line-height: 1.5; }
.exp-step { display: flex; gap: 9px; align-items: flex-start; margin: 6px 0; font-size: .96rem; line-height: 1.45; }
.exp-num { flex: none; width: 21px; height: 21px; border-radius: 50%; background: var(--yellow-soft); color: var(--yellow-dk); font-weight: 800; font-size: .78rem; display: flex; align-items: center; justify-content: center; }
.exp-traps ul { margin: 0; padding-left: 18px; }
.exp-traps li { font-size: .92rem; line-height: 1.45; color: var(--ink-soft); margin: 4px 0; }
.exp-viz-toggle { display: inline-flex; align-items: center; font-size: .85rem; font-weight: 800; color: var(--ink); background: var(--bg-alt); border: 1px solid var(--line-dk); border-radius: var(--r-pill); padding: 8px 14px; cursor: pointer; margin-top: 4px; }
.exp-viz-mount { margin-top: 10px; }
.exp-viz-mount.hidden { display: none; }
.exp-viz-graph { width: 100%; height: 300px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }

/* "Walk me through it" step-by-step solver (before answering) */
.wt-launch { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; font-weight: 800;
  color: var(--ink); background: var(--yellow-soft); border: 1px solid var(--yellow-dk);
  border-radius: var(--r-pill); padding: 9px 16px; cursor: pointer; margin: 4px 0 16px; }
.wt-sheet { max-width: 640px; }
.wt-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.wt-title { font-size: 1.15rem; font-weight: 800; }
.wt-close { width: 38px; height: 38px; border: none; background: none; font-size: 1.05rem; color: var(--muted); cursor: pointer; border-radius: 50%; }
.wt-close:hover { background: var(--bg-alt); }
.wt-stem { font-size: 1rem; font-weight: 700; line-height: 1.4; padding: 10px 12px; background: var(--bg-alt); border-radius: var(--r); margin-bottom: 12px; }
.wt-visual { margin-bottom: 14px; }
.wt-svg { width: 100%; height: auto; max-height: 260px; display: block; }
.wt-graph { width: 100%; height: 280px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.wt-steps { margin: 4px 0; }
.wt-step { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 1rem; line-height: 1.45; }
.wt-step:last-child { border-bottom: none; }
.wt-num { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 800; font-size: .82rem; display: flex; align-items: center; justify-content: center; }
.wt-new { animation: wt-in .25s var(--ease-out, ease) both; }
@keyframes wt-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.wt-final .wt-num { background: var(--correct); }
.wt-final { font-weight: 700; }
.wt-counter { font-size: .78rem; font-weight: 700; color: var(--muted-2); text-transform: uppercase; letter-spacing: .06em; margin: 10px 0; }
.wt-ctrl { display: flex; gap: 10px; align-items: center; }
.wt-ctrl .btn { flex: 1; }
.wt-ctrl .btn-sm { flex: 0 0 auto; }
