:root {
  color-scheme: dark;
  --ink: #f7fbf2;
  --muted: #aac0c4;
  --panel: #142024;
  --panel-2: #1d3032;
  --green: #72d15c;
  --lime: #c8f05a;
  --red: #ff6363;
  --blue: #58bde8;
  --gold: #ffd166;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 10%, rgba(114, 209, 92, 0.18), transparent 32rem),
    linear-gradient(135deg, #0c1316 0%, #19292d 48%, #271725 100%);
  display: grid;
  place-items: center;
  padding: 18px;
}

button {
  border: 0;
  border-radius: 8px;
  color: #071012;
  background: var(--lime);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 0 #749522;
  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    filter 120ms ease;
}

button:hover {
  filter: brightness(1.05);
}

button:active {
  transform: translateY(5px);
  box-shadow: 0 3px 0 #749522;
}

.game-shell {
  width: min(100%, 1060px);
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 0 2px 14px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 0.9;
}

.stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stats span {
  min-width: 116px;
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(20, 32, 36, 0.82);
  color: var(--muted);
  text-align: right;
}

.stats b {
  color: var(--ink);
  font-size: 1.3rem;
}

.stage-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #0d1518;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 190px);
  background: #121d21;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 14px;
  padding: 26px;
  text-align: center;
  background: rgba(8, 13, 16, 0.68);
  backdrop-filter: blur(5px);
}

.overlay.hidden {
  display: none;
}

.overlay h2 {
  font-size: clamp(1.7rem, 4vw, 3.5rem);
}

.overlay p {
  max-width: 36rem;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.15rem);
}

#startButton {
  justify-self: center;
  min-width: 138px;
  min-height: 48px;
  margin-top: 4px;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1.35fr 1fr;
  gap: 10px;
  padding-top: 12px;
}

.controls button {
  min-height: 54px;
  background: var(--blue);
  box-shadow: 0 8px 0 #286b85;
}

.controls button:active {
  box-shadow: 0 3px 0 #286b85;
}

@media (max-width: 660px) {
  body {
    padding: 12px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .stats {
    justify-content: stretch;
  }

  .stats span {
    flex: 1;
    min-width: 0;
    text-align: left;
  }

  canvas {
    max-height: none;
  }
}
