/* --- FONTS & BASE --- */
@font-face {
    font-family: 'Shadow Beamer';
    src: url('image/Shadow Beamer.ttf') format('truetype'); 
}

body {
    background: linear-gradient(135deg, #a7e0f0 0%, #d4eaf7 100%);
    font-family: 'Luckiest Guy', cursive;
    -webkit-tap-highlight-color: transparent;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: background 0.5s ease-in-out;
}

/* Effetto di puntini bianchi */
body::before { 
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10"><circle cx="1" cy="1" r="0.5" fill="rgba(255,255,255,0.4)"/></svg>');
    background-size: 20px 20px;
    opacity: 0.8;
    pointer-events: none;
}

h1, h2 {
    font-family: 'Satisfy', cursive;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    color: #3b82f6; /* Blu più vivace */
}

#start-screen h1 {
    font-family: 'Shadow Beamer', cursive;
    color: #ef4444; /* Rosso vibrante */
    text-shadow: 3px 3px 0px #fcd34d; /* Bordo Giallo */
}

/* --- STATS E INDICATORI --- */
.stats-item p {
    font-family: 'Satisfy', cursive;
    color: #1d4ed8; /* BLU SCURO: testo descrittivo */
    font-weight: 700;
}
.stats-item strong {
    font-family: 'Luckiest Guy', cursive;
    color: #10b981; /* VERDE: numeri delle stats */
    text-shadow: 2px 2px #d1fae5;
}
.level-indicator {
    font-family: 'Luckiest Guy', cursive;
    color: #f97316; /* ARANCIONE: indicatore livello */
    text-shadow: 2px 2px #fed7aa;
}

/* --- ICONA MUTE --- */
#mute-button {
    position: relative;
    background: none;
    box-shadow: none;
    outline: none;
    padding: 0;
    border-radius: 0;
    transition: none;
}

#icon-audio {
    height: 50px; /* Dimensione base per mobile */
    width: 50px;
}

/* Dimensione per schermi più grandi */
@media (min-width: 640px) {
    #icon-audio {
        height: 64px;
        width: 64px;
    }
}

#icon-audio[style*="animation-play-state: running"] {
    animation-play-state: running; 
}
#icon-audio[style*="animation-play-state: paused"] {
    animation-play-state: paused;
}

#mute-button.muted-state::after {
    content: 'X';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem; /* Adattato per l'icona più piccola */
    color: #ef4444;
    font-family: sans-serif;
    font-weight: 900;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
    pointer-events: none; 
    opacity: 0.9;
}

/* --- CARDS --- */
.game-container {
    perspective: 1000px;
}

.card {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s, box-shadow 0.3s;
    cursor: pointer;
    transform: rotateY(0deg); 
    border-radius: 15px; 
}

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

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    border: 5px solid transparent; 
}

.card-back {
    background: linear-gradient(135deg, #f7e6b8, #e8d096); 
    border: 5px solid #a37f53; 
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1), 0 5px 15px rgba(0,0,0,0.2);
    background-image: url('image/dorso.png');
    background-size: 85%; 
    background-repeat: no-repeat;
    background-position: center;
    transform: rotateY(0deg); 
}

.card-front {
    background-color: #fcfcfc; 
    border: 5px solid #a7e0f0; 
    transform: rotateY(180deg);
}

.card-face img {
    width: 80%; 
    height: 80%;
    object-fit: contain;
    border-radius: 8px; 
}

.card-front.text-card {
    background-color: #ffe0b2; 
}
.card-front .card-text {
    font-family: 'Shadow Beamer', cursive;
    font-size: clamp(0.8rem, 8vw, 1.5rem); /* Testo fluido che si adatta */
    color: #d84315; 
    text-shadow: 1px 1px 0px #fef3c7;
    text-align: center;
    padding: 5px;
}

.card.matched {
    box-shadow: 0 0 20px 10px rgba(118, 255, 100, 0.7); 
    animation: pulse-border 1.5s infinite alternate; 
}
@keyframes pulse-border {
    from { box-shadow: 0 0 15px 8px rgba(118, 255, 100, 0.5); }
    to { box-shadow: 0 0 25px 12px rgba(118, 255, 100, 0.9); }
}
.card.matched .card-front {
    border-color: #76ff64; 
}

/* --- MODAL --- */
.modal {
    background-color: rgba(0, 0, 0, 0.7); 
}

.modal-content {
    background: #ffffff; 
    border: 5px solid #60a5fa; 
    box-shadow: 0 15px 30px rgba(0,0,0,0.5); 
}

/* --- PULSANTI E ANIMAZIONE SHIMMER --- */
button {
    font-family: 'Luckiest Guy', cursive;
}

#start-button, #action-button {
    background: linear-gradient(180deg, #f59e0b, #d97706);
    color: #ffffff;
    border: 3px solid #b45309;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.6);
    box-shadow: 0 4px 0 #b45309, 0 8px 15px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
    transition: all 0.1s ease-in-out;
}

#action-button.level2-btn {
    background: linear-gradient(180deg, #10b981, #059669);
    border: 3px solid #047857;
    box-shadow: 0 4px 0 #047857, 0 8px 15px rgba(0,0,0,0.3);
}

#start-button::before, #action-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 75%;
    height: 100%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0) 100%);
    transform: skewX(-25deg);
    animation: shimmer 3.5s infinite;
}

@keyframes shimmer {
  100% {
    left: 150%;
  }
}

.card-wrapper {
    aspect-ratio: 1 / 1; 
}