/* ===================================================
   1. VARIABLES Y ESTILOS GLOBALES
   =================================================== */
:root {
    --card-back: #FFCC00;
    --card-front: #ffffff;
    --bg-color: #ffffff;
    --text-color: #0f172a;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

a {
    color: #637ED5;
}

/* ===================================================
   2. CONTENEDOR PRINCIPAL
   =================================================== */
.game-container {
    background: linear-gradient(180deg, #FFFFFF 0%, #F5F1E2 100%);
    border: 5px solid #E8E4D6;
    border-radius: 70px;
    width: 90%;
    max-width: 760px; /* Ancho máximo del tablero */
    padding: 70px 30px 40px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 50px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.03);
}

/* Asegura que el padding no sume espacio extra al ancho definido */
.game-container, .promo-module {
    box-sizing: border-box;
}

/* ===================================================
   3. TIPOGRAFÍA Y TEXTOS (TÍTULO, SUBTÍTULO, STATS)
   =================================================== */
h1 {
    font-family: 'Sora', sans-serif;
    font-weight: 800;
    color: #232323;
    margin: 0;
    text-align: center;
    font-size: 65px; /* Tamaño del título en escritorio */

    /* Efecto de etiqueta amarilla */
    background-color: #FFCC00;
    padding: 5px 25px;
    border-radius: 20px;
    box-shadow: 0px 6px 15px rgba(0,0,0,0.08);
    white-space: nowrap;

    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
}

p.subtitle {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    color: #999999;
    text-align: center;
    margin-top: 15px;
    margin-bottom: 25px;
    line-height: 1.2;
    font-size: 26px; /* Tamaño del subtítulo en escritorio */
}

.stats {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: #939393;
    text-transform: uppercase;
    font-size: 24px; /* Tamaño del contador en escritorio */
}

.card-back {
    background-color: var(--card-back);
    color: #D8A60F;
    font-family: Arial, sans-serif;
    font-weight: bold;
    font-size: 50px; /* Tamaño del signo de interrogación en escritorio */
}

/* ===================================================
   4. TABLERO DE CARTAS
   =================================================== */
.game-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Siempre 4 columnas en la base */
    gap: 10px;
    max-width: 480px;
    width: 100%;
    perspective: 1000px;
}

.card {
    aspect-ratio: 1 / 1;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.4s;
    cursor: pointer;
}

.card.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    user-select: none;
    overflow: hidden;
}

.card-front {
    background-color: var(--card-front);
    transform: rotateY(180deg);
    border: 2px solid #e2e8f0;
    box-sizing: border-box;
}

.card-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===================================================
   5. INTERFAZ (BOTONES, NAVEGACIÓN Y MENSAJES)
   =================================================== */
.win-message {
    display: none;
    text-align: center;
    margin-top: 25px;
}

.win-message h2 {
    font-family: 'Sora', sans-serif;
    color: #FFCC00;
    margin-bottom: 5px;
    font-size: 35px;
}

.win-message p {
    font-family: 'Outfit', sans-serif;
    color: #939393;
    font-weight: 600;
    font-size: 20px;
}

.win-message .btn-reset {
    margin-top: 15px; /* Separación debajo del texto "Lograste resolver..." */
}

.nav-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 25px;
    width: 100%;
}

.level-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

/* Estilos compartidos de botones */
.btn-level, .btn-reset, .btn-share {
    padding: 12px 25px;
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    border: none;
    height: 46px;
    transition: background-color 0.2s;
}

/* Botones Nivel y Reset (amarillos) */
.btn-level, .btn-reset {
    background-color: #FFCC00;
    color: #333333;
}

.btn-level:hover, .btn-reset:hover {
    background-color: #fcde65;
}

/* Estado del nivel activo (en el que estás jugando ahora) */
.btn-level.active {
    background-color: #fcde65;
    cursor: default;
}

/* Botón Compartir (azul) */
.btn-share {
    background-color: #2a68d8;
    color: white;
}

.btn-share:hover {
    background-color: #6e9cf0;
}

