/* FLYING ROADSTER — telemetry UI
   Layout concept: a full-bleed 3D view with glass instrument panels hugging the edges.
   Palette: night ink, cold-gas cyan (thrust), anodised gold (coins, nozzle rings), signal red (danger). */
:root {
  --ink: #06080b;
  --panel: rgba(9, 12, 17, 0.74);
  --panel-solid: #0b0f15;
  --line: rgba(176, 202, 230, 0.16);
  --line-strong: rgba(176, 202, 230, 0.32);
  --text: #eaf0f6;
  --dim: #8896a8;
  --faint: #55627a;
  --cold: #7fe3ff;
  --cold-deep: #1c8fb5;
  --gold: #eab84f;
  --danger: #ff5a45;
  --ok: #8dffb0;
  --font-display: 'Michroma', 'Eurostile', 'Bank Gothic', 'Arial Narrow', sans-serif;
  --font-ui: 'Barlow Semi Condensed', 'Arial Narrow', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--text); font-family: var(--font-ui); overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--cold); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- boot ---------- */
#boot { position: fixed; inset: 0; z-index: 50; background: radial-gradient(120% 90% at 50% 40%, #0e1520, #05070a); display: grid; place-items: center; transition: opacity .6s ease; }
#boot.done { opacity: 0; pointer-events: none; }
.boot-inner { text-align: center; width: min(340px, 80vw); }
.boot-logo { font-family: var(--font-display); font-size: clamp(22px, 5vw, 34px); line-height: 1.25; letter-spacing: .08em; margin-bottom: 28px; }
.boot-bar { height: 3px; background: rgba(255,255,255,.1); overflow: hidden; border-radius: 2px; }
.boot-bar i { display: block; height: 100%; width: 8%; background: linear-gradient(90deg, var(--cold-deep), var(--cold)); transition: width .3s ease; }
.boot-msg { margin-top: 14px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; color: var(--dim); text-transform: uppercase; }

/* ---------- shared widgets ---------- */
.kbd, kbd { font-family: var(--font-mono); font-size: 11px; padding: 2px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; color: var(--dim); background: rgba(255,255,255,.04); }
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 18px; border: 1px solid var(--line-strong); border-radius: 3px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.015));
  font-weight: 600; letter-spacing: .1em; text-transform: uppercase; font-size: 14px; text-align: left;
  transition: transform .12s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.btn:hover:not(:disabled) { border-color: var(--cold); background: linear-gradient(180deg, rgba(127,227,255,.14), rgba(127,227,255,.03)); box-shadow: 0 0 0 1px rgba(127,227,255,.2), 0 8px 30px -10px rgba(127,227,255,.35); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn.primary { border-color: var(--gold); background: linear-gradient(180deg, rgba(234,184,79,.28), rgba(234,184,79,.06)); color: #fff4d9; }
.btn.primary:hover:not(:disabled) { border-color: #ffd98a; background: linear-gradient(180deg, rgba(234,184,79,.42), rgba(234,184,79,.1)); box-shadow: 0 0 0 1px rgba(234,184,79,.3), 0 10px 34px -10px rgba(234,184,79,.5); }
.btn.big { padding: 18px 22px; font-size: 17px; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--dim); }
.btn.small { padding: 7px 12px; font-size: 12px; }
.btn .meta { font-family: var(--font-mono); font-weight: 400; font-size: 11px; letter-spacing: .02em; color: var(--dim); text-transform: none; }
.badge { font-family: var(--font-mono); font-size: 11px; padding: 1px 7px; border-radius: 10px; background: var(--gold); color: #1a1303; font-weight: 700; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); background: rgba(255,255,255,.03); }
.chip.on { color: var(--text); border-color: var(--cold); background: rgba(127,227,255,.1); }
.coin-dot { display: inline-block; width: .8em; height: .8em; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff1c2, var(--gold) 55%, #9a6d1c); box-shadow: 0 0 8px rgba(234,184,79,.6); vertical-align: -1px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.eyebrow { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--dim); }

.panel { background: var(--panel); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); border: 1px solid var(--line); border-radius: 4px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { flex: 1; margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 15px; letter-spacing: .12em; text-transform: uppercase; }

.screen { position: fixed; inset: 0; padding: calc(var(--safe-t) + 22px) calc(var(--safe-r) + 24px) calc(var(--safe-b) + 20px) calc(var(--safe-l) + 24px); pointer-events: none; animation: screen-in .35s ease both; }
.screen > * { pointer-events: auto; }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- main menu ---------- */
.menu-col { position: absolute; left: calc(var(--safe-l) + 24px); top: 50%; transform: translateY(-50%); width: min(380px, calc(100vw - 48px)); display: flex; flex-direction: column; gap: 26px; }
.brand .logo { font-family: var(--font-display); font-size: clamp(30px, 4.6vw, 54px); line-height: 1.08; letter-spacing: .06em; text-shadow: 0 2px 40px rgba(0,0,0,.6); }
.brand .logo b { font-weight: 400; color: var(--gold); }
.brand .tagline { margin-top: 12px; font-size: 13px; letter-spacing: .26em; text-transform: uppercase; color: var(--cold); }
.menu-list { display: grid; gap: 8px; }
.menu-list .btn.primary { margin-bottom: 6px; }
.profile { display: grid; gap: 8px; padding: 12px 14px; }
.profile-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.callsign { font-family: var(--font-display); font-size: 14px; letter-spacing: .1em; }
.lvl { font-family: var(--font-mono); font-size: 12px; color: var(--cold); }
.xpbar { height: 4px; background: rgba(255,255,255,.1); border-radius: 2px; overflow: hidden; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--cold-deep), var(--cold)); border-radius: 2px; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.wallet { font-family: var(--font-mono); font-size: 14px; color: var(--gold); font-weight: 600; }

.stage-picker { position: absolute; right: calc(var(--safe-r) + 24px); bottom: calc(var(--safe-b) + 54px); display: flex; gap: 10px; max-width: calc(100vw - 440px); }
.stage-card { width: 150px; padding: 0; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; background: var(--panel); text-align: left; transition: border-color .15s, transform .15s; }
.stage-card:hover:not(.locked) { border-color: var(--cold); transform: translateY(-2px); }
.stage-card.sel { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(234,184,79,.4), 0 12px 34px -12px rgba(234,184,79,.4); }
.stage-card .thumb { height: 64px; position: relative; }
.stage-card .thumb::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.45)); }
.stage-card .txt { padding: 8px 10px 10px; }
.stage-card .nm { font-weight: 700; font-size: 13px; letter-spacing: .04em; line-height: 1.15; }
.stage-card .sb { font-size: 11px; color: var(--dim); margin-top: 2px; }
.stage-card .lock { font-family: var(--font-mono); font-size: 11px; color: var(--gold); margin-top: 6px; }
.stage-card.locked { opacity: .6; }
.disclaimer { position: absolute; left: calc(var(--safe-l) + 24px); bottom: calc(var(--safe-b) + 14px); font-size: 11px; color: var(--faint); max-width: min(560px, 80vw); line-height: 1.35; }
.topright { position: absolute; top: calc(var(--safe-t) + 18px); right: calc(var(--safe-r) + 24px); display: flex; gap: 10px; align-items: center; }

