/**
 * client/index.css
 * Retro Arcade Racer Styling.
 * Strictly NO neon colors or futuristic glow effects.
 * Clean matte surfaces, sharp borders, hardware-accelerated transforms.
 */

:root {
  --bg-color: #1a1e24;
  --panel-bg: #222730;
  --accent-color: #3b5998;
  --accent-hover: #2d4373;
  --secondary-color: #3f4756;
  --secondary-hover: #4e5769;
  --danger-color: #b91c1c;
  --danger-hover: #991b1b;
  --success-color: #15803d;
  --text-main: #f3f4f6;
  --text-muted: #94a3b8;
  --border-color: #333c4d;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body,
html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  font-family: var(--font-family);
  color: var(--text-main);
}

#app-root {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* In-Game HUD (Retro arcade top dashboard) */
#hud-container {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 8px 20px;
  background-color: #1c222c;
  border-bottom: 2px solid var(--border-color);
  z-index: 20;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-self: start;
}

#hud-timer {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #e2e8f0;
}

#hud-fps {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  background: #28313e;
  border: 1px solid var(--border-color);
  padding: 2px 7px;
  border-radius: 4px;
}

/* Center Dashboard: Place, Lap and Mini Map */
.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  justify-self: center;
}

.hud-center-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hud-minimap {
  width: 140px;
  height: 64px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

#minimap-svg {
  width: 100%;
  height: 100%;
  display: block;
}

#hud-place {
  font-size: 20px;
  font-weight: 800;
  color: #f59e0b;
  letter-spacing: 0.5px;
}

#hud-lap {
  font-size: 15px;
  font-weight: 700;
  color: #cbd5e1;
  background: #2a3442;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

/* Right Dashboard: Player name and perk slot */
.hud-right {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-self: end;
}

.hud-player-name {
  font-size: 14px;
  font-weight: 700;
  color: #e2e8f0;
  background: #2a3442;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.hud-perk-badge {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: #232a35;
  color: #94a3b8;
  min-width: 175px;
  text-align: center;
  box-sizing: border-box;
}

.hud-perk-badge.active {
  background: #b45309;
  color: #ffffff;
  border-color: #d97706;
}

.hud-perk-badge.ufo {
  background: #065f46;
  color: #a7f3d0;
  border-color: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

/* Main Viewport & 2D Top-Down Stage */
#game-viewport {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #1e381d;
  contain: layout paint;
}

#track-stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 1600px;
  height: 1000px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  border-radius: 6px;
  overflow: hidden;
  background-color: #2d6a4f;
  transform-origin: 0 0;
  will-change: transform;
}

#track-bg-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#track-entities-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

#track-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Top-Down Single-Element PNG Car Sprites */
.entity-car-sprite {
  position: absolute;
  top: 0;
  left: 0;
  width: 32px;
  height: 52px;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  z-index: 25;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
}

.car-sprite-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.65));
}

