:root {
  --bg: #0b0c14;
  --bezel: #171928;
  --border: #2f3556;
  --neon-cyan: #2de2e6;
  --neon-pink: #ff2a85;
  --neon-yellow: #ffd319;
  --neon-green: #38f276;
  --text: #f3f5ff;
  --muted: #98a2c7;
  --font-display: 'Orbitron', 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
  --font-pixel: 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: radial-gradient(circle at center, #181b2c 0%, var(--bg) 75%);
  color: var(--text);
  font-family: var(--font-pixel);
  font-size-adjust: from-font;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  overflow: hidden;
}

#arcade-cabinet {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
}

#top-bar, #controls-bar {
  width: min(1480px, 98vw);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

#stage-layout {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 12px;
  width: min(1480px, 98vw);
}

#leaderboard-panel {
  width: 308px;
  max-height: calc(100dvh - 78px);
  flex-shrink: 0;
  background: linear-gradient(180deg, #161b36 0%, #0d1124 100%);
  border: 2px solid var(--neon-cyan);
  border-radius: 8px;
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.75),
    0 0 18px rgba(45, 226, 230, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--neon-cyan) #0d1124;
}

.lb-title {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.25;
  color: var(--neon-yellow);
  text-align: center;
  text-shadow: 0 0 10px rgba(255, 211, 25, 0.45);
  border-bottom: 2px solid rgba(45, 226, 230, 0.35);
  padding-bottom: 5px;
}

.lb-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: linear-gradient(90deg, rgba(45, 226, 230, 0.14), rgba(56, 242, 118, 0.14));
  border: 1px solid rgba(45, 226, 230, 0.48);
  border-radius: 5px;
  padding: 5px 9px;
}

.lb-cur-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.lb-cur-val {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px rgba(45, 226, 230, 0.45);
}

.lb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text);
}

.lb-empty {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
  padding: 4px;
}

.lb-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(152, 162, 199, 0.22);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.25;
}

.lb-score-row.rank-1 {
  border-color: rgba(255, 211, 25, 0.6);
  background: rgba(255, 211, 25, 0.12);
}

.lb-score-row.rank-2 {
  border-color: rgba(203, 213, 225, 0.45);
  background: rgba(203, 213, 225, 0.08);
}

.lb-score-row.rank-3 {
  border-color: rgba(255, 107, 53, 0.5);
  background: rgba(255, 107, 53, 0.09);
}

.lb-rank {
  min-width: 24px;
  font-weight: 700;
  color: var(--neon-yellow);
  flex-shrink: 0;
}

.lb-pilot-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f8fafc;
}

.lb-pts {
  color: var(--neon-green);
  font-weight: 700;
  flex-shrink: 0;
}

.lb-pts small {
  font-size: 0.65rem;
  color: var(--muted);
}

.lb-subtitle {
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1.25;
  color: var(--neon-cyan);
  text-align: center;
  border-top: 2px solid rgba(47, 53, 86, 0.85);
  border-bottom: 1px solid rgba(47, 53, 86, 0.85);
  padding: 5px 0 4px;
}

.lb-tracks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--text);
}

.lb-tracks li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  background: rgba(19, 24, 48, 0.88);
  border: 1px solid rgba(47, 53, 86, 0.9);
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 0.76rem;
  line-height: 1.25;
}

.lb-tracks li.active-stage {
  border-color: var(--neon-yellow);
  background: rgba(255, 211, 25, 0.14);
  box-shadow: 0 0 10px rgba(255, 211, 25, 0.18);
}

.lb-trk-left {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.lb-minimap-canvas {
  width: 44px;
  height: 26px;
  flex-shrink: 0;
  background: rgba(8, 11, 24, 0.9);
  border: 1px solid rgba(45, 226, 230, 0.35);
  border-radius: 3px;
}

.lb-tracks li.active-stage .lb-minimap-canvas {
  border-color: var(--neon-yellow);
  box-shadow: 0 0 6px rgba(255, 211, 25, 0.35);
}

.lb-trk-num {
  color: var(--neon-pink);
  font-weight: 700;
  font-size: 0.7rem;
  min-width: 21px;
  flex-shrink: 0;
}

.lb-trk-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f1f5f9;
  font-weight: 600;
  font-size: 0.76rem;
}

.lb-trk-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.lb-trk-pilot {
  background: rgba(45, 226, 230, 0.15);
  border: 1px solid rgba(45, 226, 230, 0.45);
  color: var(--neon-cyan);
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 700;
  font-size: 0.68rem;
  max-width: 68px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-trk-time {
  color: var(--neon-yellow);
  font-weight: 700;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-meta a {
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
}

.footer-meta a:hover {
  color: var(--neon-cyan);
}

.version-badge {
  background: #1d2136;
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan) !important;
  padding: 2px 6px;
  font-weight: 700;
}

.score-form {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin-bottom: 14px;
}

.score-input {
  font-family: var(--font-pixel);
  font-size: 14px;
  font-weight: 700;
  padding: 8px 10px;
  width: 170px;
  background: #13172b;
  color: var(--neon-yellow);
  border: 2px solid var(--neon-cyan);
  text-align: center;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(760px, 95%);
  margin: 0 0 16px;
  text-align: left;
}

.legend-item {
  background: #13172b;
  border: 2px solid var(--border);
  padding: 7px 9px;
  font-size: 11px;
  line-height: 1.35;
}

.legend-item strong {
  display: block;
  color: var(--neon-yellow);
  margin-bottom: 2px;
}

.chassis-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.chassis-btn {
  font-family: var(--font-pixel);
  font-size: 11px;
  padding: 7px 10px;
  background: #13172b;
  color: var(--text);
  border: 2px solid var(--border);
  cursor: pointer;
  text-align: left;
}

.chassis-btn.active {
  border-color: var(--neon-yellow);
  background: #231f33;
}

.chassis-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.track-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: min(720px, 95%);
  margin: 10px 0 14px;
}

.track-choice-minimap {
  display: block;
  width: 144px;
  height: 80px;
  margin: 2px auto 4px;
  background: rgba(7, 10, 22, 0.88);
  border: 1px solid rgba(45, 226, 230, 0.45);
  border-radius: 4px;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.65);
}

