/* 701 OVERKILL — design system
   Tokens → base → layout → components → screens → motion. Sizes in rem so text scales with
   the phone's font size. Dark "security terminal" theme is default; light theme + cosmetic themes. */

:root {
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  /* type scale (1.2 ratio) */
  --t-xs: .75rem; --t-sm: .875rem; --t-md: 1rem; --t-lg: 1.2rem; --t-xl: 1.44rem; --t-2xl: 1.75rem; --t-3xl: 2.2rem;
  /* spacing (4px grid) */
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.25rem; --s6: 1.5rem; --s8: 2rem;
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 26px; --r-pill: 999px;
  --ease: cubic-bezier(.2,.8,.2,1); --spring: cubic-bezier(.34,1.56,.64,1);
  --dur: 220ms;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}

/* Dark (default) */
:root, [data-theme="dark"] {
  color-scheme: dark;
  --bg: #070B10; --bg-2: #0B1118;
  --surface: #111821; --surface-2: #17202C; --surface-3: #1E2937;
  --line: rgba(148,175,210,.12); --line-2: rgba(148,175,210,.2);
  --text: #E8EEF5; --text-2: #A9B6C6; --muted: #7D8C9F;
  --accent: #34E0A1; --accent-ink: #04130D; --accent-soft: rgba(52,224,161,.14);
  --cyan: #45C8F5; --violet: #A28BFF; --amber: #FFBE3D; --red: #FF6B7A; --pink: #FF7AC6;
  --good: #34E0A1; --mid: #FFBE3D; --bad: #FF6B7A; --new: #5B6B80;
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 10px 30px -12px rgba(0,0,0,.6);
  --shadow-lg: 0 20px 50px -20px rgba(0,0,0,.8);
  --glow: 0 0 0 1px rgba(52,224,161,.35), 0 8px 30px -8px rgba(52,224,161,.45);
  --grid: rgba(69,200,245,.05);
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #F3F6FA; --bg-2: #EAF0F6;
  --surface: #FFFFFF; --surface-2: #F4F7FB; --surface-3: #E8EEF5;
  --line: rgba(20,40,70,.1); --line-2: rgba(20,40,70,.18);
  --text: #0C1622; --text-2: #3A4A5E; --muted: #5E6D80;
  --accent: #087A55; --accent-ink: #FFFFFF; --accent-soft: rgba(8,122,85,.12);
  --cyan: #07709B; --violet: #6B4EE6; --amber: #8A5A0E; --red: #C42F43; --pink: #C2378A;
  --good: #087A55; --mid: #8A5A0E; --bad: #C42F43; --new: #8A97A8;
  --shadow: 0 1px 2px rgba(16,32,60,.06), 0 8px 24px -12px rgba(16,32,60,.18);
  --shadow-lg: 0 20px 50px -24px rgba(16,32,60,.35);
  --glow: 0 0 0 1px rgba(14,159,110,.35), 0 8px 24px -10px rgba(14,159,110,.35);
  --grid: rgba(10,127,176,.05);
}
/* Cosmetic themes (unlocked by badges — cosmetics only) */
[data-cosmetic="terminal"] { --accent: #39FF88; --accent-soft: rgba(57,255,136,.12); --cyan: #39FF88; --font: var(--mono); --bg: #020604; --surface: #07110B; --surface-2: #0B1A11; --surface-3: #10251A; }
[data-theme="light"][data-cosmetic="terminal"] { --bg: #F1FBF4; --surface: #fff; --surface-2: #EEF9F1; --surface-3: #DDF3E3; --accent: #0B8A44; --cyan: #0B8A44; }
[data-cosmetic="ember"] { --accent: #FF9F43; --accent-soft: rgba(255,159,67,.14); --accent-ink: #1A0E02; --cyan: #FFC66B; }
[data-cosmetic="aurora"] { --accent: #A28BFF; --accent-soft: rgba(162,139,255,.16); --accent-ink: #0D0624; --cyan: #7DE3FF; }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 400 var(--t-md)/1.5 var(--font);
  -webkit-font-smoothing: antialiased; overflow-x: hidden; min-height: 100dvh;
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
body::before { /* subtle grid backdrop */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px; mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: var(--t-2xl); font-weight: 800; }
h2 { font-size: var(--t-xl); font-weight: 750; }
h3 { font-size: var(--t-lg); font-weight: 700; }
p { margin: 0; }
a { color: var(--cyan); text-decoration: none; }
a.card, a.tile, a.li, a.qi, a.stage, a.zone-head, a.btn, a.chip, a.stat-pill, a.track-tab { color: inherit; }
svg { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.card-title svg { width: 16px; height: 16px; }
.chev svg { width: 18px; height: 18px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 8px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); } .t2 { color: var(--text-2); }
.sm { font-size: var(--t-sm); } .xs { font-size: var(--t-xs); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- layout ---------- */
#app { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; min-height: 100dvh; }
.screen { padding: calc(var(--safe-t) + var(--s4)) var(--s4) calc(var(--nav-h) + var(--safe-b) + var(--s8)); }
.screen.enter { animation: screenIn 260ms var(--ease) both; }
.screen.full { padding-bottom: calc(var(--safe-b) + var(--s6)); }
.stack { display: grid; gap: var(--s4); } .stack-sm { display: grid; gap: var(--s2); } .stack-lg { display: grid; gap: var(--s6); }
.row { display: flex; align-items: center; gap: var(--s3); } .row.wrap { flex-wrap: wrap; } .spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s4); }
.topbar .title { flex: 1; min-width: 0; }
.topbar h1 { font-size: var(--t-xl); }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform 120ms var(--ease), background var(--dur); flex: none; }
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s4); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.card.flat { box-shadow: none; background: var(--surface-2); }
.card.hero { padding: var(--s5); background: radial-gradient(120% 140% at 100% 0%, var(--accent-soft), transparent 60%), var(--surface); }
.card.glow { box-shadow: var(--glow); border-color: transparent; }
.card-title { font-size: var(--t-sm); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s3); display: flex; align-items: center; gap: var(--s2); }
.tappable { transition: transform 140ms var(--ease), border-color var(--dur), background var(--dur); cursor: pointer; }
.tappable:active { transform: scale(.98); }
@media (hover: hover) { .tappable:hover { border-color: var(--line-2); } }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 48px; padding: 0 var(--s5); border-radius: var(--r-md); font-weight: 700; font-size: var(--t-md); background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text); transition: transform 120ms var(--ease), filter var(--dur), background var(--dur); user-select: none; text-align: center; }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 8px 24px -10px var(--accent); }
.btn.ghost { background: transparent; }
.btn.idk { border-style: dashed; color: var(--t2, inherit); }
.btn.idk.on { border-style: solid; border-color: var(--accent); color: var(--accent); }
.btn.danger { color: var(--red); }
.btn.block { width: 100%; }
.btn.sm { min-height: 44px; padding: 0 var(--s4); font-size: var(--t-sm); border-radius: var(--r-sm); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn svg { width: 20px; height: 20px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 2px 10px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); font-size: var(--t-xs); font-weight: 700; color: var(--text-2); white-space: nowrap; }
.chip.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.warn { color: var(--amber); } .chip.bad { color: var(--red); }
.chip svg { width: 14px; height: 14px; }
.seg { display: flex; padding: 4px; gap: 4px; background: var(--surface-2); border-radius: var(--r-md); border: 1px solid var(--line); }
.seg button { flex: 1; min-height: 40px; border-radius: 10px; font-weight: 700; font-size: var(--t-sm); color: var(--text-2); transition: background var(--dur), color var(--dur); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- progress ---------- */
.bar { height: 10px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; position: relative; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--cyan)); width: 0; transition: width 900ms var(--ease); }
.bar.thin { height: 6px; }
.bar.hp > i { background: linear-gradient(90deg, #FF4D6D, #FF8A5B); }
.bar.amber > i { background: var(--amber); }
.ring { --p: 0; --c: var(--accent); width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-3) 0); position: relative; flex: none; transition: --p 900ms var(--ease); }
.ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.ring b { position: relative; font-size: var(--t-lg); font-weight: 800; }
.ring.lg { width: 112px; height: 112px; } .ring.lg b { font-size: var(--t-2xl); }
@property --p { syntax: "<number>"; inherits: false; initial-value: 0; }

