:root {
  --bg: #07070f;
  --bg2: #0d0d1c;
  --panel: rgba(8, 8, 18, 0.78);
  --panel-edge: rgba(255, 255, 255, 0.08);
  --neon-pink: #ff2ea6;
  --neon-cyan: #00f0ff;
  --neon-lime: #7cff00;
  --neon-amber: #ffb300;
  --kerb-red: #d83541;
  --ink: #e8e8ee;
  --ink-dim: #8a8aa3;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: 'Inter', system-ui, -apple-system, sans-serif; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
#app canvas { touch-action: none; }

/* Game UI is not selectable text — long-pressing HUD buttons/labels was
   selecting the time/mute glyphs and popping the Copy/Paste callout on
   phones. Real text fields opt back in below. */
body {
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
input, textarea {
  user-select: text; -webkit-user-select: text; -webkit-touch-callout: default;
}

#app { position: fixed; inset: 0; }
#app canvas { display: block; }

.hidden { display: none !important; }

/* Speed vignette — a colored rim that swells at high speed / on boost. */
#vignette {
  position: fixed; inset: 0; z-index: 4; pointer-events: none;
  opacity: 0; transition: opacity 120ms linear;
  --vig: 0, 240, 255;
  background: radial-gradient(ellipse 80% 70% at 50% 50%,
    transparent 45%, rgba(var(--vig), 0.10) 72%, rgba(var(--vig), 0.42) 100%);
  mix-blend-mode: screen;
}

/* ==========================================================================
   MENU — "Attract mode": underground neon-racing flyer meets 80s arcade
   ========================================================================== */
.attract {
  --font-display: 'Monoton', system-ui, cursive;
  --font-ui: 'Chakra Petch', system-ui, sans-serif;
  --void: #05030a;
  --pink: #ff2ea6;
  --cyan: #19e7ff;
  --lime: #b6ff3a;
  --amber: #ffb300;
  --violet: #a24bff;
  --hair: rgba(255, 255, 255, 0.10);

  position: fixed; inset: 0; z-index: 10; overflow: hidden;
  display: grid; place-items: center;
  background:
    radial-gradient(120% 80% at 50% -10%, #16082a 0%, transparent 55%),
    linear-gradient(180deg, #0a0616 0%, var(--void) 70%);
  font-family: var(--font-ui);
  color: #f5f0ff;
  -webkit-font-smoothing: antialiased;
}

/* --- Atmosphere layers --- */
.attract .fx { position: absolute; pointer-events: none; }

.grid-floor {
  left: -30%; right: -30%; bottom: -12%; height: 62%;
  background-image:
    linear-gradient(rgba(25, 231, 255, 0.45) 1.5px, transparent 1.5px),
    linear-gradient(90deg, rgba(255, 46, 166, 0.30) 1.5px, transparent 1.5px);
  background-size: 88px 88px, 88px 88px;
  transform: perspective(380px) rotateX(76deg);
  transform-origin: bottom center;
  -webkit-mask-image: linear-gradient(to top, #000 2%, transparent 82%);
  mask-image: linear-gradient(to top, #000 2%, transparent 82%);
  opacity: 0.6;
  animation: floor 5.5s linear infinite;
}
@keyframes floor { to { background-position: 0 88px, 44px 0; } }

.glow-top {
  inset: 0;
  background:
    radial-gradient(52vw 40vh at 20% 2%, rgba(255, 46, 166, 0.20), transparent 62%),
    radial-gradient(50vw 42vh at 84% 6%, rgba(25, 231, 255, 0.16), transparent 62%);
}

.scanlines {
  inset: 0; mix-blend-mode: overlay; opacity: 0.35;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 3px);
}

.grain {
  inset: -60%; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.9s steps(4) infinite;
}
@keyframes grain {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-4%, 2%); }
  50%  { transform: translate(3%, -3%); }
  75%  { transform: translate(-2%, 3%); }
  100% { transform: translate(2%, -2%); }
}

.vignette {
  inset: 0;
  background: radial-gradient(130% 100% at 50% 42%, transparent 52%, rgba(2, 1, 6, 0.85) 100%);
}

/* --- Ticket-stub corner registration marks --- */
.reg { position: absolute; width: 34px; height: 34px; border: 2px solid rgba(25, 231, 255, 0.5); opacity: 0.7; }
.reg-tl { top: 22px; left: 22px; border-right: 0; border-bottom: 0; }
.reg-tr { top: 22px; right: 22px; border-left: 0; border-bottom: 0; }
.reg-bl { bottom: 22px; left: 22px; border-right: 0; border-top: 0; }
.reg-br { bottom: 22px; right: 22px; border-left: 0; border-top: 0; }

/* --- Central stage --- */
.stage {
  position: relative; z-index: 2;
  width: min(660px, 92vw);
  padding: 20px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center;
}
.stage > * { animation: rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.stage > .eyebrow  { animation-delay: 0.05s; }
.stage > .wordmark { animation: flickerIn 1.2s both; }
.stage > .tagline  { animation-delay: 0.30s; }
.stage > .enlist   { animation-delay: 0.42s; }
.stage > .stable   { animation-delay: 0.52s; }
.stage > #play     { animation-delay: 0.64s; }
.stage > .controls { animation-delay: 0.76s; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.eyebrow {
  margin: 0 0 10px; font-size: clamp(9px, 1.4vw, 12px);
  letter-spacing: 0.42em; font-weight: 600; text-indent: 0.42em;
  color: rgba(245, 240, 255, 0.62); text-transform: uppercase;
  display: flex; align-items: center; justify-content: center; gap: 12px;
}
.dot-live {
  width: 8px; height: 8px; border-radius: 50%; background: var(--lime);
  box-shadow: 0 0 10px var(--lime); animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; transform: scale(0.8); } }

.wordmark {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(46px, 12vw, 150px); line-height: 0.86;
  margin: 0; letter-spacing: 0.01em; position: relative;
  color: #ffe3f4;
  text-shadow:
    0 0 6px #fff,
    0 0 16px var(--pink),
    0 0 40px rgba(255, 46, 166, 0.75),
    0 0 80px rgba(162, 75, 255, 0.5);
}
.wordmark em {
  font-style: normal; font-size: 0.26em; vertical-align: 0.9em;
  color: #d6fbff; margin-left: 0.06em;
  text-shadow: 0 0 6px #fff, 0 0 16px var(--cyan), 0 0 34px rgba(25, 231, 255, 0.8);
}
@keyframes flickerIn {
  0%   { opacity: 0; }
  8%   { opacity: 1; }
  10%  { opacity: 0.3; }
  13%  { opacity: 1; }
  18%  { opacity: 0.5; }
  22%  { opacity: 1; }
  70%  { opacity: 1; }
  73%  { opacity: 0.7; }
  76%  { opacity: 1; }
  100% { opacity: 1; }
}

.tagline {
  margin: 12px 0 26px; font-size: clamp(13px, 2.2vw, 19px);
  font-weight: 500; letter-spacing: 0.36em; text-indent: 0.36em;
  text-transform: uppercase; color: #f5f0ff;
}
.tagline i { font-style: normal; color: var(--cyan); margin: 0 0.15em; opacity: 0.75; }

/* --- Rider tag field --- */
.enlist { width: min(420px, 100%); margin: 0 0 22px; }
.field {
  display: flex; align-items: stretch;
  border: 1px solid var(--hair); border-radius: 10px; overflow: hidden;
  background: rgba(10, 6, 22, 0.6); backdrop-filter: blur(6px);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.field:focus-within { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(25, 231, 255, 0.14), 0 0 30px rgba(25, 231, 255, 0.14); }
.field-key {
  display: grid; place-items: center; padding: 0 14px;
  font-size: 10px; letter-spacing: 0.24em; font-weight: 700;
  color: var(--void); background: var(--cyan); white-space: nowrap;
}
#name {
  flex: 1; min-width: 0; padding: 13px 16px;
  background: transparent; border: 0; outline: none;
  color: #fff; font-family: var(--font-ui); font-size: 16px;
  font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
}
#name::placeholder { color: rgba(245, 240, 255, 0.3); letter-spacing: 0.14em; }

/* --- Stable (horse select) --- */
.stable { width: 100%; margin-bottom: 26px; }
.stable-head {
  display: flex; align-items: center; gap: 14px; margin-bottom: 12px;
  font-size: 11px; letter-spacing: 0.34em; font-weight: 600;
  color: rgba(245, 240, 255, 0.55); text-transform: uppercase;
}
.stable-head::before, .stable-head::after {
  content: ""; height: 1px; flex: 1;
  background: linear-gradient(90deg, transparent, var(--hair), transparent);
}

.horses { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.horse-card {
  --swatch: #fff;
  position: relative; cursor: pointer; user-select: none;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 13px 6px 11px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--hair); border-radius: 10px;
  overflow: hidden;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}
.horse-card .stall-bar {
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--swatch); opacity: 0.45; transition: opacity 120ms ease, height 120ms ease;
}
.horse-card .swatch {
  width: 30px; height: 30px; border-radius: 8px;
  background: radial-gradient(circle at 35% 30%, #fff5, transparent 55%), var(--swatch);
  box-shadow: 0 0 16px var(--swatch), inset 0 0 8px rgba(0, 0, 0, 0.4);
}
.horse-card .stall-name {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: #f5f0ff;
}
.horse-card .stall-tag {
  font-size: 8.5px; font-weight: 600; letter-spacing: 0.18em;
  color: rgba(245, 240, 255, 0.45); text-transform: uppercase;
}
.horse-card:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.05); }
.horse-card.selected {
  border-color: var(--swatch); background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 1px var(--swatch), 0 0 26px -6px var(--swatch);
}
.horse-card.selected .stall-bar { opacity: 1; height: 4px; box-shadow: 0 0 12px var(--swatch); }
.horse-card.selected .stall-tag { color: var(--swatch); }

/* --- RACE button --- */
#play {
  position: relative; overflow: hidden; cursor: pointer;
  width: min(420px, 100%); padding: 16px 20px 13px;
  border: 0; border-radius: 12px;
  background: linear-gradient(100deg, var(--pink), var(--violet) 55%, var(--cyan));
  color: #fff; font-family: var(--font-ui);
  box-shadow: 0 14px 34px -8px rgba(255, 46, 166, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  transition: transform 90ms ease, box-shadow 160ms ease, filter 160ms ease;
}
#play::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.4) 50%, transparent 70%);
  transform: translateX(-120%); animation: sweep 3.4s ease-in-out infinite;
}
@keyframes sweep { 0%, 55% { transform: translateX(-120%); } 80%, 100% { transform: translateX(120%); } }
.play-label { display: block; font-size: 26px; font-weight: 700; letter-spacing: 0.3em; text-indent: 0.3em; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); }
.play-sub { display: block; margin-top: 2px; font-size: 9px; font-weight: 600; letter-spacing: 0.34em; color: rgba(255, 255, 255, 0.8); }
#play:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 20px 44px -8px rgba(255, 46, 166, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.2) inset; }
#play:active { transform: translateY(0); }
#play:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

