/* Loading Screen Styles */
#loadingScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: 
        repeating-linear-gradient(
            0deg,
            #000000 0px,
            #000000 2px,
            #111111 2px,
            #111111 4px
        ),
        repeating-linear-gradient(
            90deg,
            #000000 0px,
            #000000 2px,
            #0a0a0a 2px,
            #0a0a0a 4px
        ),
        radial-gradient(circle at 25% 25%, #ffffff 1px, transparent 1px),
        radial-gradient(circle at 75% 75%, #cccccc 1px, transparent 1px),
        #000000;
    background-size: 4px 4px, 4px 4px, 40px 40px, 60px 60px, 100% 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.5s ease-out;
    animation: 
        pixelScanlines 0.1s linear infinite,
        boostEffect 5s ease-in forwards;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

@keyframes pixelScanlines {
    0% { 
        background-position: 0 0, 0 0, 0 0, 0 0, 0 0;
    }
    100% { 
        background-position: 0 4px, 4px 0, 5px 5px, -5px -5px, 0 0;
    }
}

@keyframes boostEffect {
    0% { 
        animation-duration: 0.1s;
        filter: brightness(1);
    }
    60% { 
        animation-duration: 0.08s;
        filter: brightness(1.1);
    }
    80% { 
        animation-duration: 0.05s;
        filter: brightness(1.3);
    }
    90% { 
        animation-duration: 0.03s;
        filter: brightness(1.5);
    }
    95% { 
        animation-duration: 0.02s;
        filter: brightness(1.8);
    }
    100% { 
        animation-duration: 0.01s;
        filter: brightness(2);
    }
}

#loadingScreen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-logo {
    max-width: 400px;
    width: 90%;
    height: auto;
    filter: invert(1) contrast(2) brightness(1.5);
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    animation: 
        pixelDraw 3s ease-in-out forwards,
        pixelGlitch 0.3s infinite 3.5s;
    clip-path: inset(100% 0 0 0);
}

@keyframes pixelDraw {
    0% {
        clip-path: inset(100% 0 0 0);
        filter: invert(1) contrast(3) brightness(2);
        transform: scale(0.8);
    }
    10% {
        clip-path: inset(90% 0 0 0);
        filter: invert(1) contrast(2.5) brightness(1.8);
        transform: scale(0.9);
    }
    25% {
        clip-path: inset(75% 0 0 0);
        filter: invert(1) contrast(2.8) brightness(2.2);
        transform: scale(1.1);
    }
    50% {
        clip-path: inset(50% 0 0 0);
        filter: invert(1) contrast(3) brightness(2.5);
        transform: scale(1.05);
    }
    75% {
        clip-path: inset(25% 0 0 0);
        filter: invert(1) contrast(2.5) brightness(1.8);
        transform: scale(0.95);
    }
    100% {
        clip-path: inset(0% 0 0 0);
        filter: invert(1) contrast(2) brightness(1.5);
        transform: scale(1);
    }
}

@keyframes pixelGlitch {
    0%, 90% {
        transform: translateX(0);
    }
    10% {
        transform: translateX(-2px);
    }
    20% {
        transform: translateX(2px);
    }
    30% {
        transform: translateX(-1px);
    }
    40% {
        transform: translateX(1px);
    }
}

/* Hide main content initially */
#pageContent {
    opacity: 0;
    transition: opacity 0.5s ease-in;
}

#pageContent.visible {
    opacity: 1;
}

/* 8-bit style loading dots */
.loading-dots {
    position: absolute;
    bottom: 25%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Courier New', monospace;
    font-size: 20px;
    font-weight: bold;
    color: #ffffff;
    image-rendering: pixelated;
    letter-spacing: 2px;
}

.loading-dots .dots {
    animation: blinkDots 1.5s infinite;
}

@keyframes blinkDots {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Pixel Particles */
.pixel-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.pixel-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #ffffff;
    animation: 
        pixelFloat 3s infinite linear,
        particleBoost 5s ease-in forwards;
    image-rendering: pixelated;
}

.pixel-particle:nth-child(2n) { 
    background: #cccccc; 
    animation-delay: -1s;
    animation-duration: 4s, 5s;
}
.pixel-particle:nth-child(3n) { 
    background: #888888; 
    animation-delay: -2s;
    animation-duration: 2.5s, 5s;
}
.pixel-particle:nth-child(4n) { 
    background: #ffffff; 
    animation-delay: -0.5s;
    animation-duration: 3.5s, 5s;
}

@keyframes pixelFloat {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-20px) rotate(360deg);
        opacity: 0;
    }
}

@keyframes particleBoost {
    0% { 
        animation-duration: 3s;
        filter: brightness(1);
    }
    60% { 
        animation-duration: 2s;
        filter: brightness(1.2);
    }
    80% { 
        animation-duration: 1s;
        filter: brightness(1.5);
    }
    90% { 
        animation-duration: 0.5s;
        filter: brightness(1.8);
    }
    100% { 
        animation-duration: 0.2s;
        filter: brightness(2);
    }
}
