body.has-stars {
    background: radial-gradient(ellipse at bottom, #1B2735 0%, #090A0F 100%);
    min-height: 100vh;
    overflow-x: hidden;
    background-attachment: fixed;
    position: relative;
}

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

.stars:before,
.stars:after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    background: transparent;
}

@media (min-width: 769px) {
    .stars.js-loaded:before,
    .stars.js-loaded:after {
        display: none;
    }
}

.stars:before {
    background-image:
        radial-gradient(1px 1px at 25px 5px, white, rgba(255, 255, 255, 0)),
        radial-gradient(1px 1px at 50px 25px, white, rgba(255, 255, 255, 0)),
        radial-gradient(1px 1px at 125px 20px, white, rgba(255, 255, 255, 0)),
        radial-gradient(1.5px 1.5px at 50px 75px, white, rgba(255, 255, 255, 0)),
        radial-gradient(2px 2px at 15px 125px, white, rgba(255, 255, 255, 0)),
        radial-gradient(2.5px 2.5px at 110px 80px, white, rgba(255, 255, 255, 0));
    background-size: 200px 200px;
    animation: starsDrift 60s linear infinite, staticTwinkle 10s ease-in-out infinite;
}

.stars:after {
    background-image:
        radial-gradient(1px 1px at 75px 50px, white, rgba(255, 255, 255, 0)),
        radial-gradient(1px 1px at 100px 150px, white, rgba(255, 255, 255, 0)),
        radial-gradient(1.5px 1.5px at 199px 220px, white, rgba(255, 255, 255, 0)),
        radial-gradient(2px 2px at 20px 50px, white, rgba(255, 255, 255, 0)),
        radial-gradient(2.5px 2.5px at 120px 120px, white, rgba(255, 255, 255, 0));
    background-size: 250px 250px;
    animation: starsDrift 90s linear infinite, staticTwinkle 15s ease-in-out infinite;
    animation-delay: 0s, 1s;
}

@keyframes staticTwinkle {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

@keyframes starsDrift {
    from { background-position: 0 0; }
    to { background-position: -1000px 1000px; }
}

.star {
    position: absolute;
    border-radius: 50%;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 0 0 20px rgba(255, 255, 255, 0.5);
    pointer-events: none;
    z-index: -1;
    will-change: transform, opacity;
    animation: fallingStar linear infinite, twinkle ease-in-out infinite;
}

.star.small {
    width: 1px;
    height: 1px;
    animation-duration: 50s, 3s;
}

.star.medium {
    width: 2px;
    height: 2px;
    animation-duration: 100s, 5s;
}

.star.large {
    width: 3px;
    height: 3px;
    animation-duration: 150s, 7s;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

@keyframes fallingStar {
    from { transform: translate(0, 0); }
    to { transform: translate(-2000px, 2000px); }
}

.shooting-star {
    position: absolute;
    width: 80px;
    height: 2px;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
    transform: rotate(135deg);
    border-radius: 999px;
    filter: drop-shadow(0 0 6px rgba(105, 155, 255, 1));
    pointer-events: none;
    z-index: -1;
    animation: shootingStar 3s linear forwards;
}

@keyframes shootingStar {
    0% {
        transform: translateX(-100px) translateY(0) rotate(135deg);
        opacity: 0;
    }
    10% { opacity: 1; }
    70% { opacity: 1; }
    100% {
        transform: translateX(calc(100vw + 100px)) translateY(calc(100vh + 100px)) rotate(135deg);
        opacity: 0;
    }
}

@media (max-width: 768px) {
    body.has-stars {
        background-attachment: scroll;
        background-size: cover;
    }

    .stars:before {
        background-size: 150px 150px;
        animation: starsDrift 40s linear infinite, staticTwinkle 15s ease-in-out infinite;
        background-image:
            radial-gradient(1px 1px at 25px 5px, white, rgba(255, 255, 255, 0)),
            radial-gradient(1px 1px at 50px 25px, white, rgba(255, 255, 255, 0)),
            radial-gradient(1px 1px at 125px 20px, white, rgba(255, 255, 255, 0)),
            radial-gradient(1.5px 1.5px at 50px 75px, white, rgba(255, 255, 255, 0)),
            radial-gradient(2px 2px at 15px 125px, white, rgba(255, 255, 255, 0));
    }

    .stars:after {
        background-size: 200px 200px;
        animation: starsDrift 60s linear infinite, staticTwinkle 20s ease-in-out infinite;
        animation-delay: 0s, 2s;
        background-image:
            radial-gradient(1px 1px at 75px 50px, white, rgba(255, 255, 255, 0)),
            radial-gradient(1px 1px at 100px 150px, white, rgba(255, 255, 255, 0)),
            radial-gradient(1.5px 1.5px at 199px 220px, white, rgba(255, 255, 255, 0)),
            radial-gradient(2px 2px at 20px 50px, white, rgba(255, 255, 255, 0));
    }

    .star {
        display: none;
    }

    .shooting-star {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .stars:before,
    .stars:after {
        animation: staticTwinkle 20s linear infinite;
    }

    .star,
    .shooting-star {
        display: none;
    }
}