/* --- Secondary menu button (create private lobby) --- */
.secondary-btn {
  width: min(420px, 100%); margin-top: 10px; cursor: pointer;
  padding: 12px; border-radius: 12px;
  background: transparent; border: 1px solid var(--hair);
  color: var(--ink); font-family: inherit; font-size: 13px; font-weight: 700; letter-spacing: 2px;
  transition: transform 90ms ease, border-color 140ms ease, box-shadow 160ms ease, color 140ms ease;
}
.secondary-btn:hover { transform: translateY(-1px); border-color: var(--violet); color: #fff; box-shadow: 0 0 24px -8px var(--violet); }

/* --- Invite banner (arrived via ?lobby=CODE) --- */
.invite-banner {
  width: min(420px, 100%); margin-bottom: 14px; padding: 11px 14px; border-radius: 10px;
  background: rgba(0, 240, 255, 0.08); border: 1px solid rgba(25, 231, 255, 0.4);
  color: var(--ink); font-size: 12px; letter-spacing: 1.5px; text-align: center;
}
.invite-banner b { color: var(--cyan); letter-spacing: 3px; }

/* --- Controls hint --- */
.controls {
  display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;
  margin-top: 22px; color: rgba(245, 240, 255, 0.5);
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; font-weight: 500;
}
.controls kbd {
  display: inline-block; padding: 2px 6px; margin-right: 3px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--hair); border-bottom-width: 2px; border-radius: 4px;
  color: #f5f0ff; font-family: var(--font-ui); font-size: 10px; font-weight: 600;
}