#controls-bar {
  width: min(1280px, 98vw);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  letter-spacing: 0.06em;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px rgba(45, 226, 230, 0.45);
}

.brand-helmet-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 4px rgba(5, 217, 232, 0.55));
}

.badge {
  background: var(--neon-pink);
  color: #fff;
  padding: 2px 6px;
  font-size: 11px;
  margin-left: 6px;
  border: 2px solid #fff;
}

.toggles {
  display: flex;
  gap: 8px;
}

.arcade-btn {
  font-family: var(--font-pixel);
  font-size: 13px;
  font-weight: 700;
  padding: 5px 10px;
  background: #1d2136;
  color: var(--text);
  border: 2px solid var(--border);
  cursor: pointer;
  text-shadow: 0 1px 2px #000;
  transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s ease;
}

.arcade-btn:hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

.arcade-btn:active {
  transform: translateY(1px);
}

.arcade-btn.active-pause {
  border-color: var(--neon-yellow);
  color: var(--neon-yellow);
  background: #2b2412;
}

.arcade-btn.active-mute {
  border-color: var(--neon-pink);
  color: #fda4af;
  background: #2b1322;
}

#screen-frame {
  position: relative;
  align-self: center;
  width: min(1160px, calc(98vw - 324px), calc((100dvh - 82px) * 16 / 9));
  aspect-ratio: 16 / 9;
  background: #000;
  border: 6px solid var(--bezel);
  outline: 3px solid var(--border);
  box-shadow:
    0 0 0 2px #000,
    0 18px 50px rgba(0, 0, 0, 0.75),
    0 0 32px rgba(45, 226, 230, 0.12);
  overflow: hidden;
}

#arcade-cabinet.size-medium #screen-frame {
  width: min(920px, calc(94vw - 324px), calc((100dvh - 100px) * 16 / 9));
}

#arcade-cabinet.size-large #screen-frame {
  width: min(1160px, calc(98vw - 324px), calc((100dvh - 82px) * 16 / 9));
}

#arcade-cabinet.size-full #top-bar,
#arcade-cabinet.size-full #controls-bar,
#arcade-cabinet.size-full #stage-layout {
  width: 99vw;
  max-width: 99vw;
}

#arcade-cabinet.size-full #screen-frame {
  flex: 1;
  width: auto;
  max-width: calc((100dvh - 74px) * 16 / 9);
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: auto;
}

/* Optional 80s CRT Scanline + Vignette */
#crt-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  background:
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.28) 50%),
    radial-gradient(circle at center, transparent 62%, rgba(0, 0, 0, 0.55) 100%);
  background-size: 100% 4px, 100% 100%;
}

#screen-frame.crt-on #crt-overlay {
  opacity: 1;
}

/* Overlay UI */
#ui-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 20, 0.86);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  z-index: 5;
}

#ui-overlay.title-theme {
  background: radial-gradient(circle at 50% 45%, rgba(16, 12, 36, 0.34), rgba(6, 7, 16, 0.72));
  backdrop-filter: blur(2px);
}

#ui-overlay.hidden {
  display: none;
}

.overlay-title {
  font-family: var(--font-display);
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 1.1rem + 1.5vw, 2.1rem);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-wrap: balance;
  color: var(--neon-yellow);
  text-shadow: 3px 3px 0 var(--neon-pink), 0 0 18px rgba(255, 211, 25, 0.4);
}

.overlay-subtitle {
  margin: 0 0 16px;
  font-size: 15px;
  color: var(--neon-cyan);
  max-width: 720px;
  line-height: 1.48;
  text-shadow: 0 2px 4px #000, 0 0 2px #000;
}

.standings-table {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: min(700px, 95%);
  margin-bottom: 16px;
}

.standing-pill {
  background: #14172b;
  border: 2px solid var(--border);
  padding: 9px 7px;
  font-size: 14px;
  text-shadow: 0 2px 4px #000, 0 0 2px #000;
}

.standing-pill.player {
  border-color: var(--neon-yellow);
  background: #231f33;
  color: #ffffff;
}

.standing-pill.player .standing-name {
  color: #ffd319 !important;
  text-shadow: 0 2px 4px #000, 0 0 8px rgba(255, 211, 25, 0.55);
}

.draft-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: min(800px, 96%);
  margin: 8px 0 14px;
}

.upgrade-card {
  background: #13172b;
  border: 3px solid var(--neon-cyan);
  padding: 13px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  text-shadow: 0 1px 3px #000;
  transition: transform 0.1s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.upgrade-card:hover {
  transform: translateY(-3px);
  border-color: var(--neon-yellow);
  box-shadow: 0 0 16px rgba(255, 211, 25, 0.35);
}

.upgrade-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--neon-pink);
  text-transform: uppercase;
  text-shadow: 0 1px 2px #000;
}

.upgrade-name {
  font-size: 16px;
  font-weight: 900;
  color: var(--neon-yellow);
  text-shadow: 0 2px 4px #000;
}

.upgrade-desc {
  font-size: 14px;
  color: var(--text);
  line-height: 1.38;
  text-shadow: 0 1px 2px #000;
}

.upgrade-cta {
  font-size: 13px;
  font-weight: 800;
  color: var(--neon-green);
  text-shadow: 0 1px 3px #000;
}

.primary-btn {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 800;
  padding: 10px 22px;
  background: var(--neon-pink);
  color: #fff;
  border: 3px solid #fff;
  cursor: pointer;
  letter-spacing: 0.08em;
  box-shadow: 4px 4px 0 #000;
  transition: transform 0.08s ease;
}

.primary-btn:hover:not(:disabled) {
  background: var(--neon-cyan);
  color: #080a14;
}

.primary-btn:active:not(:disabled) {
  transform: translate(2px, 2px);
}

.primary-btn:disabled {
  background: #2b314d;
  color: #94a3b8;
  border-color: #475569;
  cursor: not-allowed;
  box-shadow: none;
}

.secondary-btn {
  font-family: var(--font-pixel);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  background: #1d2136;
  color: var(--neon-yellow);
  border: 2px solid var(--neon-yellow);
  cursor: pointer;
}

