:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #1c2430;
  --muted: #69798b;
  --panel: rgba(255, 255, 255, 0.86);
  --accent: #f5a623;
  --accent-dark: #d47d0b;
  --sky-top: #79c8ff;
  --sky-bottom: #dff7ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--ink);
  background:
    radial-gradient(circle at 25% 20%, rgba(255, 255, 255, 0.8) 0 8%, transparent 9%),
    linear-gradient(145deg, #e9f9ff 0%, #d7f1fb 42%, #ffe6b8 100%);
}

button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.game-shell {
  width: min(94vw, 480px);
}

.top-bar {
  position: absolute;
  z-index: 4;
  top: 10px;
  left: 10px;
  right: 10px;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 10px;
  align-items: center;
}

.best-score {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 44px;
  color: #fff;
  text-shadow: 0 2px 0 rgba(28, 36, 48, 0.28), 0 0 12px rgba(28, 36, 48, 0.16);
}

.label {
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.best-score strong {
  font-size: 1.25rem;
  line-height: 1;
}

.hud-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 0;
  color: #fff;
  background: transparent;
  box-shadow: none;
  text-shadow: 0 2px 0 rgba(28, 36, 48, 0.26);
  font-weight: 900;
}

.sound-icon {
  position: relative;
  width: 28px;
  height: 24px;
}

.sound-icon::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 7px;
  width: 9px;
  height: 10px;
  border-radius: 3px 0 0 3px;
  background: #fff;
  box-shadow: 0 2px 0 rgba(28, 36, 48, 0.2);
}

.sound-icon::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 3px;
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-right: 14px solid #fff;
  filter: drop-shadow(0 2px 0 rgba(28, 36, 48, 0.2));
}

.sound-icon span,
.sound-icon i {
  display: none;
}

.hud-button::after {
  content: "";
  position: absolute;
}

.hud-button.is-muted .sound-icon {
  transform: translateX(-1px);
}

.hud-button.is-muted .sound-icon::before,
.hud-button.is-muted .sound-icon::after {
  opacity: 0.78;
}

.hud-button.is-muted::after {
  width: 3px;
  height: 30px;
  border-radius: 999px;
  background: #fff;
  transform: rotate(-42deg);
  box-shadow: 0 2px 0 rgba(28, 36, 48, 0.2);
}

.stage-wrap {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 432 / 640;
  border: 1px solid rgba(28, 36, 48, 0.12);
  border-radius: 8px;
  background: linear-gradient(var(--sky-top), var(--sky-bottom));
  box-shadow: 0 24px 54px rgba(66, 117, 151, 0.28);
}

.game-score {
  position: absolute;
  z-index: 2;
  top: 68px;
  left: 50%;
  min-width: 58px;
  transform: translateX(-50%);
  color: #fff;
  font-size: clamp(2.2rem, 11vw, 4.2rem);
  font-weight: 1000;
  line-height: 1;
  text-align: center;
  text-shadow: 0 4px 0 rgba(28, 36, 48, 0.24), 0 0 16px rgba(28, 36, 48, 0.18);
  pointer-events: none;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.overlay {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 14px;
  padding: 28px;
  text-align: center;
  background: rgba(239, 251, 255, 0.62);
  backdrop-filter: blur(4px);
}

.overlay.hidden {
  display: none;
}

.overlay h1,
.overlay h2,
.overlay p {
  margin: 0;
}

.overlay h1,
.overlay h2 {
  font-size: clamp(2.2rem, 10vw, 4rem);
  line-height: 0.95;
}

.overlay p {
  color: #3e5669;
  font-weight: 700;
}

.overlay button {
  justify-self: center;
  min-width: 128px;
  min-height: 44px;
  border-radius: 8px;
  color: white;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  box-shadow: 0 10px 0 #9b5206, 0 18px 24px rgba(129, 83, 14, 0.22);
  font-weight: 900;
}

.overlay button:active {
  transform: translateY(3px);
  box-shadow: 0 7px 0 #9b5206, 0 14px 20px rgba(129, 83, 14, 0.22);
}

@media (max-width: 360px) {
  .top-bar {
    grid-template-columns: 40px 1fr 40px;
  }
}
