@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@600;700;800;900&family=Rajdhani:wght@600;700;800&family=Be+Vietnam+Pro:wght@400;600;700;800&display=swap');

:root {
  --neon-cyan: #00f3ff;
  --neon-yellow: #ffea00;
  --neon-red: #ff0055;
  --neon-orange: #ff6600;
  --neon-green: #10b981;
  --hanoi-gold: #fbbf24;
  --dark-bg: rgba(10, 14, 26, 0.92);
  --border-glow: rgba(0, 243, 255, 0.45);
  --border-gold: rgba(251, 191, 36, 0.4);
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #030611;
  font-family: 'Rajdhani', sans-serif;
  color: #fff;
}

#game-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  outline: none;
}

/* FLOATING EXIT PHOTO / ZEN MODE BUTTON */
.exit-photo-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 999;
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--dark-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  padding: 10px 20px;
  border-radius: 30px;
  cursor: pointer;
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7), 0 0 16px rgba(0, 243, 255, 0.35);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.exit-photo-btn:hover {
  background: var(--neon-cyan);
  color: #030611;
  transform: scale(1.05);
}

body.photo-mode .exit-photo-btn {
  display: flex;
}

/* HUD Overlay */
.hud-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 22px;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

body.photo-mode .hud-overlay {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.98);
}

/* Top Bar Cards */
.hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hud-card {
  background: var(--dark-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-glow);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.65), inset 0 0 15px rgba(0, 243, 255, 0.08);
  border-radius: 10px;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-card {
  border-left: 4px solid var(--neon-cyan);
}

.brand-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 13.5px;
  font-weight: 900;
  letter-spacing: 1.2px;
  color: #fff;
  text-shadow: 0 0 10px var(--neon-cyan);
}

.brand-sub {
  font-size: 11px;
  color: #94a3b8;
  letter-spacing: 0.5px;
}

.brand-author-tag {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 10px;
  color: var(--hanoi-gold);
  margin-top: 2px;
}

.brand-author-tag b {
  color: #fff;
}

.rank-card {
  align-items: center;
  min-width: 80px;
  border-left: 4px solid var(--neon-yellow);
}

.rank-label {
  font-size: 9px;
  color: #94a3b8;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.rank-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 24px;
  font-weight: 900;
  color: var(--neon-yellow);
  text-shadow: 0 0 12px rgba(255, 234, 0, 0.6);
  line-height: 1;
}

.rank-sup {
  font-size: 13px;
  color: #64748b;
}

.gold-card {
  align-items: center;
  min-width: 95px;
  border-left: 4px solid var(--neon-yellow);
}

.gold-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: #ffdf40;
  text-shadow: 0 0 10px rgba(255, 223, 64, 0.6);
}

.knockouts-card {
  min-width: 85px;
  align-items: center;
  border-left: 4px solid var(--neon-red);
}

.knockout-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 17px;
  font-weight: 800;
  color: var(--neon-red);
  text-shadow: 0 0 10px rgba(255, 0, 85, 0.5);
}

.top-buttons {
  flex-direction: row;
  gap: 7px;
  pointer-events: auto;
}

.action-btn {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  border: 1px solid var(--neon-cyan);
  color: #fff;
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.3);
}

.action-btn:hover {
  background: var(--neon-cyan);
  color: #030611;
  transform: translateY(-2px);
  box-shadow: 0 0 18px rgba(0, 243, 255, 0.6);
}

.photo-btn {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  border-color: #a78bfa;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
}

.photo-btn:hover {
  background: #a78bfa;
  color: #030611;
  box-shadow: 0 0 18px rgba(167, 139, 250, 0.6);
}

.help-btn {
  background: linear-gradient(135deg, #334155, #1e293b);
  border-color: #64748b;
  box-shadow: none;
}

.help-btn:hover {
  background: #64748b;
  color: #fff;
}

.icon-btn {
  background: var(--dark-bg);
  border: 1px solid #475569;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  border-color: var(--neon-cyan);
  transform: scale(1.08);
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.4);
}

/* LIVE RACE PROGRESS TRACKER */
.race-tracker-wrap {
  width: 100%;
  max-width: 820px;
  margin: 10px auto 0 auto;
  pointer-events: auto;
  background: var(--dark-bg);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 243, 255, 0.3);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
  border-radius: 10px;
  padding: 8px 14px;
}

.tracker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.track-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  font-weight: 800;
  color: var(--neon-cyan);
  letter-spacing: 0.8px;
}

.track-dist {
  font-family: 'Rajdhani', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
}