.secondary-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.overlay-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(760px, 95%);
  margin: 0 0 16px;
  text-align: left;
}

.legend-item {
  background: #13172b;
  border: 2px solid var(--border);
  padding: 7px 9px;
  font-size: 11px;
  line-height: 1.35;
}

.legend-item strong {
  display: block;
  color: var(--neon-yellow);
  margin-bottom: 2px;
}

.chassis-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.chassis-btn {
  font-family: var(--font-pixel);
  font-size: 11px;
  padding: 7px 10px;
  background: #13172b;
  color: var(--text);
  border: 2px solid var(--border);
  cursor: pointer;
  text-align: left;
}

.chassis-btn.active {
  border-color: var(--neon-yellow);
  background: #231f33;
}

.chassis-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.track-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: min(720px, 95%);
  margin: 10px 0 14px;
}

.track-choice-minimap {
  display: block;
  width: 144px;
  height: 80px;
  margin: 2px auto 4px;
  background: rgba(7, 10, 22, 0.88);
  border: 1px solid rgba(45, 226, 230, 0.45);
  border-radius: 4px;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.65);
}

#controls-bar {
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  flex-wrap: wrap;
}

kbd {
  background: #1c2035;
  border: 1px solid #454d75;
  padding: 1px 5px;
  color: var(--neon-yellow);
  font-family: var(--font-pixel);
  font-size: 11px;
  margin-right: 3px;
}

/* Title Hero & Garage Selection */
.title-hero-box {
  background: rgba(10, 12, 26, 0.72);
  border: 2px solid rgba(255, 42, 133, 0.55);
  box-shadow: 0 0 28px rgba(255, 42, 133, 0.25);
  padding: 26px 36px;
  border-radius: 6px;
  max-width: 660px;
}

.title-eyebrow {
  font-size: 11px;
  letter-spacing: 2.5px;
  color: var(--neon-cyan);
  margin-bottom: 6px;
  font-weight: 700;
}

.garage-panel {
  background: rgba(10, 12, 26, 0.90);
  border: 2px solid var(--border);
  padding: 12px 18px;
  width: min(928px, 97%);
  max-height: 94%;
  overflow-y: auto;
  border-radius: 6px;
}

.garage-columns {
  display: grid;
  grid-template-columns: 1.25fr 0.85fr;
  gap: 14px;
  text-align: left;
}

.garage-col-title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--neon-yellow);
  letter-spacing: 1.5px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

.garage-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.garage-card {
  display: flex;
  align-items: center;
  gap: 11px;
  background: #141932;
  border: 2px solid #2e375e;
  padding: 7px 11px;
  color: var(--text);
  font-family: var(--font-pixel);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.garage-card:hover:not(:disabled) {
  border-color: var(--neon-cyan);
  background: #1a2142;
}

.garage-card.active {
  border-color: var(--neon-yellow);
  background: #231e3b;
  box-shadow: 0 0 14px rgba(255, 211, 25, 0.28);
}

.garage-card:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.car-preview-canvas {
  background: rgba(6, 8, 16, 0.85);
  border: 1px solid #394473;
  border-radius: 4px;
  flex-shrink: 0;
}

.garage-card-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 14.5px;
  line-height: 1.38;
  flex: 1;
  min-width: 0;
  text-shadow: 0 2px 4px #000, 0 0 2px #000;
}

.garage-card-info strong {
  font-size: 15px;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 4px #000, 0 0 2px #000;
}

.garage-card-info span {
  color: #e6ecff;
  font-size: 13.5px;
  line-height: 1.4;
  font-weight: 600;
  text-shadow: 0 1px 3px #000;
}

.garage-pilot-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 900;
  color: var(--neon-yellow);
}

.garage-pilot-row .score-input {
  padding: 5px 9px;
  font-size: 13px;
  width: 165px;
  border: 2px solid var(--neon-cyan);
}

.score-saved-banner {
  background: rgba(56, 242, 118, 0.14);
  border: 1px solid var(--neon-green);
  color: var(--neon-green);
  font-size: 12px;
  padding: 7px 14px;
  margin-bottom: 14px;
}

/* Live Standings Mini-Panel inside Sidebar */
.lb-live-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}

.lb-live-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  padding: 2px 4px;
  border-radius: 3px;
  background: rgba(15, 23, 42, 0.55);
}

.lb-live-row.is-player {
  background: rgba(255, 42, 133, 0.16);
  border: 1px solid rgba(255, 42, 133, 0.45);
}

.lb-pos-pill {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 3px;
  min-width: 24px;
  text-align: center;
}

.lb-live-name {
  flex: 1;
  text-align: left;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-live-lap {
  font-family: var(--font-display);
  font-size: 0.68rem;
  color: var(--neon-cyan);
  font-weight: 800;
}

/* 8-Car Garage & Pit Stop Workshop */
.garage-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.wrench-wallet-pill {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 900;
  color: var(--neon-yellow);
  background: rgba(255, 211, 25, 0.12);
  border: 2px solid var(--neon-yellow);
  padding: 6px 12px;
  border-radius: 4px;
  white-space: nowrap;
}

.garage-scroll {
  max-height: 292px;
  overflow-y: auto;
  padding-right: 4px;
}

.workshop-panel {
  background: rgba(10, 12, 26, 0.94);
  border: 2px solid var(--border);
  padding: 12px 18px;
  width: min(928px, 97%);
  max-height: 94%;
  overflow-y: auto;
  border-radius: 6px;
}

.workshop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 330px;
  overflow-y: auto;
  padding-right: 4px;
  margin-top: 8px;
  text-align: left;
}

.garage-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.chassis-badge {
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
}

.chassis-badge.is-active {
  background: var(--neon-yellow);
  color: #090612;
}

.chassis-badge.is-owned {
  background: rgba(45, 226, 230, 0.18);
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
}

.chassis-badge.is-price {
  background: rgba(148, 163, 184, 0.16);
  border: 1px solid #64748b;
  color: #cbd5e1;
}

.chassis-badge.is-price.can-buy {
  background: rgba(56, 242, 118, 0.18);
  border-color: var(--neon-green);
  color: var(--neon-green);
}

