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

body {
  overflow: hidden;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: 'Courier New', monospace;
  cursor: none;
}

#game {
  position: relative;
  width: 100vw;
  height: 100vh;
  max-width: 800px;
  max-height: 600px;
  overflow: hidden;
  background: #4a90d9;
  border-radius: 0;
  cursor: none;
}

/* Sky */
#sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #4a90d9 0%, #87ceeb 60%, #b8e4f0 100%);
  z-index: 0;
}

/* Clouds */
#sky::before {
  content: '';
  position: absolute;
  top: 10%;
  left: 0;
  right: 0;
  height: 40%;
  background:
    radial-gradient(ellipse 120px 40px at 15% 30%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(ellipse 100px 35px at 45% 20%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(ellipse 140px 45px at 70% 35%, rgba(255,255,255,0.45) 0%, transparent 100%),
    radial-gradient(ellipse 90px 30px at 85% 15%, rgba(255,255,255,0.35) 0%, transparent 100%);
}

/* Grass */
#grass {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 22%;
  background:
    linear-gradient(180deg, #5a9e3a 0%, #3d7a24 40%, #2d5a1a 100%);
  z-index: 1;
  border-top: 3px solid #4a8a2a;
}

/* Grass blades */
#grass::after {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 16px;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      transparent 6px,
      #5a9e3a 6px,
      #5a9e3a 8px,
      transparent 8px,
      transparent 14px,
      #4a8a2a 14px,
      #4a8a2a 16px,
      transparent 16px,
      transparent 22px,
      #6aae4a 22px,
      #6aae4a 24px,
      transparent 24px
    );
}

/* HUD */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 1rem;
  font-weight: bold;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
  letter-spacing: 0.5px;
}

#hud div {
  display: flex;
  align-items: center;
  gap: 4px;
}

#lives {
  font-size: 1.2rem;
}

#livesVal {
  color: #ff6b6b;
  font-size: 1.3rem;
}

/* Duck container */
#duckContainer {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

/* Duck */
.duck {
  position: absolute;
  width: 60px;
  height: 60px;
  pointer-events: none;
  transition: none;
  z-index: 5;
}

.duck-body {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Duck SVG */
.duck svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(1px 2px 2px rgba(0,0,0,0.3));
}

/* Wing flap animation handled by JS */

.duck.dead {
  transform: rotate(180deg) !important;
  transition: transform 0.3s ease;
}

.duck.falling {
  animation: fall 1.2s ease-in forwards;
}

@keyframes fall {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(180deg);
  }
  100% {
    opacity: 0;
    transform: translateY(200px) rotate(200deg);
  }
}

/* Crosshair */
#crosshair {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  font-size: 30px;
  color: rgba(255, 50, 50, 0.85);
  text-shadow:
    0 0 4px rgba(255, 255, 255, 0.8),
    0 0 8px rgba(255, 0, 0, 0.3);
  transform: translate(-50%, -50%);
  font-weight: bold;
  line-height: 1;
}

/* Muzzle flash */
#muzzleFlash {
  position: fixed;
  z-index: 50;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 200, 0.9), rgba(255, 200, 50, 0.6), transparent);
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  transition: none;
}

#muzzleFlash.fire {
  animation: flash 0.12s ease-out forwards;
}

@keyframes flash {
  0% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(2.5);
    opacity: 0;
  }
}

/* Bullet holes */
#bulletHoles {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.bullet-hole {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #333, #111);
  box-shadow: inset 0 0 3px rgba(0,0,0,0.8), 0 1px 2px rgba(0,0,0,0.3);
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0.6;
}

/* Feathers */
.feather {
  position: absolute;
  pointer-events: none;
  z-index: 20;
  width: 8px;
  height: 4px;
  background: #555;
  border-radius: 50% 50% 50% 0;
  opacity: 0;
}

.feather.pop {
  animation: featherPop 0.8s ease-out forwards;
}

@keyframes featherPop {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.3);
  }
}

/* Overlay */
#overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  transition: opacity 0.4s ease;
}

#overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

#overlayBox {
  background: linear-gradient(145deg, #1a2a1a, #0d1a0d);
  border: 3px solid #4a8a2a;
  border-radius: 24px;
  padding: 40px 48px;
  text-align: center;
  color: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), inset 0 0 30px rgba(74, 138, 42, 0.15);
  max-width: 400px;
  width: 90%;
}

#overlayTitle {
  font-size: 2.2rem;
  margin-bottom: 8px;
  letter-spacing: 2px;
  text-shadow: 0 0 20px rgba(255, 200, 50, 0.3);
}

#overlayDesc {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.95rem;
  margin-bottom: 6px;
}

#overlayExtra {
  font-size: 1.1rem;
  margin: 12px 0;
  min-height: 28px;
  color: #ffd43b;
  font-weight: bold;
}

#overlayBtn {
  background: #ff6b35;
  color: #fff;
  border: none;
  padding: 14px 50px;
  border-radius: 14px;
  font-size: 1.3rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 12px 0;
  font-family: inherit;
  letter-spacing: 1px;
  box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

#overlayBtn:hover {
  background: #ff5a1f;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 107, 53, 0.5);
}

#overlayBtn:active {
  transform: translateY(0);
}

#controlsHint {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 8px;
  flex-wrap: wrap;
}

/* Hit / Miss text */
.flying-text {
  position: absolute;
  z-index: 30;
  font-size: 1.5rem;
  font-weight: bold;
  pointer-events: none;
  animation: flyText 0.9s ease-out forwards;
  text-shadow: 1px 1px 4px rgba(0,0,0,0.5);
}

.flying-text.hit {
  color: #ffd43b;
}

.flying-text.miss {
  color: #ff6b6b;
  font-size: 1.2rem;
}

@keyframes flyText {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-60px) scale(1.2);
  }
}

/* Responsive */
@media (max-width: 600px) {
  #game {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }

  .duck {
    width: 48px;
    height: 48px;
  }

  #hud {
    font-size: 0.8rem;
    padding: 8px 12px;
  }

  #crosshair {
    font-size: 24px;
  }

  #overlayBox {
    padding: 28px 24px;
  }

  #overlayTitle {
    font-size: 1.6rem;
  }
}

@media (max-width: 400px) {
  .duck {
    width: 40px;
    height: 40px;
  }

  #hud {
    font-size: 0.7rem;
    padding: 6px 10px;
  }
}
