/* Layout: the pixel room fills the screen; one floating "desk" panel sits on the left; dock bottom-right.
   During a lesson the room fades back so the avatar idles faintly beside the question. */
:root {
  --night: #120d20;
  --panel: #1b1430;
  --panel-2: #261d40;
  --line: #3e3266;
  --edge: #0a0714;
  --text: #f5ecd9;
  --muted: #ab9fc8;
  --gold: #ffc94a;
  --gold-d: #c4851a;
  --mint: #62e39a;
  --mint-d: #23935a;
  --rose: #ff6b7f;
  --rose-d: #b23450;
  --sky: #86cbff;
  --f-pixel: "Press Start 2P", ui-monospace, monospace;
  --f-ui: "Tiny5", system-ui, sans-serif;
  --f-read: "Source Serif 4", Georgia, "Times New Roman", serif;
  --gut-l: max(16px, env(safe-area-inset-left, 0px));
  --gut-r: max(16px, env(safe-area-inset-right, 0px));
  --pix: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--night); color: var(--text); font-family: var(--f-ui); font-size: 17px; overflow: hidden; -webkit-font-smoothing: antialiased; font-variant-ligatures: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }
.pix { image-rendering: pixelated; image-rendering: crisp-edges; display: block; }

/* ---------- room ---------- */
#room { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 78% 70%; image-rendering: pixelated; transition: opacity .7s ease, filter .7s ease; }
body.in-lesson #room { opacity: .38; filter: saturate(.8) brightness(.85); }

/* ---------- shell ---------- */
#app { position: fixed; inset: 0; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px var(--gut-r) 10px var(--gut-l); }
.brand { font-family: var(--f-pixel); font-size: 13px; letter-spacing: .06em; color: var(--text); text-shadow: 2px 2px 0 var(--edge); }
.brand span { color: var(--gold); margin-left: .5em; }
.hud { display: flex; align-items: center; gap: 10px; }
.hud-item, .hud-level { display: flex; align-items: center; gap: 8px; background: var(--panel); box-shadow: var(--pix); padding: 6px 10px; font-family: var(--f-pixel); font-size: 11px; font-variant-numeric: tabular-nums; }
.hud-level b { color: var(--gold); }
.lv-bar { width: 72px; height: 8px; background: var(--edge); }
.lv-bar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .6s steps(12); }

#stage { flex: 1; min-height: 0; display: flex; align-items: flex-start; padding: 8px var(--gut-r) 84px var(--gut-l); }

