:root {
  --bg: #0f1020; --bg2: #171933; --card: #1d2042; --card2: #252955; --line: #33386b;
  --text: #ecebff; --muted: #a3a6d0; --accent: #8b7bff; --accent2: #2ec4b6; --warn: #ff9f1c;
  --bad: #ef476f; --ok: #06d6a0; --gold: #ffd166;
  --radius: 16px; --shadow: 0 10px 30px rgba(0,0,0,.35);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f4ff; --bg2: #ecebff; --card: #ffffff; --card2: #f1f0ff; --line: #dcdaf5;
    --text: #1d1b3a; --muted: #67658f; --shadow: 0 10px 30px rgba(60,50,140,.12); color-scheme: light;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); min-height: 100vh; }
body.kids { font-size: 18px; --radius: 24px; --accent: #ff7ab6; --accent2: #3ad1ff;
  background: radial-gradient(circle at 10% 0%, rgba(255,209,102,.18), transparent 40%), radial-gradient(circle at 90% 10%, rgba(58,209,255,.15), transparent 40%), var(--bg); }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
code { background: var(--card2); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.muted { color: var(--muted); } .small { font-size: .85em; } .hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.row.end { justify-content: flex-end; } .row.space { justify-content: space-between; } .row.center { justify-content: center; }
.label { font-size: .78em; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 0; }

/* ── layout ── */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; text-decoration: none; color: var(--text); display: flex; gap: 8px; align-items: center; font-size: 1.05em; }
.brand span { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 10px; font-size: .93em; }
.nav a:hover, .nav a.on { color: var(--text); background: var(--card); }
.player-pill { display: flex; gap: 10px; align-items: center; font-size: .88em; color: var(--muted); }
.player-pill b { color: var(--gold); }
main { max-width: 1180px; margin: 0 auto; padding: 24px 16px 80px; }

/* ── buttons ── */
.btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--card2); color: var(--text);
  padding: 10px 18px; border-radius: 12px; cursor: pointer; transition: transform .08s, background .15s, border-color .15s; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; font-size: .88em; border-radius: 10px; }
.btn.danger { border-color: var(--bad); color: var(--bad); background: transparent; }
body.kids .btn { border-radius: 18px; padding: 12px 22px; }

/* ── hero / catalog ── */
.hero { padding: 28px 0 12px; }
.hero h1 { font-size: clamp(1.8em, 4vw, 2.7em); }
.hero p { color: var(--muted); max-width: 720px; font-size: 1.08em; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.game-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 20px; border-radius: var(--radius); background: var(--card);
  border: 1px solid var(--line); text-decoration: none; color: var(--text); transition: transform .15s, border-color .15s; overflow: hidden; }
.game-card:hover { transform: translateY(-3px); border-color: var(--c, var(--accent)); }
.game-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 4px; background: var(--c, var(--accent)); }
.game-card .cover { font-size: 2.4em; }
.game-card h3 { margin: 4px 0 0; }
.game-card .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; }
.progress-line { height: 6px; border-radius: 4px; background: var(--card2); overflow: hidden; }
.progress-line i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: .78em; padding: 3px 10px; border-radius: 999px; background: var(--card2); color: var(--muted); border: 1px solid var(--line); }
.chip.pop { animation: pop .3s; color: var(--text); }
.badge { font-size: .78em; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--text); }
.section-title { margin: 36px 0 14px; display: flex; align-items: baseline; gap: 12px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.feature { padding: 16px; border-radius: var(--radius); background: var(--bg2); border: 1px solid var(--line); }
.feature b { display: block; margin-bottom: 4px; }

/* ── game page: map ── */
.game-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .game-layout { grid-template-columns: minmax(0, 1fr); } .game-layout .sidebar { order: 2; } }
.sidebar { position: sticky; top: 70px; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 860px) { .sidebar { position: static; } }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.level { margin-bottom: 12px; }
.level-title { font-weight: 700; font-size: .92em; margin-bottom: 6px; }
.scene-link { display: flex; gap: 8px; align-items: center; width: 100%; text-align: left; font: inherit; font-size: .9em; color: var(--text);
  background: transparent; border: 0; padding: 7px 8px; border-radius: 10px; cursor: pointer; }
