/* ─── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --neon:     #00e6ff;
  --neon-dim: rgba(0,230,255,0.18);
  --neon-glow: 0 0 24px rgba(0,230,255,0.55);
  --magenta:  #ff3ea5;
  --magenta-dim: rgba(255,62,165,0.2);
  --magenta-glow: 0 0 22px rgba(255,62,165,0.55);
  /* Legacy aliases — keep so non-lobby UI (HUD, builder) still resolves. */
  --gold:    var(--neon);
  --gold-dim: var(--neon-dim);
  --red:     var(--magenta);
  --red-dim: var(--magenta-dim);
  --bg:      #060812;
  --surface: rgba(255,255,255,0.05);
  --border:  rgba(255,255,255,0.10);
  --text:    #f0f4ff;
  --muted:   #8090b0;
  --font:    'Courier New', Courier, monospace;
  --radius:  12px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  color: var(--text);
  min-height: 100vh;
}

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

/* ─── Animated lobby background ─────────────────────────── */
#lobby-bg {
  position: fixed;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(8,12,10,0.15) 0%, rgba(8,12,10,0.35) 100%),
    url('speed-rush-bg.webp') center / cover no-repeat;
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,230,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,230,255,0.06) 1px, transparent 1px);
  background-size: 60px 60px;
  transform: perspective(600px) rotateX(40deg) translateY(-30%);
  transform-origin: center bottom;
  animation: grid-scroll 8s linear infinite;
  mix-blend-mode: screen;
}

@keyframes grid-scroll {
  from { background-position: 0 0; }
  to   { background-position: 0 60px; }
}

.bg-stripe {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, transparent, rgba(0,230,255,0.2) 40%, transparent);
  animation: stripe-move 6s ease-in-out infinite;
  mix-blend-mode: screen;
}
.bg-stripe:nth-child(1) { left: 20%;  animation-delay: 0s;   animation-duration: 7s; }
.bg-stripe:nth-child(2) { left: 50%;  animation-delay: 2s;   animation-duration: 5s; }
.bg-stripe:nth-child(3) { left: 80%;  animation-delay: 1.2s; animation-duration: 9s; }

@keyframes stripe-move {
  0%, 100% { opacity: 0; }
  50%       { opacity: 1; }
}

/* ─── Screens ────────────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── MAIN MENU ──────────────────────────────────────────── */
#screen-lobby {
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 6vh;
  gap: 28px;
}

#logo-wrap {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#logo-img {
  width: clamp(360px, 52vw, 640px);
  height: auto;
  filter:
    drop-shadow(0 6px 10px rgba(0,0,0,0.95))
    drop-shadow(0 16px 28px rgba(0,0,0,0.7));
  user-select: none;
  pointer-events: none;
}

/* Main nav buttons — chunky arcade pads */
#main-nav {
  display: flex;
  gap: 22px;
}

.menu-btn {
  position: relative;
  width: 290px;
  padding: 32px 26px 26px;
  background: rgba(5,8,17,0.78);
  border: 2px solid rgba(0,230,255,0.55);
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  font-family: var(--font);
  box-shadow:
    inset 0 0 28px rgba(0,230,255,0.14),
    0 0 0 1px rgba(0,0,0,0.6),
    0 14px 38px rgba(0,0,0,0.7);
  transition: transform 0.12s ease, border-color 0.2s, box-shadow 0.2s;
}

.menu-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,230,255,0.18) 0%, transparent 65%);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.menu-btn:hover {
  transform: translateY(-4px);
  border-color: var(--neon);
  box-shadow:
    inset 0 0 32px rgba(0,230,255,0.22),
    0 0 30px rgba(0,230,255,0.45),
    0 16px 38px rgba(0,0,0,0.7);
}
.menu-btn:hover::before { opacity: 1; }
.menu-btn:active { transform: translateY(-1px); }

/* .active is treated the same as a normal button — no visual divergence
   between the two main-menu options. */
.menu-btn.active {}

.menu-btn-icon {
  font-size: 30px;
  margin-bottom: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(0,230,255,0.12);
  border: 1.5px solid rgba(0,230,255,0.45);
  color: var(--neon);
  text-shadow: 0 0 14px rgba(0,230,255,0.9);
}

.menu-btn-label {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 5px;
  color: #fff;
  display: block;
  line-height: 1;
  text-shadow:
    0 0 2px #fff,
    0 0 12px rgba(0,230,255,0.6);
}

.menu-btn-sub {
  font-size: 11px;
  letter-spacing: 2px;
  color: rgba(180,210,240,0.75);
  display: block;
  margin-top: 8px;
  text-transform: uppercase;
}

/* ─── SIDE PANEL (Play / Build) ──────────────────────────── */
.side-panel {
  width: 640px;
  max-width: 94vw;
  max-height: 88vh;
  background: rgba(8,12,28,0.78);
  border: 2px solid rgba(0,230,255,0.32);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    inset 0 0 50px rgba(0,230,255,0.08),
    0 0 40px rgba(0,230,255,0.2),
    0 32px 80px rgba(0,0,0,0.7);
}

