/* instalrn: the game look (MASTER-PLAN §9; approved mockups in docs/instalrn/phase4-mockups.jpg).
   Every colour, radius and shadow comes from the tokens below. Text is Figtree 600/700 from the kit. */
@font-face { font-family: "Figtree"; src: url("../ex/fonts/figtree-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: block; }
@font-face { font-family: "Figtree"; src: url("../ex/fonts/figtree-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: block; }

:root {
  --night: #0f1a33;
  --night-2: #1a2c52;
  --glow: #2c4a86;
  --tile: #22365f;
  --tile-hi: #35528c;
  --tile-lo: #172744;
  --well: #0c1630;
  --locked: #1d2d50;
  --gold: #e8b84a;
  --gold-hi: #ffd98a;
  --gold-lo: #8f6619;
  --cream: #f6eddc;
  --dim: #a9b4cc;
  --quiet: #6f7c99;
  --sage: #86b97d;
  --coral: #e37352;
  --cyan: #6ec8f0;
  --ink: #1b1406;
  --r-tile: 22px;
  --r-btn: 20px;
  --shadow: 0 10px 22px rgba(4, 8, 20, 0.55);
  --lit: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  --col: min(100vw, 560px);
  --top-bar: 64px;
  --stage-w: min(var(--col), calc((100dvh - var(--top-bar) - 14px) * 9 / 16));
}

* { box-sizing: border-box; margin: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  background: radial-gradient(90% 55% at 50% 12%, var(--glow) 0%, transparent 62%), linear-gradient(180deg, var(--night), var(--night-2));
  color: var(--cream); font-family: "Figtree", system-ui, sans-serif; font-weight: 600; user-select: none; -webkit-user-select: none;
}
button, input { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
svg.i { width: 22px; height: 22px; display: block; }

/* ---------- shell: one centred column, bottom bar ---------- */
.view { position: fixed; inset: 0; }
[hidden] { display: none !important; }
.view[hidden] { display: none; }
.screen { position: relative; height: 100%; width: var(--col); margin: 0 auto; display: flex; flex-direction: column;
  padding: max(14px, env(safe-area-inset-top)) 0 0; }
.screen.with-nav { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: var(--col); display: flex; justify-content: space-around;
  padding: 10px 14px max(18px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent, rgba(5, 10, 24, 0.8) 40%); z-index: 20; }
.nav[hidden] { display: none; }
.nav button { display: grid; justify-items: center; gap: 4px; color: var(--dim); font-size: 12px; }
.round { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; color: var(--cream);
  background: linear-gradient(180deg, var(--tile-hi), var(--tile) 40%, var(--tile-lo)); box-shadow: var(--shadow), var(--lit); }
.round.small { width: 44px; height: 44px; }
.nav button[aria-current="page"] .round { color: var(--ink); background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  box-shadow: 0 0 22px rgba(232, 184, 74, 0.55), var(--shadow); }

/* ---------- shared pieces ---------- */
.bar { display: flex; align-items: center; gap: 10px; padding: 4px 18px 8px; }
.bar .title { flex: 1; text-align: center; font-weight: 700; font-size: 19px; }
.chip { display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 9px; border-radius: 999px; font-size: 15px; white-space: nowrap;
  background: linear-gradient(180deg, var(--tile-hi), var(--tile)); box-shadow: var(--shadow), var(--lit); }
.chip svg { width: 19px; height: 19px; }
.meter { flex: 1; height: 16px; border-radius: 999px; background: var(--well); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6); position: relative; overflow: hidden; }
.meter > i { position: absolute; inset: 2px auto 2px 2px; border-radius: 999px; background: linear-gradient(180deg, var(--gold-hi), var(--gold)); transition: width 0.4s; }
.steps { flex: 1; display: flex; gap: 6px; }
.steps .seg { flex: 1; min-width: 0; display: grid; gap: 4px; text-align: center; }
.steps .seg .meter { flex: none; height: 10px; }
.steps .seg .meter > i { inset: 1px auto 1px 1px; }
.steps .seg b { font-size: 11px; font-weight: 700; color: var(--dim); }
.steps .seg.done b { color: var(--cream); }
.steps .seg.now b { color: var(--gold-hi); }
h1 { font-weight: 700; font-size: 30px; line-height: 1.14; text-align: center; margin: 8px 24px 6px; letter-spacing: -0.01em; }
.sub { text-align: center; color: var(--dim); font-size: 15px; line-height: 1.42; margin: 0 26px; }
.btn { display: block; width: calc(100% - 44px); margin: 8px 22px; padding: 16px 18px; border-radius: var(--r-btn); font-weight: 700; font-size: 18px; text-align: center;
  color: var(--ink); background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, #c9952e); box-shadow: 0 7px 0 var(--gold-lo), var(--shadow); }
.btn:active { transform: translateY(4px); box-shadow: 0 3px 0 var(--gold-lo), var(--shadow); }
.btn.ghost { color: var(--cream); font-weight: 600; background: linear-gradient(180deg, var(--tile-hi), var(--tile)); box-shadow: 0 6px 0 #0d1830, var(--shadow); }
.btn.ghost:active { box-shadow: 0 2px 0 #0d1830, var(--shadow); }
.btn[disabled] { opacity: 0.55; }
.link { display: block; margin: 6px auto 12px; padding: 8px 14px; color: var(--dim); font-size: 15px; }
.tile { border-radius: var(--r-tile); background: linear-gradient(180deg, var(--tile-hi), var(--tile) 35%, var(--tile-lo)); box-shadow: var(--shadow), var(--lit); }
.glyph { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; font-weight: 700; font-size: 24px; flex: none;
  background: linear-gradient(180deg, #2f4d86, #1b2d52); box-shadow: var(--lit); }
.stars { display: flex; gap: 2px; }
.stars svg { width: 16px; height: 16px; }

/* ---------- onboarding ---------- */
.onboard .pick { margin: 20px 22px 0; display: grid; gap: 14px; }
.onboard .opt { width: 100%; text-align: left; padding: 20px; }
.onboard .opt b { display: block; font-weight: 700; font-size: 20px; }
.onboard .opt span { color: var(--dim); font-size: 14px; }
.onboard .opt[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--gold), 0 0 26px rgba(232, 184, 74, 0.35), var(--shadow); }
.field { margin: 20px 22px 0; }
.field label { color: var(--dim); font-size: 13px; display: block; margin: 0 0 6px 4px; }
.input { width: 100%; padding: 15px 16px; border: 0; border-radius: 16px; background: var(--well); box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.6); font-size: 18px; color: var(--cream); user-select: text; }
.err { color: var(--coral); font-size: 13px; margin: 6px 4px 0; min-height: 18px; }

/* ---------- subject switcher (Maths | Physics) ---------- */
.track-switch { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin: 2px 22px 10px; padding: 5px;
  border-radius: 999px; background: var(--well); box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.55); flex: none; }
.track-switch .seg { padding: 9px 14px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--dim);
  transition: background 0.2s, color 0.2s; }
.track-switch .seg[aria-selected="true"] { color: var(--ink);
  background: linear-gradient(180deg, var(--gold-hi), var(--gold)); box-shadow: 0 3px 12px rgba(232, 184, 74, 0.35); }

/* ---------- home ---------- */
.home .hero { position: relative; flex: 1; min-height: 120px; display: grid; place-items: end center; }
.home .hero canvas { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); height: 100%; max-height: 380px; aspect-ratio: 600 / 760; }
.home .pedestal { position: absolute; bottom: 2px; width: 220px; height: 44px; border-radius: 50%; background: radial-gradient(closest-side, rgba(110, 200, 240, 0.35), rgba(110, 200, 240, 0)); }
.home .next { margin: 8px 22px 0; padding: 14px; display: flex; gap: 14px; align-items: center; text-align: left; width: calc(100% - 44px); }
.home .next b { font-size: 18px; display: block; }
.home .next span { color: var(--dim); font-size: 14px; }

/* ---------- skill map: one winding path (unit banner, square tiles on their corner, trophy) ---------- */
.path { position: relative; width: 100%; padding: 4px 0 130px; }
.path svg.trail { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.trail path { fill: none; stroke: #2e4270; stroke-width: 7; stroke-linecap: round; stroke-dasharray: 0.1 14; }
.trail path.lit { stroke: var(--gold); stroke-width: 6; stroke-dasharray: none; filter: drop-shadow(0 0 5px rgba(232, 184, 74, 0.55)); }

.unit { position: relative; z-index: 1; margin: 30px 22px 6px; padding: 12px 18px 14px; border-radius: var(--r-tile); text-align: center;
  background: linear-gradient(180deg, var(--tile-hi), var(--tile) 45%, var(--tile-lo)); box-shadow: 0 6px 0 #0d1830, var(--shadow), var(--lit); }
.path > .unit:first-of-type { margin-top: 8px; }
.unit small { display: block; font-size: 13px; color: var(--dim); }
.unit b { display: block; font-size: 21px; font-weight: 700; margin: 2px 0 10px; }
.unit .meter { height: 10px; }
.unit .meter > i { inset: 1px auto 1px 1px; }
.unit.now { box-shadow: 0 0 0 2.5px var(--cyan), 0 0 26px rgba(110, 200, 240, 0.32), 0 6px 0 #0d1830, var(--shadow); }
.unit.now small { color: var(--cyan); }
.unit.done { box-shadow: 0 0 0 2.5px var(--gold), 0 0 24px rgba(232, 184, 74, 0.3), 0 6px 0 var(--gold-lo), var(--shadow); }
.unit.done small { color: var(--gold-hi); }
.unit.later { background: linear-gradient(180deg, #24375f, #1a2a4a); }
.unit.later b { color: var(--dim); }

/* .pad is the upright box (tap area, glyph, badge); its ::before is the tile itself, a rounded square turned on its
   corner (TJ, 2026-11-18). A shadow offset of (7, 7) before the turn becomes a straight-down slab after it. */
.stop { position: relative; display: block; width: 100%; height: 128px; text-align: left; }
.stop .pad { position: absolute; z-index: 1; left: calc(var(--x) * 100%); top: 14px; width: 92px; height: 92px; transform: translateX(-50%);
  display: grid; place-items: center; color: var(--cream); }
.stop .pad::before { content: ""; position: absolute; z-index: -1; inset: 13px; border-radius: 17px; transform: rotate(45deg);
  background: linear-gradient(135deg, var(--tile-hi), var(--tile) 55%, var(--tile-lo));
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.16), 7px 7px 0 #0d1830, 12px 12px 22px rgba(4, 8, 20, 0.6); }
.stop .g { font-weight: 700; font-size: 22px; }
.stop .name { position: absolute; z-index: 1; top: 40px; display: grid; gap: 3px; justify-items: start; }
.stop.left .name { left: calc(var(--x) * 100% + 64px); max-width: calc((1 - var(--x)) * 100% - 80px); }
.stop.right .name { right: calc((1 - var(--x)) * 100% + 64px); max-width: calc(var(--x) * 100% - 80px); text-align: right; justify-items: end; }
.stop .name b { font-size: 17px; font-weight: 700; line-height: 1.2; }
.stop .name span { font-size: 13px; line-height: 1.3; color: var(--dim); }
.stop .name .stars svg { width: 15px; height: 15px; }
.stop:focus-visible { outline: none; }
.stop:focus-visible .pad::before { outline: 3px solid var(--cyan); outline-offset: 6px; }
.stop:not(:disabled):active .pad { transform: translate(-50%, 4px); }

.stop.open .pad::before { box-shadow: 0 0 0 3px var(--cyan), 0 0 22px rgba(110, 200, 240, 0.4), inset 2px 2px 0 rgba(255, 255, 255, 0.16), 7px 7px 0 #0d1830, 12px 12px 22px rgba(4, 8, 20, 0.6); }
.stop.next { height: 172px; }
.stop.next .pad { top: 66px; }
.stop.next .name { top: 92px; }
.stop.next .name b { color: var(--cyan); }
.stop.next .g { visibility: hidden; }
.stop.next .pad::after { content: ""; position: absolute; inset: 5px; border-radius: 22px; border: 3px solid rgba(110, 200, 240, 0.6); animation: ping 1.8s ease-out infinite; }
@keyframes ping { from { transform: rotate(45deg) scale(0.94); opacity: 1; } to { transform: rotate(45deg) scale(1.28); opacity: 0; } }
.stop .hero { position: absolute; z-index: 2; left: calc(var(--x) * 100%); top: 0; height: 120px; transform: translateX(-50%); pointer-events: none; }
.stop.mastered .pad { color: var(--ink); }
.stop.mastered .pad::before { background: linear-gradient(135deg, var(--gold-hi), var(--gold) 55%, #c9952e);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.45), 7px 7px 0 var(--gold-lo), 0 0 26px rgba(232, 184, 74, 0.35), 12px 12px 22px rgba(4, 8, 20, 0.6); }
.stop.known .pad::before { box-shadow: 0 0 0 3px var(--gold), inset 2px 2px 0 rgba(255, 255, 255, 0.16), 7px 7px 0 #0d1830, 12px 12px 22px rgba(4, 8, 20, 0.6); }
.stop.locked .pad, .stop.soon .pad, .stop.trophy.closed .pad { color: #56658a; }
.stop.locked .pad::before, .stop.soon .pad::before, .stop.trophy.closed .pad::before { background: linear-gradient(135deg, #263a62, var(--locked) 55%, #16243f);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.06), 7px 7px 0 #0b1428, 12px 12px 22px rgba(4, 8, 20, 0.5); }
.stop.locked .name b, .stop.soon .name b { color: var(--quiet); }
.stop.locked .name span, .stop.soon .name span { color: #56658a; }
.stop .badge { position: absolute; top: 4px; right: 4px; min-width: 26px; height: 26px; border-radius: 13px; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; box-shadow: var(--shadow); }
.badge.tick { background: var(--sage); color: #12210f; }
.badge.lock { background: #2a3a60; color: var(--dim); }
.badge.lock svg { width: 13px; height: 13px; }

.stop.trophy { height: 112px; }
.stop.trophy .pad { top: 14px; width: 76px; height: 76px; }
.stop.trophy .pad::before { inset: 11px; border-radius: 15px; }
.stop.trophy .pad svg { width: 28px; height: 28px; }
.stop.trophy .name { top: 32px; }
.stop.trophy.closed .name b { color: var(--dim); }
.stop.trophy.won .pad::before { background: linear-gradient(135deg, var(--gold-hi), var(--gold) 55%, #c9952e);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.45), 6px 6px 0 var(--gold-lo), 0 0 30px rgba(232, 184, 74, 0.5), 11px 11px 20px rgba(4, 8, 20, 0.6); }
.stop.trophy.won .name b { color: var(--gold-hi); }

.jump { position: fixed; z-index: 21; left: 50%; bottom: calc(108px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 11px 16px 11px 18px; border-radius: 999px; white-space: nowrap;
  font-weight: 700; font-size: 15px; color: var(--ink); background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, #c9952e);
  box-shadow: 0 5px 0 var(--gold-lo), var(--shadow); }
.jump svg { width: 18px; height: 18px; transform: rotate(90deg); }
.jump.down svg { transform: rotate(-90deg); }
.jump:active { transform: translate(-50%, 3px); box-shadow: 0 2px 0 var(--gold-lo), var(--shadow); }

/* ---------- progress, leaders ---------- */
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 18px 14px; }
.stats3 .tile { padding: 14px 8px; text-align: center; }
.stats3 b { display: block; font-size: 26px; font-weight: 700; color: var(--gold-hi); }
.stats3 span { font-size: 13px; color: var(--dim); }
.rows { display: grid; gap: 8px; margin: 0 18px 18px; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 18px; background: linear-gradient(180deg, #213460, #192a4f); box-shadow: var(--shadow); text-align: left; width: 100%; }
.row .glyph { width: 44px; height: 44px; font-size: 18px; border-radius: 14px; }
.row .nm { flex: 1; }
.row .nm b { display: block; font-size: 16px; }
.row .nm span { font-size: 13px; color: var(--dim); }
.row.me { box-shadow: 0 0 0 2.5px var(--gold), var(--shadow); }
.note { text-align: center; color: var(--dim); font-size: 13px; line-height: 1.45; margin: 10px 26px; }

/* ---------- a skill: check, lesson, practice ---------- */
.play { position: relative; height: 100%; width: var(--col); margin: 0 auto; display: flex; flex-direction: column; padding-top: max(10px, env(safe-area-inset-top)); }
/* the skip pebble: small and quiet, top right under the bar; its choices open in a little menu (TJ, 2026-11-18) */
.skipper { position: absolute; z-index: 30; right: 14px; top: calc(max(10px, env(safe-area-inset-top)) + var(--top-bar) + 4px);
  display: grid; justify-items: end; gap: 6px; }
.skipper[hidden], .skipper .menu[hidden] { display: none; }
/* off the video it gets a thin row of its own, so it never sits on a title; on the video it sits on the top corner */
.play:not(.lesson) > .skipper:not([hidden]) ~ .flow { padding-top: 26px; }
.skipper .pebble { display: flex; align-items: center; gap: 1px; padding: 4px 7px 4px 11px; border-radius: 999px; font-size: 13px; font-weight: 600;
  color: var(--dim); background: rgba(30, 47, 86, 0.78); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 0 #0d1830; }
.skipper .pebble svg { width: 13px; height: 13px; transform: rotate(180deg); opacity: 0.8; }
.skipper .pebble[aria-expanded="true"] { color: var(--cream); }
.skipper .menu { display: grid; min-width: 210px; padding: 6px; border-radius: 18px; background: linear-gradient(180deg, var(--tile-hi), var(--tile));
  box-shadow: 0 6px 0 #0d1830, var(--shadow), var(--lit); }
.skipper .menu button { padding: 11px 12px; border-radius: 12px; text-align: right; font-size: 15px; font-weight: 600; color: var(--cream); }
.skipper .menu button + button { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07); }
.skipper .menu button:active { background: rgba(255, 255, 255, 0.06); }
.play .bar { height: var(--top-bar); padding-top: 4px; }
.play .flow { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
.play .flow > .grow, .play .ctl > .grow { flex: 1; }
.play .ctl { flex: 1; display: flex; flex-direction: column; }
.play .cover { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--dim); font-size: 16px; }
.play .cover .glyph { width: 96px; height: 96px; border-radius: 26px; font-size: 44px; color: var(--cream); margin-bottom: 10px; }
.streak { display: flex; gap: 8px; justify-content: center; margin: 4px 0 2px; }
.streak i { width: 34px; height: 10px; border-radius: 6px; background: var(--well); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6); }
.streak i.on { background: linear-gradient(180deg, var(--gold-hi), var(--gold)); box-shadow: 0 0 10px rgba(232, 184, 74, 0.5); }
.level { text-align: center; color: var(--dim); font-size: 14px; margin-bottom: 4px; }
/* a question (quick check, Test, practice): compact, so the question, the choices and the verdict fit one phone
   screen (TJ, 2026-11-30) */
.qhead { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 22px; font-size: 13px; color: var(--dim); }
.qhead .tag { padding: 3px 10px; border-radius: 999px; font-weight: 700; letter-spacing: 0.02em; color: var(--gold-hi); background: rgba(232, 184, 74, 0.14); }
.qhead .pips { display: flex; gap: 4px; }
.qhead .pips i { width: 18px; height: 7px; border-radius: 4px; background: var(--well); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6); }
.qhead .pips i.on { background: linear-gradient(180deg, var(--gold-hi), var(--gold)); box-shadow: 0 0 8px rgba(232, 184, 74, 0.5); }
.qcard { margin: 10px 18px 0; padding: 14px 16px; border-radius: 20px; background: linear-gradient(180deg, #24396a, #1a2b52); box-shadow: var(--shadow), var(--lit); }
.qcard p { font-size: 18px; font-weight: 700; line-height: 1.32; text-align: center; }
.qcard p.long { font-size: 17px; text-align: left; }
.qcard .hint { margin-top: 8px; font-size: 14px; color: var(--cyan); font-weight: 600; }
.opts { margin: 12px 18px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.opts.list { grid-template-columns: 1fr; gap: 8px; }
.o { position: relative; padding: 18px 10px; border-radius: 20px; text-align: center; font-size: 17px; font-weight: 700; line-height: 1.3;
  background: linear-gradient(180deg, var(--tile-hi), var(--tile) 40%, var(--tile-lo)); box-shadow: 0 6px 0 #0d1830, var(--shadow); }
.o:active { transform: translateY(3px); box-shadow: 0 3px 0 #0d1830, var(--shadow); }
.o.right { background: linear-gradient(180deg, #a7d39d, var(--sage)); color: #12210f; }
.o.wrong { background: linear-gradient(180deg, #f08d70, var(--coral)); color: #2a0e06; }
.opts .o { padding: 13px 10px; border-radius: 16px; font-size: 16px; box-shadow: 0 4px 0 #0d1830, var(--shadow); }
.opts .o:active { box-shadow: 0 1px 0 #0d1830, var(--shadow); }
.opts.list .o { display: flex; align-items: center; gap: 11px; padding: 10px 26px 10px 10px; text-align: left; font-size: 15.5px; line-height: 1.28; }
.o .key { flex: none; width: 27px; height: 27px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; color: var(--dim); background: rgba(5, 10, 24, 0.35); }
.o.right .key, .o.wrong .key { color: inherit; background: rgba(0, 0, 0, 0.12); }
.opts .o:disabled:not(.right):not(.wrong), .lesson .ask .o:disabled:not(.right):not(.wrong):not(.picked) { opacity: 0.5; }

/* the tick or cross on an answer: a badge on its corner that pops in; a wrong answer shakes */
.o .mark { position: absolute; top: -9px; right: -7px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  box-shadow: 0 0 0 3px var(--night), 0 3px 8px rgba(0, 0, 0, 0.5); animation: mark-pop 0.42s cubic-bezier(0.3, 1.7, 0.5, 1) both; }
.o .mark svg { width: 18px; height: 18px; }
.o .mark.yes { background: #3f8a37; color: #f1ffe9; }
.o .mark.no { background: #c4482a; color: #fff1ea; }
.o.shake { animation: shake 0.45s ease; }
@keyframes mark-pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }

/* the verdict under an answered question */
.verdict { display: flex; gap: 11px; align-items: flex-start; margin: 12px 18px 0; padding: 11px 14px 12px 11px; border-radius: 16px;
  background: linear-gradient(180deg, #213460, #192a4f); box-shadow: var(--shadow); animation: rise 0.3s ease both; }
.verdict .dot { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; }
.verdict .dot svg { width: 18px; height: 18px; }
.verdict.yes .dot { background: var(--sage); color: #12210f; }
.verdict.no .dot { background: var(--coral); color: #2a0e06; }
.verdict b { display: block; font-size: 16px; line-height: 1.3; margin-top: 4px; }
.verdict.yes b { color: var(--sage); }
.verdict.no b { color: var(--coral); }
.verdict p { margin-top: 3px; font-size: 14px; line-height: 1.42; color: var(--cream); }
.after .fb { margin: 10px 18px 0; padding: 12px 14px; border-radius: 16px; }
.after .fb b { font-size: 15.5px; }
.after .fb p { font-size: 14px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.btn.slim { width: calc(100% - 36px); margin: 12px 18px 4px; padding: 13px 16px; font-size: 17px; box-shadow: 0 5px 0 var(--gold-lo), var(--shadow); }
.btn.slim.ghost { box-shadow: 0 5px 0 #0d1830, var(--shadow); }

/* sparkles: little four-point stars that fly out from a right answer and fade */
.sparkles { position: fixed; z-index: 60; width: 0; height: 0; pointer-events: none; }
.sparkles i { position: absolute; left: -8px; top: -8px; width: 16px; height: 16px; background: var(--gold-hi);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  animation: spark 0.9s cubic-bezier(0.15, 0.75, 0.35, 1) var(--delay) both; }
.sparkles i.big { left: -13px; top: -13px; width: 26px; height: 26px; }
.sparkles i:nth-child(3n + 1) { background: #fff6dd; }
.sparkles i:nth-child(4n + 2) { background: #b9eeaa; }
@keyframes spark {
  0% { transform: translate(0, 0) scale(0.2) rotate(0deg); opacity: 0; }
  15% { opacity: 1; }
  70% { opacity: 1; transform: translate(calc(var(--dx) * 0.92), calc(var(--dy) * 0.92)) scale(1) rotate(120deg); }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.3) rotate(170deg); opacity: 0; }
}

/* in a lesson video: a big tick or cross pops in the middle of the picture */
.stamp { position: absolute; z-index: 6; left: 50%; top: 44%; width: 112px; height: 112px; margin: -56px 0 0 -56px; border-radius: 50%;
  display: grid; place-items: center; pointer-events: none; animation: stamp-pop 1.8s ease both; }
.stamp svg { width: 66px; height: 66px; }
.stamp.yes { color: #f4fff0; background: radial-gradient(circle at 36% 30%, #b8e8ac, var(--sage) 58%, #4f8a47);
  box-shadow: 0 0 0 7px rgba(134, 185, 125, 0.3), 0 0 46px rgba(134, 185, 125, 0.65), var(--shadow); }
.stamp.no { color: #fff3ee; background: radial-gradient(circle at 36% 30%, #f7aa92, var(--coral) 58%, #ad4a2b);
  box-shadow: 0 0 0 7px rgba(227, 115, 82, 0.28), var(--shadow); animation-name: stamp-no; }
@keyframes stamp-pop { 0% { transform: scale(0.3); opacity: 0; } 14% { transform: scale(1.14); opacity: 1; } 24% { transform: scale(1); } 82% { transform: scale(1); opacity: 1; } 100% { transform: scale(0.92); opacity: 0; } }
@keyframes stamp-no { 0% { transform: scale(0.3); opacity: 0; } 14% { transform: scale(1.1) rotate(0deg); opacity: 1; } 22% { transform: scale(1) rotate(-9deg); }
  30% { transform: rotate(8deg); } 38% { transform: rotate(-4deg); } 46% { transform: rotate(0deg); } 82% { opacity: 1; } 100% { transform: scale(0.92); opacity: 0; } }

/* a skill already learnt: watch, try or practise again */
.replay { display: grid; justify-items: center; margin-top: 18px; }
.replay .stars svg { width: 38px; height: 38px; filter: drop-shadow(0 0 12px rgba(232, 184, 74, 0.45)); }
.replay .stars svg:nth-child(2) { width: 46px; height: 46px; margin-top: -8px; }
.picklist { display: grid; gap: 10px; margin: 22px 18px 0; }
.pickrow { display: flex; align-items: center; gap: 14px; width: 100%; padding: 13px 14px; text-align: left; border-radius: 20px; box-shadow: 0 5px 0 #0d1830, var(--shadow), var(--lit); }
.pickrow:active { transform: translateY(3px); box-shadow: 0 2px 0 #0d1830, var(--shadow); }
.pickrow .ic { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: var(--ink);
  background: linear-gradient(180deg, var(--gold-hi), var(--gold)); box-shadow: 0 0 14px rgba(232, 184, 74, 0.3); }
.pickrow .ic svg { width: 24px; height: 24px; }
.pickrow .words b { display: block; font-size: 17px; font-weight: 700; }
.pickrow .words span { font-size: 13.5px; color: var(--dim); }
.play .from-book { width: fit-content; margin: 14px auto 0; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 700;
  color: var(--cyan); background: rgba(110, 200, 240, 0.12); }

/* a short note at the top of the screen (e.g. a book page whose lesson is still coming) */
.toast { position: fixed; z-index: 50; left: 0; right: 0; top: calc(max(14px, env(safe-area-inset-top)) + 8px); margin: 0 auto;
  width: min(calc(100vw - 32px), 420px); padding: 12px 16px; border-radius: 16px; text-align: center; font-size: 14.5px; line-height: 1.4;
  color: var(--cream); background: linear-gradient(180deg, var(--tile-hi), var(--tile)); box-shadow: 0 0 0 2px var(--cyan), var(--shadow);
  animation: rise 0.3s ease both; transition: opacity 0.35s; }
.toast.out { opacity: 0; }
.answer { margin: 16px 22px 0; display: flex; gap: 10px; }
.answer .input { flex: 1; text-align: center; font-size: 22px; font-weight: 700; }
.answer .input.right { border-color: var(--sage); color: var(--sage); }
.answer .input.wrong { border-color: var(--coral); color: var(--coral); }
.fb { margin: 14px 22px 0; padding: 16px 18px; border-radius: 20px; background: linear-gradient(180deg, #213460, #192a4f); box-shadow: var(--shadow); }
.fb b { display: block; font-size: 17px; margin-bottom: 4px; }
.fb p { color: var(--cream); font-size: 15px; line-height: 1.45; }
.fb.good b { color: var(--sage); }
.fb.slip b { color: var(--coral); }
.fb.help b { color: var(--cyan); }
.fb ol { margin: 8px 0 0 18px; padding: 0; display: grid; gap: 6px; font-size: 14.5px; line-height: 1.4; }
.fb ol em { color: var(--gold-hi); font-style: normal; }

/* the lesson: the 9:16 stage, with the prompt on top and the buttons below it */
.stage { position: relative; flex: none; width: var(--stage-w); height: calc(var(--stage-w) * 16 / 9); margin: 0 auto; overflow: hidden; border-radius: 18px; background: #12151b; box-shadow: var(--shadow); }
.stage[hidden] { display: none; }
.stage video, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage iframe { position: absolute; top: 0; left: 0; width: 1080px; height: 1920px; border: 0; transform-origin: 0 0; pointer-events: none; }
.stage canvas { opacity: 0; touch-action: none; }
.stage video[hidden], .stage iframe[hidden] { display: none; }
.lesson .flow { position: absolute; inset: var(--top-bar) 0 0 0; pointer-events: none; overflow: visible; }
.lesson .flow > * { pointer-events: auto; }
.lesson .prompt { position: absolute; top: 40px; left: 50%; transform: translateX(-50%); width: calc(var(--stage-w) - 22px); padding: 12px 14px; border-radius: 16px;
  background: rgba(15, 26, 51, 0.92); box-shadow: var(--shadow); font-size: 15px; line-height: 1.38; z-index: 5; }
.lesson .prompt small { display: block; margin-bottom: 4px; font-size: 12px; color: var(--gold-hi); }
.lesson .actions { position: absolute; bottom: max(12px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: calc(var(--stage-w) - 22px); z-index: 5; }
.lesson .actions .btn, .lesson .actions .o { width: 100%; margin: 6px 0; }
.lesson .ask { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lesson .ask.list { grid-template-columns: 1fr; gap: 2px; width: 82%; margin: 0 auto; }
.lesson .ask .o:disabled { opacity: 1; }
.o.picked { background: linear-gradient(180deg, var(--gold-hi), var(--gold)); color: #2a1d05; }
.lesson .prompt small.good { color: var(--sage); }
.lesson .prompt small.slip { color: var(--coral); }
.subtitle.good { background: rgba(40, 70, 36, 0.92); color: #dff3d8; font-weight: 700; }
.subtitle.slip { background: rgba(88, 38, 24, 0.92); color: #ffe2d6; font-weight: 700; }
.subtitle { position: absolute; left: 50%; transform: translateX(-50%); bottom: 96px; width: calc(var(--stage-w) - 28px); padding: 10px 14px; border-radius: 14px;
  background: rgba(13, 16, 20, 0.86); font-size: 14px; line-height: 1.4; text-align: center; z-index: 4; }
.subtitle[hidden] { display: none; }

/* subtitles, off by default: the CC pebble (top left, on the video) turns them on; then the video makes room and they
   sit in a strip of their own under it, never over the picture (TJ, 2026-11-18) */
.play { --cc-h: 0px; }
.play.cc { --cc-h: 76px; --stage-w: min(var(--col), calc((100dvh - var(--top-bar) - 14px - var(--cc-h) - env(safe-area-inset-bottom)) * 9 / 16)); }
.ccbtn { display: none; position: absolute; z-index: 30; left: 14px; top: calc(max(10px, env(safe-area-inset-top)) + var(--top-bar) + 4px);
  padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: var(--dim);
  background: rgba(30, 47, 86, 0.78); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 0 #0d1830; }
.play.lesson .ccbtn { display: block; }
.ccbtn[aria-pressed="true"] { color: var(--ink); background: var(--cream); }
.cc-line { flex: none; width: var(--stage-w); height: var(--cc-h); margin: 0 auto; padding: 8px 12px 0; overflow: hidden;
  font-size: 14px; line-height: 1.32; text-align: center; color: var(--cream); }
.cc-line[hidden] { display: none; }

/* ---------- results ---------- */
.result .bigstars { display: flex; justify-content: center; align-items: flex-end; gap: 6px; margin-top: 30px; }
.result .bigstars svg { width: 84px; height: 84px; filter: drop-shadow(0 0 18px rgba(232, 184, 74, 0.45)); }
.result .bigstars svg:nth-child(2) { width: 108px; height: 108px; }
.result .xp { margin: 14px auto 0; text-align: center; font-weight: 700; font-size: 44px; color: var(--gold-hi); }
.result .xp small { display: block; font-size: 15px; color: var(--dim); font-weight: 600; }
.result .lvl { margin: 16px 30px 0; }
.result .lvl .r { display: flex; justify-content: space-between; color: var(--dim); font-size: 14px; margin-bottom: 6px; }

/* ---------- tablets and landscape: the same column, roomier ---------- */
@media (min-width: 700px) {
  :root { --col: 600px; }
  h1 { font-size: 34px; }
}
@media (orientation: landscape) and (max-height: 560px) {
  .home .hero { min-height: 120px; }
  .home .hero canvas { max-height: 200px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .stop.next .pad::after { animation: none; opacity: 0.6; transform: rotate(45deg) scale(1.1); }
}

/* ---------- help lessons (Phase 5): the Doubt Teacher's board, standing upright ---------- */
.helpboard { position: relative; width: min(calc(var(--col) - 44px), calc((100dvh - var(--top-bar) - 236px) * 9 / 16)); aspect-ratio: 9 / 16;
  margin: 4px auto 0; border-radius: 18px; overflow: hidden;
  background: radial-gradient(80% 50% at 0% 0%, rgba(255, 200, 120, 0.08), transparent 70%),
    linear-gradient(to top, rgba(110, 200, 240, 0.09), transparent 25%), #1b1f26;
  box-shadow: inset 0 1px 0 rgba(255, 200, 120, 0.22), inset 0 0 0 1px rgba(52, 60, 72, 0.55), var(--shadow); }
.helpboard::after { content: ""; position: absolute; left: 6%; right: 6%; bottom: 0; height: 3px; border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, transparent, #9fe0ff 10%, #e6f8ff 50%, #9fe0ff 90%, transparent); box-shadow: 0 0 14px 2px rgba(110, 200, 240, 0.7); }
.helpboard canvas { display: block; width: 100%; height: 100%; }
.play .caption { margin: 12px 22px 0; min-height: 3.9em; text-align: center; font-size: 15px; line-height: 1.3; color: var(--cream); }

/* ---------- the online account and the weekly board (Phase 6) ---------- */
.codecard { margin: 18px 22px 0; padding: 18px; text-align: center; }
.codecard small { display: block; color: var(--dim); font-size: 13px; }
.codecard b { display: block; margin: 8px 0; font-size: 28px; font-weight: 700; letter-spacing: 0.06em; color: var(--gold-hi); word-break: break-word; }
.codecard p { margin: 0; color: var(--dim); font-size: 14px; }
.codecard .link { margin: 6px auto; color: var(--cyan); }
.ideas { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 4px 0; }
.ideas .idea { cursor: pointer; }
.account { margin: 0 18px 18px; padding: 16px 0 8px; }
.account > b, .account > p { display: block; margin: 0 22px; }
.account > p { color: var(--dim); font-size: 14px; margin-top: 4px; }
.account .who { display: flex; align-items: baseline; gap: 10px; margin: 0 22px; }
.account .who b { font-size: 20px; }
.account .who span { color: var(--dim); font-size: 13px; flex: 1; }
.account .who .link { margin: 0; padding: 4px 0; color: var(--cyan); }
.account .codecard { margin: 12px 14px 0; background: none; box-shadow: none; padding: 8px; }
.leaders .scroll > .sub { margin-bottom: 12px; }
.leaders .rows { margin-top: 4px; }
.leaders .rank { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%; font-weight: 700;
  background: var(--well); color: var(--cream); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5); }
.leaders .rank.gold { background: linear-gradient(180deg, #ffe08a, #e8b84a); color: #3a2a05; box-shadow: 0 0 14px rgba(232, 184, 74, 0.5); }
.leaders .rank.silver { background: linear-gradient(180deg, #eef2f7, #aab4c3); color: #222a36; }
.leaders .rank.bronze { background: linear-gradient(180deg, #f0b98d, #c27a48); color: #2f1708; }
.leaders .row .xp { color: var(--gold-hi); }
.screen > .grow, .scroll > .grow { flex: 1; }
.leaders .scroll { display: flex; flex-direction: column; }

/* ---------- "Ask a doubt" (TJ, 2026-11-22): a breathing AI orb at the bottom right, never over a video ---------- */
.doubt-fab { position: fixed; z-index: 30; width: 64px; height: 64px; display: grid; place-items: center;
  right: max(16px, calc((100vw - var(--col)) / 2 + 16px)); bottom: calc(100px + env(safe-area-inset-bottom)); }
body[data-view="play"] .doubt-fab { bottom: max(18px, env(safe-area-inset-bottom)); }
body[data-view="onboard"] .doubt-fab, body[data-video="on"] .doubt-fab { display: none; }
/* gold, like the app's Continue button and the chosen tab, with a dark spark (TJ: match the app's colours) */
.doubt-orb { position: relative; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; color: var(--ink);
  background: radial-gradient(circle at 36% 28%, #fff3cf 0%, var(--gold-hi) 24%, var(--gold) 62%, #b98a2c 100%);
  box-shadow: 0 0 0 2px rgba(255, 217, 138, 0.35), 0 0 16px rgba(232, 184, 74, 0.4), var(--shadow), inset 0 -5px 10px rgba(143, 102, 25, 0.55), inset 0 2px 0 rgba(255, 255, 255, 0.45);
  animation: doubt-breathe 3.6s ease-in-out infinite; }
.doubt-orb svg.i { width: 28px; height: 28px; filter: drop-shadow(0 1px 0 rgba(255, 243, 207, 0.5)); }
/* the live glow: a soft ring that swells out and fades, in time with the orb's breath */
.doubt-halo { position: absolute; inset: 3px; border-radius: 50%; background: radial-gradient(circle, rgba(232, 184, 74, 0.5), rgba(232, 184, 74, 0) 70%);
  animation: doubt-halo 3.6s ease-in-out infinite; }
@keyframes doubt-breathe {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 2px rgba(255, 217, 138, 0.35), 0 0 14px rgba(232, 184, 74, 0.35), var(--shadow), inset 0 -5px 10px rgba(143, 102, 25, 0.55), inset 0 2px 0 rgba(255, 255, 255, 0.45); }
  50% { transform: scale(1.07); box-shadow: 0 0 0 2px rgba(255, 217, 138, 0.6), 0 0 30px rgba(232, 184, 74, 0.75), var(--shadow), inset 0 -5px 10px rgba(143, 102, 25, 0.55), inset 0 2px 0 rgba(255, 255, 255, 0.45); }
}
@keyframes doubt-halo { 0%, 100% { transform: scale(0.9); opacity: 0.15; } 50% { transform: scale(1.55); opacity: 0.85; } }
.doubt-fab:active .doubt-orb { transform: scale(0.94); }
@media (prefers-reduced-motion: reduce) {
  .doubt-orb, .doubt-halo { animation-duration: 7s; }
}

/* the strip every screen keeps free at the bottom right, so the orb never covers a button */
body .screen.with-nav { padding-bottom: calc(168px + env(safe-area-inset-bottom)); }
body:not([data-video="on"]) .play:not(.lesson) .flow { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }

.doubt-sheet { position: fixed; inset: 0; z-index: 40;
  background: radial-gradient(90% 55% at 50% 12%, var(--glow) 0%, transparent 62%), linear-gradient(180deg, var(--night), var(--night-2)); }
.doubt-sheet .screen { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.doubt-sheet .bar { display: grid; grid-template-columns: 1fr auto 1fr; }
.doubt-sheet .bar .round { justify-self: start; }
.doubt-sheet .bar .title { font-size: 19px; }
.doubt-new { justify-self: end; padding: 8px 12px; border-radius: 999px; font-size: 13px; color: var(--cream);
  background: linear-gradient(180deg, var(--tile-hi), var(--tile)); box-shadow: var(--shadow), var(--lit); }
.doubt-sheet .bar .doubt-new[hidden] { display: block !important; visibility: hidden; }
.doubt-head { display: flex; align-items: center; gap: 10px; margin: 0 18px 8px; min-height: 22px; }
.doubt-q { flex: 1; font-size: 15px; line-height: 1.35; color: var(--gold-hi); max-height: 2.7em; overflow: hidden; }
.doubt-asked { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; box-shadow: var(--shadow); }
/* the board is as big as the free space allows: the full width on most phones, never cut off on short ones */
.doubt-stage { flex: 1; min-height: 0; margin: 0 12px; container-type: size; display: grid; place-items: center; }
.doubt-board { width: min(100cqw, 100cqh * 3 / 4); aspect-ratio: 3 / 4; margin: 0; }
.doubt-sheet .doubt-caption { margin: 8px 18px 0; min-height: 3.9em; text-align: center; font-size: 15px; line-height: 1.3; color: var(--cream); }
.doubt-sheet[data-state="idle"] .doubt-caption, .doubt-sheet[data-state="thinking"] .doubt-caption,
.doubt-sheet[data-state="transcribing"] .doubt-caption { color: var(--dim); }
.doubt-note { margin: 0 22px 6px; text-align: center; font-size: 14px; line-height: 1.35; color: var(--coral); }
.doubt-ask { display: flex; align-items: center; gap: 8px; margin: 6px 12px 0; padding: 8px; border-radius: 999px;
  background: var(--well); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6); }
.doubt-input { flex: 1; min-width: 0; border: 0; background: none; padding: 8px 4px; font-size: 16px; user-select: text; -webkit-user-select: text; }
.doubt-input::placeholder { color: var(--quiet); }
.doubt-input:focus-visible { outline: none; }
.doubt-tool, .doubt-go { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; }
.doubt-tool { color: var(--cream); background: linear-gradient(180deg, var(--tile-hi), var(--tile)); box-shadow: var(--lit); }
.doubt-go { color: var(--ink); background: linear-gradient(180deg, var(--gold-hi), var(--gold)); }
.doubt-tool:disabled, .doubt-go:disabled, .doubt-input:disabled { opacity: 0.45; }
.doubt-sheet[data-state="listening"] .doubt-tool[aria-label="Ask aloud"] { color: #fff6ea; background: var(--coral); animation: doubt-rec 1.2s ease-in-out infinite; }
@keyframes doubt-rec { 0%, 100% { box-shadow: 0 0 0 0 rgba(227, 115, 82, 0.6); } 50% { box-shadow: 0 0 0 8px rgba(227, 115, 82, 0); } }
.doubt-attached { position: relative; flex: none; }
.doubt-attached img { width: 42px; height: 42px; object-fit: cover; border-radius: 10px; display: block; }
.doubt-attached button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--tile-hi); color: var(--cream); }
.doubt-attached button svg { width: 10px; height: 10px; }

/* the crop (TJ, 2026-11-22): on a photo of a page, drag the gold corners around just the question, then ask */
.doubt-crop { position: absolute; inset: 0; z-index: 2; padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: radial-gradient(90% 55% at 50% 12%, var(--glow) 0%, transparent 62%), linear-gradient(180deg, var(--night), var(--night-2)); }
.doubt-crop-area { flex: 1; min-height: 0; margin: 4px 14px 0; container-type: size; display: grid; place-items: center; touch-action: none; }
.doubt-crop-frame { position: relative; overflow: hidden; border-radius: 8px; box-shadow: var(--shadow); }
.doubt-crop-frame img { display: block; max-width: 100cqw; max-height: 100cqh; -webkit-user-drag: none; pointer-events: none; }
.doubt-crop-box { position: absolute; touch-action: none; cursor: move;
  box-shadow: 0 0 0 9999px rgba(6, 11, 26, 0.62); outline: 1.5px solid rgba(255, 217, 138, 0.85); outline-offset: -1.5px; }
.doubt-grip { position: absolute; width: 28px; height: 28px; border: 0 solid var(--gold-hi); }
.doubt-grip::before { content: ""; position: absolute; inset: -14px; } /* a target big enough for a thumb */
.doubt-grip.nw { left: 0; top: 0; border-width: 4px 0 0 4px; cursor: nwse-resize; }
.doubt-grip.ne { right: 0; top: 0; border-width: 4px 4px 0 0; cursor: nesw-resize; }
.doubt-grip.sw { left: 0; bottom: 0; border-width: 0 0 4px 4px; cursor: nesw-resize; }
.doubt-grip.se { right: 0; bottom: 0; border-width: 0 4px 4px 0; cursor: nwse-resize; }
.doubt-crop-hint { margin: 10px 22px 0; text-align: center; font-size: 14px; color: var(--dim); }
.doubt-crop-actions { display: flex; gap: 10px; margin: 10px 14px 0; }
.doubt-crop-actions button { flex: 1; padding: 14px 10px; border-radius: var(--r-btn); font-size: 16px; font-weight: 700; box-shadow: var(--shadow), var(--lit); }
.doubt-another { color: var(--cream); background: linear-gradient(180deg, var(--tile-hi), var(--tile)); }
.doubt-use { color: var(--ink); background: linear-gradient(180deg, var(--gold-hi), var(--gold)); }

/* Brief | Detailed (TJ, 2026-11-22): the Maths | Physics pill, small, in the panel's top bar */
.doubt-sheet .bar .doubt-mode { margin: 0; padding: 4px; gap: 4px; }
.doubt-mode .seg { padding: 7px 11px; font-size: 13px; }
/* a detailed answer's pages lie in a stack (TJ: thumbnails took the learning space; show the stack on the left): the
   pages under this one peek out on the left edge, so nothing seems lost, small dots inside the board show which page
   is up, and a sideways swipe turns them */
.doubt-board { touch-action: none; transition: box-shadow 0.3s; }
/* the board steps right a little to make room for the stack; each page under it peeks out lower, like fanned cards */
.doubt-stage:has(.doubt-board:not([data-stack="0"])) { padding-left: 14px; }
.doubt-board[data-stack="1"] { box-shadow: -10px 5px 0 -3px #48526a, inset 0 1px 0 rgba(255, 200, 120, 0.22), inset 0 0 0 1px rgba(52, 60, 72, 0.55), var(--shadow); }
.doubt-board[data-stack="2"] { box-shadow: -10px 5px 0 -3px #48526a, -19px 10px 0 -6px #353d50, inset 0 1px 0 rgba(255, 200, 120, 0.22), inset 0 0 0 1px rgba(52, 60, 72, 0.55), var(--shadow); }
.doubt-dots { position: absolute; left: 0; right: 0; bottom: 9px; z-index: 1; display: flex; justify-content: center; gap: 2px; }
.doubt-dot { width: 22px; height: 18px; display: grid; place-items: center; }
.doubt-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: rgba(169, 180, 204, 0.45); transition: background 0.2s, transform 0.2s; }
.doubt-dot[aria-selected="true"]::before { background: var(--gold); transform: scale(1.25); box-shadow: 0 0 8px rgba(232, 184, 74, 0.6); }
/* the bar keeps close, the switch and "New doubt" on one line, even on a small phone */
.doubt-sheet .bar { gap: 8px; padding-left: 14px; padding-right: 14px; }
.doubt-sheet .doubt-new { white-space: nowrap; padding: 8px 10px; }

/* the photo button's two choices (TJ, 2026-11-22: take a photo of a page, or pick one): a small card above the composer */
.doubt-ask { position: relative; }
.doubt-photo-menu { position: absolute; left: 4px; bottom: calc(100% + 10px); z-index: 3; display: grid; gap: 4px; padding: 6px; border-radius: 18px;
  background: linear-gradient(180deg, var(--tile-hi), var(--tile)); box-shadow: var(--shadow), var(--lit); }
.doubt-photo-menu button { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; font-size: 15px; color: var(--cream); text-align: left; white-space: nowrap; }
.doubt-photo-menu button:active { background: rgba(255, 255, 255, 0.08); }
.doubt-photo-menu svg.i { width: 22px; height: 22px; color: var(--gold-hi); }
