:root {
  color-scheme: dark;
  --bg: #050711;
  --panel: rgba(10, 18, 34, 0.72);
  --line: rgba(138, 180, 255, 0.24);
  --text: #eff7ff;
  --muted: #91a4be;
  --cyan: #67e8f9;
  --amber: #ffd166;
  --danger: #ff5d73;
  --green: #75f0a7;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  display: grid;
  place-items: center;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 18%, rgba(103, 232, 249, 0.14), transparent 34%),
    radial-gradient(circle at 82% 78%, rgba(255, 209, 102, 0.12), transparent 32%),
    linear-gradient(145deg, #03040a 0%, var(--bg) 58%, #090d1d 100%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  overflow: hidden;
}

button {
  font: inherit;
}

.game-shell {
  width: min(1120px, calc(100vw - 28px));
  display: grid;
  gap: 14px;
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.1;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  margin-top: 3px;
  color: var(--cyan);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(20px, 3vw, 34px);
  line-height: 1;
  text-shadow: 0 0 18px rgba(103, 232, 249, 0.45);
}

.canvas-wrap {
  position: relative;
  aspect-ratio: 3 / 2;
  min-height: 320px;
  max-height: calc(100vh - 170px);
  overflow: hidden;
  border: 1px solid rgba(166, 199, 255, 0.32);
  border-radius: 8px;
  background: #02030a;
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  padding: 26px;
  text-align: center;
  background:
    radial-gradient(circle at center, rgba(9, 16, 31, 0.38), rgba(2, 3, 10, 0.82)),
    rgba(1, 3, 8, 0.4);
  backdrop-filter: blur(4px);
}

.overlay[hidden] {
  display: none;
}

.overlay h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(46px, 9vw, 112px);
  font-weight: 900;
  line-height: 0.9;
  text-transform: uppercase;
  text-shadow:
    0 0 22px rgba(103, 232, 249, 0.6),
    0 0 52px rgba(117, 240, 167, 0.28);
}

.overlay p {
  max-width: 520px;
  margin: 0;
  color: #cad8eb;
  font-size: clamp(15px, 2.4vw, 19px);
  line-height: 1.45;
}

.overlay button,
.control-button {
  border: 1px solid rgba(103, 232, 249, 0.56);
  border-radius: 8px;
  color: var(--text);
  background: linear-gradient(180deg, rgba(103, 232, 249, 0.26), rgba(103, 232, 249, 0.09));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 0 28px rgba(103, 232, 249, 0.18);
  font-weight: 850;
}

.overlay button {
  min-width: 172px;
  min-height: 48px;
  padding: 0 24px;
  font-size: 15px;
  text-transform: uppercase;
}

.overlay button:hover,
.control-button:hover {
  border-color: rgba(255, 209, 102, 0.82);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 0 34px rgba(255, 209, 102, 0.25);
}

.overlay button:active,
.control-button:active,
.control-button.is-active {
  transform: translateY(1px);
  background: linear-gradient(180deg, rgba(255, 209, 102, 0.32), rgba(255, 209, 102, 0.12));
}

.controls {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.control-button {
  min-height: 58px;
  font-size: 23px;
  touch-action: none;
}

.control-button.fire {
  color: var(--amber);
  border-color: rgba(255, 209, 102, 0.62);
}

@media (max-width: 760px) {
  body {
    overflow: auto;
    padding: 12px 0;
  }

  .game-shell {
    width: min(100vw - 18px, 680px);
    gap: 10px;
  }

  .hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .canvas-wrap {
    max-height: none;
  }

  .controls {
    display: grid;
  }
}