.side-panel-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 24px;
  border-bottom: 1px solid rgba(0,230,255,0.18);
  background:
    linear-gradient(180deg, rgba(0,230,255,0.06), transparent);
}

.side-panel-title {
  flex: 1;
  font-size: 16px;
  letter-spacing: 7px;
  color: var(--neon);
  font-weight: 900;
  text-shadow: 0 0 14px rgba(0,230,255,0.55);
}

.icon-btn {
  width: 38px;
  height: 38px;
  background: rgba(0,230,255,0.06);
  border: 1px solid rgba(0,230,255,0.25);
  border-radius: 8px;
  color: var(--neon);
  font-family: var(--font);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.icon-btn:hover {
  background: rgba(0,230,255,0.18);
  color: #fff;
  border-color: var(--neon);
  box-shadow: 0 0 18px rgba(0,230,255,0.5);
}
.icon-btn.accent {
  color: var(--magenta);
  border-color: rgba(255,62,165,0.4);
  background: rgba(255,62,165,0.12);
  font-size: 22px;
}
.icon-btn.accent:hover {
  background: rgba(255,62,165,0.28);
  border-color: var(--magenta);
  box-shadow: 0 0 18px rgba(255,62,165,0.55);
}

.side-panel-footer {
  padding: 16px 18px;
  border-top: 1px solid rgba(0,230,255,0.18);
  background: linear-gradient(0deg, rgba(0,230,255,0.05), transparent);
  display: flex;
  gap: 10px;
}

/* ─── Map list ───────────────────────────────────────────── */
.map-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  align-content: start;
}

.map-list::-webkit-scrollbar { width: 10px; }
.map-list::-webkit-scrollbar-track { background: rgba(0,0,0,0.25); border-radius: 5px; }
.map-list::-webkit-scrollbar-thumb {
  background: rgba(0,230,255,0.5);
  border-radius: 5px;
}
.map-list::-webkit-scrollbar-thumb:hover { background: rgba(0,230,255,0.75); }
.map-list { scrollbar-color: rgba(0,230,255,0.5) rgba(0,0,0,0.25); scrollbar-width: thin; }

.map-row {
  position: relative;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.18s, background 0.18s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.map-row:hover {
  transform: translateY(-2px);
  border-color: rgba(0,230,255,0.55);
  background: rgba(0,230,255,0.08);
  box-shadow: 0 0 20px rgba(0,230,255,0.28);
}
.map-row.selected {
  border-color: var(--neon);
  background: rgba(0,230,255,0.16);
  box-shadow: 0 0 26px rgba(0,230,255,0.5);
}
.map-row.unplayable { opacity: 0.45; cursor: default; }
.map-row.unplayable:hover { transform: none; box-shadow: none; }

/* SVG track preview thumbnail */
.map-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: rgba(0,0,0,0.5);
  border-radius: 8px;
  border: 1px solid rgba(0,230,255,0.15);
  overflow: hidden;
  display: block;
}
.map-preview .track-line {
  fill: none;
  stroke: var(--neon);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 4px rgba(0,230,255,0.6));
}
.map-row.selected .map-preview .track-line { stroke-width: 4; }
.map-preview .track-start {
  fill: #76ff7d;
  filter: drop-shadow(0 0 4px rgba(118,255,125,0.8));
}
.map-preview .track-finish {
  fill: var(--magenta);
  filter: drop-shadow(0 0 4px rgba(255,62,165,0.8));
}
.map-preview .track-empty {
  fill: rgba(255,255,255,0.18);
  font-family: var(--font);
  font-size: 14px;
  letter-spacing: 2px;
}

.map-row-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.map-row-name {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 8px rgba(0,230,255,0.3);
}

.map-row-meta {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1.5px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.map-tag {
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 1.5px;
  border: 1px solid transparent;
}
.map-tag.built-in {
  background: rgba(0,230,255,0.1);
  border-color: rgba(0,230,255,0.25);
  color: var(--neon);
}
.map-tag.warn {
  background: rgba(255,62,165,0.12);
  border-color: rgba(255,62,165,0.4);
  color: var(--magenta);
}

.list-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 14px;
  color: rgba(255,255,255,0.4);
}
.list-empty-icon {
  font-size: 40px;
  color: var(--neon);
  text-shadow: 0 0 16px rgba(0,230,255,0.6);
}
.list-empty-text { font-size: 12px; letter-spacing: 2.5px; text-align: center; line-height: 1.9; }

/* ─── Action buttons ─────────────────────────────────────── */
.action-btn {
  padding: 14px 24px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 2.5px;
  border-radius: 8px;
  cursor: pointer;
  border: 1.5px solid rgba(0,230,255,0.2);
  background: rgba(0,230,255,0.05);
  color: #cfeaff;
  transition: background 0.15s, transform 0.1s, box-shadow 0.18s, opacity 0.15s, border-color 0.18s, color 0.15s;
  white-space: nowrap;
}
.action-btn:hover:not(:disabled) {
  background: rgba(0,230,255,0.16);
  border-color: var(--neon);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(0,230,255,0.4);
}
.action-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.action-btn.full-width { flex: 1; }

