:root {
  --bg: #06070b;
  --ink: #f4f5f7;
  --ink-2: rgba(244, 245, 247, 0.62);
  --ink-3: rgba(244, 245, 247, 0.36);
  --panel: rgba(12, 14, 20, 0.78);
  --line: rgba(255, 255, 255, 0.12);
  --accent: #ffbf3c;
  --accent-ink: #1a1204;
  --cyan: #4fe3ff;
  --magenta: #ff4fa8;
  --red: #ff3b3b;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --text: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font-family: var(--text); overscroll-behavior: none; touch-action: none;
  user-select: none; -webkit-user-select: none;
}
#view { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; background: var(--bg); }
#ui { position: fixed; inset: 0; pointer-events: none; }
button { font: inherit; color: inherit; }

/* screens */
.screen { position: absolute; inset: 0; display: none; pointer-events: auto; }
.screen.show { display: flex; }

#loading { align-items: center; justify-content: center; flex-direction: column; gap: 22px; background: var(--bg); }
.loadbar { width: min(240px, 60vw); height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.loadbar i { display: block; height: 100%; width: 30%; background: var(--accent); animation: load 1.1s ease-in-out infinite; }
@keyframes load { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }

.wordmark {
  font-family: var(--display); font-weight: 800; font-style: italic; letter-spacing: 0.02em;
  font-size: clamp(72px, 16vw, 168px); line-height: 0.86; margin: 0;
  background: linear-gradient(180deg, #fff 0%, #fff 52%, #c9ccd4 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 40px rgba(255, 191, 60, 0.08);
}
.wordmark.small { font-size: 48px; }

/* title */
#title { align-items: flex-end; justify-content: flex-start;
  background: linear-gradient(90deg, rgba(6,7,11,0.86) 0%, rgba(6,7,11,0.5) 40%, rgba(6,7,11,0) 70%),
              linear-gradient(0deg, rgba(6,7,11,0.7) 0%, rgba(6,7,11,0) 45%); }
.title-wrap { padding: 0 clamp(20px, 6vw, 80px) calc(clamp(28px, 8vh, 80px) + var(--safe-b)); max-width: 640px; }
.kicker { font-family: var(--display); font-weight: 600; text-transform: uppercase; letter-spacing: 0.28em;
  font-size: 13px; color: var(--accent); margin-bottom: 10px; }
.tagline { color: var(--ink-2); font-size: 16px; margin: 14px 0 28px; max-width: 30em; }
.menu { display: flex; flex-wrap: wrap; gap: 10px; }
.title-pb { margin-top: 22px; color: var(--ink-3); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
.title-pb b { color: var(--ink); font-family: var(--display); font-size: 18px; margin-left: 6px; letter-spacing: 0.02em; }

/* buttons */
.btn {
  pointer-events: auto; cursor: pointer; border: 1px solid var(--line); background: rgba(255,255,255,0.05);
  padding: 12px 22px; border-radius: 10px; font-family: var(--display); font-weight: 700; font-size: 18px;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.btn:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.24); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible, .tab:focus-visible, .seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: #ffcb5e; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.small { padding: 7px 12px; font-size: 14px; }
.btn.wide { width: 100%; }
.g-start { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn.run { border-color: rgba(255,191,60,0.6); color: var(--accent); }

/* garage */
#garage { flex-direction: column; justify-content: space-between;
  background: linear-gradient(0deg, rgba(6,7,11,0.85) 0%, rgba(6,7,11,0) 38%); }
.g-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 0; }
.g-filter { pointer-events: auto; flex: 0 1 auto; max-width: 46vw; font: 600 13px var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2, #ccc);
  background: rgba(10, 12, 18, 0.72); border: 1px solid var(--line, rgba(255,255,255,0.14)); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.g-filter:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.g-filter option, .g-filter optgroup { background: #0d0f15; color: #e8e8ea; }
.g-gen { margin-top: 6px; font-family: var(--display); font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); font-size: 13px; }
.g-count { font-family: var(--display); color: var(--ink-3); font-size: 16px; letter-spacing: 0.1em; padding-right: 8px; }
.g-name-wrap { position: absolute; top: 64px; left: 0; right: 0; text-align: center; pointer-events: none; padding: 0 16px; }
.g-brand { font-family: var(--display); font-weight: 600; text-transform: uppercase; letter-spacing: 0.32em; color: var(--accent); font-size: 14px; }
.g-model { font-family: var(--display); font-weight: 800; font-style: italic; font-size: clamp(34px, 7vw, 64px); line-height: 1; margin-top: 4px; }
.g-tags { margin-top: 10px; display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.g-tags span { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: 99px; padding: 3px 9px; }
.g-arrow { position: absolute; top: 44%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(10,12,18,0.6); font-size: 34px; line-height: 1; cursor: pointer; color: var(--ink);
  display: flex; align-items: center; justify-content: center; padding-bottom: 4px; }
.g-arrow:hover { border-color: rgba(255,255,255,0.3); }
.g-arrow.left { left: 16px; } .g-arrow.right { right: 16px; }
.g-panel { margin: 0 auto calc(16px + var(--safe-b)); width: min(560px, calc(100vw - 32px)); padding: 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.g-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; margin-bottom: 14px; }
.stat { font-size: 12px; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.1em; }
.stat .v { float: right; color: var(--ink); font-family: var(--display); font-size: 16px; letter-spacing: 0.02em; }
.stat .bar { height: 3px; background: var(--line); border-radius: 2px; margin-top: 4px; clear: both; overflow: hidden; }
.stat .bar i { display: block; height: 100%; background: var(--ink); transition: width 0.35s cubic-bezier(.2,.8,.2,1); }
.g-colors { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.15); cursor: pointer; padding: 0; }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,0.25); }
.g-colors input[type=color] { width: 32px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: transparent; padding: 0 2px; cursor: pointer; }

