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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Comic Sans MS", "Chalkboard SE", "Comic Neue", cursive, sans-serif;
  background: linear-gradient(to bottom, #87CEEB 0%, #87CEEB 50%, #90EE90 50%, #228B22 100%);
}

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.hidden {
  display: none !important;
}

/* ===== START SCREEN ===== */
#start-screen {
  background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 50%, #a1c4fd 100%);
  z-index: 100;
}

.start-content {
  text-align: center;
  background: rgba(255, 255, 255, 0.93);
  padding: 2.5rem 2rem;
  border-radius: 30px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  max-width: 90vw;
  animation: popIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

h1 {
  font-size: clamp(2rem, 8vw, 3.5rem);
  color: #e91e63;
  text-shadow: 3px 3px 0 #fff, 5px 5px 0 #ff9800;
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 1.4rem;
  color: #5d4037;
  margin-bottom: 1.2rem;
}

.instructions {
  font-size: 1.1rem;
  line-height: 1.6;
  color: #444;
  margin-bottom: 1.8rem;
}

.big-btn {
  background: linear-gradient(to bottom, #ffeb3b, #ffc107);
  border: 4px solid #f57f17;
  color: #5d4037;
  font-size: 1.5rem;
  font-weight: bold;
  padding: 0.9rem 2.5rem;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 8px 0 #f57f17, 0 12px 20px rgba(0,0,0,0.2);
  transition: transform 0.1s, box-shadow 0.1s;
  font-family: inherit;
}

.big-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 11px 0 #f57f17, 0 15px 25px rgba(0,0,0,0.25);
}

.big-btn:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 #f57f17, 0 6px 10px rgba(0,0,0,0.2);
}

.big-btn.secondary {
  background: linear-gradient(to bottom, #ce93d8, #ab47bc);
  border-color: #7b1fa2;
  box-shadow: 0 8px 0 #7b1fa2, 0 12px 20px rgba(0,0,0,0.2);
  margin-top: 1rem;
}

.tip {
  margin-top: 1.2rem;
  font-size: 0.95rem;
  color: #666;
}

/* ===== GAME HUD ===== */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.6rem 0.5rem;
  background: rgba(255,255,255,0.88);
  z-index: 20;
  font-size: clamp(0.9rem, 3.5vw, 1.2rem);
  font-weight: bold;
  color: #333;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.hud-item span {
  color: #e91e63;
}

/* ===== PLAY AREA ===== */
#play-area {
  position: absolute;
  top: 50px;
  left: 0;
  right: 0;
  bottom: 60px;
  overflow: hidden;
  cursor: none;
}

/* Soft clouds */
#play-area::before {
  content: "☁️     ☁️        ☁️";
  position: absolute;
  top: 12px;
  left: 5%;
  font-size: 2.2rem;
  opacity: 0.65;
  animation: drift 45s linear infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes drift {
  0% { transform: translateX(0); }
  100% { transform: translateX(70vw); }
}

