:root {
  --blue: #F4581C; --blue-dark: #D24310; --ink: #14110E; --mut: #6B655D;
  --bg: #FFFBF2; --card: #ffffff; --line: #F2E4C8;
  --good: #059669; --grow: #d97706;
}
* { box-sizing: border-box; margin: 0; }
body { font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink); }
.screen { display: none; min-height: 100vh; padding: 16px; position: relative; }
.screen.active { display: block; }

/* ---------- landing ---------- */
.landing { padding: 0 0 40px; }
.hero { background: linear-gradient(135deg, #D24310 0%, #F4581C 45%, #E8960F 100%);
  color: #fff; text-align: center; padding: 52px 20px 86px; }
.brand.light { color: #bfdbfe; letter-spacing: 2px; font-size: .8rem; }
.hero-h1 { font-size: clamp(1.8rem, 6vw, 2.8rem); margin: 10px 0 12px; }
.hero-sub { color: #dbeafe; max-width: 560px; margin: 0 auto 20px; line-height: 1.5; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px; padding: 7px 14px; font-size: .85rem; font-weight: 600; }
.landing .card { margin: 24px auto; max-width: 640px; }
.card.overlap { margin-top: -48px; box-shadow: 0 12px 32px rgba(17,24,39,.14); }
.price-row { display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px; border-bottom: 1px dashed var(--line); padding-bottom: 14px; }
.price { font-size: 1.7rem; font-weight: 800; }
.price-note { color: var(--mut); font-size: .82rem; display: block; }
.free-badge { background: #dcfce7; color: #166534; font-weight: 700; font-size: .85rem;
  border-radius: 999px; padding: 8px 14px; }
.big-cta { font-size: 1.15rem; padding: 16px; }
.opt-tag { color: var(--mut); font-weight: 400; font-size: .82rem; }
.landing-h2 { font-size: 1.15rem; margin-bottom: 14px; }
.get-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.get { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.get span { font-size: 1.5rem; }
.get b { display: block; margin: 6px 0 4px; }
.get p { color: var(--mut); font-size: .85rem; line-height: 1.45; }
.cert-teaser { text-align: center; margin-top: 18px; }
.mini-cert { display: inline-block; background: #fffdf7; border: 2px solid #c9a227;
  border-radius: 6px; padding: 16px 26px; box-shadow: 0 6px 18px rgba(0,0,0,.12);
  transform: rotate(-1.5deg); font-family: Georgia, serif; }
.mc-brand { font-family: Helvetica, sans-serif; font-size: .55rem; letter-spacing: 1px;
  color: var(--blue); font-weight: 700; }
.mc-title { font-variant: small-caps; font-size: .8rem; margin-top: 2px; }
.mc-name { font-weight: 700; font-size: 1.05rem; border-bottom: 1px solid #c9a227;
  margin: 6px 0; padding-bottom: 3px; }
.mc-score { font-size: 1.6rem; font-weight: 800; color: var(--blue); }
.mc-score span { color: var(--blue); }
.mc-serial { font-family: Helvetica, sans-serif; font-size: .58rem; color: var(--mut); margin-top: 4px; }
.cert-caption { color: var(--mut); font-size: .85rem; margin-top: 10px; }
.sample-row { display: flex; gap: 10px; margin-top: 16px; }
.sample-row button { flex: 1; }
.klass-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.klass { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.klass-emoji { font-size: 1.6rem; }
.klass b { display: block; margin: 6px 0 2px; }
.klass-num { color: var(--blue); font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.klass p { color: var(--mut); font-size: .84rem; line-height: 1.45; }
.klass p.klass-num { color: var(--blue); }
.klass-common { margin-top: 14px; font-size: .92rem; }
.klass-common ul { margin: 8px 0 0 2px; list-style: none; }
.klass-common li { margin: 7px 0; line-height: 1.45; }
@media (max-width: 640px) { .klass-grid { grid-template-columns: 1fr; } .sample-row { flex-direction: column; } }
@media (max-width: 560px) { .get-grid { grid-template-columns: 1fr; } }
.card { max-width: 760px; margin: 24px auto; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.card.center { text-align: center; }
.brand { color: var(--blue); font-weight: 700; letter-spacing: .4px; margin-bottom: 6px; }
h1 { font-size: 1.5rem; margin-bottom: 8px; }
.sub { color: var(--mut); margin-bottom: 20px; }
label { display: block; margin: 14px 0 4px; font-weight: 600; font-size: .95rem; }
input, select { width: 100%; padding: 12px; margin-top: 6px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 1rem; background: #fff; }
button { cursor: pointer; border: 0; border-radius: 10px; padding: 13px 22px;
  font-size: 1rem; font-weight: 600; }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--blue); color: #fff; width: 100%; margin-top: 20px; }
button.primary:active { background: var(--blue-dark); }
button.ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.fine { color: var(--mut); font-size: .8rem; margin-top: 16px; line-height: 1.4; }
.hidden { display: none; }
.big { font-size: 2.2rem; font-weight: 700; margin: 14px 0; }

#hud { max-width: 760px; margin: 0 auto; display: flex; justify-content: space-between;
  padding: 10px 4px; font-weight: 600; color: var(--mut); font-size: .9rem; }
#hud-timer.low { color: #dc2626; }
#q-prompt { font-weight: 700; font-size: 1.05rem; margin-bottom: 14px; }
#q-stem svg { width: 100%; height: auto; max-height: 46vh; }
#q-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px; margin-top: 14px; }
.opt { border: 2px solid var(--line); border-radius: 10px; background: #fff;
  padding: 6px; position: relative; }
.opt svg { width: 100%; height: auto; }
.opt .tag { position: absolute; top: 4px; left: 8px; font-weight: 700; color: var(--mut); }
.opt.sel { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.18); }
.opt { cursor: pointer; transition: transform .08s, border-color .12s; }
.opt:active { transform: scale(.96); }
.opt-check { position: absolute; top: 4px; right: 8px; color: var(--blue);
  font-weight: 800; opacity: 0; transition: opacity .12s; }
.opt.sel .opt-check { opacity: 1; }

/* zone intro */
#zone-intro { position: absolute; inset: 0; display: none; z-index: 20;
  background: linear-gradient(135deg, #D24310, #F4581C 45%, #E8960F);
  color: #fff; align-items: center; justify-content: center; text-align: center; }
#zone-intro.show { display: flex; animation: zi-in .3s ease-out; }
@keyframes zi-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
.zi-inner { padding: 24px; }
.zi-name { font-size: 2rem; font-weight: 800; margin-bottom: 10px; }
.zi-tag { font-size: 1.1rem; color: #dbeafe; margin-bottom: 26px; }
#zone-intro .zi-go { background: #fff; color: var(--blue); max-width: 240px; margin: 0 auto; }

/* numerical: type your answer */
/* W1-06 layout budget: pad + confirm tick must fit above the fold at 360x740 */
.num-entry { text-align: center; padding: 4px 0 2px; }
.num-disp { font-size: 2rem; font-weight: 800; min-height: 44px; letter-spacing: 3px;
  border-bottom: 2px solid var(--line); max-width: 260px; margin: 0 auto 10px; }
.num-pad { display: grid; grid-template-columns: repeat(3, 68px); gap: 8px; justify-content: center; }
.num-key { font-size: 1.3rem; padding: 10px 0; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; font-weight: 700; cursor: pointer; }
.num-key:active { background: #eef2ff; }
.num-ok { background: var(--blue); color: #fff; border: 0; }
.num-ok:disabled { opacity: .35; }
#q-nav { display: flex; gap: 10px; justify-content: space-between; margin-top: 18px; }
#q-nav .primary { width: auto; margin-top: 0; }

/* ---------- working memory mini-games ---------- */
.wm-intro { text-align: center; padding: 16px 0; }
.wm-emoji { font-size: 3rem; }
.wm-len { font-weight: 700; margin: 10px 0 18px; }
.wm-done-note { color: var(--good); font-weight: 600; margin-bottom: 10px; }
.wm-intro .primary { max-width: 320px; margin: 0 auto; }
.wm-stage { text-align: center; padding: 24px 0; }
.wm-flash { font-size: 5rem; font-weight: 800; height: 110px; line-height: 110px; }
.wm-flash.pop { animation: wmpop .25s ease-out; }
@keyframes wmpop { from { transform: scale(.4); opacity: .2; } to { transform: scale(1); opacity: 1; } }
.wm-hint { color: var(--mut); margin-top: 8px; }
.wm-answer { text-align: center; padding: 6px 0; }
.wm-answer > p { font-weight: 700; margin-bottom: 8px; }
.wm-entry { font-size: 1.6rem; font-weight: 700; letter-spacing: 6px; min-height: 40px;
  border-bottom: 2px solid var(--line); max-width: 320px; margin: 0 auto 10px; }
.wm-pad { display: grid; grid-template-columns: repeat(3, 68px); gap: 8px; justify-content: center; }
.wm-key { font-size: 1.3rem; padding: 10px 0; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; font-weight: 700; cursor: pointer; }
.wm-key:active { background: #eef2ff; }
.wm-ok { background: var(--blue); color: #fff; border: 0; }
.wm-ok:disabled { opacity: .35; }
.wm-grid { display: grid; grid-template-columns: repeat(3, 76px); grid-template-rows: repeat(3, 76px);
  gap: 9px; justify-content: center; margin: 0 auto; }
.wm-cell { background: #e8edf7; border-radius: 12px; position: relative; }
.wm-cell.tap { cursor: pointer; }
.wm-cell.lit { background: var(--blue); box-shadow: 0 0 18px rgba(37,99,235,.55); }
.wm-badge { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.4rem; color: var(--blue); }
.wm-grid-nav { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }

.confetti { text-align: center; font-size: 1.6rem; margin-bottom: 6px; }
.center-text { text-align: center; }
.mut { color: var(--mut); }
.iq-ring { width: 170px; height: 170px; margin: 18px auto 8px; border-radius: 50%;
  border: 8px solid var(--blue); display: flex; flex-direction: column;
  align-items: center; justify-content: center; box-shadow: 0 0 0 8px rgba(37,99,235,.12); }
.iq-num { font-size: 3.4rem; font-weight: 800; line-height: 1; }
.iq-cap { font-size: .75rem; color: var(--mut); text-transform: uppercase; letter-spacing: .5px; margin-top: 4px; }
.beat { font-weight: 700; font-size: 1.05rem; margin: 12px 0 18px; }
.share-row { display: flex; gap: 10px; margin-top: 10px; }
.share-row button { flex: 1; }
.wa { border-color: #25d366; color: #128c7e; font-weight: 700; }
/* CareerGuide account box (result screen) */
.acct { border: 1px dashed var(--blue); border-radius: 12px; padding: 16px;
  margin-top: 14px; background: #f6f9ff; }
.acct h3 { font-size: 1rem; margin-bottom: 6px; }
.acct input { width: 100%; padding: 11px; margin-top: 8px; border: 1px solid var(--line);
  border-radius: 10px; font-size: .95rem; background: #fff; }
.acct .primary { margin-top: 12px; }
.acct-row { display: flex; gap: 10px; margin-top: 12px; }
.acct-row button { flex: 1; margin: 0; }
.acct-note { color: var(--mut); font-size: .88rem; line-height: 1.45; }
.acct-note.ok { color: var(--good); font-weight: 600; }
.acct-note.err { color: #dc2626; font-weight: 600; }
.acct-small { padding: 8px 14px; font-size: .85rem; margin-top: 8px; }

.retake-cta { border: 2px dashed var(--blue); border-radius: 14px; background: #FFF6F1;
  padding: 16px 18px; text-align: center; margin-top: 14px; line-height: 1.5; }

.explain { margin-top: 26px; }
.explain h2 { font-size: 1.05rem; margin-bottom: 10px; }
.explain details { border: 1px solid var(--line); border-radius: 10px;
  margin: 8px 0; background: #fafbfe; }
.explain summary { cursor: pointer; padding: 13px 14px; font-weight: 700;
  list-style: none; }
.explain summary::-webkit-details-marker { display: none; }
.explain summary::after { content: "＋"; float: right; color: var(--blue); }
.explain details[open] summary::after { content: "－"; }
.explain p { padding: 0 14px 14px; line-height: 1.55; font-size: .95rem; }
.dimrow { margin: 12px 0; }
.dimrow .name { display: flex; justify-content: space-between; font-size: .92rem;
  font-weight: 600; margin-bottom: 4px; }
.bar { height: 10px; background: var(--line); border-radius: 6px; overflow: hidden; }
.bar > div { height: 100%; background: var(--blue); border-radius: 6px; }
.callouts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.callout { border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.callout h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }
.callout.good h3 { color: var(--good); }
.callout.grow h3 { color: var(--grow); }
@media (max-width: 560px) { .callouts { grid-template-columns: 1fr; } .card { padding: 18px; } }


/* W1-01: idle "are you still there?" pause overlay */
#idle-overlay { position: absolute; inset: 0; display: none; z-index: 40; cursor: pointer;
  background: rgba(17,24,39,.88); color: #fff;
  align-items: center; justify-content: center; text-align: center; }
#idle-overlay.show { display: flex; animation: zi-in .3s ease-out; }
.idle-inner { padding: 24px; }
.idle-emoji { font-size: 3rem; }
.idle-title { font-size: 1.6rem; font-weight: 800; margin-top: 10px; }
.idle-sub { color: #d1d5db; margin-top: 10px; font-size: 1rem; }

/* W1-11: Skip must not look like Next */
#btn-skip { border: 1px dashed var(--grow); color: var(--grow); background: #fffbeb; }

/* one-time hint toast */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(16px);
  background: #111827; color: #fff; padding: 12px 18px; border-radius: 10px;
  font-size: .9rem; font-weight: 600; max-width: 90vw; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* keypad input-mode announcement (W1-07) */
.pad-hint { color: var(--mut); font-size: .82rem; margin-bottom: 8px; }

/* frozen timer on the break screen (W1-04) */
.break-frozen { color: var(--mut); margin-top: 10px; }
.break-frozen b { color: var(--ink); }

/* W1-06: short phones (360x740 class) — everything answerable above the fold */
@media (max-height: 760px) {
  #q-stem svg { max-height: 32vh; }
  .card { padding: 16px; }
  #q-prompt { margin-bottom: 8px; }
  #q-options { margin-top: 10px; }
  #q-nav { margin-top: 12px; }
  .wm-stage { padding: 12px 0; }
  .wm-grid { grid-template-columns: repeat(3, 68px); grid-template-rows: repeat(3, 68px); }
}

/* mid-test paywall */
#paywall { position: absolute; inset: 0; display: none; z-index: 30; overflow-y: auto;
  background: linear-gradient(135deg, #D24310, #F4581C 45%, #E8960F); color: #fff; }
#paywall.show { display: flex; align-items: center; justify-content: center; animation: zi-in .3s ease-out; }
.pw-inner { max-width: 420px; padding: 28px 20px; text-align: center; }
.pw-title { font-size: 1.7rem; font-weight: 800; }
.pw-sub { color: #dbeafe; margin: 10px 0 16px; line-height: 1.5; }
.pw-preview { position: relative; background: #fff; border-radius: 14px; padding: 18px; }
.pw-blur { filter: blur(5px); }
.pw-ring { width: 90px; height: 90px; border-radius: 50%; border: 6px solid #F4581C;
  margin: 0 auto 12px; display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 800; color: #111827; }
.pw-bars div { height: 9px; background: #e5e7eb; border-radius: 6px; margin: 7px 0; }
.pw-bars i { display: block; height: 100%; background: #F4581C; border-radius: 6px; }
.pw-cert { color: #92400e; background: #fef3c7; border-radius: 8px; padding: 8px;
  font-weight: 700; font-size: .85rem; margin-top: 10px; }
.pw-lock { position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; font-size: 3.4rem; }
.pw-what { color: #dbeafe; font-size: .85rem; margin: 14px 0 4px; line-height: 1.5; }
#paywall .pw-pay { background: #fff; color: #D24310; font-size: 1.1rem; }
.pw-note { color: #bfdbfe; font-size: .78rem; margin-top: 10px; }

/* parent-consent gate (DPDP) */
.acct-check { display: flex; gap: 8px; align-items: flex-start; font-size: .84rem;
  color: #475569; margin: 8px 0 10px; line-height: 1.45; }
.acct-check input { margin-top: 3px; flex: 0 0 auto; }

/* G6 (shared QA standard): reserve the scrollbar gutter so the card never
   shifts left/right between screens. G3/G4/G5 already satisfied here —
   .opt-check is pre-rendered and revealed by opacity, and .opt:active uses
   transform, so selection never changes layout. */
html { scrollbar-gutter: stable; }

/* zone intro: what's coming (W1-05) */
.zi-step { font-size: .74rem; letter-spacing: .12em; text-transform: uppercase;
  color: #93c5fd; font-weight: 700; margin-bottom: 4px; }
.zi-meta { font-weight: 700; margin-top: 10px; color: #fff; }
.zi-how { font-size: .88rem; color: #dbeafe; margin-top: 6px; line-height: 1.5; max-width: 30ch; }

/* R2: inline validation on the start card — no browser alert() boxes */
.field-bad { border-color: #dc2626 !important; box-shadow: 0 0 0 3px rgba(220,38,38,.12); }
.field-msg { color: #b91c1c; font-size: .85rem; margin: 5px 0 0; }
/* R2: reviewer saw clipped text on narrow phones */
.hero-h1, .hero-sub, .chip, .big-cta { overflow-wrap: anywhere; }
.big-cta { white-space: normal; line-height: 1.3; height: auto; padding: 15px 18px; }
.chips { flex-wrap: wrap; }
/* R2: option letter badges (A-E) so a student can call out an answer */
.opt-letter { display:inline-flex; align-items:center; justify-content:center;
  width:22px; height:22px; border-radius:6px; background:#eef2ff; color:#3730a3;
  font-weight:700; font-size:.78rem; margin-right:8px; flex:0 0 auto; }
.opt.selected .opt-letter { background:#F4581C; color:#fff; }
/* R2: student identity visible during the test */
.who { font-size:.8rem; color:#64748b; }

/* ---------- R2-11/12: question palette + mark-for-review ----------
   A 91-question paper had no way to see what was missed or jump back.
   Students in Classes 10-12 sit board and entrance mocks; they expect this. */
.hud-btn { background: none; border: 1px solid var(--line); border-radius: 8px;
  padding: 2px 8px; font-size: .95rem; cursor: pointer; color: var(--ink); line-height: 1.6; }
.hud-btn:active { background: #f1f5f9; }

#palette { position: absolute; inset: 0; z-index: 30; display: flex;
  align-items: center; justify-content: center; background: rgba(15,23,42,.55); padding: 16px; }
#palette.hidden { display: none; }
.pal-card { background: #fff; border-radius: 16px; padding: 16px; width: 100%;
  max-width: 420px; max-height: 84vh; display: flex; flex-direction: column; }
.pal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.pal-x { background: none; border: 0; font-size: 1.1rem; cursor: pointer; color: #64748b; }
.pal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 7px; overflow-y: auto; padding: 2px; }
.pal-q { aspect-ratio: 1; border-radius: 9px; border: 1.5px solid var(--line);
  background: #fff; font-weight: 700; font-size: .82rem; cursor: pointer; color: var(--ink); }
.pal-q.done { background: #dcfce7; border-color: #16a34a; color: #14532d; }
.pal-q.flag { background: #fef3c7; border-color: #d97706; color: #78350f; }
.pal-q.flag.done { background: #fef3c7; border-color: #16a34a; }
.pal-q.lock { background: #f1f5f9; color: #94a3b8; cursor: not-allowed; border-style: dashed; }
.pal-q.here { box-shadow: 0 0 0 3px rgba(37,99,235,.45); border-color: var(--blue); }
.pal-key { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; font-size: .74rem; color: #64748b; }
.pal-key .k { display: inline-block; width: 11px; height: 11px; border-radius: 3px;
  border: 1.5px solid var(--line); vertical-align: -1px; margin-right: 4px; }
.k-done { background: #dcfce7; border-color: #16a34a; }
.k-todo { background: #fff; }
.k-flag { background: #fef3c7; border-color: #d97706; }
.k-lock { background: #f1f5f9; border-style: dashed; }
.pal-sum { font-size: .8rem; color: #475569; margin: 10px 0 0; text-align: center; }

#btn-flag.on { background: #fef3c7; border-color: #d97706; color: #78350f; }
@media (max-width: 380px) { #q-nav { flex-wrap: wrap; } #q-nav button { flex: 1 1 auto; } }

/* ── cheers & milestones (gamification standard) ── */
#cheer{position:fixed;top:74px;left:50%;transform:translateX(-50%) translateY(-12px);background:#14110E;color:#fff;font-weight:800;font-size:15px;padding:10px 22px;border-radius:999px;box-shadow:0 12px 30px -10px rgba(0,0,0,.4);opacity:0;pointer-events:none;transition:all .25s cubic-bezier(.2,0,0,1);z-index:9998}
#cheer.on{opacity:1;transform:translateX(-50%) translateY(0)}
#cheer.milestone{background:#F4581C;font-size:16.5px;box-shadow:0 0 0 3px #FFD93B,0 14px 34px -10px rgba(244,88,28,.55)}

.brand-by { display: block; font-size: .62em; font-weight: 600; letter-spacing: .04em; opacity: .85; text-transform: none; }