/* ---------- header HUD ---------- */
.hud { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s4); }
.avatar { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--cyan)); color: var(--accent-ink); font-weight: 900; font-size: var(--t-lg); box-shadow: var(--glow); flex: none; }
.hud .lvl { font-weight: 800; font-size: var(--t-md); }
.hud .xpline { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-xs); color: var(--muted); }
.stat-pill { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); font-weight: 800; font-size: var(--t-sm); }
.stat-pill svg { width: 18px; height: 18px; }
.flame { color: var(--amber); }

/* ---------- track switcher ---------- */
.tracks { display: flex; gap: var(--s2); overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--s4)) var(--s4); padding: 0 var(--s4); }
.tracks::-webkit-scrollbar { display: none; }
.track-tab { flex: none; min-height: 44px; padding: 6px 14px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); font-weight: 750; font-size: var(--t-sm); display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.track-tab[aria-pressed="true"] { border-color: transparent; background: var(--accent-soft); color: var(--accent); }
.track-tab small { font-weight: 600; color: var(--muted); }

/* ---------- world map ---------- */
.zone { padding: 0; }
.zone-head { padding: var(--s4); display: flex; gap: var(--s3); align-items: center; }
.zone-badge { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-weight: 900; font-size: var(--t-xl); background: var(--surface-3); color: var(--text-2); flex: none; position: relative; }
.zone.conquered .zone-badge { background: linear-gradient(135deg, var(--accent), var(--cyan)); color: var(--accent-ink); box-shadow: var(--glow); }
.zone.conquered { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.zone.conquered::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(80% 60% at 0% 0%, var(--accent-soft), transparent 70%); }
.zone-name { font-weight: 800; font-size: var(--t-md); }
.zone-sub { font-size: var(--t-xs); color: var(--muted); }
.boss-line { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-xs); color: var(--text-2); margin-top: 6px; }
.boss-line .bar { flex: 1; }
.stages { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s2); padding: 0 var(--s4) var(--s4); }
.stage { min-height: 76px; border-radius: var(--r-md); padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; text-align: left; position: relative; overflow: hidden; transition: transform 140ms var(--ease); }
.stage:active { transform: scale(.96); }
.stage .sid { font-weight: 900; font-family: var(--mono); font-size: var(--t-sm); padding-right: 14px; }
.stage .sname { display: block; font: 600 var(--t-xs)/1.25 var(--font); color: var(--text-2); margin-top: 2px; }
.stage .spct { font-weight: 800; font-size: var(--t-lg); }
.stage .ticks { display: flex; gap: 3px; }
.stage .fill { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--c, var(--new)); width: calc(var(--p) * 1%); transition: width 900ms var(--ease); }
.stage[data-s="mastered"] { --c: var(--good); background: color-mix(in srgb, var(--good) 13%, var(--surface-2)); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.stage[data-s="progress"] { --c: var(--mid); }
.stage[data-s="weak"] { --c: var(--bad); }
.stage .scn { position: absolute; top: 6px; right: 8px; color: var(--amber); }
.stage .scn svg { width: 14px; height: 14px; }
.tick { width: 18px; height: 18px; border-radius: 6px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.tick svg { width: 12px; height: 12px; }
.tick.on { background: var(--accent-soft); color: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: var(--s3); font-size: var(--t-xs); color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- quest card ---------- */
.quest-items { display: grid; gap: var(--s2); margin-top: var(--s3); }
.qi { display: flex; align-items: center; gap: var(--s3); padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); min-height: 52px; width: 100%; text-align: left; }
.qi .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); flex: none; }
.qi .ico svg { width: 18px; height: 18px; }
.qi.done .ico { background: var(--accent-soft); color: var(--accent); }
.qi.done .label { text-decoration: line-through; color: var(--muted); }
.qi .label { flex: 1; font-weight: 650; font-size: var(--t-sm); }

