/* BINGO */
/* Fondo y centrado general SOLO para esta página */

/* Contenedor del bingo: AHORA CON ESTILO DE CARTA (SIMILAR A .game-container DE WORDLE) */
.bingo-container {
    /* **Estilos de Carta (tomados de .game-container)** */
    background-image: url('../img/card.png');
    /* Usar la imagen de fondo de la carta */
    background-repeat: no-repeat;
    background-size: 100% 100%;
    padding: 35px 25px 60px 25px;
    /* Padding para que el contenido encaje dentro del marco de la imagen */
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.7));
    /* Sombra para levantarlo */

    /* Estilos de centrado y límite de ancho */
    margin: 20px auto;
    max-width: 700px;
    width: 95%;
}

.bingo-body {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}

/* Wrapper */
.bingo-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    max-width: 660px;
    width: 100%;
}

/* Header */
.bingo-header {
    display: flex;
    align-items: center;
    /* Alineación vertical central */
    justify-content: space-evenly;
    /* Distribuye espacio entre elementos */
    margin-top: -20px;
    /* Ajuste para compensar el padding superior de la carta */
    width: 100%;
    margin-bottom: 10px;
}

.bingo-left,
.bingo-right {
    /* Quitamos flex: 1 para que el ancho lo controle el contenido o el padding */
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    padding-left: 0;
    padding-right: 15px;
}

.bingo-left {
    justify-content: flex-start;
}

.bingo-right {
    justify-content: flex-end;
    padding-left: 15px;
    padding-right: 0;
}

.bingo-center {
    /* Fija el ancho del centro para evitar saltos laterales */
    width: 200px;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    margin-right: 2%;
    margin-top: 25px;
}

/* MODIFICADO: Fondo PAPIRO para el temporizador */
.bingo-timer {
    font-family: "Bangers", cursive;
    font-size: 28px;
    border-radius: 40px;
    color: #3e2723;
    /* Texto oscuro para contrastar con papiro */
    background: #fff8e1;
    /* Fondo PAPIRO */
    border: 3px solid #8d6e63;
    /* Borde de madera/tierra */
    border-radius: 10px;
    padding: 8px 14px;
    min-width: 110px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* --- ESTILO PARA EL BOTÓN SKIP --- */
.skip-btn {
    background: #fff8e1;
    /* Color crema/papiro */
    color: #3e2723;
    /* Color de texto muy oscuro */
    border: 3px solid #8d6e63;
    /* Borde de madera/tierra */
    padding: 12px 24px;
    font-size: 25px;
    font-family: 'Bangers', cursive;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 5px;
    box-shadow: 0 4px 0 #6d4c41;
    /* Sombra más oscura para simular relieve */
    transition: all 0.15s ease;
    text-transform: uppercase;
    line-height: 1;
}

/* Efecto al presionar (Active) */
.skip-btn:active {
    transform: translateY(4px);
    /* Presiona hacia abajo */
    box-shadow: none;
    /* Quita la sombra */
}

/* GRID */
.bingo-grid {
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 145px);
    /* 4 columnas un poco más grandes en escritorio */
    justify-content: center;
    gap: 12px;
}

/* Separador real entre grid y botones */
.grid-sep {
    width: 100%;
    max-width: 660px;
    /* 4*150 + 3*14 = 642, margen con seguridad */
    height: 0;
    margin: 20px auto 10px;
    border-top: 2px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}

@media (max-width: 768px) {
    .grid-sep {
        max-width: 380px;
        /* acompasa al grid en este breakpoint */
        margin-top: 14px;
        border-top-width: 1px;
    }
}

@media (max-width: 480px) {
    .grid-sep {
        max-width: 100%;
        padding: 0 8px;
        /* empata con padding lateral del grid */
    }
}

/* CELDAS */
.bingo-cell {
    background: transparent;
    border: none;
    border-radius: 19%;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    /* cuadradas con tamaño fijo */
    padding: 0;
    overflow: hidden;
    /* para overlays y ajuste limpio */
    transition: 0.25s ease;
    cursor: pointer;
    position: relative;
    /* para overlays */
}

/* Efecto hover */
.bingo-cell:hover {
    background: transparent;
    transform: scale(1.05);
}

/* TEXTO DE LA CELDA */
.bingo-label {
    color: #fff;
    font-size: 18px;
    text-align: center;
    line-height: 1.3;
    font-family: "Bangers", cursive;
}

.bingo-icon {
    width: 100%;
    height: 100%;
    object-fit: fill;
    /* llena la celda sin recortar (puede deformar) */
    object-position: center;
    display: block;
}

/* Overlay común (invisible por defecto) */
.bingo-cell::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

/* Acierto: overlay verde semitransparente sobre la foto */
.bingo-cell.cell-correct::after {
    background: rgba(56, 193, 114, 0.55);
    opacity: 1;
}

/* Error momentáneo: usar animación sobre el overlay */
.bingo-cell.blink-error::after {
    animation: blinkRed 0.6s ease;
    opacity: 1;
}

