/* ================== ESTILOS BASE ================== */
body {
    margin: 0;
    padding: 0;
    background-color: #000000;
    overflow: hidden;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    touch-action: manipulation;
    transition: opacity 0.4s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #ffffff;
    height: 100vh;
    min-height: -webkit-fill-available;
}

@supports (height: 100dvh) {
    body { height: 100dvh; }
}

#particles-canvas {
    display: block;
    width: 100vw;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

/* Contenedor central - SIN sombra blanca */
#carrusel-container-apk {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    overflow: hidden;
    border-radius: 16px;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #fff;
}

/* Media queries contenedor central */
@media (min-width: 1025px) {
    #carrusel-container-apk { width: calc(min(100vw, 100vh) * 0.8); height: calc(min(100vw, 100vh) * 0.8); }
}
@media (min-width: 768px) and (max-width: 1024px) {
    #carrusel-container-apk { width: calc(min(100vw, 100vh) * 0.92); height: calc(min(100vw, 100vh) * 0.92); }
}
@media (max-width: 767px) {
    #carrusel-container-apk {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: calc(min(100vw, 100vh) * 0.94);
        height: calc(min(100vw, 100vh) * 0.94);
        margin: auto;
    }
    @supports (height: 100dvh) {
        #carrusel-container-apk { height: calc(min(100dvw, 100dvh) * 0.94); }
    }
}

/* Contadores y botones superiores/inferiores */
.CONTENEDOR-IZQUIERDA { position: fixed; top: 10px; left: 15px; z-index: 20; }
.CONTENEDOR-DERECHA { position: fixed; top: 15px; right: 15px; z-index: 20; display: flex; flex-direction: row; gap: 15px; }

.LORDRAKONS {
    position: fixed; top: 12px; left: 15px; z-index: 25; font-size: 26px; width: 48px; height: 48px; padding: 8px;
    border: 2px solid currentColor; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
    background-color: #000000; box-shadow: 0 0 15px currentColor; cursor: pointer; transition: transform 0.3s ease, box-shadow 0.3s ease;
    color: #00FF00; animation: GLOW-CONTORNO 2s infinite alternate;
}
.LORDRAKONS:hover { transform: scale(1.15); box-shadow: 0 0 25px currentColor; }

.DRAKONS-CONTADOR, .LORDRAKONS-CONTADOR {
    position: absolute; bottom: -14px; font-size: 14px; color: #ff0000; background: #000000; padding: 2px 6px;
    border-radius: 10px; min-width: 20px; text-align: center; box-shadow: 0 0 10px #ff0000; font-weight: bold;
}

