:root {
  --ug-black: #0a0d14;
  --ug-surface: rgba(14, 19, 30, 0.88);
  --ug-surface-solid: #111726;
  --ug-yellow: #fcdc04;
  --ug-red: #d90000;
  --ug-gold-glow: rgba(252, 220, 4, 0.25);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-subtle: rgba(255, 255, 255, 0.11);
  --font-display: 'Orbitron', sans-serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--ug-black);
  color: var(--text-main);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

.icon-xs { width: 14px; height: 14px; stroke-width: 2.3; flex-shrink: 0; }
.icon-sm { width: 17px; height: 17px; stroke-width: 2.2; flex-shrink: 0; }
.icon-md { width: 24px; height: 24px; stroke-width: 2.5; flex-shrink: 0; }
.text-yellow { color: var(--ug-yellow); }
.text-cyan { color: #00f5d4; }
.text-red { color: #ff3b5c; }
.text-orange { color: #ff8c00; }
.text-green { color: #22c55e; }
.hidden { display: none !important; }

/* 3D Showroom Canvas */
#showroom-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  display: block;
}

/* 3D Real Uganda GPS Road + Chase Car Viewport */
.race-viewport {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 2;
  background: linear-gradient(180deg, #071226 0%, #172b4d 44%, #0b101d 100%);
}

.uganda-map-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.race-car-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

/* 3D Ugandan Landmark Map Pins */
.ug-landmark-pin {
  pointer-events: none;
}

.ug-landmark-badge {
  background: rgba(10, 13, 20, 0.92);
  border: 1.5px solid var(--ug-yellow);
  border-radius: 10px;
  padding: 5px 10px;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 2px;
  white-space: nowrap;
}

.ug-landmark-tag {
  font-family: var(--font-display);
  font-size: 9px;
  color: var(--ug-yellow);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ug-landmark-badge strong {
  font-size: 11px;
  font-weight: 800;
}

/* Uganda Flag Top Ribbon */
.ug-flag-ribbon {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  z-index: 30;
}
.stripe-black { background: #000000; }
.stripe-yellow { background: #fcdc04; }
.stripe-red { background: #d90000; }

/* Header Topbar */
.topbar {
  position: fixed;
  top: 4px;
  left: 0;
  right: 0;
  height: 62px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 25;
  background: linear-gradient(180deg, rgba(10, 13, 20, 0.96) 0%, rgba(10, 13, 20, 0.65) 100%);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-emblem {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: rgba(252, 220, 4, 0.12);
  border: 1px solid rgba(252, 220, 4, 0.35);
  display: grid;
  place-items: center;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.06em;
}
.brand-title span { color: var(--ug-yellow); }

.brand-sub {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.11em;
  color: var(--text-muted);
}

/* Stage Navigation Menu */
.stage-nav-menu {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-subtle);
  padding: 4px;
  border-radius: 12px;
}

.stage-nav-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.18s ease;
}

.stage-nav-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.stage-nav-btn.active {
  background: var(--ug-yellow);
  color: #0a0d14;
  box-shadow: 0 3px 12px rgba(252, 220, 4, 0.3);
}

.nav-quest-badge {
  background: #d90000;
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 999px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.step-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

/* Logged-in Racer HUD Pill */
.racer-hud-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-subtle);
}

.hud-avatar-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1.5px solid var(--ug-yellow);
  background: rgba(252, 220, 4, 0.12);
  padding: 2px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.hud-avatar-svg {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: 12px;
}

.hud-plate {
  background: var(--ug-yellow);
  color: #0a0d14;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 900;
  padding: 3px 7px;
  border-radius: 5px;
}

.hud-wallet,
.hud-rp {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.hud-wallet strong {
  color: var(--ug-yellow);
  font-family: var(--font-display);
}

.hud-rp strong {
  color: #00f5d4;
  font-family: var(--font-display);
}

.btn-icon-only {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.btn-icon-only:hover {
  color: #fff;
  border-color: var(--ug-red);
}

/* Main Viewport Layout */
.viewport {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100vh;
  padding: 74px 22px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

/* ==================== AVATAR PICKER GRID ==================== */
.avatar-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.avatar-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.78);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.16s ease;
}

.avatar-option:hover {
  border-color: rgba(252, 220, 4, 0.5);
  color: #fff;
}

.avatar-option.active {
  border-color: var(--ug-yellow);
  background: rgba(252, 220, 4, 0.14);
  color: var(--ug-yellow);
  box-shadow: 0 0 12px rgba(252, 220, 4, 0.22);
}

.avatar-option-svg {
  width: 32px;
  height: 32px;
}

.avatar-option span {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-align: center;
}

.avatar-modal-card {
  width: min(460px, 94vw);
}

.modal-grid {
  margin-bottom: 16px;
}

/* ==================== STEP 1: AUTH CARD ==================== */
.auth-card {
  pointer-events: auto;
  width: min(450px, 100%);
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  background: var(--ug-surface);
  backdrop-filter: blur(22px);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}

.card-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(252, 220, 4, 0.12);
  border: 1px solid rgba(252, 220, 4, 0.3);
  color: var(--ug-yellow);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  margin-bottom: 4px;
}

.card-desc {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(8, 11, 18, 0.85);
  padding: 4px;
  border-radius: 11px;
  border: 1px solid var(--border-subtle);
  margin-bottom: 12px;
}

.auth-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.auth-tab.active {
  background: var(--ug-yellow);
  color: #0a0d14;
}

.auth-alert {
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
  background: rgba(217, 0, 0, 0.16);
  border: 1px solid rgba(217, 0, 0, 0.45);
  color: #fca5a5;
}

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

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  width: 100%;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  width: 100%;
}

.field-group label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field-input,
.field-select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 38px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: rgba(9, 13, 22, 0.9);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  outline: none;
}

.field-input:focus,
.field-select:focus {
  border-color: var(--ug-yellow);
}

.plate-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(252, 220, 4, 0.06);
  border: 1px dashed rgba(252, 220, 4, 0.35);
}

.plate-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.ug-plate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--ug-yellow);
  color: #0a0d14;
  border: 2px solid #0a0d14;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 12px;
}

.ug-plate-flag {
  font-size: 9px;
  background: #0a0d14;
  color: var(--ug-yellow);
  padding: 1px 4px;
  border-radius: 3px;
}

.btn-primary {
  height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: 11px;
  background: linear-gradient(135deg, #fcdc04 0%, #f59e0b 60%, #d90000 100%);
  color: #0a0d14;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.05em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 10px 24px rgba(252, 220, 4, 0.25);
  transition: transform 0.15s ease;
}

.btn-primary:hover { transform: translateY(-1px); }

.btn-secondary {
  height: 38px;
  padding: 0 13px;
  border-radius: 9px;
  border: 1px solid rgba(252, 220, 4, 0.4);
  background: rgba(252, 220, 4, 0.12);
  color: var(--ug-yellow);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}

.divider {
  display: flex;
  align-items: center;
  margin: 10px 0;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}
.divider span { padding: 0 10px; }

.btn-guest {
  width: 100%;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

/* ==================== STEP 2 & 3: GARAGE & TUNING ==================== */
.garage-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 20px;
  pointer-events: none;
}

.garage-panel {
  pointer-events: auto;
  width: min(390px, 42vw);
  background: var(--ug-surface);
  backdrop-filter: blur(22px);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.65);
  overflow-y: auto;
}

.panel-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.panel-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--ug-yellow);
}