/* Contenedor de la imagen (tamaño fijo) */
.bingo-pool-container {
    width: 180px;
    height: 180px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 6px 0 12px 0;
}

/* Centrado imagen */
.bingo-character-img {
    width: 100%;
    /* La imagen ocupa el 100% de la altura y ancho fijos */
    height: 100%;
    object-fit: cover;
    object-position: top;
    border-radius: 12px;
    border: 3px solid #fff;
}

.bingo-character-name {
    font-family: 'Pirata One', cursive;
    color: var(--gold-treasure);
    text-shadow:
        2px 2px 0 #3e2723,
        -1px -1px 0 #3e2723,
        1px -1px 0 #3e2723,
        -1px 1px 0 #3e2723,
        1px 1px 0 #3e2723;
    margin: 0;
    font-size: 1.8rem;
    white-space: nowrap;
}

/* --- RESPONSIVE --- */

/* Ajuste para pantallas de altura media (Laptops/FullHD) */
@media screen and (min-width: 901px) and (max-height: 1080px) {
    .bingo-container {
        max-width: 580px;
        padding: 20px 20px 40px 20px;
    }

    .bingo-wrapper {
        max-width: 540px;
    }

    .bingo-grid {
        grid-template-columns: repeat(4, 120px);
        gap: 10px;
    }

    .grid-sep {
        max-width: 510px;
        margin-top: 15px;
    }

    .bingo-center {
        width: 170px;
        margin-top: 15px;
    }

    .bingo-pool-container {
        width: 150px;
        height: 150px;
    }

    .bingo-timer {
        font-size: 24px;
        padding: 6px 12px;
        min-width: 90px;
    }

    .skip-btn {
        font-size: 20px;
        padding: 8px 20px;
    }

    .bingo-header {
        margin-top: -10px;
    }
}


@media (max-width: 900px) {
    .bingo-character-name {
        margin-top: -10px;
        font-size: 1.4rem;
        text-align: center;
    }

    .bingo-grid {
        width: 100%;
        max-width: 420px;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .bingo-center {
        width: 180px;
        /* Ancho fijo para móvil */
    }

    .bingo-pool-container {
        width: 160px;
        height: 160px;
    }
}


@media (max-width: 480px) {
    .bingo-header {
        margin-top: -18px;
        margin-bottom: 5px;
    }

    .bingo-left,
    .bingo-right {
        /* width: 96px; */
    }

    /* RESPONSIVE BOTÓN SKIP */
    .skip-btn {
        padding: 8px 14px;
        font-size: 16px;
        border-radius: 6px;
        border-width: 2px;
        box-shadow: 0 2px 0 #8d6e63;
    }

    .skip-btn:active {
        transform: translateY(2px);
    }

    /* FIN RESPONSIVE BOTÓN SKIP */

    .bingo-timer {
        font-size: 18px;
        padding: 4px 8px;
        min-width: 72px;
    }

    .bingo-center {
        width: 160px;
        /* Ancho fijo para móvil */
    }

    .bingo-pool-container {
        width: 140px;
        height: 140px;
        margin: 6px 0 8px 0;
    }

    .bingo-grid {
        max-width: 100%;
        padding: 0 8px;
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .bingo-cell {
        aspect-ratio: 1 / 1;
        padding: 0;
    }

    .bingo-label {
        font-size: 11.5px;
        line-height: 1.2;
    }

    .bingo-icon {
        width: 100%;
        height: 100%;
    }
}

/* Ultra-small phones */
@media (max-width: 360px) {
    .bingo-header {
        margin-top: 10px;
    }

    /* RESPONSIVE BOTÓN SKIP */
    .skip-btn {
        padding: 6px 10px;
        font-size: 14px;
    }

    /* FIN RESPONSIVE BOTÓN SKIP */

    .bingo-timer {
        font-size: 16px;
        padding: 3px 6px;
        min-width: 64px;
    }

    .bingo-center {
        width: 140px;
    }

    .bingo-pool-container {
        width: 125px;
        height: 125px;
    }

    .bingo-grid {
        gap: 5px;
    }

    .bingo-label {
        font-size: 10.5px;
    }
}

/* ACERTADO */
.cell-correct {
    border-color: #2f9e5c;
}

/* BLOQUEADO */
.cell-blocked {
    pointer-events: none;
    opacity: 0.85;
}

/* ERROR: parpadeo rojo */
.blink-error {
    animation: blinkRed 0.6s ease;
}

@keyframes blinkRed {
    0% {
        background-color: rgba(255, 77, 77, 0.40);
    }

    50% {
        background-color: rgba(255, 0, 0, 0.55);
    }

    100% {
        background-color: rgba(255, 77, 77, 0.40);
    }
}

/* ERROR: temblor */
.shake {
    animation: shakeAnim 0.4s;
}

@keyframes shakeAnim {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-6px);
    }

    50% {
        transform: translateX(6px);
    }

    75% {
        transform: translateX(-6px);
    }

    100% {
        transform: translateX(0);
    }
}

