:root {
  color-scheme: light;
  --bg: #f3f7ee;
  --ink: #1b2a2f;
  --muted: #58706f;
  --panel: #ffffff;
  --line: #c9d7c2;
  --leaf: #257d4c;
  --leaf-strong: #176238;
  --sun: #f2b536;
  --sun-strong: #d77d22;
  --sky: #79c7f2;
  --shadow: 0 18px 42px rgb(27 42 47 / 14%);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgb(121 199 242 / 34%), transparent 22rem),
    linear-gradient(135deg, #f7fbef, var(--bg));
}

body,
button {
  font: inherit;
}

button {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 20;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  background: var(--ink);
  color: #ffffff;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.game-shell {
  display: grid;
  gap: 1rem;
  width: min(1120px, calc(100% - 2rem));
  min-height: 100vh;
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

.topbar,
.scorebar,
.controls {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--leaf);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.status-pill {
  min-width: 7rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--leaf-strong);
  font-weight: 900;
  text-align: center;
}

.scorebar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.scorebar div {
  min-height: 5rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.scorebar span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.scorebar strong {
  display: block;
  margin-top: 0.2rem;
  font-size: clamp(1.55rem, 5vw, 2.6rem);
  line-height: 1;
}

.stage {
  min-height: 0;
}

#game-canvas {
  display: block;
  width: 100%;
  height: min(56vh, 420px);
  min-height: 300px;
  border: 2px solid #24383d;
  border-radius: var(--radius);
  background: var(--sky);
  box-shadow: var(--shadow);
  touch-action: manipulation;
}

.controls {
  flex-wrap: wrap;
  gap: 0.75rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 8rem;
  min-height: 3.15rem;
  padding: 0.8rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 900;
  cursor: pointer;
}

.button.primary {
  background: var(--leaf);
  color: #ffffff;
}

.button.primary:hover,
.button.primary:focus-visible {
  background: var(--leaf-strong);
}

.button.accent {
  background: var(--sun);
  color: #2f2109;
}

.button.accent:hover,
.button.accent:focus-visible {
  background: var(--sun-strong);
  color: #ffffff;
}

.button.secondary {
  border-color: var(--line);
  background: var(--panel);
}

.button.secondary:hover,
.button.secondary:focus-visible {
  border-color: var(--leaf);
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgb(37 125 76 / 34%);
  outline-offset: 3px;
}

@media (max-width: 680px) {
  .game-shell {
    width: min(100% - 1rem, 1120px);
    padding-top: 0.5rem;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-pill {
    width: 100%;
  }

  .scorebar {
    gap: 0.5rem;
  }

  .scorebar div {
    min-height: 4.35rem;
    padding: 0.7rem;
  }

  #game-canvas {
    height: 52vh;
    min-height: 280px;
  }

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

  .button {
    min-width: 0;
    padding: 0.75rem 0.6rem;
  }
}
