* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --blue: #6ec8ff;
  --deep-blue: #234a9f;
  --grass: #6fd36f;
  --sun: #ffe66d;
  --rocket: #ff6b6b;
  --panel: rgba(255, 255, 255, 0.9);
  --shadow: 0 18px 40px rgba(24, 52, 108, 0.24);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Comic Sans MS", "Trebuchet MS", system-ui, sans-serif;
  color: #17315f;
  background:
    radial-gradient(circle at 20% 10%, #fff6a5 0 9%, transparent 10%),
    linear-gradient(180deg, #93ddff 0%, #c7f2ff 48%, #92e87b 49%, #63c95f 100%);
}

.game-shell {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.top-buttons {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: clamp(0.9rem, 2vw, 1.15rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #315eb5;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4.3rem);
  line-height: 0.95;
  color: #183a86;
  text-shadow: 0 4px 0 rgba(255, 255, 255, 0.7);
}

.stage-card {
  position: relative;
  overflow: hidden;
  border: 8px solid #fff;
  border-radius: 34px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: manipulation;
}

.story-text {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 18px;
  padding: 14px 18px;
  border: 5px solid rgba(255, 255, 255, 0.85);
  border-radius: 24px;
  color: #14316c;
  background: rgba(255, 255, 255, 0.82);
  font-size: clamp(1rem, 3.6vw, 2rem);
  font-weight: 900;
  text-align: center;
  box-shadow: 0 8px 20px rgba(33, 61, 120, 0.16);
}

.scene-controls,
.controls {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

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

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

button {
  min-height: 72px;
  border: 0;
  border-radius: 24px;
  color: white;
  background: #f27649;
  font: inherit;
  font-size: clamp(1.05rem, 3vw, 1.8rem);
  font-weight: 900;
  box-shadow: 0 8px 0 #b84425, 0 14px 24px rgba(36, 57, 94, 0.22);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.controls button:nth-child(2) {
  background: #36b56d;
  box-shadow: 0 8px 0 #1b7841, 0 14px 24px rgba(36, 57, 94, 0.22);
}

.controls button:nth-child(3) {
  background: #7857df;
  box-shadow: 0 8px 0 #4b34a1, 0 14px 24px rgba(36, 57, 94, 0.22);
}

.controls button:nth-child(4) {
  background: #2788df;
  box-shadow: 0 8px 0 #15599a, 0 14px 24px rgba(36, 57, 94, 0.22);
}

.controls button:nth-child(5) {
  background: #d9488b;
  box-shadow: 0 8px 0 #8d2759, 0 14px 24px rgba(36, 57, 94, 0.22);
}

.controls button:nth-child(6) {
  background: #12a6a6;
  box-shadow: 0 8px 0 #0b6f73, 0 14px 24px rgba(36, 57, 94, 0.22);
}

.controls button:nth-child(7) {
  background: #c47a32;
  box-shadow: 0 8px 0 #7a4a1e, 0 14px 24px rgba(36, 57, 94, 0.22);
}

.controls button:nth-child(8) {
  background: #f5a623;
  box-shadow: 0 8px 0 #a76410, 0 14px 24px rgba(36, 57, 94, 0.22);
}

.scene-button {
  min-height: 62px;
  border: 5px solid #fff;
  color: #17315f;
  background: #ffec80;
  font-size: clamp(1rem, 2.6vw, 1.45rem);
  box-shadow: 0 7px 0 #c79816, 0 13px 22px rgba(36, 57, 94, 0.18);
}

.scene-button:nth-child(2) {
  background: #8ff7ff;
  box-shadow: 0 7px 0 #2c9daa, 0 13px 22px rgba(36, 57, 94, 0.18);
}

.scene-button:nth-child(3) {
  background: #c7ff8f;
  box-shadow: 0 7px 0 #6fac2e, 0 13px 22px rgba(36, 57, 94, 0.18);
}

.scene-button:nth-child(4) {
  background: #ffd1e7;
  box-shadow: 0 7px 0 #b14f7e, 0 13px 22px rgba(36, 57, 94, 0.18);
}

button:active,
button.is-pressed {
  transform: translateY(7px) scale(0.98);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.28), 0 8px 16px rgba(36, 57, 94, 0.16);
}

.small-button {
  flex: 0 0 auto;
  min-height: 54px;
  padding: 0 18px;
  border: 4px solid white;
  border-radius: 18px;
  font-size: clamp(0.95rem, 2.4vw, 1.15rem);
  background: #183a86;
  box-shadow: 0 6px 0 #0c2459, 0 10px 18px rgba(36, 57, 94, 0.22);
}

.narration-button {
  background: #d9488b;
  box-shadow: 0 6px 0 #8d2759, 0 10px 18px rgba(36, 57, 94, 0.22);
}

.small-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.hint {
  margin: 12px 0 0;
  font-size: clamp(0.95rem, 2.2vw, 1.2rem);
  font-weight: 800;
  text-align: center;
}

@media (max-width: 720px) {
  .game-shell {
    padding: 10px;
  }

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

  .top-buttons {
    justify-content: flex-start;
  }

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

  button {
    min-height: 66px;
  }

  .story-text {
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 10px 12px;
  }
}