/* --- Bottom hype ticker --- */
.ticker {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 1;
  padding: 9px 0; overflow: hidden; white-space: nowrap;
  border-top: 1px solid var(--hair);
  background: linear-gradient(180deg, transparent, rgba(5, 3, 10, 0.85));
}
.ticker-track { display: inline-flex; align-items: center; gap: 26px; animation: marquee 22s linear infinite; }
.ticker span { font-size: 12px; letter-spacing: 0.3em; font-weight: 700; color: rgba(245, 240, 255, 0.72); text-transform: uppercase; }
.ticker b { color: var(--pink); font-size: 10px; }
@keyframes marquee { to { transform: translateX(-50%); } }

@media (max-width: 460px) {
  .horses { grid-template-columns: repeat(2, 1fr); }
}
/* Menu must scroll when it can't fit (phones, landscape, small tablets). */
@media (max-height: 800px), (max-width: 640px) {
  .attract { overflow-y: auto; place-items: start center; }
  .stage { padding: 30px 16px 72px; }
  .wordmark { font-size: clamp(38px, 10vw, 90px); }
}
@media (prefers-reduced-motion: reduce) {
  .attract .fx, .stage > *, #play::after, .ticker-track, .dot-live { animation: none !important; }
  .grid-floor { opacity: 0.4; }
}

/* ---------- HUD ---------- */
.hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.hud > div { position: absolute; }

.hud-tl { top: 18px; left: 18px; }
.hud-tr { top: 18px; right: 18px; }
.hud-bl { bottom: 22px; left: 22px; }
.hud-br { bottom: 22px; right: 22px; }
.hud-tc { top: 18px; left: 50%; transform: translateX(-50%); }

/* Position + leaderboard top-left */
.pos-box {
  background: var(--panel);
  backdrop-filter: blur(6px);
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  padding: 10px 16px 12px;
  min-width: 170px;
}
.pos-line { display: flex; align-items: baseline; gap: 4px; line-height: 1; }
.pos-big {
  font-size: 56px; font-weight: 900;
  color: var(--neon-amber);
  text-shadow: 0 0 20px rgba(255, 179, 0, 0.55);
  font-variant-numeric: tabular-nums;
}
.pos-slash { font-size: 30px; color: var(--ink-dim); font-weight: 900; }
.pos-total { font-size: 30px; color: var(--ink); font-weight: 900; font-variant-numeric: tabular-nums; }
.pos-sub {
  margin-top: 4px;
  font-size: 13px; letter-spacing: 3px; font-weight: 800;
  color: var(--ink-dim);
}
.pos-sub span { color: var(--ink); }

.leader {
  list-style: none; margin: 10px 0 0; padding: 8px 12px;
  background: var(--panel);
  backdrop-filter: blur(6px);
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  min-width: 190px;
  font-size: 13px; letter-spacing: 1px;
}
.leader li {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 0;
  color: var(--ink-dim);
  font-weight: 600;
}
.leader li.me {
  color: var(--neon-amber);
  background: linear-gradient(90deg, rgba(255, 179, 0, 0.10), transparent);
  margin: 0 -12px; padding: 3px 12px;
  border-left: 3px solid var(--neon-amber);
}
.leader li.lead1 { color: var(--ink); }
.leader li .ord { width: 14px; color: var(--ink); font-weight: 900; text-align: right; }
.leader li.me .ord { color: var(--neon-amber); }
.leader li .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leader li .crown { color: var(--neon-amber); font-size: 14px; line-height: 1; }

/* Map name tag above the minimap */
.map-tag {
  text-align: right;
  margin-bottom: 6px;
  font-size: 12px; font-weight: 800; letter-spacing: 3px;
  color: var(--neon-cyan);
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.5);
}

/* Minimap top-right */
#minimap {
  display: block;
  background: var(--panel);
  backdrop-filter: blur(6px);
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  padding: 0;
  width: 300px; height: 190px;
}