.stat-bars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 12px;
  margin: 3px 0;
  width: 100%;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.stat-lbl {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 800;
  color: #e2e8f0;
  width: 34px;
  min-width: 34px;
  flex-shrink: 0;
  text-align: left;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 2px #000;
}

.stat-track-10 {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 2px;
  flex: 1;
  min-width: 66px;
  height: 7px;
  align-items: center;
}

.stat-sq {
  display: block;
  height: 6px;
  background: #0b0e1d;
  border: 1px solid #2d3659;
  border-radius: 1px;
  image-rendering: pixelated;
}

.stat-sq.on {
  border-color: rgba(255, 255, 255, 0.48);
}

.chassis-desc {
  font-size: 12.5px !important;
  color: #e2e8f0 !important;
  line-height: 1.28 !important;
  text-shadow: 0 1px 2px #000;
}

/* Paid Upgrade Card Rarities & Weapon Warning */
.upgrade-card.rarity-comune {
  border-color: #38bdf8;
}

.upgrade-card.rarity-rara {
  border-color: #b537f2;
  box-shadow: 0 0 12px rgba(181, 55, 242, 0.24);
}

.upgrade-card.rarity-leggendaria {
  border-color: var(--neon-yellow);
  box-shadow: 0 0 16px rgba(255, 211, 25, 0.28);
}

.weapon-warn {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 800;
  color: #ffd319;
  background: rgba(255, 42, 133, 0.22);
  border: 1px solid #ff2a85;
  border-radius: 3px;
}

/* Mobile / Narrow Screen Advisory Banner */
.mobile-touch-banner {
  display: none;
  width: min(1480px, 98vw);
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  background: linear-gradient(90deg, rgba(255, 211, 25, 0.16), rgba(45, 226, 230, 0.14));
  border: 1px solid var(--neon-yellow);
  border-radius: 5px;
  color: var(--neon-yellow);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.25;
}

.mobile-banner-close {
  flex-shrink: 0;
  background: #1d2136;
  color: var(--text);
  border: 1px solid var(--neon-cyan);
  border-radius: 4px;
  padding: 2px 7px;
  font-family: var(--font-pixel);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.mobile-banner-close:hover {
  border-color: var(--neon-yellow);
  color: var(--neon-yellow);
}

.mobile-touch-banner.hidden {
  display: none !important;
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .mobile-touch-banner {
    display: flex;
  }
}

/* v0.15 Rev Pill, Leaderboard Highlight, NEW RECORD Flash, Attract, Export/Import & Admin */
.rev-pill {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  color: var(--neon-yellow);
  background: rgba(255, 211, 25, 0.14);
  border: 1px solid rgba(255, 211, 25, 0.55);
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

.rev-home-badge {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  color: var(--neon-cyan);
  background: rgba(45, 226, 230, 0.12);
  border: 1px solid var(--neon-cyan);
  padding: 3px 10px;
  border-radius: 4px;
  letter-spacing: 0.08em;
}

.admin-trigger-btn {
  border-color: rgba(152, 162, 199, 0.45);
  color: #cbd5e1;
  font-size: 11px;
}

.lb-score-row.is-my-pilot {
  border-color: var(--neon-pink) !important;
  background: linear-gradient(90deg, rgba(255, 42, 133, 0.22), rgba(45, 226, 230, 0.14)) !important;
  box-shadow: 0 0 8px rgba(255, 42, 133, 0.25);
}

.lb-score-row.is-my-pilot .lb-pilot-name {
  color: var(--neon-yellow);
  font-weight: 800;
}

.lb-trk-pilot.is-my-pilot {
  background: rgba(255, 42, 133, 0.28);
  border-color: var(--neon-pink);
  color: #ffffff;
}

@keyframes recordPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 10px rgba(255, 211, 25, 0.7);
  }
  50% {
    opacity: 0.55;
    transform: scale(1.04);
    box-shadow: 0 0 2px rgba(255, 42, 133, 0.4);
  }
}

.lb-tracks li.is-new-record {
  border-color: var(--neon-yellow);
  background: rgba(255, 211, 25, 0.2);
}

.lb-new-record-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 900;
  color: #090612;
  background: var(--neon-yellow);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  animation: recordPulse 0.65s infinite;
}

.mini-btn {
  font-family: var(--font-pixel);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  background: #171d36;
  color: var(--neon-cyan);
  border: 1px solid var(--neon-cyan);
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.mini-btn:hover {
  background: var(--neon-cyan);
  color: #090612;
}

.secondary-btn.copied-flash {
  background: var(--neon-green) !important;
  border-color: #ffffff !important;
  color: #090612 !important;
}

/* Attract Mode Overlay */
#ui-overlay.attract-mode {
  background: rgba(6, 7, 16, 0.14);
  backdrop-filter: none;
  justify-content: space-between;
  padding: 56px 20px 26px;
}

.attract-top-pill {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  color: var(--neon-cyan);
  background: rgba(9, 12, 26, 0.84);
  border: 1px solid var(--neon-cyan);
  padding: 4px 12px;
  border-radius: 4px;
  letter-spacing: 0.12em;
}

@keyframes insertCoinBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.22; }
}

.attract-cta-box {
  background: rgba(9, 11, 22, 0.88);
  border: 2px solid var(--neon-yellow);
  box-shadow: 0 0 26px rgba(255, 211, 25, 0.35);
  padding: 14px 28px;
  border-radius: 6px;
  cursor: pointer;
}

.attract-insert-coin {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  color: var(--neon-yellow);
  text-shadow: 2px 2px 0 var(--neon-pink);
  letter-spacing: 0.12em;
  animation: insertCoinBlink 1.1s infinite;
}

.attract-sub {
  font-size: 12px;
  color: #e2e8f0;
  margin-top: 6px;
}

/* Export/Import Save & Admin Modals */
.save-modal-panel,
.admin-modal-panel {
  background: rgba(10, 12, 26, 0.96);
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 32px rgba(45, 226, 230, 0.25);
  border-radius: 6px;
  padding: 16px 20px;
  text-align: left;
  width: min(880px, 96%);
  max-height: 92%;
  overflow-y: auto;
}

.save-modal-panel {
  width: min(620px, 95%);
}