.scene-link:hover:not(:disabled) { background: var(--card2); }
.scene-link.on { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.scene-link:disabled { opacity: .45; cursor: not-allowed; }
.scene-link .st { width: 22px; text-align: center; }
.skill-row { display: grid; grid-template-columns: 1fr 70px; gap: 4px 8px; align-items: center; font-size: .85em; margin-bottom: 8px; }
.skill-row .bar { grid-column: 1 / -1; }
.bar { position: relative; height: 8px; border-radius: 6px; background: var(--card2); overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 6px; transition: width .6s; }
.bar b { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--gold); }

/* ── scene ── */
.scene { position: relative; min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; min-height: 420px; }
.scene-head h2 { font-size: 1.5em; margin: 6px 0 8px; }
.scene-kicker { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: .85em; flex-wrap: wrap; }
.scene-intro { margin: 14px 0; color: var(--text); font-size: 1.04em; max-width: 760px; }
.stage { margin-top: 12px; }
.scene-tools { margin-top: 16px; display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.hint-box { flex: 1; min-width: 200px; color: var(--gold); }
.hint-box.pop { animation: pop .35s; }
.feedback { min-height: 1.6em; margin-top: 10px; font-weight: 500; }
.feedback-ok { color: var(--ok); } .feedback-warn { color: var(--warn); }
.banner { margin: 10px 0; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 15%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); font-size: .92em; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner-ok { background: color-mix(in srgb, var(--ok) 12%, transparent); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.error { padding: 14px; border-radius: 12px; background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.why { margin-top: 10px; color: var(--ok); }
.why:empty { display: none; }

/* result overlay */
.result { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(4px); border-radius: var(--radius); animation: fade .25s; }
.result-card { max-width: 560px; width: 100%; max-height: 100%; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); text-align: center; animation: pop .35s; }
.result-emoji { font-size: 3em; }
.result-score { color: var(--muted); margin-bottom: 8px; }
.result .row { justify-content: center; }
.explain { text-align: left; margin-top: 14px; padding: 14px; border-radius: 12px; background: var(--bg2); }
.explain-label { font-size: .75em; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: 4px; font-weight: 700; }
.skill-deltas { margin-top: 14px; text-align: left; }
.skill-delta { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: center; font-size: .85em; margin-bottom: 6px; }
.skill-delta .up { color: var(--ok); } .skill-delta .down { color: var(--warn); }

/* story */
.story-card { text-align: center; padding: 26px 16px; max-width: 640px; margin: 0 auto; min-height: 220px; }
.story-card.enter { animation: slide .35s; }
.story-icon { font-size: 3.6em; margin-bottom: 6px; }
.story-text { font-size: 1.12em; }
.dots { display: flex; gap: 6px; } .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); } .dots i.on { background: var(--accent); }

/* quiz */
.quiz-progress { color: var(--muted); font-size: .85em; }
.quiz-icon { font-size: 2.6em; }
.quiz-q { font-size: 1.12em; font-weight: 600; margin: 6px 0 12px; }
.options { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.option { font: inherit; text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); cursor: pointer; transition: border-color .15s, background .15s; }
.option:hover:not(:disabled) { border-color: var(--accent); }
.option:disabled { cursor: default; }
.option.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 18%, transparent); }
.option.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); animation: shake .35s; }
.option.struck { opacity: .35; text-decoration: line-through; }