.action-btn.gold {
  background: var(--neon);
  color: #00121a;
  border-color: var(--neon);
  font-weight: 900;
  text-shadow: 0 0 6px rgba(255,255,255,0.5);
  box-shadow: 0 0 22px rgba(0,230,255,0.55);
}
.action-btn.gold:hover:not(:disabled) {
  background: #66f6ff;
  border-color: #66f6ff;
  color: #00121a;
  box-shadow: 0 0 36px rgba(0,230,255,0.85);
}

.action-btn.red {
  background: rgba(255,62,165,0.12);
  border-color: rgba(255,62,165,0.4);
  color: var(--magenta);
}
.action-btn.red:hover:not(:disabled) {
  background: rgba(255,62,165,0.28);
  border-color: var(--magenta);
  color: #fff;
  box-shadow: 0 0 20px rgba(255,62,165,0.55);
}

/* ─── Custom modal ───────────────────────────────────────── */
#modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

#modal-box {
  background: #0e130f;
  border: 1px solid rgba(255,216,77,0.2);
  border-radius: 14px;
  width: 360px;
  max-width: 92vw;
  box-shadow: 0 24px 60px rgba(0,0,0,0.8);
  overflow: hidden;
}

#modal-title {
  padding: 20px 24px 0;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 4px;
  color: var(--gold);
}

#modal-body {
  padding: 16px 24px 20px;
}

#modal-body p {
  font-size: 12px;
  color: #888;
  letter-spacing: 1px;
  margin-bottom: 12px;
  line-height: 1.6;
}

.modal-input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 7px;
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  letter-spacing: 1px;
  outline: none;
  transition: border-color 0.15s;
}
.modal-input:focus { border-color: rgba(255,216,77,0.5); }
.modal-input::placeholder { color: #444; }

#modal-footer {
  padding: 0 24px 20px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ─── GAME HUD ───────────────────────────────────────────── */
#hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 18px;
}

#hud-top {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.hud-chip {
  background: rgba(0,0,0,0.65);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 6px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  backdrop-filter: blur(4px);
}
.hud-chip.wide { min-width: 130px; }

.hud-label {
  font-size: 8px;
  letter-spacing: 3px;
  color: #666;
}

.hud-value {
  font-size: 20px;
  font-weight: bold;
  color: #fff;
  letter-spacing: 1px;
}
.hud-value.mono { font-size: 18px; }

#hud-bottom {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
}

#hud-bottom-left {
  position: fixed;
  top: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  z-index: 20;
}

.hud-back-btn {
  pointer-events: all;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid rgba(0, 230, 255, 0.5);
  border-radius: 999px;
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 10px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  backdrop-filter: blur(4px);
  box-shadow: 0 0 18px rgba(0, 230, 255, 0.25);
}
.hud-back-btn:hover {
  background: rgba(0, 230, 255, 0.18);
  border-color: var(--neon);
  transform: translateY(-1px);
}
.hud-back-btn:active { transform: translateY(1px); }

#hud-right {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

#speedometer {
  background: rgba(0,0,0,0.65);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 8px 18px;
  display: flex;
  align-items: baseline;
  gap: 5px;
  backdrop-filter: blur(4px);
}

#speed-value {
  font-size: 42px;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
  letter-spacing: -1px;
  min-width: 56px;
  text-align: right;
}

#speed-unit {
  font-size: 11px;
  color: rgba(255,216,77,0.6);
  letter-spacing: 1px;
  padding-bottom: 5px;
}

#drift-indicator {
  font-size: 16px;
  font-weight: bold;
  color: var(--red);
  letter-spacing: 4px;
  text-shadow: 0 0 14px var(--red);
  animation: drift-pulse 0.25s ease-in-out infinite alternate;
  align-self: flex-end;
  padding-bottom: 12px;
}

@keyframes drift-pulse {
  from { opacity: 0.6; transform: scale(1); }
  to   { opacity: 1;   transform: scale(1.05); }
}

/* ─── Message overlay ────────────────────────────────────── */
#message-overlay {
  position: fixed;
  top: 34%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  pointer-events: none;
}

#message-text {
  background: rgba(0,0,0,0.8);
  border: 1px solid rgba(255,216,77,0.35);
  border-radius: 8px;
  padding: 10px 36px;
  font-size: 22px;
  font-weight: bold;
  color: var(--gold);
  letter-spacing: 4px;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}

/* ─── Controls legend ────────────────────────────────────── */
#controls-legend {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 10;
  background: rgba(0,0,0,0.6);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  pointer-events: none;
  backdrop-filter: blur(4px);
}

.ctrl-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: #666;
  margin-bottom: 4px;
}
.ctrl-row:last-child { margin-bottom: 0; }

kbd {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 9px;
  font-family: var(--font);
  color: #bbb;
}

/* ─── Finish screen ──────────────────────────────────────── */
#finish-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(6px);
}

#finish-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

