:root {
  color-scheme: light;
  --leaf: #176b3a;
  --leaf-dark: #0d4027;
  --sky: #8bd7ee;
  --sun: #ffd95f;
  --ink: #1d241e;
  --panel: #fff8d6;
  --panel-2: #f7c95a;
  --accent: #e94d37;
  --water: #2f90b8;
  --bark: #7a4b26;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", Verdana, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 12%, rgba(255, 217, 95, 0.72), transparent 17rem),
    linear-gradient(135deg, #8bd7ee 0%, #e0f7b0 52%, #42a85f 100%);
}

.game-shell {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.kicker {
  margin: 0 0 2px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #31582e;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4.1rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(5, minmax(88px, 1fr));
  gap: 8px;
  min-width: min(100%, 520px);
}

.score-tile {
  border: 3px solid rgba(29, 36, 30, 0.82);
  border-radius: 8px;
  background: rgba(255, 248, 214, 0.9);
  padding: 8px;
  box-shadow: 0 4px 0 rgba(29, 36, 30, 0.22);
}

.score-tile strong {
  display: block;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-tile span {
  font-size: 1.25rem;
  font-weight: 900;
}

.stage {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 5px solid var(--ink);
  border-radius: 8px;
  background: var(--sky);
  box-shadow: 0 12px 0 rgba(13, 64, 39, 0.34);
}

canvas:focus {
  outline: 4px solid rgba(255, 217, 95, 0.82);
  outline-offset: 3px;
}

.panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  min-height: 100%;
  border: 5px solid var(--ink);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
  box-shadow: 0 12px 0 rgba(13, 64, 39, 0.34);
}

.panel h2 {
  margin-bottom: 8px;
  font-size: 1.45rem;
  line-height: 1.05;
}

.panel p {
  line-height: 1.35;
}

.panel-label {
  margin-bottom: 6px;
  font-size: 0.73rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #49613b;
}

.meter {
  width: 100%;
  height: 18px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: #f2e39d;
  overflow: hidden;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #43a755, var(--sun), var(--accent));
}

.controls {
  border-top: 3px dashed rgba(29, 36, 30, 0.36);
  border-bottom: 3px dashed rgba(29, 36, 30, 0.36);
  padding: 12px 0;
}

.event-select {
  display: grid;
  gap: 7px;
}

.event-select[hidden] {
  display: none;
}

.event-select button {
  min-height: 36px;
  border-width: 2px;
  background: #2f90b8;
  color: #fff8d6;
  font-size: 0.82rem;
  box-shadow: 0 3px 0 #17516b;
}

button {
  width: 100%;
  min-height: 48px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--accent);
  color: #fff8d6;
  font: inherit;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 5px 0 #81291f;
}

button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #81291f;
}

@media (max-width: 940px) {
  .topbar,
  .stage {
    grid-template-columns: 1fr;
    display: grid;
  }

  .scoreboard {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-width: 0;
  }

  .panel {
    min-height: auto;
  }
}

@media (max-width: 620px) {
  .game-shell {
    width: min(100vw - 18px, 1240px);
    padding-top: 10px;
  }

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

  .score-tile:last-child {
    grid-column: span 2;
  }
}