.BTN-DRAKONS, .BTN-PUZZLE, .BTN-PUZZLE-MENU, .BTN-GRATIS, .BTN-CUENTA-REGRESIVA {
    font-size: 26px; width: 48px; height: 48px; padding: 8px; border: 2px solid currentColor; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; background-color: #000000; box-shadow: 0 0 15px currentColor;
    cursor: pointer; transition: transform 0.3s ease, box-shadow 0.3s ease; position: relative;
}
.BTN-DRAKONS { color: #00FF00; animation: GLOW-CONTORNO 2s infinite alternate; }
.BTN-PUZZLE { color: #00FF00; }
.BTN-PUZZLE-MENU { color: #00FFCC; animation: GIRAR 1s infinite linear, GLOW-CONTORNO 2s infinite alternate; }
.BTN-GRATIS { color: #FFD700; }
.BTN-CUENTA-REGRESIVA { 
    color: #FF0000; 
    animation: GLOW-CONTORNO 2s infinite alternate; 
    border-color: #FF0000; 
    box-shadow: 0 0 15px #FF0000; 
    display: none; 
}

.BTN-DRAKONS:hover, .BTN-PUZZLE:hover, .BTN-PUZZLE-MENU:hover, .BTN-GRATIS:hover, .BTN-CUENTA-REGRESIVA:hover {
    transform: scale(1.15); box-shadow: 0 0 25px currentColor;
}

.cuenta-regresiva-numero { font-size: 28px; font-weight: bold; line-height: 1; text-shadow: 0 0 10px #FF0000; }

/* Posiciones botones inferiores - BASE */
.BTN-PUZZLE, .BTN-PUZZLE-MENU, .BTN-GRATIS {
    position: fixed; 
    bottom: 25px; 
    z-index: 20; 
    width: 54px; 
    height: 54px; 
    font-size: 28px; 
    padding: 10px;
    box-sizing: border-box;
}

/* Tablet */
@media (max-width: 1024px) and (min-width: 768px) {
    .BTN-PUZZLE, .BTN-PUZZLE-MENU, .BTN-GRATIS { 
        width: 58px; 
        height: 58px; 
        font-size: 30px; 
        padding: 10px; 
    }
    .BTN-PUZZLE { left: calc(50% - 100px); }
    .BTN-PUZZLE-MENU { left: calc(50% - 29px); }
    .BTN-GRATIS { left: calc(50% + 42px); }
}

/* Desktop */
@media (min-width: 1025px) {
    .BTN-PUZZLE, .BTN-PUZZLE-MENU, .BTN-GRATIS { 
        bottom: 40px; 
        transform: scale(1.1); 
    }
    .BTN-PUZZLE { right: 280px; }
    .BTN-PUZZLE-MENU { right: 190px; }
    .BTN-GRATIS { right: 100px; }
    .BTN-CUENTA-REGRESIVA { 
        position: fixed; 
        top: 12px; 
        right: 95px; 
        z-index: 25; 
    }
}

/* ============================================= */
/* MÓVIL - INTERCAMBIO DE POSICIONES: Puzzle a la derecha, Gratis a la izquierda */
/* ============================================= */
@media (max-width: 767px) {
    .BTN-PUZZLE, .BTN-PUZZLE-MENU, .BTN-GRATIS {
        width: 58px;
        height: 58px;
        font-size: 30px;
        padding: 10px;
        bottom: 25px;
        box-sizing: border-box;
    }

    .BTN-GRATIS {          /* Antes estaba Puzzle, ahora Gratis a la izquierda */
        left: 20px;
    }

    .BTN-PUZZLE-MENU {
        left: calc(50% - 29px);
        transform: none;
    }

    .BTN-PUZZLE {           /* Antes estaba Gratis, ahora Puzzle a la derecha */
        right: 20px;
    }

    .BTN-CUENTA-REGRESIVA {
        position: fixed;
        top: 12px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 25;
    }
}

/* Animaciones generales */
@keyframes GIRAR { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes GLOW-CONTORNO { from { box-shadow: 0 0 15px currentColor; } to { box-shadow: 0 0 25px currentColor, 0 0 35px currentColor; } }
.icono-animado { animation: GLOW-ICONO 1s infinite alternate; text-shadow: 0 0 15px currentColor; }
@keyframes GLOW-ICONO { 0% { transform: scale(1) translateY(0px); } 100% { transform: scale(1.5) translateY(-1px); } }

/* ================== MODALES ================== */
.modal-mensaje {
    position: fixed;
    inset: 0;
    background: #000000;
    z-index: 3000;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-contenido {
    background: #000000;
    border-radius: 20px;
    padding: 40px 50px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.35), 0 0 50px rgba(0, 0, 0, 0.25);
    border: none;
    position: relative;
}

.boton-canjear {
    padding: 12px 30px;
    background: linear-gradient(#000, #000) padding-box,
                linear-gradient(45deg, #0000FF, #00FFFF) border-box;
    color: #FFF;
    border: 4px solid transparent;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1.4rem;
    font-weight: bold;
    text-transform: uppercase;
    animation: BORDE-BOTON-FLUIDO 0.6s infinite linear;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.7), 0 0 40px rgba(0, 0, 255, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.boton-canjear:hover {
    transform: scale(1.08);
    box-shadow: 0 0 35px rgba(0, 255, 255, 0.9), 0 0 60px rgba(0, 0, 255, 0.6);
}

.boton-canjear.no-gracias {
    background: linear-gradient(#000, #000) padding-box,
                linear-gradient(45deg, #ff4444, #ff8888) border-box;
}

@keyframes BORDE-BOTON-FLUIDO {
    0% { background: linear-gradient(#000,#000) padding-box, linear-gradient(45deg, #0000FF, #00FFFF) border-box; }
    50% { background: linear-gradient(#000,#000) padding-box, linear-gradient(45deg, #00FFFF, #0000FF) border-box; }
    100% { background: linear-gradient(#000,#000) padding-box, linear-gradient(45deg, #0000FF, #00FFFF) border-box; }
}

.botones-contenedor {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.ICONO-NOTIFICACION {
    font-size: 4.5rem;
    margin-bottom: 20px;
}

.WARNING-TITULO {
    font-size: 2.2rem;
    margin: 0 0 15px;
    text-shadow: 0 0 12px #00ffff, 0 0 18px rgba(0, 0, 255, 0.75), 0 0 28px rgba(0, 255, 255, 0.65);
}

.WARNING-TEXTO {
    font-size: 1.3rem;
    line-height: 1.6;
    margin: 0 0 30px;
}

/* AJUSTES SOLO PARA MÓVIL EN MODALES */
@media (max-width: 767px) {
    .modal-contenido {
        padding: 30px 25px;
        max-width: 90vw;
        max-height: 80vh;
        overflow-y: auto;
    }

    .ICONO-NOTIFICACION {
        font-size: 3.8rem;
        margin-bottom: 15px;
    }

    .WARNING-TITULO {
        font-size: 1.9rem;
    }

    .WARNING-TEXTO {
        font-size: 1.2rem;
    }

    .botones-contenedor {
        gap: 15px;
        flex-wrap: nowrap;
    }

    .boton-canjear {
        padding: 11px 28px;
        font-size: 1.3rem;
        min-width: 110px;
    }
}

/* Puzzle y timer */
#puzzle-container {
    position: absolute;
    z-index: 2;
    background: transparent;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 90vmin;
    height: 90vmin;
    max-width: 500px;
    max-height: 500px;
    display: none;
}

.tile {
    position: absolute;
    background-size: 400% 300%;
    border-radius: 6px;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: left 0.3s ease, top 0.3s ease;
}

.no-click { pointer-events: none !important; cursor: default !important; }

.timer-hidden { display: none; }
.timer-visible { display: block; animation: pulseTimer 1s infinite alternate; }

@keyframes pulseTimer { from { transform: scale(1); } to { transform: scale(1.15); } }

/* Título PUZZLEMANIA con sombra azul sutil */
.bienvenidos-titulo {
    font-size: 2.8rem;
    font-weight: bold;
    margin: 0;
    color: #ffffff;
    text-shadow: 0 0 15px #0000FF, 0 0 25px rgba(0, 0, 255, 0.6);
}

@media (max-width: 767px) {
    .bienvenidos-titulo {
        font-size: 2.2rem;
    }
}