#finish-flag { font-size: 52px; animation: flag-wave 1s ease-in-out infinite alternate; }
@keyframes flag-wave {
  from { transform: rotate(-8deg); }
  to   { transform: rotate(8deg); }
}

#finish-title {
  font-size: 42px;
  letter-spacing: 8px;
  color: #fff;
  text-shadow: 0 0 30px rgba(255,216,77,0.3);
}

#finish-times {
  font-size: 15px;
  text-align: center;
  line-height: 2.2;
  color: #888;
}
#finish-times .best-row { color: var(--gold); font-weight: bold; }

#finish-btns {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

/* ─── BUILDER ────────────────────────────────────────────── */
#builder-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #0d120d;
}

/* Top bar */
#builder-topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50px;
  background: rgba(5,8,5,0.95);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 10px;
  z-index: 5;
  backdrop-filter: blur(6px);
}

#builder-map-name {
  flex: 1;
  text-align: center;
  font-size: 12px;
  letter-spacing: 4px;
  color: var(--gold);
  font-weight: bold;
}

#builder-topbar-right { display: flex; gap: 8px; }

.builder-topbar-btn {
  padding: 6px 14px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 1.5px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: #aaa;
  transition: background 0.15s, color 0.15s;
}
.builder-topbar-btn:hover:not(:disabled) { background: rgba(255,255,255,0.1); color: #fff; }
.builder-topbar-btn:disabled   { opacity: 0.25; cursor: not-allowed; }
.builder-topbar-btn.gold       { background: var(--gold); color: #000; border-color: var(--gold); }
.builder-topbar-btn.gold:hover:not(:disabled) { background: #ffe566; }

/* Sidebar */
#builder-sidebar {
  position: absolute;
  top: 50px; left: 0; bottom: 0;
  width: 260px;
  background: rgba(6, 10, 6, 0.97);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overflow-y: auto;
  z-index: 4;
  backdrop-filter: blur(6px);
}
#builder-sidebar::-webkit-scrollbar { width: 3px; }
#builder-sidebar::-webkit-scrollbar-thumb { background: #1e2e1e; border-radius: 2px; }

/* Main area: split horizontally into 2D pane + splitter + 3D pane */
#builder-main {
  position: absolute;
  top: 50px;
  left: 260px;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: row;
}

#builder-2d-pane,
#builder-3d-pane {
  position: relative;
  flex: 1 1 50%;
  min-width: 0;
  background: #0a0e0a;
  overflow: hidden;
}
#builder-3d-pane { background: #1a2820; }

#builder-splitter {
  flex: 0 0 4px;
  background: var(--border);
  cursor: col-resize;
}
#builder-splitter:hover { background: var(--gold-dim); }

.pane-label {
  position: absolute;
  top: 8px; left: 10px;
  font-size: 9px;
  letter-spacing: 2.5px;
  color: var(--muted);
  background: rgba(0,0,0,0.55);
  padding: 4px 8px;
  border-radius: 3px;
  pointer-events: none;
  z-index: 5;
}

#builder-2d {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

#builder-2d-status {
  position: absolute;
  bottom: 8px; left: 10px; right: 10px;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: #889;
  background: rgba(0,0,0,0.55);
  padding: 5px 10px;
  border-radius: 3px;
  pointer-events: none;
}

#builder-preview {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}
#builder-preview:active { cursor: grabbing; }

#builder-3d-hint {
  position: absolute;
  bottom: 8px; right: 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-end;
  font-size: 10px;
  background: rgba(0,0,0,0.55);
  padding: 6px 10px;
  border-radius: 3px;
  pointer-events: none;
  color: #aab;
}
#builder-3d-hint .nav-row kbd {
  background: rgba(255,215,0,0.15);
  color: var(--gold);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 9px;
  margin-right: 3px;
  letter-spacing: 0.5px;
}

/* Waypoint editor panel */
.wp-editor-empty {
  font-size: 10px;
  color: #556;
  padding: 12px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 5px;
}
.wp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.wp-label {
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--muted);
  min-width: 50px;
}
.wp-value {
  font-size: 13px;
  color: var(--gold);
  font-weight: 700;
}
#wp-height-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--gold);
  padding: 5px 8px;
  font-family: var(--font);
  font-size: 12px;
  border-radius: 4px;
  width: 80px;
}
#wp-height-slider {
  width: 100%;
  margin: 6px 0 10px;
}
.wp-btn-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.wp-btn-row .builder-topbar-btn { flex: 1; }
.full-width { width: 100%; }
.builder-topbar-btn.red {
  border-color: rgba(255,60,60,0.35);
  color: var(--red);
}
.builder-topbar-btn.red:hover:not(:disabled) {
  background: rgba(255,60,60,0.18);
  color: #fff;
}