.save-textarea {
  width: 100%;
  height: 112px;
  background: #090d1a;
  color: #e2e8f0;
  border: 1px solid #394473;
  border-radius: 4px;
  padding: 8px;
  font-family: monospace;
  font-size: 11px;
  resize: vertical;
  user-select: text;
}

.save-feedback {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  min-height: 18px;
}

.admin-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.admin-tab-btn {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  padding: 6px 12px;
  background: #141932;
  color: #98a2c7;
  border: 1px solid #394473;
  border-radius: 4px;
  cursor: pointer;
}

.admin-tab-btn.active {
  background: rgba(45, 226, 230, 0.16);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

.admin-scroll-body {
  max-height: 295px;
  overflow-y: auto;
  border: 1px solid #262e52;
  border-radius: 4px;
  padding: 8px;
  background: rgba(7, 9, 18, 0.75);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.admin-table th {
  text-align: left;
  color: var(--neon-yellow);
  font-family: var(--font-display);
  font-size: 10px;
  padding: 5px 6px;
  border-bottom: 1px solid #2f3556;
}

.admin-table td {
  padding: 5px 6px;
  border-bottom: 1px solid rgba(47, 53, 86, 0.45);
  color: #f1f5f9;
}

.admin-num-input,
.admin-select-input {
  background: #141932;
  color: #ffd319;
  border: 1px solid #455180;
  border-radius: 3px;
  padding: 3px 6px;
  font-family: var(--font-pixel);
  font-size: 12px;
  font-weight: 700;
  width: 68px;
  user-select: text;
}

.admin-select-input {
  width: auto;
  min-width: 190px;
}

.admin-rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-rule-card {
  background: #12172b;
  border: 1px solid #2e375e;
  border-radius: 4px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.admin-rule-card label {
  font-size: 11px;
  font-weight: 700;
  color: var(--neon-cyan);
}

.admin-auth-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.admin-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-field-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--neon-cyan);
  letter-spacing: 0.5px;
}

.admin-pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-pw-wrap .score-input,
.admin-text-input,
input[type="password"],
.admin-modal-panel input,
.admin-modal-panel textarea,
.admin-modal-panel select,
.save-modal-panel input[type="password"],
.save-modal-panel .admin-text-input {
  text-transform: none !important;
  user-select: text !important;
  -webkit-user-select: text !important;
}

.admin-pw-wrap .score-input,
.admin-text-input {
  background: #141932;
  color: #f8fafc;
  border: 1px solid #455180;
  border-radius: 3px;
  padding: 5px 8px;
  font-family: var(--font-pixel);
  font-size: 13px;
  font-weight: 700;
  width: 100%;
  letter-spacing: 0.03em;
  text-align: left;
}

.admin-eye-btn {
  background: #1a2142;
  border: 1px solid #455180;
  border-radius: 3px;
  color: #e2e8f0;
  cursor: pointer;
  padding: 5px 8px;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.admin-eye-btn:hover {
  border-color: var(--neon-cyan);
  color: #ffffff;
}

.admin-link-btn {
  background: transparent;
  border: none;
  color: #ffd319;
  font-family: var(--font-pixel);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 0;
  text-decoration: underline;
  align-self: flex-start;
}

.admin-link-btn:hover {
  color: #ffffff;
}

.admin-recovery-banner {
  background: rgba(255, 211, 25, 0.12);
  border: 1px solid #ffd319;
  border-radius: 4px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-code-pill {
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  font-weight: 900;
  color: #ffd319;
  background: #0d1226;
  border: 1px dashed #ffd319;
  border-radius: 3px;
  padding: 5px 10px;
  letter-spacing: 1px;
  user-select: all;
}

.admin-cf-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #38f276;
  background: rgba(56, 242, 118, 0.12);
  border: 1px solid rgba(56, 242, 118, 0.45);
  border-radius: 3px;
  padding: 3px 8px;
  margin-top: 4px;
}

.admin-device-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: #0f1428;
  border: 1px solid #2e375e;
  border-radius: 3px;
  padding: 6px 8px;
  font-size: 11px;
}

.admin-btn-xs {
  background: #2b1627;
  color: #ff6b9d;
  border: 1px solid #ff2a85;
  border-radius: 3px;
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.admin-btn-xs:hover {
  background: #ff2a85;
  color: #ffffff;
}

/* v0.18 Roadmap Footer Link & Roadmap Page */
.roadmap-footer-link {
  background: #181c30;
  border: 1px solid rgba(255, 211, 25, 0.55);
  color: var(--neon-yellow) !important;
  padding: 2px 7px;
  font-weight: 700;
  border-radius: 3px;
  letter-spacing: 0.04em;
  transition: border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.roadmap-footer-link:hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan) !important;
  box-shadow: 0 0 8px rgba(45, 226, 230, 0.35);
}

html.roadmap-root,
body.roadmap-page {
  height: 100dvh;
  overflow: hidden;
}

body.roadmap-page {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 16px;
}

@media (max-height: 520px) {
  html.roadmap-root,
  body.roadmap-page {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
    justify-content: flex-start;
  }
}

.roadmap-page input,
.roadmap-page textarea,
.roadmap-page select,
.rm-card-title,
.rm-card-desc {
  user-select: text;
}

.rm-crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.025) 0px,
    rgba(255, 255, 255, 0.025) 1px,
    transparent 1px,
    transparent 3px
  );
  z-index: 2;
}

.rm-shell {
  position: relative;
  z-index: 3;
  width: min(1140px, 100%);
  height: min(92vh, 92dvh);
  max-height: min(92vh, 92dvh);
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(10, 12, 26, 0.86);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 0 32px rgba(45, 226, 230, 0.16);
}

.rm-header {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bezel);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  box-shadow: 0 0 24px rgba(45, 226, 230, 0.14), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.rm-brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-inline-size: 0;
}

.rm-title-stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-inline-size: 0;
}

.rm-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(16px, 2.3vw, 22px);
  font-weight: 900;
  letter-spacing: 0.06em;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(45, 226, 230, 0.45), 0 2px 0 #050712;
}

