html, body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  width: 100%;
  height: 100%;
  background: #1a1a2e;
  font-family: -apple-system, "Segoe UI", Arial, sans-serif;
  touch-action: manipulation;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none; /* prevent scroll/zoom gestures from interfering with tap-hold duck */
}

#hud {
  position: fixed;
  top: 16px;
  left: 16px;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  user-select: none;
}

#roundLine {
  font-size: 22px;
  font-weight: 700;
}

#distanceLine {
  font-size: 14px;
  opacity: 0.8;
  margin-top: 2px;
}

#milestoneToast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  color: #ffcc4d;
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  user-select: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#messageOverlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #fff;
  text-align: center;
  background: rgba(10, 10, 20, 0.55);
  pointer-events: none;
  user-select: none;
}

#messageOverlay.hidden {
  display: none;
}

#messageTitle {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: 4px;
}

#messageBody {
  font-size: 16px;
  opacity: 0.9;
  line-height: 1.5;
}

#messageHint {
  margin-top: 18px;
  font-size: 14px;
  opacity: 0.7;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

.controlButton {
  -webkit-appearance: none;
  appearance: none;
  padding: 0;
  outline: none;
  cursor: pointer;
  position: fixed;
  bottom: 28px;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  z-index: 10;
  transition: background 0.1s ease, transform 0.1s ease;
}

.controlButton.pressed {
  background: rgba(255, 255, 255, 0.32);
  transform: scale(0.92);
}

#duckButton {
  left: 24px;
}

#jumpButton {
  right: 24px;
}

/* First-time tutorial draws the eye to the two controls. */
.controlButton.tutorialPulse {
  animation: tutorialPulse 1.2s ease-in-out infinite;
}

@keyframes tutorialPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 204, 77, 0.55); }
  50% { box-shadow: 0 0 0 16px rgba(255, 204, 77, 0); }
}
