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

body {
  overflow: hidden;
  background: #87CEEB;
  font-family: 'Nunito', sans-serif;
}

canvas {
  display: block;
  position: absolute;
  top: 0; left: 0;
}

/* ── Butterfly ── */
#lottieBird {
  position: absolute;
  width: 90px;
  height: 90px;
  pointer-events: none;
  /* Rotate so the butterfly faces right (horizontal flight) */
  transform-origin: center center;
  transform: rotate(90deg);
  transition: filter 0.1s;
}

/* ── HUD ── */
#hud {
  position: absolute;
  top: 20px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 40px;
  pointer-events: none;
  z-index: 10;
}

#scoreDisplay {
  font-family: 'Fredoka One', cursive;
  font-size: 72px;
  color: #fff;
  text-shadow: 0 4px 0 rgba(0,0,0,0.25);
  line-height: 1;
}

#highScoreDisplay {
  font-family: 'Fredoka One', cursive;
  font-size: 22px;
  color: rgba(255,255,255,0.85);
  text-shadow: 0 2px 0 rgba(0,0,0,0.2);
  margin-top: 10px;
}

/* ── Screens ── */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  background: rgba(10, 30, 80, 0.45);
  backdrop-filter: blur(4px);
}

.screen.hidden {
  display: none;
}

.game-title {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(52px, 10vw, 96px);
  color: #fff;
  text-shadow: 0 6px 0 rgba(0,0,0,0.3), 0 0 40px rgba(255,220,100,0.6);
  letter-spacing: 2px;
}

.subtitle {
  font-size: 18px;
  color: rgba(255,255,255,0.8);
  margin-top: 8px;
  margin-bottom: 48px;
  letter-spacing: 1px;
}

.press-hint {
  font-size: 20px;
  color: #fff;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.4);
  padding: 14px 32px;
  border-radius: 50px;
  animation: pulse 1.4s ease-in-out infinite;
}

kbd {
  background: rgba(255,255,255,0.3);
  border-radius: 6px;
  padding: 2px 8px;
  font-family: inherit;
}

.over-title {
  font-family: 'Fredoka One', cursive;
  font-size: 64px;
  color: #FF6B6B;
  text-shadow: 0 4px 0 rgba(0,0,0,0.3);
  margin-bottom: 32px;
}

.score-card {
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  padding: 24px 60px;
  margin-bottom: 36px;
  width: min(320px, 80vw);
}

.score-row {
  display: flex;
  justify-content: space-between;
  font-size: 26px;
  color: #fff;
  padding: 8px 0;
}

.score-row.best {
  border-top: 1px solid rgba(255,255,255,0.3);
  margin-top: 8px;
  padding-top: 16px;
  color: #FFD700;
}

#restartBtn {
  font-family: 'Fredoka One', cursive;
  font-size: 26px;
  color: #fff;
  background: linear-gradient(135deg, #FF6B6B, #FF8E53);
  border: none;
  border-radius: 50px;
  padding: 16px 56px;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0,0,0,0.25);
  transition: transform 0.1s, box-shadow 0.1s;
}

#restartBtn:hover { transform: translateY(-2px); box-shadow: 0 8px 0 rgba(0,0,0,0.25); }
#restartBtn:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0,0,0,0.25); }

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