:root {
  color-scheme: dark;
  --bg: #070b1a;
  --bg2: #0d1430;
  --panel: rgba(18, 26, 58, .78);
  --panel-solid: #121a3a;
  --line: rgba(140, 160, 255, .18);
  --ink: #eaf0ff;
  --muted: #9ba8d6;
  --dim: #5d6894;
  --cyan: #74f0ff;
  --gold: #ffd36e;
  --good: #4ff0a8;
  --bad: #ff6382;
  --A: #5aa9ff;   /* Knowing & understanding */
  --B: #b48cff;   /* Investigating patterns */
  --C: #3fe0b0;   /* Communicating */
  --D: #ff9d5c;   /* Applying in real-life contexts */
  --radius: 16px;
  --font-ui: "Atkinson Hyperlegible", system-ui, sans-serif;
  --font-head: "Chakra Petch", "Atkinson Hyperlegible", sans-serif;
  --font-math: "STIX Two Text", "Cambria Math", "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 700px at 80% -10%, #2a1655 0%, transparent 60%),
              radial-gradient(900px 600px at -10% 40%, #0b2c55 0%, transparent 60%),
              radial-gradient(800px 500px at 90% 100%, #3a1236 0%, transparent 65%),
              var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font: 17px/1.55 var(--font-ui);
  min-height: 100vh;
  overflow-x: hidden;
}
#stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
a { color: var(--cyan); }
button { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-head); letter-spacing: .02em; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .8em; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ---------- HUD ---------- */
.hud {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(7, 11, 26, .82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-family: var(--font-head); font-size: 1.15rem; white-space: nowrap; }
.brand svg { width: 28px; height: 28px; }
.brand b { color: var(--gold); }
.hud-stats { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.hud-nav { display: flex; gap: 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: .85rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.chip.rank .rank-name { font-family: var(--font-head); color: var(--gold); }
.xpbar { width: 64px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; }
.xpbar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--gold)); transition: width .6s; }
.xp-num { color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.streak { color: var(--D); }
.chip.streak svg { width: 16px; height: 16px; }
.chip.streak.cold { color: var(--dim); }
.fuel-gauge { width: 46px; height: 10px; border-radius: 5px; border: 1px solid var(--line); overflow: hidden; display: block; }
.fuel-gauge span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ff9d5c, #ffd36e); transition: width .6s; }
.chip.fuel::before { content: "FUEL"; font-family: var(--font-head); font-size: .7rem; color: var(--muted); }
.btn-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: transparent; border: 1px solid transparent; color: var(--muted); cursor: pointer; }
.btn-icon:hover { color: var(--ink); border-color: var(--line); background: var(--panel); }
.btn-icon svg { width: 22px; height: 22px; }
.btn-icon.off #soundWaves { opacity: 0; }
.btn-icon.on { color: var(--gold); border-color: rgba(255, 211, 110, .5); background: rgba(255, 211, 110, .1); }
.teacher-chip { display: none; color: var(--gold); border-color: rgba(255, 211, 110, .5); font-family: var(--font-head); }
body.teacher .teacher-chip { display: inline-flex; }
body.teacher .chip.rank, body.teacher .chip.streak, body.teacher .chip.fuel { display: none; }
.teacher-banner { border: 1px solid rgba(255, 211, 110, .45); background: rgba(255, 211, 110, .08); border-radius: 12px; padding: 10px 14px; margin: 10px 0; font-size: .95rem; }
.lvl-pick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
@media (max-width: 640px) {
  .hud { gap: 6px; flex-wrap: nowrap; padding-left: 12px; padding-right: 12px; }
  .brand span { display: none; }
  .hud-stats { margin-left: 0; gap: 5px; min-width: 0; }
  .xpbar { width: 34px; }
  .xp-num { display: none; }
  .chip { padding: 4px 8px; }
  .chip.fuel::before { content: none; }
  .fuel-gauge { width: 30px; }
  .hud-nav { margin-left: auto; gap: 0; }
  .btn-icon { width: 34px; height: 34px; }
  .unit-head .sun { width: 44px; height: 44px; }
  .crit-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 360px) { .chip.fuel { display: none; } .xpbar { display: none; } }
h1, h2 { overflow-wrap: break-word; }
@media (max-width: 640px) { .tlabel { display: none; } }
@media (max-width: 440px) { .unit-head { flex-direction: column; align-items: flex-start; gap: 10px; } }
.unit-head > div, .node-label, .p-label { min-width: 0; }

/* ---------- layout ---------- */
main { max-width: 820px; margin: 0 auto; padding: 20px 16px 80px; outline: none; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; backdrop-filter: blur(6px); }
.panel + .panel { margin-top: 16px; }
.eyebrow { font-family: var(--font-head); text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; color: var(--cyan); margin-bottom: 6px; }
.muted { color: var(--muted); }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: .9rem; margin-bottom: 14px; }
.back:hover { color: var(--ink); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-solid); color: var(--ink); font-family: var(--font-head); font-weight: 600; font-size: 1rem; cursor: pointer; text-decoration: none; transition: transform .1s, background .2s; }
.btn:hover { background: #1a2550; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, #2bb8d6, #5a6cff); border-color: transparent; color: #fff; box-shadow: 0 4px 20px rgba(80, 140, 255, .35); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.gold { background: linear-gradient(135deg, #ffcf5c, #ff9d5c); color: #2a1300; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; font-size: .85rem; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.danger { border-color: rgba(255, 99, 130, .5); color: var(--bad); }

/* ---------- math ---------- */
.m { font-family: var(--font-math); font-size: 1.12em; white-space: nowrap; }
.m i { font-style: italic; padding: 0 .02em; }
.op { margin: 0 .22em; }
.m sup { font-size: .7em; line-height: 0; }
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 .12em; font-size: .92em; }
.frac > span:first-child { border-bottom: 1px solid currentColor; padding: 0 .2em; }
.frac > span:last-child { padding: 0 .2em; }
.mathblock { font-family: var(--font-math); font-size: 1.5rem; text-align: center; margin: 12px 0; }

