body {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    background: #f2f2f2;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header {
    width: 100%;
    background: #007bff;
    color: white;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-small {
    background: white;
    color: #007bff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

.timer {
    font-size: 20px;
    font-weight: bold;
}

/* =================== */
/* Estilos generales   */
/* =================== */


h1 {
    text-align: center;
    margin-top: 30px;
    font-size: 2rem;
    color: #333;
}

/* =================== */
/* Tablero de juego    */
/* =================== */

.board-game {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    padding: 50px 20px 20px 20px; /* Aire arriba y a los lados */
    max-width: 900px;
    margin: 0 auto; /* Centrar tablero */
}

.board-game figure {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    position: relative;
    height: 150px; /* Altura fija para que no se deformen */
    transition: transform 0.3s ease;
}

.board-game figure:hover {
    transform: scale(1.05);
}

/* Imágenes */

.board-game figure img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Recorta sin deformar */
    display: block;
}

/* Imagen trasera (logo) */

.board-game figure .back {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    transition: opacity 0.4s ease;
}

/* Imagen frontal (producto) */

.board-game figure .searched-image {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
}

.board-game figure .searched-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Mostrar carta volteada */

.board-game figure.opened .back {
    opacity: 0;
}

/* =================== */
/* Responsivo          */
/* =================== */

@media (max-width: 768px) {
    .board-game {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        padding: 40px 10px 10px 10px;
    }

    .board-game figure {
        height: 120px;
    }
}

@media (max-width: 480px) {
    .board-game {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        padding: 10px; /* Menos padding en móviles */
        max-width: 100%; /* ¡Que use todo el ancho disponible! */
    }

    .board-game figure {
        height: 120px; /* Un poquito más alto para que no quede tan "apretado" */
    }
}


.card {
    width: 200px;
    height: 200px;
    perspective: 1000px;
    cursor: pointer;
    position: relative;
}

.card .front,
.card .back {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    position: absolute;
    backface-visibility: hidden;
    background: white;
    overflow: hidden;
    transition: transform 0.5s;
}

.card .back {
    transform: rotateY(180deg);
}

.card.opened .front {
    transform: rotateY(180deg);
}

.card.opened .back {
    transform: rotateY(360deg);
}
.card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.modal {
    display: none; /* Oculto por defecto */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7); /* Fondo oscuro semitransparente */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999; /* Bien arriba de todo */
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    animation: pop 0.3s ease-out;
}

@keyframes pop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-content h2 {
    margin-top: 0;
    font-size: 24px;
    color: #ff4b5c;
}

.modal-content p {
    margin: 10px 0 20px;
    font-size: 18px;
}

.modal-content button {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
}



/* Animación de entrada */
@keyframes fadeIn {
    from {opacity: 0;}
    to {opacity: 1;}
}

