
.preloader {
    position: fixed;
    inset: 0;
    z-index: 99999;

    display: flex;
    justify-content: center;
    align-items: center;

    background:
        radial-gradient(circle at 50% 45%,
            rgba(255, 223, 0, 0.28) 0%,
            rgba(0, 156, 59, 0.24) 22%,
            rgba(0, 39, 118, 0.35) 48%,
            rgba(8, 18, 32, 0.92) 100%
        ),
        linear-gradient(135deg,
            rgba(0, 156, 59, 0.45),
            rgba(0, 39, 118, 0.75)
        );

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.preloader::before {
    content: "";
    position: absolute;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background:
        radial-gradient(circle,
            rgba(255, 223, 0, 0.34),
            rgba(0, 156, 59, 0.16) 45%,
            transparent 70%
        );
    filter: blur(22px);
}

.loader-ball {
    width: 120px;
    height: 120px;
    object-fit: contain;
    animation: ballRotate 1s linear infinite;
    filter: drop-shadow(0 0 25px rgba(255, 255, 255, 0.35));
}
.loader-ball {
    animation: ballRotate 10s linear infinite;
}
.loader-ball {
    animation: ballRotate 1s linear infinite !important;
}
@keyframes ballRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}


    .loader-box:nth-child(1) {
        top: 0;
        left: 0;
        animation-delay: 0s;
    }

    .loader-box:nth-child(2) {
        top: 0;
        right: 0;
        animation-delay: 0.5s;
    }

    .loader-box:nth-child(3) {
        bottom: 0;
        right: 0;
        animation-delay: 1s;
    }

    .loader-box:nth-child(4) {
        bottom: 0;
        left: 0;
        animation-delay: 1.5s;
    }

    @keyframes move {

        0%,
        100% {
            transform: scale(1) rotate(0deg);
            opacity: 1;
        }

        50% {
            transform: scale(0.5) rotate(90deg);
            opacity: 0.5;
            box-shadow: 0 0 20px rgba(239, 68, 68, 0.8);
        }
    }

    /* Particle effects */
    .particle {
    position: absolute;
    background: none;   /* xoá màu */
    border-radius: 0;   /* bỏ hình tròn */
    pointer-events: none;
}

    .particle {
    position: absolute;
    background: none !important;
    border-radius: 0 !important;
    opacity: 0;
    animation: floatParticle 15s infinite linear;
}
    .particle {
      filter: drop-shadow(0 8px 15px rgba(0,0,0,0.25));
}
    @keyframes floatParticle {
        0% {
            transform: translateY(0) translateX(0) rotate(0deg);
            opacity: 0;
        }

        10% {
            opacity: 0.7;
        }

        90% {
            opacity: 0.3;
        }

        100% {
            transform: translateY(-100vh) translateX(100px) rotate(360deg);
            opacity: 0;
        }
    }

    /* Enhanced Custom Animations */
    @keyframes float {
        0% {
            transform: translateY(0px) rotate(0deg);
        }

        33% {
            transform: translateY(-10px) rotate(3deg);
        }

        66% {
            transform: translateY(5px) rotate(-3deg);
        }

        100% {
            transform: translateY(0px) rotate(0deg);
        }
    }

    @keyframes glow {
        0% {
            box-shadow: 0 0 5px #ef4444, 0 0 10px rgba(239, 68, 68, 0.3);
            transform: scale(1);
        }

        50% {
            box-shadow: 0 0 20px #ef4444, 0 0 30px rgba(239, 68, 68, 0.6);
            transform: scale(1.05);
        }

        100% {
            box-shadow: 0 0 5px #ef4444, 0 0 10px rgba(239, 68, 68, 0.3);
            transform: scale(1);
        }
    }

    @keyframes bounceGame {

        0%,
        100% {
            transform: scale(1) rotate(0deg);
        }

        25% {
            transform: scale(1.1) rotate(2deg);
        }

        50% {
            transform: scale(1.15) rotate(0deg);
        }

        75% {
            transform: scale(1.1) rotate(-2deg);
        }
    }

    @keyframes pulseText {

        0%,
        100% {
            transform: scale(1);
            text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
        }

        50% {
            transform: scale(1.05);
            text-shadow: 0 0 15px rgba(255, 255, 255, 0.8),
                0 0 25px rgba(239, 68, 68, 0.6);
        }
    }

