html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  background: #8fd3f4;
}

#game-container {
  position: fixed;
  inset: 0;
}

#game-container canvas {
  display: block;
}

#look-zone {
  position: fixed;
  inset: 0;
  z-index: 10;
  touch-action: none;
  cursor: crosshair;
}

.hidden {
  display: none !important;
}

/* ---------- Top bar ---------- */
#topbar {
  position: fixed;
  top: 12px;
  left: 12px;
  background: rgba(20, 20, 20, 0.65);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 20;
  display: flex;
  gap: 14px;
  align-items: center;
  pointer-events: none;
}

#mode-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---------- Interaction prompt ---------- */
#prompt {
  position: fixed;
  bottom: 210px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 20, 20, 0.75);
  color: #fff;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 15px;
  z-index: 20;
  white-space: nowrap;
  pointer-events: none;
}

/* ---------- Minimap ---------- */
#minimap-frame {
  position: fixed;
  left: 12px;
  top: 56px;
  width: 140px;
  height: 140px;
  z-index: 20;
  /* Interactive: tap/click inside it to set a destination marker there
     (see bindMinimapTarget in main.js) — so it needs pointer events,
     unlike the other pure-display HUD elements. */
  pointer-events: auto;
  cursor: crosshair;
  touch-action: none;
  border: 3px solid rgba(255, 255, 255, 0.55);
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

#destination-info {
  position: fixed;
  left: 12px;
  top: 202px;
  z-index: 20;
  background: rgba(20, 20, 20, 0.7);
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  pointer-events: none;
}

/* ---------- Cockpit frame (driving) ---------- */
/* Dropped: a full-screen vignette here was overwhelming on narrow/tall
   phone screens (its fixed px inset ate most of the viewport). The 3D
   dashboard/pillars/visor already sell "inside the car" on their own. */
#cockpit-frame {
  display: none;
}

/* ---------- Driving HUD ---------- */
#drive-hud {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 20;
  pointer-events: none;
}

#speedometer {
  background: rgba(20, 20, 20, 0.7);
  color: #fff;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  min-width: 70px;
  text-align: center;
}

#speed-value {
  font-size: 20px;
}

/* ---------- Touch controls ---------- */
#touch-controls {
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: none; /* let clicks/drags fall through to #look-zone except on the buttons below */
}

#dpad {
  position: fixed;
  left: 16px;
  bottom: 16px;
  width: 176px;
  height: 176px;
  display: grid;
  grid-template-columns: 56px 56px 56px;
  grid-template-rows: 56px 56px 56px;
  gap: 4px;
  pointer-events: auto;
}

.dpad-btn {
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.dpad-btn:active {
  background: rgba(255, 255, 255, 0.4);
}

.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 3; }

#btn-action {
  position: fixed;
  right: 20px;
  bottom: 30px;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: none;
  background: rgba(59, 130, 246, 0.85);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
}

#btn-action:active {
  background: rgba(37, 99, 235, 0.95);
}

#btn-action.disabled {
  opacity: 0.35;
}

/* ---------- Setup overlay ---------- */
#setup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 20, 0.92);
  color: #fff;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.setup-box {
  width: 90vw;
  max-width: 440px;
  box-sizing: border-box;
  padding: 24px 28px;
  background: #1c2430;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  max-height: 85vh;
  overflow-y: auto;
}

.setup-box h1 {
  margin: 0 0 10px;
  font-size: 26px;
}

.setup-box p {
  font-size: 14px;
  line-height: 1.4;
  color: #cfd6de;
}

#start-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: #3b82f6;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
}

#start-btn:hover {
  background: #2563eb;
}
