/* coldgas UI - mobile first. Portrait: view 76% / pad 24%. Landscape + desktop: view full, pad overlaid. */
:root {
  --ink: #05080d;
  --panel: #0a0f17;
  --panel2: #121a26;
  --line: rgba(160, 210, 255, .16);
  --white: #f2f8ff;
  --cold: #9fe0ff;
  --cold2: #3fb2ff;
  --cold3: #1b6fd1;
  --hot: #ff7a1a;
  --hot2: #ffb347;
  --bad: #ff3b3b;
  --good: #7dffb2;
  --font: 'Chakra Petch', 'Rajdhani', 'Barlow Condensed', 'Arial Narrow', system-ui, -apple-system, sans-serif;
  --view-h: 76%;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --shadow: 0 2px 0 rgba(0, 0, 0, .55), 0 0 8px rgba(0, 0, 0, .55), 0 0 2px rgba(0, 0, 0, .9);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none;
  background: var(--ink); color: var(--white); font-family: var(--font);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  touch-action: none; -webkit-text-size-adjust: 100%;
}
button { font-family: inherit; color: inherit; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; }
img, svg { -webkit-user-drag: none; -webkit-touch-callout: none; }

/* ---------- stage ---------- */
#stage { position: fixed; inset: 0; overflow: hidden; background: #000; }
#view { position: absolute; left: 0; top: 0; width: 100%; height: var(--view-h); display: block; touch-action: none; outline: none; }
#hud { position: absolute; left: 0; top: 0; width: 100%; height: var(--view-h); pointer-events: none; overflow: hidden; z-index: 2; }
#pad {
  position: absolute; left: 0; bottom: 0; width: 100%; height: calc(100% - var(--view-h)); z-index: 3;
  background: linear-gradient(#0d141f, #070b11 60%); border-top: 1px solid var(--line);
  box-shadow: 0 -6px 18px rgba(0, 0, 0, .5);
  display: grid; grid-template-columns: 1fr minmax(118px, 34%) minmax(104px, 28%);
  gap: 6px; padding: 8px calc(8px + var(--sar)) calc(6px + var(--sab)) calc(8px + var(--sal));
  touch-action: none;
}

/* ---------- pad: wheel ---------- */
.pad-wheel { position: relative; display: flex; align-items: center; justify-content: center; touch-action: none; border-radius: 16px; }
.pad-wheel::before { /* drag lane */
  content: ''; position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; margin-top: -1px;
  background: linear-gradient(90deg, transparent, var(--line) 20%, var(--line) 80%, transparent); pointer-events: none;
}
.wheel {
  position: relative; width: min(100%, 132px, calc(100% - 4px)); aspect-ratio: 1; pointer-events: none;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .6)); will-change: transform;
}
.wheel svg { width: 100%; height: 100%; display: block; }
.pad-wheel.active .wheel { filter: drop-shadow(0 0 10px rgba(63, 178, 255, .55)); }
.wheel-hint {
  position: absolute; bottom: 2px; left: 0; right: 0; text-align: center; font-size: 10px; letter-spacing: .2em;
  color: rgba(159, 224, 255, .45); pointer-events: none; font-weight: 600;
}