/* sequence */
.seq { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .seq { grid-template-columns: 1fr; } }
.seq-pool, .seq-answer { min-height: 120px; padding: 10px; border-radius: 12px; background: var(--bg2); border: 1px dashed var(--line); display: flex; flex-direction: column; gap: 8px; margin: 0; }
.seq-answer { padding-left: 34px; }
.seq-card { font: inherit; width: 100%; display: flex; gap: 10px; align-items: center; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; animation: pop .2s; }
.seq-card:hover { border-color: var(--accent); }
.seq-card.right { border-color: var(--ok); } .seq-card.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--card)); }
.seq-card .ico { font-size: 1.4em; }

/* classify */
.cls { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.cls-card { min-width: 240px; max-width: 420px; padding: 22px; text-align: center; border-radius: var(--radius); background: var(--bg2); border: 2px solid var(--accent); font-size: 1.15em; font-weight: 600; box-shadow: var(--shadow); }
.cls-card .ico { font-size: 2.6em; }
.cls-card.enter { animation: drop .3s; } .cls-card.shake { animation: shake .4s; border-color: var(--bad); }
.cls-bins { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; width: 100%; }
.cls-bin { font: inherit; color: var(--text); padding: 14px 10px; border-radius: 14px; border: 2px dashed var(--line); background: var(--card2); cursor: pointer; transition: transform .1s, border-color .15s; }
.cls-bin:hover { border-color: var(--accent); transform: translateY(-2px); }
.cls-bin .ico { font-size: 1.9em; } .cls-bin .count { font-size: .8em; color: var(--muted); }
.cls-bin.flash-ok { border-color: var(--ok); border-style: solid; background: color-mix(in srgb, var(--ok) 16%, var(--card2)); }
.cls-bin.flash-bad { border-color: var(--bad); border-style: solid; }

/* highlight */
.tokens { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px; border-radius: 12px; background: var(--bg2); }
.tok { --heat: 0; font: inherit; font-size: 1.08em; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); color: var(--text); cursor: pointer;
  background: var(--card); transition: background .3s, border-color .15s; }
.tok:hover:not(:disabled) { border-color: var(--accent); }
.tok.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 25%, var(--card)); }
.tok.focus { border-color: var(--gold); color: var(--gold); font-weight: 700; opacity: 1; }
.tok.right { border-color: var(--ok); } .tok.wrong { border-color: var(--bad); animation: shake .3s; }
.tok.heat { background: color-mix(in srgb, var(--gold) calc(var(--heat) * 75%), var(--card)); }
.tok:disabled { cursor: default; }

