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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #0a0e14;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  user-select: none;
}

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity .8s ease; }
#hud.visible { opacity: 1; }

#speedo {
  position: absolute; right: 28px; bottom: 24px;
  width: 150px; height: 110px;
  background: linear-gradient(160deg, rgba(10,16,26,.72), rgba(10,16,26,.5));
  border: 1px solid rgba(160,220,255,.25);
  border-radius: 14px;
  backdrop-filter: blur(6px);
  text-align: center;
  color: #eaf6ff;
  padding-top: 10px;
  display: none;
}
#speedo.active { display: block; }
#speed-value { font-size: 44px; font-weight: 700; line-height: 1; letter-spacing: 1px;
  text-shadow: 0 0 14px rgba(120,200,255,.6); font-variant-numeric: tabular-nums; }
#speed-unit { font-size: 11px; letter-spacing: 3px; opacity: .7; margin-top: 2px; }
#gear-value { position: absolute; top: 8px; left: 12px; font-size: 15px; font-weight: 700;
  color: #ffd97a; text-shadow: 0 0 8px rgba(255,200,80,.5); }

#location-banner {
  position: absolute; left: 26px; bottom: 214px;
  color: #fff; font-size: 26px; font-weight: 300; letter-spacing: 1px;
  font-style: italic;
  text-shadow: 0 2px 12px rgba(0,0,0,.8);
  opacity: 0; transform: translateY(8px);
  transition: opacity .6s ease, transform .6s ease;
}
#location-banner.show { opacity: 1; transform: translateY(0); }

#clock {
  position: absolute; top: 20px; right: 28px;
  color: #eaf6ff; font-size: 18px; letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 8px rgba(0,0,0,.7);
}

#wanted { position: absolute; top: 48px; right: 28px; display: flex; gap: 4px; flex-direction: row-reverse; }
#wanted .star { width: 18px; height: 18px; opacity: .18; transition: opacity .3s;
  background: #ffd97a;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
#wanted .star.lit { opacity: 1; filter: drop-shadow(0 0 6px rgba(255,200,80,.9)); animation: starPulse 1s infinite alternate; }
@keyframes starPulse { from { transform: scale(1); } to { transform: scale(1.15); } }

#prompt {
  position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%);
  color: #fff; font-size: 16px; letter-spacing: .5px;
  background: rgba(8,12,20,.65); border: 1px solid rgba(160,220,255,.3);
  padding: 8px 18px; border-radius: 20px;
  backdrop-filter: blur(4px);
  opacity: 0; transition: opacity .25s;
}
#prompt.show { opacity: 1; }
#prompt b { color: #8fd8ff; }

#toast {
  position: absolute; left: 50%; top: 64px; transform: translateX(-50%);
  color: #fff; font-size: 15px;
  background: rgba(8,12,20,.7); border-left: 3px solid #8fd8ff;
  padding: 10px 20px; border-radius: 4px;
  opacity: 0; transition: opacity .4s;
  max-width: 60ch; text-align: center;
}
#toast.show { opacity: 1; }

#minimap-wrap {
  position: absolute; left: 24px; bottom: 24px;
  width: 180px; height: 180px; border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(160,220,255,.35);
  box-shadow: 0 4px 24px rgba(0,0,0,.5);
  background: #16202e;
}
#minimap { width: 100%; height: 100%; }
#minimap-player {
  position: absolute; left: 50%; top: 50%;
  width: 0; height: 0; transform: translate(-50%, -50%);
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-bottom: 11px solid #ffd97a;
  filter: drop-shadow(0 0 4px rgba(255,220,120,.9));
}

/* ---------- Title screen ---------- */
#title-screen {
  position: fixed; inset: 0; z-index: 10;
  background:
    radial-gradient(1200px 600px at 50% 110%, rgba(80,160,220,.25), transparent 60%),
    linear-gradient(180deg, #0b1524 0%, #132639 55%, #1d3a50 100%);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 1.2s ease;
}
#title-screen.hidden { opacity: 0; pointer-events: none; }
#title-inner { text-align: center; color: #eaf6ff; }
#title-inner h1 {
  font-size: clamp(42px, 8vw, 92px); font-weight: 200; letter-spacing: .35em;
  margin-bottom: 4px;
  background: linear-gradient(180deg, #fff, #8fc8e8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.subtitle { letter-spacing: .5em; font-size: 13px; opacity: .6; margin-bottom: 44px; text-transform: uppercase; }
#controls-card {
  display: grid; grid-template-columns: repeat(4, auto); gap: 10px 28px;
  justify-content: center; margin-bottom: 44px;
}
.ctl { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.ctl b { font-size: 14px; color: #ffd97a; letter-spacing: 1px; }
.ctl span { font-size: 11px; opacity: .65; letter-spacing: .5px; }
#start-btn {
  pointer-events: auto; cursor: pointer;
  font: inherit; font-size: 16px; letter-spacing: .3em;
  color: #eaf6ff; background: transparent;
  border: 1px solid rgba(160,220,255,.5); border-radius: 30px;
  padding: 14px 46px;
  transition: background .3s, box-shadow .3s;
  animation: breathe 2.4s infinite ease-in-out;
}
#start-btn:hover { background: rgba(120,200,255,.12); box-shadow: 0 0 30px rgba(120,200,255,.25); }
@keyframes breathe { 0%,100% { opacity: .75; } 50% { opacity: 1; } }
.hint { margin-top: 22px; font-size: 11px; opacity: .4; letter-spacing: 1px; }

@media (max-width: 700px) {
  #controls-card { grid-template-columns: repeat(2, auto); }
  #minimap-wrap { width: 120px; height: 120px; }
}