/* Botón circular de sonido — mismo alto que los botones amarillos */
.btn-sound {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background-color: #FFCC00;
    color: #333333;
    border: none;
    padding: 0;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-sound:hover {
    background-color: #fcde65;
}

.sound-icon {
    width: 22px;
    height: 22px;
}

.sound-mute-line {
    display: none;
}

.btn-sound.muted .sound-waves {
    display: none;
}

.btn-sound.muted .sound-mute-line {
    display: block;
}

footer {
    margin-top: 30px;
    font-size: 14px;
    color: #A7A7A7;
    text-align: center;
    font-family: 'Outfit', sans-serif;
}

/* ===================================================
   6. ANIMACIÓN DEL EMOJI FLOTANTE
   =================================================== */
.floating-emoji {
    position: fixed;
    transform: translate(-50%, -50%);
    font-size: 70px; /* Tamaño en escritorio (PC) */
    pointer-events: none;
    z-index: 1000;
    animation: floatUp 1.2s ease-out forwards;
}

@keyframes floatUp {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -80%) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -200px) scale(1); }
}

/* ===================================================
   7. DESCRIPCIÓN DEL JUEGO (texto de SEO / párrafo visible)
   =================================================== */
.descripcion-juego {
    width: 90%;
    max-width: 760px;
    margin-top: 30px;
    padding: 0 20px;
    box-sizing: border-box;
    text-align: center;
}

.descripcion-juego p {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    color: #797979;
    font-size: 19px;
    line-height: 1.5;
    margin: 0 0 14px 0;
}

.descripcion-juego p:last-child {
    margin-bottom: 0;
}

/* ===================================================
   8. MÓDULO INFERIOR DE LA REVISTA
   =================================================== */
.promo-module {
    background-color: #F4F4F4;
    border-radius: 70px;
    width: 90%;
    max-width: 760px;
    padding: 70px 30px 40px;
    margin-top: 40px;
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.promo-cover {
    max-width: 100%;
    width: 280px;
    height: auto;
    margin-bottom: 30px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.promo-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: #636363;
    font-size: 32px;
    text-align: center;
    margin: 0 0 35px 0;
    line-height: 1.3;
}

.promo-subtitle {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: #636363;
    font-size: 22px;
    text-align: center;
    margin: 0 0 5px 0;
}

.promo-link {
    font-family: 'Outfit', sans-serif;
    color: #637ED5;
    font-size: 18px;
    text-decoration: underline;
    text-align: center;
    margin-bottom: 30px;
    font-weight: bold;
    display: block;
    word-break: break-word;
    overflow-wrap: break-word;
}

.promo-link:last-child {
    margin-bottom: 0;
}

/* ===================================================
   9. CANVAS DEL CONFETI
   =================================================== */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

/* ===================================================
   10. RESPONSIVE: TAMAÑOS PARA PANTALLAS CHICAS (CELULARES)
   =================================================== */
@media (max-width: 768px) {
    body {
        padding: 20px 5px;
    }

    h1 {
        font-size: 35px;
        white-space: normal;
        width: 80%;
        padding: 10px;
    }

    p.subtitle {
        font-size: 18px;
        margin-top: 25px;
    }

    .stats {
        font-size: 18px;
    }

    .card-back {
        font-size: 35px;
    }

    .game-container {
        padding: 60px 15px 30px;
    }

    .floating-emoji {
        font-size: 40px;
    }

    .descripcion-juego {
        padding: 0 10px;
    }

    .descripcion-juego p {
        font-size: 18px;
    }

    .promo-module {
        border-radius: 50px;
        padding: 60px 15px 30px;
    }

    .promo-title {
        font-size: 24px;
    }

    .promo-subtitle {
        font-size: 18px;
    }

    .promo-link {
        font-size: 16px;
    }
}

/* ===================================================
   11. RESPONSIVE: AJUSTES PANORÁMICOS PARA COMPUTADORAS (LAPTOPS/PC)
   =================================================== */
@media (min-width: 769px) {
    /* Nivel 2: 20 cartas -> 5 columnas x 4 filas */
    .nivel-2-grid {
        grid-template-columns: repeat(5, 1fr);
        max-width: 600px;
    }

    /* Nivel 3: 24 cartas -> 6 columnas x 4 filas */
    .nivel-3-grid {
        grid-template-columns: repeat(6, 1fr);
        max-width: 720px;
    }

    /* Nivel MAX: 36 cartas -> 6 columnas x 6 filas */
    .nivel-max-grid {
        grid-template-columns: repeat(6, 1fr);
        max-width: 720px;
    }
}
