/* Loading Screen Styles */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0a0a0a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    overflow: hidden;
    /* Removed screen shake - was causing white border flicker */
    /* animation: screenShake 2s ease-out infinite; */
}

.loading-screen::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(163, 224, 2, 0.1) 0%, transparent 70%);
    animation: rotateBackground 20s linear infinite;
}

/* Removed flash effect - was causing white border flicker */
/* .loading-screen::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(163, 224, 2, 0.9) 0%, rgba(7, 199, 189, 0.5) 20%, transparent 40%);
    opacity: 0;
    animation: explosionFlash 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
    pointer-events: none;
} */

.loading-container {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Logo Container */
.loading-logo {
    position: relative;
    width: 200px;
    height: 240px;
    transform-style: preserve-3d;
    perspective: 1000px;
    /* Add shake to logo only, not the whole screen */
    animation: logoShake 2s ease-out infinite;
}

.loading-logo svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 20px rgba(163, 224, 2, 0.5));
}

/* Transformer-style ASSEMBLY Animation - 4 SNAP Assembly! */
.loading-logo svg g path {
    transform-origin: center;
}

/* SNAP 1 - First wave (0-20%) 咔！*/
.loading-logo svg g path:nth-child(1),
.loading-logo svg g path:nth-child(2),
.loading-logo svg g path:nth-child(3),
.loading-logo svg g path:nth-child(4),
.loading-logo svg g path:nth-child(5),
.loading-logo svg g path:nth-child(6),
.loading-logo svg g path:nth-child(7),
.loading-logo svg g path:nth-child(8),
.loading-logo svg g path:nth-child(9),
.loading-logo svg g path:nth-child(10) {
    animation: snap1 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}

/* SNAP 2 - Second wave (20-40%) 咔！*/
.loading-logo svg g path:nth-child(11),
.loading-logo svg g path:nth-child(12),
.loading-logo svg g path:nth-child(13),
.loading-logo svg g path:nth-child(14),
.loading-logo svg g path:nth-child(15),
.loading-logo svg g path:nth-child(16),
.loading-logo svg g path:nth-child(17),
.loading-logo svg g path:nth-child(18),
.loading-logo svg g path:nth-child(19),
.loading-logo svg g path:nth-child(20) {
    animation: snap2 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}

/* SNAP 3 - Third wave (40-60%) 咔！*/
.loading-logo svg g path:nth-child(21),
.loading-logo svg g path:nth-child(22),
.loading-logo svg g path:nth-child(23),
.loading-logo svg g path:nth-child(24),
.loading-logo svg g path:nth-child(25),
.loading-logo svg g path:nth-child(26),
.loading-logo svg g path:nth-child(27),
.loading-logo svg g path:nth-child(28),
.loading-logo svg g path:nth-child(29),
.loading-logo svg g path:nth-child(30) {
    animation: snap3 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}

/* SNAP 4 - Final wave (60-80%) 咔！*/
.loading-logo svg g path:nth-child(n+31) {
    animation: snap4 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}

/* Glow Effect */
.loading-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(163, 224, 2, 0.3) 0%, transparent 70%);
    animation: pulse 2s ease-in-out infinite;
    border-radius: 50%;
}

/* Loading Text */
.loading-text {
    position: absolute;
    bottom: -80px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    font-weight: 600;
    color: #a3e002;
    letter-spacing: 4px;
    text-transform: uppercase;
    animation: textPulse 1.5s ease-in-out infinite;
}

.loading-text::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