.rm-subtitle {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.rm-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.rm-nav-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.rm-summary-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  background: #121526;
  border: 2px solid #2b3358;
  border-radius: 8px;
  padding: 14px 16px;
}

.rm-progress-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rm-progress-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
}

.rm-progress-label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  color: var(--neon-yellow);
  letter-spacing: 0.06em;
  text-shadow: 0 1px 2px #000;
}

.rm-progress-stats {
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
}

.rm-progress-track-10 {
  display: grid;
  grid-template-columns: repeat(10, minmax(16px, 24px));
  gap: 5px;
  align-items: center;
  background: #090c18;
  border: 1px solid #2e3860;
  border-radius: 4px;
  padding: 6px 8px;
}

.rm-progress-sq {
  display: block;
  height: 14px;
  background: #101528;
  border: 1px solid #2a3356;
  border-radius: 2px;
  image-rendering: pixelated;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.rm-progress-sq.on {
  background: linear-gradient(180deg, #5cff93 0%, #24cf61 100%);
  border-color: #b7ffd0;
  box-shadow: 0 0 8px rgba(56, 242, 118, 0.55);
}

.rm-filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding-top: 8px;
  border-top: 1px solid #262e4d;
}

.rm-filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.rm-filter-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.06em;
  margin-inline-end: 2px;
}

.rm-filter-btn {
  background: #181d34;
  color: #cbd5e1;
  border: 1px solid #35406b;
  border-radius: 4px;
  padding: 5px 10px;
  font-family: var(--font-pixel);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color 0.14s ease, color 0.14s ease, background 0.14s ease;
}

.rm-filter-btn:hover {
  border-color: var(--neon-cyan);
  color: #ffffff;
}

.rm-filter-btn[aria-pressed="true"] {
  background: rgba(45, 226, 230, 0.18);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  box-shadow: 0 0 8px rgba(45, 226, 230, 0.25);
}

.rm-filter-btn:focus-visible,
.rm-status-btn:focus-visible,
.rm-card-del:focus-visible,
.rm-input:focus-visible,
.rm-select:focus-visible,
.rm-textarea:focus-visible {
  outline: 2px solid var(--neon-yellow);
  outline-offset: 2px;
}

/* Admin Bar & Form */
.rm-admin-panel {
  background: linear-gradient(180deg, rgba(24, 30, 56, 0.96), rgba(14, 17, 34, 0.98));
  border: 2px solid var(--neon-pink);
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 0 20px rgba(255, 42, 133, 0.18);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rm-admin-panel[hidden] {
  display: none;
}

.rm-admin-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rm-admin-heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  color: var(--neon-pink);
  letter-spacing: 0.06em;
}

.rm-add-form {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 10px;
  align-items: end;
}

.rm-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-inline-size: 0;
}

.rm-col-title { grid-column: span 5; }
.rm-col-cat { grid-column: span 3; }
.rm-col-diff { grid-column: span 2; }
.rm-col-ver { grid-column: span 2; }
.rm-col-desc { grid-column: span 9; }
.rm-col-submit { grid-column: span 3; }

@media (max-width: 820px) {
  .rm-col-title, .rm-col-desc { grid-column: span 12; }
  .rm-col-cat, .rm-col-diff, .rm-col-ver { grid-column: span 4; }
  .rm-col-submit { grid-column: span 12; }
}

@media (max-width: 540px) {
  .rm-col-cat, .rm-col-diff, .rm-col-ver { grid-column: span 12; }
}

.rm-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--neon-cyan);
  letter-spacing: 0.05em;
}

.rm-input,
.rm-select,
.rm-textarea {
  width: 100%;
  font-family: var(--font-pixel);
  font-size: max(1rem, 13px);
  color: #f8fafc;
  background: #0b0e1e;
  border: 1px solid #3c4774;
  border-radius: 4px;
  padding: 7px 10px;
  line-height: 1.35;
}

.rm-textarea {
  resize: vertical;
  min-height: 44px;
}

.rm-input:user-invalid,
.rm-textarea:user-invalid {
  border-color: var(--neon-pink);
}

.rm-prompt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 42, 133, 0.35);
}

.rm-prompt-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.rm-live-status {
  font-size: 12px;
  font-weight: 700;
  color: var(--neon-green);
  min-height: 18px;
}

.rm-main-pane {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rm-summary-panel {
  flex: 0 0 auto;
}

/* Task Grid & Cards */
.rm-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  align-content: start;
  padding-right: 6px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--neon-yellow) rgba(10, 14, 28, 0.7);
}

.rm-shell #controls-bar {
  flex: 0 0 auto;
}

.rm-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(180deg, #161a2e 0%, #101324 100%);
  border: 2px solid #2e375d;
  border-radius: 7px;
  padding: 13px 14px;
  box-shadow: 0 4px 0 #070913, inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.16s ease, transform 0.12s ease;
}

.rm-card:hover {
  border-color: #4b5996;
}

.rm-card.status-in_progress {
  border-color: rgba(255, 211, 25, 0.55);
}

.rm-card.status-done {
  border-color: rgba(56, 242, 118, 0.45);
  background: linear-gradient(180deg, #121c27 0%, #0d141d 100%);
}

.rm-card.is-selected {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 14px rgba(45, 226, 230, 0.25), 0 4px 0 #070913;
}

.rm-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.rm-badges-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.rm-cat-badge {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--neon-cyan);
  background: rgba(45, 226, 230, 0.12);
  border: 1px solid rgba(45, 226, 230, 0.4);
  border-radius: 3px;
  padding: 2px 6px;
}

.rm-diff-badge {
  font-size: 10.5px;
  font-weight: 800;
  border-radius: 3px;
  padding: 2px 6px;
  border: 1px solid transparent;
}

.rm-diff-facile {
  color: #38f276;
  background: rgba(56, 242, 118, 0.12);
  border-color: rgba(56, 242, 118, 0.42);
}

.rm-diff-media {
  color: #ffd319;
  background: rgba(255, 211, 25, 0.12);
  border-color: rgba(255, 211, 25, 0.42);
}

.rm-diff-alta {
  color: #ff5b9e;
  background: rgba(255, 42, 133, 0.15);
  border-color: rgba(255, 42, 133, 0.5);
}

