:root {
  color-scheme: light;
  font-family: "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  --ink: #10283b;
  --night: #173d72;
  --navy: #0f274f;
  --snow: #f8fdff;
  --holly: #13895d;
  --ribbon: #e73845;
  --gold: #ffd25e;
  --ice: #83e4ff;
  --shadow: rgba(10, 29, 62, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  min-width: 320px;
  margin: 0;
  overflow: hidden;
  color: var(--snow);
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 210, 94, 0.7), transparent 11rem),
    linear-gradient(180deg, #102a55 0%, #286899 55%, #a9f0ff 100%);
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.game-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(10px, 1.5vw, 16px);
  width: min(100vw, 1420px);
  height: 100svh;
  margin: 0 auto;
  padding: clamp(10px, 2vw, 22px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
}

.eyebrow {
  margin: 0 0 2px;
  color: #bff7ff;
  font-size: clamp(0.78rem, 1.6vw, 0.92rem);
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: #fff8d4;
  font-size: clamp(1.65rem, 4.6vw, 3.6rem);
  line-height: 0.95;
  letter-spacing: 0;
  text-shadow: 0 3px 0 rgba(13, 36, 72, 0.42);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 52vw;
}

.stats span {
  min-width: 92px;
  padding: 9px 12px;
  border: 3px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 18px var(--shadow);
  color: var(--ink);
  font-size: clamp(0.84rem, 1.8vw, 1rem);
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.play-area {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 4px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  background: #173d72;
  box-shadow: 0 16px 34px var(--shadow);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 280px;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(11, 35, 73, 0.18);
  backdrop-filter: blur(2px);
}

.overlay.hidden {
  display: none;
}

.panel {
  width: min(520px, 92vw);
  padding: clamp(20px, 4vw, 32px);
  border: 4px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 20px 40px rgba(8, 31, 64, 0.32);
  color: var(--ink);
  text-align: center;
}

.badge {
  display: inline-block;
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #d9fbff;
  color: #0d6a71;
  font-weight: 900;
}

h2 {
  margin: 0;
  font-size: clamp(1.7rem, 6vw, 3rem);
  line-height: 1;
  letter-spacing: 0;
}

.panel p:last-of-type {
  max-width: 28rem;
  margin: 12px auto 18px;
  font-size: clamp(1rem, 3vw, 1.2rem);
  font-weight: 800;
}

.primary-button,
.drop-button,
.round-button {
  border-radius: 8px;
  color: #fff;
  font-weight: 1000;
}

.primary-button,
.drop-button {
  min-height: 58px;
  padding: 0 24px;
  background: linear-gradient(180deg, #ff6d62, #d9253f);
  box-shadow: 0 8px 0 #8c1931, 0 14px 22px var(--shadow);
  font-size: clamp(1.05rem, 3vw, 1.4rem);
}

.primary-button:active,
.drop-button:active,
.round-button:active {
  transform: translateY(5px);
}

.primary-button:focus-visible,
.drop-button:focus-visible,
.round-button:focus-visible {
  outline: 4px solid #fff8a8;
  outline-offset: 3px;
}

.primary-button:active,
.drop-button:active {
  box-shadow: 0 3px 0 #8c1931, 0 8px 14px var(--shadow);
}

.controls {
  display: grid;
  grid-template-columns: 64px minmax(160px, 280px) 64px;
  justify-content: center;
  align-items: center;
  gap: 12px;
  min-height: 76px;
}

.round-button {
  width: 64px;
  height: 58px;
  background: linear-gradient(180deg, #18a36f, #0c6b54);
  box-shadow: 0 8px 0 #074533, 0 14px 22px var(--shadow);
  font-size: 1.3rem;
}

.round-button:active {
  box-shadow: 0 3px 0 #074533, 0 8px 14px var(--shadow);
}

.drop-button {
  width: 100%;
}

@media (max-width: 700px) {
  body {
    overflow: auto;
  }

  .game-shell {
    height: 100svh;
    padding: 8px;
  }

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

  .stats {
    max-width: 50vw;
  }

  .stats span {
    min-width: 76px;
    padding: 7px 8px;
  }

  .controls {
    grid-template-columns: 56px minmax(144px, 1fr) 56px;
    gap: 8px;
  }

  .round-button {
    width: 56px;
  }
}