.play {
    animation: bounceGame 1.5s infinite, float 3s ease-in-out infinite;
    background: transparent !important;
    box-shadow: none !important;
}

    .play:hover {
        transform: scale(1.1) rotate(5deg);
        box-shadow: 0 15px 30px rgba(239, 68, 68, 0.6);
    }

    .restart {
        animation: bounceGame 1.5s infinite;
       
    }

    .score-pulse {
        animation: glow 2s infinite;
        background: linear-gradient(145deg, #1e293b, #0f172a);
        border: 2px solid #ef4444;
        box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
    }

    /* Enhanced hero selection animation */
    .hero-option {
        transition: all 0.3s ease;
        transform-style: preserve-3d;
        border: 2px solid transparent;
    }

    .hero-option:hover {
        transform: scale(1.1) rotateY(15deg);
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.8);
        border: 2px solid #ef4444;
    }

    /* Enhanced Game elements styling */
    .platform {
        box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.5);
        background: linear-gradient(to top, #644406, #334155);
        border-top: 3px solid #ef4444;
    }

    .stick {
        transition: height 0.1s linear, transform 0.3s ease;
        background: linear-gradient(to right, #ef4444, #f59e0b);
        box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
    }

    /* Enhanced Menu background effect */
.menu-bg {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    backdrop-filter: none !important;
}

    /* Enhanced Title gradient */
    .gradient-text {
        background: linear-gradient(45deg, #ef4444, #f59e0b, #ef4444);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-size: 300% 300%;
        animation: gradient 3s ease infinite, pulseText 2s ease-in-out infinite;
    }

    @keyframes gradient {
        0% {
            background-position: 0% 50%;
        }

        50% {
            background-position: 100% 50%;
        }

        100% {
            background-position: 0% 50%;
        }
    }

    /* Menu item animations */
    .menu-item {
        transition: all 0.3s ease;
        transform: translateY(0);
    }

    .menu-item:hover {
        transform: translateY(-5px) scale(1.05);
        box-shadow: 0 10px 20px rgba(239, 68, 68, 0.3);
    }

    /* Hero character animation */
    @keyframes heroIdle {

        0%,
        100% {
            transform: translateY(0);
        }

        50% {
            transform: translateY(-5px);
        }
    }

  .ball {
    width: 100px;
    height: 120px;
    animation: heroIdle 2s ease-in-out infinite;

    background-size: contain;
    background-repeat: no-repeat;
    background-position: bottom;
}
.restart-img {
    transition: 0.3s;
}

.restart-img:hover {
    transform: scale(1.1);
    filter: brightness(1.2);
}
    /* Success animation */
    @keyframes success {
        0% {
            transform: scale(1);
            box-shadow: 0 0 0 rgba(239, 68, 68, 0.5);
        }

        50% {
            transform: scale(1.2);
            box-shadow: 0 0 30px rgba(239, 68, 68, 0.8);
        }

        100% {
            transform: scale(1);
            box-shadow: 0 0 0 rgba(239, 68, 68, 0.5);
        }
    }

    .success-animation {
        animation: success 0.5s ease-in-out;
    }

    /* Falling animation */
    @keyframes fall {
        0% {
            transform: rotate(0deg);
            opacity: 1;
        }

        100% {
            transform: rotate(90deg) translateY(50vh);
            opacity: 0;
        }
    }

    /* Responsive adjustments */
    @media (max-width: 768px) {
        .gradient-text {
            font-size: 40px;
        }

        .play,
        .restart {
            width: 120px;
            height: 120px;
            line-height: 120px;
        }
    }
body {
    background-size: 100%;
    background-position: center;
    background-repeat: no-repeat;
}

    /* FIX: Thêm class .show để điều khiển hiển thị Modal từ JavaScript */
    /* Modal show state */
    #level2Modal.show {
        display: flex !important;
        opacity: 1;
        pointer-events: auto;
    }

    #level2Modal.show > div {
        transform: scale(1);
    }