/* Tab bar (replaces old mode tabs) */
#builder-tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* Path actions row in topbar */
#builder-path-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Brush palette */
#brush-palette {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.brush-btn {
  padding: 7px 6px;
  font-family: var(--font);
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 1.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: #888;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-align: center;
}
.brush-btn:hover  { background: rgba(255,255,255,0.08); color: #ccc; }
.brush-btn.active { background: var(--gold-dim); border-color: var(--gold); color: var(--gold); }

/* Road toggle */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 0;
}
.toggle-row input[type=checkbox] {
  width: 16px;
  height: 16px;
  accent-color: var(--gold);
  cursor: pointer;
  flex-shrink: 0;
}
.toggle-label {
  font-size: 11px;
  color: #aaa;
  letter-spacing: 1px;
}

/* Mode tabs */
#builder-mode-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.mode-btn {
  flex: 1;
  padding: 9px 2px;
  font-family: var(--font);
  font-size: 8px;
  font-weight: bold;
  letter-spacing: 1px;
  line-height: 1.6;
  background: none;
  border: none;
  border-right: 1px solid var(--border);
  color: #555;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  text-align: center;
}
.mode-btn:last-child { border-right: none; }
.mode-btn:hover  { color: #aaa; background: rgba(255,255,255,0.03); }
.mode-btn.active { color: var(--gold); background: var(--gold-dim); border-bottom: 2px solid var(--gold); }

/* Panels */
.builder-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.builder-section {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.builder-section-title {
  font-size: 8px;
  letter-spacing: 3px;
  color: #445;
  margin-bottom: 10px;
  font-weight: bold;
  text-transform: uppercase;
}

/* Hints */
.builder-hints { padding: 10px 14px; }
.builder-hint-row {
  font-size: 10px;
  color: #445;
  margin-bottom: 5px;
  line-height: 1.5;
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.hk {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 3px;
  padding: 0 5px;
  font-size: 9px;
  color: #888;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Slider */
.builder-slider-row { display: flex; align-items: center; gap: 10px; }
.builder-slider-row input[type=range] {
  flex: 1; -webkit-appearance: none;
  height: 3px; background: #1e2e1e; border-radius: 2px; outline: none;
}
.builder-slider-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px;
  border-radius: 50%; background: var(--gold); cursor: pointer;
}
.builder-slider-row span { font-size: 14px; color: var(--gold); min-width: 24px; text-align: right; }

/* Del / secondary buttons */
.builder-del-btn {
  font-family: var(--font); font-size: 9px; letter-spacing: 1px;
  padding: 5px 10px; background: var(--red-dim);
  border: 1px solid rgba(255,60,60,0.2); border-radius: 5px;
  color: #e06060; cursor: pointer; transition: background 0.15s;
}
.builder-del-btn:hover:not(:disabled)    { background: rgba(255,60,60,0.3); }
.builder-del-btn:disabled                { opacity: 0.3; cursor: not-allowed; }
.builder-del-btn.secondary {
  background: var(--surface); border-color: var(--border); color: #888;
}
.builder-del-btn.secondary:hover:not(:disabled) { background: rgba(255,255,255,0.1); color: #fff; }

/* Fence legend */
.fence-legend { display: flex; gap: 16px; margin-top: 6px; }
.fence-legend-item { font-size: 10px; letter-spacing: 1px; }
.fence-legend-item.on  { color: #e06060; }
.fence-legend-item.off { color: #60e080; }

/* Tool palette */
#tool-palette {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s, border-color 0.15s;
}
.tool-btn:hover  { background: rgba(255,255,255,0.08); border-color: #444; }
.tool-btn.active { background: var(--gold-dim); border-color: var(--gold); }

.tool-icon  { font-size: 20px; }
.tool-label { font-size: 8px; letter-spacing: 2px; color: #888; font-weight: bold; }
.tool-btn.active .tool-label { color: var(--gold); }

/* Point list */
#builder-point-list {
  flex: 1; overflow-y: auto; padding: 4px 0;
}
#builder-point-list::-webkit-scrollbar { width: 4px; }
#builder-point-list::-webkit-scrollbar-thumb { background: #1e2e1e; border-radius: 2px; }

.builder-list-empty {
  font-size: 10px; color: #334; text-align: center;
  padding: 28px 12px; line-height: 1.8; letter-spacing: 1px;
}

.builder-pt-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; cursor: pointer;
  transition: background 0.1s; border-left: 2px solid transparent;
}
.builder-pt-row:hover    { background: rgba(255,255,255,0.03); }
.builder-pt-row.selected { background: var(--gold-dim); border-left-color: var(--gold); }

.builder-pt-num   { font-size: 10px; color: #445; min-width: 18px; text-align: center; }
.builder-pt-coords { flex: 1; font-size: 10px; color: #556; }
.builder-pt-row.selected .builder-pt-num    { color: var(--gold); }
.builder-pt-row.selected .builder-pt-coords { color: #aaa; }
.elev-val { color: #ffaa44; }

.builder-pt-del {
  background: none; border: none; color: #334; font-size: 11px;
  cursor: pointer; padding: 2px 5px; border-radius: 3px;
  transition: color 0.1s, background 0.1s; font-family: var(--font);
}
.builder-pt-del:hover { color: var(--red); background: var(--red-dim); }

/* Builder nav hint overlay */
#builder-nav-hint {
  position: absolute;
  bottom: 14px;
  right: 14px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 7px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
  backdrop-filter: blur(4px);
}
.nav-row {
  font-size: 9px;
  color: #445;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-row kbd {
  font-size: 8px;
}

/* Path mode status bar */
#builder-path-status {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.7);
  padding: 6px 14px;
  font-size: 10px;
  letter-spacing: 1px;
  color: #667;
  pointer-events: none;
  backdrop-filter: blur(4px);
}

/* Toast */
.builder-toast {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.88); border: 1px solid rgba(255,216,77,0.35);
  border-radius: 7px; padding: 9px 26px; font-size: 12px; letter-spacing: 3px;
  color: var(--gold); pointer-events: none; z-index: 10;
}
.builder-toast.error { border-color: rgba(255,60,60,0.35); color: var(--red); }

/* ─── Builder mode label (top-left of viewport) ─────────── */
#builder-mode-label {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 6px 12px;
  background: rgba(10, 14, 20, 0.78);
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: 4px;
  color: #ffd700;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  pointer-events: none;
  z-index: 20;
}

/* ─── Builder right-click context menu ──────────────────── */
.builder-ctx-menu {
  position: fixed;
  min-width: 160px;
  background: #11161e;
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: 5px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
  padding: 4px 0;
  z-index: 9999;
  font-size: 11px;
  letter-spacing: 1px;
  color: #cdd;
  user-select: none;
}
.builder-ctx-menu .ctx-item {
  padding: 7px 14px;
  cursor: pointer;
  white-space: nowrap;
}
.builder-ctx-menu .ctx-item:hover:not(.ctx-disabled) {
  background: rgba(255, 215, 0, 0.12);
  color: #ffd700;
}
.builder-ctx-menu .ctx-disabled {
  color: #556;
  cursor: default;
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 4px;
}

/* ─── Tool selector (POINT / EDGE / FENCE) ───────────────── */
#tool-row {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}
.tool-btn-mini {
  flex: 1;
  padding: 8px 4px;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  background: rgba(255,255,255,0.04);
  color: #889;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.tool-btn-mini:hover  { background: rgba(255,255,255,0.08); color: #ccc; }
.tool-btn-mini.active { background: var(--gold-dim); color: var(--gold); border-color: var(--gold); }
.tool-hint {
  font-size: 10px;
  color: #667;
  margin-top: 4px;
  min-height: 14px;
  letter-spacing: 1px;
}

/* ─── Sidebar redesign ──────────────────────────────────── */
#builder-sidebar {
  padding: 8px 8px 0 8px;
  gap: 8px;
  flex-direction: column;
}

/* Compact tool row at the very top of the sidebar. */
.sb-tools {
  display: flex;
  gap: 4px;
}
.sb-tool {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 2px;
  min-height: 48px;
  background: rgba(255,255,255,0.04);
  color: #889;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}
.sb-tool:hover  { background: rgba(255,255,255,0.08); color: #ddd; }
.sb-tool.active {
  background: var(--gold-dim);
  color: var(--gold);
  border-color: var(--gold);
  /* Make the active state really pop: brighter background + tiny lift. */
  box-shadow: 0 0 0 2px rgba(255,215,77,0.18) inset;
}
.sb-tool-icon {
  font-size: 18px;
  line-height: 1;
}
.sb-tool-label {
  font-size: 9px;
  letter-spacing: 1px;
  font-weight: 700;
}

/* Card / panel block in the sidebar — slimmer than the old sections. */
.sb-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
}
.sb-card-title {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sb-card-title.small { font-size: 9px; margin-top: 0; }
.sb-empty {
  font-size: 10px;
  color: #667;
  line-height: 1.4;
}
.sb-row-tight {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Collapsible card. The "collapsed" class hides the body and rotates chevron. */
.sb-collapsible .sb-toggle {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-family: inherit;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 0;
  margin-bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sb-collapsible .sb-toggle:hover { color: #ccc; }
.sb-collapsible.collapsed .sb-card-body { display: none; }
.sb-collapsible.collapsed .sb-toggle    { margin-bottom: 0; }
.sb-collapsible:not(.collapsed) .sb-toggle { margin-bottom: 8px; }
.sb-chevron {
  transition: transform 0.15s;
  font-size: 10px;
}
.sb-collapsible.collapsed .sb-chevron { transform: rotate(-90deg); }

/* Footer block: pushed to the bottom. */
.sb-spacer { flex: 1 1 auto; min-height: 4px; }
.sb-footer {
  padding: 8px 12px 10px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.18);
  margin: 0 -8px;
  font-size: 10px;
  color: #778;
  line-height: 1.45;
}
.sb-stats {
  font-size: 10px;
  color: #aab;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.sb-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sb-shortcuts kbd {
  background: rgba(255,255,255,0.08);
  color: #ccd;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 9px;
  margin-right: 3px;
  font-family: var(--font);
}

/* ─── HUD held item ──────────────────────────────────────── */
#held-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(10, 14, 20, 0.78);
  border: 1px solid rgba(122, 214, 255, 0.55);
  border-radius: 8px;
  color: #cdf6ff;
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
  box-shadow: 0 0 12px rgba(122,214,255,0.25);
}
#held-item .held-icon  { font-size: 18px; }
#held-item .held-label { font-weight: 700; }
#held-item .held-key   { font-size: 10px; color: #9ab; opacity: 0.8; margin-left: 6px; }
#held-item .held-key kbd {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-radius: 3px;
  padding: 1px 5px;
  font-family: var(--font);
  font-size: 10px;
  margin-right: 3px;
}

/* ─── Speed lines (boost overlay) ─────────────────────────── */
/* Radial comic-book speed lines: each streak is anchored at the screen
   center, rotated to a fixed angle, and animated outward from the
   middle so it reads as motion blur converging on a vanishing point. */
#speed-lines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
}
/* Radial speed lines: each streak lives in a ring around the screen edge,
   never reaching the center. The streak is anchored at screen center,
   pre-translated outward to its inner end, then rotated. The animation
   pulses opacity so the lines feel alive without sweeping inward. */
#speed-lines .streak {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 35vmax;       /* outer end sits past the screen edge */
  height: 3px;
  background: linear-gradient(to right,
    rgba(255,255,255,0)    0%,
    rgba(255,255,255,0.85) 35%,
    rgba(255,255,255,0.95) 75%,
    rgba(255,255,255,0)   100%);
  transform-origin: 0% 50%;
  animation: speedPulse 0.55s linear infinite;
  filter: blur(0.4px);
  --r: 0deg;
}
#speed-lines .streak:nth-child(1)  { --r:   0deg; animation-delay: 0.00s; }
#speed-lines .streak:nth-child(2)  { --r:  30deg; animation-delay: 0.08s; }
#speed-lines .streak:nth-child(3)  { --r:  60deg; animation-delay: 0.16s; }
#speed-lines .streak:nth-child(4)  { --r:  90deg; animation-delay: 0.24s; }
#speed-lines .streak:nth-child(5)  { --r: 120deg; animation-delay: 0.32s; }
#speed-lines .streak:nth-child(6)  { --r: 150deg; animation-delay: 0.40s; }
#speed-lines .streak:nth-child(7)  { --r: 180deg; animation-delay: 0.04s; }
#speed-lines .streak:nth-child(8)  { --r: 210deg; animation-delay: 0.12s; }
#speed-lines .streak:nth-child(9)  { --r: 240deg; animation-delay: 0.20s; }
#speed-lines .streak:nth-child(10) { --r: 270deg; animation-delay: 0.28s; }
#speed-lines .streak:nth-child(11) { --r: 300deg; animation-delay: 0.36s; }
#speed-lines .streak:nth-child(12) { --r: 330deg; animation-delay: 0.44s; }
/* The translateX(25vmax) leaves a clear circle of radius 25vmax in the
   middle — streaks only exist in the outer ring of the screen. */
@keyframes speedPulse {
  0%   { transform: rotate(var(--r)) translateX(25vmax); opacity: 0.2; }
  50%  { transform: rotate(var(--r)) translateX(25vmax); opacity: 1; }
  100% { transform: rotate(var(--r)) translateX(25vmax); opacity: 0.2; }
}

/* ─── Quick Play (sits below the main nav, distinct look) ─ */
#quick-play-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  margin: 24px auto 0; padding: 14px 36px;
  font-family: 'Orbitron', system-ui, sans-serif;
  font-size: 18px; font-weight: 800; letter-spacing: 3px;
  color: #1a0a00;
  background: linear-gradient(135deg, #ffd34a 0%, #ff7a1a 100%);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow:
    0 0 24px rgba(255, 122, 26, 0.55),
    0 6px 0 rgba(0, 0, 0, 0.35),
    inset 0 0 0 2px rgba(255, 255, 255, 0.4);
  transition: transform 0.1s, box-shadow 0.1s, filter 0.1s;
}
#quick-play-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow:
    0 0 32px rgba(255, 122, 26, 0.8),
    0 7px 0 rgba(0, 0, 0, 0.4),
    inset 0 0 0 2px rgba(255, 255, 255, 0.55);
}
#quick-play-btn:active {
  transform: translateY(2px);
  box-shadow:
    0 0 18px rgba(255, 122, 26, 0.6),
    0 3px 0 rgba(0, 0, 0, 0.4),
    inset 0 0 0 2px rgba(255, 255, 255, 0.4);
}
#quick-play-icon {
  font-size: 22px;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.7));
}