/* ---------- galaxy map ---------- */
.hero { margin-bottom: 18px; }
.hero p { color: var(--muted); max-width: 60ch; }
.welcome { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.welcome input { flex: 1; min-width: 160px; }
.map { position: relative; margin-top: 10px; }
.map svg.trail { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.map-row { position: relative; display: flex; align-items: center; gap: 16px; padding: 16px 4%; }
.map-row.right { flex-direction: row-reverse; text-align: right; }
.star-node { text-decoration: none; flex: none; position: relative; width: 74px; height: 74px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; background: transparent; }
.star-node .core { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; color: #120a00; background: radial-gradient(circle at 35% 30%, #fff8dc, var(--star, var(--gold)) 55%, #b06a00 100%); box-shadow: 0 0 24px var(--star, var(--gold)), 0 0 60px rgba(255, 211, 110, .25); transition: transform .2s; }
.star-node:hover .core { transform: scale(1.08); }
.star-node.locked .core { background: radial-gradient(circle at 35% 30%, #59628a, #2a3156 70%); box-shadow: none; color: #9ba8d6; }
.star-node.available::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; border: 2px solid var(--cyan); animation: pulse 2s infinite; }
.star-node.done::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; border: 2px solid var(--gold); }
@keyframes pulse { 0% { transform: scale(.85); opacity: 1; } 100% { transform: scale(1.35); opacity: 0; } }
.node-label { min-width: 0; }
.node-label .t { font-family: var(--font-head); font-size: 1.05rem; color: var(--ink); text-decoration: none; display: block; }
.node-label .s { font-size: .85rem; color: var(--muted); }
.tag { display: inline-block; font-size: .7rem; font-family: var(--font-head); letter-spacing: .06em; padding: 1px 7px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); margin-left: 4px; vertical-align: middle; }
.tag.ext { color: var(--B); border-color: rgba(180, 140, 255, .4); }

/* ---------- system view ---------- */
.unit-head { display: flex; gap: 16px; align-items: center; }
.unit-head .sun { width: 64px; height: 64px; flex: none; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff8dc, var(--gold) 55%, #b06a00); box-shadow: 0 0 40px rgba(255, 211, 110, .5); }
details.briefing { margin-top: 14px; }
details.briefing summary { cursor: pointer; font-family: var(--font-head); color: var(--cyan); }
.brief-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 12px; }
.brief-grid > div { background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.brief-grid h4 { margin: 0 0 4px; font-family: var(--font-head); font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.soi { font-size: 1.05rem; font-style: italic; border-left: 3px solid var(--gold); padding-left: 12px; margin: 12px 0; }
.crit-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.crit-pill { border-radius: 12px; padding: 8px; text-align: center; border: 1px solid color-mix(in srgb, var(--c) 50%, transparent); background: color-mix(in srgb, var(--c) 10%, transparent); }
.crit-pill b { display: block; font-family: var(--font-head); color: var(--c); font-size: 1.3rem; }
.crit-pill span { font-size: .72rem; color: var(--muted); }
.path { position: relative; margin-top: 20px; }
.path svg.trail { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.p-row { position: relative; display: flex; align-items: center; gap: 14px; padding: 12px 6%; }
.p-row.right { flex-direction: row-reverse; text-align: right; }
.planet { flex: none; width: 64px; height: 64px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; font-size: 1.2rem; color: #fff; position: relative; background: radial-gradient(circle at 35% 30%, #9fd8ff, #3b6ad6 60%, #1c2a6b); box-shadow: inset -8px -8px 16px rgba(0,0,0,.35), 0 0 18px rgba(90, 140, 255, .4); transition: transform .2s; }
.planet:hover { transform: scale(1.07); }
.planet.ch { background: radial-gradient(circle at 35% 30%, #fff, var(--c) 45%, color-mix(in srgb, var(--c) 40%, #000)); box-shadow: inset -8px -8px 16px rgba(0,0,0,.35), 0 0 22px var(--c); color: #0b0f24; }
.planet.boss { width: 92px; height: 92px; font-size: .9rem; background: radial-gradient(circle at 35% 30%, #ffd1a6, #e2553a 50%, #5a1020); box-shadow: inset -12px -12px 22px rgba(0,0,0,.4), 0 0 36px rgba(255, 90, 60, .6); }
.planet.boss::before { content: ""; position: absolute; inset: -12px; border-radius: 50%; border: 2px solid rgba(255, 157, 92, .5); transform: rotateX(70deg); }
.planet.locked { background: radial-gradient(circle at 35% 30%, #4a537a, #20274a 70%); box-shadow: none; color: var(--dim); cursor: pointer; }
.planet.done::after { content: "✓"; position: absolute; right: -2px; top: -2px; width: 22px; height: 22px; border-radius: 50%; background: var(--good); color: #052a1a; font-size: .8rem; display: grid; place-items: center; }
.planet.current { animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.p-label .t { font-family: var(--font-head); font-size: 1rem; }
.p-label .s { font-size: .82rem; color: var(--muted); }
.stars { color: var(--gold); letter-spacing: 2px; font-size: .95rem; }
.stars .off { color: var(--dim); }
.coming { text-align: center; padding: 28px 16px; }
.coming .big { font-size: 2.5rem; }

/* ---------- lesson ---------- */
.dots { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.dots span { flex: 1; min-width: 12px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.1); }
.dots span.on { background: var(--cyan); }
.slide { min-height: 260px; animation: slideIn .35s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.slide h2 { color: var(--gold); }
.slide ul { padding-left: 1.2em; }
.slide li { margin-bottom: 6px; }
.callout { border: 1px solid rgba(116, 240, 255, .35); background: rgba(116, 240, 255, .06); border-radius: 12px; padding: 12px 14px; margin: 12px 0; }
.callout.warn { border-color: rgba(255, 157, 92, .45); background: rgba(255, 157, 92, .07); }
.callout b:first-child { font-family: var(--font-head); }
.nav-row { display: flex; gap: 10px; justify-content: space-between; margin-top: 18px; }
table.vocab, table.data { border-collapse: collapse; width: 100%; margin: 10px 0; }
table.vocab td, table.vocab th, table.data td, table.data th { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
table.data td, table.data th { text-align: center; font-variant-numeric: tabular-nums; }
table.vocab th, table.data th { font-family: var(--font-head); font-weight: 600; color: var(--muted); background: rgba(255,255,255,.03); }
.anatomy { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; margin: 18px 0 8px; font-family: var(--font-math); font-size: 1.8rem; }
.anatomy > span { display: flex; flex-direction: column; align-items: center; }
.anatomy small { font-family: var(--font-ui); font-size: .72rem; color: var(--muted); border-top: 2px solid var(--c, var(--cyan)); padding-top: 4px; margin-top: 4px; white-space: nowrap; }

/* ---------- question ---------- */
.q-crit { display: inline-flex; gap: 6px; align-items: center; font-family: var(--font-head); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--c); }
.q-crit::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.q-prompt { font-size: 1.12rem; margin: 10px 0 14px; }
.q-visual { margin: 10px 0; overflow-x: auto; }
.q-visual svg { max-width: 100%; height: auto; }
.answer-row { display: flex; gap: 10px; flex-wrap: wrap; }
input.ans, .welcome input, input.text { flex: 1; min-width: 140px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.3); color: var(--ink); font: 1.25rem var(--font-math); }
.welcome input, input.text { font: 1rem var(--font-ui); }
input.ans:focus, input.text:focus { border-color: var(--cyan); outline: none; box-shadow: 0 0 0 3px rgba(116, 240, 255, .15); }
.multi-f { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 140px; font: 1.2rem var(--font-math); }
.multi-f input { min-width: 80px; }
.keypad { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.keypad button { min-width: 44px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.05); cursor: pointer; font: 1.1rem var(--font-math); }
.keypad button:hover { background: rgba(255,255,255,.12); }
.preview { min-height: 1.6em; margin-top: 6px; color: var(--muted); font-size: .95rem; }
.options { display: grid; gap: 10px; }
.options.two { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.opt { text-align: left; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.04); cursor: pointer; font-size: 1.02rem; transition: background .15s, border-color .15s; }
.opt:hover:not(:disabled) { background: rgba(255,255,255,.09); border-color: var(--cyan); }
.opt.sel { border-color: var(--cyan); background: rgba(116, 240, 255, .1); }
.opt.right { border-color: var(--good); background: rgba(79, 240, 168, .12); }
.opt.wrong { border-color: var(--bad); background: rgba(255, 99, 130, .12); }
.opt:disabled { cursor: default; }
.order-pool, .order-ans { display: flex; flex-direction: column; gap: 8px; }
.order-ans { min-height: 60px; border: 1px dashed var(--line); border-radius: 12px; padding: 8px; margin-bottom: 10px; }
.order-ans:empty::before { content: "Tap the steps below in the right order"; color: var(--dim); font-size: .9rem; padding: 8px; }
.order-item { text-align: left; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.05); cursor: pointer; }
.order-ans .order-item::before { content: attr(data-n) ". "; color: var(--cyan); font-family: var(--font-head); }
.steps { margin: 8px 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; padding: 6px 10px; border-left: 3px solid var(--line); margin-bottom: 4px; }
.steps li::before { content: "Line " counter(s) ":  "; font-family: var(--font-head); font-size: .8rem; color: var(--muted); }
.feedback { margin-top: 14px; border-radius: 12px; padding: 12px 14px; animation: slideIn .25s ease; }
.feedback.good { background: rgba(79, 240, 168, .1); border: 1px solid rgba(79, 240, 168, .4); }
.feedback.bad { background: rgba(255, 99, 130, .1); border: 1px solid rgba(255, 99, 130, .4); }
.feedback.meh { background: rgba(255, 211, 110, .1); border: 1px solid rgba(255, 211, 110, .4); }
.feedback .head { font-family: var(--font-head); font-size: 1.05rem; margin-bottom: 4px; }
.feedback.good .head { color: var(--good); }
.feedback.bad .head { color: var(--bad); }
.feedback.meh .head { color: var(--gold); }
.solution { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.hint-box { margin-top: 10px; color: var(--gold); font-size: .95rem; }
.q-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; align-items: center; }

/* ---------- challenge / boss ---------- */
.ch-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.progress { flex: 1; height: 8px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--c, var(--cyan)); transition: width .4s; }
.combo { font-family: var(--font-head); color: var(--gold); min-width: 70px; text-align: right; }
.result-big { text-align: center; padding: 10px 0; }
.result-big .stars { font-size: 2.4rem; letter-spacing: 8px; }
.result-big .score { font-family: var(--font-head); font-size: 2.6rem; }
.level-badge { display: inline-block; font-family: var(--font-head); font-size: 1.1rem; padding: 4px 14px; border-radius: 999px; border: 1px solid var(--c); color: var(--c); }
.boss-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.boss-bar .hp { flex: 1; height: 14px; border-radius: 7px; background: rgba(255,255,255,.08); overflow: hidden; border: 1px solid rgba(255, 99, 130, .4); }
.boss-bar .hp span { display: block; height: 100%; background: linear-gradient(90deg, #ff3d6a, #ff9d5c); transition: width .5s; }
.boss-planet { width: 120px; height: 120px; margin: 0 auto 12px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffd1a6, #e2553a 50%, #5a1020); box-shadow: inset -16px -16px 30px rgba(0,0,0,.45), 0 0 50px rgba(255, 90, 60, .6); animation: bob 3s ease-in-out infinite; }
.boss-planet.hit { animation: hit .4s; }
@keyframes hit { 25% { transform: translateX(-8px); filter: brightness(2); } 75% { transform: translateX(8px); } }
.rubric { width: 100%; border-collapse: collapse; margin-top: 12px; }
.rubric td, .rubric th { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.rubric th { font-family: var(--font-head); color: var(--muted); font-weight: 600; font-size: .85rem; }
.rubric .lvl { font-family: var(--font-head); font-size: 1.4rem; color: var(--c); white-space: nowrap; }

/* ---------- asteroid run ---------- */
.field { position: relative; height: min(52vh, 440px); border-radius: var(--radius); border: 1px solid var(--line); background: radial-gradient(ellipse at 50% 120%, rgba(116, 240, 255, .18), transparent 60%), rgba(0,0,0,.35); overflow: hidden; }
.field .ship { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); width: 44px; height: 44px; }
.field .ground { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--cyan), transparent); }
.asteroid { position: absolute; left: 50%; transform: translateX(-50%); min-width: 120px; padding: 14px 18px; border-radius: 46% 54% 50% 50% / 55% 45% 55% 45%; background: radial-gradient(circle at 35% 30%, #a49ab8, #5b5270 60%, #2d2740); box-shadow: inset -6px -6px 12px rgba(0,0,0,.4), 0 0 20px rgba(255, 157, 92, .25); text-align: center; font: 1.25rem var(--font-math); white-space: nowrap; color: #fff; }
.asteroid.boom { animation: boom .35s forwards; }
@keyframes boom { to { transform: translateX(-50%) scale(1.8); opacity: 0; filter: brightness(3); } }
.field.shake { animation: hit .35s; }
.ast-hud { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-family: var(--font-head); }
.shields { color: var(--cyan); letter-spacing: 3px; }
.shields .off { color: var(--dim); }
.ast-input { display: flex; gap: 10px; margin-top: 12px; }
.missed { position: absolute; left: 0; right: 0; bottom: 60px; text-align: center; color: var(--bad); font-family: var(--font-head); }

/* ---------- profile ---------- */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.badge { border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; background: rgba(255,255,255,.03); }
.badge .ico { font-size: 2rem; }
.badge .n { font-family: var(--font-head); font-size: .95rem; }
.badge .d { font-size: .78rem; color: var(--muted); }
.badge.locked { opacity: .4; filter: grayscale(1); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; }
.stat b { display: block; font-family: var(--font-head); font-size: 1.6rem; color: var(--gold); }
.stat span { font-size: .8rem; color: var(--muted); }
.confirm-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; max-width: min(340px, calc(100vw - 32px)); }
.toast { background: var(--panel-solid); border: 1px solid var(--gold); border-radius: 14px; padding: 12px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: toastIn .35s ease; }
.toast.out { animation: toastOut .35s ease forwards; }
.toast .tt { font-family: var(--font-head); color: var(--gold); }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(16px); } }
.xp-float { position: fixed; pointer-events: none; font-family: var(--font-head); color: var(--gold); font-size: 1.2rem; animation: floatUp 1s ease forwards; z-index: 60; }
@keyframes floatUp { to { transform: translateY(-50px); opacity: 0; } }

/* ---------- manipulatives ---------- */
.manip { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: rgba(0,0,0,.25); margin: 12px 0; }
.manip-title { font-family: var(--font-head); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--cyan); margin-bottom: 10px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.seg button { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; cursor: pointer; font: 1rem var(--font-math); }
.seg button.on { background: rgba(116, 240, 255, .15); border-color: var(--cyan); }
.slider-row { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
.slider-row label { min-width: 70px; font-family: var(--font-math); font-size: 1.15rem; }
.slider-row input[type=range] { flex: 1; accent-color: var(--cyan); }
.slider-row output { min-width: 34px; text-align: right; font: 1.2rem var(--font-math); color: var(--gold); }
.machine { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; text-align: center; margin: 12px 0; }
.machine .io { border: 1px solid var(--line); border-radius: 12px; padding: 10px; font: 1.6rem var(--font-math); }
.machine .io small { display: block; font: .72rem var(--font-head); color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.machine .box { padding: 14px 16px; border-radius: 14px; background: linear-gradient(135deg, #2a3a7a, #172050); border: 1px solid var(--cyan); font: 1.3rem var(--font-math); position: relative; }
.machine .box.spin { animation: hit .4s; }
.machine .arrow { color: var(--cyan); }
.history { font-size: .9rem; color: var(--muted); }
.tray { min-height: 120px; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; padding: 12px; border-radius: 12px; border: 1px dashed var(--line); margin: 10px 0; }
.tile { border: 0; cursor: pointer; border-radius: 6px; display: grid; place-items: center; font: italic 1rem var(--font-math); color: #071022; transition: transform .2s, opacity .3s; }
.tile.x { width: 34px; height: 96px; }
.tile.one { width: 34px; height: 34px; }
.tile.x2 { width: 96px; height: 96px; }
.tile.pos { background: linear-gradient(135deg, #74f0ff, #3aa5d6); }
.tile.neg { background: linear-gradient(135deg, #ff8aa3, #d6405f); }
.tile.x2.pos { background: linear-gradient(135deg, #c3a8ff, #8a5ce0); }
.tile.pair { outline: 3px solid var(--gold); }
.tile.gone { transform: scale(0); opacity: 0; }
.readout { font-size: 1.05rem; margin-top: 6px; }
.readout .m { font-size: 1.25em; }
.area-svg text { font-family: var(--font-math); fill: var(--ink); }
.sticks-table { max-height: 220px; overflow: auto; }