.car-color-badge {
  position: absolute;
  bottom: 2px;
  width: 10px;
  height: 4px;
  border-radius: 2px;
  border: 1px solid #ffffff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

.car-nickname-label {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  background: rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #475569;
  letter-spacing: 0.5px;
  pointer-events: none;
}

.car-spinning {
  filter: drop-shadow(0 0 12px #ef4444) !important;
}

.car-boosting {
  filter: drop-shadow(0 0 14px #f59e0b) !important;
}

/* Mystery Item Box */
.entity-box {
  position: absolute;
  top: 0;
  left: 0;
  width: 22px;
  height: 22px;
  background: #d97706;
  border: 2px solid #fef3c7;
  color: #ffffff;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 4px;
  will-change: transform;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  z-index: 10;
}

/* Green UFO Special Box */
.entity-box.entity-box-ufo {
  background: #059669;
  border: 2px solid #6ee7b7;
  color: #ecfdf5;
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: 0.5px;
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.85), 0 2px 6px rgba(0, 0, 0, 0.5);
  z-index: 12;
}

/* UFO Abduction Dynamic Actor */
.ufo-abduction-actor {
  position: absolute;
  top: 0;
  left: 0;
  width: 80px;
  height: 110px;
  pointer-events: none;
  z-index: 45;
  will-change: transform;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ufo-saucer {
  position: relative;
  width: 68px;
  height: 30px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6));
}

.ufo-saucer-dome {
  position: absolute;
  top: 0;
  left: 19px;
  width: 30px;
  height: 16px;
  background: radial-gradient(circle at 40% 30%, #a7f3d0, #059669 70%, #064e3b 100%);
  border: 1.5px solid #34d399;
  border-radius: 50% 50% 0 0;
}

.ufo-saucer-body {
  position: absolute;
  top: 10px;
  left: 0;
  width: 68px;
  height: 20px;
  background: linear-gradient(to bottom, #94a3b8 0%, #475569 50%, #1e293b 100%);
  border: 1.5px solid #cbd5e1;
  border-radius: 50%;
}

.ufo-saucer-lights {
  position: absolute;
  top: 18px;
  left: 6px;
  width: 56px;
  display: flex;
  justify-content: space-around;
}

.ufo-saucer-light {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #facc15;
  box-shadow: 0 0 4px #facc15;
  animation: ufoLightBlink 0.6s infinite alternate;
}

.ufo-saucer-light:nth-child(2) { animation-delay: 0.2s; }
.ufo-saucer-light:nth-child(3) { animation-delay: 0.4s; }

.ufo-tractor-beam {
  width: 56px;
  height: 78px;
  background: linear-gradient(to bottom, rgba(52, 211, 153, 0.8), rgba(16, 185, 129, 0.15));
  clip-path: polygon(28% 0%, 72% 0%, 100% 100%, 0% 100%);
  box-shadow: 0 0 16px rgba(52, 211, 153, 0.6);
  animation: beamFlicker 0.25s infinite alternate;
}

@keyframes ufoLightBlink {
  0% { opacity: 0.3; }
  100% { opacity: 1.0; }
}

@keyframes beamFlicker {
  0% { opacity: 0.7; }
  100% { opacity: 0.95; }
}

/* Oil Slick Hazard */
.entity-hazard-oil {
  position: absolute;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #0f172a;
  border: 2px solid #1e293b;
  will-change: transform;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8);
  z-index: 8;
}

/* Missile Projectile */
.entity-missile {
  position: absolute;
  top: 0;
  left: 0;
  width: 12px;
  height: 20px;
  background: #dc2626;
  border: 2px solid #ffffff;
  border-radius: 6px 6px 2px 2px;
  will-change: transform;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.6);
  z-index: 18;
}

/* Pre-Race Countdown Overlay - Top Anchored to avoid starting grid occlusion */
#countdown-overlay {
  position: absolute;
  top: 14%;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  height: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  z-index: 50;
}

.countdown-banner {
  padding: 16px 40px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.9);
  border: 2px solid #475569;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  animation: countdownPop 0.35s ease-out;
}

.countdown-num {
  font-size: 72px;
  font-weight: 900;
  color: #f59e0b;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
}

.countdown-go {
  font-size: 42px;
  font-weight: 900;
  color: #22c55e;
  letter-spacing: 1px;
}

.ready-prompt-text {
  font-size: 22px;
  font-weight: 800;
  color: #f1f5f9;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ready-key {
  background: #f59e0b;
  color: #0f172a;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 24px;
  font-weight: 900;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.6);
  animation: keyPulse 1s infinite alternate;
}

.ready-sub {
  color: #94a3b8;
  font-size: 16px;
  font-weight: 700;
}

.ready-banner-pulse {
  border-color: #f59e0b;
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.4);
}

@keyframes keyPulse {
  0% { transform: scale(0.95); }
  100% { transform: scale(1.08); }
}

@keyframes countdownPop {
  0% {
    transform: scale(0.6);
    opacity: 0.2;
  }
  70% {
    transform: scale(1.15);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}


/* Controls Instruction Bar (Top-Left overlay) */
#controls-bar {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 30;
  pointer-events: none;
  display: block;
  padding: 12px 14px;
  background: rgba(28, 34, 44, 0.94);
  border: 2px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.35);
}