/* ─── Compact lobby for short viewports (CrazyGames iframe, small laptops) ─
   Only kicks in below 760px tall — full-size design stays untouched on any
   normal monitor. Shrinks logo + card padding + gaps so everything fits
   without clipping QUICK PLAY at the bottom. */
@media (max-height: 760px) {
  #screen-lobby {
    padding-top: 12px;
    gap: 14px;
  }
  #logo-img {
    width: clamp(260px, 36vw, 440px);
  }
  #main-nav { gap: 14px; }
  .menu-btn {
    width: 240px;
    padding: 18px 20px 16px;
  }
  .menu-btn-icon {
    font-size: 22px;
    width: 36px;
    height: 36px;
    margin-bottom: 6px;
  }
  .menu-btn-label { font-size: 22px; letter-spacing: 4px; }
  .menu-btn-sub { font-size: 10px; }
  #quick-play-btn {
    margin-top: 10px;
    padding: 10px 28px;
    font-size: 16px;
  }
}
@media (max-height: 600px) {
  #screen-lobby { padding-top: 6px; gap: 8px; }
  #logo-img { width: clamp(200px, 28vw, 340px); }
  .menu-btn { width: 200px; padding: 12px 16px 10px; }
  .menu-btn-label { font-size: 18px; letter-spacing: 3px; }
  #quick-play-btn { margin-top: 4px; padding: 8px 22px; font-size: 14px; }
}