/* --- MENSAJES DE VICTORIA / DERROTA (BINGO) --- */
#winMsg,
#looseMsg {
    max-width: 580px;
    margin: 20px auto;
}

/* Estilo para el mensaje de derrota */
.loose-content {
    background: linear-gradient(135deg, #c62828, #b71c1c);
    border: 3px solid #ffb300;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    color: white;
    box-shadow: 0 0 20px rgba(198, 40, 40, 0.4);
}

.loose-content h2 {
    font-family: 'Pirata One', cursive;
    color: #ffca28;
    font-size: 2rem;
    margin: 0 0 10px 0;
}

.loose-content p {
    margin: 0;
    font-size: 1.1rem;
}

/* Responsive para los mensajes en Bingo */
@media (max-width: 600px) {
    .loose-content {
        flex-direction: column;
        text-align: center;
        margin: 10px;
    }

    #winMsg,
    #looseMsg {
        margin: 7px;
    }
}

/* Alineación izquierda para la info del juego en Bingo */
.info-game {
    text-align: left;
}

/* Tutorial Modal */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.tutorial-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Modificación clave para aplicar el estilo de CARD.PNG y texto oscuro */
.tutorial-content {
    /* Estilos de Carta */
    background-image: url('../img/card.png');
    background-repeat: no-repeat;
    background-size: 100% 100%;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.7));

    padding: 30px 25px 40px 25px;

    border: none;
    border-radius: 15px;
    max-width: 700px;
    width: 90%;
    text-align: center;
    font-size: 1.3rem;
    box-shadow: none;
}

.tutorial-content p {
    color: #fff8e1;
}

.tutorial-content h2 {
    font-family: 'Pirata One', cursive;
    color: var(--gold-treasure, #ffd700);
    font-size: 32px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 0 #3e2723;
}

/* ESTILO DE PÁRRAFO GENERAL (DESKTOP) */
.tutorial-content p {
    /* Mantenemos el color existente y quitamos la propiedad font-size de aquí */
    line-height: 1.4;
    margin-bottom: 10px;
}

.tutorial-image-container {
    margin: 20px 0;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #333;
}

.tutorial-img {
    width: 100%;
    height: auto;
    display: block;
}

/* Two-column layout for tutorial */
.tutorial-body {
    display: flex;
    gap: 20px;
    align-items: center;
    margin: 20px 0;
}

.tutorial-gif-column {
    flex: 0 0 auto;
    max-width: 300px;
}

.tutorial-gif {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
    border: 2px solid #8d6e63;
}

.tutorial-text-column {
    flex: 1;
    text-align: left;
}

.tutorial-text-column p {
    margin: 0px 40px 0px 10px;
    font-size: 1.8rem;
    font-family: 'Pirata One', cursive;
}

.tutorial-options {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 25px 0;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: #ffd700;
}

input:focus+.slider {
    box-shadow: 0 0 1px #ffd700;
}

input:checked+.slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.toggle-label {
    font-size: 22px;
    font-weight: bold;
    color: var(--gold-treasure, #ffd700);
    font-family: 'Pirata One', cursive;
    text-shadow: 2px 2px 0 #3e2723;
    /* Aseguramos que la etiqueta del toggle sea oscura */
}

/* MODIFICADO: Fondo PAPIRO para el botón de Jugar */
.play-btn {
    background: #fff8e1;
    /* Fondo PAPIRO */
    color: #3e2723;
    /* Texto oscuro */
    border: 3px solid #8d6e63;
    /* Borde de madera/tierra */
    padding: 12px 40px;
    font-size: 24px;
    font-family: 'Bangers', cursive;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 4px 0 #6d4c41;
    /* Sombra 3D */
}

.play-btn:hover {
    transform: translateY(-2px);
    /* Ajustado para compensar la sombra */
    background: #fffbf0;
    /* Ligero cambio de color al pasar el ratón */
    box-shadow: 0 6px 0 #6d4c41;
}

.play-btn:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* Blur Effect */
.blur-background {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

/* --- RESPONSIVE MÓVIL (Menor tamaño de P en tutorial) --- */
@media (max-width: 600px) {

    /* Aquí reducimos el tamaño de la P solo en móvil */
    .tutorial-content p {
        font-size: 16px;
        /* 16px solo en móvil */
        /* margin-bottom: 8px; -> Esta propiedad no existía en el bloque anterior que me pasaste */
    }

    /* Aseguramos que otros elementos de texto importantes se mantengan legibles */
    .toggle-label {
        font-size: 16px;
    }

    .tutorial-content h2 {
        font-size: 28px;
    }

    /* Stack tutorial columns on mobile */
    .tutorial-body {
        flex-direction: column;
    }

    .tutorial-gif-column {
        max-width: 100%;
    }

    .tutorial-text-column {
        text-align: center;
    }
}