* {
  box-sizing: border-box;
}

:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #243047;
  background: #dff6ff;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  padding: clamp(10px, 3vw, 24px);
  background: linear-gradient(#8fe2ff 0%, #c9f2d4 72%, #eaffd0 100%);
}

main {
  width: min(100%, 1000px);
  margin: 0 auto;
}

header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0;
  color: #28754b;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
}

h1 {
  margin: 2px 0 8px;
  color: #174d39;
  font-size: clamp(2rem, 7vw, 3.6rem);
  line-height: 1;
}

#score {
  margin: 0 0 8px;
  padding: 9px 14px;
  border-radius: 999px;
  background: #fff7d1;
  color: #704719;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 3px 0 #d2ae62;
}

.instructions,
.status {
  text-align: center;
  font-weight: 650;
}

.instructions {
  margin: 0 0 12px;
  color: #28556a;
}

.status {
  min-height: 1.5em;
  margin: 10px 0 0;
  color: #174d39;
}

.game-shell {
  position: relative;
  overflow: hidden;
  border: 5px solid #fff9df;
  border-radius: 18px;
  background: #69cdec;
  box-shadow: 0 8px 0 #477d56, 0 14px 30px #397a8840;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: #69cdec;
  outline: none;
  image-rendering: auto;
}

canvas:focus {
  box-shadow: inset 0 0 0 4px #ffe16b;
}

.touch-controls {
  display: none;
  position: relative;
  inset: auto;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px 6px;
  pointer-events: none;
  background: #174d39;
}

.touch-controls button {
  pointer-events: auto;
  min-width: 62px;
  min-height: 48px;
  padding: 8px 14px;
  border: 2px solid #fff4b8;
  border-radius: 14px;
  color: #fff;
  background: #28754b;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 800;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.touch-controls button:active,
.touch-controls button:focus-visible {
  background: #5aa85f;
  outline: 3px solid #ffe16b;
  outline-offset: 2px;
}

@media (max-width: 650px) {
  body {
    padding: 10px 8px 14px;
  }

  header {
    align-items: start;
    flex-direction: column;
    gap: 4px;
  }

  #score {
    margin: 0;
  }

  .touch-controls {
    display: flex;
  }

  .instructions {
    margin-bottom: 9px;
    font-size: 0.9rem;
  }

  .game-shell {
    border-width: 3px;
    border-radius: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