/* ---------- question runner ---------- */
.qhead { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s4); }
.qhead .bar { flex: 1; }
.hearts { display: flex; gap: 4px; color: var(--red); }
.hearts svg { width: 22px; height: 22px; transition: transform 300ms var(--spring), opacity 300ms; }
.hearts .lost { opacity: .2; transform: scale(.7); }
.qmeta { display: flex; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s3); }
.stem { font-size: var(--t-lg); font-weight: 650; line-height: 1.45; margin-bottom: var(--s5); white-space: pre-line; }
.stem .log, .log { display: block; font: 500 var(--t-sm)/1.55 var(--mono); background: #05080C; color: #BDF5D5; border: 1px solid var(--line); padding: var(--s3); border-radius: var(--r-md); overflow-x: auto; white-space: pre; margin: var(--s3) 0; }
[data-theme="light"] .stem .log, [data-theme="light"] .log { background: #0C1622; color: #C9F7DD; }
.options { display: grid; gap: var(--s3); }
.opt { display: flex; align-items: flex-start; gap: var(--s3); width: 100%; text-align: left; min-height: 56px; padding: 14px; border-radius: var(--r-md); background: var(--surface); border: 1.5px solid var(--line-2); font-size: var(--t-md); line-height: 1.4; transition: transform 120ms var(--ease), border-color var(--dur), background var(--dur); }
.opt:active { transform: scale(.985); }
.opt .key { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: var(--t-sm); background: var(--surface-3); color: var(--text-2); flex: none; }
.opt.sel { border-color: var(--cyan); }
.opt.sel .key { background: var(--cyan); color: #001018; }
.opt.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 12%, var(--surface)); animation: pulse 600ms var(--ease); }
.opt.right .key { background: var(--good); color: var(--accent-ink); }
.opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--surface)); animation: shake 420ms var(--ease); }
.opt.wrong .key { background: var(--bad); color: #fff; }
.opt.dim { opacity: .6; }
.opt .why { display: block; margin-top: 6px; font-size: var(--t-sm); color: var(--text-2); }
.feedback { margin-top: var(--s4); border-radius: var(--r-lg); padding: var(--s4); border: 1px solid var(--line); background: var(--surface); animation: rise 280ms var(--ease) both; }
.feedback.good { border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.feedback.gap { border-color: color-mix(in srgb, var(--amber) 50%, transparent); }
.feedback h3 { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s2); font-size: var(--t-md); }
.feedback h3 svg { width: 22px; height: 22px; }
.feedback.good h3 { color: var(--good); } .feedback.gap h3 { color: var(--amber); }
.dock { position: sticky; bottom: calc(var(--safe-b) + var(--s3)); margin-top: var(--s5); display: flex; gap: var(--s3); z-index: 5; }
.dock .btn { flex: 1; box-shadow: var(--shadow-lg); }

/* exam */
.timer { font: 800 var(--t-md) var(--mono); padding: 6px 12px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); display: inline-flex; gap: 6px; align-items: center; }
.timer.low { color: var(--red); border-color: color-mix(in srgb, var(--red) 50%, transparent); animation: blink 1s steps(2) infinite; }
.navgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.navgrid button { height: 44px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font: 700 var(--t-sm) var(--mono); color: var(--text-2); position: relative; }
.navgrid button.ans { background: var(--accent-soft); color: var(--accent); }
.navgrid button.cur { outline: 2px solid var(--cyan); }
.navgrid button.flag::after { content: ""; position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 2px; background: var(--amber); }

