html {
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

body {
    background: #ffffff url('../img/geometry2.png'); 
    font-family: 'Coda', cursive; 
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh; /* Centra el juego verticalmente en la pantalla */
    margin: 0;
}

.container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

h1 {
    font-family: 'Open Sans', sans-serif; /* Corregido 'open' por 'Open' */
    font-weight: 300;
}

/* --- DECK DE CARTAS --- */

.deck {
    width: 660px;
    min-height: 680px;
    background: linear-gradient(160deg, #02ccba 0%, #aa7ecd 100%);
    padding: 32px;
    border-radius: 10px;
    box-shadow: 12px 15px 20px 0 rgba(46, 61, 73, 0.5);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 3em;
}

.deck .card {
    height: 125px;
    width: 125px;
    background: #2e3d49;
    font-size: 0;
    color: #ffffff;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 5px 2px 20px 0 rgba(46, 61, 73, 0.5);
    transition: transform 0.3s ease, background 0.3s ease; /* Transición suave */
}

/* Efecto de rotación al abrir */
.deck .card.open {
    transform: rotateY(180deg); 
    background: #02b3e4;
    cursor: default;
}

.deck .card.show {
    font-size: 33px;
    transform: rotateY(0); /* Vuelve a 0 para mostrar el icono */
}

.deck .card.match {
    cursor: default;
    background: #02ccba;
    font-size: 33px;
    animation: pulse 0.5s; /* Animación de éxito */
}

.deck .card.wrong {
    background: #e74c3c; /* Un rojo más estético */
    animation: shake 0.4s; /* Animación de error */
}

/* --- ANIMACIONES --- */

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* --- SCORE PANEL --- */

.score-panel {
    text-align: left;
    width: 500px; /* Un poco más ancho para que no se amontone el timer */
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.score-panel .stars {
    margin: 0;
    padding: 0;
    display: inline-block;
}

.score-panel .stars li {
    list-style: none;
    display: inline-block;
    color: #f1c40f; /* Color dorado para las estrellas */
}

.score-panel .restart {
    cursor: pointer;
    transition: color 0.2s;
}

.score-panel .restart:hover {
    color: #02ccba;
}

/* --- MODAL --- */

.modal {
    display: none; 
    position: fixed; 
    z-index: 10; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.6); /* Más oscuro para resaltar el modal */
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 40px;
    border-radius: 15px; /* Bordes redondeados */
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    width: 50%;
    max-width: 400px;
    text-align: center;
}

.playAgain {
    background-color: #02b3e4;
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 5px;
    font-size: 18px;
    margin-top: 20px;
    cursor: pointer;
    transition: background 0.3s;
}

.playAgain:hover {
    background-color: #0288ad;
}

/* --- RESPONSIVE --- */

@media screen and (max-width: 800px) {
    .deck {
        width: 450px;
        min-height: 450px;
    }

    .deck .card {
        height: 90px;
        width: 90px;
    }
}

@media screen and (max-width: 450px) {
    .deck {
        width: 320px;
        min-height: 320px;
        padding: 15px;
    }

    .deck .card {
        height: 65px;
        width: 65px;
    }

    .score-panel {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }
}
