*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0f1f0f;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a2f1a;
}

#game-canvas {
  display: block;
  touch-action: none;
}

/* ── HUD ── */
#hud {
  position: absolute;
  top: env(safe-area-inset-top, 0px);
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  pointer-events: none;
  z-index: 10;
}

#score-display {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  min-width: 3ch;
  text-align: left;
}

#hud-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.15rem;
  font-weight: 900;
  color: #7ed957;
  letter-spacing: 2px;
  text-shadow: 0 0 12px rgba(126, 217, 87, 0.35);
  pointer-events: none;
  white-space: nowrap;
}

#mute-btn {
  pointer-events: all;
  background: rgba(0, 0, 0, 0.35);
  border: 1.5px solid rgba(126, 217, 87, 0.3);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

#mute-btn:active {
  background: rgba(126, 217, 87, 0.25);
}

/* ── Overlay ── */
#overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(8, 22, 8, 0.88);
  z-index: 20;
  touch-action: none;
}

#overlay.visible {
  display: flex;
}

.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  padding: 40px 32px;
  max-width: 340px;
  width: 100%;
}

.screen.active {
  display: flex;
}

/* ── Start screen ── */
.game-title {
  font-size: clamp(2.8rem, 12vw, 4rem);
  font-weight: 900;
  color: #7ed957;
  text-shadow: 0 0 24px rgba(126, 217, 87, 0.45), 0 4px 12px rgba(0,0,0,0.5);
  letter-spacing: 3px;
  line-height: 1;
  margin-bottom: 4px;
}

.turtle-icon {
  font-size: clamp(4rem, 16vw, 6rem);
  margin: 20px 0 12px;
  animation: float 2.2s ease-in-out infinite;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
}

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(-3deg); }
  50% { transform: translateY(-14px) rotate(3deg); }
}

.subtitle {
  font-size: 1rem;
  color: #8fba7a;
  letter-spacing: 1px;
  margin-bottom: 28px;
}

.hint {
  font-size: 1.25rem;
  font-weight: 600;
  color: #7ed957;
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.97); }
}

/* ── Game over screen ── */
.gameover-title {
  font-size: clamp(2rem, 10vw, 2.8rem);
  font-weight: 900;
  color: #ff6b6b;
  text-shadow: 0 0 20px rgba(255, 107, 107, 0.4);
  margin-bottom: 16px;
}

.score-label {
  font-size: 0.85rem;
  color: #8fba7a;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 4px;
}

#final-score {
  font-size: clamp(4rem, 18vw, 5.5rem);
  font-weight: 900;
  color: #7ed957;
  line-height: 1;
  text-shadow: 0 0 20px rgba(126, 217, 87, 0.4);
  margin-bottom: 32px;
}

#restart-btn {
  background: linear-gradient(135deg, #7ed957, #5cb840);
  color: #0f1f0f;
  border: none;
  border-radius: 50px;
  padding: 16px 52px;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  min-width: 200px;
  min-height: 56px;
  letter-spacing: 1px;
  box-shadow: 0 6px 20px rgba(126, 217, 87, 0.3);
  transition: transform 0.1s, box-shadow 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#restart-btn:active {
  transform: scale(0.95);
  box-shadow: 0 2px 8px rgba(126, 217, 87, 0.2);
}
