particlewa {
  position: fixed;
  left: 0;
  top: 0;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

.circles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  z-index: -9999;
  pointer-events: none;
}

.circles li {
  position: fixed;
  display: block;
  list-style: none;
  width: 20px;
  height: 20px;
  background: rgba(99, 102, 241, 0.15); /* Use theme color with lower opacity */
  animation: optimized-float 20s linear infinite;
  bottom: -150px;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

.circles li:nth-child(1) {
  left: 25%;
  width: 60px; /* Reduced size for better performance */
  height: 60px;
  animation-delay: 0s;
  animation-duration: 18s;
}

.circles li:nth-child(2) {
  left: 10%;
  width: 20px;
  height: 20px;
  animation-delay: 2s;
  animation-duration: 15s;
}

.circles li:nth-child(3) {
  left: 70%;
  width: 20px;
  height: 20px;
  animation-delay: 4s;
  animation-duration: 20s;
}

.circles li:nth-child(4) {
  left: 40%;
  width: 45px; /* Reduced size */
  height: 45px;
  animation-delay: 1s;
  animation-duration: 22s;
}

.circles li:nth-child(5) {
  left: 65%;
  width: 20px;
  height: 20px;
  animation-delay: 3s;
  animation-duration: 20s;
}

.circles li:nth-child(6) {
  left: 75%;
  width: 80px; /* Reduced size */
  height: 80px;
  animation-delay: 5s;
  animation-duration: 25s;
}

.circles li:nth-child(7) {
  left: 35%;
  width: 100px; /* Reduced size */
  height: 100px;
  animation-delay: 7s;
  animation-duration: 28s;
}

.circles li:nth-child(8) {
  left: 50%;
  width: 25px;
  height: 25px;
  animation-delay: 10s;
  animation-duration: 30s;
}

.circles li:nth-child(9) {
  left: 20%;
  width: 15px;
  height: 15px;
  animation-delay: 6s;
  animation-duration: 24s;
}

.circles li:nth-child(10) {
  left: 85%;
  width: 90px; /* Reduced size */
  height: 90px;
  animation-delay: 8s;
  animation-duration: 26s;
}

@keyframes optimized-float {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 0.8;
    border-radius: 0;
  }

  50% {
    opacity: 0.4;
  }

  100% {
    transform: translateY(-100vh) rotate(360deg); /* Flow across full viewport height */
    opacity: 0;
    border-radius: 50%;
  }
}

/* Responsive adjustments for different screen sizes */
@media screen and (max-width: 350px) {
  .circles li {
    animation-duration: 25s; /* Faster animation on small screens */
  }

  .circles li:nth-child(1) {
    width: 30px;
    height: 30px;
  }

  .circles li:nth-child(4) {
    width: 25px;
    height: 25px;
  }

  .circles li:nth-child(6) {
    width: 40px;
    height: 40px;
  }

  .circles li:nth-child(7) {
    width: 50px;
    height: 50px;
  }

  .circles li:nth-child(10) {
    width: 45px;
    height: 45px;
  }

  @keyframes optimized-float {
    0% {
      transform: translateY(0) rotate(0deg);
      opacity: 0.6;
      border-radius: 0;
    }
    50% {
      opacity: 0.3;
    }
    100% {
      transform: translateY(-100vh) rotate(180deg);
      opacity: 0;
      border-radius: 50%;
    }
  }
}

@media screen and (min-width: 351px) and (max-width: 768px) {
  .circles li {
    animation-duration: 22s; /* Medium speed for tablets */
  }

  .circles li:nth-child(1) {
    width: 45px;
    height: 45px;
  }

  .circles li:nth-child(4) {
    width: 35px;
    height: 35px;
  }

  .circles li:nth-child(6) {
    width: 60px;
    height: 60px;
  }

  .circles li:nth-child(7) {
    width: 75px;
    height: 75px;
  }

  .circles li:nth-child(10) {
    width: 65px;
    height: 65px;
  }

  @keyframes optimized-float {
    0% {
      transform: translateY(0) rotate(0deg);
      opacity: 0.7;
      border-radius: 0;
    }
    50% {
      opacity: 0.35;
    }
    100% {
      transform: translateY(-100vh) rotate(270deg);
      opacity: 0;
      border-radius: 50%;
    }
  }
}

@media screen and (min-width: 769px) {
  .circles li {
    animation-duration: 20s; /* Original speed for desktop */
  }

  /* Enhanced desktop experience with more particles */
  .circles li:nth-child(11),
  .circles li:nth-child(12),
  .circles li:nth-child(13),
  .circles li:nth-child(14),
  .circles li:nth-child(15) {
    position: fixed;
    display: block;
    list-style: none;
    background: rgba(99, 102, 241, 0.1);
    animation: optimized-float 25s linear infinite;
    bottom: -150px;
    will-change: transform, opacity;
    backface-visibility: hidden;
  }

  .circles li:nth-child(11) {
    left: 5%;
    width: 30px;
    height: 30px;
    animation-delay: 12s;
    animation-duration: 32s;
  }

  .circles li:nth-child(12) {
    left: 90%;
    width: 40px;
    height: 40px;
    animation-delay: 14s;
    animation-duration: 28s;
  }

  .circles li:nth-child(13) {
    left: 15%;
    width: 25px;
    height: 25px;
    animation-delay: 16s;
    animation-duration: 35s;
  }

  .circles li:nth-child(14) {
    left: 80%;
    width: 35px;
    height: 35px;
    animation-delay: 18s;
    animation-duration: 30s;
  }

  .circles li:nth-child(15) {
    left: 60%;
    width: 20px;
    height: 20px;
    animation-delay: 20s;
    animation-duration: 33s;
  }
}

/* High-resolution displays optimization */
@media screen and (min-width: 1440px) {
  .circles li {
    background: rgba(
      99,
      102,
      241,
      0.12
    ); /* Slightly more visible on large screens */
  }

  @keyframes optimized-float {
    0% {
      transform: translateY(0) rotate(0deg);
      opacity: 0.9;
      border-radius: 0;
    }
    25% {
      opacity: 0.6;
    }
    50% {
      opacity: 0.4;
    }
    75% {
      opacity: 0.2;
    }
    100% {
      transform: translateY(-100vh) rotate(360deg);
      opacity: 0;
      border-radius: 50%;
    }
  }
}

/* Performance optimization for low-end devices */
@media screen and (max-width: 480px) and (max-height: 800px) {
  .circles li:nth-child(n + 6) {
    display: none; /* Hide some particles on very small screens */
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .circles li {
    animation-duration: 60s;
    animation-timing-function: ease-out;
  }

  @keyframes optimized-float {
    0% {
      transform: translateY(0);
      opacity: 0.5;
    }
    100% {
      transform: translateY(-100vh);
      opacity: 0;
    }
  }
}