/* Top-center time */
.time-box {
  background: var(--panel);
  backdrop-filter: blur(6px);
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  padding: 6px 16px;
  text-align: center;
  font-weight: 900; letter-spacing: 2px;
}
.time-box .k { display: block; font-size: 9px; color: var(--ink-dim); letter-spacing: 3px; }
.time-box span:last-child { font-size: 18px; font-variant-numeric: tabular-nums; }

/* Finish-grace countdown under the race clock */
.grace-box {
  margin-top: 6px; padding: 4px 12px; border-radius: 8px;
  background: rgba(255, 51, 68, 0.14);
  border: 1px solid rgba(255, 51, 68, 0.55);
  color: #ff5a66; font-size: 12px; font-weight: 900; letter-spacing: 2px;
  text-align: center; font-variant-numeric: tabular-nums;
  animation: gracePulse 0.9s ease-in-out infinite;
}
.grace-box span { font-size: 14px; }
@keyframes gracePulse { 50% { background: rgba(255, 51, 68, 0.3); box-shadow: 0 0 18px rgba(255, 51, 68, 0.4); } }

/* Stamina bottom-left */
.stamina {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel);
  backdrop-filter: blur(6px);
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  padding: 10px 16px 10px 12px;
}
.stamina-icon {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(124, 255, 0, 0.10);
  color: var(--neon-lime);
  box-shadow: 0 0 14px rgba(124, 255, 0, 0.35) inset;
}
.stamina-icon svg { width: 18px; height: 18px; }
.stamina-body { display: flex; flex-direction: column; gap: 4px; }
.stamina-label {
  font-size: 11px; letter-spacing: 3px; color: var(--ink-dim); font-weight: 800;
}
.stamina-segs {
  display: flex; gap: 4px;
}
.stamina-segs .seg {
  width: 22px; height: 16px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  transition: background 80ms linear, box-shadow 80ms linear;
}
.stamina-segs .seg.on { background: var(--seg-color, var(--neon-lime)); box-shadow: 0 0 10px var(--seg-color, var(--neon-lime)); }

/* Boost circle bottom-right */
.boost {
  position: relative;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(255, 179, 0, 0.22), rgba(8, 8, 18, 0.7) 65%);
  border: 3px solid rgba(255, 179, 0, 0.55);
  box-shadow:
    0 0 24px rgba(255, 179, 0, 0.25),
    inset 0 0 18px rgba(255, 179, 0, 0.15);
  display: grid; place-items: center;
  color: var(--neon-amber);
  text-align: center;
  transition: transform 60ms ease, box-shadow 80ms ease, border-color 80ms ease;
}
.boost.active {
  border-color: var(--neon-amber);
  box-shadow:
    0 0 40px rgba(255, 179, 0, 0.7),
    inset 0 0 26px rgba(255, 179, 0, 0.35);
  transform: scale(1.04);
}
/* Exhausted → "recharging": drain the amber, cool it down, gentle pulse. */
.boost.exhausted {
  border-color: rgba(120, 130, 160, 0.5);
  color: var(--ink-dim);
  background: radial-gradient(circle at 50% 45%, rgba(90, 100, 130, 0.14), rgba(8, 8, 18, 0.7) 65%);
  box-shadow: 0 0 18px rgba(90, 100, 130, 0.25);
  transform: none;
  animation: recharge 1s ease-in-out infinite;
}
.boost.exhausted svg { filter: none; opacity: 0.5; }
@keyframes recharge { 50% { border-color: rgba(0, 240, 255, 0.55); box-shadow: 0 0 22px rgba(0, 240, 255, 0.28); } }
.stamina-segs.exhausted { animation: staminaPulse 0.8s ease-in-out infinite; }
@keyframes staminaPulse { 50% { opacity: 0.45; } }

.boost svg { width: 38px; height: 38px; margin-top: -6px; filter: drop-shadow(0 0 8px rgba(255, 179, 0, 0.7)); }
.boost-label { position: absolute; bottom: 22px; font-size: 11px; font-weight: 900; letter-spacing: 3px; }
.boost-key {
  position: absolute; bottom: 4px;
  font-size: 9px; letter-spacing: 2px; color: var(--ink-dim);
  background: rgba(8, 8, 18, 0.7);
  border: 1px solid var(--panel-edge);
  padding: 2px 6px; border-radius: 4px;
}

/* Mute toggle */
#muteBtn {
  position: absolute; top: 18px; right: 336px;
  pointer-events: auto; cursor: pointer;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--panel); backdrop-filter: blur(6px);
  border: 1px solid var(--panel-edge); border-radius: 10px;
  color: var(--neon-cyan); font-size: 18px; line-height: 1;
  transition: color 80ms ease, border-color 80ms ease;
}
#muteBtn:hover { border-color: var(--neon-cyan); }
#muteBtn.muted { color: var(--ink-dim); }