.panel-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 900;
  margin-top: 2px;
}

.fleet-count,
.car-status-badge {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(252, 220, 4, 0.14);
  border: 1px solid rgba(252, 220, 4, 0.35);
  color: var(--ug-yellow);
}

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

.fleet-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.16s ease;
}

.fleet-item:hover {
  border-color: rgba(252, 220, 4, 0.4);
}

.fleet-item.active {
  background: rgba(252, 220, 4, 0.13);
  border-color: var(--ug-yellow);
}

.fleet-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fleet-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
  color: var(--ug-yellow);
}

.fleet-car-title {
  font-size: 12px;
  font-weight: 800;
}

.fleet-car-sub {
  font-size: 10px;
  color: var(--text-muted);
}

.fleet-tag-owned {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
}

.fleet-tag-price {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(252, 220, 4, 0.14);
  color: var(--ug-yellow);
}

/* Custom Paint & Plate Box */
.customizer-box {
  margin-top: auto;
  padding: 11px;
  border-radius: 13px;
  background: rgba(9, 13, 22, 0.82);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.customizer-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.paint-swatches {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.swatch {
  height: 24px;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
}
.swatch.active {
  border-color: #fff;
  transform: scale(1.08);
}

.plate-editor-row {
  display: flex;
  gap: 8px;
}

.plate-input {
  height: 36px;
  font-family: var(--font-display);
  text-transform: uppercase;
}

/* Telemetry Bars */
.telemetry-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(9, 13, 22, 0.78);
  border: 1px solid var(--border-subtle);
}

.stat-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.stat-label span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.stat-label strong {
  color: var(--text-main);
  font-family: var(--font-display);
}

.stat-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #fcdc04, #ff6b00, #d90000);
  transition: width 0.25s ease;
}