/* ---------- HUD ---------- */
.hud { position: fixed; inset: 0; pointer-events: none; padding: calc(var(--safe-t) + 14px) calc(var(--safe-r) + 20px) calc(var(--safe-b) + 14px) calc(var(--safe-l) + 20px); }
.hud::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(4,6,9,.55), rgba(4,6,9,0) 22%, rgba(4,6,9,0) 74%, rgba(4,6,9,.5)); }
.hud * { pointer-events: none; }
.hud .pauseBtn, .hud .muteBtn { pointer-events: auto; }
.score-block { position: absolute; left: calc(var(--safe-l) + 22px); top: calc(var(--safe-t) + 16px); }
.score-block .lbl { font-size: 11px; letter-spacing: .26em; color: var(--dim); }
.score-num { font-family: var(--font-mono); font-weight: 700; font-size: clamp(30px, 4.2vw, 56px); line-height: 1; letter-spacing: -.02em; text-shadow: 0 2px 24px rgba(0,0,0,.7); font-variant-numeric: tabular-nums; }
.mult-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.mult { font-family: var(--font-mono); font-weight: 700; font-size: 18px; color: var(--gold); min-width: 3.4em; transition: transform .1s; }
.mult.pulse { animation: pulse .3s ease; }
@keyframes pulse { 0% { transform: scale(1.5); } 100% { transform: scale(1); } }
.combo { width: clamp(80px, 12vw, 150px); height: 4px; background: rgba(255,255,255,.14); border-radius: 2px; overflow: hidden; }
.combo i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #fff1c2); width: 0; }
.top-mid { position: absolute; left: 50%; top: calc(var(--safe-t) + 16px); transform: translateX(-50%); text-align: center; }
.dist { font-family: var(--font-mono); font-size: 15px; letter-spacing: .08em; color: var(--text); text-shadow: 0 1px 12px rgba(0,0,0,.8); }
.dist small { color: var(--dim); font-size: 11px; letter-spacing: .2em; margin-left: 6px; }
.hazard { margin: 10px auto 0; display: inline-flex; align-items: center; gap: 10px; padding: 6px 16px; border-radius: 2px; font-family: var(--font-display); font-size: 12px; letter-spacing: .14em; background: repeating-linear-gradient(135deg, rgba(255,90,69,.9) 0 10px, rgba(40,10,6,.92) 10px 20px); color: #fff; text-shadow: 0 1px 3px #000; animation: blink .5s steps(2) infinite; }
.hazard.warn { background: repeating-linear-gradient(135deg, rgba(234,184,79,.95) 0 10px, rgba(30,22,4,.92) 10px 20px); }
@keyframes blink { 50% { opacity: .55; } }
.top-right { position: absolute; right: calc(var(--safe-r) + 20px); top: calc(var(--safe-t) + 16px); display: flex; gap: 12px; align-items: center; }
.coins { font-family: var(--font-mono); font-weight: 700; font-size: 22px; color: var(--gold); text-shadow: 0 2px 16px rgba(0,0,0,.7); }
.iconbtn { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 3px; background: var(--panel); }
.iconbtn:hover { border-color: var(--cold); }
.speedo { position: absolute; left: calc(var(--safe-l) + 22px); bottom: calc(var(--safe-b) + 20px); }
.speedo .v { font-family: var(--font-mono); font-weight: 700; font-size: clamp(36px, 5vw, 66px); line-height: .95; letter-spacing: -.03em; text-shadow: 0 2px 26px rgba(0,0,0,.8); font-variant-numeric: tabular-nums; }
.speedo .u { font-size: 12px; letter-spacing: .24em; color: var(--dim); margin-left: 8px; }
.speedo .alt { margin-top: 6px; font-family: var(--font-mono); font-size: 13px; color: var(--cold); letter-spacing: .06em; }
.gauge { position: absolute; left: 50%; bottom: calc(var(--safe-b) + 18px); transform: translateX(-50%); width: min(520px, 46vw); }
.gauge-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; font-size: 11px; letter-spacing: .22em; color: var(--dim); }
.gauge-head .mono { color: var(--text); letter-spacing: .04em; font-size: 13px; }
.segs { display: grid; grid-template-columns: repeat(36, 1fr); gap: 2px; height: 14px; }
.segs i { background: rgba(255,255,255,.1); border-radius: 1px; transition: background .08s; }
.segs i.on { background: linear-gradient(180deg, #b6f1ff, var(--cold-deep)); box-shadow: 0 0 8px rgba(127,227,255,.5); }
.gauge.low .segs i.on { background: linear-gradient(180deg, #ffb1a6, var(--danger)); box-shadow: 0 0 8px rgba(255,90,69,.6); }
.gauge.low .gauge-head .lowtag { color: var(--danger); animation: blink .4s steps(2) infinite; }
.thr { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.thr span { min-width: 54px; text-align: center; padding: 4px 6px; border: 1px solid var(--line); border-radius: 2px; font-size: 10px; letter-spacing: .14em; color: var(--faint); background: rgba(0,0,0,.35); transition: all .06s; }
.thr span b { display: block; font-family: var(--font-mono); font-weight: 600; font-size: 9px; color: var(--faint); letter-spacing: .06em; margin-top: 1px; }
.thr span.on { color: #04141a; background: var(--cold); border-color: var(--cold); box-shadow: 0 0 14px rgba(127,227,255,.6); }
.thr span.on b { color: #0a3a48; }
.shields { position: absolute; right: calc(var(--safe-r) + 22px); bottom: calc(var(--safe-b) + 22px); display: flex; gap: 6px; align-items: center; font-size: 11px; letter-spacing: .2em; color: var(--dim); }
.shields i { width: 14px; height: 14px; border: 2px solid var(--cold); transform: rotate(45deg); }
.shields i.off { border-color: var(--faint); opacity: .5; }
.hint { position: absolute; right: calc(var(--safe-r) + 22px); bottom: calc(var(--safe-b) + 54px); font-size: 12px; color: var(--dim); text-align: right; line-height: 1.9; transition: opacity 1s; }
.hint.fade { opacity: 0; }
.toasts { position: absolute; left: 50%; top: 24%; transform: translateX(-50%); width: min(560px, 90vw); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.toast { display: flex; align-items: baseline; gap: 12px; font-family: var(--font-display); font-size: clamp(15px, 2.1vw, 24px); letter-spacing: .1em; text-shadow: 0 2px 20px rgba(0,0,0,.85); animation: toast 1.7s cubic-bezier(.2,.8,.2,1) both; white-space: nowrap; }
.toast small { font-family: var(--font-mono); font-size: .66em; color: #fff; opacity: .9; letter-spacing: .02em; }
.toast.gold { color: var(--gold); } .toast.cyan { color: var(--cold); } .toast.good { color: var(--ok); } .toast.warn { color: #ffcf6b; } .toast.bad { color: var(--danger); }
@keyframes toast { 0% { opacity: 0; transform: translateY(14px) scale(.9); } 10% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-22px); } }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: clamp(80px, 18vw, 220px); letter-spacing: .02em; text-shadow: 0 8px 80px rgba(0,0,0,.7); }
.countdown span { animation: count .85s ease both; }
.countdown span.go { color: var(--gold); }
@keyframes count { 0% { opacity: 0; transform: scale(1.6); } 25% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(.85); } }
.crashmsg { position: absolute; left: 50%; top: 36%; transform: translateX(-50%); text-align: center; font-family: var(--font-display); }
.crashmsg b { display: block; font-size: clamp(26px, 5vw, 56px); letter-spacing: .08em; color: var(--danger); font-weight: 400; text-shadow: 0 4px 40px rgba(0,0,0,.8); }
.crashmsg span { font-size: 13px; letter-spacing: .2em; color: var(--text); }
.vign-flash { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 40%, rgba(255,60,40,.5)); opacity: 0; transition: opacity .25s; }
.vign-flash.on { opacity: 1; transition: none; }

/* ---------- touch controls ---------- */
.touch { position: fixed; inset: 0; pointer-events: none; }
.touch button { pointer-events: auto; position: absolute; border: 1px solid var(--line-strong); background: rgba(9,12,17,.5); color: var(--text); border-radius: 50%; width: 74px; height: 74px; font-family: var(--font-display); font-size: 11px; letter-spacing: .08em; backdrop-filter: blur(6px); touch-action: none; }
.touch button.down { background: rgba(127,227,255,.35); border-color: var(--cold); }
.touch .tl { left: calc(var(--safe-l) + 18px); bottom: calc(var(--safe-b) + 88px); }
.touch .tr { left: calc(var(--safe-l) + 108px); bottom: calc(var(--safe-b) + 88px); }
.touch .dl { left: calc(var(--safe-l) + 18px); bottom: calc(var(--safe-b) + 170px); width: 58px; height: 58px; }
.touch .dr { left: calc(var(--safe-l) + 118px); bottom: calc(var(--safe-b) + 170px); width: 58px; height: 58px; }
.touch .lf { right: calc(var(--safe-r) + 18px); bottom: calc(var(--safe-b) + 96px); width: 104px; height: 104px; font-size: 13px; background: rgba(234,184,79,.2); border-color: var(--gold); }
.touch .bo { right: calc(var(--safe-r) + 136px); bottom: calc(var(--safe-b) + 96px); width: 64px; height: 64px; }
.touch .dn { right: calc(var(--safe-r) + 136px); bottom: calc(var(--safe-b) + 170px); width: 56px; height: 56px; }
.touch .t1 { right: calc(var(--safe-r) + 18px); bottom: calc(var(--safe-b) + 214px); width: 54px; height: 54px; }
.touch .t2 { right: calc(var(--safe-r) + 82px); bottom: calc(var(--safe-b) + 214px); width: 54px; height: 54px; }

/* ---------- garage ---------- */
.garage-panel { position: absolute; left: calc(var(--safe-l) + 24px); top: calc(var(--safe-t) + 22px); bottom: calc(var(--safe-b) + 22px); width: min(430px, calc(100vw - 48px)); display: flex; flex-direction: column; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); }
.tab { appearance: none; background: transparent; border: 0; padding: 9px 12px; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); border-bottom: 2px solid transparent; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--gold); }
.list { overflow: auto; padding: 8px 10px 12px; display: grid; gap: 6px; align-content: start; flex: 1; touch-action: pan-y; }
.list::-webkit-scrollbar { width: 6px; } .list::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
.item { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 3px; background: rgba(255,255,255,.02); text-align: left; }
.item:hover:not(.locked) { border-color: var(--line-strong); background: rgba(255,255,255,.05); }
.item.eq { border-color: var(--gold); background: rgba(234,184,79,.07); }
.item .sw { width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); box-shadow: inset 0 -6px 10px rgba(0,0,0,.35), inset 0 3px 6px rgba(255,255,255,.3); }
.item .sw.sq { border-radius: 4px; display: grid; place-items: center; font-family: var(--font-mono); font-size: 10px; color: var(--dim); background: rgba(255,255,255,.05); box-shadow: none; }
.item .nm { font-weight: 700; font-size: 15px; letter-spacing: .03em; }
.item .ds { font-size: 12px; color: var(--dim); line-height: 1.3; margin-top: 2px; }
.item .act { font-family: var(--font-mono); font-size: 12px; text-align: right; white-space: nowrap; }
.item .act .btn { padding: 7px 12px; }
.item .tagged { font-size: 10px; letter-spacing: .18em; color: var(--gold); }
.item.locked { opacity: .55; }
.item .lockmsg { color: var(--faint); font-size: 11px; letter-spacing: .08em; }
.pips { display: inline-flex; gap: 3px; margin-top: 4px; }
.pips i { width: 14px; height: 5px; background: rgba(255,255,255,.14); border-radius: 1px; }
.pips i.on { background: var(--cold); box-shadow: 0 0 6px rgba(127,227,255,.5); }
.statbox { position: absolute; right: calc(var(--safe-r) + 24px); bottom: calc(var(--safe-b) + 24px); width: min(330px, calc(100vw - 48px)); padding: 14px 16px; display: grid; gap: 9px; }
.stat { display: grid; grid-template-columns: 96px 1fr 54px; align-items: center; gap: 10px; font-size: 12px; letter-spacing: .08em; color: var(--dim); text-transform: uppercase; }
.stat .bar { height: 5px; background: rgba(255,255,255,.1); border-radius: 3px; overflow: hidden; }
.stat .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--cold-deep), var(--cold)); }
.stat .val { font-family: var(--font-mono); color: var(--text); text-align: right; font-size: 12px; }
.car-title { position: absolute; right: calc(var(--safe-r) + 24px); top: calc(var(--safe-t) + 24px); text-align: right; }
.car-title h3 { margin: 4px 0 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(20px, 3vw, 34px); letter-spacing: .08em; text-transform: uppercase; }
.car-title .eyebrow { color: var(--gold); }
.back { position: absolute; left: calc(var(--safe-l) + 24px); bottom: calc(var(--safe-b) + 22px); }