.tracker-bar {
  position: relative;
  height: 12px;
  background: #1e293b;
  border-radius: 6px;
  overflow: visible;
  border: 1px solid #334155;
}

.tracker-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #00f3ff);
  border-radius: 6px;
  transition: width 0.1s linear;
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
}

.racer-pin {
  position: absolute;
  top: -9px;
  font-size: 15px;
  transform: translateX(-50%);
  transition: left 0.1s linear;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8));
  cursor: default;
}

.pin-player {
  font-size: 18px;
  top: -12px;
  z-index: 5;
  filter: drop-shadow(0 0 6px #00f3ff);
}

.finish-flag-pin {
  position: absolute;
  right: 0;
  top: -7px;
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  font-weight: 800;
  color: var(--neon-yellow);
  background: rgba(15, 23, 42, 0.85);
  padding: 1px 4px;
  border-radius: 4px;
}

/* Center Banner */
.center-banner {
  align-self: center;
  text-align: center;
  background: rgba(3, 6, 17, 0.9);
  backdrop-filter: blur(16px);
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 35px rgba(0, 243, 255, 0.45);
  border-radius: 12px;
  padding: 14px 28px;
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.center-banner.show {
  opacity: 1;
  transform: scale(1);
}

.banner-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 22px;
  font-weight: 900;
  color: var(--neon-yellow);
  letter-spacing: 1px;
  text-shadow: 0 0 14px rgba(255, 234, 0, 0.7);
}

.banner-sub {
  font-size: 13px;
  color: #e2e8f0;
  font-weight: 700;
  margin-top: 3px;
}

/* Bottom HUD */
.hud-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  width: 100%;
}

.hud-bottom-left {
  pointer-events: auto;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.hud-bottom-left.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
}

.combat-hint-box {
  background: var(--dark-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-glow);
  border-left: 4px solid var(--neon-cyan);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
  max-width: 360px;
}

.hint-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.hint-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  font-weight: 800;
  color: var(--neon-cyan);
  letter-spacing: 0.8px;
}

.hint-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.hint-close-btn:hover {
  color: #fff;
}

.hint-content {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  color: #cbd5e1;
}

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

.key-tag {
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 4px;
  padding: 1px 6px;
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  font-weight: 800;
  color: var(--neon-yellow);
}

.key-mouse {
  background: #0284c7;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
}

.hint-footer {
  font-size: 10px;
  color: #64748b;
  margin-top: 8px;
  border-top: 1px solid #334155;
  padding-top: 6px;
}

/* Speedometer Cluster */
.hud-bottom-right {
  pointer-events: auto;
}

.speedo-cluster {
  background: var(--dark-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-glow);
  border-radius: 14px;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7), inset 0 0 20px rgba(0, 243, 255, 0.1);
}

.speedo-dial {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.speed-number {
  font-family: 'Orbitron', sans-serif;
  font-size: 48px;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
}

.speed-unit {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: var(--neon-cyan);
}

.nitro-bar-wrap {
  width: 100%;
  min-width: 180px;
  margin-top: 10px;
}

.nitro-label {
  font-size: 9px;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}

.nitro-track {
  height: 8px;
  background: #1e293b;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #334155;
}

.nitro-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff0055, #ff6600, #ffea00);
  border-radius: 4px;
  transition: width 0.1s linear;
  box-shadow: 0 0 10px rgba(255, 102, 0, 0.6);
}

/* Mobile Touch Controls */
.touch-controls {
  position: absolute;
  bottom: 16px;
  left: 0;
  width: 100%;
  padding: 0 18px;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  z-index: 15;
  pointer-events: none;
}

@media (pointer: coarse), (max-width: 900px) {
  .touch-controls {
    display: flex;
  }
}

