:root {
    --torch-flame-primary: #FFD700;
    --torch-flame-secondary: #FF4500;
    --torch-flame-tertiary: #FF1493;
    --torch-flame-quaternary: #4169E1;
    --torch-flame-core: #FFFFFF;
    --torch-handle: #4A4A4A;
    --torch-glow: rgba(255, 215, 0, 0.3);
}

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-olympic);
    background-size: 400% 400%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: gradientFlow 5s ease infinite;
}

.torch-container {
    position: relative;
    width: 100px;
    height: 200px;
    transform-origin: center bottom;
    animation: torchGrow 2s ease-out forwards;
}

.torch {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 120px;
    background: var(--torch-handle);
    border-radius: 8px;
}

.flame {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 80px;
    background: var(--torch-flame-primary);
    border-radius: 50% 50% 20% 20%;
    opacity: 0;
    animation: flameGlow 1s ease-in forwards;
    box-shadow: 0 0 20px var(--torch-flame-primary);
}

.flame::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 15%;
    width: 70%;
    height: 70%;
    background: linear-gradient(45deg, var(--torch-flame-secondary), var(--torch-flame-tertiary));
    border-radius: 50% 50% 20% 20%;
    filter: blur(5px);
    animation: innerFlame 1.2s ease-in-out infinite;
}

.flame::after {
    content: '';
    position: absolute;
    top: 20%;
    left: 25%;
    width: 50%;
    height: 50%;
    background: linear-gradient(to right, var(--torch-flame-core), var(--torch-flame-quaternary));
    border-radius: 50%;
    filter: blur(3px);
    animation: coreFlame 0.8s ease-in-out infinite;
}

.torch {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 120px;
    background: var(--torch-handle);
    border-radius: 8px;
    box-shadow: 0 0 15px var(--torch-glow);
    animation: torchGlow 2s ease-in-out infinite;
}

.particles {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 100px;
    pointer-events: none;
}

.particle {
    position: absolute;
    background: var(--torch-flame-primary);
    border-radius: 50%;
    width: 4px;
    height: 4px;
    opacity: 0;
    animation: particleRise 2s ease-out infinite;
}

.loading-text {
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    color: var(--white);
    font-size: var(--font-xl);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0;
    animation: textFadeIn 1s ease-in forwards 0.5s;
}

@keyframes torchGrow {
    0% {
        transform: scale(0.5);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes flameGlow {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0.5);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
}

@keyframes innerFlame {
    0%, 100% {
        transform: scale(0.9) rotate(-2deg);
        background-position: 0% 50%;
    }
    50% {
        transform: scale(1.1) rotate(2deg);
        background-position: 100% 50%;
    }
}

@keyframes coreFlame {
    0%, 100% {
        transform: scale(0.8);
        opacity: 0.8;
        background-position: 0% 50%;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
        background-position: 100% 50%;
    }
}

@keyframes torchGlow {
    0%, 100% {
        box-shadow: 0 0 15px var(--torch-glow);
    }
    50% {
        box-shadow: 0 0 25px var(--torch-glow);
    }
}

@keyframes particleRise {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 0;
    }
    20% {
        opacity: 0.8;
    }
    100% {
        transform: translate(var(--x, 20px), -100px) scale(0);
        opacity: 0;
    }
}

@keyframes textFadeIn {
    0% {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.loading-screen.loaded {
    animation: fadeOut 0.5s ease-out forwards;
}

.loading-screen.loaded .torch-container {
    animation: torchFinale 0.5s ease-out forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

@keyframes torchFinale {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.5);
    }
    100% {
        transform: scale(0);
    }
}