/* ─── Garage ─────────────────────────────────────────────── */
#screen-garage {
  display: block;
  background: #0a0e1a;
}
#garage-wrap {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 360px;
}
#garage-3d {
  position: relative;
  background: radial-gradient(ellipse at center, #15203a 0%, #050810 80%);
}
#garage-canvas {
  width: 100%;
  height: 100%;
  display: block;
}
#garage-back-btn {
  position: absolute;
  top: 16px; left: 16px;
  z-index: 10;
}
#garage-side {
  background: rgba(8, 12, 28, 0.95);
  border-left: 1px solid rgba(0, 230, 255, 0.25);
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.garage-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(0, 230, 255, 0.18);
  border-radius: 10px;
  padding: 12px 14px;
}
.garage-card-title {
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 2px;
  color: #7ad6ff;
  margin-bottom: 8px;
}
.garage-card select {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: 1px solid rgba(0, 230, 255, 0.35);
  border-radius: 6px;
  padding: 8px;
  font-family: var(--font);
  font-size: 14px;
}
.grg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.grg-row span {
  font-size: 13px;
  color: #cdd6e4;
}
.grg-row input[type="color"] {
  width: 50px;
  height: 30px;
  border: 1px solid rgba(0, 230, 255, 0.35);
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
}
.grg-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #cdd6e4;
  cursor: pointer;
  margin-bottom: 4px;
}