/* ---------- Post-race results ---------- */
.results {
  position: fixed; inset: 0; z-index: 8;
  display: grid; place-items: center;
  background: rgba(4, 4, 10, 0.55);
  backdrop-filter: blur(4px);
  animation: fade 300ms ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.results-panel {
  width: min(440px, 92vw);
  padding: 24px 26px;
  background: linear-gradient(180deg, rgba(20, 20, 36, 0.96), rgba(8, 8, 18, 0.96));
  border: 1px solid var(--panel-edge);
  border-radius: 16px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 240, 255, 0.18) inset;
}
.results-head { text-align: center; margin-bottom: 16px; }
.results-eyebrow { font-size: 11px; letter-spacing: 5px; color: var(--ink-dim); font-weight: 800; }
.results-place {
  font-size: 72px; font-weight: 900; line-height: 1.05; margin-top: 2px;
  background: linear-gradient(90deg, var(--neon-amber), var(--neon-pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 40px rgba(255, 179, 0, 0.35);
}
.results-tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.results-tbl td { padding: 6px 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); color: var(--ink-dim); }
.results-tbl .rp { width: 28px; font-weight: 900; color: var(--ink); text-align: right; }
.results-tbl .rm { width: 26px; text-align: center; }
.results-tbl .rn { color: var(--ink); font-weight: 700; letter-spacing: 1px; }
.results-tbl .rt { text-align: right; font-variant-numeric: tabular-nums; }
.results-tbl tr.me td { color: var(--neon-amber); }
.results-tbl tr.me .rp, .results-tbl tr.me .rn { color: var(--neon-amber); }
.results-tbl tr.proj .rt { color: #6b6b85; font-style: italic; }

.results-actions { display: flex; gap: 10px; margin-top: 20px; }
.res-btn {
  flex: 1; cursor: pointer; padding: 12px 10px;
  font-family: inherit; font-size: 13px; font-weight: 800; letter-spacing: 2px;
  color: var(--ink); background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-edge); border-radius: 10px;
  transition: transform 80ms ease, box-shadow 140ms ease, background 140ms ease, border-color 140ms ease;
}
.res-btn:hover { transform: translateY(-1px); background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.25); }
.res-btn:active { transform: translateY(0); }
.res-btn.primary {
  color: #07070f; border: none;
  background: linear-gradient(100deg, var(--neon-pink), var(--neon-cyan));
  box-shadow: 0 8px 22px -6px rgba(255, 46, 166, 0.6);
}
.res-btn.primary:hover { filter: brightness(1.07); box-shadow: 0 12px 28px -6px rgba(255, 46, 166, 0.7); }

.results-foot { text-align: center; margin-top: 14px; font-size: 11px; letter-spacing: 3px; color: var(--ink-dim); }
.results-foot span { color: var(--neon-cyan); font-variant-numeric: tabular-nums; }

/* ---------- Spectator ---------- */
.spec-bar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 8;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 12px;
  background: rgba(6, 5, 14, 0.82); backdrop-filter: blur(6px);
  border: 1px solid var(--panel-edge);
  font-family: 'Chakra Petch', system-ui, sans-serif; color: var(--ink);
}
.spec-eye { font-size: 11px; letter-spacing: 2px; font-weight: 800; color: var(--neon-cyan); }
.spec-name { min-width: 90px; text-align: center; font-weight: 800; letter-spacing: 1px; color: #fff; }
.spec-arrow {
  cursor: pointer; width: 30px; height: 30px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--panel-edge);
  color: var(--ink); font-size: 18px; line-height: 1;
}
.spec-arrow:hover { border-color: var(--neon-cyan); color: var(--neon-cyan); }
.spec-lobby {
  cursor: pointer; margin-left: 6px; padding: 7px 12px; border-radius: 8px;
  background: transparent; border: 1px solid var(--panel-edge);
  color: var(--ink-dim); font-family: inherit; font-size: 11px; font-weight: 700; letter-spacing: 1px;
}
.spec-lobby:hover { border-color: var(--neon-amber); color: var(--neon-amber); }
/* Hide the racer-only HUD while spectating. */
body.spectating .hud-bl, body.spectating .hud-br, body.spectating .pos-box { display: none; }

/* ---------- Chat ---------- */
.chat {
  position: fixed; left: 20px; bottom: 96px; z-index: 7;
  width: min(340px, 44vw);
  display: flex; flex-direction: column; gap: 6px;
  pointer-events: none;
  font-family: 'Chakra Petch', system-ui, sans-serif;
}
.chat-log { display: flex; flex-direction: column; gap: 3px; }
.cm {
  align-self: flex-start; max-width: 100%;
  padding: 3px 9px; border-radius: 8px;
  background: rgba(6, 5, 14, 0.55); backdrop-filter: blur(3px);
  font-size: 13px; line-height: 1.3; letter-spacing: 0.3px;
  color: var(--ink); word-break: break-word;
  transition: opacity 1.2s ease;
}
.cm.fade { opacity: 0; }
.cm-name { font-weight: 800; margin-right: 2px; }
.cm-text { color: #ececf5; }
.chat-input {
  pointer-events: auto;
  padding: 9px 12px; border-radius: 9px;
  background: rgba(6, 5, 14, 0.9); border: 1px solid var(--neon-cyan);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.14);
  color: #fff; font-family: inherit; font-size: 14px; letter-spacing: 0.5px; outline: none;
}
.chat-input::placeholder { color: rgba(245, 240, 255, 0.4); }
.chat-hint {
  align-self: flex-start;
  font-size: 10px; letter-spacing: 2px; color: var(--ink-dim); text-transform: uppercase;
  background: rgba(6, 5, 14, 0.45); padding: 3px 8px; border-radius: 7px;
}
.chat-hint kbd {
  display: inline-block; padding: 0 5px; margin-right: 4px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--panel-edge);
  border-radius: 3px; color: var(--ink); font-family: inherit;
}