.controls-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.controls-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f5f10b;
  font-size: 13px;
}

.controls-list li strong {
  min-width: 46px;
  padding: 5px 7px;
  text-align: center;
  background: #14171d;
  border: 1px solid #526174;
  border-radius: 4px;
  color: var(--text-main);
  font-family: monospace;
  font-size: 12px;
  font-weight: 700;
}

.controls-list li span {
  opacity: 0.9;
}

/* Live Race Scoreboard / Leaderboard (Top-Right overlay) */
#hud-leaderboard {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 30;
  pointer-events: none;
  display: block;
  min-width: 175px;
  padding: 10px 12px;
  background: rgba(28, 34, 44, 0.94);
  border: 2px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.35);
}

.leaderboard-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #94a3b8;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-color);
}

.leaderboard-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #cbd5e1;
}

.leaderboard-row.local-player {
  color: #f59e0b;
  font-weight: 700;
}

.leaderboard-pos {
  font-family: monospace;
  font-weight: 800;
  min-width: 24px;
  color: #f5f10b;
}

.leaderboard-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 85px;
}

.leaderboard-lap {
  font-family: monospace;
  font-size: 11px;
  color: #94a3b8;
}

/* Modal Overlays */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 14, 18, 0.82);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

#in-game-menu {
  z-index: 100;
}

#settings-modal {
  z-index: 250 !important;
}

.modal-card {
  background: var(--panel-bg);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 28px;
  width: 380px;
  max-height: 94vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
}

.modal-card h1,
.modal-card h2 {
  font-size: 20px;
  text-align: center;
  color: #f5f10b;
}

#game-over-modal h2 {
  font-family: Arial, sans-serif;
  color: #ffffff;
}

.game-over-text {
  font-size: 18px;
  text-align: center;
  font-weight: 700;
  color: #f5f10b;
}

.settings-tabs {
  display: flex;
  gap: 8px;
  width: 100%;
}

.settings-tab-btn {
  flex: 1;
  padding: 8px 12px;
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.settings-tab-btn:hover {
  background: #334155;
  color: #f1f5f9;
}

.settings-tab-btn.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
}

.settings-panel {
  width: 100%;
}

.settings-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: Arial, sans-serif;
  font-size: 13px;
  color: #ffffff;
}

.setting-row .btn {
  min-width: 80px;
}

.settings-sounds {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 0 8px 0;
}

.sound-setting-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sound-setting-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: Arial, sans-serif;
  font-size: 13px;
  color: #ffffff;
}

.sound-val-badge {
  font-family: monospace;
  font-size: 12px;
  color: #f5f10b;
  font-weight: bold;
}

.form-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #334155;
  outline: none;
  cursor: pointer;
}

.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f5f10b;
  cursor: pointer;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
  transition: transform 0.1s ease;
}

.form-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.form-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f5f10b;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.input-group label {
  font-family: Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
}

.input-group input,
.input-group select,
.form-select,
.form-input {
  padding: 9px 12px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: #14171d;
  color: var(--text-main);
  outline: none;
  font-size: 14px;
  box-sizing: border-box;
  width: 100%;
}

.form-input {
  cursor: text;
}

.form-select {
  cursor: pointer;
}

.input-group input:focus,
.input-group select:focus,
.form-select:focus,
.form-input:focus {
  border-color: #64748b;
}