/* ─── Audio toggles (music + SFX, independent) ──────────── */
#audio-toggles {
  position: fixed;
  top: 12px; right: 12px;
  display: flex;
  gap: 6px;
  z-index: 40;
}
#audio-toggles button {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 14, 20, 0.7);
  border: 1px solid rgba(122, 214, 255, 0.35);
  border-radius: 999px;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}
#audio-toggles button:hover { background: rgba(122, 214, 255, 0.18); }
#audio-toggles button:active { transform: scale(0.94); }
#audio-toggles button.muted { opacity: 0.5; }

/* ─── Plaxzy / external link ────────────────────────────── */
#plaxzy-link {
  position: fixed;
  bottom: 12px; right: 12px;
  font-family: 'Orbitron', system-ui, sans-serif;
  font-size: 11px; letter-spacing: 1px;
  color: #7ad6ff;
  background: rgba(10, 14, 20, 0.7);
  border: 1px solid rgba(122, 214, 255, 0.35);
  border-radius: 999px;
  padding: 6px 12px;
  text-decoration: none;
  z-index: 40;
  transition: background 0.15s, color 0.15s;
}
#plaxzy-link:hover { background: rgba(122, 214, 255, 0.18); color: #fff; }
#plaxzy-link strong { color: #ffd34a; }
/* CrazyGames forbids external links during gameplay — hide while racing. */
body.in-game #plaxzy-link { display: none; }

/* ─── Reset hint (off-road + stuck) ─────────────────────── */
#reset-hint {
  position: fixed;
  top: 22vh;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Orbitron', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #ffd34a;
  background: rgba(10, 14, 20, 0.78);
  border: 2px solid rgba(255, 211, 74, 0.55);
  border-radius: 999px;
  padding: 10px 22px;
  text-shadow: 0 0 12px rgba(255, 211, 74, 0.6);
  box-shadow: 0 0 24px rgba(255, 211, 74, 0.35);
  pointer-events: none;
  z-index: 30;
  animation: resetHintPulse 1.2s ease-in-out infinite;
}
#reset-hint kbd {
  display: inline-block;
  font-family: inherit;
  font-size: 16px;
  background: rgba(255, 211, 74, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 211, 74, 0.7);
  border-radius: 5px;
  padding: 2px 8px 1px;
}
@keyframes resetHintPulse {
  0%,100% { opacity: 0.85; }
  50%     { opacity: 1; }
}

/* ─── Multiplayer countdown ─────────────────────────────── */
#mp-countdown {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: 'Orbitron', system-ui, sans-serif;
  font-size: 22vmin; font-weight: 900;
  color: #ffd34a;
  text-shadow: 0 0 30px rgba(255,211,74,.8), 0 4px 0 #000, 0 0 60px rgba(255,99,99,.6);
  pointer-events: none;
  z-index: 50;
}

/* ─── Utility ────────────────────────────────────────────── */
.hidden { display: none !important; }
