@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;700;800&display=swap');
:root { --colore-primario: #007BFF; --colore-secondario: #20C997; --colore-sfondo: #E9F5FF; --colore-testo: #2C3E50; --card-size: 120px; }
body { font-family: 'Nunito', sans-serif; background-color: var(--colore-sfondo); display: flex; justify-content: center; align-items: center; min-height: 100vh; margin: 0; }
.game-container { width: 95%; max-width: 800px; text-align: center; }
header h1 { font-size: 2.5rem; color: var(--colore-primario); }
.stats-container { font-size: 1.5rem; margin: 20px 0; font-weight: 700; }
.memory-grid { display: grid; grid-template-columns: repeat(4, var(--card-size)); gap: 15px; justify-content: center; perspective: 1000px; }
.card { width: var(--card-size); height: var(--card-size); position: relative; transform-style: preserve-3d; transition: transform 0.6s; cursor: pointer; }
.card.flipped, .card.matched { transform: rotateY(180deg); cursor: default; }
.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    /* --- CORREZIONE APPLICATA QUI --- */
    -webkit-backface-visibility: hidden; /* Per compatibilità con browser Webkit */
    backface-visibility: hidden; /* Nasconde il lato posteriore durante la rotazione */
}
.card-front { background-color: var(--colore-secondario); display: flex; justify-content: center; align-items: center; font-size: 4rem; font-weight: 800; color: white; background-image: url('https://upload.wikimedia.org/wikipedia/commons/a/a6/Logo_della_Protezione_Civile.svg'); background-size: 60%; background-repeat: no-repeat; background-position: center; }
.card-back { background-color: white; transform: rotateY(180deg); display: flex; justify-content: center; align-items: center; padding: 10px; }
.card-back img { max-width: 90%; max-height: 90%; }
.back-button { display: inline-block; margin-top: 30px; padding: 10px 20px; background-color: var(--colore-primario); color: white; text-decoration: none; border-radius: 10px; font-weight: 700; }
.win-screen-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.7); display: flex; justify-content: center; align-items: center; z-index: 100; }
.win-box { background-color: white; padding: 40px; border-radius: 20px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.btn { margin-top: 20px; padding: 15px 30px; font-size: 1.2rem; cursor: pointer; border-radius: 10px; border: none; background-color: var(--colore-secondario); color: white; font-weight: 700; }
.hide { display: none; }
@media (max-width: 600px) { :root { --card-size: 80px; } .memory-grid { gap: 10px; } }