/* ---------- panels ---------- */
.panel { width: min(560px, 100%); max-height: 100%; overflow: auto; background: color-mix(in srgb, var(--panel) 94%, transparent); box-shadow: var(--pix), 8px 8px 0 3px rgba(10, 7, 20, .45); padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.eyebrow { margin: 0; font-family: var(--f-pixel); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
h1 { margin: 0; font-family: var(--f-ui); font-weight: 600; font-size: 30px; line-height: 1.15; text-wrap: balance; }
.label { margin: 0; font-family: var(--f-pixel); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.sub { margin: -8px 0 0; color: var(--muted); font-size: 15px; }
.num { font-family: var(--f-pixel); font-size: 10px; font-variant-numeric: tabular-nums; }

.goal { display: flex; flex-direction: column; gap: 8px; }
.goal .row { display: flex; justify-content: space-between; align-items: center; }
.bar { height: 14px; background: var(--edge); box-shadow: inset 0 0 0 2px var(--line); padding: 3px; }
.bar i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--gold) 0 10px, #ffd977 10px 12px); transition: width .9s steps(16); }
.goal.done .bar i { background: repeating-linear-gradient(90deg, var(--mint) 0 10px, #8af0b6 10px 12px); }

/* ---------- buttons ---------- */
.btn { border: 0; font-family: var(--f-pixel); font-size: 12px; letter-spacing: .06em; padding: 16px 22px 19px; box-shadow: var(--pix), inset 0 -5px 0 0 rgba(0,0,0,.28); transition: transform .06s; }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: var(--pix), inset 0 -2px 0 0 rgba(0,0,0,.28); }
.btn:disabled { background: var(--panel-2) !important; color: var(--muted) !important; cursor: not-allowed; }
.btn-big { font-size: 15px; padding: 22px; }
.btn-gold { background: var(--gold); color: #2b1a04; }
.btn-gold:hover:not(:disabled) { background: #ffd56e; }
.btn-mint { background: var(--mint); color: #0d2a19; }
.btn-rose { background: var(--rose); color: #2d0710; }
.btn-ghost { background: var(--panel-2); color: var(--text); }
.btn-ghost:hover { background: var(--line); }
.btn-small { font-size: 9px; padding: 8px 10px 10px; background: var(--gold); color: #2b1a04; }
.icon-btn { background: transparent; border: 0; color: var(--muted); font-size: 18px; padding: 4px 8px; }
.icon-btn:hover { color: var(--text); }

/* ---------- home ---------- */
.skills { display: flex; flex-direction: column; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--panel-2); border: 0; box-shadow: inset 0 0 0 2px var(--line); padding: 7px 10px; font-size: 14px; display: inline-flex; gap: 8px; align-items: baseline; }
.chip em { font-style: normal; font-family: var(--f-pixel); font-size: 8px; color: var(--mint); }
.chip:hover { box-shadow: inset 0 0 0 2px var(--muted); }
.chip.on { background: var(--gold); color: #2b1a04; box-shadow: none; }
.chip.on em { color: #5a3b05; }
.next-unlock { display: flex; gap: 14px; align-items: center; padding: 12px; background: var(--panel-2); box-shadow: inset 0 0 0 2px var(--line); }
.next-unlock .nu-art { flex: none; display: grid; place-items: center; min-width: 64px; }
.nu-name { margin: 4px 0 2px; font-size: 18px; font-weight: 600; }
.nu-name span { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.nu-need { margin: 0; font-size: 14px; color: var(--gold); }

/* ---------- lesson ---------- */
.panel.lesson { width: min(720px, 100%); height: 100%; padding: 0; gap: 0; overflow: hidden; }
.lesson-top { display: flex; align-items: center; gap: 12px; padding: 16px 20px 8px; }
.progress { flex: 1; display: flex; gap: 6px; }
.progress i { flex: 1; height: 12px; background: var(--edge); box-shadow: inset 0 0 0 2px var(--line); }
.progress i.done { background: var(--gold); box-shadow: none; }
.progress i.now { box-shadow: inset 0 0 0 2px var(--gold); }
.combo { font-family: var(--f-pixel); font-size: 9px; color: #2b1a04; background: var(--gold); padding: 6px 8px; animation: pop .35s steps(4); }
@keyframes pop { 0% { transform: scale(.6); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
.q-scroll { flex: 1; min-height: 0; overflow: auto; padding: 8px 24px 20px; display: flex; flex-direction: column; gap: 16px; }
.q-meta { display: flex; align-items: center; gap: 12px; }
.q-type { font-family: var(--f-pixel); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--sky); background: rgba(134, 203, 255, .12); padding: 6px 8px; }
.q-diff { color: var(--gold); font-size: 11px; letter-spacing: 2px; }
.stimulus { margin: 0; font-family: var(--f-read); font-size: 17.5px; line-height: 1.62; white-space: pre-line; max-width: 64ch; }
.stem { margin: 0; font-family: var(--f-read); font-weight: 600; font-size: 17px; line-height: 1.5; max-width: 64ch; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice { display: flex; gap: 12px; align-items: flex-start; text-align: left; background: var(--panel-2); border: 0; box-shadow: inset 0 0 0 2px var(--line); padding: 12px 14px; font-family: var(--f-read); font-size: 16px; line-height: 1.45; transition: transform .06s; }
.choice:hover:not(:disabled) { box-shadow: inset 0 0 0 2px var(--muted); }
.choice .key { flex: none; font-family: var(--f-pixel); font-size: 10px; width: 26px; height: 26px; display: grid; place-items: center; background: var(--edge); color: var(--muted); margin-top: 1px; }
.choice.sel { box-shadow: inset 0 0 0 3px var(--gold); background: #33284a; }
.choice.sel .key { background: var(--gold); color: #2b1a04; }
.choice.right { box-shadow: inset 0 0 0 3px var(--mint); background: #183a2a; }
.choice.right .key { background: var(--mint); color: #0d2a19; }
.choice.wrong { box-shadow: inset 0 0 0 3px var(--rose); background: #3d1826; animation: shake .3s steps(6); }
.choice.wrong .key { background: var(--rose); color: #2d0710; }
.choice:disabled { cursor: default; }
.choice:disabled:not(.right):not(.wrong) { opacity: .55; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.keys-hint { margin: 0; color: var(--muted); font-size: 13px; }
.lesson-foot { padding: 14px 24px 18px; display: flex; flex-direction: column; gap: 12px; background: var(--panel); box-shadow: 0 -3px 0 0 var(--line); }
.lesson-foot .btn { align-self: stretch; }
.lesson-foot.ok { background: #143323; box-shadow: 0 -3px 0 0 var(--mint-d); }
.lesson-foot.bad { background: #36121f; box-shadow: 0 -3px 0 0 var(--rose-d); }
.fb { display: flex; flex-direction: column; gap: 8px; max-height: 36vh; overflow: auto; animation: rise .25s steps(5); }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.fb-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
#fb-title { font-size: 22px; font-weight: 700; }
.ok #fb-title { color: var(--mint); }
.bad #fb-title { color: var(--rose); }
#fb-xp { font-family: var(--f-pixel); font-size: 10px; color: var(--gold); }
.fb p { margin: 0; font-family: var(--f-read); font-size: 15.5px; line-height: 1.55; max-width: 66ch; }
.fb-why { color: #ffd0d7; }

/* ---------- results ---------- */
.results { text-align: left; }
.xp-burst { display: flex; align-items: center; gap: 14px; font-family: var(--f-pixel); }
#r-xp { font-size: 40px; color: var(--gold); text-shadow: 4px 4px 0 var(--edge); font-variant-numeric: tabular-nums; }
.xp-burst .unit { font-size: 14px; color: var(--muted); align-self: flex-end; padding-bottom: 6px; }
.r-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.r-stats div { background: var(--panel-2); box-shadow: inset 0 0 0 2px var(--line); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.r-stats b { font-family: var(--f-pixel); font-size: 14px; font-variant-numeric: tabular-nums; }
.r-stats span { font-size: 13px; color: var(--muted); }
.streak-line { margin: 0; display: flex; gap: 10px; align-items: center; color: var(--muted); }
.unlocks { display: flex; flex-direction: column; gap: 10px; }
.unlocks:empty { display: none; }
.levelup { font-family: var(--f-pixel); font-size: 14px; color: #2b1a04; background: var(--gold); padding: 14px; text-align: center; animation: pop .4s steps(4); }
.unlock-card { display: flex; gap: 16px; align-items: center; padding: 12px; background: var(--panel-2); box-shadow: inset 0 0 0 2px var(--gold); animation: rise .3s steps(5); }
.unlock-card .nu-name { margin-bottom: 8px; }
.r-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.r-actions .btn { flex: 1 1 180px; }

/* ---------- dock & drawer ---------- */
.dock { position: fixed; right: calc(var(--gut-r) + 3px); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 10px; }
.dock button { background: var(--panel); border: 0; box-shadow: var(--pix); font-family: var(--f-pixel); font-size: 10px; padding: 12px 14px; }
.dock button:hover, .dock button.on { background: var(--gold); color: #2b1a04; }
body.in-lesson .dock button:not([data-drawer="sound"]) { display: none; }
.drawer { position: fixed; top: calc(62px + env(safe-area-inset-top, 0px)); right: calc(var(--gut-r) + 3px); bottom: calc(76px + env(safe-area-inset-bottom, 0px)); width: min(380px, calc(100% - 38px)); background: var(--panel); box-shadow: var(--pix), 8px 8px 0 3px rgba(10, 7, 20, .45); display: flex; flex-direction: column; z-index: 5; animation: rise .2s steps(4); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; }
.drawer-head h2 { margin: 0; font-family: var(--f-pixel); font-size: 12px; color: var(--gold); }
#drawer-body { flex: 1; overflow: auto; padding: 8px 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.av-preview { display: grid; place-items: center; padding: 14px; background: var(--panel-2); box-shadow: inset 0 0 0 2px var(--line); }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab { background: transparent; border: 0; box-shadow: inset 0 0 0 2px var(--line); padding: 6px 9px; font-size: 14px; }
.tab.on { background: var(--sky); color: #0b1d33; box-shadow: none; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.item { position: relative; background: var(--panel-2); border: 0; box-shadow: inset 0 0 0 2px var(--line); padding: 10px 6px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.item:hover:not(.locked) { box-shadow: inset 0 0 0 2px var(--muted); }
.item.on { box-shadow: inset 0 0 0 3px var(--gold); }
.item .cap { font-size: 13px; line-height: 1.2; text-align: center; }
.item.locked > canvas, .item.locked .sw { opacity: .3; filter: grayscale(1); }
.item.locked .cap { font-family: var(--f-pixel); font-size: 8px; color: var(--muted); }
.item .lk { position: absolute; top: 6px; right: 6px; }
.sw { width: 34px; height: 34px; box-shadow: 0 0 0 2px var(--edge); }
.rooms { display: flex; flex-direction: column; gap: 10px; }
.room-card { position: relative; border: 0; padding: 0; background: var(--edge); box-shadow: inset 0 0 0 2px var(--line); display: block; text-align: left; }
.room-card canvas { width: 100%; height: auto; }
.room-card .cap { position: absolute; left: 8px; bottom: 8px; background: var(--panel); padding: 5px 8px; font-size: 14px; }
.room-card.on { box-shadow: 0 0 0 3px var(--gold); }
.room-card.locked canvas { filter: grayscale(1) brightness(.45); }
.room-card.locked .cap { font-family: var(--f-pixel); font-size: 9px; color: var(--muted); }
.tracks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.track { background: var(--panel-2); border: 0; box-shadow: inset 0 0 0 2px var(--line); padding: 10px; font-size: 15px; text-align: left; }
.track.on { background: var(--gold); color: #2b1a04; box-shadow: none; }
.slider { display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.slider input { -webkit-appearance: none; appearance: none; width: 100%; height: 14px; background: linear-gradient(90deg, var(--sky) var(--p, 0%), var(--edge) var(--p, 0%)); box-shadow: inset 0 0 0 2px var(--line); }
.slider input::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 22px; background: var(--text); box-shadow: 0 0 0 2px var(--edge); cursor: pointer; }
.slider input::-moz-range-thumb { width: 14px; height: 22px; background: var(--text); border: 0; border-radius: 0; box-shadow: 0 0 0 2px var(--edge); cursor: pointer; }
.toggle { display: flex; gap: 10px; align-items: center; font-size: 15px; }
.toggle input { width: 18px; height: 18px; accent-color: var(--gold); }
.hint { margin: 0; color: var(--muted); font-size: 14px; }

#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); background: var(--gold); color: #2b1a04; font-family: var(--f-pixel); font-size: 10px; padding: 12px 16px; box-shadow: var(--pix); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s steps(3); z-index: 10; max-width: calc(100% - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- phones: room becomes a strip under the top bar ---------- */
@media (max-width: 760px) {
  #room { inset: auto 0 auto 0; top: calc(52px + env(safe-area-inset-top, 0px)); height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
  #stage { padding-top: calc(100vw * 9 / 16 - 8px); padding-bottom: 76px; }
  body.in-lesson #stage { padding-top: calc(100vw * 9 / 16 * .72); }
  body.in-lesson #room { opacity: .5; }
  .brand { font-size: 10px; }
  .brand span { margin-left: .3em; }
  .hud { gap: 7px; }
  .hud-item, .hud-level { padding: 5px 7px; font-size: 9px; gap: 6px; }
  .lv-bar { width: 40px; }
  .panel { padding: 18px; }
  h1 { font-size: 24px; }
  .q-scroll { padding: 6px 16px 16px; }
  .lesson-foot { padding: 12px 16px 14px; }
  .stimulus { font-size: 16.5px; }
  .dock { left: calc(var(--gut-l) + 3px); right: calc(var(--gut-r) + 3px); }
  .dock button { flex: 1; }
  .drawer { top: calc(52px + env(safe-area-inset-top, 0px)); width: auto; left: calc(var(--gut-l) + 3px); }
}
@media (max-width: 420px) { .hud-level { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* =====================================================================
   v2: tabs, modes, rewards, modals, bosses, exam, stats, settings
   ===================================================================== */
:root { --common: #b9b2cf; --rare: #6fb6ff; --epic: #c58cff; --legendary: #ffc94a; }
.hud-item { border: 0; color: var(--text); }
button.hud-item { cursor: pointer; }
.r-stats { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.panel.home { gap: 0; padding: 0; }
.ptabs { display: flex; gap: 2px; padding: 10px 10px 0; background: var(--edge); position: sticky; top: 0; z-index: 2; overflow-x: auto; }
.ptabs button { flex: 1; background: transparent; border: 0; padding: 10px 8px 9px; font-family: var(--f-pixel); font-size: 9px; color: var(--muted); position: relative; white-space: nowrap; }
.ptabs button.on { background: color-mix(in srgb, var(--panel) 94%, transparent); color: var(--gold); }
.ptabs .dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; background: var(--rose); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }
.tab-body { padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 16px; }
.badge-fresh { background: rgba(98, 227, 154, .12); box-shadow: inset 0 0 0 2px var(--mint-d); padding: 10px 12px; font-size: 15px; }
.badge-fresh b:first-child { font-family: var(--f-pixel); font-size: 9px; color: var(--mint); margin-right: 8px; }
.badge-fresh.gold { background: rgba(255, 201, 74, .12); box-shadow: inset 0 0 0 2px var(--gold-d); }
.badge-fresh.gold b:first-child { color: var(--gold); }
.chip .medal, .trow .medal { display: inline-block; width: 8px; height: 8px; box-shadow: 0 0 0 1px var(--edge); margin-right: 2px; }

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-card { text-align: left; background: var(--panel-2); border: 0; box-shadow: inset 0 0 0 2px var(--line); padding: 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mode-card b { font-family: var(--f-pixel); font-size: 9px; line-height: 1.5; }
.mode-card span { font-size: 14px; color: var(--muted); line-height: 1.3; }
.mode-card:hover:not(.locked) { box-shadow: inset 0 0 0 2px var(--muted); }
.mode-card.hot { box-shadow: inset 0 0 0 2px var(--gold); }
.mode-card.m-nemesis.hot { box-shadow: inset 0 0 0 2px var(--rose); background: #321a33; }
.mode-card.locked { opacity: .55; }
.boss-teaser, .next-unlock, .daily-chest, .streak-card { display: flex; gap: 14px; align-items: center; padding: 12px; background: var(--panel-2); box-shadow: inset 0 0 0 2px var(--line); }
.boss-teaser { background: #2a1830; box-shadow: inset 0 0 0 2px #5a2a4a; }
.boss-teaser canvas { flex: none; }
.streak-card { flex-direction: column; align-items: stretch; gap: 8px; }
.week { display: flex; gap: 6px; }
.week span { flex: 1; text-align: center; padding: 8px 0; background: var(--edge); font-family: var(--f-pixel); font-size: 8px; color: var(--muted); }
.week span.on { background: #ff7a2f; color: #2b1004; }

.quests { display: flex; flex-direction: column; gap: 8px; }
.quest { display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--panel-2); box-shadow: inset 0 0 0 2px var(--line); }
.quest.done { box-shadow: inset 0 0 0 2px var(--mint-d); }
.quest .q-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.quest p { margin: 0; font-size: 16px; }
.q-rew { font-family: var(--f-pixel); font-size: 9px; color: var(--gold); }
.quest.done .q-rew { color: var(--mint); }
.bar.thin { height: 10px; padding: 2px; }

.bestiary { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.beast { background: var(--panel-2); box-shadow: inset 0 0 0 2px var(--line); padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.beast canvas { width: 80px !important; height: auto !important; }
.beast p { margin: 0; font-size: 13px; text-align: center; }
.beast.beaten { box-shadow: inset 0 0 0 2px var(--gold); }
.beast.unknown p { color: var(--muted); }
.achs { display: flex; flex-direction: column; gap: 6px; }
.ach { display: flex; gap: 10px; align-items: center; padding: 8px 10px; background: var(--panel-2); opacity: .55; }
.ach.got { opacity: 1; box-shadow: inset 0 0 0 2px var(--gold-d); }
.ach div { flex: 1; display: flex; flex-direction: column; }
.ach span { font-size: 13px; color: var(--muted); }
.ach em { font-style: normal; font-family: var(--f-pixel); font-size: 9px; color: var(--gold); }

.coins-h { color: var(--gold); }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.shop-card { background: var(--panel-2); border: 0; box-shadow: inset 0 0 0 2px var(--line); padding: 12px 8px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.shop-card .cap { font-size: 14px; text-align: center; line-height: 1.2; }
.shop-card .price { font-family: var(--f-pixel); font-size: 8px; color: var(--gold); }
.shop-card.owned .price { color: var(--mint); }
.shop-card:hover { box-shadow: inset 0 0 0 2px var(--muted); }
.r-rare { box-shadow: inset 0 0 0 2px var(--rare) !important; }
.r-epic { box-shadow: inset 0 0 0 2px var(--epic) !important; }
.r-legendary { box-shadow: inset 0 0 0 2px var(--legendary), 0 0 14px rgba(255, 201, 74, .35) !important; }
.item.on { box-shadow: inset 0 0 0 3px var(--gold) !important; }
.item .sw { margin-top: 4px; }

/* modal + rewards */
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(8, 5, 18, .72); display: grid; place-items: center; padding: 16px; animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; } }
.modal-card { width: min(440px, 100%); max-height: calc(100% - 32px); overflow: auto; background: var(--panel); box-shadow: var(--pix), 8px 8px 0 3px rgba(10, 7, 20, .5); padding: 24px; display: flex; flex-direction: column; gap: 14px; align-items: center; text-align: center; animation: pop .3s steps(4); }
.modal-card h2 { margin: 0; font-family: var(--f-pixel); font-size: 14px; }
.chest-stage { cursor: pointer; padding: 10px; }
.chest-stage.shake { animation: shake .3s steps(6); }
.chest-modal.r-legendary .chest-stage { filter: drop-shadow(0 0 18px rgba(255, 201, 74, .7)); }
.chest-modal.r-epic .chest-stage { filter: drop-shadow(0 0 14px rgba(197, 140, 255, .6)); }
.loot { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.loot-row { display: flex; gap: 10px; align-items: center; justify-content: center; font-family: var(--f-pixel); font-size: 12px; color: var(--gold); animation: rise .3s steps(5); }
.loot-item { display: flex; gap: 14px; align-items: center; text-align: left; padding: 12px; background: var(--panel-2); animation: rise .35s steps(5); }
.loot-item .nu-name { margin-bottom: 6px; }
.lv-big { font-family: var(--f-pixel); font-size: 40px; color: var(--gold); text-shadow: 4px 4px 0 var(--edge); animation: pop .5s steps(5); }

/* toasts, floating text, confetti */
#toasts { position: fixed; top: calc(64px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 30; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100% - 32px)); pointer-events: none; }
.toast { display: flex; gap: 12px; align-items: center; background: var(--panel); box-shadow: var(--pix), 0 6px 0 3px rgba(10, 7, 20, .4); padding: 10px 14px; animation: drop .3s steps(4); transition: opacity .4s, transform .4s; }
.toast b { display: block; font-family: var(--f-pixel); font-size: 9px; line-height: 1.5; color: var(--gold); }
.toast span { font-size: 14px; color: var(--text); }
.toast.quest b { color: var(--mint); } .toast.ach b { color: #ffd977; } .toast.rank b { color: var(--sky); }
.toast.out { opacity: 0; transform: translateY(-10px); }
@keyframes drop { from { transform: translateY(-16px); opacity: 0; } }
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
.float { position: fixed; transform: translate(-50%, 0); font-family: var(--f-pixel); font-size: 12px; color: var(--gold); text-shadow: 2px 2px 0 var(--edge); animation: floatUp 1.2s ease-out forwards; white-space: nowrap; }
.float.lucky { color: #ff8fb1; font-size: 14px; } .float.coin { color: #ffd977; } .float.bad { color: var(--rose); } .float.dmg { color: #fff; font-size: 16px; }
@keyframes floatUp { to { transform: translate(-50%, -70px); opacity: 0; } }
.confetti { position: fixed; width: 6px; height: 6px; animation: conf 1s ease-out forwards; }
@keyframes conf { to { transform: translate(var(--dx), var(--dy)) rotate(180deg); opacity: 0; } }

/* lesson extras */
.combo { display: flex; gap: 6px; align-items: baseline; background: var(--panel-2); color: var(--text); padding: 6px 8px; }
.combo b { font-family: var(--f-pixel); font-size: 11px; }
.combo span { font-family: var(--f-pixel); font-size: 7px; color: var(--muted); }
.combo em { font-style: normal; font-family: var(--f-pixel); font-size: 7px; color: var(--gold); }
.combo.hot { background: #3a2a10; } .combo.hot span { color: var(--gold); }
.combo.fire { background: #ff7a2f; animation: pop .35s steps(4), glow 1s steps(2) infinite; } .combo.fire span, .combo.fire em, .combo.fire b { color: #2b1004; }
@keyframes glow { 50% { box-shadow: 0 0 12px #ff7a2f; } }
.progress i.done.ok { background: var(--mint); } .progress i.done.bad { background: var(--rose); }
.sprint-t { font-family: var(--f-pixel); font-size: 14px; color: var(--gold); }
.sprint-s { font-family: var(--f-pixel); font-size: 10px; margin-left: auto; }
.progress:has(.sprint-t) { align-items: center; }
.round-timer { height: 6px; margin: 0 20px; background: var(--edge); }
.round-timer i { display: block; height: 100%; width: 100%; background: var(--sky); transition: width .1s linear; }
.round-timer i.low, .timer i.low { background: var(--rose); }
.mode-tag { font-family: var(--f-pixel); font-size: 8px; padding: 6px 8px; background: var(--gold); color: #2b1a04; }
.mode-tag.m-redeem { background: var(--mint); color: #0d2a19; }
.mode-tag.m-cond, .mode-tag.m-flaw { background: #c58cff; color: #1e0b33; }
.mode-tag.m-match { background: var(--sky); color: #0b1d33; }
.mode-tag.m-elim { background: var(--rose); color: #2d0710; }
.ask-big { margin: 0; font-size: 20px; font-weight: 600; }
.stimulus.big { font-size: 19px; }
.fact { margin: 0; font-family: var(--f-read); font-size: 17px; padding: 10px 12px; background: rgba(134, 203, 255, .1); box-shadow: inset 3px 0 0 var(--sky); }
.stem.quote { font-size: 19px; padding: 14px; background: var(--panel-2); box-shadow: inset 0 0 0 2px var(--line); }
.sentences { line-height: 1.9; }
.sent { display: inline; font: inherit; color: inherit; text-align: left; background: transparent; border: 0; padding: 2px 3px; box-shadow: inset 0 -2px 0 var(--line); }
.sent:hover:not(:disabled) { background: rgba(255, 201, 74, .12); }
.sent.sel { background: rgba(255, 201, 74, .25); box-shadow: inset 0 -2px 0 var(--gold); }
.sent.right { background: rgba(98, 227, 154, .25); box-shadow: inset 0 -2px 0 var(--mint); }
.sent.wrong { background: rgba(255, 107, 127, .25); box-shadow: inset 0 -2px 0 var(--rose); }
.choice.struck { opacity: .55; }
.choice.struck .txt { text-decoration: line-through; text-decoration-color: var(--rose); }
.why-mini { margin: 6px 0 0; font-size: 13.5px; color: #ffc0ca; text-decoration: none; display: block; }
.match-timer { margin: 0; font-family: var(--f-pixel); font-size: 12px; color: var(--gold); }
.match-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.tile { min-height: 64px; background: var(--panel-2); border: 0; box-shadow: inset 0 0 0 2px var(--line); padding: 10px; font-size: 15px; line-height: 1.25; transition: opacity .25s, transform .25s; }
.tile.a { font-weight: 600; }
.tile:hover { box-shadow: inset 0 0 0 2px var(--muted); }
.tile.sel { box-shadow: inset 0 0 0 3px var(--gold); background: #33284a; }
.tile.bad { box-shadow: inset 0 0 0 3px var(--rose); animation: shake .3s steps(6); }
.tile.gone { opacity: 0; transform: scale(.85); pointer-events: none; }
.reframe { background: rgba(98, 227, 154, .08); box-shadow: inset 0 0 0 2px var(--mint-d); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.reframe-h { margin: 0; font-size: 19px; font-weight: 600; color: var(--mint); }
.reframe-t { margin: 0; font-family: var(--f-read); font-size: 16.5px; line-height: 1.6; }
.fb-why.compare { color: #c8f5da; }
.fb-tag { color: var(--muted); }
.lucky { font-family: var(--f-pixel); font-size: 8px; background: #ff8fb1; color: #3a0a1a; padding: 3px 5px; margin-left: 6px; }

/* results */
.breakdown { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.breakdown li { display: flex; justify-content: space-between; padding: 6px 10px; background: var(--panel-2); font-size: 15px; animation: rise .3s steps(5) both; }
.breakdown li:nth-child(2) { animation-delay: .15s; } .breakdown li:nth-child(3) { animation-delay: .3s; } .breakdown li:nth-child(4) { animation-delay: .45s; }
.breakdown b { font-family: var(--f-pixel); font-size: 10px; color: var(--gold); }
.breakdown .fresh { box-shadow: inset 0 0 0 2px var(--mint-d); } .breakdown .hl { box-shadow: inset 0 0 0 2px var(--gold-d); }
.boss-gate { display: flex; gap: 14px; align-items: center; padding: 12px; background: var(--panel-2); box-shadow: inset 0 0 0 2px var(--line); opacity: .75; }
.boss-gate.open { opacity: 1; background: #2a1830; box-shadow: inset 0 0 0 2px var(--rose); animation: pop .4s steps(4); }
.boss-gate .btn { margin-top: 8px; }
.hint.break { color: var(--sky); }

/* boss fight */
.panel.boss { width: min(640px, 100%); }
body.in-boss #room { opacity: .3; filter: saturate(.6) brightness(.7); }
body.in-boss .dock button:not([data-drawer="sound"]) { display: none; }
.boss-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hearts { display: flex; gap: 4px; }
.boss-name { font-family: var(--f-pixel); font-size: 11px; color: var(--rose); text-align: right; }
.hp { position: relative; height: 18px; background: var(--edge); box-shadow: inset 0 0 0 2px #5a2a4a; padding: 3px; }
.hp i { display: block; height: 100%; background: var(--rose); transition: width .4s steps(6); }
.hp span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-pixel); font-size: 8px; }
.arena { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 0; }
.arena canvas { width: 240px; height: 160px; }
.arena.shake { animation: shake .3s steps(6); }
.taunt { margin: 0; font-style: italic; color: var(--muted); font-size: 15px; }
.timer { height: 8px; background: var(--edge); }
.timer i { display: block; height: 100%; width: 100%; background: var(--gold); }
.boss-q { display: flex; flex-direction: column; gap: 12px; }
.boss-note { margin: 0; font-family: var(--f-read); font-size: 15px; color: #ffd0d7; }
body.hurt::after { content: ""; position: fixed; inset: 0; background: rgba(255, 60, 90, .25); pointer-events: none; animation: hurt .4s forwards; z-index: 15; }
@keyframes hurt { to { opacity: 0; } }

/* practice section */
body.in-exam #room { opacity: .18; }
body.in-exam .dock { display: none; }
.exam .ex-top { display: flex; align-items: center; gap: 12px; padding: 14px 20px 6px; }
.ex-time { margin-left: auto; font-family: var(--f-pixel); font-size: 14px; color: var(--gold); font-variant-numeric: tabular-nums; }
.ex-time.low { color: var(--rose); }
.palette { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 20px 8px; }
.pal { width: 28px; height: 26px; border: 0; background: var(--edge); color: var(--muted); font-family: var(--f-pixel); font-size: 8px; }
.pal.ans { background: var(--line); color: var(--text); }
.pal.flag { box-shadow: inset 0 -3px 0 var(--rose); }
.pal.now { box-shadow: inset 0 0 0 2px var(--gold); color: var(--gold); }
.ex-nav { display: flex; gap: 8px; padding: 12px 20px 16px; background: var(--panel); box-shadow: 0 -3px 0 0 var(--line); }
.ex-nav .btn:last-child { margin-left: auto; }
.type-table { display: flex; flex-direction: column; gap: 6px; }
.trow { display: grid; grid-template-columns: minmax(0, 1.4fr) 1fr 44px 34px; gap: 10px; align-items: center; font-size: 14px; }
.trow b { font-family: var(--f-pixel); font-size: 9px; text-align: right; }
.trow em { font-style: normal; font-size: 12px; color: var(--muted); }
.trow.weak span { color: var(--rose); }
.trow.weak span::after { content: " · focus here"; font-size: 12px; }
.ex-review { display: flex; flex-direction: column; gap: 6px; }
.rv { background: var(--panel-2); padding: 10px 12px; }
.rv summary { cursor: pointer; font-size: 14px; }
.rv.ok summary b { color: var(--mint); } .rv.bad summary b { color: var(--rose); }
.rv .stimulus, .rv .stem { font-size: 15px; margin-top: 10px; }
.rv-choice { margin: 4px 0; font-family: var(--f-read); font-size: 14.5px; }
.rv-choice.right { color: var(--mint); } .rv-choice.wrong { color: var(--rose); text-decoration: line-through; }
.rv .fb-exp { margin-top: 10px; font-family: var(--f-read); font-size: 14.5px; color: var(--muted); }

/* stats */
.r-stats.four { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.spark { display: flex; gap: 6px; height: 90px; align-items: flex-end; }
.sp-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.sp-col i { display: block; width: 100%; min-height: 2px; background: var(--sky); }
.sp-col span { font-family: var(--f-pixel); font-size: 7px; color: var(--muted); }
.mlog { display: flex; flex-direction: column; gap: 6px; }
.mrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; background: var(--panel-2); font-size: 14px; }
.mrow .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.mrow em { font-style: normal; font-size: 12px; color: var(--gold); }

/* HUD extras */
.pomo { display: flex; align-items: center; gap: 8px; background: var(--panel); box-shadow: var(--pix); padding: 4px 6px 4px 10px; font-family: var(--f-pixel); font-size: 8px; }
.pomo b { font-size: 11px; font-variant-numeric: tabular-nums; }
.pomo.break { background: #173a2a; } .pomo.break span { color: var(--mint); }
.pomo.focus span { color: var(--sky); }
.pomo button { border: 0; background: var(--gold); color: #2b1a04; width: 24px; height: 22px; font-size: 10px; }
.event-chip { font-family: var(--f-pixel); font-size: 8px; background: var(--gold); color: #2b1a04; padding: 8px 10px; box-shadow: var(--pix); animation: glow 1.2s steps(2) infinite; }

/* settings + sound drawer */
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; }
.seg-btn { text-align: left; background: var(--panel-2); border: 0; box-shadow: inset 0 0 0 2px var(--line); padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.seg-btn b { font-size: 15px; }
.seg-btn span { font-size: 12.5px; color: var(--muted); line-height: 1.25; }
.seg-btn.on { box-shadow: inset 0 0 0 3px var(--gold); background: #33284a; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.preset { background: var(--panel-2); border: 0; box-shadow: inset 0 0 0 2px var(--line); padding: 8px 10px; font-size: 14px; }
.preset:hover { box-shadow: inset 0 0 0 2px var(--sky); }
.track { display: flex; flex-direction: column; gap: 2px; }
.track b { font-size: 15px; font-weight: 600; }
.track span { font-size: 12px; opacity: .75; }
.av-preview { gap: 10px; }
.decor-grid .item canvas { max-width: 100%; height: auto !important; }

@media (max-width: 760px) {
  .tab-body { padding: 16px; }
  .ptabs button { font-size: 7px; padding: 9px 4px; }
  .modes { grid-template-columns: 1fr; }
  .pomo span { display: none; }
  .event-chip { display: none; }
  .dock button { font-size: 8px; padding: 12px 6px; }
  .arena canvas { width: 180px; height: 120px; }
  .trow { grid-template-columns: minmax(0, 1.4fr) .8fr 40px; }
  .trow em { display: none; }
}

/* fixes after review */
.panel:not(.lesson) > * { flex-shrink: 0; }
#toasts { left: auto; right: calc(var(--gut-r) + 3px); transform: none; width: min(340px, calc(100% - 32px)); }
#toasts .toast:nth-last-child(n+4) { display: none; }
@media (max-width: 760px) { #toasts { left: 16px; right: 16px; width: auto; } }

/* =====================================================================
   v3: corner menu, answer dropdowns, mistake journal, category labels
   ===================================================================== */
.corner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.menu-wrap { position: relative; display: flex; gap: 8px; align-items: center; }
.menu-btn { position: relative; border: 0; background: var(--panel); color: var(--text); box-shadow: var(--pix); font-family: var(--f-pixel); font-size: 10px; padding: 10px 12px; }
.menu-btn:hover, .menu-btn[aria-expanded="true"] { background: var(--gold); color: #2b1a04; }
.menu-btn .caret { font-family: var(--f-ui); }
.menu-btn .dot { position: absolute; top: -4px; right: -4px; width: 9px; height: 9px; background: var(--rose); box-shadow: 0 0 0 2px var(--edge); animation: blink 1s steps(2) infinite; }
.quick-start { padding: 10px 12px 12px; font-size: 10px; }
.menu { position: absolute; top: calc(100% + 10px); left: 0; z-index: 12; min-width: 220px; background: var(--panel); box-shadow: var(--pix), 8px 8px 0 3px rgba(10, 7, 20, .45); padding: 6px; display: flex; flex-direction: column; animation: drop .18s steps(3); }
.menu button { text-align: left; border: 0; background: transparent; color: var(--text); font-family: var(--f-ui); font-size: 17px; padding: 9px 12px; }
.menu button:hover, .menu button:focus-visible { background: var(--panel-2); color: var(--gold); }
.menu button.on { color: var(--gold); box-shadow: inset 3px 0 0 var(--gold); }
.menu hr { border: 0; height: 2px; background: var(--line); margin: 6px 4px; }
body.in-lesson .menu [data-tab], body.in-boss .menu [data-tab], body.in-lesson .menu hr, body.in-boss .menu hr,
body.in-lesson .menu [data-drawer="avatar"], body.in-lesson .menu [data-drawer="room"], body.in-boss .menu [data-drawer="avatar"], body.in-boss .menu [data-drawer="room"] { display: none; }
body.in-lesson .quick-start, body.in-boss .quick-start, body.in-exam .menu-wrap { display: none; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px 0 24px; }
.panel.home .tab-body { padding-top: 6px; }
#stage { padding-bottom: 24px; }

/* "why was I wrong" dropdowns */
.fb-more { display: flex; flex-direction: column; gap: 6px; }
.fb-more:empty { display: none; }
.dd { background: rgba(0, 0, 0, .18); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .08); }
.dd summary { cursor: pointer; padding: 9px 12px; font-size: 16px; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.dd summary::-webkit-details-marker { display: none; }
.dd summary::after { content: "▾"; color: var(--muted); }
.dd[open] summary::after { content: "▴"; }
.dd summary:hover { color: var(--gold); }
.dd-body { padding: 0 12px 12px; font-family: var(--f-read); font-size: 15px; line-height: 1.55; }
.dd-all p { margin: 0 0 8px; }
.dd-all .right { color: #a8f0c4; } .dd-all .wrong { color: #ffc0ca; }
.tips { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.tips li { font-family: var(--f-read); font-size: 15px; line-height: 1.5; }

/* journal */
.chip.small { font-size: 13px; padding: 5px 8px; }
.journal { display: flex; flex-direction: column; gap: 8px; }
.jcard { background: var(--panel-2); box-shadow: inset 0 0 0 2px var(--line); }
.jcard.s-open { box-shadow: inset 3px 0 0 var(--rose), inset 0 0 0 2px var(--line); }
.jcard.s-improving { box-shadow: inset 3px 0 0 var(--gold), inset 0 0 0 2px var(--line); }
.jcard.s-mastered { box-shadow: inset 3px 0 0 var(--mint), inset 0 0 0 2px var(--line); }
.jcard summary { cursor: pointer; list-style: none; padding: 12px 14px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; align-items: center; }
.jcard summary::-webkit-details-marker { display: none; }
.j-sum { font-family: var(--f-read); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.j-meta { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.j-meta .st { font-family: var(--f-pixel); font-size: 8px; text-transform: uppercase; }
.s-open .st { color: var(--rose); } .s-improving .st { color: var(--gold); } .s-mastered .st { color: var(--mint); }
.j-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 12px; }
.j-sec h4 { margin: 0 0 6px; font-family: var(--f-pixel); font-size: 9px; line-height: 1.5; color: var(--sky); text-transform: uppercase; letter-spacing: .06em; }
.j-sec.wrong h4 { color: var(--rose); } .j-sec.right h4 { color: var(--mint); }
.j-sec p { margin: 0 0 6px; font-family: var(--f-read); font-size: 15px; line-height: 1.55; }
.stimulus.small, .stem.small { font-size: 15px; }
.quote-a { padding: 8px 10px; background: rgba(0, 0, 0, .2); font-style: italic; }
.j-body .r-actions { align-items: center; }

/* category labels under every equippable thing */
.cap .cat, em.cat { display: block; font-style: normal; font-size: 12px; color: var(--muted); }
.nu-name em.cat { display: inline; font-size: 13px; }
.item .cap { display: flex; flex-direction: column; align-items: center; }

@media (max-width: 760px) {
  .corner { gap: 8px; }
  .menu-btn, .quick-start { font-size: 8px; padding: 9px 8px; }
  .menu { position: fixed; left: 16px; right: 16px; top: calc(56px + env(safe-area-inset-top, 0px)); }
  .brand { display: none; }
}
@media (max-width: 760px) {
  body.room-only #room { top: 0; bottom: 0; height: 100%; aspect-ratio: auto; object-fit: cover; object-position: 80% 60%; }
}

/* v4: journal notes, round-type picker */
.j-note { width: 100%; min-height: 72px; resize: vertical; background: var(--edge); color: var(--text); border: 0; box-shadow: inset 0 0 0 2px var(--line); padding: 10px; font-family: var(--f-read); font-size: 15px; line-height: 1.5; }
.j-note:focus { outline: none; box-shadow: inset 0 0 0 2px var(--gold); }
.j-sec.notes h4 { color: var(--gold); }
.note-saved { display: block; margin-top: 4px; font-size: 12px; min-height: 14px; }
.has-note { font-style: normal; color: var(--gold); }
.modes-pick { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.seg-btn.check:not(.on) { opacity: .6; }

/* pre-lesson setup */
.setup-modal { width: min(620px, 100%); align-items: stretch; text-align: left; }
.setup-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.setup-modes .mode-card.on { box-shadow: inset 0 0 0 3px var(--gold); background: #33284a; }
.setup-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.setup-field { display: flex; flex-direction: column; gap: 6px; }
.setup-select { background: var(--edge); color: var(--text); border: 0; box-shadow: inset 0 0 0 2px var(--line); padding: 10px; font-family: var(--f-ui); font-size: 16px; }
.setup-modal .btn-ghost { align-self: center; }

/* =====================================================================
   v5: study tools (highlighter, cross-out), Predict First, Find the Gap, Reading Comp, NPCs
   ===================================================================== */
.tools { display: flex; align-items: center; gap: 8px; padding: 0 20px 8px; flex-wrap: wrap; }
.tool { border: 0; background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 2px var(--line); padding: 6px 10px; font-size: 14px; display: inline-flex; gap: 6px; align-items: center; }
.tool:hover { box-shadow: inset 0 0 0 2px var(--muted); }
.tool.on { box-shadow: inset 0 0 0 2px var(--gold); color: var(--gold); }
.hl-swatch { width: 10px; height: 10px; background: #ffe066; box-shadow: 0 0 0 1px var(--edge); }
.hl-colors { display: inline-flex; gap: 4px; }
.hl-c { width: 18px; height: 18px; border: 0; padding: 0; box-shadow: 0 0 0 2px var(--edge); }
.hl-c[data-c="y"] { background: #ffe066; } .hl-c[data-c="p"] { background: #ff9ec4; } .hl-c[data-c="b"] { background: #8fd3ff; }
.hl-c.on { box-shadow: 0 0 0 2px var(--edge), 0 0 0 4px var(--text); }
.tool-hint { font-size: 12px; color: var(--muted); margin-left: auto; }
body.hl-on .stimulus, body.hl-on .stem, body.hl-on .passage-p, body.hl-on .reframe-t, body.hl-on .fact { cursor: text; }
body.hl-on .q-scroll { box-shadow: inset 3px 0 0 #ffe066; }
mark.hl { color: #1b1430; padding: 0 1px; }
mark.hl.c-y { background: #ffe066; } mark.hl.c-p { background: #ff9ec4; } mark.hl.c-b { background: #8fd3ff; }
body.hl-on mark.hl { cursor: pointer; }
/* cross-out (process of elimination) */
.choices.can-cross .choice { position: relative; padding-right: 40px; }
.x-btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; display: grid; place-items: center; font-size: 13px; color: var(--muted); background: var(--edge); opacity: .55; }
.choice:hover .x-btn, .x-btn:focus { opacity: 1; }
.x-btn:hover { color: var(--rose); }
.choice.crossed .txt { text-decoration: line-through; text-decoration-color: var(--rose); text-decoration-thickness: 2px; opacity: .45; }
.choice.crossed .key { opacity: .45; }
.choice.crossed .x-btn { opacity: 1; color: var(--rose); }
/* Predict First */
.predict-ta { min-height: 80px; }
.pred-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pred-compare > div { background: rgba(0, 0, 0, .2); padding: 10px; }
.pred-compare b { font-family: var(--f-pixel); font-size: 8px; color: var(--sky); }
.pred-compare p { margin: 6px 0 0; font-family: var(--f-read); font-size: 15px; }
.pred-compare .label, .pred-compare .presets { grid-column: 1 / -1; }
.preset.on { box-shadow: inset 0 0 0 2px var(--gold); color: var(--gold); }
/* Find the Gap */
.gap-note { margin: 0; min-height: 20px; color: var(--muted); font-size: 15px; }
.sent.is-ev { background: rgba(134, 203, 255, .25); box-shadow: inset 0 -2px 0 var(--sky); }
.sent.is-co { background: rgba(255, 201, 74, .25); box-shadow: inset 0 -2px 0 var(--gold); }
.bridge { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.bridge div { background: var(--panel-2); padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.bridge b { font-family: var(--f-pixel); font-size: 8px; }
.bridge div:first-child b { color: var(--sky); } .bridge div:last-child b { color: var(--gold); }
.bridge span { font-family: var(--f-read); font-size: 14.5px; line-height: 1.45; }
.bridge i { font-style: normal; font-family: var(--f-pixel); font-size: 10px; color: var(--rose); }
/* Reading Comp */
.panel.lesson.rc-mode { width: min(1180px, 100%); }
.rc-wrap { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.passage { background: rgba(0, 0, 0, .18); box-shadow: inset 0 0 0 2px var(--line); padding: 14px 16px; max-height: 58vh; overflow: auto; }
.passage-p { margin: 0 0 12px; font-family: var(--f-read); font-size: 16px; line-height: 1.65; }
.passage-p.pass-head::first-line { font-weight: 600; }
.rc-q { display: flex; flex-direction: column; gap: 12px; }
.rc-ev { margin: 0; padding: 8px 10px; font-size: 15px; }
.rc-ev.ok { background: rgba(98, 227, 154, .15); color: #a8f0c4; } .rc-ev.bad { background: rgba(255, 107, 127, .12); color: #ffc0ca; }
@media (max-width: 900px) { .rc-wrap { grid-template-columns: 1fr; } .passage { max-height: 40vh; } .bridge { grid-template-columns: 1fr; } .bridge i { text-align: center; } .pred-compare { grid-template-columns: 1fr; } .tool-hint { display: none; } }
.passage .label { display: block; line-height: 1.7; margin-bottom: 6px; }

/* account & sync */
.menu-link { display: block; padding: 9px 12px; font-family: var(--f-ui); font-size: 15px; color: var(--muted); text-decoration: none; }
.menu-link:hover { color: var(--gold); }
.cloud-chip { border: 0; font-family: var(--f-pixel); font-size: 8px; padding: 8px 10px; background: var(--panel); color: var(--muted); box-shadow: var(--pix); }
.cloud-chip.s-synced { color: var(--mint); } .cloud-chip.s-syncing { color: var(--sky); } .cloud-chip.s-error { color: var(--rose); } .cloud-chip.s-out { color: var(--gold); }
.acct-form { display: flex; flex-direction: column; gap: 10px; }
.cloud-status { margin: 0; font-size: 15px; } .cloud-status.s-synced { color: var(--mint); } .cloud-status.s-error { color: var(--rose); }
.preset.danger { color: var(--rose); box-shadow: inset 0 0 0 2px var(--rose-d); }
#drawer-body a { color: var(--gold); }
@media (max-width: 760px) { .cloud-chip { display: none; } }

/* HUD hover tooltips (streak, coins, level): informational, not clickable */
.has-tip { position: relative; cursor: default; }
.has-tip:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }
.hud-tip { position: absolute; top: calc(100% + 10px); right: 0; z-index: 30; width: max-content; max-width: 240px; background: var(--panel); box-shadow: var(--pix), 6px 6px 0 2px rgba(10, 7, 20, .45); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; font-family: var(--f-ui); font-size: 14px; line-height: 1.35; color: var(--text); text-align: left; opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .12s, transform .12s steps(2), visibility .12s; pointer-events: none; white-space: normal; }
.hud-tip b { font-family: var(--f-pixel); font-size: 9px; color: var(--gold); line-height: 1.5; }
.hud-tip span { color: var(--muted); }
.has-tip:hover .hud-tip, .has-tip:focus-visible .hud-tip { opacity: 1; visibility: visible; transform: none; }