.upgrade-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.upgrade-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upgrade-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-subtle);
}

.upg-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.upg-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(252, 220, 4, 0.12);
  color: var(--ug-yellow);
  display: grid;
  place-items: center;
}

.upg-name {
  font-size: 11px;
  font-weight: 700;
}

.upg-lvl {
  font-family: var(--font-display);
  font-size: 9px;
  color: var(--ug-yellow);
}

.upg-btn-pair {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.btn-upgrade {
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid rgba(252, 220, 4, 0.4);
  background: rgba(252, 220, 4, 0.14);
  color: var(--ug-yellow);
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}

.btn-upgrade-rp {
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid rgba(0, 245, 212, 0.45);
  background: rgba(0, 245, 212, 0.14);
  color: #00f5d4;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}

.btn-upgrade:hover:not(:disabled) {
  background: var(--ug-yellow);
  color: #0a0d14;
}

.btn-upgrade-rp:hover:not(:disabled) {
  background: #00f5d4;
  color: #0a0d14;
}

.btn-upgrade:disabled,
.btn-upgrade-rp:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.garage-toast {
  padding: 7px 11px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
}

.garage-cta-stack {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: auto;
}

.quick-nav-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.btn-race-launch {
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(252, 220, 4, 0.55);
  background: rgba(252, 220, 4, 0.14);
  color: var(--ug-yellow);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}

.btn-online-launch {
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(0, 245, 212, 0.55);
  background: rgba(0, 245, 212, 0.14);
  color: #00f5d4;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}

/* ==================== STEP 4 & 5: CIRCUITS, MODES, ONLINE 1V1 & QUESTS ==================== */
.circuits-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.circuits-panel {
  pointer-events: auto;
  width: min(1140px, 96vw);
  max-height: calc(100vh - 92px);
  overflow-y: auto;
  background: var(--ug-surface);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border-subtle);
  border-radius: 22px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 28px 65px rgba(0, 0, 0, 0.78);
}

.stage-back-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.btn-back-stage {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.btn-back-stage:hover {
  border-color: var(--ug-yellow);
  color: var(--ug-yellow);
}

.stage-step-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  color: var(--ug-yellow);
}

.circuits-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.circuits-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
}

.circuits-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Mode Selector Bar */
.mode-selector-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.weather-selector-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-radius: 12px;
  background: rgba(9, 13, 22, 0.85);
  border: 1px solid var(--border-subtle);
}

.weather-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  color: var(--text-main);
}

.weather-btn-group,
.hud-weather-audio-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.weather-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.weather-chip:hover {
  color: #fff;
  border-color: rgba(252, 220, 4, 0.45);
}

.weather-chip.active {
  background: rgba(252, 220, 4, 0.16);
  border-color: var(--ug-yellow);
  color: var(--ug-yellow);
}

.mode-card {
  text-align: left;
  padding: 11px 13px;
  border-radius: 13px;
  background: rgba(15, 23, 42, 0.82);
  border: 1.5px solid var(--border-subtle);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.mode-card:hover {
  border-color: rgba(252, 220, 4, 0.45);
}

.mode-card.active {
  background: rgba(252, 220, 4, 0.14);
  border-color: var(--ug-yellow);
  box-shadow: 0 8px 22px rgba(252, 220, 4, 0.16);
}

.mode-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mode-badge {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ug-yellow);
}

.mode-card strong {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 900;
}

.mode-card span {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

.circuits-layout {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 16px;
}

.circuits-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}

.circuit-card {
  padding: 13px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.8);
  border: 1.5px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 7px;
  cursor: pointer;
}

.circuit-card.active {
  background: rgba(252, 220, 4, 0.12);
  border-color: var(--ug-yellow);
}

.circuit-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.circuit-diff {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(252, 220, 4, 0.16);
  color: var(--ug-yellow);
}

.circuit-dist {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
}