.rm-ver-badge {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 800;
  color: #e2e8f0;
  background: #1c2240;
  border: 1px solid #414e82;
  border-radius: 3px;
  padding: 2px 7px;
  white-space: nowrap;
}

.rm-card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.3;
  text-shadow: 0 1px 2px #000;
}

.rm-card-desc {
  margin: 0;
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.42;
}

.rm-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.rm-select-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--neon-cyan);
  cursor: pointer;
}

.rm-select-chk {
  width: 16px;
  height: 16px;
  accent-color: var(--neon-cyan);
  cursor: pointer;
}

.rm-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-inline-start: auto;
}

.rm-status-pill,
.rm-status-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-pixel);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  border-radius: 4px;
  padding: 4px 9px;
  border: 1px solid transparent;
}

.rm-status-btn {
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease;
}

.rm-status-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.rm-status-todo {
  color: #e2e8f0;
  background: rgba(148, 163, 184, 0.14);
  border-color: rgba(148, 163, 184, 0.45);
}

.rm-status-in_progress {
  color: #ffd319;
  background: rgba(255, 211, 25, 0.16);
  border-color: rgba(255, 211, 25, 0.65);
}

.rm-status-done {
  color: #38f276;
  background: rgba(56, 242, 118, 0.16);
  border-color: rgba(56, 242, 118, 0.65);
}

.rm-card-del {
  background: #231426;
  border: 1px solid rgba(255, 42, 133, 0.55);
  color: #ff7ab2;
  border-radius: 4px;
  padding: 4px 7px;
  font-size: 12px;
  cursor: pointer;
}

.rm-card-del:hover {
  background: var(--neon-pink);
  color: #ffffff;
}

.rm-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px 16px;
  background: #111528;
  border: 2px dashed #323c66;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
}

/* Native Modal Dialog for Quick Admin Login */
dialog.rm-dialog {
  width: min(440px, 92vw);
  background: #14182c;
  color: var(--text);
  border: 2px solid var(--neon-cyan);
  border-radius: 8px;
  padding: 18px 20px;
  box-shadow: 0 0 32px rgba(45, 226, 230, 0.35);
}

dialog.rm-dialog:modal {
  overscroll-behavior: contain;
}

dialog.rm-dialog::backdrop {
  background: rgba(6, 8, 18, 0.8);
  overflow: hidden;
  overscroll-behavior: contain;
}

.rm-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.rm-dialog-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: var(--neon-cyan);
}

.rm-login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rm-pass-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rm-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

/* v0.19 Unified Admin Roadmap Tab & Insert Coin UI */
.admin-rm-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-rm-progress-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  background: #10152a;
  border: 1px solid #2b355c;
  border-radius: 5px;
  padding: 8px 10px;
}

.admin-rm-counters {
  font-size: 11px;
  font-weight: 700;
  color: var(--neon-cyan);
  letter-spacing: 0.04em;
}

.admin-rm-form {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
  align-items: end;
  background: #10152a;
  border: 1px solid #354173;
  border-radius: 5px;
  padding: 9px 10px;
}

.admin-rm-preview {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #cbd5e1;
  background: rgba(7, 9, 20, 0.72);
  border: 1px dashed #33406b;
  border-radius: 4px;
  padding: 5px 8px;
}

.admin-rm-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.admin-rm-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-rm-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  background: #12172c;
  border: 1px solid #2d365e;
  border-radius: 5px;
  padding: 7px 9px;
}

.admin-rm-row.status-done {
  border-color: rgba(56, 242, 118, 0.45);
  background: #101a25;
}

.admin-rm-row.status-in_progress {
  border-color: rgba(255, 211, 25, 0.55);
}

.admin-rm-row-left {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.admin-rm-row-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.credits-pill-btn {
  border-color: var(--neon-yellow) !important;
  color: var(--neon-yellow) !important;
  background: rgba(255, 211, 25, 0.12) !important;
  font-family: var(--font-display);
  font-weight: 800;
}

.credits-pill-btn.ready {
  border-color: var(--neon-green) !important;
  color: var(--neon-green) !important;
  background: rgba(56, 242, 118, 0.14) !important;
}

.coin-cabinet-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;
  margin: 4px 0 10px;
  padding: 8px 14px;
  background: linear-gradient(180deg, rgba(22, 27, 50, 0.92), rgba(11, 14, 28, 0.96));
  border: 2px solid var(--neon-yellow);
  border-radius: 6px;
  box-shadow: 0 0 14px rgba(255, 211, 25, 0.2);
}

.coin-credits-readout {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--neon-yellow);
  text-shadow: 0 0 8px rgba(255, 211, 25, 0.45);
}

.coin-credits-readout.ready {
  color: var(--neon-green);
  text-shadow: 0 0 8px rgba(56, 242, 118, 0.45);
}

.coin-credits-readout.flash {
  animation: coinFlash 0.35s ease;
}

@keyframes coinFlash {
  0% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.12); filter: brightness(1.6); }
  100% { transform: scale(1); filter: brightness(1); }
}

.insert-coin-btn {
  background: linear-gradient(180deg, #ffd319 0%, #f59e0b 100%);
  color: #0b0e17;
  border: 2px solid #fff3b0;
  border-radius: 5px;
  padding: 6px 12px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 3px 0 #92400e;
}

.insert-coin-btn:hover {
  filter: brightness(1.1);
}

.insert-coin-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #92400e;
}

/* v0.20 / v0.21 Centered Tall (~92vh) Admin View, Livery Shop, Trophy Room & Time Attack */
#ui-overlay.admin-fullscreen-view {
  position: fixed;
  inset: 0;
  z-index: 60;
  padding: 14px 24px;
  background: rgba(7, 9, 20, 0.94);
  backdrop-filter: blur(6px);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#ui-overlay.admin-fullscreen-view .admin-modal-panel {
  width: min(1280px, 98vw);
  max-width: 1280px;
  height: min(92vh, 92dvh);
  max-height: min(92vh, 92dvh);
  min-height: 0;
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#ui-overlay.admin-fullscreen-view .admin-header-row,
#ui-overlay.admin-fullscreen-view .admin-tabs,
#ui-overlay.admin-fullscreen-view .save-feedback,
#ui-overlay.admin-fullscreen-view .overlay-actions {
  flex: 0 0 auto;
}