/* ---------- missions ---------- */
.center-panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(1000px, calc(100vw - 40px)); max-height: calc(100vh - 60px - var(--safe-t) - var(--safe-b)); display: flex; flex-direction: column; }
.two { display: grid; grid-template-columns: 1.05fr .95fr; gap: 0; overflow: auto; min-height: 0; touch-action: pan-y; }
.two > div { padding: 16px 18px 18px; min-width: 0; }
.two > div + div { border-left: 1px solid var(--line); }
.mission { padding: 12px 14px; border: 1px solid var(--line); border-radius: 3px; background: rgba(255,255,255,.02); margin-bottom: 10px; }
.mission .t { font-size: 15px; font-weight: 600; line-height: 1.25; }
.mission .r { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12px; color: var(--dim); }
.mission .bar { height: 5px; background: rgba(255,255,255,.1); border-radius: 3px; overflow: hidden; margin-top: 9px; }
.mission .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #fff1c2); }
.mission .rw { color: var(--gold); font-family: var(--font-mono); }
.tl-row { display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; align-items: baseline; }
.tl-row.reached .lv { color: var(--ok); } .tl-row .lv { font-family: var(--font-mono); font-size: 12px; color: var(--dim); }
.tl-row.reached { color: var(--text); } .tl-row:not(.reached) { color: var(--dim); }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.stats-grid div { padding: 10px; border: 1px solid var(--line); border-radius: 3px; }
.stats-grid b { display: block; font-family: var(--font-mono); font-size: 17px; margin-top: 3px; font-weight: 600; }

