:root {
  --bg: #070b14;
  --hud: #e6f1ff;
  --accent: #6ae3ff;
  --accent-strong: #9ff0ff;
  --warm: #ffb86b;
  --danger: #ff6b6b;
  --panel: rgba(9, 14, 26, 0.78);
  --panel-border: rgba(122, 233, 255, 0.2);
}

* {
  box-sizing: border-box;
}

@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap");

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 20% 20%, rgba(106, 227, 255, 0.12), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(255, 184, 107, 0.1), transparent 45%),
    radial-gradient(circle at 50% 10%, rgba(116, 155, 255, 0.12), transparent 55%),
    #070b14;
  font-family: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--hud);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(0,0,0,0) 35%, rgba(0,0,0,0.55) 100%),
    repeating-linear-gradient(120deg, rgba(255,255,255,0.02) 0 1px, rgba(255,255,255,0) 1px 8px);
  z-index: 1;
}

canvas {
  display: block;
}

#hud {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  font-size: 13px;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(6, 10, 20, 0.55);
  border: 1px solid rgba(122, 233, 255, 0.2);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(3, 6, 12, 0.45), inset 0 0 0 1px rgba(122, 233, 255, 0.08);
  text-shadow: 0 0 12px rgba(106, 227, 255, 0.4);
}

#help {
  opacity: 0.7;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: none;
}

#overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at top, rgba(106, 227, 255, 0.18), transparent 60%),
    radial-gradient(circle at 80% 70%, rgba(255, 184, 107, 0.18), transparent 55%),
    rgba(4, 6, 12, 0.94);
  z-index: 3;
  gap: 16px;
  padding: 24px;
}

#overlay.hidden {
  display: none;
}

.overlay-panel {
  width: min(640px, 92vw);
  padding: 28px 28px 24px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(14, 22, 38, 0.9), rgba(6, 10, 20, 0.9));
  border: 1px solid var(--panel-border);
  box-shadow: 0 30px 70px rgba(2, 4, 10, 0.6), inset 0 0 0 1px rgba(122, 233, 255, 0.08);
  backdrop-filter: blur(10px);
  display: grid;
  gap: 18px;
}

.overlay-hero {
  display: grid;
  gap: 12px;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(230, 241, 255, 0.7);
}

.title {
  margin: 0;
  font-size: clamp(36px, 6vw, 64px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-strong);
  text-shadow: 0 0 20px rgba(106, 227, 255, 0.45);
}

.subtitle {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: rgba(230, 241, 255, 0.8);
}

.controls {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.controls li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(9, 14, 26, 0.65);
  border-radius: 10px;
  border: 1px solid rgba(122, 233, 255, 0.12);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  position: relative;
  padding-left: 30px;
}

.controls li::before {
  content: "";
  position: absolute;
  left: 12px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(106, 227, 255, 0.6);
}

.controls span {
  color: rgba(230, 241, 255, 0.7);
}

.controls strong {
  color: var(--accent-strong);
  font-weight: 600;
}

#overlay-text {
  font-size: 16px;
  text-align: center;
  line-height: 1.5;
  white-space: pre-line;
  color: rgba(230, 241, 255, 0.85);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#overlay-button {
  appearance: none;
  border: 1px solid rgba(106, 227, 255, 0.8);
  background: linear-gradient(135deg, rgba(106, 227, 255, 0.12), rgba(106, 227, 255, 0.02));
  color: var(--hud);
  padding: 12px 22px;
  font-size: 13px;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
  border-radius: 999px;
  box-shadow: 0 14px 30px rgba(5, 10, 18, 0.45);
}

#overlay-button:hover {
  background: var(--accent);
  color: #071018;
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(5, 10, 18, 0.6), 0 0 18px rgba(106, 227, 255, 0.5);
}

#overlay[data-state="pause"] .overlay-hero,
#overlay[data-state="gameover"] .overlay-hero {
  display: none;
}

#overlay[data-state="pause"] .overlay-panel,
#overlay[data-state="gameover"] .overlay-panel {
  width: min(420px, 88vw);
  text-align: center;
}

@media (max-width: 600px) {
  #hud {
    left: 10px;
    top: 10px;
    padding: 10px 12px;
  }

  .overlay-panel {
    padding: 22px 20px;
  }

  .controls li {
    font-size: 12px;
  }
}
