:root {
  --bg: #0c1116;
  --surface: #121a22;
  --surface-2: #17222c;
  --border: #23323f;
  --text: #eaf3f7;
  --text-muted: #8fa4b0;
  --text-faint: #5f7480;
  --accent: #4fd6ff;
  --accent-bright: #a3ecff;
  --accent-deep: #1c6f94;
  --danger: #ff6b6b;
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  display: flex;
  flex-direction: column;
  cursor: default;
}

a { color: var(--accent); }

/* ---------- Top bar ---------- */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}

.back {
  text-decoration: none;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.back:hover { color: var(--accent); }

.bar-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
}

.bar-score {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.bar-score-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.68rem;
  color: var(--text-faint);
}

#hud-score, #hud-best { color: var(--accent-bright); font-weight: 500; }

.bar-score-sep { color: var(--text-faint); }

/* ---------- Stage ---------- */

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* ---------- Fire button ----------
   Sits in the same stacking layer as the canvas (placed before the overlay
   screens in the DOM), so the start/game-over screens naturally cover and
   disable it without any extra state handling. */

.fire-btn {
  position: absolute;
  right: clamp(16px, 4vw, 32px);
  bottom: clamp(16px, 4vw, 32px);
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 2px solid var(--accent-deep);
  background: rgba(23, 34, 44, 0.75);
  color: var(--accent-bright);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, transform 0.1s ease;
}

.fire-btn:hover { background: rgba(23, 34, 44, 0.92); }
.fire-btn:active { transform: scale(0.94); }

/* ---------- Overlay screens ---------- */

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  padding: 24px;
  background: rgba(12, 17, 22, 0.72);
  backdrop-filter: blur(6px);
  transition: opacity 0.3s ease;
}

.screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.eyebrow {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.screen h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 8vw, 3.2rem);
}

#final-score { color: var(--accent-bright); }

.lede {
  margin: 0;
  max-width: 44ch;
  color: var(--text-muted);
}

button.primary {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  padding: 12px 28px;
  border-radius: 100px;
  border: none;
  background: var(--accent);
  color: #04202b;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

button.primary:hover { background: var(--accent-bright); transform: translateY(-1px); }
button.primary:active { transform: translateY(0); }

.controls {
  margin: 4px 0 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.controls-sep { color: var(--text-faint); }

kbd {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-muted);
  padding: 1px 6px;
}

/* ---------- Footer ---------- */

footer {
  padding: 10px 18px 16px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-faint);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

@media (prefers-reduced-motion: reduce) {
  .screen { transition: none; }
}