/* boss */
.boss-arena { text-align: center; padding: var(--s5) var(--s4); background: radial-gradient(90% 80% at 50% 0%, rgba(255,77,109,.18), transparent 70%), var(--surface); }
.boss-face { width: 96px; height: 96px; margin: 0 auto var(--s3); border-radius: 30px; display: grid; place-items: center; background: linear-gradient(145deg, #2A0F1A, #4A1426); border: 1px solid rgba(255,107,122,.4); box-shadow: 0 0 40px -10px rgba(255,77,109,.7); animation: hover 3s ease-in-out infinite; }
.boss-face svg { width: 56px; height: 56px; color: #FF8A9A; }
.boss-face.hit { animation: hit 380ms var(--ease); }
.boss-name { font-weight: 900; font-size: var(--t-xl); }
.hpwrap { margin-top: var(--s3); }
.hpwrap .bar { height: 14px; }
.hplabel { display: flex; justify-content: space-between; font: 700 var(--t-xs) var(--mono); color: var(--text-2); margin-bottom: 4px; }

/* flashcards */
.fc-wrap { perspective: 1200px; margin: var(--s2) 0 var(--s5); touch-action: pan-y; }
.fc { position: relative; height: min(52dvh, 380px); transform-style: preserve-3d; transition: transform 520ms var(--ease); cursor: pointer; }
.fc.flip { transform: rotateY(180deg); }
.fc.swipe-r { transform: translateX(120%) rotate(12deg); opacity: 0; transition: transform 320ms var(--ease), opacity 320ms; }
.fc.swipe-l { transform: translateX(-120%) rotate(-12deg); opacity: 0; transition: transform 320ms var(--ease), opacity 320ms; }
.fc-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: var(--r-xl); padding: var(--s6); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); }
.fc-face.back { transform: rotateY(180deg); background: radial-gradient(120% 100% at 50% 0%, var(--accent-soft), transparent 70%), var(--surface); }
.fc-face .big { font-size: var(--t-3xl); font-weight: 900; letter-spacing: -.02em; overflow-wrap: anywhere; }
.fc-face .mid { font-size: var(--t-lg); font-weight: 600; line-height: 1.45; }
.fc-face .deck { position: absolute; top: var(--s4); left: var(--s4); }
.fc-face .hint { position: absolute; bottom: var(--s4); font-size: var(--t-xs); color: var(--muted); }
.boxes { display: flex; gap: 6px; }
.boxes span { flex: 1; text-align: center; padding: 6px 0; border-radius: 10px; background: var(--surface-2); font: 700 var(--t-xs) var(--mono); color: var(--muted); border: 1px solid var(--line); }
.boxes span b { display: block; font-size: var(--t-md); color: var(--text); }

/* PBQ */
.pbq-cols { display: grid; gap: var(--s3); }
.dropzone { min-height: 56px; border: 1.5px dashed var(--line-2); border-radius: var(--r-md); padding: 8px; display: flex; flex-direction: column; gap: 6px; background: var(--surface-2); transition: border-color var(--dur), background var(--dur); }
.dropzone.over { border-color: var(--cyan); background: color-mix(in srgb, var(--cyan) 10%, var(--surface-2)); }
.dz-label { font-weight: 700; font-size: var(--t-sm); padding: 2px 4px; }
.token { min-height: 48px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line-2); font-size: var(--t-sm); font-weight: 600; box-shadow: var(--shadow); touch-action: none; user-select: none; display: flex; align-items: center; gap: 8px; text-align: left; width: 100%; }
.token.sel { border-color: var(--cyan); box-shadow: 0 0 0 2px var(--cyan); }
.token.ghost { opacity: .35; }
.token.ok { border-color: var(--good); } .token.no { border-color: var(--bad); }
.token .grip { color: var(--muted); flex: none; } .token .grip svg { width: 18px; height: 18px; }
.drag-float { position: fixed; z-index: 100; pointer-events: none; transform: rotate(-2deg) scale(1.03); box-shadow: var(--shadow-lg); opacity: .95; }
.pool { display: grid; gap: 6px; }
.order-list { display: grid; gap: 8px; }
.order-item { display: flex; align-items: center; gap: 8px; }
.order-item .num { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); font: 800 var(--t-sm) var(--mono); flex: none; }
.order-item .token { flex: 1; }
.mini-btns { display: flex; flex-direction: column; gap: 4px; }
.mini-btns button { width: 44px; height: 26px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; }
.mini-btns svg { width: 16px; height: 16px; }
.axis-pick { display: grid; gap: 8px; }
.axis-pick .opts { display: flex; flex-wrap: wrap; gap: 6px; }
.axis-pick .opts button { min-height: 40px; padding: 0 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: var(--t-sm); font-weight: 650; }
.axis-pick .opts button[aria-pressed="true"] { background: var(--cyan); color: #001018; border-color: transparent; }
.axis-pick .opts button.ok { background: var(--good); color: var(--accent-ink); }
.axis-pick .opts button.no { background: var(--bad); color: #fff; }

/* lists */
.list { display: grid; gap: var(--s2); }
.li { display: flex; align-items: center; gap: var(--s3); padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); min-height: 56px; width: 100%; text-align: left; }
.li .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); flex: none; color: var(--accent); }
.li .ico svg { width: 20px; height: 20px; }
.li .t { font-weight: 700; } .li .d { font-size: var(--t-sm); color: var(--muted); }
.li .chev { color: var(--muted); } .li .chev svg { width: 18px; height: 18px; }
.tile { display: flex; flex-direction: column; gap: 8px; padding: var(--s4); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); text-align: left; min-height: 110px; }
.tile .ico { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.tile .ico svg { width: 22px; height: 22px; }
.tile .t { font-weight: 800; } .tile .d { font-size: var(--t-xs); color: var(--muted); }
.kv { display: flex; justify-content: space-between; gap: var(--s3); padding: 10px 0; border-bottom: 1px solid var(--line); font-size: var(--t-sm); }
.kv:last-child { border-bottom: 0; }
.kv b { text-align: right; }
.bignum { font-size: var(--t-3xl); font-weight: 900; letter-spacing: -.03em; line-height: 1; }
.stat { padding: var(--s3); border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.stat b { display: block; font-size: var(--t-xl); font-weight: 850; }
.stat span { font-size: var(--t-xs); color: var(--muted); }
.callout { padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--surface-2); border-left: 3px solid var(--cyan); font-size: var(--t-sm); color: var(--text-2); }
.callout.warn { border-left-color: var(--amber); } .callout.good { border-left-color: var(--good); }
.input { width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line-2); font-size: var(--t-md); }
.input:focus { outline: 2px solid var(--cyan); outline-offset: 0; }
label.field { display: grid; gap: 6px; font-weight: 700; font-size: var(--t-sm); }
.spark { width: 100%; height: 44px; display: block; }
.spark path.l { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.spark path.a { fill: var(--accent-soft); }
.spark line { stroke: var(--amber); stroke-dasharray: 4 4; stroke-width: 1.5; }
.video { position: relative; aspect-ratio: 16/9; border-radius: var(--r-md); overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vrow { display: flex; align-items: center; gap: var(--s3); padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.vrow .play { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: #FF3B3B; color: #fff; flex: none; }
.vrow .play svg { width: 18px; height: 18px; }
.vrow .t { font-weight: 700; font-size: var(--t-sm); }
.check { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; border: 1.5px solid var(--line-2); color: var(--muted); flex: none; }
.check.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.check svg { width: 20px; height: 20px; }
.plan-day { display: flex; gap: var(--s3); padding: 10px 0; border-bottom: 1px solid var(--line); }
.plan-day .date { width: 52px; flex: none; text-align: center; }
.plan-day .date b { display: block; font-size: var(--t-lg); }
.plan-day .date span { font-size: var(--t-xs); color: var(--muted); text-transform: uppercase; }
.plan-day.today { background: var(--accent-soft); border-radius: var(--r-md); padding: 10px; border: 0; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--s2); }
.badge { padding: var(--s3) 8px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); text-align: center; font-size: var(--t-xs); font-weight: 700; color: var(--muted); }
.badge .b-ico { width: 44px; height: 44px; margin: 0 auto 6px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-3); }
.badge .b-ico svg { width: 22px; height: 22px; }
.badge.on { color: var(--text); border-color: color-mix(in srgb, var(--amber) 40%, transparent); }
.badge.on .b-ico { background: linear-gradient(135deg, var(--amber), #FF7A59); color: #1A0B00; }
details.acc { border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
details.acc summary { list-style: none; padding: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; cursor: pointer; min-height: 52px; }
details.acc summary::-webkit-details-marker { display: none; }
details.acc[open] summary { border-bottom: 1px solid var(--line); }
details.acc .body { padding: 14px; }

/* bottom nav */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; padding: 8px max(10px, calc((100vw - 560px) / 2 + 10px)) calc(var(--safe-b) + 8px); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; border-radius: 14px; color: var(--muted); font-size: 11px; font-weight: 700; transition: color var(--dur), background var(--dur), transform 120ms; }
.nav a:active { transform: scale(.92); }
.nav a svg { width: 24px; height: 24px; }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.nav.hidden { transform: translateY(110%); }

/* sheet + toast + overlay */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 80; animation: fade 200ms both; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; max-width: 560px; margin: 0 auto; max-height: 86dvh; overflow-y: auto; background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0; padding: var(--s3) var(--s4) calc(var(--safe-b) + var(--s5)); box-shadow: var(--shadow-lg); animation: sheetUp 300ms var(--ease) both; border: 1px solid var(--line); }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 0 auto var(--s4); }
.toasts { position: fixed; top: calc(var(--safe-t) + 12px); left: 0; right: 0; z-index: 120; display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; padding: 10px 16px; border-radius: var(--r-pill); background: var(--surface-3); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); font-weight: 750; font-size: var(--t-sm); display: flex; align-items: center; gap: 8px; animation: toastIn 300ms var(--spring) both; max-width: 92vw; }
.toast.xp { color: var(--accent); }
.toast svg { width: 18px; height: 18px; }
.celebrate { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; padding: var(--s6); background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--accent) 20%, transparent), rgba(0,0,0,.75)); animation: fade 250ms both; }
.celebrate .panel { text-align: center; max-width: 380px; width: 100%; background: var(--surface); border-radius: var(--r-xl); padding: var(--s8) var(--s5) var(--s5); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); animation: pop 520ms var(--spring) both; }
.celebrate .medal { width: 96px; height: 96px; margin: 0 auto var(--s4); border-radius: 30px; display: grid; place-items: center; background: linear-gradient(135deg, var(--amber), #FF7A59); color: #1A0B00; box-shadow: 0 10px 40px -8px var(--amber); }
.celebrate .medal svg { width: 52px; height: 52px; }
canvas.confetti { position: fixed; inset: 0; z-index: 115; pointer-events: none; }

/* ---------- motion ---------- */
@keyframes screenIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent); } 100% { box-shadow: 0 0 0 16px transparent; } }
@keyframes shake { 0%,100% { transform: none; } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes blink { 50% { opacity: .55; } }
@keyframes hover { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes hit { 0% { transform: none; filter: none; } 30% { transform: translateX(-8px) rotate(-6deg); filter: brightness(2); } 60% { transform: translateX(6px) rotate(4deg); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { :root:not([data-motion="full"]) *, :root:not([data-motion="full"]) *::before, :root:not([data-motion="full"]) *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; } }
[data-motion="reduced"] *, [data-motion="reduced"] *::before, [data-motion="reduced"] *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }

@media (min-width: 600px) { .screen { padding-left: var(--s5); padding-right: var(--s5); } }

/* resume preview + print (USAJOBS guidance: 8.5x11, 0.5in margins, 10pt body, 14pt name) */
.rs-preview { margin-top: .75rem; overflow-x: auto; border-radius: var(--r-md); background: #DDE3EA; padding: 8px; }
.rs-preview .rs-page { transform-origin: top left; }
.rs-page { width: 8.5in; padding: .5in; background: #fff; color: #111; font: 10pt/1.3 Arial, Helvetica, sans-serif; box-sizing: border-box; }
.rs-preview .rs-page { width: 100%; padding: 14px; font-size: 9px; }
.rs-name { font-size: 14pt; font-weight: 700; margin-bottom: 2pt; }
.rs-preview .rs-name { font-size: 13px; }
.rs-h { font-weight: 700; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid #444; margin: 8pt 0 3pt; font-size: 10.5pt; }
.rs-preview .rs-h { font-size: 10px; }
.rs-job { font-weight: 700; margin-top: 5pt; }
.rs-li { padding-left: 12pt; text-indent: -8pt; }
.rs-p { margin: 1pt 0; }
#print { display: none; }
@media print {
  @page { size: letter; margin: 0; }
  body.printing > *:not(#print) { display: none !important; }
  body.printing #print { display: block; }
  body.printing::before { display: none; }
}

/* grids and form fields must be able to shrink on narrow phones (no horizontal scroll) */
.grid2 > *, .grid3 > *, .row > *, label.field { min-width: 0; }
.input { min-width: 0; max-width: 100%; }
input[type="month"].input, input[type="date"].input { -webkit-appearance: none; appearance: none; }
.seg { overflow: hidden; }
.seg button { min-width: 0; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .t, .li .d, .callout, .card p, .tile .d, .sheet p { overflow-wrap: anywhere; }
/* logs wrap on phones instead of scrolling sideways */
.stem .log, .log { white-space: pre-wrap; overflow-wrap: anywhere; overflow-x: hidden; font-size: .78rem; line-height: 1.5; }

/* ---------- ease-of-use layer: home header, Next up, quick actions, help, welcome tour ---------- */
.home-head { display: flex; align-items: center; gap: var(--s3); }
.track-pick { display: inline-flex; align-items: baseline; flex-wrap: wrap; column-gap: 6px; font-size: var(--t-xl); font-weight: 850; letter-spacing: -.01em; min-height: 44px; padding: 0; text-align: left; }
.track-pick .muted { font-size: var(--t-sm); font-weight: 650; white-space: nowrap; }
.track-pick svg { width: 18px; height: 18px; color: var(--muted); }
.help-btn { color: var(--cyan); }
.next-up h2 { font-size: var(--t-2xl); }
.next-up.is-done { border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.steps { list-style: none; padding: 0; margin: 0 0 var(--s4); display: grid; gap: 8px; }
.steps a { display: flex; align-items: center; gap: var(--s3); min-height: 52px; padding: 8px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font-weight: 650; font-size: var(--t-sm); }
.steps .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font: 800 var(--t-sm) var(--mono); flex: none; }
.steps .n svg { width: 16px; height: 16px; }
.steps li.done a { color: var(--muted); }
.steps li.done .n { background: var(--accent); color: var(--accent-ink); }
.steps li.cur a { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.steps li.cur .n { background: var(--accent-soft); color: var(--accent); }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s2); }
.q-act { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: var(--t-xs); font-weight: 700; text-align: center; min-height: 76px; transition: transform 120ms var(--ease); }
.q-act:active { transform: scale(.95); }
.q-act .ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.q-act .ico svg { width: 20px; height: 20px; }
.legend-box { margin-top: .6rem; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.legend-box summary { list-style: none; padding: 10px 14px; font-size: var(--t-sm); font-weight: 700; color: var(--cyan); cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 8px; }
.legend-box summary::-webkit-details-marker { display: none; }
.legend-box .legend { padding: 0 14px 12px; flex-direction: column; gap: 6px; }
.help-item { padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.help-item > b { display: block; margin-bottom: 2px; }
.welcome { display: flex; flex-direction: column; min-height: 100dvh; }
.welcome-art { display: grid; place-items: center; padding: 8vh 0 4vh; }
.welcome-ico { width: 120px; height: 120px; border-radius: 36px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--cyan)); color: var(--accent-ink); box-shadow: var(--glow); animation: hover 3s ease-in-out infinite; }
.welcome-ico svg { width: 60px; height: 60px; }
.dots { display: flex; justify-content: center; gap: 8px; margin: var(--s6) 0 auto; }
.dots i { width: 8px; height: 8px; border-radius: 4px; background: var(--surface-3); transition: width var(--dur), background var(--dur); }
.dots i.on { width: 24px; background: var(--accent); }
.welcome .dock { margin-top: auto; }

/* ---------- simplified layout ---------- */
.progress-card { display: grid; gap: 10px; }
.big-line { font-size: var(--t-lg); font-weight: 650; }
.big-line b { font-size: var(--t-2xl); font-weight: 900; }
.domain-row .ico { font-weight: 900; color: var(--text-2); background: var(--surface-2); }
.domain-row .ico.won { background: linear-gradient(135deg, var(--accent), var(--cyan)); color: var(--accent-ink); }
.ring.sm { width: 48px; height: 48px; } .ring.sm::before { inset: 5px; } .ring.sm b { font-size: var(--t-sm); }
.boss-mini { display: grid; gap: 12px; background: radial-gradient(90% 80% at 0% 0%, rgba(255,77,109,.12), transparent 70%), var(--surface); }
.boss-face.sm { width: 48px; height: 48px; border-radius: 14px; margin: 0; animation: none; }
.boss-face.sm svg { width: 28px; height: 28px; }
.step-row { display: flex; align-items: center; gap: var(--s3); min-height: 64px; padding: 10px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.step-row .grow { display: grid; }
.step-row .n { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font: 800 var(--t-md) var(--mono); flex: none; }
.step-row .n svg { width: 18px; height: 18px; }
.step-row.cur { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset, var(--glow); }
.step-row.cur .n { background: var(--accent); color: var(--accent-ink); }
.step-row.done .n { background: var(--accent-soft); color: var(--accent); }

/* ---------- iPhone polish ---------- */
html { touch-action: manipulation; }                 /* no double-tap zoom delay */
a, button, .opt, .token, .stage, .li, .tile { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.stem, .feedback, .sheet p, .body { -webkit-user-select: text; user-select: text; }
.input, select.input, textarea.input { font-size: max(16px, 1rem); }   /* iOS zooms into inputs under 16px */
.topbar, .home-head { padding-top: 2px; }
@supports (padding: max(0px)) { .screen { padding-left: max(var(--s4), env(safe-area-inset-left)); padding-right: max(var(--s4), env(safe-area-inset-right)); } }
@media (display-mode: standalone) { body { overscroll-behavior: none; } }
.acc summary .step-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font: 800 var(--t-xs) var(--mono); flex: none; }
.acc summary .grow { min-width: 0; }
.acc summary .chip { white-space: normal; text-align: right; max-width: 45%; }

/* ---------- flashcard flip: iPhone-safe ----------
   iOS Safari can ignore backface-visibility and show the back face mirrored through the front.
   Belt and braces: explicit 3D transforms on both faces, AND each face is hidden (opacity +
   visibility) during the half of the flip where it faces away, so nothing can leak or mirror. */
.fc { -webkit-transform-style: preserve-3d; transform-style: preserve-3d; }
.fc-face { -webkit-transform: rotateY(0deg) translateZ(1px); transform: rotateY(0deg) translateZ(1px); transition: opacity 0s linear 260ms, visibility 0s linear 260ms; }
.fc-face.back { -webkit-transform: rotateY(180deg) translateZ(1px); transform: rotateY(180deg) translateZ(1px); }
.fc:not(.flip) .fc-face.back { opacity: 0; visibility: hidden; }
.fc.flip .fc-face.front { opacity: 0; visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .fc-face { transition: none; } }

/* ---------- Home: XP strip, bank line, world map tiles ---------- */
.xp-strip { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.xp-strip .lv { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--cyan)); color: var(--accent-ink); font-weight: 900; flex: none; }
.xp-strip .grow { display: grid; gap: 5px; }
.bank-line { display: flex; align-items: center; gap: 8px; font-size: var(--t-sm); color: var(--text-2); padding: 2px 4px; min-height: 44px; }
.bank-line .chev { margin-left: auto; }
.world { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.world .zone-tile:first-child { grid-column: 1 / -1; }
.zone-tile { display: grid; gap: 6px; padding: 12px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); color: var(--text); box-shadow: var(--shadow); min-height: 150px; align-content: start; transition: transform 140ms var(--ease); }
.zone-tile:active { transform: scale(.97); }
.zone-tile.won { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: radial-gradient(120% 120% at 0% 0%, var(--accent-soft), transparent 70%), var(--surface); }
.zt-top { display: flex; justify-content: space-between; align-items: center; }
.zt-badge { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); font-weight: 900; }
.zone-tile.won .zt-badge { background: linear-gradient(135deg, var(--accent), var(--cyan)); color: var(--accent-ink); }
.zt-name { font-size: var(--t-md); }
.zt-sub { line-height: 1.3; }
/* video embed: black while loading (no white strip), fills the frame exactly */
.video { background: #000; line-height: 0; }
.video iframe { background: #000; color-scheme: normal; display: block; }

/* ---------- Exam date choice ("Not yet" is a full option) + ready-to-book ---------- */
.choice-q { font-weight: 700; margin-bottom: .1rem; }
.choice { display: flex; align-items: flex-start; gap: .7rem; width: 100%; text-align: left; padding: .8rem .9rem; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg2, transparent); color: inherit; font: inherit; cursor: pointer; min-height: 44px; }
.choice b { display: block; }
.choice .xs { display: block; margin-top: .15rem; }
.choice-dot { flex: none; width: 20px; height: 20px; margin-top: .1rem; border-radius: 50%; border: 2px solid var(--muted, #888); position: relative; }
.choice.on { border-color: var(--cyan); background: color-mix(in srgb, var(--cyan) 10%, transparent); }
.choice.on .choice-dot { border-color: var(--cyan); }
.choice.on .choice-dot::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--cyan); }
.date-field[hidden] { display: none; }
.ready-row .bar.thin { height: 6px; margin-top: .3rem; }
.ready-row svg { width: 14px; height: 14px; vertical-align: -2px; color: var(--good); }
.ready-head { margin: .6rem 0 .3rem; }
.exam-line { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .7rem; font-size: .85rem; color: inherit; }
.exam-line svg { width: 15px; height: 15px; vertical-align: -2px; }
.exam-line .chip { flex: none; }
.ready-card h3 { margin: 0; }

/* ---------- Exam versions: retirement notices, newer-version card, carryover ---------- */
.version-line { display: inline-block; margin-top: .15rem; text-decoration: none; }
.version-line.warn { color: var(--amber); font-weight: 600; }
.version-card { border-color: color-mix(in srgb, var(--cyan) 40%, var(--line)); }
.version-card.warn { border-color: var(--amber); background: color-mix(in srgb, var(--amber) 8%, var(--card, transparent)); }
.version-card.retired { border-color: var(--red); background: color-mix(in srgb, var(--red) 10%, var(--card, transparent)); }
.version-card.retired .card-title { color: var(--red); }
.version-card p { margin: 0; }
.big-num { font-size: 2.2rem; font-weight: 800; color: var(--cyan); min-width: 4.5rem; }
.carry-row { padding: .45rem 0; border-top: 1px solid var(--line); }
.carry-row:first-child { border-top: 0; }
.carry-row .bar { margin-top: .3rem; }

/* Move progress between devices */
.qrbox { display: grid; place-items: center; min-height: 240px; }
.qrbox.loading .qr { opacity: .2; }
.qr { width: min(80vw, 420px); height: auto; aspect-ratio: 1; border-radius: 12px; background: #fff; image-rendering: pixelated; }
.scanner { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; background: #000; }

/* Lessons (teach-first) */
.lesson-note { margin-bottom: 1rem; }
.lesson-note.again { margin-top: 1rem; border-color: var(--accent); }
.lesson-text { font-size: var(--t-lg, 1.1rem); line-height: 1.6; margin: 0; }
.idea { margin-top: .75rem; padding: .7rem .85rem; border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.idea p { margin: .3rem 0 0; line-height: 1.5; }

/* Exam picker inside the sheet: a vertical list (no sideways swiping — unreliable inside iOS sheets) */
.sheet .tracks { flex-direction: column; overflow: visible; margin: 0 0 var(--s4); padding: 0; }
.sheet .track-tab { width: 100%; justify-content: space-between; text-align: left; flex-wrap: wrap; padding: 10px 14px; }
.sheet .track-tab small { white-space: normal; }
.sheet .track-tab[data-planned] { opacity: .55; }
.step-tag { display: block; width: 100%; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.track-tab:not(.sheet .track-tab) .step-tag { display: none; }

/* Optional AI help */
.ai-x { margin-top: .75rem; }
.ai-card { padding: .7rem .85rem; border-radius: 12px; border: 1px dashed var(--line-2); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.ask-log { display: grid; gap: .6rem; max-height: 60dvh; overflow-y: auto; padding-right: 2px; }
.ask-msg { padding: .65rem .85rem; border-radius: 14px; max-width: 92%; line-height: 1.5; }
.ask-msg p { margin: 0; }
.ask-msg.me { justify-self: end; background: var(--accent-soft); }
.ask-msg.ai { justify-self: start; background: var(--surface); border: 1px solid var(--line); }
.ask-msg.err { justify-self: start; border: 1px solid var(--line); color: var(--mid); }
.ask-form { display: flex; gap: .5rem; }
.ask-form .input { flex: 1; }
.sync-line { display: block; margin-top: 2px; }
.sync-line.warn { color: var(--mid); }

/* Professor Bit: study companion (views/prof.js) */
.prof { position: fixed; right: max(12px, calc((100vw - 560px) / 2 + 12px)); bottom: calc(var(--safe-b) + 92px); z-index: 30; display: flex; align-items: flex-end; gap: .5rem; pointer-events: none; }
.prof.hidden { display: none; }
.prof-btn { pointer-events: auto; width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface-2); box-shadow: var(--shadow-lg); padding: 5px; cursor: pointer; transition: transform var(--dur) var(--spring); }
.prof-btn:active { transform: scale(.92); }
.prof-btn svg, .prof-face svg { width: 100%; height: 100%; display: block; }
.prof-face { width: 44px; height: 44px; flex: none; }
.prof-bubble { pointer-events: auto; max-width: min(260px, 70vw); background: var(--surface-3); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--r-md) var(--r-md) 4px var(--r-md); padding: .55rem .75rem; font-size: var(--t-sm); line-height: 1.35; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(6px) scale(.97); transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); cursor: pointer; }
.prof-bubble:not(.on) { visibility: hidden; }
.prof-bubble.on { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .prof-bubble, .prof-btn { transition: none; } }