/* ---------- pad: thruster buttons ---------- */
.pad-thr { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 6px; touch-action: none; }
.thr {
  position: relative; border: 1px solid rgba(159, 224, 255, .28); border-radius: 14px; padding: 0;
  background: linear-gradient(#1a2433, #0f1622); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 3px 0 #04070b;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-weight: 700; font-size: 12px; letter-spacing: .08em; color: var(--cold);
  transition: transform .06s, background .1s, box-shadow .1s; min-height: 0; outline: none;
}
.thr svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.thr span { pointer-events: none; }
.thr.on, .thr[data-ctl].on {
  transform: translateY(2px); color: #fff;
  background: radial-gradient(circle at 50% 60%, #49c2ff, #1b6fd1 70%);
  box-shadow: 0 0 16px rgba(63, 178, 255, .85), inset 0 0 12px rgba(255, 255, 255, .35), 0 1px 0 #04070b;
}
.thr[data-ctl="boost"].on { background: radial-gradient(circle at 50% 60%, #ffd2a1, #ff7a1a 70%); box-shadow: 0 0 18px rgba(255, 122, 26, .9), inset 0 0 12px rgba(255, 255, 255, .4), 0 1px 0 #04070b; }
.thr[data-ctl="boost"] { color: var(--hot2); border-color: rgba(255, 160, 80, .35); }
.thr[data-ctl="suck"].on { animation: suckglow 1.1s ease-in-out infinite; transform: none; color: #04140a; }
.thr[data-ctl="suck"].on::after {
  content: 'ON'; position: absolute; top: 4px; right: 6px; font-size: 9px; color: #fff; letter-spacing: .1em;
}
@keyframes suckglow {
  0%, 100% { box-shadow: 0 0 10px rgba(125, 255, 178, .6), inset 0 0 10px rgba(255, 255, 255, .25); }
  50% { box-shadow: 0 0 22px rgba(125, 255, 178, 1), inset 0 0 14px rgba(255, 255, 255, .45); }
}
.thr[data-ctl="suck"] { color: var(--good); border-color: rgba(125, 255, 178, .3); }
.thr[data-ctl="suck"].on { background: radial-gradient(circle at 50% 60%, #9dffc8, #14a35a 75%); }
.thr.flash { animation: flash .25s ease-out; }
@keyframes flash { from { background: #fff; color: #0a0f17; } }

/* ---------- pad: pedals ---------- */
.pad-pedals { display: flex; gap: 6px; align-items: flex-end; touch-action: none; }
.pedal {
  position: relative; flex: 1; border-radius: 12px 12px 8px 8px; border: 1px solid rgba(255, 255, 255, .14);
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px;
  font-weight: 700; font-size: 12px; letter-spacing: .12em; color: rgba(255, 255, 255, .8);
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .35) 0 3px, transparent 3px 11px),
    linear-gradient(#3a4556, #1c2430);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 5px 0 #020407, 0 6px 10px rgba(0, 0, 0, .5);
  transform-origin: 50% 100%; transition: transform .07s, box-shadow .07s, filter .07s;
}
.pedal span { pointer-events: none; text-shadow: 0 1px 0 #000; }
.pedal.brake { height: 70%; }
.pedal.gas { height: 100%; flex: 1.15; }
.pedal.gas { background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .35) 0 3px, transparent 3px 11px), linear-gradient(#3b4a5a, #1d2733); }
.pedal.on { transform: perspective(300px) rotateX(16deg) translateY(4px) scaleY(.95); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 #020407; filter: brightness(1.25); }
.pedal.gas.on { border-color: rgba(125, 255, 178, .6); }
.pedal.gas.on span { color: var(--good); }
.pedal.brake.on { border-color: rgba(255, 59, 59, .7); }
.pedal.brake.on span { color: #ff8a8a; }

/* ---------- landscape / desktop: full view, pad overlay ---------- */
@media (orientation: landscape) {
  :root { --view-h: 100%; }
  #pad {
    inset: 0; height: 100%; display: block; background: none; border: 0; box-shadow: none; padding: 0;
    pointer-events: none;
  }
  .pad-wheel {
    position: absolute; left: 0; bottom: 0; width: 42%; height: 70%; pointer-events: auto;
    align-items: flex-end; justify-content: flex-start;
    padding: 0 0 calc(14px + var(--sab)) calc(18px + var(--sal));
  }
  .pad-wheel::before { display: none; }
  .wheel { width: clamp(120px, 19vw, 170px); opacity: .82; }
  .wheel-hint { left: calc(18px + var(--sal)); width: clamp(120px, 19vw, 170px); right: auto; bottom: calc(2px + var(--sab)); }
  .pad-pedals {
    position: absolute; right: calc(14px + var(--sar)); bottom: calc(12px + var(--sab));
    width: clamp(132px, 18vw, 180px); height: clamp(108px, 30vh, 150px); pointer-events: auto; opacity: .85;
  }
  .pad-thr {
    position: absolute; right: calc(14px + var(--sar)); bottom: calc(24px + var(--sab) + clamp(108px, 30vh, 150px));
    width: clamp(160px, 22vw, 210px); height: clamp(98px, 27vh, 124px); pointer-events: auto; opacity: .88;
  }
  .thr { background: linear-gradient(rgba(26, 36, 51, .78), rgba(15, 22, 34, .78)); }
}
@media (orientation: landscape) and (max-height: 330px) {
  .pad-thr { height: 84px; bottom: calc(18px + var(--sab) + 100px); }
  .pad-pedals { height: 100px; }
}

/* ---------- HUD ---------- */
#hud { font-weight: 700; text-shadow: var(--shadow); }
.hud-tl { position: absolute; left: calc(12px + var(--sal)); top: calc(8px + var(--sat)); line-height: 1; }
.hud-label { font-size: 11px; letter-spacing: .22em; color: var(--cold); opacity: .9; }
.score-val { font-size: 40px; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.score-val.bump { animation: bump .25s ease-out; }
@keyframes bump { 40% { transform: scale(1.12); color: var(--hot2); } }
.score-row { display: flex; align-items: baseline; gap: 8px; transform-origin: 0 60%; }
.combo { font-size: 22px; color: var(--hot); opacity: 0; transform: scale(.6); transition: opacity .15s, transform .15s; }
.combo.show { opacity: 1; transform: scale(1); }
.best-val { font-size: 12px; color: rgba(242, 248, 255, .7); margin-top: 2px; letter-spacing: .08em; }

.hud-tr { position: absolute; right: calc(10px + var(--sar)); top: calc(8px + var(--sat)); display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.hud-btns { display: flex; gap: 6px; }
.hud-btn {
  pointer-events: auto; width: 36px; height: 36px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(5, 8, 13, .45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
}
.hud-btn svg { width: 18px; height: 18px; stroke: #fff; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.hud-btn:active { background: rgba(63, 178, 255, .6); }
.hud-btn .x-mute { display: none; }
.hud-btn .x-off { display: none; }
.hud-btn.off .x-off { display: inline; }
.hud-btn.off { opacity: .6; }
.hud-btns { position: relative; }
.radio-name {
  position: absolute; right: 100%; top: 50%; margin-right: 8px; transform: translate(6px, -50%); opacity: 0; pointer-events: none;
  white-space: nowrap; font: 700 12px/1 system-ui, sans-serif; letter-spacing: .08em; color: #fff; padding: 6px 9px; border-radius: 8px;
  background: rgba(5, 8, 13, .55); border: 1px solid rgba(63, 178, 255, .5); text-shadow: 0 0 6px rgba(63, 178, 255, .8);
  transition: opacity .25s, transform .25s;
}
.radio-name.show { opacity: 1; transform: translate(0, -50%); }
.hud-btn.muted .x-mute { display: inline; }
.hud-btn.muted .x-wave { display: none; }
.speed { text-align: right; line-height: .9; margin-top: 2px; }
.speed-val { font-size: 46px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.speed-unit { font-size: 11px; letter-spacing: .22em; color: var(--cold); }
.speed.fast .speed-val { color: var(--hot2); }
.speed.nice .speed-val { display: inline-block; transform-origin: 100% 60%; color: #ff5fd2; text-shadow: 0 0 14px #ff5fd2, 0 0 30px #ff5fd2aa; animation: nice69 .35s ease-in-out infinite alternate; }
@keyframes nice69 { from { transform: scale(1); } to { transform: scale(1.12); } }

.hud-timer {
  margin-top: 3px; font-size: 14px; letter-spacing: .1em; color: rgba(242, 248, 255, .85); font-variant-numeric: tabular-nums;
}

/* PSI gauge */
.gauge { position: absolute; left: calc(10px + var(--sal)); bottom: 8px; display: flex; align-items: center; gap: 8px; }
.gauge-ring { position: relative; width: 64px; height: 64px; }
.gauge-ring svg { width: 100%; height: 100%; transform: rotate(135deg); overflow: visible; }
.gauge-ring .trk { fill: none; stroke: rgba(5, 8, 13, .55); stroke-width: 7; stroke-linecap: round; }
.gauge-ring .val { fill: none; stroke: var(--cold2); stroke-width: 7; stroke-linecap: round; transition: stroke .2s; filter: drop-shadow(0 0 4px rgba(63, 178, 255, .8)); }
.gauge-txt { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: .95; }
.gauge-psi { font-size: 15px; font-variant-numeric: tabular-nums; }
.gauge-unit { font-size: 9px; letter-spacing: .2em; color: var(--cold); }
.gauge-side { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; min-width: 74px; }
.chip {
  font-size: 10px; letter-spacing: .16em; padding: 3px 7px; border-radius: 6px; text-shadow: none;
  background: rgba(5, 8, 13, .55); color: rgba(255, 255, 255, .35); border: 1px solid rgba(255, 255, 255, .12);
}
.chip.on { color: #04140a; background: var(--good); border-color: var(--good); box-shadow: 0 0 10px rgba(125, 255, 178, .8); }
.chip.vent.on { color: #fff; background: var(--cold2); border-color: var(--cold2); box-shadow: 0 0 10px rgba(63, 178, 255, .8); }
.chip.vent.hot.on { background: var(--hot); border-color: var(--hot); box-shadow: 0 0 10px rgba(255, 122, 26, .8); }
.gauge.venting .val { stroke: #dff4ff; }
.gauge.low .val { stroke: var(--hot); filter: drop-shadow(0 0 4px rgba(255, 122, 26, .8)); }
.gauge.empty .val { stroke: var(--bad); }
.gauge.empty .gauge-psi { color: var(--bad); }
.ooa {
  position: absolute; left: 0; bottom: 100%; margin-bottom: 4px; white-space: nowrap;
  font-size: 16px; letter-spacing: .14em; color: var(--bad); opacity: 0;
}
.gauge.empty .ooa { animation: blink .5s steps(2, jump-none) infinite; }
.gauge.empty .gauge-ring { animation: shake .3s linear infinite; }
@keyframes blink { 0% { opacity: 1; } 100% { opacity: .15; } }
@keyframes shake { 25% { transform: translateX(-1px); } 75% { transform: translateX(1px); } }

/* popups */
.popups { position: absolute; left: 0; right: 0; top: 24%; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.popup { text-align: center; line-height: 1; animation: pop 1.7s cubic-bezier(.2, 1.4, .4, 1) forwards; will-change: transform, opacity; }
.popup .p-main { font-size: 26px; letter-spacing: .04em; max-width: calc(100vw - 32px); overflow-wrap: anywhere; text-align: center; }
@media (max-width: 480px) { .popup .p-main { font-size: 21px; } .popup.great .p-main { font-size: 25px; } }
.popup .p-sub { font-size: 13px; letter-spacing: .14em; color: var(--cold); margin-top: 2px; }
.popup.good .p-main { color: #fff; }
.popup.great .p-main { color: var(--hot2); font-size: 32px; }
.popup.bad .p-main { color: var(--bad); }
.popup.info .p-main { color: var(--cold); font-size: 20px; }
@keyframes pop {
  0% { transform: scale(.3) translateY(10px); opacity: 0; }
  14% { transform: scale(1.18); opacity: 1; }
  24% { transform: scale(1); }
  78% { transform: scale(1) translateY(0); opacity: 1; }
  100% { transform: scale(.92) translateY(-24px); opacity: 0; }
}

/* banner */
.banner { position: absolute; left: 0; right: 0; top: 40%; transform: translateY(-50%); text-align: center; padding: 0 12px; display: none; }
.banner.show { display: block; }
.banner .b-main { font-size: clamp(28px, 9vw, 64px); line-height: .95; letter-spacing: .02em; color: #fff; animation: bannerin .45s cubic-bezier(.2, 1.5, .4, 1); }
.banner .b-sub { font-size: clamp(12px, 3.6vw, 18px); letter-spacing: .14em; color: var(--cold); margin-top: 8px; animation: bannerin .6s ease-out; }
.banner.boom .b-main { color: var(--hot2); text-shadow: var(--shadow), 0 0 22px rgba(255, 90, 0, .8); }
@keyframes bannerin { from { transform: scale(1.8); opacity: 0; letter-spacing: .3em; } }

#hud.has-banner .popups { opacity: 0; }
@media (orientation: landscape) {
  /* sits left of the pedals, chips on its left side */
  .gauge { left: auto; right: calc(30px + var(--sar) + clamp(132px, 18vw, 180px)); bottom: calc(12px + var(--sab)); flex-direction: row-reverse; }
  .gauge-side { align-items: flex-end; }
  .ooa { left: auto; right: 0; }
  .popups { top: 20%; }
  .score-val { font-size: 44px; }
}

/* ---------- overlays: menu + loading ---------- */
.overlay[hidden] { display: none !important; }
.overlay { position: fixed; inset: 0; z-index: 10; }
#menu {
  overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(63, 178, 255, .28), transparent 60%),
    radial-gradient(ellipse at 50% 120%, rgba(255, 122, 26, .22), transparent 55%),
    rgba(5, 8, 13, .88);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.menu-inner {
  min-height: 100%; max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(20px + var(--sat)) calc(16px + var(--sar)) calc(16px + var(--sab)) calc(16px + var(--sal)); text-align: center;
}
.menu-kicker { font-size: 11px; letter-spacing: .32em; color: var(--cold); font-weight: 600; }
.menu-title {
  margin: 2px 0 0; font-size: clamp(56px, 19vw, 120px); line-height: .9; font-weight: 700; letter-spacing: .04em; font-style: italic;
  background: linear-gradient(180deg, #ffffff 30%, #9fe0ff 62%, #3fb2ff 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .5)) drop-shadow(0 0 22px rgba(63, 178, 255, .45));
}
.menu-tag { margin: 6px 0 16px; font-size: clamp(15px, 4.4vw, 20px); font-weight: 600; color: var(--hot2); letter-spacing: .04em; }
.menu-levels { display: grid; grid-template-columns: 1fr; gap: 10px; width: 100%; }
.level-card {
  position: relative; text-align: left; border-radius: 16px; padding: 14px 16px; cursor: pointer; overflow: hidden;
  border: 1px solid rgba(159, 224, 255, .3); background: linear-gradient(120deg, rgba(27, 111, 209, .35), rgba(10, 15, 23, .8) 60%);
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'name go' 'desc go'; align-items: center; gap: 2px 12px;
  box-shadow: 0 4px 0 #020407; transition: transform .08s, box-shadow .08s, border-color .15s;
}
.level-card[data-level="house"] { background: linear-gradient(120deg, rgba(255, 179, 71, .3), rgba(10, 15, 23, .8) 60%); }
.level-card[data-level="mars"] { background: linear-gradient(120deg, rgba(214, 74, 32, .42), rgba(10, 15, 23, .8) 60%); }
.level-card:hover { border-color: var(--cold); }
.level-card:active { transform: translateY(3px); box-shadow: 0 1px 0 #020407; }
.lc-name { grid-area: name; font-size: 26px; font-weight: 700; letter-spacing: .1em; }
.lc-desc { grid-area: desc; font-size: 13px; color: rgba(242, 248, 255, .78); line-height: 1.25; font-weight: 500; }
.lc-go { grid-area: go; font-size: 13px; font-weight: 700; letter-spacing: .14em; color: var(--hot2); }
#menu-best { margin-top: 12px; font-size: 13px; letter-spacing: .08em; color: var(--cold); min-height: 1em; }
#menu-best:empty { display: none; }
.menu-hints { margin-top: 14px; font-size: 12px; line-height: 1.5; color: rgba(242, 248, 255, .6); font-weight: 500; }
.menu-hints b { color: var(--cold); font-weight: 700; letter-spacing: .08em; margin-right: 4px; }
.menu-follow { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 14px auto 0; padding: 13px 22px; max-width: 360px; border-radius: 14px;
  background: #f2f8ff; color: #05080d; font-size: 16px; font-weight: 700; letter-spacing: .06em; text-decoration: none; box-shadow: 0 0 22px rgba(159, 224, 255, .35); }
.menu-follow .x { flex: none; }
.menu-follow .handle { font-weight: 500; opacity: .6; font-size: 13px; }
.menu-follow:active { transform: scale(.98); background: #dbeeff; }
.menu-credit { margin-top: 12px; font-size: 11px; letter-spacing: .08em; color: rgba(242, 248, 255, .38); }
@media (hover: none) { .hint-keys { display: none; } }
@media (orientation: landscape) {
  .menu-levels { grid-template-columns: repeat(3, 1fr); }
  .level-card { grid-template-columns: 1fr; grid-template-areas: 'name' 'desc' 'go'; align-content: start; gap: 6px; }
  .lc-go { margin-top: 4px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .menu-title { font-size: 64px; }
  .menu-tag { margin-bottom: 10px; }
  .menu-hints, .menu-credit { margin-top: 8px; }
  .lc-name { font-size: 20px; }
}

#loading { z-index: 20; background: var(--ink); display: flex; align-items: center; justify-content: center; }
.loading-inner { text-align: center; }
.loading-title { font-size: 44px; font-weight: 700; font-style: italic; letter-spacing: .06em; color: var(--cold); }
.loading-bar { width: 200px; height: 4px; border-radius: 2px; background: rgba(159, 224, 255, .15); margin: 12px auto; overflow: hidden; }
.loading-bar i { display: block; height: 100%; width: 40%; background: var(--cold2); border-radius: 2px; animation: load 1.1s ease-in-out infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.loading-text { font-size: 12px; letter-spacing: .2em; color: rgba(242, 248, 255, .55); }

@media (prefers-reduced-motion: reduce) {
  .thr[data-ctl="suck"].on, .gauge.empty .gauge-ring { animation: none; }
}

/* banner must not run under the landscape thruster cluster */
@media (orientation: landscape) {
  .banner { left: 50%; right: auto; width: min(100%, calc(100% - 2 * (40px + clamp(160px, 22vw, 210px)))); transform: translate(-50%, -50%); top: 42%; }
  .banner .b-main { font-size: clamp(26px, min(6.4vw, 12vh), 72px); }
}
/* desktop with a mouse: bigger HUD, quieter pad (keyboard is the main input) */
@media (hover: hover) and (pointer: fine) and (min-width: 1000px) {
  .score-val { font-size: 56px; }
  .speed-val { font-size: 64px; }
  .hud-label, .speed-unit { font-size: 13px; }
  .hud-timer, .best-val { font-size: 16px; }
  .popup .p-main { font-size: 34px; }
  .popup.great .p-main { font-size: 42px; }
  .gauge-ring { width: 80px; height: 80px; }
  .gauge-psi { font-size: 18px; }
  .wheel-hint { display: none; }
  .pad-wheel .wheel, .pad-thr, .pad-pedals { opacity: .5; transition: opacity .2s; }
  .pad-wheel:hover .wheel, .pad-thr:hover, .pad-pedals:hover { opacity: .9; }
}

/* ---- sound gate (first screen) ---- */
#gate { z-index: 60; display: flex; align-items: center; justify-content: center; text-align: center;
  background: radial-gradient(ellipse at 50% 35%, rgba(40,90,140,.55), rgba(3,6,10,.97) 70%); }
#gate[hidden] { display: none; }
.gate-inner { padding: 24px 16px; max-width: 420px; }
.gate-btn { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 34px auto 18px;
  width: min(78vw, 320px); height: 96px; border-radius: 22px; border: 2px solid #7fd4ff;
  background: linear-gradient(180deg, #1d6fa8, #0b3a5c); color: #fff; font: 700 30px/1 'Chakra Petch', system-ui, sans-serif;
  letter-spacing: .08em; box-shadow: 0 0 40px rgba(90,200,255,.45), inset 0 1px 0 rgba(255,255,255,.3);
  animation: gatePulse 1.6s ease-in-out infinite; cursor: pointer; }
.gate-btn:active { transform: scale(.96); }
.gate-icon { font-size: 34px; }
.gate-skip { background: none; border: 0; color: rgba(220,235,255,.6); font: 600 14px 'Chakra Petch', system-ui, sans-serif;
  letter-spacing: .06em; text-decoration: underline; padding: 10px; cursor: pointer; }
.gate-note { margin-top: 18px; font-size: 13px; color: rgba(220,235,255,.55); letter-spacing: .03em; }
@keyframes gatePulse { 0%,100% { box-shadow: 0 0 28px rgba(90,200,255,.35), inset 0 1px 0 rgba(255,255,255,.3); }
  50% { box-shadow: 0 0 60px rgba(90,200,255,.75), inset 0 1px 0 rgba(255,255,255,.3); } }
#hud .gauge { pointer-events: auto; }

.menu-reset { display: block; margin: 14px auto 0; background: none; border: 1px solid rgba(220,235,255,.25); border-radius: 10px;
  color: rgba(220,235,255,.65); font: 600 12px 'Chakra Petch', system-ui, sans-serif; letter-spacing: .06em; padding: 8px 14px; cursor: pointer; }
.menu-reset.armed { border-color: #ff7a3a; color: #ffb08a; }

#stab { position: absolute; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 74px); transform: translateX(-50%);
  padding: 5px 12px; border-radius: 999px; border: 1px solid #7fd4ff; background: rgba(8, 40, 64, .72); color: #bfeaff;
  font: 700 12px 'Chakra Petch', system-ui, sans-serif; letter-spacing: .14em; white-space: nowrap;
  opacity: 0; transition: opacity .25s; pointer-events: none; box-shadow: 0 0 14px rgba(90, 200, 255, .45); }
#stab::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #7fd4ff;
  margin-right: 8px; vertical-align: 1px; animation: stabPulse .6s ease-in-out infinite alternate; }
#stab.on { opacity: 1; }
@keyframes stabPulse { from { opacity: .3; } to { opacity: 1; } }

/* analog pedal level: fill grows with --lvl (slide thumb up = more) */
.pedal { position: relative; overflow: hidden; }
.pedal::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--lvl, 0) * 100%);
  background: linear-gradient(0deg, rgba(125, 255, 178, .45), rgba(125, 255, 178, .08)); pointer-events: none; transition: height .06s; }
.pedal.brake::after { background: linear-gradient(0deg, rgba(255, 70, 70, .5), rgba(255, 70, 70, .08)); }

/* gameplay HUD: unit toggle (tap speedometer), refill pad, hull warning */
#hud .speed { pointer-events: auto; cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; }
.refill-tag { position: absolute; left: 50%; top: 100%; transform: translate(-50%, -2px); font-size: 10px; letter-spacing: .18em;
  color: #dff7ff; opacity: 0; white-space: nowrap; transition: opacity .2s; }
.gauge.refilling .refill-tag { opacity: 1; animation: blink .45s steps(2, jump-none) infinite; }
.gauge.refilling .val { stroke: #bff3ff; filter: drop-shadow(0 0 7px rgba(127, 243, 255, 1)); animation: refillGlow .5s ease-in-out infinite alternate; }
.gauge.refilling .gauge-psi { color: #bff3ff; }
@keyframes refillGlow { from { stroke-width: 7; } to { stroke-width: 9; } }
.hull { margin-top: 6px; font-size: 14px; letter-spacing: .14em; color: var(--hot2); opacity: 0; transition: opacity .3s; }
.hull.show { opacity: 1; }
.hull.warn { color: var(--hot); }
.hull.crit { color: var(--bad); animation: blink .5s steps(2, jump-none) infinite; }
@media (prefers-reduced-motion: reduce) { .gauge.refilling .refill-tag, .gauge.refilling .val, .hull.crit { animation: none; } }