/* HUD */
.hud { position: absolute; inset: 0; display: none; pointer-events: none; font-family: var(--display);
  --t0: #a3a9b4; --t1: #a76bff; --t2: #3d8bff; --t3: #27e08a; --t4: #ff4fb8; --t5: #ff8a1f; }
.hud.show { display: block; }
.h-runs { position: absolute; top: 14px; left: 16px; display: flex; flex-direction: column; gap: 4px; }
.h-runs div { display: flex; gap: 10px; align-items: baseline; }
.h-runs span { font-size: 11px; letter-spacing: 0.22em; color: var(--ink-3); width: 36px; }
.h-runs b { font-size: 18px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.hud.run .h-runs { display: none; }
.hud:not(.run) .run-only { display: none !important; }

/* score box */
.sb { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; align-items: stretch; gap: 10px;
  padding: 9px 11px 8px; border-radius: 14px; width: min(452px, calc(100vw - 24px));
  background: linear-gradient(180deg, rgba(16, 18, 27, 0.88), rgba(8, 9, 14, 0.8));
  border: 1px solid rgba(255, 255, 255, 0.1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  contain: layout paint; }
.sb-main { flex: 1; min-width: 0; }
.sb-row { display: flex; align-items: center; gap: 16px; transition: opacity 0.3s; }
.sb.idle .sb-row { opacity: 0.55; }
.sb-cell { display: flex; flex-direction: column; line-height: 1; }
.sb-cell span { font-size: 10px; font-weight: 600; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 3px; }
.sb-cell b { font-size: 22px; font-weight: 800; font-style: italic; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.sb-cell b.low { color: var(--red); }
.sb-badge { margin-left: auto; min-width: 74px; text-align: center; padding: 4px 10px 3px; border-radius: 8px; font-size: 22px; font-weight: 800;
  font-style: italic; font-variant-numeric: tabular-nums; color: #fff; background: var(--t0); transition: background 0.25s;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14) inset; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35); }
.sb-badge.grey { background: #4a4f5a; } .sb-badge.purple { background: var(--t1); } .sb-badge.blue { background: var(--t2); }
.sb-badge.green { background: var(--t3); color: #052014; text-shadow: none; } .sb-badge.pink { background: var(--t4); }
.sb-badge.orange { background: var(--t5); color: #2a1100; text-shadow: none; }
.sb-badge.hit { animation: badge 0.32s cubic-bezier(.2, .9, .3, 1.4); transform-origin: right center; }
@keyframes badge { 0% { transform: scale(1.2); } 100% { transform: scale(1); } }
.sb-pts { position: relative; margin-top: 7px; height: 42px; border-radius: 9px; overflow: hidden; display: flex; align-items: center;
  justify-content: center; gap: 8px; background: rgba(255, 255, 255, 0.07); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.sb-fill { position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); transition: transform 0.25s ease-out;
  background: linear-gradient(90deg, rgba(122, 77, 255, 0.55), rgba(176, 107, 255, 0.85)); }
.sb-pts.beyond .sb-fill { background: linear-gradient(90deg, rgba(255, 176, 40, 0.6), rgba(255, 214, 90, 0.95)); }
.sb-pts b { position: relative; font-size: 31px; font-weight: 800; font-style: italic; font-variant-numeric: tabular-nums; line-height: 1;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45); }
.sb-pts span { position: relative; font-size: 13px; font-weight: 700; letter-spacing: 0.2em; color: var(--ink-2); margin-top: 6px; }
.sb-pts.bump b { animation: bump 0.22s ease-out; }
@keyframes bump { 0% { transform: scale(1.08); } 100% { transform: scale(1); } }
.sb-pb { margin-top: 5px; font-size: 11px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-3);
  text-align: center; font-variant-numeric: tabular-nums; }
.sb-pb b { color: #ffd166; font-weight: 700; }
.sb-aggro { display: flex; flex-direction: column-reverse; justify-content: center; gap: 3px; padding: 2px 0; }
.sb-aggro i { display: block; width: 6px; flex: 1; max-height: 15px; min-height: 9px; border-radius: 2px; background: rgba(255, 255, 255, 0.1);
  transition: background 0.2s, box-shadow 0.2s; }
.sb-aggro i.on { background: var(--t5); box-shadow: 0 0 8px rgba(255, 138, 31, 0.7); }
.sb-aggro.flash i.on { animation: aggro 0.4s ease-out; }
@keyframes aggro { 0% { background: #fff; } 100% { background: var(--t5); } }
.sb-lives { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding-left: 2px; }
.sb-lives .heart { width: 16px; height: 15px; fill: #fff; transition: fill 0.2s; }
.sb-lives.hurt .heart { fill: var(--red); }
.sb-lives .bars { display: flex; gap: 3px; }
.sb-lives .bars i { width: 5px; height: 16px; border-radius: 2px; background: #fff; transition: background 0.2s; }
.sb-lives .bars i.lost { background: rgba(255, 59, 59, 0.75); }

.sb-warn { position: absolute; top: 140px; left: 50%; transform: translateX(-50%); display: none; align-items: baseline; gap: 10px;
  padding: 6px 16px; border-radius: 99px; background: rgba(200, 20, 30, 0.86); box-shadow: 0 6px 22px rgba(200, 20, 30, 0.35);
  font-weight: 800; font-style: italic; text-transform: uppercase; letter-spacing: 0.1em; font-size: 17px; white-space: nowrap; }
.sb-warn.amber { background: rgba(200, 120, 10, 0.9); box-shadow: 0 6px 22px rgba(200, 120, 10, 0.3); }
.sb-warn b { font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.sb-warn.show { display: flex; animation: warn 0.6s ease-in-out infinite alternate; }
@keyframes warn { 0% { opacity: 1; } 100% { opacity: 0.72; } }

/* centre-screen pass callout */
#callouts { position: absolute; left: 50%; top: 31%; width: 0; height: 0; }
.co { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); display: none; text-align: center; white-space: nowrap;
  padding: 5px 16px 4px; border: 2px solid var(--c, #fff); border-radius: 6px; background: rgba(8, 9, 14, 0.5);
  box-shadow: 0 0 22px color-mix(in srgb, var(--c, #fff) 40%, transparent); animation: co 0.95s cubic-bezier(.2, .9, .25, 1) forwards; }
.co .lbl { display: block; font-size: 30px; font-weight: 800; font-style: italic; text-transform: uppercase; letter-spacing: 0.05em; line-height: 1;
  color: var(--c, #fff); }
.co .val { display: block; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.06em; margin-top: 2px; color: #fff; }
.co.t1 { --c: var(--t1); } .co.t2 { --c: var(--t2); } .co.t3 { --c: var(--t3); } .co.t4 { --c: var(--t4); } .co.t5 { --c: var(--t5); }
.co.t5 .lbl, .co.t4 .lbl { font-size: 36px; }
@keyframes co {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  26% { transform: translate(-50%, -50%) scale(1); }
  72% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, calc(-50% - 26px)) scale(0.96); }
}

/* small status lines under the score box */
#popups { position: absolute; left: 50%; top: 128px; width: 0; height: 0; }
.pop { position: absolute; left: 0; top: 0; transform: translateX(-50%); white-space: nowrap; text-align: center; display: none;
  font-weight: 800; font-style: italic; text-transform: uppercase; letter-spacing: 0.08em; font-size: 17px;
  animation: pop 1.4s cubic-bezier(.2,.9,.25,1) forwards; text-shadow: 0 2px 14px rgba(0,0,0,0.6); }
.pop.split { color: #ffd166; } .pop.aggro { color: var(--t5); } .pop.bad { color: var(--red); } .pop.info { color: var(--ink-2); }
@keyframes pop {
  0% { opacity: 0; transform: translate(-50%, 6px) scale(0.8); }
  14% { opacity: 1; transform: translate(-50%, 0) scale(1.05); }
  24% { transform: translate(-50%, 0) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, 14px); }
}
.h-pause { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 10px; pointer-events: auto; cursor: pointer;
  background: rgba(10,12,18,0.45); border: 1px solid var(--line); display: flex; gap: 5px; align-items: center; justify-content: center; }
.h-pause i { display: block; width: 4px; height: 14px; background: var(--ink); border-radius: 1px; }
.h-speedo { position: absolute; right: 14px; bottom: calc(12px + var(--safe-b)); width: 168px; height: 150px; }
.h-speedo::before { content: ""; position: absolute; left: 10px; right: 10px; top: 10px; height: 148px; border-radius: 50%;
  background: radial-gradient(circle, rgba(8, 9, 14, 0.55) 0%, rgba(8, 9, 14, 0.25) 60%, rgba(8, 9, 14, 0) 72%); }
.tach { position: absolute; inset: 0; width: 100%; height: 168px; overflow: visible; }
.tach path { fill: none; stroke-width: 7; stroke-linecap: round; }
.tach-bg { stroke: rgba(255,255,255,0.12); }
.tach-red { stroke: rgba(255,59,59,0.55); }
.tach-fg { stroke: var(--ink); }
.h-speed { position: absolute; left: 0; right: 0; top: 52px; text-align: center; }
.h-speed b { display: block; font-size: 50px; font-weight: 800; font-style: italic; line-height: 1; font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 14px rgba(0,0,0,0.5); }
.h-speed span { font-size: 12px; letter-spacing: 0.24em; color: var(--ink-3); text-transform: uppercase; }
.h-gear { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; font-size: 24px; font-weight: 800; color: var(--accent); }
.h-crash { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); font-size: clamp(44px, 9vw, 84px); font-weight: 800;
  font-style: italic; color: var(--red); opacity: 0; letter-spacing: 0.04em; text-shadow: 0 4px 30px rgba(0,0,0,0.6); text-align: center; white-space: nowrap; }
.h-crash small { display: block; font-size: 0.32em; color: var(--ink); letter-spacing: 0.12em; font-style: normal; }
.h-crash.show { animation: crash 1.8s ease-out forwards; }
@keyframes crash { 0% { opacity: 0; transform: translate(-50%,-50%) scale(1.3); } 10% { opacity: 1; transform: translate(-50%,-50%) scale(1); } 70% { opacity: 1; } 100% { opacity: 0; } }
.h-flash { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(255,40,40,0) 40%, rgba(255,40,40,0.35) 100%); opacity: 0; }
.h-flash.show { animation: flash 0.6s ease-out forwards; }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }

/* end of run */
.ro { text-align: center; width: min(520px, calc(100vw - 32px)); }
.ro h2 { margin: 2px 0 6px; }
.ro-kicker { font-family: var(--display); font-weight: 700; letter-spacing: 0.3em; text-transform: uppercase; font-size: 13px; color: var(--accent); }
.ro-score { font-family: var(--display); display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.ro-score b { font-size: clamp(46px, 11vw, 72px); font-weight: 800; font-style: italic; line-height: 1; font-variant-numeric: tabular-nums; }
.ro-score span { font-size: 16px; letter-spacing: 0.2em; color: var(--ink-2); font-weight: 700; }
.ro-pb { font-family: var(--display); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; font-size: 15px; color: var(--ink-2); margin: 4px 0 16px; }
.ro-pb.new { color: #ffd166; }
.ro-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: left; }
.ro-grid div { background: rgba(255,255,255,0.045); border: 1px solid rgba(255,255,255,0.06); border-radius: 10px; padding: 8px 10px; }
.ro-grid span { display: block; font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-3); }
.ro-grid b { font-family: var(--display); font-size: 22px; font-weight: 800; font-style: italic; font-variant-numeric: tabular-nums; }
.ro-tiers { display: flex; gap: 6px; justify-content: center; margin-top: 12px; flex-wrap: wrap; font-family: var(--display); }
.ro-tiers span { padding: 3px 9px; border-radius: 6px; font-weight: 700; font-size: 14px; letter-spacing: 0.06em; color: #fff; }
.ro .panel-foot { justify-content: center; }

/* touch */
.touch { position: absolute; inset: 0; display: none; pointer-events: none; }
.touch.show { display: block; }
.t-steer { position: absolute; left: 12px; bottom: calc(14px + var(--safe-b)); display: flex; gap: 10px; }
.t-pedals { position: absolute; right: 12px; bottom: calc(14px + var(--safe-b)); display: grid; grid-template-columns: auto auto; gap: 10px; align-items: end; }
.t-btn { pointer-events: auto; width: 84px; height: 84px; border-radius: 18px; border: 1px solid rgba(255,255,255,0.18);
  background: rgba(10,12,18,0.42); color: var(--ink); font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: 0.06em;
  touch-action: none; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.t-btn.on { background: rgba(255,255,255,0.22); border-color: rgba(255,255,255,0.5); }
.t-btn.gas { height: 120px; background: rgba(255,191,60,0.22); border-color: rgba(255,191,60,0.5); }
.t-btn.brake { height: 96px; }
.t-btn.small { width: 84px; height: 44px; font-size: 15px; }
body.touchmode .h-speedo { bottom: auto; top: 150px; right: 2px; transform: scale(0.56); transform-origin: top right; }
body.touchmode .hint { bottom: calc(232px + var(--safe-b)); }
@media (max-height: 480px) {
  body.touchmode .h-speedo { top: 8px; right: 58px; transform: scale(0.52); }
  body.touchmode .h-runs { top: 12px; }
  .sb { transform: translateX(-50%) scale(0.8); transform-origin: top center; top: 4px; }
  .sb-warn { top: 104px; }
  #popups { top: 98px; }
  #callouts { top: 36%; }
}

/* modal */
.modal { align-items: center; justify-content: center; background: rgba(4,5,8,0.62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.panel { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; background: rgba(14,16,23,0.94);
  border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel h2 { margin: 0; font-family: var(--display); font-weight: 800; font-style: italic; font-size: 34px; text-transform: uppercase; }
.tabs { display: flex; gap: 4px; background: rgba(255,255,255,0.05); padding: 3px; border-radius: 10px; }
.tab { background: transparent; border: 0; padding: 7px 12px; border-radius: 8px; cursor: pointer; color: var(--ink-2);
  font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; font-size: 14px; }
.tab.on { background: rgba(255,255,255,0.12); color: var(--ink); }
.tabpane { display: none; } .tabpane.on { display: block; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.06); flex-wrap: wrap; }
.row label { font-size: 13px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-2); }
.seg { display: flex; gap: 2px; background: rgba(255,255,255,0.05); border-radius: 9px; padding: 3px; flex-wrap: wrap; }
.seg button { background: transparent; border: 0; padding: 6px 10px; border-radius: 7px; cursor: pointer; color: var(--ink-2);
  font-family: var(--display); font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em; }
.seg button.on { background: var(--ink); color: #0b0c10; }
.vol { display: flex; gap: 10px; align-items: center; }
.vol input { width: 150px; accent-color: var(--accent); }
.note { color: var(--ink-3); font-size: 13px; line-height: 1.45; margin: 12px 0 0; }
.panel-foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.keys { width: 100%; border-collapse: collapse; font-size: 14px; }
.keys td { padding: 7px 4px; border-bottom: 1px solid rgba(255,255,255,0.06); color: var(--ink-2); }
.keys td:first-child { color: var(--ink); }
kbd { font-family: var(--display); font-weight: 700; background: rgba(255,255,255,0.08); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; font-size: 13px; color: var(--ink); }

.hint { position: absolute; left: 50%; bottom: calc(22px + var(--safe-b)); transform: translateX(-50%); font-family: var(--display); font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; font-size: 13px; color: var(--ink-2); opacity: 0; transition: opacity 0.4s; white-space: nowrap; }
.hint.show { opacity: 1; }

@media (max-width: 640px) {
  .h-runs { display: none; }
  .sb { top: 56px; gap: 7px; padding: 7px 8px 6px; }
  .sb-row { gap: 10px; }
  .sb-cell b { font-size: 19px; }
  .sb-badge { font-size: 19px; min-width: 62px; padding: 3px 7px 2px; }
  .sb-pts { height: 36px; } .sb-pts b { font-size: 26px; }
  .sb-warn { top: 176px; } #popups { top: 166px; }
  .ro-grid { grid-template-columns: repeat(2, 1fr); }
  .g-arrow { top: 40%; width: 44px; height: 44px; }
  .g-stats { gap: 6px 12px; }
  .btn { padding: 11px 16px; font-size: 16px; }
  .h-speedo { transform: scale(0.82); transform-origin: bottom right; }
  .vol input { width: 110px; }
}
@media (max-height: 480px) and (orientation: landscape) {
  #garage .g-panel { position: absolute; right: 12px; bottom: calc(10px + var(--safe-b)); width: min(380px, 48vw); margin: 0; }
  .g-name-wrap { text-align: left; left: 18px; right: auto; top: 50px; }
  .g-tags { justify-content: flex-start; }
  .g-arrow.right { right: calc(min(380px, 48vw) + 24px); }
  .g-arrow { top: 62%; }
}
@media (max-height: 480px) {
  .g-name-wrap { top: 52px; }
  .g-model { font-size: 30px; }
  .g-panel { padding: 10px; }
  .g-stats { margin-bottom: 8px; }
  .tagline { margin: 8px 0 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .pop { animation-duration: 0.9s; }
}