.circuit-name {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 900;
}

.circuit-region {
  font-size: 11px;
  color: var(--text-muted);
}

.circuit-landmarks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.landmark-chip {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
}

.circuit-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 10px;
  font-weight: 700;
}

.circuit-prize {
  color: var(--ug-yellow);
  font-family: var(--font-display);
}

/* Leaderboard Box */
.leaderboard-box {
  padding: 14px;
  border-radius: 15px;
  background: rgba(9, 13, 22, 0.85);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.leaderboard-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 900;
}

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

.lb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 9px;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 11px;
}

.lb-rank {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(252, 220, 4, 0.16);
  color: var(--ug-yellow);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 900;
  display: grid;
  place-items: center;
}

.lb-racer {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lb-time {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  color: var(--ug-yellow);
}

/* ==================== ONLINE 2-PLAYER FRIEND INVITE LOBBY ==================== */
.mp-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 16px;
}

.mp-box {
  padding: 16px;
  border-radius: 16px;
  background: rgba(9, 13, 22, 0.86);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mp-box-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.mp-box-header h3 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 900;
}

.mp-box-header p {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

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

.active-room-lobby {
  margin-top: 6px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(252, 220, 4, 0.08);
  border: 1.5px solid var(--ug-yellow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lobby-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lobby-code-label {
  display: block;
  font-size: 9px;
  font-weight: 800;
  color: var(--text-muted);
}

.lobby-room-code {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 900;
  color: var(--ug-yellow);
}

.lobby-status-badge {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 245, 212, 0.16);
  color: #00f5d4;
}

.lobby-vs-cards {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.lobby-racer-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px;
  border-radius: 10px;
  background: rgba(10, 13, 20, 0.85);
  border: 1px solid var(--border-subtle);
}

.lobby-slot-avatar {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.slot-role {
  display: block;
  font-size: 8px;
  font-weight: 800;
  color: var(--ug-yellow);
}

.lobby-racer-slot strong {
  display: block;
  font-size: 12px;
  font-weight: 800;
}

.lobby-racer-slot small {
  font-size: 10px;
  color: var(--text-muted);
}

.lobby-vs-pill {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 900;
  color: var(--ug-yellow);
}

.mp-search-bar {
  display: flex;
  gap: 8px;
}

.mp-join-password-box {
  padding: 12px;
  border-radius: 12px;
  background: rgba(252, 220, 4, 0.1);
  border: 1.5px solid var(--ug-yellow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mp-join-prompt {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.mp-join-row {
  display: flex;
  gap: 8px;
}

.btn-join-confirm {
  height: 38px;
  white-space: nowrap;
}

.mp-rooms-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 290px;
  overflow-y: auto;
}

.mp-room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
}

.mp-room-meta strong {
  display: block;
  font-size: 13px;
  font-weight: 800;
}

.mp-room-meta small {
  font-size: 11px;
  color: var(--text-muted);
}

/* ==================== STEP 5B: QUESTS & RP REWARDS ==================== */
.quest-balance-summary {
  display: flex;
  align-items: center;
  gap: 10px;
}

.q-bal-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 11px;
  background: rgba(252, 220, 4, 0.12);
  border: 1px solid rgba(252, 220, 4, 0.35);
  font-family: var(--font-display);
  font-size: 12px;
}

.q-bal-rp {
  background: rgba(0, 245, 212, 0.12);
  border-color: rgba(0, 245, 212, 0.35);
}

.quests-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.quest-card {
  padding: 15px;
  border-radius: 15px;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quest-card.ready-to-claim {
  border-color: var(--ug-yellow);
  background: rgba(252, 220, 4, 0.1);
}

.quest-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quest-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(252, 220, 4, 0.14);
  color: var(--ug-yellow);
  display: grid;
  place-items: center;
}

.quest-reward-pills {
  display: flex;
  gap: 5px;
}

.q-pill-ugx {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 900;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(252, 220, 4, 0.16);
  color: var(--ug-yellow);
}

.q-pill-rp {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 900;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(0, 245, 212, 0.16);
  color: #00f5d4;
}

.quest-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 900;
}

.quest-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.quest-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
}

.quest-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
}

/* ==================== LIVE 3D RACE HUD + BLUR POWER-UPS ==================== */
.race-hud-stage {
  position: fixed;
  inset: 0;
  padding: 72px 24px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 20;
  pointer-events: none;
}

