:root {
  --bg: #0b101b;
  --panel: rgba(12, 17, 29, 0.82);
  --panel-2: rgba(22, 30, 48, 0.9);
  --line: rgba(255, 255, 255, 0.09);
  --text: #eef3fb;
  --muted: #95a3bb;
  --accent: #39c6f0;
  --accent-2: #2f86eb;
  --gold: #ffd23c;
  --red: #ff5a4a;
  --green: #3dff8b;
  --cut: 14px;
  --font: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { touch-action: none; user-select: none; -webkit-user-select: none; }
#game { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; outline: none; }
#ui { position: fixed; inset: 0; pointer-events: none; }
.layer { position: absolute; inset: 0; pointer-events: none; }
.layer > * { pointer-events: auto; }
.hud-layer { display: none; }
.hud-layer.on { display: block; }
.hud-layer > * { pointer-events: none; }
.overlay-layer.on { background: rgba(5, 8, 14, 0.55); backdrop-filter: blur(3px); pointer-events: auto; }
button { font-family: inherit; }
input, select { font-family: inherit; user-select: text; -webkit-user-select: text; }
.noscript { color: #fff; padding: 2em; }

/* ---------- boot ---------- */
#boot { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; background: radial-gradient(ellipse at 50% 40%, #1a2742 0%, #0b101b 70%); z-index: 50; transition: opacity 0.6s; }
#boot.gone { opacity: 0; pointer-events: none; }
.boot-logo { font-size: 64px; font-weight: 900; font-style: italic; letter-spacing: 2px; }
.boot-logo span { color: var(--accent); }
.boot-bar { width: 240px; height: 4px; background: rgba(255,255,255,0.1); overflow: hidden; }
.boot-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transform: scaleX(0); transform-origin: left; transition: transform 0.2s; }
.boot-msg { color: var(--muted); font-size: 13px; letter-spacing: 3px; text-transform: uppercase; }

/* ---------- common ---------- */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 28px 36px; opacity: 0; transform: translateY(8px); transition: opacity 0.25s, transform 0.25s; }
.screen.in { opacity: 1; transform: none; }
.panel { background: var(--panel); border: 1px solid var(--line); padding: 18px 20px; clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut)); backdrop-filter: blur(8px); }
.panel h3 { margin: 0 0 12px; font-size: 13px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.panel h3 small { letter-spacing: 0.5px; text-transform: none; font-weight: 500; opacity: 0.8; }
.screen-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.screen-head h1 { margin: 0; font-size: 34px; font-weight: 900; font-style: italic; letter-spacing: 1px; text-transform: uppercase; }
.note { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 8px 0 0; }
.ico { display: inline-flex; width: 1.15em; height: 1.15em; }
.ico svg { width: 100%; height: 100%; fill: currentColor; }

.btn { --b: rgba(255,255,255,0.08); position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 11px 22px; border: 0; color: var(--text); background: var(--b); font-size: 15px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; cursor: pointer; clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%); transition: background 0.15s, transform 0.12s, color 0.15s; white-space: nowrap; }
.btn:hover, .btn:focus-visible { background: rgba(255,255,255,0.18); outline: none; transform: translateX(3px); }
.btn:active { transform: translateX(3px) scale(0.98); }
.btn.primary { background: linear-gradient(100deg, var(--accent-2), var(--accent)); color: #06121f; }
.btn.primary:hover, .btn.primary:focus-visible { background: linear-gradient(100deg, #4b9bff, #6fdcff); }
.btn.primary.on { background: linear-gradient(100deg, #1fb56a, var(--green)); }
.btn.danger { background: rgba(255, 90, 74, 0.18); color: #ffb3aa; }
.btn.danger:hover { background: rgba(255, 90, 74, 0.35); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.big { padding: 16px 30px; font-size: 18px; }
.btn.wide { width: 100%; }
.btn.small { padding: 7px 14px; font-size: 12px; }
.btn.tiny { padding: 4px 10px; font-size: 11px; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.icon-btn { padding: 10px 14px; clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%); }
.icon-btn .ico { width: 20px; height: 20px; }
.icon-btn.small { padding: 6px 10px; }
.icon-btn.small .ico { width: 16px; height: 16px; }

.tabs { display: flex; gap: 4px; }
.tab { background: rgba(255,255,255,0.06); border: 0; color: var(--muted); padding: 8px 16px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; font-size: 13px; cursor: pointer; clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
.tab.on { background: var(--accent); color: #06121f; }

.choice { display: flex; gap: 3px; flex-wrap: wrap; }
.choice button, .seg, .toggle { background: rgba(255,255,255,0.07); border: 0; color: var(--muted); padding: 8px 14px; font-weight: 700; font-size: 13px; cursor: pointer; letter-spacing: 0.5px; clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
.choice button.on, .seg.on, .toggle.on { background: var(--accent); color: #06121f; }
.choice button:hover, .seg:hover, .toggle:hover { color: var(--text); }
.choice button.on:hover, .seg.on:hover, .toggle.on:hover { color: #06121f; }
.stepper { display: flex; align-items: center; gap: 2px; }
.stepper button { width: 34px; height: 32px; background: rgba(255,255,255,0.08); border: 0; color: var(--text); font-size: 18px; cursor: pointer; }
.stepper button:hover { background: rgba(255,255,255,0.18); }
.stepper b { min-width: 40px; text-align: center; font-size: 17px; }

.medal { display: inline-block; width: 16px; height: 16px; clip-path: polygon(50% 0, 100% 38%, 82% 100%, 18% 100%, 0 38%); background: rgba(255,255,255,0.12); vertical-align: -3px; }
.medal.big { width: 54px; height: 54px; }
.medal.author { background: linear-gradient(135deg, #7ff6ff, #2f86eb 60%, #1b3f9a); }
.medal.gold { background: linear-gradient(135deg, #fff2a8, #ffd23c 50%, #c88a0c); }
.medal.silver { background: linear-gradient(135deg, #ffffff, #c9ced6 50%, #7f8a99); }
.medal.bronze { background: linear-gradient(135deg, #ffd0a0, #d0874a 50%, #8b4d22); }

.name-input, .code-input, .num-input, .chat-input, .track-select { background: rgba(0,0,0,0.35); border: 1px solid var(--line); color: var(--text); padding: 10px 12px; font-size: 16px; outline: none; }
.name-input:focus, .code-input:focus, .num-input:focus, .chat-input:focus { border-color: var(--accent); }
.track-select { font-size: 14px; max-width: 220px; }
.track-select option { background: #121a2a; }

/* ---------- logo / title ---------- */
.logo { display: flex; align-items: center; gap: 14px; }
.logo-mark { width: 64px; height: 64px; display: block; flex: none; filter: drop-shadow(0 6px 18px rgba(0,0,0,0.5)); }
.logo-mark svg { width: 100%; height: 100%; }
.logo-word { position: relative; white-space: nowrap; font-size: 56px; font-weight: 900; font-style: italic; letter-spacing: 1px; line-height: 1; text-shadow: 0 4px 24px rgba(0,0,0,0.55); }
.logo-word b { color: #fff; }
.logo-word i { color: var(--accent); font-style: italic; }
/* the PRO tag hangs under the end of TRACK */
.logo-word em, .boot-logo em { position: absolute; right: 0.1em; bottom: -1em; padding: 0.12em 0.34em 0.08em; font-size: 0.3em; font-style: italic; font-weight: 900; letter-spacing: 3px; line-height: 1; color: #0b101b; background: linear-gradient(135deg, #ffe066, #f39c34); transform: skewX(-10deg); text-shadow: none; box-shadow: 0 4px 14px rgba(0,0,0,0.35); }
.boot-logo { position: relative; }
.logo.big .logo-mark { width: 88px; height: 88px; }
.logo.big .logo-word { font-size: 82px; }
.logo.small .logo-mark { width: 40px; height: 40px; }
.logo.small .logo-word { font-size: 30px; }
.title-screen { justify-content: space-between; background: linear-gradient(90deg, rgba(8,12,22,0.86) 0%, rgba(8,12,22,0.55) 36%, rgba(8,12,22,0) 62%); }
.title-left { display: flex; flex-direction: column; gap: 18px; max-width: 680px; margin-top: 4vh; }
.tagline { color: #c7d3e8; font-size: 17px; margin: -4px 0 12px 6px; text-shadow: 0 2px 10px rgba(0,0,0,0.6); }
.menu-stack { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.menu-stack .btn { min-width: 300px; justify-content: flex-start; }
.menu-stack .btn .ico { width: 22px; height: 22px; }
.title-stats { display: flex; gap: 26px; margin: 16px 0 0 6px; }
.title-stats div { display: flex; flex-direction: column; }
.title-stats b { font-size: 26px; font-style: italic; }
.title-stats span { color: var(--muted); font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; }
.title-foot { display: flex; gap: 22px; align-items: center; color: rgba(255,255,255,0.55); font-size: 12px; letter-spacing: 1px; }
.fs-btn { margin-left: auto; background: rgba(255,255,255,0.08); border: 0; color: #d8e2f2; padding: 7px 12px; font-size: 12px; letter-spacing: 1px; cursor: pointer; }
.fs-btn:hover { background: rgba(255,255,255,0.18); }

/* ---------- track select ---------- */
.play-screen { background: rgba(8,12,22,0.8); backdrop-filter: blur(6px); }
.play-body { display: grid; grid-template-columns: 1fr 380px; gap: 22px; min-height: 0; flex: 1; }
.track-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; overflow-y: auto; align-content: start; padding: 2px 8px 20px 2px; }
.track-card { position: relative; display: flex; flex-direction: column; text-align: left; padding: 0; border: 2px solid transparent; background: var(--panel-2); color: var(--text); cursor: pointer; clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px); transition: transform 0.12s, border-color 0.12s; }
.track-card:hover, .track-card:focus-visible { transform: translateY(-2px); outline: none; border-color: rgba(255,255,255,0.25); }
.track-card.sel { border-color: var(--accent); }
.td-body { display: contents; }
.tc-thumb.new { display: flex; align-items: center; justify-content: center; aspect-ratio: 240 / 150; background: rgba(57,198,240,0.1); color: var(--accent); }
.tc-thumb.new .ico { width: 48px; height: 48px; }
.tc-thumb canvas { display: block; width: 100%; height: auto; aspect-ratio: 240 / 150; }
.tc-num { position: absolute; top: 6px; left: 12px; font-weight: 900; font-style: italic; font-size: 22px; text-shadow: 0 2px 6px rgba(0,0,0,0.8); }
.tc-info { padding: 9px 12px 11px; display: flex; flex-direction: column; gap: 4px; }
.tc-name { font-weight: 800; font-size: 16px; font-style: italic; }
.tc-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.tc-type { color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; font-size: 11px; }
.tc-best { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; font-size: 13px; color: #d5deec; }
.tc-diff { position: absolute; top: 10px; right: 10px; display: flex; gap: 3px; }
.tc-diff i { width: 7px; height: 12px; background: rgba(255,255,255,0.25); transform: skewX(-15deg); }
.tc-diff i.on { background: var(--gold); }
.tc-diff.extreme i.on { background: #ff4a3d; box-shadow: 0 0 8px rgba(255,74,61,0.7); }
.medal-summary { margin-left: auto; display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--muted); }
.medal-summary .medal { margin-left: 8px; }
.track-detail { background: var(--panel); border: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px); }
.td-map canvas { width: 100%; height: auto; background: rgba(0,0,0,0.25); display: block; }
.td-title h2 { margin: 0; font-size: 28px; font-style: italic; font-weight: 900; }
.td-sub { color: var(--muted); font-size: 13px; }
.td-feats { display: flex; flex-wrap: wrap; gap: 5px; }
.td-credit { font-size: 11px; color: var(--muted); }
.feat { background: rgba(57,198,240,0.14); color: #9fe6ff; padding: 3px 9px; font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.td-medals, .res-ladder { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 14px; }
.tdm { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.tdm b { margin-left: auto; font-variant-numeric: tabular-nums; color: #cdd6e4; font-weight: 600; }
.tdm.got b { color: var(--green); }
.td-best { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); padding-top: 10px; }
.td-best span { color: var(--muted); font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; }
.td-best b { font-size: 22px; font-variant-numeric: tabular-nums; font-style: italic; }
.segs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.seg { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 11px; font-size: 14px; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opts.hint { color: var(--muted); font-size: 13px; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.opt > span { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; }

/* ---------- garage ---------- */
.garage-screen { flex-direction: row; padding: 0; gap: 0; }
.garage-left { width: 440px; max-width: 100%; height: 100%; display: flex; flex-direction: column; gap: 12px; padding: 24px; background: linear-gradient(90deg, rgba(10,14,24,0.95), rgba(10,14,24,0.86)); border-right: 1px solid var(--line); }
.garage-view { flex: 1; cursor: grab; }
.garage-view:active { cursor: grabbing; }
.garage-name { display: flex; align-items: center; gap: 10px; }
.garage-name label { color: var(--muted); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; }
.garage-name input { flex: 1; }
.garage-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.gtab { background: rgba(255,255,255,0.06); border: 0; color: var(--muted); padding: 8px 12px; font-weight: 700; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; cursor: pointer; clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
.gtab.on { background: var(--accent); color: #06121f; }
.garage-panel-body { flex: 1; overflow-y: auto; padding-right: 6px; display: flex; flex-direction: column; gap: 14px; }
.gsec h3 { margin: 0 0 8px; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.garage-actions { display: flex; gap: 8px; justify-content: space-between; }
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.swatch { position: relative; aspect-ratio: 1; border: 2px solid rgba(255,255,255,0.12); cursor: pointer; clip-path: polygon(25% 0, 100% 0, 100% 75%, 75% 100%, 0 100%, 0 25%); background: #333; display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 800; font-size: 18px; }
.swatch.on { border-color: #fff; box-shadow: inset 0 0 0 2px #0008; }
.swatch.custom { background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); color: #fff; text-shadow: 0 1px 3px #000; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.swatch.none { background: rgba(255,255,255,0.05); }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.opt-card { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 10px 12px; background: rgba(255,255,255,0.06); border: 2px solid transparent; color: var(--text); cursor: pointer; clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
.opt-card b { font-size: 14px; font-style: italic; }
.opt-card span { font-size: 11px; color: var(--muted); }
.opt-card:hover { background: rgba(255,255,255,0.11); }
.opt-card.on { border-color: var(--accent); background: rgba(57,198,240,0.12); }
.opt-card.preset { flex-direction: row; align-items: center; gap: 10px; }
.pchip { display: inline-block; width: 26px; height: 16px; background: linear-gradient(135deg, var(--c1) 55%, var(--c2) 55%); clip-path: polygon(20% 0, 100% 0, 80% 100%, 0 100%); flex: none; }
.row { display: flex; gap: 8px; align-items: center; }
.num-input { width: 80px; padding: 7px 10px; }

/* ---------- online ---------- */
.online-screen, .lobby-screen, .settings-screen { background: rgba(8,12,22,0.78); backdrop-filter: blur(6px); }
.online-body { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding-top: 4vh; }
.online-card { width: 480px; max-width: 100%; display: flex; flex-direction: column; gap: 14px; }
.online-card h2 { margin: 0; font-style: italic; font-size: 26px; }
.online-card p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { color: var(--muted); font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.join-row { display: flex; gap: 8px; }
.code-input { flex: 1; width: 0; min-width: 0; font-size: 26px; letter-spacing: 10px; text-align: center; font-weight: 800; text-transform: uppercase; }
.join-row .btn { flex: none; }
.net-status { min-height: 20px; color: var(--muted); font-size: 14px; }
.net-status.busy::after { content: ''; display: inline-block; width: 12px; height: 12px; margin-left: 8px; border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -2px; }
.net-status.err { color: #ffb3aa; }
@keyframes spin { to { transform: rotate(360deg); } }
.room-code { margin-left: auto; display: flex; align-items: center; gap: 10px; background: var(--panel); padding: 6px 8px 6px 16px; border: 1px solid var(--line); }
.room-code span { color: var(--muted); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; }
.room-code b { font-size: 30px; letter-spacing: 7px; font-weight: 900; color: var(--gold); }
.lobby-body { flex: 1; display: grid; grid-template-columns: 1fr 380px; gap: 20px; min-height: 0; }
.lobby-main { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.lobby-right { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; }
.lobby-side .panel { display: flex; flex-direction: column; gap: 10px; }
.lobby-track { display: flex; flex-direction: column; gap: 6px; }
.lobby-track canvas { width: 100%; height: auto; display: block; }
.lobby-track b { font-size: 20px; font-style: italic; }
.lobby-track span { color: var(--muted); font-size: 13px; display: block; }
.lobby-action { display: flex; flex-direction: column; gap: 8px; }
.wait-note { color: var(--muted); font-size: 13px; text-align: center; }
.roster { display: flex; flex-direction: column; gap: 5px; }
.player { display: flex; align-items: center; gap: 12px; padding: 9px 12px; background: rgba(255,255,255,0.05); }
.player.me { background: rgba(57,198,240,0.12); }
.player .pchip { width: 30px; height: 18px; background: linear-gradient(135deg, currentColor 60%, var(--acc) 60%); }
.player .pchip.bot { background: rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.pname { font-weight: 700; flex: 1; }
.player.bot .pname { color: var(--muted); font-weight: 500; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; padding: 3px 8px; }
.tag.host { color: var(--gold); }
.tag.ready { color: var(--green); }
.tag.wait { color: var(--muted); }
.ping { color: var(--muted); font-size: 12px; min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; }
.chat { flex: 1; display: flex; flex-direction: column; min-height: 180px; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; font-size: 14px; padding-right: 6px; min-height: 80px; }
.msg { line-height: 1.4; word-break: break-word; }
.msg.sys { color: var(--muted); font-style: italic; font-size: 12px; }
.chat-row { display: flex; gap: 6px; margin-top: 10px; }
.chat-input { flex: 1; font-size: 14px; padding: 8px 10px; }

/* ---------- settings ---------- */
.settings-body { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 14px; align-content: start; padding-bottom: 20px; }
.set-sec { display: flex; flex-direction: column; gap: 10px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.set-label { display: flex; flex-direction: column; font-size: 15px; }
.set-label small { color: var(--muted); font-size: 12px; }
.slider-row { display: flex; align-items: center; gap: 10px; }
.slider-row b { min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.slider { width: 170px; accent-color: var(--accent); }
.keys { display: flex; flex-direction: column; gap: 5px; }
.key-row { display: grid; grid-template-columns: 1fr auto 90px; gap: 10px; align-items: center; font-size: 14px; }
kbd { background: rgba(255,255,255,0.1); border-bottom: 2px solid rgba(255,255,255,0.18); padding: 3px 8px; font-family: inherit; font-size: 12px; font-weight: 700; text-align: center; }
kbd.pad { background: rgba(57,198,240,0.14); color: #9fe6ff; }
.settings-screen.as-overlay { background: rgba(8,12,22,0.92); }

/* ---------- pause ---------- */
.pause-screen { align-items: center; justify-content: center; }
.pause-card { width: 380px; display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.pause-card h2 { margin: 6px 0; font-style: italic; font-size: 30px; }
.pause-card .logo { justify-content: center; }

/* ---------- results ---------- */
.results-screen { align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(8,12,22,0.55), rgba(8,12,22,0.85)); }
.res-card { width: 520px; max-width: 100%; display: flex; flex-direction: column; gap: 12px; align-items: stretch; text-align: center; max-height: 100%; overflow-y: auto; }
.res-track { color: var(--muted); letter-spacing: 3px; text-transform: uppercase; font-size: 13px; font-weight: 700; }
.res-time { font-size: 64px; font-weight: 900; font-style: italic; font-variant-numeric: tabular-nums; line-height: 1; }
.res-time.pb { color: var(--gold); text-shadow: 0 0 30px rgba(255,210,60,0.35); }
.res-badge { color: var(--gold); letter-spacing: 3px; font-weight: 800; font-size: 13px; }
.res-sub { color: var(--muted); font-size: 14px; }
.res-medal { display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 22px; font-weight: 800; font-style: italic; }
.res-ladder { text-align: left; }
.res-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 6px; }
.standings { display: flex; flex-direction: column; gap: 3px; text-align: left; }
.st-row { display: grid; grid-template-columns: 26px 22px 1fr auto; align-items: center; gap: 8px; padding: 6px 10px; background: rgba(255,255,255,0.05); font-size: 14px; }
.st-row.me { background: rgba(57,198,240,0.16); }
.st-pos { font-weight: 900; font-style: italic; }
.st-chip { width: 18px; height: 12px; clip-path: polygon(20% 0, 100% 0, 80% 100%, 0 100%); }
.st-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.st-gap { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }

/* ---------- HUD ---------- */
.hud { position: absolute; inset: 0; font-style: italic; }
.hud-top { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hud-timer { font-size: 44px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: 1px; text-shadow: 0 2px 12px rgba(0,0,0,0.6), 0 0 2px #000; }
.hud-timer.done { color: var(--gold); }
.hud-sub { font-size: 14px; color: #dce6f5; text-shadow: 0 1px 6px #000; font-weight: 700; font-style: normal; letter-spacing: 1px; }
.hud-split { margin-top: 8px; display: flex; gap: 12px; align-items: baseline; background: rgba(8,12,22,0.7); padding: 6px 16px; opacity: 0; transform: translateY(-6px); transition: opacity 0.2s, transform 0.2s; clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%); }
.hud-split.show { opacity: 1; transform: none; }
.hud-split .l { font-size: 12px; letter-spacing: 2px; color: var(--muted); font-weight: 800; font-style: normal; }
.hud-split .t { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hud-split .d { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; }
.hud-split .d.good { color: var(--green); }
.hud-split .d.bad { color: var(--red); }
.hud-left { position: absolute; top: 18px; left: 22px; display: flex; flex-direction: column; gap: 2px; text-shadow: 0 2px 10px rgba(0,0,0,0.7); }
.hud-pos { font-size: 56px; font-weight: 900; line-height: 1; }
.hud-pos small { font-size: 24px; opacity: 0.75; }
.hud-lap { font-size: 22px; font-weight: 900; }
.hud-cp { font-size: 15px; font-weight: 800; color: #d9e3f3; font-style: normal; letter-spacing: 1px; }
.hud-map { position: absolute; top: 14px; right: 14px; width: 190px; height: 190px; background: rgba(8,12,22,0.45); clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px); }
.hud-speedo { position: absolute; right: 26px; bottom: 22px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-shadow: 0 2px 12px rgba(0,0,0,0.6); }
.hud-speed-row { display: flex; align-items: flex-end; gap: 10px; }
.hud-speed-num { font-size: 72px; font-weight: 900; line-height: 0.85; font-variant-numeric: tabular-nums; min-width: 140px; text-align: right; }
.hud-speed-side { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.hud-speed-unit { font-size: 13px; font-weight: 800; letter-spacing: 2px; font-style: normal; color: #dce6f5; }
.hud-gear { font-size: 30px; font-weight: 900; background: rgba(8,12,22,0.6); min-width: 44px; text-align: center; clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%); }
.hud-rpm, .hud-boost { width: 210px; height: 8px; background: rgba(8,12,22,0.55); transform: skewX(-20deg); overflow: hidden; }
.hud-rpm i, .hud-boost i { display: block; height: 100%; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, #2f86eb, #39c6f0 70%, #fff); transition: transform 0.05s linear; }
.hud-rpm i.red { background: linear-gradient(90deg, #ff9b3d, #ff4a3d); }
.hud-boost { height: 5px; width: 160px; }
.hud-boost i { background: linear-gradient(90deg, #ff3df0, #39e6ff); }
.hud-center { position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%); text-align: center; }
.hud-count { font-size: 150px; font-weight: 900; line-height: 1; opacity: 0; color: #fff; text-shadow: 0 6px 40px rgba(0,0,0,0.6); }
.hud-count.show { opacity: 1; }
.hud-count.pop { animation: pop 0.9s ease-out forwards; }
.hud-count.go { color: var(--green); }
@keyframes pop { 0% { transform: scale(1.6); opacity: 0; } 15% { transform: scale(1); opacity: 1; } 70% { opacity: 1; } 100% { transform: scale(0.85); opacity: 0; } }
.hud-msg { font-size: 42px; font-weight: 900; letter-spacing: 2px; opacity: 0; transition: opacity 0.2s; text-shadow: 0 4px 24px rgba(0,0,0,0.6); }
.hud-msg.show { opacity: 1; }
.hud-msg.warn { color: var(--red); animation: blink 0.5s steps(2) infinite; }
.hud-msg.lap { color: var(--gold); }
.hud-msg.go { color: var(--green); font-size: 0; }
@keyframes blink { 50% { opacity: 0.35; } }
/* finish celebration */
.hud.finishing .hud-top, .hud.finishing .hud-left, .hud.finishing .hud-speedo, .hud.finishing .hud-map, .hud.finishing .hud-standings, .hud.finishing .hud-hint { opacity: 0.18; transition: opacity 0.4s; }
.finish-fx { position: absolute; inset: 0; overflow: hidden; pointer-events: none; font-style: italic; }
.ff-flash { position: absolute; inset: 0; background: #fff; animation: ffFlash 0.45s ease-out forwards; }
.ff-band { position: absolute; left: -20%; width: 140%; height: 74px; transform: translateX(-110%) skewY(-4deg);
  background-image: linear-gradient(45deg, #111 25%, transparent 25%, transparent 75%, #111 75%), linear-gradient(45deg, #111 25%, #f4f4f4 25%, #f4f4f4 75%, #111 75%);
  background-size: 37px 37px; background-position: 0 0, 18.5px 18.5px; box-shadow: 0 8px 30px rgba(0,0,0,0.5); opacity: 0.95; }
.ff-band.a { top: 22%; animation: ffBand 1.1s cubic-bezier(.2,.8,.2,1) 0.05s forwards; }
.ff-band.b { top: auto; bottom: 20%; animation: ffBandR 1.1s cubic-bezier(.2,.8,.2,1) 0.18s forwards; transform: translateX(110%) skewY(-4deg); }
.ff-center { position: absolute; left: 50%; top: 47%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; white-space: nowrap; }
.ff-kicker { font-size: clamp(18px, 2.4vw, 30px); font-weight: 900; letter-spacing: 8px; color: #fff; opacity: 0; animation: ffUp 0.45s ease-out 0.45s forwards; text-shadow: 0 3px 16px rgba(0,0,0,0.8); }
.ff-title { position: relative; font-size: clamp(84px, 13vw, 190px); font-weight: 900; line-height: 0.95; letter-spacing: 2px; color: #fff; opacity: 0;
  background: linear-gradient(180deg, #ffffff 0%, #bff3ff 45%, #39c6f0 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 6px 0 rgba(0,0,0,0.45)) drop-shadow(0 0 28px rgba(57,198,240,0.55)); animation: ffSlam 0.55s cubic-bezier(.15,1.4,.35,1) 0.12s forwards; }
.finish-fx.gold .ff-title { background: linear-gradient(180deg, #fffbe6 0%, #ffe27a 45%, #ffb13d 100%); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 6px 0 rgba(0,0,0,0.45)) drop-shadow(0 0 30px rgba(255,190,60,0.6)); }
.ff-time { font-size: clamp(34px, 4.6vw, 64px); font-weight: 900; font-variant-numeric: tabular-nums; color: #fff; opacity: 0; animation: ffUp 0.45s ease-out 0.6s forwards; text-shadow: 0 4px 20px rgba(0,0,0,0.8); }
.ff-sub { font-size: clamp(15px, 1.7vw, 22px); font-weight: 900; letter-spacing: 4px; color: var(--gold); opacity: 0; animation: ffUp 0.4s ease-out 0.85s forwards, ffPulse 0.9s ease-in-out 1.3s infinite alternate; text-shadow: 0 3px 14px rgba(0,0,0,0.8); }
.finish-fx.out { animation: ffOut 0.45s ease-in forwards; }
@keyframes ffFlash { 0% { opacity: 0.85; } 100% { opacity: 0; } }
@keyframes ffBand { 0% { transform: translateX(-110%) skewY(-4deg); } 60% { transform: translateX(2%) skewY(-4deg); } 100% { transform: translateX(0) skewY(-4deg); opacity: 0.9; } }
@keyframes ffBandR { 0% { transform: translateX(110%) skewY(-4deg); } 60% { transform: translateX(-2%) skewY(-4deg); } 100% { transform: translateX(0) skewY(-4deg); opacity: 0.9; } }
@keyframes ffSlam { 0% { opacity: 0; transform: scale(2.6) skewX(-8deg); filter: blur(12px); } 60% { opacity: 1; } 100% { opacity: 1; transform: scale(1) skewX(-8deg); } }
@keyframes ffUp { 0% { opacity: 0; transform: translateY(18px); } 100% { opacity: 1; transform: none; } }
@keyframes ffPulse { 0% { opacity: 1; } 100% { opacity: 0.55; } }
@keyframes ffOut { 0% { opacity: 1; transform: none; } 100% { opacity: 0; transform: scale(1.08); } }

/* off-track clock */
.hud-off { position: absolute; top: 46%; left: 50%; transform: translate(-50%, -50%) scale(0.9); display: grid; justify-items: center; gap: 2px; opacity: 0; transition: opacity 0.15s, transform 0.15s; font-style: normal; text-shadow: 0 3px 18px rgba(0,0,0,0.75); }
.hud-off.show { opacity: 1; transform: translate(-50%, -50%); }
.hud-off svg { grid-area: 1 / 1; width: 96px; height: 96px; transform: rotate(-90deg); overflow: visible; }
.hud-off circle { fill: rgba(8,12,22,0.6); stroke: rgba(255,255,255,0.14); stroke-width: 6; }
.hud-off circle.fg { fill: none; stroke: var(--gold); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 0; }
.hud-off.late circle.fg { stroke: var(--red); }
.hud-off b { position: relative; grid-area: 1 / 1; align-self: center; font-size: 46px; font-weight: 900; font-style: italic; font-variant-numeric: tabular-nums; }
.hud-off span { margin-top: 4px; font-size: 22px; font-weight: 900; font-style: italic; letter-spacing: 3px; color: var(--gold); }
.hud-off.late span, .hud-off.late b { color: var(--red); }
.hud-off small { font-size: 13px; color: #dce6f5; letter-spacing: 1px; font-weight: 700; }
.hud-standings { position: absolute; top: 216px; right: 14px; width: 190px; display: flex; flex-direction: column; gap: 2px; font-style: normal; }
.hud-standings .st-row { background: rgba(8,12,22,0.62); padding: 4px 8px; font-size: 13px; grid-template-columns: 20px 18px 1fr auto; }
.hud-standings .st-row.me { background: rgba(47,134,235,0.55); }
.hud-standings .st-gap { font-size: 11px; }
.hud-hint { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); font-size: 13px; color: rgba(255,255,255,0.8); font-style: normal; background: rgba(8,12,22,0.55); padding: 6px 14px; letter-spacing: 0.5px; transition: opacity 1s; white-space: nowrap; }
.hud-hint.fade { opacity: 0; }
.hud-tags { position: absolute; inset: 0; overflow: hidden; }
.tag-name { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 5px; padding: 2px 8px 2px 6px; background: rgba(8,12,22,0.62); font-size: 13px; font-weight: 700; font-style: normal; white-space: nowrap; transform-origin: 50% 100%; will-change: transform; clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
.tag-name i { width: 10px; height: 10px; display: block; clip-path: polygon(25% 0, 100% 0, 75% 100%, 0 100%); }
.tag-name.ghost { background: rgba(255,255,255,0.18); color: #e6f4ff; }
.hud-fps { position: absolute; left: 12px; bottom: 10px; font-size: 12px; color: #9f9; font-style: normal; font-weight: 700; }

/* ---------- track builder ---------- */
.editor-screen { display: grid; grid-template-columns: 320px 1fr 300px; grid-template-rows: auto 1fr auto; gap: 12px; padding: 14px 16px; }
.ed-top { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; background: var(--panel); padding: 8px 12px; border: 1px solid var(--line); clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px); flex-wrap: wrap; }
.ed-top h1 { font-size: 22px; margin: 0 8px 0 2px; font-style: italic; font-weight: 900; text-transform: uppercase; white-space: nowrap; }
.ed-name { width: 230px; font-size: 15px; padding: 7px 10px; }
.ed-saved { color: var(--muted); font-size: 12px; min-width: 56px; }
.ed-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.ed-left { grid-column: 1; grid-row: 2 / 4; display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: hidden; padding: 12px 14px; }
.ed-left > h3 { margin: 4px 0 0; }
.ed-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; min-height: 100px; padding-right: 4px; }
.pc-row { display: flex; align-items: center; gap: 7px; padding: 6px 8px; background: rgba(255,255,255,0.04); border: 0; border-left: 3px solid transparent; color: var(--text); font-size: 13px; text-align: left; cursor: pointer; font-family: inherit; }
.pc-row:hover { background: rgba(255,255,255,0.09); }
.pc-row.sel { background: rgba(57,198,240,0.2); border-left-color: var(--accent); }
.pc-row.start .pc-d { color: #cfe9ff; }
.pc-n { color: var(--muted); font-size: 11px; min-width: 18px; text-align: right; font-variant-numeric: tabular-nums; }
.pc-g { font-size: 15px; width: 18px; text-align: center; color: var(--accent); }
.pc-d { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bdg { font-style: normal; font-size: 10px; font-weight: 800; padding: 1px 5px; background: rgba(255,255,255,0.1); color: var(--muted); text-transform: uppercase; }
.bdg.cp { background: var(--gold); color: #1a1405; }
.bdg.boost { color: var(--accent); }
.pc-close { display: flex; align-items: center; gap: 8px; padding: 6px 8px; font-size: 12px; color: var(--gold); background: rgba(255,210,60,0.08); border-left: 3px solid var(--gold); }
.pc-close span { flex: 1; }
.ed-palette h3 { margin: 4px 0 6px; }
.pal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.pal-btn { display: flex; align-items: center; gap: 6px; justify-content: center; padding: 8px 6px; background: rgba(255,255,255,0.08); border: 0; color: var(--text); font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; }
.pal-btn:hover { background: rgba(57,198,240,0.3); }
.ed-sec summary { cursor: pointer; font-size: 13px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.ed-sec .set-row, .ed-right .set-row { padding: 5px 0; font-size: 14px; }
.ed-sec .set-label, .ed-right .set-label { font-size: 14px; }
.ed-left .slider, .ed-right .slider { width: 120px; }
.ed-left .choice button, .ed-right .choice button { padding: 6px 9px; font-size: 12px; }
.ed-view { grid-column: 2; grid-row: 2; position: relative; cursor: grab; min-height: 0; touch-action: none; }
.ed-view:active { cursor: grabbing; }
.ed-map { position: absolute; left: 0; bottom: 0; width: 190px; height: 190px; cursor: pointer; clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px); }
.ed-right { grid-column: 3; grid-row: 2 / 4; overflow-y: auto; padding: 12px 14px; }
.ed-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.ed-tabs .tab { flex: 1; }
.ed-right .track-select { font-size: 13px; padding: 6px 8px; }
.ed-bottom { grid-column: 2; grid-row: 3; display: flex; gap: 12px; align-items: stretch; min-width: 0; }
.ed-status { flex: 1; background: var(--panel); border: 1px solid var(--line); padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; max-height: 150px; overflow-y: auto; min-width: 0; }
.ed-facts { display: flex; gap: 14px; font-size: 13px; color: var(--muted); align-items: baseline; flex-wrap: wrap; }
.ed-facts b { color: var(--text); font-size: 16px; font-style: italic; }
.ed-issues { display: flex; flex-direction: column; gap: 3px; }
.issue { font-size: 13px; padding: 3px 8px; border: 0; border-left: 3px solid; text-align: left; background: rgba(0,0,0,0.2); color: var(--text); font-family: inherit; line-height: 1.35; }
.issue.err { border-color: var(--red); color: #ffc2ba; }
.issue.warn { border-color: var(--gold); color: #ffe7a0; cursor: pointer; }
.issue.ok { border-color: var(--green); color: #bfffd6; }
.ed-ai { background: var(--panel); border: 1px solid var(--line); padding: 8px 12px; display: flex; flex-direction: column; gap: 8px; width: 250px; justify-content: center; }
.ai-run { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.ai-bar { flex: 1; height: 6px; background: rgba(255,255,255,0.1); overflow: hidden; }
.ai-bar i { display: block; height: 100%; background: var(--accent); transform-origin: left; }
.ai-medals { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: 12px; color: var(--muted); }
.ai-medals > span:first-child { grid-column: 1 / -1; letter-spacing: 2px; text-transform: uppercase; font-weight: 700; font-size: 11px; }
.ai-note { font-size: 12px; color: #ffe7a0; line-height: 1.4; }
.insp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.insp-head h3 { margin: 0; flex: 1; }
.insp-tools { display: flex; gap: 4px; }
.insp-tools .btn { padding: 5px 8px; }
.insp-tools .ico { width: 14px; height: 14px; }
.insp-code { margin-top: 12px; }
.insp-code code { font-size: 12px; color: var(--muted); background: rgba(0,0,0,0.3); padding: 4px 8px; display: inline-block; }
.row.wrap { flex-wrap: wrap; justify-content: flex-end; }
.ed-modal { position: absolute; inset: 0; background: rgba(5,8,14,0.62); display: flex; align-items: center; justify-content: center; z-index: 5; backdrop-filter: blur(3px); }
.ed-dialog { width: min(780px, 92vw); max-height: 86vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.dlg-head { display: flex; align-items: center; gap: 10px; }
.dlg-head h2 { flex: 1; margin: 0; font-style: italic; }
.ed-code { width: 100%; background: rgba(0,0,0,0.35); border: 1px solid var(--line); color: var(--text); font-family: ui-monospace, Consolas, monospace; font-size: 12px; padding: 10px; resize: vertical; user-select: text; -webkit-user-select: text; word-break: break-all; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.lib-card { display: flex; flex-direction: column; gap: 5px; background: var(--panel-2); padding: 8px; border: 2px solid transparent; }
.lib-card.on { border-color: var(--accent); }
.lib-card canvas { width: 100%; height: auto; display: block; }
.lib-card b { font-style: italic; }
.lib-card span { font-size: 12px; color: var(--muted); }
.note.err { color: #ffb3aa; }
/* title footer: sound hint */
.foot-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.foot-right .fs-btn { margin-left: 0; }
.sound-hint { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,210,60,0.16); border: 0; color: var(--gold); padding: 6px 12px; font-size: 12px; letter-spacing: 1px; cursor: pointer; font-family: inherit; font-weight: 700; }
.sound-hint:hover { background: rgba(255,210,60,0.3); }
.sound-hint .ico { width: 15px; height: 15px; }
.sound-hint.gone { display: none; }
@media (max-width: 1100px) {
  .editor-screen { grid-template-columns: 270px 1fr 250px; }
  .ed-name { width: 160px; }
  .ed-ai { width: 200px; }
}

/* ---------- 3D track builder ---------- */
.screen.block-editor { display: block; padding: 0; }
.be-view { position: absolute; inset: 0; cursor: crosshair; touch-action: none; }
.be-top { position: absolute; top: 12px; left: 14px; right: 14px; display: flex; align-items: center; gap: 8px; background: var(--panel); padding: 8px 12px; border: 1px solid var(--line); clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px); flex-wrap: nowrap; white-space: nowrap; }
.be-top .ed-actions { flex-wrap: nowrap; }
.be-top h1 { font-size: 22px; margin: 0 8px 0 2px; font-style: italic; font-weight: 900; text-transform: uppercase; white-space: nowrap; }
.be-name { width: 200px; min-width: 90px; flex: 0 1 auto; font-size: 15px; padding: 7px 10px; }
.be-side { position: absolute; top: 78px; right: 14px; width: 272px; max-height: calc(100% - 270px); overflow-y: auto; padding: 12px 14px; }
.be-side .set-row { padding: 5px 0; font-size: 14px; }
.be-side .set-label { font-size: 14px; }
.be-side .track-select { font-size: 13px; padding: 6px 8px; max-width: 150px; }
.be-left { position: absolute; left: 14px; bottom: 150px; width: min(400px, 46vw); display: flex; flex-direction: column; gap: 8px; }
.be-status { background: var(--panel); border: 1px solid var(--line); padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; max-height: 170px; overflow-y: auto; }
.be-ai { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); padding: 8px 12px; display: flex; flex-direction: column; gap: 8px; min-width: 220px; }
.be-dock { position: absolute; left: 14px; right: 14px; bottom: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.be-dock > * { pointer-events: auto; }
.be-layer { display: flex; gap: 8px; align-items: center; background: var(--panel); border: 1px solid var(--line); padding: 5px 12px; font-size: 13px; color: var(--muted); }
.be-layer b { color: var(--text); min-width: 26px; text-align: center; font-variant-numeric: tabular-nums; }
.be-rot { margin-left: 10px; }
.be-palette { display: flex; gap: 12px; background: var(--panel); border: 1px solid var(--line); padding: 6px 10px 8px; overflow-x: auto; max-width: 100%; }
.be-group { display: flex; gap: 4px; align-items: flex-end; position: relative; padding-top: 15px; }
.be-group + .be-group { padding-left: 12px; border-left: 1px solid var(--line); }
.be-cat { position: absolute; top: 0; left: 2px; font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.be-group + .be-group .be-cat { left: 14px; }
.be-group.cats { flex-direction: column; align-items: stretch; gap: 5px; padding-top: 0; }
.be-cats { display: flex; gap: 4px; }
.be-cats button { flex: 1; background: rgba(255,255,255,0.06); border: 0; color: var(--muted); padding: 4px 10px; font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; cursor: pointer; font-family: inherit; }
.be-cats button.on { background: var(--accent); color: #06121f; }
.be-group.blocks { padding-top: 0; }
.be-block { position: relative; }
.be-num { position: absolute; top: 2px; left: 4px; font-style: normal; font-size: 10px; color: var(--muted); }
.be-block, .be-tool { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 62px; padding: 4px 2px 3px; background: rgba(255,255,255,0.05); border: 1px solid transparent; color: var(--text); cursor: pointer; font-family: inherit; }
.be-block:hover, .be-tool:hover { background: rgba(255,255,255,0.12); }
.be-block small, .be-tool small { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 58px; color: #cfd8e6; }
.be-block.on, .be-tool.on { border-color: var(--accent); background: rgba(57,198,240,0.22); }
.be-tool .be-ic { height: 44px; display: flex; align-items: center; }
.be-ic svg { display: block; }
.be-ic.small svg { width: 30px; height: 30px; }
.be-help { position: absolute; top: 78px; left: 50%; transform: translateX(-50%); width: min(580px, 92vw); z-index: 4; }
.be-help .keys { display: grid; grid-template-columns: 1fr; gap: 4px; }
.lib-empty { aspect-ratio: 220 / 130; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.05); color: var(--muted); font-size: 12px; }
@media (max-width: 1100px) {
  .be-side { width: 230px; }
  .be-name { width: 150px; }
  .be-top h1 { display: none; }
}
@media (max-width: 1500px) {
  .be-top h1 { display: none; }
}

/* ---------- films (/pitstop, /yeet) ---------- */
.cut { position: fixed; inset: 0; z-index: 27; pointer-events: none; font-style: italic; }
.cut.leave { opacity: 0; transition: opacity 0.4s; }
.cut-bars i { position: absolute; left: 0; right: 0; height: 9vh; background: #000; }
.cut-bars i:first-child { top: 0; } .cut-bars i:last-child { bottom: 0; }
.cut-cap { position: absolute; left: 50%; top: 20%; transform: translate(-50%, -50%); font-size: clamp(38px, 6vw, 88px); font-weight: 900; color: #fff; letter-spacing: 2px; white-space: nowrap; text-shadow: 0 5px 24px rgba(0,0,0,0.65), 0 0 2px #000; }
.cut-cap.huge { font-size: clamp(80px, 13vw, 190px); color: #ffd23c; top: 42%; }
.cut-cap.pop { animation: cutPop 0.45s cubic-bezier(.2,1.4,.4,1); }
.cut-sub { position: absolute; left: 50%; top: calc(20% + clamp(34px, 4.4vw, 64px)); transform: translateX(-50%); font-size: clamp(14px, 1.6vw, 22px); font-weight: 800; color: #fff; letter-spacing: 2px; text-transform: uppercase; font-style: normal; white-space: nowrap; text-shadow: 0 2px 10px #000; }
@keyframes cutPop { from { transform: translate(-50%, -50%) scale(1.6); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.cut-progress { position: absolute; left: 50%; bottom: calc(9vh + 26px); width: min(520px, 70vw); height: 22px; transform: translateX(-50%); background: rgba(0,0,0,0.55); border: 2px solid #fff; display: none; font-style: normal; }
.cut-progress.on { display: block; }
.cut-progress i { position: absolute; inset: 0; background: linear-gradient(90deg, #ffd23c, #ff8a3a); transform-origin: left; transform: scaleX(0); }
.cut-progress span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 900; letter-spacing: 3px; color: #111; text-shadow: 0 1px 0 rgba(255,255,255,0.5); }
.cut-skip { position: absolute; right: 3vw; bottom: calc(9vh + 14px); color: rgba(255,255,255,0.6); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; font-style: normal; }
.cut-fade { position: absolute; inset: 0; background: #000; opacity: 0; transition: opacity 0.45s; }
.cut-fade.on { opacity: 1; }

/* ---------- /precalc ---------- */
.quiz { position: fixed; right: 20px; top: 130px; width: min(380px, 44vw); z-index: 26; pointer-events: auto; padding: 14px 16px 12px; background: rgba(10,14,24,0.92); border: 3px solid #ffd23c; box-shadow: 0 10px 30px rgba(0,0,0,0.5); animation: qzIn 0.35s cubic-bezier(.2,1.3,.4,1); font-style: normal; }
.quiz.leave { opacity: 0; transform: translateX(40px); transition: 0.35s; }
.quiz.pass { border-color: #3bbf6a; } .quiz.fail { border-color: #ff3a2a; }
@keyframes qzIn { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: none; } }
.qz-head { display: flex; justify-content: space-between; align-items: baseline; }
.qz-head b { color: #ffd23c; font-weight: 900; letter-spacing: 2px; font-size: 14px; }
.qz-head span { color: var(--muted); font-size: 11px; letter-spacing: 1px; }
.qz-q { font-size: 22px; font-weight: 800; margin: 10px 0 12px; line-height: 1.3; }
.qz-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qz-opt { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.15); color: #fff; font-size: 16px; font-weight: 700; cursor: pointer; text-align: left; }
.qz-opt b { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; background: #ffd23c; color: #111; font-size: 13px; flex: none; }
.qz-opt.right { background: rgba(59,191,106,0.35); border-color: #3bbf6a; }
.qz-opt.wrong { background: rgba(255,58,42,0.35); border-color: #ff3a2a; }
.qz-opt.dim { opacity: 0.45; }
.qz-bar { height: 6px; margin-top: 12px; background: rgba(255,255,255,0.12); }
.qz-bar i { display: block; height: 100%; background: #ffd23c; transform-origin: left; }
.qz-msg { margin-top: 8px; font-size: 13px; color: var(--muted); }
.quiz.pass .qz-msg { color: #7ae89a; } .quiz.fail .qz-msg { color: #ff8a7a; font-weight: 800; }

/* ---------- rebuild minigame ---------- */
.rebuild { position: fixed; inset: 0; z-index: 28; pointer-events: auto; background: radial-gradient(ellipse at 50% 55%, rgba(30,36,52,0.94), rgba(6,8,14,0.97)); font-style: normal; user-select: none; touch-action: none; }
.rebuild.leave { opacity: 0; transition: opacity 0.4s; }
.rebuild.fixed .rb-frame { animation: rbShake 0.2s linear 4; }
.rb-head { position: absolute; left: 0; right: 0; top: 18px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rb-head b { font-size: clamp(26px, 3.6vw, 44px); font-weight: 900; font-style: italic; letter-spacing: 2px; color: #ffd23c; }
.rb-head span { font-size: 15px; font-weight: 700; letter-spacing: 1px; color: #fff; }
.rb-head i { position: absolute; right: 24px; top: 4px; font-style: normal; font-weight: 900; font-size: 20px; color: var(--muted); }
.rb-stage { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -46%); }
.rb-frame { position: relative; width: 800px; height: 340px; }
.rb-chassis { position: absolute; inset: 0; width: 100%; height: 100%; }
.rb-slot { position: absolute; border: 3px dashed rgba(255,210,60,0.55); border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.rb-slot span { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: rgba(255,210,60,0.75); }
.rb-slot.filled { border-color: transparent; } .rb-slot.filled span { display: none; }
.rb-part { position: fixed; left: 0; top: 0; cursor: grab; z-index: 2; filter: drop-shadow(0 6px 10px rgba(0,0,0,0.5)); }
.rb-part svg { width: 100%; height: 100%; display: block; pointer-events: none; }
.rb-part.held { cursor: grabbing; z-index: 3; filter: drop-shadow(0 12px 18px rgba(0,0,0,0.6)); }
.rb-part.placed { cursor: default; filter: none; }
.rb-part.wheel.placed { cursor: pointer; }
.rb-part.shake { animation: rbShake 0.1s linear 4; }
.rb-bolt { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #ff3a2a; box-shadow: 0 0 0 2px #111; pointer-events: none; }
.rb-bolt.tight { background: #3bbf6a; }
.rb-start { position: absolute; left: 50%; bottom: 9vh; transform: translateX(-50%); width: 320px; height: 60px; display: none; border: 3px solid #fff; background: #1a1d24; color: #fff; font-weight: 900; font-size: 17px; letter-spacing: 2px; cursor: pointer; overflow: hidden; }
.rb-start.on { display: block; }
.rb-start i { position: absolute; inset: 0; background: linear-gradient(90deg, #3bbf6a, #ffd23c); transform-origin: left; transform: scaleX(0); }
.rb-start span { position: relative; }
.rb-toast { position: absolute; left: 50%; bottom: calc(9vh + 80px); transform: translateX(-50%); z-index: 5; pointer-events: none; font-size: 18px; font-weight: 800; color: #fff; opacity: 0; white-space: nowrap; text-shadow: 0 2px 8px #000; }
.rb-toast.on { animation: rbToast 2.4s ease-out forwards; }
@keyframes rbToast { 0% { opacity: 0; transform: translate(-50%, 10px); } 10% { opacity: 1; transform: translate(-50%, 0); } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes rbShake { 0% { translate: 0 0; } 25% { translate: -6px 2px; } 50% { translate: 5px -3px; } 75% { translate: -3px 3px; } 100% { translate: 0 0; } }

/* ---------- /advertisement ---------- */
.ad-ui { position: absolute; inset: 0; pointer-events: none; font-style: normal; }
.ad-count { position: absolute; left: 3vw; bottom: calc(9vh + 14px); padding: 4px 10px; background: rgba(0,0,0,0.65); color: #ffd23c; font-weight: 800; font-size: 14px; }
.ad-skip { position: absolute; right: 3vw; bottom: calc(9vh + 44px); padding: 10px 18px; background: rgba(0,0,0,0.7); border: 1px solid rgba(255,255,255,0.4); color: rgba(255,255,255,0.7); font-size: 15px; font-weight: 700; pointer-events: auto; cursor: default; }
.ad-skip.ready { color: #fff; cursor: pointer; border-color: #fff; }
.ad-brand { position: absolute; left: 3vw; top: calc(9vh + 14px); font-size: 22px; font-weight: 900; font-style: italic; color: #e8433a; text-shadow: 0 2px 0 #fff, 0 4px 12px rgba(0,0,0,0.4); }

/* ---------- /missile ---------- */
.pranks { position: absolute; inset: 0; pointer-events: none; }
.pk-armed { position: absolute; left: 50%; top: 158px; transform: translateX(-50%); padding: 6px 16px; background: rgba(160,20,10,0.85); color: #fff; font-weight: 900; font-size: 15px; letter-spacing: 3px; display: none; }
.pk-armed.on { display: block; }
.pk-warn { position: absolute; left: 50%; top: 32%; transform: translateX(-50%); padding: 8px 22px; background: #c00; color: #fff; font-weight: 900; font-size: clamp(18px, 2.2vw, 28px); letter-spacing: 3px; display: none; animation: nkBlink 0.3s steps(2, jump-none) infinite; }
.pk-warn.on { display: block; }
.pk-lock { position: absolute; left: 0; top: 0; width: 64px; height: 64px; border: 3px solid transparent; background:
  linear-gradient(#ff3a2a, #ff3a2a) top left / 16px 3px no-repeat, linear-gradient(#ff3a2a, #ff3a2a) top left / 3px 16px no-repeat,
  linear-gradient(#ff3a2a, #ff3a2a) top right / 16px 3px no-repeat, linear-gradient(#ff3a2a, #ff3a2a) top right / 3px 16px no-repeat,
  linear-gradient(#ff3a2a, #ff3a2a) bottom left / 16px 3px no-repeat, linear-gradient(#ff3a2a, #ff3a2a) bottom left / 3px 16px no-repeat,
  linear-gradient(#ff3a2a, #ff3a2a) bottom right / 16px 3px no-repeat, linear-gradient(#ff3a2a, #ff3a2a) bottom right / 3px 16px no-repeat;
  filter: drop-shadow(0 0 6px rgba(255,40,20,0.8)); }
/* /1v1: the duel */
.duel { position: fixed; inset: 0; z-index: 28; pointer-events: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: rgba(6,10,20,0.92); font-style: normal; user-select: none; touch-action: none; animation: qzIn 0.35s ease-out; }
.duel.leave { opacity: 0; transition: opacity 0.4s; }
.du-head { display: flex; align-items: baseline; gap: 18px; }
.du-head b { font-size: clamp(22px, 3vw, 38px); font-weight: 900; font-style: italic; letter-spacing: 2px; color: #ffd23c; }
.du-head i { font-style: normal; font: 900 clamp(20px, 2.4vw, 30px) ui-monospace, Consolas, monospace; color: #fff; }
.du-canvas { width: min(94vw, calc((100vh - 150px) * 16 / 9)); aspect-ratio: 16 / 9; border: 3px solid #ffd23c; border-radius: 6px; cursor: none; box-shadow: 0 10px 40px rgba(0,0,0,0.6); }
.du-pad { display: flex; gap: 8px; }
.du-btn { min-width: 64px; padding: 8px 14px; font: 900 15px Arial, sans-serif; letter-spacing: 1px; color: #fff; background: rgba(255,255,255,0.12); border: 2px solid rgba(255,255,255,0.35); border-radius: 6px; cursor: pointer; }
.du-btn:active { background: rgba(255,210,60,0.4); }
.du-help { font-size: 13px; font-weight: 700; letter-spacing: 1px; color: rgba(255,255,255,0.7); }
/* /pitstop pro: the stopwatch */
.pit-timer { position: absolute; left: 50%; bottom: 17%; transform: translateX(-50%); padding: 4px 18px; background: rgba(10,10,14,0.85); border: 2px solid #ffc83a; color: #ffc83a; font: 900 clamp(26px, 3.4vw, 44px) ui-monospace, Consolas, monospace; letter-spacing: 2px; opacity: 0; transition: opacity 0.2s; }
.pit-timer.on { opacity: 1; }
.pit-timer.done { color: #2cf06a; border-color: #2cf06a; }
.pit-timer::after { content: ' s'; font-size: 0.55em; }
/* /fullbox: the damage number over the car, a hitmarker and the caller's callout */
.fb-dmg { position: absolute; left: 0; top: 0; font-size: clamp(30px, 3.6vw, 48px); font-weight: 900; font-style: italic; color: #ffd23c; -webkit-text-stroke: 2px #1a1206; text-shadow: 0 3px 0 #1a1206, 0 0 18px rgba(255,200,40,0.7); white-space: nowrap; }
.fb-hit { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; transform: translate(-50%, -50%) rotate(45deg); background:
  linear-gradient(#fff, #fff) center top / 4px 14px no-repeat, linear-gradient(#fff, #fff) center bottom / 4px 14px no-repeat,
  linear-gradient(#fff, #fff) left center / 14px 4px no-repeat, linear-gradient(#fff, #fff) right center / 14px 4px no-repeat;
  filter: drop-shadow(0 0 2px #000) drop-shadow(0 0 6px rgba(255,60,40,0.9)); animation: fbHit 0.45s ease-out forwards; }
.fb-call { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; animation: fbCall 2.6s ease-out forwards; }
.fb-call b { font-size: clamp(34px, 4.6vw, 60px); font-weight: 900; font-style: italic; letter-spacing: 3px; color: #fff; background: linear-gradient(90deg, #7a2cff, #2c8aff); padding: 2px 22px; transform: skewX(-8deg); box-shadow: 0 6px 20px rgba(0,0,0,0.5); }
.fb-call span { font-size: clamp(13px, 1.4vw, 18px); font-weight: 900; letter-spacing: 3px; color: #fff; background: rgba(0,0,0,0.7); padding: 2px 12px; text-transform: uppercase; }
@keyframes fbHit { 0% { opacity: 1; transform: translate(-50%, -50%) rotate(45deg) scale(1.4); } 100% { opacity: 0; transform: translate(-50%, -50%) rotate(45deg) scale(0.9); } }
@keyframes fbCall { 0% { opacity: 0; transform: translateX(-50%) scale(1.5); } 10% { opacity: 1; transform: translateX(-50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateX(-50%) translateY(-10px); } }

/* ---------- /nuke ---------- */
.nuke-fx { position: fixed; inset: 0; z-index: 25; pointer-events: none; font-style: italic; }
.nuke-fx.leave { opacity: 0; transition: opacity 0.5s; }
.nk-vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 50%, rgba(255,0,0,0) 45%, rgba(220,0,0,0.55) 100%); animation: nkPulse 0.5s ease-in-out infinite alternate; }
.nuke-fx.boom .nk-vignette { animation: none; opacity: 0; transition: opacity 1s; }
.nk-banner { position: absolute; left: 0; right: 0; top: 16vh; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 0 12px; background: repeating-linear-gradient(-45deg, rgba(255,210,40,0.92) 0 26px, rgba(20,20,20,0.92) 26px 52px); animation: nkBlink 0.5s steps(2, jump-none) infinite; }
.nk-banner b { font-size: clamp(22px, 3.4vw, 44px); font-weight: 900; letter-spacing: 3px; color: #fff; background: #b00; padding: 4px 18px; text-shadow: 0 2px 8px #000; }
.nk-banner span { font-size: clamp(12px, 1.3vw, 17px); font-weight: 900; letter-spacing: 4px; color: #fff; background: rgba(0,0,0,0.75); padding: 2px 12px; font-style: normal; }
.nuke-fx.boom .nk-banner { display: none; }
.nk-count { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font-size: clamp(80px, 14vw, 180px); font-weight: 900; color: #ff3a2a; text-shadow: 0 0 30px rgba(255,40,20,0.8), 0 6px 20px #000; }
.nk-flash { position: absolute; inset: 0; background: #fff8e8; opacity: 0; }
.nuke-fx.boom .nk-flash { animation: nkFlash 1.5s ease-out forwards; }
.nk-after { position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%) scale(1.6); opacity: 0; font-size: clamp(44px, 7vw, 96px); font-weight: 900; letter-spacing: 4px; color: #ffd23c; text-shadow: 0 0 24px rgba(255,120,20,0.8), 0 6px 20px #000; white-space: nowrap; }
.nuke-fx.boom .nk-after { animation: nkAfter 3.2s ease-out 0.5s forwards; }
@keyframes nkPulse { from { opacity: 0.35; } to { opacity: 1; } }
@keyframes nkBlink { 0% { opacity: 1; } 100% { opacity: 0.55; } }
@keyframes nkFlash { 0% { opacity: 1; } 10% { opacity: 0.95; } 100% { opacity: 0; } }
@keyframes nkAfter { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1); } }

/* ---------- pre-race intro ---------- */
.intro { position: fixed; inset: 0; z-index: 30; font-style: italic; cursor: pointer; }
.intro.waiting, .intro.leave { pointer-events: none; cursor: default; }
.intro.leave { opacity: 0; transition: opacity 0.6s; }
.in-bars i { position: absolute; left: 0; right: 0; height: 9vh; background: #000; transition: transform 1s ease-in-out; }
.in-bars i:first-child { top: 0; }
.in-bars i:last-child { bottom: 0; }
.intro.settle .in-bars i:first-child { transform: translateY(-100%); }
.intro.settle .in-bars i:last-child { transform: translateY(100%); }
.in-title { position: absolute; left: 6vw; top: 15vh; display: flex; flex-direction: column; gap: 8px; opacity: 0; transform: translateX(-40px); transition: opacity 0.5s, transform 0.7s cubic-bezier(.2,.9,.3,1); }
.in-title.on { opacity: 1; transform: none; }
.in-title b { font-size: clamp(40px, 6.5vw, 92px); font-weight: 900; line-height: 0.95; color: #fff; letter-spacing: 1px; text-transform: uppercase; text-shadow: 0 4px 26px rgba(0,0,0,0.65); }
.in-title span { font-size: clamp(13px, 1.4vw, 19px); color: #e6eef9; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; font-style: normal; text-shadow: 0 2px 10px #000; }
.in-card { position: absolute; left: 6vw; bottom: 15vh; transition: opacity 0.4s; }
.intro.settle .in-card { opacity: 0; }
.in-name { display: flex; align-items: center; gap: 18px; animation: inName 0.5s cubic-bezier(.2,.9,.3,1) both; }
.in-pos { font-size: clamp(30px, 4.2vw, 60px); font-weight: 900; line-height: 1; color: #0b101b; background: var(--c, var(--accent)); padding: 10px 14px 8px 10px; transform: skewX(-10deg); box-shadow: 0 6px 24px rgba(0,0,0,0.45); }
.in-who { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding-left: 14px; border-left: 5px solid var(--c, var(--accent)); }
.in-who b { font-size: clamp(44px, 6.8vw, 96px); font-weight: 900; line-height: 0.95; color: #fff; letter-spacing: 2px; text-shadow: 0 4px 24px rgba(0,0,0,0.7); }
.in-who span { font-size: clamp(13px, 1.4vw, 19px); color: #dfe8f5; font-weight: 700; letter-spacing: 2px; font-style: normal; text-shadow: 0 2px 10px #000; }
.in-who em { font-style: normal; font-weight: 900; font-size: clamp(12px, 1.1vw, 15px); letter-spacing: 3px; color: #0b101b; background: #ffd23c; padding: 3px 9px 2px; }
@keyframes inName { 0% { opacity: 0; transform: translateX(-40px) skewX(-6deg); } 100% { opacity: 1; transform: none; } }
.in-ready { position: absolute; left: 50%; top: 36%; transform: translate(-50%, -50%) scale(1.3); font-size: clamp(34px, 5vw, 72px); font-weight: 900; color: #fff; letter-spacing: 8px; white-space: nowrap; opacity: 0; text-shadow: 0 4px 26px rgba(0,0,0,0.6); transition: opacity 0.45s, transform 0.6s cubic-bezier(.2,.9,.3,1); }
.intro.settle .in-ready { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.in-skip { position: absolute; right: 3vw; bottom: calc(9vh + 14px); color: rgba(255,255,255,0.65); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; font-style: normal; opacity: 0; transition: opacity 0.6s; }
.in-skip.on { opacity: 1; }
.intro.settle .in-skip { opacity: 0; }
.in-wait { position: absolute; left: 50%; top: 26%; transform: translateX(-50%); display: none; font-size: clamp(22px, 2.6vw, 34px); font-weight: 900; letter-spacing: 4px; color: #fff; white-space: nowrap; text-shadow: 0 3px 16px rgba(0,0,0,0.7); }
.intro.waiting > :not(.in-wait) { display: none; }
.intro.waiting .in-wait { display: block; }
.in-fade { position: absolute; inset: 0; background: #000; opacity: 0; transition: opacity 0.6s ease-out; pointer-events: none; }
.in-fade.quick { transition-duration: 0.28s; }
.in-fade.on { opacity: 1; }
.hud-layer .hud { transition: opacity 0.5s; }
.hud-layer.cinema .hud, .hud-layer.cinema .hud-chat:not(.typing) { opacity: 0; }

/* ---------- loading ---------- */
.loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(8,12,22,0.86); opacity: 0; pointer-events: none; transition: opacity 0.15s; z-index: 5; }
.loading.on { opacity: 1; pointer-events: auto; }
.loading-card { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.loading-spin { width: 38px; height: 38px; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: conic-gradient(var(--accent), var(--accent-2), transparent 70%); animation: spin 0.8s linear infinite; }
.loading-label { color: var(--muted); font-size: 12px; letter-spacing: 3px; text-transform: uppercase; }
.loading-name { font-size: 30px; font-weight: 900; font-style: italic; }

/* ---------- toasts ---------- */
.toasts { position: absolute; left: 50%; bottom: 80px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { background: rgba(10,14,24,0.92); border-left: 3px solid var(--accent); padding: 9px 16px; font-size: 14px; opacity: 0; transform: translateY(8px); transition: opacity 0.25s, transform 0.25s; max-width: 80vw; }
.toast.in { opacity: 1; transform: none; }
.toast.err { border-left-color: var(--red); }
.toast.chat { border-left-color: var(--gold); }
/* in-race chat (online) */
.hud-chat { position: absolute; left: 22px; bottom: 150px; width: min(420px, 60vw); display: flex; flex-direction: column; gap: 6px; font-style: normal; }
.hc-log { display: flex; flex-direction: column; gap: 3px; }
.hc-line { align-self: flex-start; max-width: 100%; background: rgba(8,12,22,0.62); padding: 4px 10px; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; transition: opacity 0.6s; text-shadow: 0 1px 3px #000; }
.hc-line b { font-weight: 800; }
.hc-line.sys { color: var(--muted); font-style: italic; }
.hc-line.old { opacity: 0; }
.hc-row { display: none; }
.hud-chat.typing { pointer-events: auto; }
.hud-chat.typing .hc-row { display: flex; }
.hud-chat.typing .hc-line { background: rgba(8,12,22,0.8); }
.hc-input { flex: 1; background: rgba(8,12,22,0.85); border: 1px solid var(--accent); color: var(--text); padding: 8px 10px; font-size: 14px; outline: none; font-family: inherit; }
.quick-chat { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quick-chat button { background: rgba(255,255,255,0.07); border: 0; color: var(--muted); padding: 5px 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.5px; cursor: pointer; clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%); }
.quick-chat button:hover { color: var(--text); background: rgba(57,198,240,0.25); }

/* ---------- touch ---------- */
.touch { position: absolute; inset: 0; pointer-events: none; display: none; }
.touch.show { display: block; }
.tbtn { position: absolute; pointer-events: auto; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 15px; letter-spacing: 1px; color: rgba(255,255,255,0.9); background: rgba(12,17,29,0.45); border: 2px solid rgba(255,255,255,0.22); backdrop-filter: blur(2px); touch-action: none; }
.tbtn.on { background: rgba(57,198,240,0.5); border-color: var(--accent); }
.touch-left .tbtn { bottom: 26px; width: 104px; height: 104px; font-size: 34px; clip-path: polygon(18% 0, 100% 0, 82% 100%, 0 100%); }
.touch-left .left { left: 20px; }
.touch-left .right { left: 138px; }
.touch-right .gas { right: 20px; bottom: 26px; width: 110px; height: 150px; }
.touch-right .brake { right: 142px; bottom: 26px; width: 96px; height: 96px; }
.touch-right .drift { right: 142px; bottom: 134px; width: 96px; height: 58px; font-size: 13px; }
.touch-top .tbtn { top: 150px; width: 52px; height: 52px; font-size: 20px; }
.touch-top .resp { left: 20px; }
.touch-top .pause { left: 80px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .play-body, .lobby-body { grid-template-columns: 1fr; overflow-y: auto; }
  .track-detail { order: -1; }
  .logo.big .logo-word { font-size: 60px; }
}
@media (max-width: 760px) {
  .screen { padding: 16px; }
  .screen-head h1 { font-size: 24px; }
  .menu-stack .btn { min-width: 0; width: 100%; }
  .title-screen { background: rgba(8,12,22,0.6); }
  .logo.big .logo-word { font-size: 44px; }
  .logo.big .logo-mark { width: 56px; height: 56px; }
  .garage-screen { flex-direction: column-reverse; }
  .garage-left { width: 100%; height: 58%; padding: 14px; }
  .garage-view { flex: 1; }
  .hud-timer { font-size: 30px; }
  .hud-map { width: 120px; height: 120px; }
  .hud-standings { top: 140px; width: 150px; }
  .hud-speedo { bottom: 196px; right: 16px; }
  .touch.show ~ * .hud-hint, .hud-hint { display: none; }
  .hud-speed-num { font-size: 48px; min-width: 90px; }
  .hud-rpm { width: 140px; }
  .hud-pos { font-size: 40px; }
  .hud-count { font-size: 100px; }
  .settings-body { grid-template-columns: 1fr; }
  .key-row { grid-template-columns: 1fr auto; }
  .key-row .pad { display: none; }
  .title-foot span:last-child { display: none; }
}
