/* Sfondo con immagine tempio notturno */
body {
    overflow: hidden;
    font-family: 'Arial', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    background: url('./public/sfondo.jpeg') no-repeat center center fixed;
    background-size: cover;
    position: relative;
}

/* Overlay scuro per contrasto */
body::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5); /* semitrasparente per rendere leggibile il testo */
    z-index: 0;
}

/* Container principale */
.container {
    text-align: center;
    background: rgba(255, 255, 255, 0.93);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
    position: relative; /* sopra l'overlay */
    z-index: 1;
}

/* Titolo */
h1 {
    margin-bottom: 20px;
    font-size: 2.5rem;
    color: #ff6f61;
}

/* --- INIZIO MODIFICA --- */

/* Contenitore (La Card Bianca) */
#sushiContainer {
    /* Flexbox per centrare perfettamente */
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;

    /* Dimensioni fisse e bloccate */
    width: 220px !important;
    height: 220px !important;
    margin: 20px auto;

    /* Stile della card */
    background-color: #ffffff !important; /* Forza il bianco */
    border-radius: 25px;
    border: 4px solid #ffebea;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);

    /* Questo impedisce all'immagine di uscire o coprire i bordi */
    overflow: hidden !important;
    position: relative;
    z-index: 10;
}

/* L'immagine dentro la Card */
#sushiContainer img {
    /* Resetta qualsiasi dimensione fissa precedente */
    width: auto !important;
    height: auto !important;

    /* La costringe a stare dentro l'80% dello spazio */
    max-width: 80% !important;
    max-height: 80% !important;

    /* Assicura che non sia posizionata in modo strano */
    position: relative !important;
    display: block !important;
    object-fit: contain;

    /* Mantiene le animazioni */
    transition: transform 0.2s;
    background: transparent !important; /* Nessun sfondo per l'immagine stessa */
    box-shadow: none !important;
}


/* Contatori */
.counter, .best-score, .timer {
    font-size: 2rem;
    margin: 10px 0;
    color: #222; /* testo scuro leggibile sopra il container chiaro */
}

/* Pulsanti */
.add-btn, .reset-btn {
    padding: 12px 25px;
    font-size: 1.2rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    margin: 10px;
    transition: transform 0.2s, background-color 0.3s, box-shadow 0.3s;
}

.add-btn {
    background-color: #ff6f61;
    color: white;
}

.add-btn:hover {
    background-color: #ff3b2f;
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.reset-btn {
    background-color: #4caf50;
    color: white;
}

.reset-btn:hover {
    background-color: #3a8a36;
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

/* Flying sushi */
.flying-sushi {
    position: absolute;
    width: 50px;
    height: 50px;
    pointer-events: none;
    animation: fall 0.8s forwards;
}

@keyframes fall {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(150px) scale(0.5);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 600px) {
    .sushi-img {
        width: 180px;
        height: 180px;
    }

    h1 {
        font-size: 2rem;
    }

    .counter, .best-score, .timer {
        font-size: 1.5rem;
    }

    .add-btn, .reset-btn {
        font-size: 1rem;
        padding: 10px 20px;
    }
    #sushiContainer {
        width: 180px;
        height: 180px;
    }
}

/* Lanterne lampeggianti */
.lantern {
    position: absolute;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffdd88 0%, #ff9900 80%);
    opacity: 0.8;
    animation: flicker 2s infinite;
    pointer-events: none;
    z-index: 0; /* sotto il container */
}

@keyframes flicker {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.2; }
}

/* Flying sushi con bagliore dorato */
.flying-sushi {
    position: absolute;
    width: 50px;
    height: 50px;
    pointer-events: none;
    animation: fall 0.8s forwards;
    filter: drop-shadow(0 0 10px gold);
}

/* Stelle statiche */
.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    opacity: 0.8;
    animation: twinkle 2s infinite alternate;
    pointer-events: none;
    z-index: 0;
}

@keyframes twinkle {
    0% { opacity: 0.2; }
    50% { opacity: 0.8; }
    100% { opacity: 0.2; }
}

/* Stelle cadenti */
.shooting-star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    opacity: 1;
    box-shadow: 0 0 10px white;
    pointer-events: none;
    z-index: 0;
    animation: shoot 1s forwards;
}

@keyframes shoot {
    0% { transform: translate(0,0) scale(1); opacity:1; }
    100% { transform: translate(-300px, 300px) scale(0); opacity:0; }
}

.sushi-particle {
    position: absolute;
    width: 30px;
    height: 30px;
    pointer-events: none;
    animation: explode 0.8s forwards;
}

@keyframes explode {
    0% {
        transform: translate(0,0) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--x), var(--y)) rotate(360deg) scale(0.5);
        opacity: 0;
    }
}