#ui-overlay.admin-fullscreen-view .admin-scroll-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--neon-cyan) rgba(10, 14, 28, 0.7);
}

@media (max-height: 520px) {
  #ui-overlay.admin-fullscreen-view {
    overflow-y: auto;
    align-items: flex-start;
  }
  #ui-overlay.admin-fullscreen-view .admin-modal-panel {
    height: auto;
    max-height: none;
  }
}

.admin-rm-form-wide {
  grid-template-columns: 1.6fr 1fr 1fr auto;
}

.admin-rm-edit-banner {
  background: rgba(255, 211, 25, 0.14);
  border: 1.5px solid var(--neon-yellow);
  border-radius: 5px;
  color: #fef08a;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 10px;
  margin-bottom: 8px;
}

.admin-rm-row.is-editing {
  border-color: var(--neon-yellow);
  box-shadow: 0 0 12px rgba(255, 211, 25, 0.24);
}

.rm-card-edit {
  background: rgba(45, 226, 230, 0.14);
  color: var(--neon-cyan);
  border: 1px solid var(--neon-cyan);
  border-radius: 4px;
  padding: 4px 8px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.rm-card-edit:hover {
  background: rgba(45, 226, 230, 0.28);
}

/* Livery Shop Grid inside Garage */
.livery-shop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.livery-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #12172c;
  border: 1.5px solid #2d3761;
  border-radius: 5px;
  padding: 6px 8px;
  color: #f8fafc;
  cursor: pointer;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
}

.livery-chip.active {
  border-color: var(--neon-yellow);
  box-shadow: 0 0 10px rgba(255, 211, 25, 0.28);
}

.livery-chip:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.livery-swatch {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  flex-shrink: 0;
}

.livery-chip-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Trophy Room Modal */
.trophy-modal-panel,
.timeattack-modal-panel {
  background: rgba(10, 12, 26, 0.96);
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 32px rgba(45, 226, 230, 0.25);
  border-radius: 6px;
  padding: 18px 20px;
  text-align: left;
  width: min(860px, 95%);
  max-height: 92%;
  overflow-y: auto;
}

.trophy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 8px;
}

.trophy-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  border-radius: 5px;
  border: 1.5px solid #2b355c;
  background: #0f1428;
}

.trophy-card.unlocked {
  border-color: var(--neon-yellow);
  background: linear-gradient(180deg, rgba(255, 211, 25, 0.12), #10162d);
}

.trophy-card.locked {
  opacity: 0.62;
}

.trophy-icon {
  font-size: 22px;
  line-height: 1;
}

.trophy-title {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 800;
  color: #ffffff;
}

.trophy-desc {
  font-size: 11px;
  color: #cbd5e1;
  line-height: 1.3;
}

.trophy-badge {
  align-self: flex-start;
  font-size: 9.5px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 3px;
  background: #1e293b;
  color: #94a3b8;
}

.trophy-badge.on {
  background: var(--neon-yellow);
  color: #090d16;
}

/* Time Attack Track Selector */
.ta-track-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 8px;
}

.ta-track-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #12172c;
  border: 1.5px solid #2f3b69;
  border-radius: 5px;
  color: #f8fafc;
  cursor: pointer;
  text-align: left;
}

.ta-track-card:hover {
  border-color: var(--neon-cyan);
  background: #17203e;
}

.ta-minimap-canvas {
  background: #080b16;
  border: 1px solid #33406b;
  border-radius: 3px;
  flex-shrink: 0;
}

.ta-track-name {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  color: var(--neon-yellow);
}

.ta-track-meta {
  font-size: 10.5px;
  color: #94a3b8;
  margin-top: 2px;
}

.ta-track-best {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--neon-cyan);
  margin-top: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--neon-yellow);
  outline-offset: 2px;
}

/* v0.21 Pre-Race Strategy Selector & G.niK Creator Ghost Button */
.ghost-creator-btn {
  border: 2px solid #c084fc;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.28), rgba(255, 42, 133, 0.22));
  color: #f5d0fe;
  text-shadow: 0 1px 2px #000;
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.25);
}

.ghost-creator-btn:hover {
  border-color: #f0abfc;
  background: linear-gradient(135deg, rgba(192, 132, 252, 0.4), rgba(255, 42, 133, 0.34));
  box-shadow: 0 0 18px rgba(192, 132, 252, 0.48);
}

.pre-race-panel {
  width: min(680px, 95%);
  background: rgba(11, 15, 31, 0.96);
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 28px rgba(45, 226, 230, 0.25);
  border-radius: 6px;
  padding: 14px 18px;
  text-align: left;
}

.pre-race-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.strategy-fieldset {
  border: 1.5px solid #2b3868;
  border-radius: 5px;
  background: #0d1226;
  padding: 8px 10px 10px;
  margin: 0;
}

.strategy-legend {
  font-family: var(--font-pixel);
  font-size: 11px;
  font-weight: 800;
  color: var(--neon-cyan);
  padding: 0 6px;
  letter-spacing: 0.4px;
}

.strategy-radio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.strategy-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: #141b36;
  border: 2px solid #28335e;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.strategy-option:hover {
  border-color: var(--neon-cyan);
}

.strategy-option:has(input:checked) {
  border-color: var(--neon-yellow);
  background: #1d254a;
  box-shadow: 0 0 12px rgba(255, 211, 25, 0.26);
}

.strategy-option input[type="radio"] {
  margin-top: 3px;
  accent-color: #ffd319;
  transform: scale(1.15);
  cursor: pointer;
}

.strategy-opt-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.strategy-opt-title {
  font-size: 12.5px;
  font-weight: 900;
  color: #f8fafc;
}

.strategy-opt-desc {
  font-size: 11px;
  line-height: 1.3;
  color: #cbd5e1;
}

.pilot-name-contrast {
  text-shadow:
    -1px -1px 0 #05070e,
    1px -1px 0 #05070e,
    -1px 1px 0 #05070e,
    1px 1px 0 #05070e,
    0 1px 3px rgba(0, 0, 0, 0.9);
}