/* Buttons */
.btn {
  padding: 10px 14px;
  border-radius: 4px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.btn.primary {
  background: #2563eb;
  color: #fff;
  border-color: #1d4ed8;
}

.btn.primary:hover {
  background: #1d4ed8;
}

.btn.secondary {
  background: #334155;
  color: #e2e8f0;
  border-color: #475569;
}

.btn.secondary:hover {
  background: #475569;
}

.btn.success {
  background: #15803d;
  color: #fff;
  border-color: #166534;
}

.btn.success:hover {
  background: #166534;
}

.btn.danger {
  background: var(--danger-color);
  color: #fff;
}

.btn.danger:hover {
  background: var(--danger-hover);
}

.btn:disabled,
.btn.disabled-btn,
.btn[disabled] {
  opacity: 0.35 !important;
  cursor: not-allowed !important;
  background: #181f2a !important;
  color: #64748b !important;
  border-color: #27303f !important;
  box-shadow: none !important;
  filter: grayscale(1) !important;
}

.btn:disabled:hover,
.btn.disabled-btn:hover,
.btn[disabled]:hover,
.btn.secondary:disabled:hover,
.btn.secondary.disabled-btn:hover {
  background: #181f2a !important;
  color: #64748b !important;
  border-color: #27303f !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
}

#lobby-message {
  min-height: 16px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

#lobby-player-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 20px;
  color: var(--text-main);
  font-size: 14px;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Broadcast Banners */
#broadcast-banners {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 50;
  pointer-events: none;
}

.broadcast-banner {
  background: #1e2633;
  border: 1px solid var(--border-color);
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  animation: bannerSlideIn 0.3s ease-out;
}

@keyframes bannerSlideIn {
  from {
    transform: translateY(-12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Chat overlay docked in bottom-right corner */
#chat-container {
  position: absolute;
  bottom: 40px;
  right: 16px;
  left: auto;
  width: min(290px, calc(100vw - 32px));
  background: #1c222c;
  border: 1px solid #465263;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 110;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}

.chat-header {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: #28313e;
  border-bottom: 1px solid var(--border-color);
}

#chat-heading {
  margin-right: auto;
  color: #f1f5f9;
  font-size: 13px;
  font-weight: 700;
}

.chat-unread {
  padding: 3px 7px;
  border-radius: 10px;
  background: #b91c1c;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.chat-toggle {
  padding: 4px 7px;
  border: 1px solid #526174;
  border-radius: 4px;
  background: #1c222c;
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.chat-toggle:hover {
  background: #354154;
}

.chat-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
}

.chat-collapsed .chat-header {
  border-bottom: 0;
}

.chat-collapsed .chat-content {
  display: none;
}

#chat-messages {
  height: 110px;
  overflow-y: auto;
  color: #f1f5f9;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-message {
  word-break: break-word;
}

.chat-sender {
  font-weight: 700;
  color: #38bdf8;
}

.chat-text {
  color: #f1f5f9;
}

#chat-input {
  width: 100%;
  background: #14171d;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 5px 8px;
  color: var(--text-main);
  font-size: 11px;
  outline: none;
}

/* ==========================================================
   VimVim Race Track - Revamped UI Styles
   ========================================================== */

/* Home Menu Hero Screen */
#home-menu,
#solo-menu,
#multiplayer-menu,
#multiplayer-room {
  background: transparent;
  overflow: hidden;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
}

/* Dynamic Shared Menu & Room Lobby Background */
.home-dynamic-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  background-color: #0b1118;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.4) 0%, rgba(5, 8, 12, 0.88) 100%),
    repeating-linear-gradient(45deg, rgba(22, 101, 52, 0.06) 0px, rgba(22, 101, 52, 0.06) 24px, rgba(20, 83, 45, 0.1) 24px, rgba(20, 83, 45, 0.1) 48px);
  z-index: 50;
}

.menu-roads-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.menu-roads-horizontal {
  z-index: 1;
}

.menu-cars-horizontal {
  z-index: 2;
}

.menu-roads-vertical {
  z-index: 3;
}

.menu-cars-vertical {
  z-index: 4;
}

.menu-road {
  position: absolute;
}

.menu-road-horizontal {
  left: 0;
  width: 100%;
  height: 64px;
  background: #192231;
  border-top: 3px solid #64748b;
  border-bottom: 3px solid #64748b;
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.5);
}

.menu-road-horizontal::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 0;
  border-top: 3px dashed rgba(255, 255, 255, 0.45);
  transform: translateY(-50%);
}

.menu-road-vertical {
  top: 0;
  height: 100%;
  width: 64px;
  background: #1e293b;
  border-left: 3px solid #64748b;
  border-right: 3px solid #64748b;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.85);
}

