* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #87CEEB;
  font-family: "Segoe UI", Tahoma, system-ui, sans-serif;
  touch-action: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Live score (top center, during play) */
#score-display {
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(48px, 9vw, 80px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), 0 0 24px rgba(0, 0, 0, 0.25);
  z-index: 5;
  pointer-events: none;
  letter-spacing: 2px;
}

/* Full-screen overlays (start / game over). Clicks pass through to canvas
   except for interactive elements like the restart button. */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: rgba(18, 28, 54, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 10;
  color: #fff;
  text-align: center;
  padding: 24px;
  pointer-events: none;
}

.overlay .title {
  font-size: clamp(40px, 10vw, 96px);
  font-weight: 900;
  letter-spacing: 3px;
  color: #FFD23F;
  text-shadow: 0 6px 0 rgba(0, 0, 0, 0.4), 0 0 32px rgba(255, 210, 63, 0.45);
  margin-bottom: 4px;
}

.overlay .instruction {
  font-size: clamp(18px, 4.5vw, 30px);
  font-weight: 700;
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4);
}

.overlay .hint {
  font-size: clamp(13px, 3vw, 18px);
  color: rgba(255, 255, 255, 0.82);
  font-style: italic;
}

.best-label {
  font-size: clamp(18px, 4vw, 26px);
  font-weight: 800;
  color: #FFD23F;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4);
}

.final-score {
  font-size: clamp(30px, 7vw, 48px);
  font-weight: 900;
  color: #fff;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4);
}

#restart-btn {
  margin-top: 8px;
  padding: 16px 44px;
  font-size: clamp(20px, 4.5vw, 28px);
  font-weight: 900;
  color: #20303a;
  background: #FFD23F;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  letter-spacing: 1px;
  box-shadow: 0 6px 0 #c9a200, 0 10px 22px rgba(0, 0, 0, 0.35);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease;
  pointer-events: auto;
}

#restart-btn:hover {
  background: #ffdb5c;
}

#restart-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #c9a200, 0 5px 12px rgba(0, 0, 0, 0.3);
}

.hidden {
  display: none !important;
}