/* Progress Bar */
.loading-progress {
    position: absolute;
    bottom: -120px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 3px;
    background: rgba(163, 224, 2, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #a3e002, #07c7bd);
    animation: progressBar 3s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(163, 224, 2, 0.5);
}

/* Fade Out Animation */
.loading-screen.fade-out {
    animation: fadeOut 0.8s ease-out forwards;
}

/* Keyframes */
@keyframes rotateBackground {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Removed - no longer needed */
/* @keyframes explosionFlash {
    0%, 78% {
        opacity: 0;
        transform: scale(0.5);
    }
    80% {
        opacity: 1;
        transform: scale(2.5);
    }
    82% {
        opacity: 0.8;
        transform: scale(3.5);
    }
    84% {
        opacity: 0.4;
        transform: scale(4.5);
    }
    86% {
        opacity: 0;
        transform: scale(5);
    }
    87%, 100% {
        opacity: 0;
        transform: scale(0.5);
    }
} */

/* SNAP 1 - First wave flies in (0-20%) 咔！*/
@keyframes snap1 {
    0% {
        transform: translate(-200px, -200px) scale(0.5);
        opacity: 0;
    }
    10% {
        transform: translate(-100px, -100px) scale(0.7);
        opacity: 0.5;
    }
    18% {
        transform: translate(-10px, -10px) scale(0.95);
        opacity: 1;
    }
    20% {
        transform: translate(0, 0) scale(1.1);
        opacity: 1;
    }
    22% {
        transform: translate(0, 0) scale(0.98);
        opacity: 1;
    }
    24%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
}

/* SNAP 2 - Second wave flies in (20-40%) 咔！*/
@keyframes snap2 {
    0%, 20% {
        transform: translate(200px, -200px) scale(0.5);
        opacity: 0;
    }
    30% {
        transform: translate(100px, -100px) scale(0.7);
        opacity: 0.5;
    }
    38% {
        transform: translate(10px, -10px) scale(0.95);
        opacity: 1;
    }
    40% {
        transform: translate(0, 0) scale(1.1);
        opacity: 1;
    }
    42% {
        transform: translate(0, 0) scale(0.98);
        opacity: 1;
    }
    44%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
}

/* SNAP 3 - Third wave flies in (40-60%) 咔！*/
@keyframes snap3 {
    0%, 40% {
        transform: translate(-200px, 200px) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translate(-100px, 100px) scale(0.7);
        opacity: 0.5;
    }
    58% {
        transform: translate(-10px, 10px) scale(0.95);
        opacity: 1;
    }
    60% {
        transform: translate(0, 0) scale(1.1);
        opacity: 1;
    }
    62% {
        transform: translate(0, 0) scale(0.98);
        opacity: 1;
    }
    64%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
}

/* SNAP 4 - Final wave flies in (60-80%) 咔！*/
@keyframes snap4 {
    0%, 60% {
        transform: translate(200px, 200px) scale(0.5);
        opacity: 0;
    }
    70% {
        transform: translate(100px, 100px) scale(0.7);
        opacity: 0.5;
    }
    78% {
        transform: translate(10px, 10px) scale(0.95);
        opacity: 1;
    }
    80% {
        transform: translate(0, 0) scale(1.1);
        opacity: 1;
    }
    82% {
        transform: translate(0, 0) scale(0.98);
        opacity: 1;
    }
    84%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 20% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.2;
    }
    40% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.3;
    }
    60% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.4;
    }
    80% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0.8;
    }
    85% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 0.6;
    }
    90%, 100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0.4;
    }
}

@keyframes textPulse {
    0%, 20% {
        opacity: 0.6;
        transform: translateX(-50%) scale(0.95);
        letter-spacing: 2px;
    }
    40% {
        opacity: 0.7;
        transform: translateX(-50%) scale(0.97);
        letter-spacing: 3px;
    }
    60% {
        opacity: 0.85;
        transform: translateX(-50%) scale(0.99);
        letter-spacing: 3.5px;
    }
    80% {
        opacity: 1;
        transform: translateX(-50%) scale(1.12);
        letter-spacing: 8px;
    }
    85% {
        opacity: 1;
        transform: translateX(-50%) scale(0.96);
        letter-spacing: 3px;
    }
    90%, 100% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
        letter-spacing: 4px;
    }
}

@keyframes dots {
    0%, 25% { content: ''; }
    50% { content: '.'; }
    75% { content: '..'; }
    85%, 100% { content: '...'; }
}

@keyframes progressBar {
    0%, 20% {
        width: 25%;
        transform: scaleX(1);
        opacity: 0.6;
    }
    40% {
        width: 50%;
        transform: scaleX(1);
        opacity: 0.8;
    }
    60% {
        width: 75%;
        transform: scaleX(1);
        opacity: 0.9;
    }
    80% {
        width: 100%;
        transform: scaleX(1.05);
        opacity: 1;
    }
    85% {
        width: 100%;
        transform: scaleX(0.98);
        opacity: 1;
    }
    90%, 100% {
        width: 100%;
        transform: scaleX(1);
        opacity: 1;
    }
}

@keyframes fadeOut {
    0% {
        opacity: 1;
        visibility: visible;
    }
    100% {
        opacity: 0;
        visibility: hidden;
    }
}

/* Logo shake effect for 4 SNAP moments - smaller shake, no white borders */
@keyframes logoShake {
    0%, 19% {
        transform: translate(0, 0);
    }
    /* SNAP 1 - 20% 咔！*/
    20% {
        transform: translate(-2px, 2px);
    }
    21% {
        transform: translate(2px, -2px);
    }
    22% {
        transform: translate(-1px, 1px);
    }
    23%, 39% {
        transform: translate(0, 0);
    }
    /* SNAP 2 - 40% 咔！*/
    40% {
        transform: translate(2px, -2px);
    }
    41% {
        transform: translate(-2px, 2px);
    }
    42% {
        transform: translate(1px, -1px);
    }
    43%, 59% {
        transform: translate(0, 0);
    }
    /* SNAP 3 - 60% 咔！*/
    60% {
        transform: translate(-2px, -2px);
    }
    61% {
        transform: translate(2px, 2px);
    }
    62% {
        transform: translate(-1px, -1px);
    }
    63%, 79% {
        transform: translate(0, 0);
    }
    /* SNAP 4 - 80% 咔！*/
    80% {
        transform: translate(3px, 3px);
    }
    81% {
        transform: translate(-3px, -3px);
    }
    82% {
        transform: translate(2px, -2px);
    }
    83%, 100% {
        transform: translate(0, 0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .loading-container {
        width: 200px;
        height: 200px;
    }

    .loading-logo {
        width: 150px;
        height: 180px;
    }

    .loading-text {
        font-size: 14px;
        letter-spacing: 2px;
        bottom: -60px;
    }

    .loading-progress {
        width: 150px;
        bottom: -90px;
    }
}