.menu-road-vertical::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  height: 100%;
  width: 0;
  border-left: 3px dashed rgba(255, 255, 255, 0.45);
  transform: translateX(-50%);
}

.menu-road-top {
  top: 15%;
}

.menu-road-bottom {
  bottom: 15%;
}

.menu-road-left {
  left: 10%;
}

.menu-road-right {
  right: 10%;
}

.menu-bg-cars-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.menu-bg-car {
  position: absolute;
  width: 28px;
  height: 52px;
  pointer-events: none;
  will-change: transform;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.7));
  transition: none;
}

.menu-bg-car-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.menu-bg-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(11, 17, 24, 0.1) 0%, rgba(5, 8, 12, 0.85) 75%);
  z-index: 5;
}

.home-card {
  position: relative;
  z-index: 10;
  width: 440px;
  text-align: center;
  padding: 36px 32px;
  border: 2px solid #475569;
  background: rgba(18, 24, 34, 0.95);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 30px rgba(56, 189, 248, 0.15);
}

.home-badge {
  display: inline-block;
  align-self: center;
  margin: 0 auto 8px auto;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  padding: 4px 12px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 4px;
}

.home-title {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #f8fafc;
  margin-bottom: 24px;
  text-transform: uppercase;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.home-subtitle {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 24px;
}

.home-button-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-large {
  padding: 13px 18px;
  font-size: 15px;
  letter-spacing: 0.5px;
}

.mode-select-subtitle {
  font-size: 13px;
  color: #94a3b8;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: -14px;
  margin-bottom: 24px;
}

.text-btn {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 13px;
  padding: 8px 12px;
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.15s ease;
}

.text-btn:hover {
  color: #94a3b8;
}

/* Terminal Mode Card (Exact size as current menu) */
.terminal-card {
  padding: 0 !important;
  border: 1px solid #334155 !important;
  background: #090e17 !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 25px rgba(34, 197, 94, 0.15) !important;
  font-family: 'Courier New', Courier, Consolas, monospace !important;
  text-align: left !important;
  overflow: hidden;
}

.terminal-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d1420;
  border-bottom: 1px solid #1e293b;
  padding: 12px 16px;
}

.terminal-title {
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.terminal-close-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #64748b;
  font-family: 'Courier New', Courier, Consolas, monospace;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 8px;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.terminal-close-btn:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.15);
}

.terminal-body {
  padding: 24px 28px;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 14px;
  line-height: 1.6;
  color: #cbd5e1;
}

.terminal-option-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  user-select: none;
  cursor: default;
}

.term-key {
  color: #22c55e;
  font-weight: bold;
}

.terminal-line {
  word-break: break-all;
}

.term-green {
  color: #22c55e;
  font-weight: 700;
}

.term-error {
  color: #f87171;
  font-weight: 700;
}

.terminal-bottom-panel {
  border-top: 1px solid #1e293b;
  background: #060a10;
  padding: 12px 18px 16px 18px;
}

.terminal-prompt-line {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0a0f18;
  border: 1px solid #1e293b;
  border-radius: 4px;
  padding: 8px 12px;
}

.terminal-prompt-sym {
  color: #22c55e;
  font-weight: bold;
  font-size: 14px;
}

.terminal-input {
  background: transparent;
  border: none;
  outline: none;
  color: #f8fafc;
  font-family: inherit;
  font-size: 13px;
  flex: 1;
}

.terminal-input::placeholder {
  color: #64748b;
  font-style: italic;
}

.terminal-cursor {
  color: #22c55e;
  font-weight: bold;
  animation: term-blink 1s step-start infinite;
}

@keyframes term-blink {
  50% {
    opacity: 0;
  }
}

/* Solo and Setup Card Layouts */
.setup-card {
  width: 440px;
}

.setup-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setup-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
}

/* Carousel Control */
.carousel-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #14171d;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 10px;
}

.carousel-control.compact {
  padding: 4px 8px;
}

.btn-carousel {
  width: 32px;
  height: 32px;
  background: #1e2633;
  color: #f1f5f9;
  border: 1px solid #475569;
  border-radius: 4px;
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.btn-carousel:hover:not(:disabled) {
  background: #334155;
  border-color: #64748b;
}

.btn-carousel.disabled,
.btn-carousel:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.carousel-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
}