/* ---------- Pre-race lobby ---------- */
.lobby-overlay {
  position: fixed; inset: 0; z-index: 9;
  display: grid; place-items: center;
  background: rgba(4, 3, 10, 0.55); backdrop-filter: blur(5px);
  animation: fade 240ms ease-out;
  font-family: 'Chakra Petch', system-ui, sans-serif;
}
.lobby-card {
  width: min(440px, 94vw); max-height: 88vh; overflow: hidden;
  display: flex; flex-direction: column;
  padding: 22px 24px 20px;
  background: linear-gradient(180deg, rgba(20, 18, 34, 0.97), rgba(8, 8, 18, 0.97));
  border: 1px solid var(--panel-edge); border-radius: 16px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 240, 255, 0.16) inset;
}
.lobby-top { display: flex; align-items: baseline; justify-content: space-between; }
.lobby-eyebrow { font-size: 10px; letter-spacing: 4px; color: var(--ink-dim); font-weight: 700; }
.lobby-map {
  font-size: 20px; font-weight: 800; letter-spacing: 2px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lobby-status {
  margin: 12px 0 14px; font-size: 15px; letter-spacing: 3px; font-weight: 800;
  color: var(--ink-dim);
}
.lobby-status.go { color: var(--neon-lime); text-shadow: 0 0 16px rgba(124, 255, 0, 0.5); animation: pulse 0.9s ease-in-out infinite; }
.invite-row { margin-bottom: 14px; }
.invite-label { font-size: 10px; letter-spacing: 2px; color: var(--ink-dim); font-weight: 700; margin-bottom: 5px; }
.invite-link {
  display: flex; align-items: stretch; gap: 6px;
  border: 1px solid var(--panel-edge); border-radius: 9px; overflow: hidden;
  background: rgba(6, 5, 14, 0.6);
}
.invite-link #inviteUrl {
  flex: 1; min-width: 0; padding: 9px 11px;
  font-size: 12px; color: var(--neon-cyan); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: 'Chakra Petch', monospace;
}
.invite-link #copyBtn {
  flex: none; cursor: pointer; padding: 0 16px; border: 0;
  background: var(--neon-cyan); color: #07070f;
  font-family: inherit; font-size: 11px; font-weight: 800; letter-spacing: 2px;
}
.invite-link #copyBtn:hover { filter: brightness(1.08); }
.lobby-roster-head { font-size: 10px; letter-spacing: 3px; color: var(--ink-dim); font-weight: 700; margin-bottom: 8px; }
/* Fixed height (not max-height): the roster fills with bots over the first few
   ticks, and a growing list moved the READY button mid-click. */