/* ===== HOLES IN THE GROUND ===== */
.hole {
  position: absolute;
  width: 180px;
  height: 80px;
  transform: translate(-50%, -30%);
  background: radial-gradient(ellipse at center, #3e2723 0%, #5d4037 40%, #4e342e 100%);
  border-radius: 50%;
  box-shadow:
    inset 0 12px 18px rgba(0,0,0,0.6),
    0 3px 0 #8d6e63;
  z-index: 3;
  pointer-events: none;
}

.hole::after {
  content: "";
  position: absolute;
  top: -10px;
  left: 8%;
  width: 84%;
  height: 22px;
  background: #6d4c41;
  border-radius: 50%;
  box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

/* ===== ANIMALS (pop out of holes) ===== */
.animal {
  position: absolute;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
  will-change: transform, opacity;
  transform-origin: center bottom;
  overflow: hidden;
  border: 4px solid #5d4037;
  background: #fff;
}

.animal img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  pointer-events: none;
}

/* Pop up from hole */
.animal.popping {
  animation: popUp 0.22s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
}

@keyframes popUp {
  0% {
    transform: scale(0.2) translateY(30px);
    opacity: 0;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.animal.visible {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Dive back into hole */
.animal.hiding {
  animation: diveDown 0.28s ease-in forwards;
}

@keyframes diveDown {
  0% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
  100% {
    transform: scale(0.3) translateY(25px);
    opacity: 0;
  }
}

/* Caught celebration on the animal itself */
.animal.caught {
  animation: catchBurst 0.55s forwards;
  z-index: 30;
  pointer-events: none;
}

@keyframes catchBurst {
  0% { transform: scale(1); opacity: 1; }
  30% { transform: scale(1.5) rotate(8deg); opacity: 1; }
  100% { transform: scale(0) rotate(-15deg); opacity: 0; }
}

/* ===== NET ===== */
#net {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 6px solid #5d4037;
  background: radial-gradient(circle, rgba(139, 195, 74, 0.28) 0%, rgba(139, 195, 74, 0.06) 70%);
  box-shadow:
    inset 0 0 20px rgba(0,0,0,0.1),
    0 0 0 3px #8bc34a,
    0 8px 25px rgba(0,0,0,0.3);
  pointer-events: none;
  z-index: 25;
  transform: translate(-50%, -50%);
  transition: width 0.1s, height 0.1s, background 0.1s;
}

#net::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 2px dashed #8bc34a;
  opacity: 0.6;
}

#net.active {
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(255, 235, 59, 0.45) 0%, rgba(139, 195, 74, 0.18) 70%);
  border-color: #f57f17;
  box-shadow:
    inset 0 0 20px rgba(0,0,0,0.1),
    0 0 0 4px #ffeb3b,
    0 8px 25px rgba(0,0,0,0.35);
}

/* ===== BIG CELEBRATION MESSAGE ===== */
#catch-message {
  position: absolute;
  top: 58%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #fff9c4, #ffffff);
  padding: 1.3rem 2.2rem;
  border-radius: 24px;
  font-weight: bold;
  color: #e91e63;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3), 0 0 0 6px #ffeb3b;
  z-index: 40;
  pointer-events: none;
  text-align: center;
  min-width: 240px;
}

#catch-message.big-celebrate {
  animation: bigCelebrate 2.2s forwards;
}

@keyframes bigCelebrate {
  0% {
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 0;
  }
  12% {
    transform: translate(-50%, -50%) scale(1.25);
    opacity: 1;
  }
  22% {
    transform: translate(-50%, -50%) scale(1);
  }
  75% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -70%) scale(0.9);
  }
}

.celebrate-title {
  font-size: clamp(1.5rem, 6vw, 2.3rem);
  line-height: 1.2;
  margin-bottom: 0.3rem;
}

.celebrate-sub {
  font-size: clamp(1rem, 4vw, 1.4rem);
  color: #5d4037;
}

/* ===== CONFETTI ===== */
.confetti {
  position: absolute;
  pointer-events: none;
  z-index: 35;
  animation: confettiFly 1.0s cubic-bezier(0.15, 0.7, 0.4, 1) forwards;
}

@keyframes confettiFly {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(0.3);
    opacity: 0;
  }
}

/* ===== CONTROLS ===== */
#controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  background: rgba(255,255,255,0.9);
  z-index: 20;
}

#controls button {
  background: #fff;
  border: 3px solid #5d4037;
  border-radius: 30px;
  padding: 0.5rem 1.3rem;
  font-size: 1.1rem;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 0 #5d4037;
  transition: transform 0.1s;
}

#controls button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #5d4037;
}

/* ===== OVERLAYS ===== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.overlay-content {
  background: white;
  padding: 2.5rem;
  border-radius: 25px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

.overlay-content h2 {
  font-size: 2.5rem;
  color: #5d4037;
  margin-bottom: 1.5rem;
}

/* Responsive */
@media (max-width: 600px) {
  .hole {
    width: 140px;
    height: 62px;
  }
  #net {
    width: 100px;
    height: 100px;
  }
  #net.active {
    width: 118px;
    height: 118px;
  }
  .start-content {
    padding: 1.8rem 1.2rem;
  }
  #catch-message {
    padding: 1rem 1.4rem;
    min-width: 200px;
  }
}