.touch-left, .touch-right-actions {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.touch-btn {
  background: var(--dark-bg);
  backdrop-filter: blur(10px);
  border: 2px solid var(--border-glow);
  color: #fff;
  font-family: 'Orbitron', sans-serif;
  font-weight: 800;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  touch-action: manipulation;
}

.touch-steer {
  width: 68px;
  height: 56px;
  font-size: 13px;
}

.touch-right-actions {
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.touch-kick-row, .touch-drive-row {
  display: flex;
  gap: 8px;
}

.touch-kick {
  padding: 8px 14px;
  font-size: 12px;
  background: rgba(239, 68, 68, 0.6);
  border-color: #ef4444;
}

.touch-nitro {
  width: 60px;
  height: 52px;
  background: rgba(245, 158, 11, 0.65);
  border-color: #f59e0b;
}

.touch-brake {
  width: 60px;
  height: 52px;
  background: rgba(220, 38, 38, 0.65);
  border-color: #dc2626;
}

.touch-gas {
  width: 68px;
  height: 52px;
  background: rgba(16, 185, 129, 0.75);
  border-color: #10b981;
}

/* Modals Backdrop */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(3, 6, 17, 0.9);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Garage Card */
.garage-card {
  background: #0f172a;
  border: 2px solid var(--neon-yellow);
  box-shadow: 0 0 40px rgba(255, 234, 0, 0.35), inset 0 0 25px rgba(255, 234, 0, 0.08);
  border-radius: 14px;
  width: 680px;
  max-width: 95%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.garage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #334155;
  padding-bottom: 12px;
}

.garage-header h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 19px;
  color: var(--neon-yellow);
  letter-spacing: 1px;
}

.modal-close-btn {
  background: #dc2626;
  border: none;
  color: #fff;
  font-size: 20px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
}

.garage-gold-bar {
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.garage-gold-bar b {
  font-family: 'Orbitron', sans-serif;
  color: #ffdf40;
  font-size: 17px;
}

/* Bike Shelf */
.bike-shelf {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.bike-card {
  background: #1e293b;
  border: 2px solid #334155;
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.bike-card:hover {
  transform: translateY(-3px);
  border-color: var(--neon-cyan);
}

.bike-card.active {
  border-color: var(--neon-cyan);
  background: #0e2d4d;
  box-shadow: 0 0 18px rgba(0, 243, 255, 0.45);
}

.bike-card-icon {
  font-size: 32px;
  margin-bottom: 4px;
}

.bike-card-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}

.bike-card-price {
  font-size: 11px;
  color: #facc15;
  font-weight: 700;
}

.bike-card-status {
  font-size: 9px;
  padding: 3px 6px;
  border-radius: 4px;
  margin-top: 6px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.status-using {
  background: #10b981;
  color: #000;
}

.status-owned {
  background: #3b82f6;
  color: #fff;
}

.status-locked {
  background: #475569;
  color: #cbd5e1;
}

/* Upgrade Stats Grid */
.upgrade-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #111e38;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 14px;
}

.upgrade-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #1e293b;
  padding-bottom: 10px;
}

.upgrade-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.up-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.up-title {
  font-size: 11px;
  font-weight: 800;
  color: #cbd5e1;
}

.stat-pips {
  display: flex;
  gap: 5px;
}

.pip {
  width: 14px;
  height: 8px;
  background: #334155;
  border-radius: 2px;
}

.pip.filled {
  background: var(--neon-cyan);
  box-shadow: 0 0 6px var(--neon-cyan);
}

.btn-up-stat {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  color: #000;
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  font-weight: 800;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-up-stat:hover {
  filter: brightness(1.2);
  transform: scale(1.04);
}

.btn-up-stat.maxed {
  background: #475569;
  color: #94a3b8;
  cursor: not-allowed;
}

.garage-footer {
  display: flex;
  justify-content: center;
  margin-top: 6px;
}

.btn-resume-race {
  background: linear-gradient(135deg, #10b981, #059669);
  border: none;
  color: #fff;
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  font-weight: 900;
  padding: 12px 30px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

/* End Race Modal */
.end-race-card {
  background: #0f172a;
  border: 2px solid var(--neon-yellow);
  box-shadow: 0 0 45px rgba(255, 234, 0, 0.4);
  border-radius: 16px;
  padding: 28px;
  text-align: center;
  max-width: 440px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.end-icon {
  font-size: 48px;
}

#end-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 22px;
  color: var(--neon-yellow);
}

#end-desc {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
}

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

.stat-box {
  background: #1e293b;
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
}

.stat-lbl {
  font-size: 10px;
  color: #94a3b8;
  text-transform: uppercase;
}

.stat-val {
  font-family: 'Orbitron', sans-serif;
  font-size: 18px;
  color: #fff;
  margin-top: 4px;
}

.gold-col {
  color: #ffdf40;
}

.end-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-primary, .btn-secondary {
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  font-weight: 800;
  padding: 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #00f3ff);
  color: #030611;
}

.btn-secondary {
  background: #334155;
  color: #fff;
}

@media (max-width: 900px) {
  .hud-top {
    flex-wrap: wrap;
    gap: 8px;
  }
  .hud-card {
    padding: 6px 10px;
  }
  .bike-shelf {
    grid-template-columns: repeat(2, 1fr);
  }
}
