:root {
  --bg: #05070f;
  --ink: #eaf6ff;
  --dim: #8fa8bf;
  --accent: #42e8c0;
  --accent-2: #7cc4ff;
  --danger: #ff5a6e;
  --gold: #ffd23f;
  --panel: rgba(8, 14, 28, 0.72);
  --line: rgba(122, 214, 255, 0.22);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
}

#app { position: fixed; inset: 0; }

#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- HUD ---------- */

#hud {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 10px 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  user-select: none;
  z-index: 5;
}

.hud-block { display: flex; flex-direction: column; align-items: center; min-width: 52px; }
.hud-label {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
}
.hud-block strong { font-size: 22px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.hud-best strong { color: var(--gold); }

.preview-badge {
  position: absolute;
  bottom: 18px;
  right: 18px;
  padding: 4px 10px;
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--accent-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  user-select: none;
}

/* ---------- Overlays ---------- */

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: radial-gradient(ellipse at center, rgba(5, 7, 15, 0.25), rgba(5, 7, 15, 0.86));
  z-index: 10;
}
.overlay--thin { background: rgba(5, 7, 15, 0.6); }

.hidden { display: none !important; }

.kicker {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
}
.kicker--danger { color: var(--danger); }

.overlay h1 {
  margin: 0;
  font-size: clamp(30px, 6vw, 54px);
  line-height: 1.08;
  letter-spacing: 0.02em;
}
.overlay h2 { margin: 0; font-size: clamp(22px, 4vw, 34px); }

.intro {
  margin: 0;
  max-width: 460px;
  color: var(--dim);
  font-size: 15px;
  line-height: 1.55;
}
.intro strong { color: var(--gold); font-variant-numeric: tabular-nums; }

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px 26px;
  margin-top: 4px;
}

.control {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--dim);
}
.control span { margin-left: 6px; }

kbd {
  min-width: 26px;
  padding: 3px 7px;
  font-size: 12px;
  font-family: inherit;
  color: var(--ink);
  background: rgba(122, 196, 255, 0.12);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
}

.launch {
  margin-top: 10px;
  padding: 13px 34px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #04110c;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  box-shadow: 0 0 24px rgba(66, 232, 192, 0.35);
}
.launch:hover { transform: translateY(-2px); box-shadow: 0 0 34px rgba(66, 232, 192, 0.55); }
.launch:active { transform: translateY(0); }

.hint { margin: 2px 0 0; font-size: 12px; color: var(--dim); }

.touch-only { display: none; }
@media (pointer: coarse) {
  .touch-only { display: flex; }
}

/* ---------- FX ---------- */

#flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 30%, var(--danger));
  opacity: 0;
  pointer-events: none;
  z-index: 8;
}
#flash.on { animation: flash 0.55s ease-out; }

@keyframes flash {
  0% { opacity: 0.85; }
  100% { opacity: 0; }
}

.pop {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translateX(-50%);
  font-size: 26px;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(255, 210, 63, 0.8);
  pointer-events: none;
  animation: pop 0.7s ease-out forwards;
}

@keyframes pop {
  0% { opacity: 0; translate: 0 10px; }
  25% { opacity: 1; }
  100% { opacity: 0; translate: 0 -34px; }
}
