:root {
  color-scheme: dark;
  --grass: #178a42;
  --grass-dark: #0d5c36;
  --sky: #162268;
  --ink: #ffffff;
  --muted: rgba(255, 255, 255, 0.72);
  --panel: rgba(10, 20, 46, 0.72);
  --line: rgba(255, 255, 255, 0.22);
  --accent: #ffd345;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  display: grid;
  place-items: center;
  min-height: 100%;
  background:
    radial-gradient(circle at 50% 10%, rgba(255, 255, 255, 0.16), transparent 34%),
    linear-gradient(180deg, #10194d 0%, #0d1437 42%, #08111e 100%);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

.scorebar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1;
}

.score-card {
  min-width: 72px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: center;
}

.score-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.score-card strong {
  display: block;
  margin-top: 2px;
  font-size: 22px;
  line-height: 1;
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #10234a;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.42);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  user-select: none;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 12, 24, 0.62);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
  transition: opacity 180ms ease;
}

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

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #101423;
  font: 700 15px/1 Arial, Helvetica, sans-serif;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
  transition: transform 120ms ease, filter 120ms ease;
}

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

button:active {
  transform: translateY(1px);
}

button.secondary {
  background: #ffffff;
}

@media (max-width: 560px) {
  body {
    align-items: start;
  }

  .game-shell {
    padding: 10px;
  }

  .scorebar {
    grid-template-columns: 1fr auto auto;
  }

  .score-card {
    min-width: 58px;
    padding: 7px 8px;
  }

  .score-card strong {
    font-size: 19px;
  }

  .controls {
    grid-template-columns: repeat(3, 1fr);
  }

  #restart {
    grid-column: 1 / -1;
  }
}
