@media (max-width: 600px) {
  /* Tree trunk */
  .tree-trunk {
    position: absolute;
    bottom: 0%;
    left: 52%;
    width: 90%;
    height: 70%;
    background-size: cover;
    background-image: url('7DEB6594-5B51-48E1-83AF-499CF2548203.png');
    background-repeat: no-repeat; /* Prevent tiling */
    background-position: center; /* Center the enlarged image */
    border-radius: 50% 50% 0 0;
    z-index: 0;
    transform: translateX(-50%);
  }

  /* Tree canopy */
  .tree-canopy {
    position: absolute;
    bottom: 35%;
    left: 52%;
    width: 95%;
    height: 60%;
    background-image: url('4395630-E-A63-D-4-B8-E-9-C0-C-1-CC48716-B2-EC.png');
    background-size: cover;
    background-repeat: no-repeat; /* Prevent tiling */
    background-position: center; /* Center the enlarged image */
    border-radius: 50%;
    z-index: 0;
    transform: translateX(-50%);
  }
}

@media (min-width: 601px) {
  /* Tree trunk */
  .tree-trunk {
    position: absolute;
    bottom: 0%;
    left: 52%;
    width: 100%;
    height: 80%;
    background-image: url('7DEB6594-5B51-48E1-83AF-499CF2548203.png');
    background-repeat: no-repeat; /* Prevent tiling */
    background-position: center; /* Center the enlarged image */
    border-radius: 50% 50% 0 0;
    z-index: 0;
    transform: translateX(-50%);
  }

  /* Tree canopy */
  .tree-canopy {
    position: absolute;
    bottom: 35%;
    left: 52%;
    width: 550px;
    height: 60%;
    background-image: url('4395630-E-A63-D-4-B8-E-9-C0-C-1-CC48716-B2-EC.png');
    background-size: cover;
    background-repeat: no-repeat; /* Prevent tiling */
    background-position: center; /* Center the enlarged image */
    border-radius: 50%;
    z-index: 0;
    transform: translateX(-50%);
  }
}

/* General styles */
body {
  font-family: Arial, sans-serif;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background-color: #87ceeb; /* Sky blue */
  overflow: hidden;
}

#game-container {
  position: relative;
  width: 80vw; /* Smaller, responsive game area */
  height: 80vh;
  background-color: #282c34; /* Optional background to visualize the game area */
  border: 2px solid white;
  border-radius: 10px;
  overflow: hidden;
}

#score {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 24px;
  color: white;
  text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
  z-index: 5;
}
#target {
  position: absolute;
  width: 60px; /* Size of the circular target */
  height: 60px;
  background-color: rgba(255, 0, 0, 0.5); /* Semi-transparent red */
  background-image: url('EC4942-C0-6636-4-DCC-8930-E40-F1-C3-FB36-E.png');
  background-size: 150%; /* Enlarge the background image */
  background-repeat: no-repeat; /* Prevent tiling */
  background-position: center; /* Center the enlarged image */
  border-radius: 50%; /* Maintain the circular shape */
  cursor: pointer;
  transition: all 0.3s ease;
}

#target:active {
  transform: scale(1.5); /* Slight shrink effect when tapped */
  transition: transform 0.1s ease;
}

/* Red sparkles for default mode */
#target::before,
#target::after {
  content: '';
  position: absolute;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(255, 0, 0, 0.3) 0%, rgba(255, 0, 0, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
  animation: sparkle 1s infinite;
}

#target::before {
  top: 0;
  left: 0;
}

#target::after {
  bottom: 0;
  right: 0;
}

@keyframes sparkle {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1) translate(-50%, -50%);
  }
  50% {
    opacity: 1;
    transform: scale(1.5) translate(-50%, -50%);
  }
}

/* Green (eating) mode */
#target.eating {
  background-color: rgba(0, 255, 0, 0.5); /* Semi-transparent green */
  transform: scaleX(-1); /* Flip the bird horizontally */
}

#target.eating::before,
#target.eating::after {
  background: radial-gradient(circle, rgba(0, 255, 0, 0.3) 0%, rgba(0, 255, 0, 0) 70%); /* Green sparkles */
}

/* Pears */
.pear {
  position: absolute;
  width: 20px;
  height: 30px;
  background-color: #ffcc00; /* Yellow pear */
  border-radius: 50% 50% 60% 60%;
  transform: rotate(-20deg);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  transition: top 3s linear, left 0.8s ease;
}

.pear::before {
  content: '';
  position: absolute;
  width: 4px;
  height: 10px;
  background-color: #8b4513; /* Brown stem */
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 2px;
}

/* Fade-out effect */
.pear.hidden {
  opacity: 0; /* Make the pear invisible */
  transition: opacity 0.5s ease; /* Smooth fade-out */
}

@keyframes spinUp {
  0% {
    transform: translateY(0) rotate(0deg); /* Start at the original position */
  }
  50% {
    transform: translateY(-60px) rotate(360deg); /* Rotate fully and move slightly upward */
  }
  100% {
    transform: translateY(0) rotate(0deg); /* Return to the original position */
  }
}

#target.spinning {
  animation: spinUp 0.5s ease-in-out; /* 0.5s spin effect */
}

/* Add shake animation */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.pear.shake {
  animation: shake 0.5s infinite; /* Shake for 0.5 seconds */
}