/* ---------- ranking ---------- */
.rank-top { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line); align-items: center; }
.rank-top .grow { flex: 1; }
.table { overflow: auto; padding: 4px 8px 8px; min-height: 0; touch-action: pan-y; }
.table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { position: sticky; top: 0; background: var(--panel-solid); text-align: left; padding: 10px 10px; font-size: 11px; letter-spacing: .2em; font-weight: 600; color: var(--dim); text-transform: uppercase; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 10px; border-bottom: 1px solid rgba(176,202,230,.07); }
.table td.n, .table th.n { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.table tr.you td { background: rgba(234,184,79,.1); color: #fff2d2; }
.table td.rk { font-family: var(--font-mono); color: var(--dim); width: 52px; }
.table tr:nth-child(1) td.rk { color: var(--gold); } .table tr:nth-child(2) td.rk { color: #cfd6dd; } .table tr:nth-child(3) td.rk { color: #d79a62; }
.table td.nm { font-weight: 600; letter-spacing: .04em; }
.status { padding: 10px 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--dim); display: flex; gap: 8px; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.off { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.empty { padding: 36px; text-align: center; color: var(--dim); }

/* ---------- settings / modal / pause ---------- */
.modal-wrap { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(2,4,7,.55); backdrop-filter: blur(3px); animation: screen-in .25s ease both; }
.modal { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; }
.modal .body { padding: 18px; display: grid; gap: 14px; }
.modal .foot { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.field { display: grid; grid-template-columns: 1fr minmax(150px, 220px); gap: 14px; align-items: center; }
.field label { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.field select, .field input[type=text], .field input[type=email] { width: 100%; padding: 9px 10px; background: rgba(0,0,0,.4); border: 1px solid var(--line-strong); border-radius: 3px; }
.field input[type=range] { width: 100%; accent-color: var(--cold); }
.ctrl-list { display: grid; gap: 6px; font-size: 13px; }
.ctrl-list div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 5px 0; }
.ctrl-list span { color: var(--dim); }
.pause-btns { display: grid; gap: 8px; padding: 18px; }

/* ---------- game over ---------- */
.over .body { padding: 22px 24px 8px; }
.over .big { font-family: var(--font-mono); font-weight: 700; font-size: clamp(44px, 8vw, 84px); letter-spacing: -.03em; line-height: 1; }
.over .reason { font-family: var(--font-display); font-size: 12px; letter-spacing: .18em; color: var(--danger); text-transform: uppercase; margin-bottom: 8px; }
.over .newbest { display: inline-block; margin-left: 12px; padding: 3px 10px; font-family: var(--font-display); font-size: 11px; letter-spacing: .18em; color: #1a1303; background: var(--gold); border-radius: 2px; vertical-align: middle; }
.over .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-top: 16px; }
.over .grid div { padding: 10px 12px; border: 1px solid var(--line); border-radius: 3px; }
.over .grid b { display: block; font-family: var(--font-mono); font-weight: 600; font-size: 18px; margin-top: 2px; }
.over .rewards { margin: 16px 24px 0; padding: 14px; border: 1px solid var(--line-strong); border-radius: 3px; background: rgba(255,255,255,.03); }
.over .rewards .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; padding: 3px 0; }
.over .unlock { margin-top: 10px; padding: 8px 12px; border-radius: 2px; background: rgba(141,255,176,.1); border: 1px solid rgba(141,255,176,.4); color: var(--ok); font-size: 13px; letter-spacing: .06em; }
.over .rank-line { margin: 14px 24px 0; font-size: 14px; color: var(--dim); min-height: 22px; }
.over .rank-line b { color: var(--gold); font-family: var(--font-mono); }
.over .foot { margin-top: 14px; }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .stage-picker { left: calc(var(--safe-l) + 24px); right: auto; bottom: calc(var(--safe-b) + 40px); max-width: calc(100vw - 48px); overflow-x: auto; padding-bottom: 4px; }
  .stage-card { width: 124px; flex: none; }
  .menu-col { top: calc(var(--safe-t) + 18px); transform: none; gap: 14px; }
  .brand .logo { font-size: 28px; }
  .menu-list { grid-template-columns: 1fr 1fr; }
  .menu-list .btn.primary { grid-column: 1 / -1; }
  .profile { display: none; }
  .two { grid-template-columns: 1fr; }
  .two > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .garage-panel { top: auto; height: 52vh; }
  .statbox { top: calc(var(--safe-t) + 70px); bottom: auto; right: calc(var(--safe-r) + 12px); width: 220px; padding: 10px; }
  .stat { grid-template-columns: 70px 1fr 40px; font-size: 10px; }
  .gauge { width: min(420px, 54vw); }
  .thr { display: none; }
  .hint { display: none; }
}
@media (max-height: 560px) {
  .menu-col { gap: 12px; } .brand .logo { font-size: 24px; } .menu-list .btn { padding: 8px 14px; }
  .stage-picker { display: none; }
  .gauge { bottom: calc(var(--safe-b) + 8px); } .toasts { top: 16%; }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- codex ---------- */
.cx-body { overflow: auto; padding: 6px 22px 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 34px; min-height: 0; touch-action: pan-y; }
.cx h3 { margin: 18px 0 8px; font-family: var(--font-display); font-weight: 400; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.cx ul { margin: 0; padding-left: 18px; display: grid; gap: 7px; font-size: 14px; line-height: 1.4; color: #cdd6e0; }
.cx li::marker { color: var(--faint); }
.cx b { color: var(--text); font-weight: 600; }
.cx-game { margin: 10px 0 0; padding: 8px 12px; border-left: 2px solid var(--cold); background: rgba(127,227,255,.06); font-size: 13px; line-height: 1.4; color: #bfe9f7; }
.cx-game b { color: var(--cold); letter-spacing: .16em; font-size: 10px; margin-right: 8px; }
.cx-src { grid-column: 1 / -1; margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--dim); }
.cx-src a { color: var(--cold); text-decoration: none; border-bottom: 1px dotted var(--cold); }
@media (max-width: 900px) { .cx-body { grid-template-columns: 1fr; } }

/* ---------- first-run controls card ---------- */
.tut { position: absolute; left: 50%; bottom: calc(var(--safe-b) + 112px); transform: translateX(-50%); width: min(640px, calc(100vw - 32px)); padding: 14px 18px 12px; background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line-strong); border-radius: 4px; transition: opacity .8s ease, transform .8s ease; }
.tut.out { opacity: 0; transform: translateX(-50%) translateY(10px); }
.tut-title { font-family: var(--font-display); font-size: 12px; letter-spacing: .2em; color: var(--gold); margin-bottom: 10px; }
.tut-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px 22px; font-size: 14px; }
.tut-grid div { display: flex; align-items: center; gap: 6px; }
.tut-grid span { margin-left: 6px; color: #cdd6e0; }
.tut-tip { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); font-size: 12px; color: var(--dim); }
@media (max-width: 900px), (max-height: 560px) { .tut { display: none; } }

/* ---------- garage live preview ---------- */
.gtip { padding: 8px 18px 0; font-size: 12px; color: var(--dim); }
.item { cursor: pointer; }
.item.pv { border-color: var(--cold); background: rgba(127,227,255,.09); box-shadow: inset 3px 0 0 var(--cold); }
.item.hv { border-color: var(--line-strong); background: rgba(255,255,255,.06); }
.item.eq.pv { border-color: var(--gold); }
.stat .bar { position: relative; }
.stat .bar b { position: absolute; top: 0; height: 100%; }
.stat .bar b.up { background: var(--ok); box-shadow: 0 0 8px rgba(141,255,176,.6); }
.stat .bar b.down { background: var(--danger); opacity: .8; }
.stat .val em { font-style: normal; }
.stat .val em.up { color: var(--ok); } .stat .val em.down { color: var(--danger); }
.stat { grid-template-columns: 96px 1fr 104px; }
.stat .val { white-space: nowrap; }
.statbox { width: min(380px, calc(100vw - 48px)); }
.hots { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
.hot { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: auto; padding: 0; border: 0; background: transparent; color: var(--text); transform: translate(-50px, -50px); will-change: transform; opacity: 0; transition: opacity .15s; }
.hot i { width: 22px; height: 22px; position: absolute; left: -11px; top: -11px; border-radius: 50%; border: 2px solid rgba(255,255,255,.9); background: rgba(6,8,11,.55); box-shadow: 0 0 0 3px rgba(127,227,255,.22), 0 4px 14px rgba(0,0,0,.5); }
.hot i::after { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: var(--cold); }
.hot span { position: absolute; left: 18px; top: -12px; padding: 3px 9px; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--panel); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; opacity: 0; transform: translateX(-6px); transition: opacity .15s, transform .15s; }
.hot:hover span, .hot:focus-visible span { opacity: 1; transform: none; }
.hot:hover i { background: rgba(127,227,255,.35); }
.gbar { position: absolute; left: 50%; bottom: calc(var(--safe-b) + 24px); transform: translateX(-4%); width: min(560px, calc(100vw - 480px)); min-width: 360px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.gb-info { display: grid; gap: 2px; min-width: 0; }
.gb-info b { font-family: var(--font-display); font-weight: 400; font-size: 14px; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gb-meta { font-family: var(--font-mono); font-size: 12px; color: var(--gold); }
.gb-meta .need { color: var(--danger); }
.gb-btns { display: flex; gap: 8px; flex: none; }
@media (max-width: 900px) { .gbar { left: 12px; right: 12px; transform: none; width: auto; min-width: 0; bottom: calc(var(--safe-b) + 54vh + 8px); } .hot span { display: none; } }

.trial-tag { margin: 8px auto 0; display: inline-block; padding: 4px 12px; font-family: var(--font-display); font-size: 10px; letter-spacing: .18em; color: #04141a; background: var(--cold); border-radius: 2px; }

/* garage layout: title + stats on the right, preview bar under them */
.statbox { top: calc(var(--safe-t) + 104px); bottom: auto; right: calc(var(--safe-r) + 24px); }
.gbar { left: auto; right: calc(var(--safe-r) + 24px); transform: none; bottom: calc(var(--safe-b) + 22px); width: min(520px, calc(100vw - 500px)); min-width: 380px; }
@media (max-width: 900px) {
  .statbox { top: calc(var(--safe-t) + 64px); right: calc(var(--safe-r) + 12px); width: 250px; }
  .gbar { left: 12px; right: 12px; width: auto; min-width: 0; bottom: calc(var(--safe-b) + 54vh + 8px); }
}

/* ---------- menu tweaks ---------- */
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.menu-grid .btn { padding: 11px 14px; }
.btn.big2 { padding: 14px 20px; font-size: 15px; }

/* ---------- career ---------- */
.lvl-total { font-family: var(--font-mono); font-size: 14px; color: var(--gold); }
.career-body { overflow: auto; padding: 8px 20px 22px; display: grid; gap: 6px; min-height: 0; touch-action: pan-y; }
.chap { padding-top: 10px; }
.chap-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.chap-head .sw { width: 38px; height: 38px; border-radius: 3px; border: 1px solid var(--line-strong); flex: none; }
.chap-head b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }
.chap-head span:not(.sw) { font-size: 12px; color: var(--dim); }
.lvls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.lcard { appearance: none; display: grid; grid-template-columns: 38px 1fr; grid-template-rows: auto auto; gap: 2px 12px; align-items: center; padding: 12px 14px; text-align: left; border: 1px solid var(--line); border-radius: 3px; background: rgba(255,255,255,.025); transition: border-color .15s, background .15s, transform .12s; min-height: 82px; }
.lcard:hover:not(:disabled) { border-color: var(--cold); background: rgba(127,227,255,.08); transform: translateY(-1px); }
.lcard .n { grid-row: 1 / 3; font-family: var(--font-display); font-size: 22px; color: var(--cold); text-align: center; }
.lcard .t { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lcard .t b { font-size: 15px; letter-spacing: .04em; }
.lcard .sub { font-size: 12px; color: var(--dim); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stars { display: inline-flex; gap: 1px; } .stars i, .bigstars i { font-style: normal; color: rgba(255,255,255,.2); }
.stars i.on, .bigstars i.on { color: var(--gold); text-shadow: 0 0 10px rgba(234,184,79,.6); }
.lcard.done { border-color: rgba(234,184,79,.45); } .lcard.done .n { color: var(--gold); }
.lcard.locked { opacity: .45; cursor: not-allowed; } .lcard.locked .n { color: var(--faint); }
.objs { list-style: none; margin: 8px 0 12px; padding: 0; display: grid; gap: 6px; }
.objs li { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 3px; font-size: 14px; background: rgba(255,255,255,.02); }
.objs li .chk { color: var(--faint); font-size: 18px; } .objs li.got .chk { color: var(--gold); } .objs li.got { border-color: rgba(234,184,79,.5); background: rgba(234,184,79,.06); }
.objs li em { font-style: normal; font-family: var(--font-mono); font-size: 12px; color: var(--gold); }
.brief { margin: 0; font-size: 15px; line-height: 1.45; color: #d5dde7; }
.bigstars { font-size: clamp(40px, 8vw, 72px); letter-spacing: 8px; line-height: 1; margin: 4px 0 8px; }
.bigstars i { display: inline-block; animation: starpop .6s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes starpop { 0% { transform: scale(0) rotate(-40deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@media (max-width: 900px) { .lvls { grid-template-columns: 1fr; } }

/* HUD: career objectives */
.lvl-tag { margin-top: 6px; font-family: var(--font-display); font-size: 11px; letter-spacing: .16em; color: var(--cold); text-shadow: 0 1px 10px rgba(0,0,0,.8); }
.prog { width: min(300px, 40vw); height: 4px; margin: 6px auto 0; background: rgba(255,255,255,.16); border-radius: 2px; overflow: hidden; }
.prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cold-deep), var(--cold)); }
.hobjs { position: absolute; left: calc(var(--safe-l) + 22px); top: calc(var(--safe-t) + 112px); margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 13px; text-shadow: 0 1px 8px rgba(0,0,0,.9); }
.hobjs li { color: #dfe7f0; } .hobjs li span { display: inline-block; width: 18px; color: var(--dim); } .hobjs li.got { color: var(--gold); } .hobjs li.got span { color: var(--gold); }
.hobjs em { font-style: normal; font-family: var(--font-mono); font-size: 11px; color: var(--dim); margin-left: 6px; }

/* black cut between loops of the menu show */
.cut { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .4s ease; z-index: 0; }
.cut.on { opacity: 1; }

/* account modals */
.modal input { user-select: text; -webkit-user-select: text; }
.field.stack { grid-template-columns: 1fr; gap: 6px; }
.row { display: flex; gap: 8px; align-items: center; }
.row input { flex: 1; min-width: 0; }
.lead { margin: 0; color: var(--dim); line-height: 1.5; font-size: 14px; }
.lead b { color: var(--text); font-weight: 600; }
.chk { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; line-height: 1.45; color: var(--dim); cursor: pointer; }
.chk input { margin-top: 2px; accent-color: var(--gold); width: 16px; height: 16px; flex: none; }
.keybox { font-family: var(--font-mono); font-size: clamp(17px, 4.6vw, 26px); letter-spacing: .12em; text-align: center; padding: 16px 8px; border: 1px dashed var(--gold); border-radius: 4px; color: #fff4d9; background: rgba(234,184,79,.07); user-select: all; -webkit-user-select: all; word-break: break-all; }
.acerr { color: var(--danger); font-size: 13px; min-height: 1.2em; }
.acok { color: var(--ok); font-size: 13px; }
.acct { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: 3px; font-size: 13px; line-height: 1.5; }
.acct small { color: var(--dim); }
.acct-btns { display: flex; gap: 8px; }
