* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow: hidden;
  background: #111;
  touch-action: none;
  font-family: 'Arial Black', Arial, sans-serif;
}

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

/* ── Controls ─────────────────────────────────────── */

#controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 16px 20px;
  pointer-events: none;
}

#controls.hidden {
  display: none;
}

#btnLeft,
#btnRight {
  width: 120px;
  height: 80px;
  font-size: 2rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.5);
  color: white;
  pointer-events: all;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
  transition: background 0.1s;
}

#btnLeft:active,
#btnRight:active {
  background: rgba(255, 255, 255, 0.45);
}

/* ── Overlays ──────────────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.82);
  color: white;
  text-align: center;
  z-index: 10;
  padding: 24px;
  gap: 16px;
}

.overlay.visible {
  display: flex;
}

/* ── Main Menu ─────────────────────────────────────── */

#gameTitle {
  font-size: 2.8rem;
  margin: 0;
  line-height: 1.15;
  letter-spacing: 2px;
  color: #ff4400;
  text-shadow: 0 0 28px #ff2200, 0 0 6px #000;
}

#menuBest {
  font-size: 0.95rem;
  color: #aaa;
  margin: 0;
  min-height: 1.3em;
  font-family: Arial, sans-serif;
  font-weight: normal;
}

#diffSelect {
  display: flex;
  gap: 10px;
}

.diff-btn {
  padding: 10px 20px;
  font-size: 1rem;
  font-weight: bold;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.25);
  color: #bbb;
  cursor: pointer;
  transition: all 0.1s;
  font-family: 'Arial Black', Arial, sans-serif;
}

.diff-btn.active {
  background: rgba(200, 50, 0, 0.65);
  border-color: #ff4400;
  color: white;
}

#btnPlay {
  padding: 18px 60px;
  font-size: 1.6rem;
  font-weight: bold;
  border-radius: 14px;
  background: #22aa44;
  border: none;
  color: white;
  cursor: pointer;
  letter-spacing: 1px;
  pointer-events: all;
  font-family: 'Arial Black', Arial, sans-serif;
}

#btnPlay:active {
  background: #1a8833;
}

/* ── Game Over ─────────────────────────────────────── */

#overlayTitle {
  font-size: 3rem;
  margin: 0;
  color: #ff4444;
  text-shadow: 0 0 20px #ff0000;
}

#overlayScore {
  font-size: 1.4rem;
  margin: 0;
  color: #ffdd44;
  font-family: Arial, sans-serif;
}

#overlayRecord {
  font-size: 1.1rem;
  margin: 0;
  color: #ffd700;
  min-height: 1.4em;
  font-family: Arial, sans-serif;
}

#btnRestart {
  padding: 16px 40px;
  font-size: 1.4rem;
  font-weight: bold;
  border-radius: 12px;
  background: #22aa44;
  border: none;
  color: white;
  cursor: pointer;
  pointer-events: all;
  font-family: 'Arial Black', Arial, sans-serif;
}

#btnRestart:active {
  background: #1a8833;
}

#btnMenu {
  padding: 12px 32px;
  font-size: 1.1rem;
  font-weight: bold;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.35);
  color: white;
  cursor: pointer;
  pointer-events: all;
  font-family: 'Arial Black', Arial, sans-serif;
}

#btnMenu:active {
  background: rgba(255, 255, 255, 0.28);
}