.lobby-roster { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; height: clamp(150px, 24vh, 260px); }
/* Lobby chat panel */
.lobby-chat { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.lobby-chat-log {
  height: 96px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px; border-radius: 9px;
  background: rgba(6, 5, 14, 0.5); border: 1px solid var(--panel-edge);
  font-size: 12.5px; line-height: 1.35;
}
.lobby-chat-log:empty::before { content: 'say hi to your lobby…'; color: var(--ink-dim); font-size: 11px; letter-spacing: 1px; }
.lobby-chat-log .cm-name { font-weight: 800; margin-right: 3px; }
.lobby-chat-log .cm-text { color: #ececf5; }
.lobby-chat-input {
  padding: 9px 12px; border-radius: 9px;
  background: rgba(6, 5, 14, 0.8); border: 1px solid var(--panel-edge);
  color: #fff; font-family: inherit; font-size: 13px; letter-spacing: 0.4px; outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.lobby-chat-input:focus { border-color: var(--neon-cyan); box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.14); }
.lobby-chat-input::placeholder { color: rgba(245, 240, 255, 0.35); }
.r-row {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid transparent; border-radius: 8px;
  font-size: 13px; letter-spacing: 1px;
}
.r-row.me { border-color: rgba(255, 179, 0, 0.4); background: linear-gradient(90deg, rgba(255, 179, 0, 0.10), transparent); }
.r-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.r-name { flex: 1; color: var(--ink); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-row.me .r-name { color: var(--neon-amber); }
.r-ready { font-size: 10px; font-weight: 800; letter-spacing: 2px; color: var(--neon-lime); }
.r-wait { color: var(--ink-dim); font-size: 16px; line-height: 1; }
.r-bot { font-size: 9px; font-weight: 700; letter-spacing: 2px; color: var(--ink-dim); }
.ready-btn {
  margin-top: 16px; cursor: pointer; padding: 14px; border: 0; border-radius: 12px;
  font-family: inherit; font-size: 16px; font-weight: 800; letter-spacing: 3px; color: #07070f;
  background: linear-gradient(100deg, var(--neon-lime), var(--neon-cyan));
  box-shadow: 0 12px 30px -8px rgba(124, 255, 0, 0.5);
  transition: transform 90ms ease, filter 140ms ease, box-shadow 160ms ease;
}
.ready-btn:hover { transform: translateY(-2px); filter: brightness(1.06); }
.ready-btn:active { transform: translateY(0); }
.ready-btn.is-ready { background: linear-gradient(100deg, var(--neon-amber), var(--neon-pink)); box-shadow: 0 12px 30px -8px rgba(255, 179, 0, 0.55); }
.lobby-hint { text-align: center; margin-top: 10px; font-size: 10px; letter-spacing: 1px; color: var(--ink-dim); }

/* ---------- Leaderboard ---------- */
.lb-open {
  margin: 4px 0 0; cursor: pointer;
  background: transparent; border: 1px solid var(--panel-edge);
  border-radius: 10px; padding: 9px 18px;
  color: var(--neon-amber); font-family: inherit;
  font-size: 12px; font-weight: 700; letter-spacing: 3px;
  transition: transform 80ms ease, border-color 120ms ease, box-shadow 160ms ease;
}
.lb-open:hover { transform: translateY(-1px); border-color: var(--neon-amber); box-shadow: 0 0 22px -6px var(--neon-amber); }

.lb-overlay {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background: rgba(4, 3, 10, 0.72); backdrop-filter: blur(6px);
  animation: fade 240ms ease-out;
  font-family: 'Chakra Petch', system-ui, sans-serif;
}
.lb-card {
  width: min(460px, 94vw); max-height: 86vh; overflow: hidden;
  display: flex; flex-direction: column;
  padding: 22px 22px 18px;
  background: linear-gradient(180deg, rgba(20, 18, 34, 0.97), rgba(8, 8, 18, 0.97));
  border: 1px solid var(--panel-edge); border-radius: 16px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 179, 0, 0.18) inset;
}
.lb-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.lb-title {
  font-size: 24px; font-weight: 800; letter-spacing: 3px;
  background: linear-gradient(90deg, var(--neon-amber), var(--neon-pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lb-date { font-size: 10px; letter-spacing: 2px; color: var(--ink-dim); margin-top: 2px; }
.lb-close {
  cursor: pointer; width: 32px; height: 32px; flex: none;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--panel-edge);
  border-radius: 8px; color: var(--ink); font-size: 14px;
}
.lb-close:hover { border-color: var(--neon-pink); color: var(--neon-pink); }
.lb-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.lb-tab {
  flex: 1; cursor: pointer; padding: 9px; border-radius: 9px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--panel-edge);
  color: var(--ink-dim); font-family: inherit; font-size: 12px; font-weight: 700; letter-spacing: 2px;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}
.lb-tab.active { color: #07070f; background: linear-gradient(90deg, var(--neon-amber), var(--neon-pink)); border-color: transparent; }
.lb-table { width: 100%; border-collapse: collapse; font-size: 14px; display: block; overflow-y: auto; }
.lb-table thead th {
  position: sticky; top: 0; text-align: right; padding: 6px 6px;
  font-size: 10px; letter-spacing: 2px; color: var(--ink-dim); font-weight: 700;
  background: rgba(8, 8, 18, 0.97);
}
.lb-table th.c-rank, .lb-table td.c-rank { width: 34px; text-align: center; }
.lb-table th.c-name, .lb-table td.c-name { text-align: left; }
.lb-table tbody td { padding: 7px 6px; text-align: right; border-bottom: 1px solid rgba(255, 255, 255, 0.05); color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.lb-table td.c-rank { font-weight: 900; color: var(--ink); }
.lb-table td.c-name { color: var(--ink); font-weight: 700; letter-spacing: 1px; }
.lb-table tbody tr:nth-child(1) td.c-name { color: var(--neon-amber); }
.lb-empty { text-align: center; padding: 24px 0 8px; color: var(--ink-dim); font-size: 12px; letter-spacing: 1px; }

/* ---------- Touch controls ---------- */
.touch-steer {
  position: absolute; left: 16px; bottom: 18px;
  display: flex; gap: 14px;
}
.t-btn {
  pointer-events: auto; user-select: none; -webkit-user-select: none;
  touch-action: none; cursor: pointer;
  width: 84px; height: 84px; border-radius: 50%;
  background: rgba(10, 8, 22, 0.55); backdrop-filter: blur(4px);
  border: 2px solid rgba(255, 255, 255, 0.22);
  color: var(--ink); font-family: inherit; font-size: 28px; line-height: 1;
  display: grid; place-items: center;
}
.t-btn:active { background: rgba(0, 240, 255, 0.18); border-color: var(--neon-cyan); }
.t-drift {
  position: absolute; right: 26px; bottom: 150px;
  width: 76px; height: 76px;
  font-size: 13px; font-weight: 900; letter-spacing: 1px;
  color: var(--neon-pink); border-color: rgba(255, 46, 166, 0.5);
}
.t-drift:active { background: rgba(255, 46, 166, 0.2); border-color: var(--neon-pink); }
body.touch .boost { pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none; }
/* Touch layout: stamina moves up out of the steer zone; chat sits above the arrows. */
body.touch .hud-bl { bottom: 116px; }
body.touch .chat { bottom: 210px; }
body.touch .chat-hint { pointer-events: auto; cursor: pointer; }

/* ---------- Small screens (phones + small tablets) ---------- */
@media (max-width: 860px) {
  .hud-tl { top: 10px; left: 10px; }
  .hud-tr { top: 10px; right: 10px; }
  .pos-box { padding: 6px 12px 8px; min-width: 120px; }
  .pos-big { font-size: 36px; }
  .pos-slash, .pos-total { font-size: 20px; }
  .pos-sub { font-size: 10px; letter-spacing: 2px; }
  .leader { min-width: 150px; font-size: 11px; padding: 6px 10px; }
  #minimap { width: 168px; height: 106px; }
  .map-tag { font-size: 10px; }
  .time-box { padding: 4px 10px; }
  .time-box span:last-child { font-size: 14px; }
  #muteBtn { right: 10px; top: 126px; width: 34px; height: 34px; }  /* below the minimap, clear of the time box */
  .stamina { padding: 6px 10px; gap: 8px; }
  .stamina-icon { width: 26px; height: 26px; }
  .stamina-segs .seg { width: 14px; height: 12px; }
  .boost { width: 88px; height: 88px; }
  .boost svg { width: 28px; height: 28px; }
  .boost-label { font-size: 9px; bottom: 16px; }
  .boost-key { display: none; }
  .chat { width: min(280px, 56vw); }
  .lobby-card, .results-panel, .lb-card { padding: 16px 16px 14px; }
  .results-place { font-size: 52px; }
}
@media (max-width: 620px) {
  .leader { display: none; }   /* position + lap still visible; standings at race end */
  .spec-bar { bottom: 118px; }
}
/* Touch devices: backdrop blur is brutal on mobile GPUs — drop it everywhere
   (panels keep their translucent backgrounds, just without live blur). */
@media (pointer: coarse) {
  .pos-box, .leader, #minimap, .time-box, .stamina, .lobby-overlay, .lobby-card,
  .results, .lb-overlay, .cm, .chat-input, .spec-bar, .t-btn {
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
}

/* Short screens (landscape phones): compact HUD, scrollable overlays. */
@media (max-height: 480px) {
  .pos-big { font-size: 28px; }
  .lobby-card, .results-panel, .lb-card { max-height: 94vh; overflow-y: auto; }
  .lobby-roster { height: 110px; }
  .lobby-chat-log { height: 56px; }
}
/* Landscape touch: everything gets an explicit, non-overlapping slot —
   steer bottom-left, stamina bottom-center, boost+drift bottom-right,
   chat top-left under the position box (clamped), minimap+mute top-right. */
@media (pointer: coarse) and (max-height: 520px) {
  .t-btn { width: 64px; height: 64px; font-size: 22px; }
  .touch-steer { left: 12px; bottom: 12px; gap: 10px; }
  .t-drift { right: 18px; bottom: 108px; width: 58px; height: 58px; font-size: 11px; }
  .boost { width: 74px; height: 74px; }
  .hud-br { bottom: 14px; right: 18px; }
  body.touch .hud-bl { bottom: 10px; left: 50%; transform: translateX(-50%); }
  .stamina { padding: 4px 8px; }
  .stamina-label { display: none; }
  body.touch .chat { top: 88px; bottom: auto; left: 10px; width: 190px; }
  .chat-log { max-height: 120px; overflow: hidden; }
  #minimap { width: 132px; height: 84px; }
  #muteBtn { top: 100px; right: 10px; width: 30px; height: 30px; }
  .grace-box { margin-top: 3px; padding: 2px 8px; font-size: 10px; }
  .spec-bar { bottom: 96px; }
}

/* ---------- Big centered text (3-2-1-GO!) ---------- */
.bigtext {
  position: fixed; inset: 0; z-index: 6;
  display: grid; place-items: center;
  pointer-events: none;
}
.bigtext span {
  font-size: clamp(90px, 18vw, 220px);
  font-weight: 900;
  letter-spacing: 4px;
  max-width: 94vw;
  text-align: center;
  line-height: 0.95;
  overflow-wrap: break-word;
  background: linear-gradient(180deg, var(--neon-cyan), var(--neon-pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 60px rgba(255, 46, 166, 0.4);
  animation: pop 700ms ease-out;
}
/* Word messages (LAP 2, FINISH!, BACK ON TRACK, DISCONNECTED) — far smaller
   than the 3-2-1-GO glyphs so they always fit the screen. */
.bigtext span.msg {
  font-size: clamp(28px, 6.5vw, 76px);
  letter-spacing: 3px;
}
@keyframes pop {
  0%   { transform: scale(0.4); opacity: 0; }
  30%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------- Menu on mobile: fit on one screen, no scrolling ---------- */
/* Touch: keyboard hints are meaningless, ticker steals bottom space. */
@media (pointer: coarse) {
  .controls, .ticker { display: none; }
}
/* Portrait phones: compact everything; horse stalls go 4-wide x 2 rows. */
@media (max-width: 640px) {
  .attract { place-items: start center; }
  .stage { margin-block: auto; padding: 14px 14px 20px; }
  .eyebrow { font-size: 8px; margin-bottom: 6px; letter-spacing: 0.3em; }
  .wordmark { font-size: clamp(34px, 11vw, 50px); }
  .tagline { margin: 8px 0 14px; font-size: 11px; }
  .enlist { margin-bottom: 12px; }
  #name { padding: 10px 12px; font-size: 14px; }
  .field-key { font-size: 8px; padding: 0 9px; }
  .stable { margin-bottom: 14px; }
  .stable-head { margin-bottom: 8px; font-size: 9px; }
  .horses { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .horse-card { padding: 8px 3px 7px; gap: 4px; }
  .horse-card .swatch { width: 20px; height: 20px; border-radius: 5px; }
  .horse-card .stall-name { font-size: 8px; letter-spacing: 0; }
  .horse-card .stall-tag { display: none; }
  .invite-banner { margin-bottom: 10px; padding: 8px 10px; font-size: 10px; }
  #play { padding: 12px 16px 10px; }
  .play-label { font-size: 20px; }
  .play-sub { font-size: 8px; letter-spacing: 0.25em; }
  .secondary-btn { margin-top: 8px; padding: 10px; font-size: 11px; }
  .lb-open { margin-top: 4px; padding: 7px 14px; font-size: 10px; }
}
/* Landscape phones: brutal compaction — one row of 8 stalls, no frills. */
@media (pointer: coarse) and (max-height: 520px) {
  .eyebrow, .tagline, .stable-head, .play-sub { display: none; }
  .stage { margin-block: auto; padding: 10px 14px; }
  .wordmark { font-size: 30px; }
  .enlist { margin-bottom: 8px; }
  .stable { margin-bottom: 10px; }
  .horses { grid-template-columns: repeat(8, 1fr); gap: 5px; }
  .horse-card .stall-name { font-size: 7px; }
  #play { padding: 9px 14px; }
  .play-label { font-size: 16px; }
  .secondary-btn { margin-top: 6px; padding: 8px; font-size: 10px; }
  .lb-open { margin-top: 3px; padding: 5px 10px; font-size: 9px; }
}
