:root {
  --sky-top: #1b2a4a;
  --panel-bg: rgba(10, 14, 26, 0.92);
  --ink: #f2ede4;
  --accent: #ffb703;
  --danger: #e63946;
  --good: #6fbf73;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #05070d;
  color: var(--ink);
  font-family: "Segoe UI", Helvetica, Arial, sans-serif;
  overflow: hidden;
  touch-action: none;
}

#stage {
  position: relative;
  width: 100%;
  height: 100%;
}

#three-container {
  position: absolute;
  inset: 0;
  background: var(--sky-top);
}

#three-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#hud {
  position: absolute;
  inset: 0;
  padding: 12px 14px;
  pointer-events: none;
  font-size: 0.95rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

#hud.hidden { display: none; }

#elevText {
  font-weight: 700;
}

.bar-track {
  margin-top: 6px;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.bar-track.small { height: 6px; }

.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
}

.bar-fill.elev { background: var(--accent); }
.bar-fill.stamina { background: var(--good); }
.bar-fill.cold { background: #5fb0e8; }

#hearts {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 1.1rem;
  letter-spacing: 2px;
}

.heart { color: rgba(255, 255, 255, 0.25); }
.heart.full { color: var(--danger); }

.meter-row {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  font-size: 0.72rem;
  color: #cfd6e4;
}

.meter { flex: 1; }

#zoneBanner {
  position: absolute;
  top: 30%;
  left: 0;
  right: 0;
  text-align: center;
  font-style: italic;
  font-weight: 700;
  font-size: 1.2rem;
  opacity: 0;
  transition: opacity 0.4s ease;
}

#zoneBanner.show { opacity: 1; }

#toast {
  position: absolute;
  bottom: 6%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.4s ease;
}

#toast.show { opacity: 1; }

#radar {
  margin-top: 12px;
  display: flex;
  justify-content: center;
}

#radarTrack {
  position: relative;
  width: min(360px, 82vw);
  height: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
}

#radarCenter {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.55);
  transform: translateX(-50%);
}

.blip {
  position: absolute;
  top: 50%;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.blip.rock { background: #8a8578; border-radius: 3px; }
.blip.bo { background: #c98f5e; }
.blip.ice { background: #cfe8ff; }

#hitFlash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(230, 57, 70, 0.9) 100%);
  opacity: 0;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  background: var(--panel-bg);
  padding: 24px;
}

.screen.hidden { display: none; }

.screen h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.5px;
}

.tagline {
  margin: 0;
  color: var(--accent);
  font-style: italic;
}

.screen p {
  max-width: 380px;
  line-height: 1.5;
  margin: 0;
}

.controls {
  margin: 8px 0;
  font-size: 0.9rem;
  color: #cfd6e4;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.key {
  display: inline-block;
  min-width: 1.6em;
  padding: 2px 7px;
  margin: 0 2px;
  border-radius: 5px;
  background: #2b3550;
  border: 1px solid #4a5578;
  font-weight: bold;
  font-size: 0.85em;
}

button {
  margin-top: 8px;
  padding: 12px 28px;
  font-size: 1.05rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #241a00;
  cursor: pointer;
}

button:active { transform: translateY(1px); }

#endTitle.win { color: var(--good); }
#endTitle.lose { color: var(--danger); }
