.loader-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(
        135deg,
        rgba(212, 175, 55, 0.95),
        rgba(52, 219, 191, 0.95),
        rgba(250, 250, 250, 0.95)
    );
    z-index: 9999;
    transition: opacity 0.5s ease-in-out, visibility 0.5s;
    backdrop-filter: blur(12px);
    margin: 0;
    padding: 0;
}

.car-loader {
    position: relative;
    width: 380px;
    height: 220px;
    margin: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    transform: translateY(15%);
}

.loading-text {
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-shadow: 
        0 0 8px rgba(255, 255, 255, 0.7),
        0 0 15px rgba(255, 215, 0, 0.5);
    text-align: center;
    margin-top: 50px;
    margin-bottom: 30px;
    width: 100%;
    font-family: 'Arial', sans-serif;
    text-transform: uppercase;
    animation: textPulse 1.5s ease-in-out infinite alternate;
}

.loader-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.road {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: linear-gradient(to bottom, #222, #111);
    border-bottom-left-radius: 25px;
    border-bottom-right-radius: 25px;
    box-shadow: 
        inset 0 -10px 20px rgba(0, 0, 0, 0.4),
        0 5px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transform: translateY(10px);
}

.road-line {
    position: absolute;
    top: 50%;
    left: -100%;
    transform: translateY(-50%);
    width: 100px;
    height: 10px;
    background: linear-gradient(90deg, transparent, #ff0, #ff0, transparent);
    border-radius: 5px;
    animation: roadMove 0.7s linear infinite;
    filter: drop-shadow(0 0 5px #ff0);
    opacity: 0.9;
}

.road-line:nth-child(2) { 
    animation-delay: 0.35s;
}

.car-body {
    position: relative;
    width: 220px;
    height: 90px;
    background: linear-gradient(
        135deg,
        #cc0d9c 0%,
        #e20303 30%,
        #c50766 70%,
        #a54646 100%
    );
    border-radius: 30px 60px 15px 30px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.7),
        inset 0 5px 10px rgba(255, 255, 255, 0.3),
        inset 0 -5px 10px rgba(0, 0, 0, 0.4);
    z-index: 10;
    animation: carBounce 0.4s ease-in-out infinite alternate;
    margin-bottom: 25px;
    border: 2px solid #000;
    transform-origin: bottom center;
    overflow: visible;
}

.car-roof {
    position: absolute;
    top: -20px;
    left: 60px;
    width: 120px;
    height: 45px;
    background: linear-gradient(to top, #222, #444);
    border-radius: 20px 70px 0 0;
    border: 2px solid #000;
    border-bottom: none;
    z-index: 11;
    box-shadow: inset 0 -8px 15px rgba(0, 0, 0, 0.5);
}

.car-window {
    position: absolute;
    top: 10px;
    left: 70px;
    width: 50px;
    height: 30px;
    background: linear-gradient(
        135deg,
        rgba(100, 200, 255, 0.3),
        rgba(0, 50, 100, 0.7)
    );
    border-radius: 10px;
    border: 1px solid #000;
    z-index: 12;
    transform: skewX(-25deg);
    box-shadow: 
        inset 0 0 15px rgba(255, 255, 255, 0.5),
        0 0 10px rgba(100, 200, 255, 0.3);
}

.car-window.back {
    left: 130px;
    width: 40px;
    transform: skewX(25deg);
}

.headlight {
    position: absolute;
    top: 45px;
    right: -10px;
    width: 25px;
    height: 15px;
    background: linear-gradient(to right, #fff, #ffeb3b);
    border-radius: 10px 0 0 10px;
    box-shadow: 0 0 20px #ffeb3b;
    z-index: 13;
    animation: headlightFlicker 2s infinite;
}

.taillight {
    position: absolute;
    top: 45px;
    left: -10px;
    width: 25px;
    height: 15px;
    background: linear-gradient(to right, #f00, #ff5252);
    border-radius: 0 10px 10px 0;
    box-shadow: 0 0 20px #ff0000;
    z-index: 13;
    animation: taillightPulse 1.5s infinite;
}

.spoiler {
    position: absolute;
    top: -25px;
    left: 20px;
    width: 40px;
    height: 12px;
    background: linear-gradient(to right, #0b07e4, #5d5dff);
    border-radius: 5px 5px 0 0;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.5);
    z-index: 14;
    transform: rotate(-15deg);
}

.spoiler::before, .spoiler::after {
    content: '';
    position: absolute;
    top: 12px;
    width: 5px;
    height: 15px;
    background: linear-gradient(to bottom, #333, #000);
    border-radius: 3px;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.3);
}

.spoiler::before { left: 5px; }
.spoiler::after { right: 5px; }

.exhaust {
    position: absolute;
    bottom: 10px;
    left: -15px;
    width: 20px;
    height: 12px;
    background: linear-gradient(to right, #555, #333);
    border-radius: 8px 0 0 8px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
    z-index: 15;
    animation: exhaustSmoke 1.5s linear infinite;
    opacity: 0;
    transform-origin: center right;
}

.wheel {
    position: absolute;
    bottom: -15px;
    width: 45px;
    height: 45px;
    background: radial-gradient(
        circle at center,
        #000 40%,
        #333 60%,
        #555 80%,
        #777 100%
    );
    border-radius: 50%;
    border: 8px solid #222;
    box-shadow: 
        inset 0 0 20px rgba(0, 0, 0, 0.8),
        0 8px 15px rgba(0, 0, 0, 0.6);
    z-index: 20;
    animation: wheelRotate 0.3s linear infinite;
}

.wheel-front {
    left: 30px;
}

.wheel-back {
    right: 30px;
}

.wheel::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(0deg);
    width: 25px;
    height: 25px;
    background: linear-gradient(45deg, #ddd, #999);
    border-radius: 50%;
    border: 4px solid #444;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    animation: wheelSpokeRotate 0.3s linear infinite;
}

.wheel::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3px;
    height: 30px;
    background: linear-gradient(to bottom, #777, #999, #777);
    transform-origin: top center;
    transform: translate(-50%, -50%) rotate(45deg);
    z-index: 21;
    animation: wheelSpokeRotate 0.3s linear infinite;
}

.wheel.wheel-back::after {
    transform: translate(-50%, -50%) rotate(135deg);
}

.car-shadow {
    position: absolute;
    bottom: 0;
    width: 180px;
    height: 20px;
    background: radial-gradient(
        ellipse at center,
        rgba(0, 0, 0, 0.5) 0%,
        rgba(0, 0, 0, 0) 70%
    );
    filter: blur(15px);
    z-index: 5;
    animation: shadowScale 0.4s ease-in-out infinite alternate;
}

.volume-button {
    position: absolute;
    top: 25px;
    right: 25px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 12px;
    border-radius: 50%;
    font-size: 1.4rem;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 10001;
    backdrop-filter: blur(5px);
}

.volume-button:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

.volume-button:active {
    transform: scale(0.95);
}

/* New animations */
@keyframes textPulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.05); opacity: 1; }
}

@keyframes headlightFlicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

@keyframes taillightPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

@keyframes roadMove {
    0% { transform: translateY(-50%) translateX(0%); }
    100% { transform: translateY(-50%) translateX(200%); }
}

@keyframes carBounce {
    0% { transform: translateY(0) rotateZ(0deg); }
    100% { transform: translateY(-12px) rotateZ(1.5deg); }
}

@keyframes wheelRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes wheelSpokeRotate {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes shadowScale {
    0% { transform: scaleX(1) scaleY(0.8); opacity: 0.4; }
    100% { transform: scaleX(0.9) scaleY(0.6); opacity: 0.2; }
}

@keyframes exhaustSmoke {
    0% { transform: translateX(0) scale(0.8); opacity: 0; }
    20% { opacity: 0.8; transform: translateX(-5px) scale(1); }
    100% { transform: translateX(-50px) scale(1.5); opacity: 0; }
}

/* Responsive design */
@media (max-width: 768px) {
    .car-loader {
        width: 300px;
        height: 180px;
        transform: translateY(10%);
    }
    
    .loading-text {
        font-size: 1.6rem;
        margin-top: 40px;
        margin-bottom: 20px;
    }
    
    .car-body {
        width: 180px;
        height: 75px;
        margin-bottom: 20px;
    }
    
    .car-roof {
        width: 100px;
        left: 50px;
    }
    
    .wheel {
        width: 38px;
        height: 38px;
    }
    
    .car-shadow {
        width: 150px;
    }
}

@media (max-width: 768px) {
    .car-loader {
        width: 300px;
        height: 180px;
        transform: translateY(0); /* Elimina el desplazamiento vertical en móviles */
        justify-content: center; /* Centra el contenido verticalmente */
    }
    
    .loading-text {
        font-size: 1.6rem;
        margin-top: 30px; /* Reduce el margen superior */
        margin-bottom: 15px;
    }
    
    .car-body {
        width: 180px;
        height: 75px;
        margin-bottom: 15px;
    }
    
    .road {
        height: 50px; /* Reduce la altura de la carretera */
    }
    
    /* Mantén el resto de ajustes para móviles */
    .car-roof {
        width: 100px;
        left: 50px;
    }
    
    .wheel {
        width: 38px;
        height: 38px;
    }
    
    .car-shadow {
        width: 150px;
    }
}

@media (max-width: 480px) {
    .car-loader {
        width: 260px;
        height: 150px; /* Altura más compacta */
        transform: translateY(0); /* Asegura que no haya desplazamiento */
    }
    
    .loading-text {
        font-size: 1.3rem;
        margin-top: 25px;
        letter-spacing: 2px;
    }
    
    .car-body {
        width: 150px;
        height: 60px;
        margin-bottom: 10px;
    }
    
    .road {
        height: 40px;
    }
    

}