* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f2ffd2;
  background:
    radial-gradient(circle at top, #3a5f34 0%, #193316 45%, #091609 100%);
}

.game-shell {
  width: min(100vw, 1040px);
  padding: 18px;
}

.topbar,
.help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 2rem);
  letter-spacing: 0.03em;
}

.topbar p {
  margin: 4px 0 0;
  opacity: 0.8;
}

#soundButton {
  border: 2px solid #d8f39a;
  border-radius: 14px;
  padding: 10px 14px;
  color: #f2ffd2;
  background: #213c1c;
  cursor: pointer;
  font-size: 1.25rem;
}

.canvas-wrap {
  position: relative;
  margin-top: 14px;
  border: 4px solid #d8f39a;
  border-radius: 18px;
  overflow: hidden;
  background: #cadf7f;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.45);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.help {
  justify-content: center;
  margin-top: 14px;
  font-size: 0.95rem;
  opacity: 0.92;
}

.help span,
.help strong {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
}

.touch-controls {
  position: absolute;
  inset: auto 0 14px 0;
  display: none;
  justify-content: space-between;
  padding: 0 18px;
  pointer-events: none;
}

.touch-left,
.touch-right {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.touch-controls button {
  min-width: 62px;
  min-height: 54px;
  border: 3px solid rgba(242, 255, 210, 0.9);
  border-radius: 16px;
  color: #f2ffd2;
  background: rgba(16, 35, 13, 0.72);
  font-weight: 900;
  letter-spacing: 0.04em;
  touch-action: none;
}

@media (hover: none), (max-width: 820px) {
  .touch-controls {
    display: flex;
  }

  .game-shell {
    padding: 8px;
  }

  .help {
    font-size: 0.8rem;
  }
}