/* journey */
.jr-track { overflow-x: auto; border-radius: 14px; background: linear-gradient(180deg, var(--bg2), var(--card)); border: 1px solid var(--line); scrollbar-width: thin; }
.jr-inner { position: relative; padding-top: 0; }
.jr-inner svg { display: block; overflow: visible; margin-top: 40px; }
.jr-path { fill: none; stroke: var(--line); stroke-width: 6; stroke-dasharray: 2 12; stroke-linecap: round; }
.jr-path-done { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset .8s ease; }
.jr-node circle { fill: var(--card2); stroke: var(--line); stroke-width: 3; transition: all .3s; }
.jr-node { cursor: pointer; }
.jr-node.done circle { stroke: var(--accent2); }
.jr-node.here circle { stroke: var(--gold); fill: var(--card); r: 28; }
.jr-ico { font-size: 22px; pointer-events: none; }
.jr-label { fill: var(--muted); font-size: 13px; font-weight: 600; }
.jr-node.here .jr-label { fill: var(--text); }
.jr-traveler { position: absolute; left: 0; top: 40px; display: flex; align-items: center; gap: 6px; transition: transform .8s cubic-bezier(.5,-.3,.4,1.4); pointer-events: none; z-index: 2; }
.jr-traveler.hop .jr-emoji { animation: hop .8s; }
.jr-emoji { font-size: 34px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.4)); }
.jr-payload { font: 600 13px/1.3 ui-monospace, monospace; padding: 4px 8px; border-radius: 8px; background: var(--gold); color: #1d1b3a; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.jr-card { margin-top: 14px; padding: 18px; border-radius: 14px; background: var(--bg2); border: 1px solid var(--line); animation: slide .3s; }
.jr-card-head { display: flex; gap: 12px; align-items: center; }
.jr-card-ico { font-size: 2.4em; }
.jr-text { font-size: 1.04em; margin: 8px 0; }
.jr-challenge { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }

/* tuner */
.tn { display: grid; grid-template-columns: minmax(240px, 340px) minmax(0, 1fr); gap: 18px; }
.tn > *, .nr > * { min-width: 0; }
@media (max-width: 760px) { .tn { grid-template-columns: minmax(0, 1fr); } }
.tn-params { display: flex; flex-direction: column; gap: 12px; }
.tn-param { display: block; padding: 10px 12px; border-radius: 12px; background: var(--bg2); }
.tn-param input[type=range] { width: 100%; accent-color: var(--accent); margin-top: 6px; }
.tn-outputs { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.tn-out { display: flex; justify-content: space-between; font-size: .92em; padding: 4px 4px; border-bottom: 1px dashed var(--line); }
.tn-viz { padding: 12px; border-radius: 12px; background: var(--bg2); margin-bottom: 12px; }
.tn-tasks { padding-left: 22px; margin: 4px 0; }
.tn-tasks li { margin-bottom: 6px; color: var(--muted); }
.tn-tasks li.now { color: var(--text); font-weight: 600; }
.tn-tasks li.done { color: var(--ok); } .tn-tasks li.done::marker { content: '✓ '; }
.tn-samples { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.dist { display: flex; flex-direction: column; gap: 6px; }
.dist-row { display: grid; grid-template-columns: minmax(70px, 140px) 1fr 48px; gap: 10px; align-items: center; font-size: .92em; }
.dist-label { font-family: ui-monospace, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dist-bar { height: 18px; border-radius: 6px; background: var(--card2); overflow: hidden; }
.dist-bar i { display: block; height: 100%; border-radius: 6px; transition: width .25s; }
.dist-val { text-align: right; font-variant-numeric: tabular-nums; }
.curve { width: 100%; height: auto; }
.curve .grid { stroke: var(--line); stroke-width: 1; } .curve .axis { fill: var(--muted); font-size: 11px; }
.curve .mark { stroke: var(--gold); stroke-dasharray: 5 5; } .curve .mark-label { fill: var(--gold); font-size: 11px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85em; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.gauge { position: relative; display: flex; height: 38px; border-radius: 10px; overflow: visible; margin: 34px 0 10px; }
.gauge-zone { display: flex; align-items: center; justify-content: center; font-size: .72em; color: #1d1b3a; font-weight: 700; overflow: hidden; white-space: nowrap; }
.gauge-zone:first-child { border-radius: 10px 0 0 10px; } .gauge-zone:last-of-type { border-radius: 0 10px 10px 0; }
.gauge-zone span { padding: 0 4px; overflow: hidden; text-overflow: ellipsis; }
.gauge-needle { position: absolute; top: -8px; bottom: -8px; width: 4px; margin-left: -2px; background: var(--text); border-radius: 2px; transition: left .25s; }
.gauge-needle b { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: .85em; padding-bottom: 2px; }
.gauge-zone-now { font-size: 1.2em; font-weight: 700; text-align: center; }

/* neuron */
.nr { display: grid; grid-template-columns: minmax(260px, 420px) minmax(0, 1fr); gap: 18px; }
@media (max-width: 760px) { .nr { grid-template-columns: minmax(0, 1fr); } }
.nr-canvas { width: 100%; aspect-ratio: 1; border-radius: 14px; background: var(--bg2); border: 1px solid var(--line); }
.nr-side { display: flex; flex-direction: column; gap: 12px; }
.nr-formula { font-family: ui-monospace, monospace; font-size: .9em; padding: 10px; border-radius: 10px; background: var(--bg2); }
.nr-acc { font-size: 1.1em; }
.nr-train { display: flex; flex-direction: column; gap: 8px; }

/* profile */
.profile-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; }
.stat { padding: 12px 18px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); min-width: 110px; }
.stat b { display: block; font-size: 1.6em; }
.skill-table { width: 100%; border-collapse: collapse; }
.skill-table td, .skill-table th { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.skill-table th { font-size: .78em; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
.status { font-size: .8em; padding: 2px 8px; border-radius: 999px; background: var(--card2); white-space: nowrap; }
.status.l3 { background: color-mix(in srgb, var(--ok) 25%, transparent); } .status.review { background: color-mix(in srgb, var(--warn) 25%, transparent); }
input[type=text], select, textarea { font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
textarea { width: 100%; font-family: ui-monospace, monospace; font-size: 13px; line-height: 1.5; }

/* studio */
.studio { display: grid; grid-template-columns: 260px minmax(0, 1fr) minmax(0, 1fr); gap: 14px; height: calc(100vh - 140px); }
@media (max-width: 1100px) { .studio { grid-template-columns: 1fr; height: auto; } }
.studio .panel { overflow: auto; }
.studio textarea { height: 100%; min-height: 420px; resize: none; }
.studio iframe { width: 100%; height: 100%; min-height: 560px; border: 0; border-radius: 12px; background: var(--bg); }
.studio-col { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.studio-col > .panel { flex: 1; display: flex; flex-direction: column; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button { font: inherit; font-size: .88em; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.tabs button.on { background: var(--card2); color: var(--text); border-color: var(--accent); }
.outline-scene { display: flex; justify-content: space-between; gap: 6px; font-size: .86em; padding: 4px 6px; border-radius: 8px; cursor: pointer; }
.outline-scene:hover { background: var(--card2); }
.mech-list { display: grid; gap: 8px; }
.mech-item { padding: 10px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); font-size: .88em; }
.status-line { font-size: .85em; min-height: 1.4em; }
.status-line.ok { color: var(--ok); } .status-line.bad { color: var(--bad); white-space: pre-wrap; }
.an-row { display: grid; grid-template-columns: 1fr 70px 70px 70px; gap: 8px; font-size: .86em; padding: 6px 0; border-bottom: 1px solid var(--line); }
.an-row.bad { color: var(--warn); }

/* docs */
.doc { max-width: 860px; }
.doc pre { background: var(--bg2); border: 1px solid var(--line); padding: 14px; border-radius: 12px; overflow: auto; font-size: 13px; }
.doc h2 { margin-top: 1.6em; }

/* toasts & confetti */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { padding: 10px 18px; border-radius: 12px; background: var(--card2); border: 1px solid var(--line); box-shadow: var(--shadow); animation: pop .25s; }
.toast-ok { border-color: var(--ok); } .toast-bad { border-color: var(--bad); }
.toast.out { opacity: 0; transition: opacity .3s; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 99; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }

@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }
@keyframes pop { 0% { transform: scale(.92); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateY(8px); opacity: 0; } }
@keyframes drop { from { transform: translateY(-20px) rotate(-3deg); opacity: 0; } }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
@keyframes hop { 30% { transform: translateY(-18px) scale(1.15); } 60% { transform: translateY(0) scale(.95); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.table-wrap { overflow-x: auto; }
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .nav { order: 3; width: 100%; margin-left: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav a { white-space: nowrap; padding: 5px 10px; }
  .player-pill { margin-left: auto; gap: 8px; }
  .player-pill .aud-label { display: none; }
  main { padding: 16px 12px 60px; }
  .scene { padding: 16px; }
  .skill-table td:nth-child(3), .skill-table th:nth-child(3) { display: none; }
  .skill-table .muted.small { font-size: .78em; }
  .dist-row { grid-template-columns: minmax(60px, 96px) minmax(0, 1fr) 42px; }
}
.studio select { max-width: 100%; }
