* { margin: 0; padding: 0; box-sizing: border-box; }

body.loading {
  overflow: hidden !important;
  height: 100vh !important;
  position: fixed !important;
  width: 100% !important;
  top: 0 !important;
  left: 0 !important;
}

/* ===== PANTALLA DE CARGA ===== */
.sky {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%);
    overflow: hidden;
    z-index: 9999;
    transition: opacity 2s ease-in-out;
}

/* ===== ESTRELLAS FUGACES (CORREGIDO) ===== */
.star {
    position: absolute;
    /* Punto base: fuera de pantalla arriba-derecha */
    top: -10px;
    right: -10px;
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(255,255,255,0.1),
                0 0 0 8px rgba(255,255,255,0.1),
                0 0 20px rgba(255,255,255,1);
    /* rotate(315deg) apunta la estrella hacia abajo-izquierda */
    /* translateX(0) al inicio = en su posición base (fuera de pantalla) */
    transform: rotate(315deg) translateX(0);
    opacity: 0;
    animation: animate 3s linear infinite;
}

.star::before {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 300px;
    height: 1px;
    background: linear-gradient(90deg, #fff, transparent);
}

@keyframes animate {
    0% {
        transform: rotate(315deg) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        /* Se mueve diagonalmente hacia abajo-izquierda, saliendo del viewport */
        transform: rotate(315deg) translateX(-150vw);
        opacity: 0;
    }
}

/* Distribución: todas comienzan fuera del viewport (arriba-derecha) */
.star:nth-child(1)  { top: -50px;  right: -100px;  animation-delay: 0s;     animation-duration: 1.5s; }
.star:nth-child(2)  { top: -80px;  right: 50px;    animation-delay: 0.2s;   animation-duration: 3s; }
.star:nth-child(3)  { top: -30px;  right: -50px;   animation-delay: 0.4s;   animation-duration: 2s; }
.star:nth-child(4)  { top: -100px; right: 150px;   animation-delay: 0.6s;   animation-duration: 1.5s; }
.star:nth-child(5)  { top: -60px;  right: 300px;   animation-delay: 0.8s;   animation-duration: 2.5s; }
.star:nth-child(6)  { top: -120px; right: 450px;   animation-delay: 1s;     animation-duration: 3s; }
.star:nth-child(7)  { top: -40px;  right: 600px;   animation-delay: 1.2s;   animation-duration: 1.75s; }
.star:nth-child(8)  { top: -90px;  right: 750px;   animation-delay: 1.4s;   animation-duration: 1.25s; }
.star:nth-child(9)  { top: -70px;  right: 900px;   animation-delay: 0.75s;  animation-duration: 2.25s; }
.star:nth-child(10) { top: -110px; right: 400px;   animation-delay: 2.75s;  animation-duration: 2.75s; }

/* Estrellas de fondo */
.bg-star {
    position: absolute;
    width: 2px; height: 2px;
    background: white;
    border-radius: 50%;
    opacity: 0.3;
    animation: twinkle 2s ease-in-out infinite alternate;
}

@keyframes twinkle {
    0%   { opacity: 0.2; }
    100% { opacity: 0.8; }
}

/* ===== MONEDA 3D ===== */
.coin-scene {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    perspective: 800px;
    z-index: 10;
    transition: all 2.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.coin {
    width: 100px;
    height: 100px;
    position: relative;
    transform-style: preserve-3d;
    animation: spinCoin 3s linear infinite;
}

.coin-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    backface-visibility: hidden;
    overflow: hidden;
}

.coin-face img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.coin-front {
    transform: rotateY(0deg);
}

.coin-back {
    transform: rotateY(180deg);
}

/* Borde metálico de la moneda */
.coin::before {
    content: '';
    position: absolute;
    top: -4px; left: -4px;
    width: calc(100% + 8px);
    height: calc(100% + 8px);
    border-radius: 50%;
    animation: glowPulse 2s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: -1;
}

@keyframes spinCoin {
    0%   { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

@keyframes glowPulse {
    0%   { box-shadow: 0 0 20px rgba(0, 26, 255, 0.3), 0 0 40px rgba(255, 215, 0, 0.1); }
    100% { box-shadow: 0 0 30px rgba(0, 8, 255, 0.5), 0 0 60px rgba(255, 215, 0, 0.2); }
}

/* ===== RESPONSIVE MÓVIL OPTIMIZADO ===== */
@media(max-width:768px){
    .coin{width:70px;height:70px}
    .coin-face img{width:70px;height:70px}
    .coin::before{top:-3px;left:-3px;width:calc(100% + 6px);height:calc(100% + 6px)}
    .coin-scene{perspective:600px}
    
    /* Menos estrellas fugaces en móvil */
    .star:nth-child(n+6){display:none}
    .star:nth-child(1){top:-30px;right:-50px}
    .star:nth-child(2){top:-50px;right:30px}
    .star:nth-child(3){top:-20px;right:-30px}
    .star:nth-child(4){top:-60px;right:80px}
    .star:nth-child(5){top:-40px;right:150px}
    
    /* Menos estrellas de fondo */
    .bg-star:nth-child(n+21){display:none}
}

@media(max-width:480px){
    .coin{width:56px;height:56px}
    .coin-face img{width:56px;height:56px}
    .star::before{width:150px}
    @keyframes animate{
        100%{transform:rotate(315deg) translateX(-120vw)}
    }
}