.carousel-car-img {
  width: 68px;
  height: 68px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
}

.compact .carousel-car-img {
  width: 48px;
  height: 48px;
}

.carousel-title {
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
}

.track-preview-box {
  position: relative;
  width: 100%;
  height: 64px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #334155;
}

.carousel-track-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.75;
}

.track-info {
  position: absolute;
  bottom: 4px;
  left: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.track-diff-badge {
  font-size: 10px;
  font-weight: 800;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid #22c55e;
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}

.track-diff-badge.medium {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid #f59e0b;
}

.track-diff-badge.hard {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid #ef4444;
}

/* 5-Color Picker */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.active {
  border-color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
  transform: scale(1.14);
}

.horizontal-group {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  gap: 12px;
}

.horizontal-group .btn {
  flex: 1;
}

/* Multiplayer Entry */
.mp-choice-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-full {
  width: 100%;
}

.mp-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  margin: 4px 0;
}

.mp-divider::before,
.mp-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #334155;
}

.mp-divider span {
  padding: 0 8px;
}

.input-group-row {
  display: flex;
  gap: 8px;
}

.input-group-row input {
  flex: 1;
  padding: 9px 12px;
  background: #14171d;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-main);
  outline: none;
}

/* Multiplayer In-Room Lobby Split Layout */
.room-lobby-card {
  width: 780px;
  max-width: 95vw;
}

.room-lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.room-code-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-small {
  padding: 4px 10px;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 700;
  height: 28px;
  cursor: pointer;
}

.highlight-code {
  color: #f59e0b;
  font-family: monospace;
  font-size: 22px;
  letter-spacing: 2px;
}

.role-badge {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  background: #334155;
  color: #e2e8f0;
}

.room-lobby-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 10px;
}

.col-title {
  font-size: 13px;
  font-weight: 800;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.room-col-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-right: 1px solid #28313e;
  padding-right: 18px;
}

.room-col-roster {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.roster-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 140px;
}

.roster-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #14171d;
  border: 1px solid #2a3442;
  border-radius: 6px;
}

.roster-player-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.roster-car-badge {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  max-width: 34px;
  max-height: 34px;
  border-radius: 6px;
  border: 2px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  padding: 2px;
  box-sizing: border-box;
}

.roster-car-thumb {
  width: 100%;
  height: 100%;
  max-width: 28px;
  max-height: 28px;
  object-fit: contain;
  display: block;
}

.roster-name {
  font-weight: 700;
  font-size: 14px;
  color: #f1f5f9;
}

.roster-host-tag {
  font-size: 10px;
  font-weight: 800;
  color: #f59e0b;
  margin-left: 4px;
}

.roster-status-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
}

.roster-status-badge.ready {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
  border: 1px solid #22c55e;
}

.roster-status-badge.not-ready {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid #475569;
}

.warning-banner {
  background: rgba(220, 38, 38, 0.18);
  border: 1px solid #ef4444;
  color: #fca5a5;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 4px;
}

.room-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.status-note {
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
  min-height: 16px;
}

/* Pause Menu */
.pause-banner-player {
  background: #1e2633;
  border: 1px solid #475569;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  color: #f59e0b;
  text-align: center;
}

/* Restart Vote Dialog Modal */
#restart-vote-modal {
  z-index: 120;
}

.vote-card {
  width: 400px;
  text-align: center;
}

.vote-prompt {
  font-size: 14px;
  color: #e2e8f0;
  font-weight: 600;
}

.vote-timer-bar {
  width: 100%;
  height: 6px;
  background: #1e293b;
  border-radius: 3px;
  overflow: hidden;
  margin: 10px 0 4px 0;
}

.vote-timer-fill {
  width: 100%;
  height: 100%;
  background: #f59e0b;
  transition: width 1s linear;
}

.vote-timer-label {
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.vote-status-msg {
  font-size: 12px;
  font-weight: 700;
  color: #ef4444;
  min-height: 16px;
}