.race-hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  pointer-events: auto;
}

.race-landmark-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 15px;
  border-radius: 13px;
  background: rgba(10, 13, 20, 0.88);
  border: 1.5px solid var(--ug-yellow);
}

.landmark-sub {
  display: block;
  font-family: var(--font-display);
  font-size: 9px;
  color: var(--ug-yellow);
}

.race-position-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pos-pill {
  padding: 7px 12px;
  border-radius: 11px;
  background: rgba(10, 13, 20, 0.88);
  border: 1px solid var(--border-subtle);
  text-align: center;
}

.pos-pill span {
  display: block;
  font-size: 9px;
  font-weight: 800;
  color: var(--text-muted);
}

.pos-pill strong {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 900;
  color: var(--ug-yellow);
}

.powerup-combat-banner {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(10, 13, 20, 0.94);
  border: 1.5px solid var(--ug-yellow);
  color: var(--ug-yellow);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.75);
}

/* BLUR-STYLE POWER-UP COMBAT BAR */
.blur-powerup-bar {
  pointer-events: auto;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  margin-bottom: 8px;
}

.powerup-slot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 11px;
  background: rgba(10, 13, 20, 0.86);
  border: 1.5px solid rgba(252, 220, 4, 0.45);
  color: #fff;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.powerup-slot:hover {
  transform: translateY(-2px);
  border-color: var(--ug-yellow);
}

.pwr-key {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: var(--ug-yellow);
  color: #0a0d14;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 900;
  display: grid;
  place-items: center;
}

.pwr-meta {
  text-align: left;
}

.pwr-meta strong {
  display: block;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 900;
}

.pwr-meta small {
  font-size: 9px;
  color: #34d399;
  font-weight: 800;
}

.race-hud-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  pointer-events: auto;
}

.speedometer-cluster {
  width: min(410px, 54vw);
  padding: 8px 14px;
  border-radius: 14px;
  background: rgba(10, 13, 20, 0.84);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.speed-readout {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 5px;
}

.speed-readout span {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 900;
  color: var(--ug-yellow);
}

.nitro-meter-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nitro-meter-label {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  font-weight: 800;
  color: var(--text-muted);
}

.nitro-meter-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.nitro-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, #00f5d4, #fcdc04, #d90000);
}

.armor-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, #00f5d4, #22c55e);
}

.controls-hint {
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
}

.touch-pad-left,
.touch-pad-right {
  display: flex;
  gap: 8px;
}

.touch-btn {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  background: rgba(10, 13, 20, 0.88);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 900;
  cursor: pointer;
}

.touch-gas {
  border-color: var(--ug-yellow);
  color: var(--ug-yellow);
}

.touch-nitro {
  border-color: #00f5d4;
  color: #00f5d4;
}

/* Finish Modal */
.race-finish-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 15, 0.82);
  backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  z-index: 40;
  pointer-events: auto;
}

.finish-card {
  width: min(460px, 92vw);
  padding: 24px;
  border-radius: 22px;
  background: var(--ug-surface-solid);
  border: 2px solid var(--ug-yellow);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.finish-badge {
  align-self: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(252, 220, 4, 0.16);
  color: var(--ug-yellow);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 900;
}

.finish-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 900;
}

.finish-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.finish-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.finish-stat {
  padding: 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
}

.finish-stat span {
  display: block;
  font-size: 9px;
  font-weight: 800;
  color: var(--text-muted);
}

.finish-stat strong {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 900;
}

.finish-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

/* Showroom Bottom Dock */
.showroom-dock {
  pointer-events: auto;
  align-self: flex-end;
  width: min(470px, 100%);
  background: var(--ug-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 14px 16px;
}

.dock-category {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--ug-yellow);
}

.dock-car-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
}

.dock-switcher {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}

.car-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 9px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.car-chip.active {
  background: rgba(252, 220, 4, 0.16);
  border-color: var(--ug-yellow);
  color: var(--ug-yellow);
}

@media (max-width: 980px) {
  html, body { overflow-y: auto; }
  .viewport {
    height: auto;
    min-height: 100vh;
    flex-direction: column;
    gap: 16px;
  }
  .garage-stage,
  .circuits-layout,
  .mp-grid,
  .quests-grid,
  .mode-selector-bar {
    grid-template-columns: 1fr;
    flex-direction: column;
  }
  .garage-panel { width: 100%; }
}
