* {
  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: #0b0f19;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Malgun Gothic", sans-serif;
  color: #fff;
}

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

/* UI Overlay */
#ui-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;
}

/* Header */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 20px;
}

.logo-badge {
  background: rgba(10, 15, 30, 0.85);
  border: 1px solid rgba(0, 240, 255, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 220, 255, 0.2);
  border-radius: 12px;
  padding: 10px 18px;
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.logo-badge h1 {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #00f0ff, #ff0077, #ffe600);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-badge .sub {
  font-size: 11px;
  color: #8fa0c0;
  letter-spacing: 1px;
  margin-top: 2px;
}

.top-controls {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.btn-icon {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}

.btn-icon:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: #00f0ff;
  color: #00f0ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 240, 255, 0.3);
}

.btn-icon.active {
  background: rgba(0, 240, 255, 0.2);
  border-color: #00f0ff;
  color: #00f0ff;
}

/* Radar / MiniMap */
.minimap-container {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 2px solid rgba(0, 240, 255, 0.6);
  background: rgba(10, 18, 30, 0.85);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.25), inset 0 0 15px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  backdrop-filter: blur(6px);
  pointer-events: auto;
}

#minimap {
  width: 100%;
  height: 100%;
}

.minimap-label {
  position: absolute;
  bottom: 6px;
  width: 100%;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: #00f0ff;
  text-shadow: 0 0 5px rgba(0,0,0,0.9);
  pointer-events: none;
}

/* Bottom Center Dashboard */
.bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 20px;
}

.dashboard {
  background: rgba(10, 15, 30, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  border-radius: 16px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  backdrop-filter: blur(10px);
  pointer-events: auto;
}

.speedo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.speed-val {
  font-size: 42px;
  font-weight: 900;
  font-family: 'Arial Black', sans-serif;
  color: #ffffff;
  line-height: 1;
  text-shadow: 0 0 15px rgba(0, 240, 255, 0.6);
  min-width: 90px;
  text-align: center;
}

.speed-unit {
  font-size: 11px;
  font-weight: 700;
  color: #00f0ff;
  letter-spacing: 2px;
}

.gauge-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 120px;
}

.gauge-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.gauge-label {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  display: flex;
  justify-content: space-between;
}

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

.progress-bar-nitro {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #00f0ff, #3b82f6);
  border-radius: 3px;
  transition: width 0.1s linear;
}

.progress-bar-drift {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  border-radius: 3px;
  transition: width 0.1s linear;
}

/* Vehicle Selector & Info */
.car-info-badge {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.car-name {
  font-size: 13px;
  font-weight: 800;
  color: #f8fafc;
}

.car-desc {
  font-size: 10px;
  color: #94a3b8;
}

/* Notifications / Alert */
#radar-warning {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background: rgba(239, 68, 68, 0.95);
  color: white;
  padding: 10px 24px;
  border-radius: 30px;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.8);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 1px;
}

#radar-warning.show {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* Controls Hint */
.controls-hint {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 11px;
  color: #cbd5e1;
  line-height: 1.6;
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.key-tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  color: #00f0ff;
  border: 1px solid rgba(0, 240, 255, 0.3);
}

/* Mobile Virtual Joystick */
.mobile-controls {
  display: none;
  width: 100%;
  position: absolute;
  bottom: 90px;
  left: 0;
  padding: 0 20px;
  justify-content: space-between;
  pointer-events: none;
}

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

.touch-btn {
  pointer-events: auto;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  font-weight: bold;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  touch-action: none;
}

.touch-btn:active {
  background: rgba(0, 240, 255, 0.5);
  border-color: #00f0ff;
  transform: scale(0.95);
}

.touch-group {
  display: flex;
  gap: 12px;
}

/* Vehicle Selection Modal */
#car-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

#car-modal.open {
  display: flex;
}

.modal-card {
  background: #0f172a;
  border: 1px solid rgba(0, 240, 255, 0.3);
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.2);
  border-radius: 20px;
  padding: 24px;
  max-width: 600px;
  width: 90%;
}

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

.modal-title {
  font-size: 20px;
  font-weight: 800;
  color: #00f0ff;
}

.btn-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 24px;
  cursor: pointer;
}

.car-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.car-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.car-card:hover, .car-card.selected {
  border-color: #00f0ff;
  background: rgba(0, 240, 255, 0.15);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
  transform: translateY(-3px);
}

.car-card-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.car-card-name {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}

.car-card-stat {
  font-size: 10px;
  color: #94a3b8;
}

/* Flash effect */
#screen-flash {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition: opacity 0.05s linear;
}
