/*body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: #f0f0f0;
    margin: 0;
}*/
/* ... (stili esistenti) ... */

body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: #f0f0f0; /* Colore diurno base */
    margin: 0;
    transition: background-color 1.5s ease-in-out; /* Transizione fluida giorno/notte */
    position: relative; /* Necessario per eventuali overlay futuri */
}

/* Classe da aggiungere al body durante la notte */
body.night-mode {
    background-color: #2c3e50; /* Blu scuro/grigio per la notte */
    color: #ecf0f1; /* Cambia colore testo base per leggibilità */
}

/* Modifica colori specifici di elementi quando è notte */
body.night-mode #game-container,
body.night-mode #auth-container {
    background-color: #34495e; /* Sfondo leggermente più scuro per i contenitori */
    border-color: #7f8c8d;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

body.night-mode h1,
body.night-mode h2,
body.night-mode #stats div, /* Colore testo statistiche */
body.night-mode .stat-label, /* Colore etichette barre */
body.night-mode #age-stat, /* Colore età */
body.night-mode #user-status span /* Colore testo user status */
{
    color: #ecf0f1; /* Testo chiaro */
}

/* Optional: Modifica i bottoni */
body.night-mode #actions button,
body.night-mode #auth-container button,
body.night-mode #language-selector button,
body.night-mode #mute-button,
body.night-mode #logout-button {
    background-color: #566573;
    color: #ecf0f1;
    border-color: #7f8c8d;
}
body.night-mode #actions button:hover,
body.night-mode #auth-container button:hover,
body.night-mode #mute-button:hover,
body.night-mode #logout-button:hover {
    background-color: #7f8c8d;
}
body.night-mode #language-selector button:hover,
body.night-mode #language-selector button:focus {
     border-color: #aaa;
     background-color: #566573;
}
body.night-mode #language-selector button.active-lang {
    border-color: #eee;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.3);
    background-color: #7f8c8d;
}
body.night-mode #actions button:disabled {
    background-color: #404a55;
    color: #909ca7;
    cursor: not-allowed;
}

/* Optional: Modifica i link nei form auth */
body.night-mode #auth-container a {
    color: #9ccfea;
}

/* Rendi le barre statistiche leggibili di notte */
body.night-mode .stat-bar-outer {
    background-color: #555;
    border-color: #777;
}
/* Potresti dover aggiustare i colori .low/.medium specifici per la notte
   se quelli attuali non contrastano bene con lo sfondo scuro della barra esterna */
/* Esempio: Giallo più brillante per medium */
body.night-mode #happiness-bar.medium,
body.night-mode #cleanliness-bar.medium {
     background-color: #f1c40f;
}
/* Esempio: Rosso/Arancione più brillanti per low/critico */
body.night-mode #hunger-bar, /* Fame alta */
body.night-mode #happiness-bar.low,
body.night-mode #health-bar.low {
    background-color: #e74c3c;
}
body.night-mode #hunger-bar.medium,
body.night-mode #health-bar.medium {
    background-color: #e67e22;
}

/* Stili per #user-status in modalità notte */
body.night-mode #user-status {
    background-color: #4a6f92; /* Un blu/grigio leggermente diverso per distinguerlo */
    border-color: #7f8c8d;
    color: #ecf0f1; /* Testo chiaro */
    box-shadow: 0 2px 4px rgba(0,0,0,0.2); /* Ombra leggera */
}
/* Assicurati che il nome utente sia chiaro */
body.night-mode #user-status #username-display {
    color: #ffffff; /* Bianco pieno per enfasi */
    font-weight: bold;
}
/* Puoi aggiungere un effetto "stelle" molto semplice (opzionale) */
body.night-mode::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../img/stars.png');  /* O un gradiente/effetto CSS */
    /*background: radial-gradient(ellipse at bottom, #1b2735 0%,#090a0f 100%);*/ 
    opacity: 0.3; /* Molto tenue */
    z-index: -1; /* Dietro a tutto */
     pointer-events: none; /* Non interferisce con i click */
}
#language-selector {
    position: absolute;
    top: 10px;
    right: 10px;
}

#language-selector button {
    padding: 3px 5px; /* Riduci padding per avvicinare l'immagine al bordo */
    margin-left: 5px;
    cursor: pointer;
    background-color: transparent; /* Sfondo trasparente */
    border: 1px solid #ccc; /* Bordo leggero o rimuovilo (border: none;) */
    border-radius: 4px;
    line-height: 0; /* Evita spazio extra verticale dovuto al testo fantasma */
    vertical-align: middle; /* Allinea i bottoni tra loro se hanno altezze diverse */
}

/* Stile per l'immagine dentro il bottone */
#language-selector button img {
    width: 24px; /* Imposta la larghezza desiderata */
    height: auto; /* Mantieni proporzioni (o imposta altezza fissa es. 16px) */
    display: block; /* Rimuove spazio sotto l'immagine */
    vertical-align: middle; /* Allinea immagine verticalmente se necessario */
}
/* Effetto Hover/Focus (opzionale) */
#language-selector button:hover,
#language-selector button:focus {
    border-color: #888;
    background-color: #f0f0f0;
    outline: none; /* Rimuovi outline di default su focus se metti un bordo/sfondo */
}
/* Stile per evidenziare la lingua attiva (Opzionale ma consigliato) */
#language-selector button.active-lang {
    border-color: #333;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
    background-color: #e0e0e0;
}

#game-container {
    background-color: #fff;
    border: 2px solid #ccc;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    width: 90%;
    max-width: 400px;
}

#character {
    margin: 20px 0;
    position: relative; /* Per posizionare la cacca */
    min-height: 100px; /* Altezza minima per contenere l'immagine */
}

#character-image {
    max-width: 100px;
    height: auto;
    display: block; /* Rimuove spazio extra sotto l'immagine */
    margin: 0 auto; /* Centra l'immagine */
    border: 3px solid #777; /* Larghezza, stile (solid, dashed, etc.), colore */
    border-radius: 12px;   /* Angoli arrotondati (aggiusta il valore come preferisci) */
    padding: 4px;          /* Spazio tra il bordo e l'immagine (opzionale) */
    background-color: #f0f8ff; /* Sfondo DENTRO la cornice (AliceBlue - opzionale, utile se l'img ha trasparenza) */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2); /* Ombra esterna (opzionale) */
    box-sizing: border-box; /* Assicura che padding e border siano inclusi nella dimensione */    
}

#poop-indicator {
    position: absolute;
/*    bottom: 5px;
    right: calc(50% - 60px);  Centra più o meno vicino al personaggio */
    /* Aggiusta bottom/right se necessario a causa del padding/border dell'immagine */
    bottom: 0px; /* Potrebbe dover essere aggiustato */
    right: 0px; /* Potrebbe dover essere aggiustato */
}

#poop-indicator img {
    width: 30px;
}

#stats {
    margin-bottom: 20px;
    line-height: 1.6;
}

#stats div {
    margin: 5px 0;
}

#stats span[data-lang] {
    font-weight: bold;
}

#actions button {
    padding: 10px 15px;
    margin: 5px;
    font-size: 1em;
    cursor: pointer;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #e7e7e7;
    transition: background-color 0.2s;
}

#actions button:hover {
    background-color: #dcdcdc;
}

#actions button:disabled {
    background-color: #f8f8f8;
    color: #aaa;
    cursor: not-allowed;
}


#message-area {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    font-weight: bold;
}

.message-gameover {
    background-color: #ffdddd;
    border: 1px solid #ffaaaa;
    color: #d8000c;
}

.message-info {
    background-color: #e6f7ff;
    border: 1px solid #b3e0ff;
    color: #005f99;
}

.hidden {
    display: none;
}
/* ... (stili precedenti) ... */

#auth-container {
    background-color: #fff;
    border: 2px solid #ccc;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px; /* Spazio tra auth e game */
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    width: 90%;
    max-width: 400px;
}

#auth-container input[type="text"],
#auth-container input[type="password"] {
    display: block;
    width: calc(100% - 22px); /* Considera padding/border */
    padding: 10px;
    margin: 10px auto;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#auth-container button {
    padding: 10px 20px;
    margin-top: 10px;
    cursor: pointer;
    background-color: #4CAF50; /* Verde */
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1em;
}

#auth-container button:hover {
    background-color: #45a049;
}

#auth-container p {
    margin-top: 15px;
    font-size: 0.9em;
}

#auth-container a {
    color: #007bff;
    text-decoration: none;
    cursor: pointer;
}

#auth-container a:hover {
    text-decoration: underline;
}

#user-status {
    padding: 10px;
    background-color: #e7f3fe;
    border: 1px solid #cce5ff;
    border-radius: 5px;
    margin-bottom: 15px;
}

#user-status button {
    background-color: #f44336; /* Rosso */
    margin-left: 15px;
    font-size: 0.9em;
    padding: 5px 10px;
}
#user-status button:hover {
    background-color: #da190b;
}

.auth-message {
    margin-top: 10px;
    font-weight: bold;
    padding: 8px;
    border-radius: 4px;
    display: none; /* Nascosto di default */
}
.auth-message.error {
    color: #D8000C;
    background-color: #FFD2D2;
    border: 1px solid #FFB8B8;
    display: block;
}
.auth-message.success {
    color: #4F8A10;
    background-color: #DFF2BF;
    border: 1px solid #BDE0A8;
    display: block;
}

/* ... (stili esistenti) ... */

#top-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
}

#language-selector {
    position: static; /* Rimuovi position absolute se dentro #top-controls */
    margin-right: 15px;
}

#mute-button {
    background: none;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 5px 8px;
    font-size: 1.2em;
    cursor: pointer;
}

#character-wrapper {
    /* Contenitore per non far "saltare" il layout durante le animazioni */
    position: relative;
    min-height: 120px; /* Abbastanza alto per animazioni */
    margin: 15px 0;
    display: flex; /* Aiuta a centrare #character se necessario */
    justify-content: center;
    align-items: center;
}

#character {
    position: relative; /* Necessario per posizionare #poop-indicator */
    /* Rimuovi min-height da qui se l'ha #character-wrapper */
    /* Aggiungi transition per cambi immagine più fluidi */
    transition: transform 0.3s ease-out;
}

#poop-indicator {
    position: absolute;
    bottom: -5px; /* Leggermente sotto */
    right: -15px; /* Leggermente a destra */
    transform-origin: bottom left; /* Punto per animazione scale */
    /* Aggiungi transition per l'apparizione */
    transition: transform 0.2s ease-out, opacity 0.2s ease-out;
}
#poop-indicator.hidden {
    transform: scale(0.5);
    opacity: 0;
    /* display: none; lo rimuoviamo per permettere la transizione */
    pointer-events: none; /* Impedisce interazioni quando nascosto */
}


/* --- Keyframes per Animazioni --- */

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
  40% {transform: translateY(-15px);}
  60% {transform: translateY(-8px);}
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(5deg); }
  75% { transform: rotate(-5deg); }
}

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

@keyframes poof {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}


/* --- Classi per Applicare Animazioni --- */

.animate-bounce {
  animation: bounce 0.8s ease;
}

.animate-wiggle {
  animation: wiggle 0.5s ease-in-out;
}

.animate-pulse {
  animation: pulse 1s infinite ease-in-out; /* Pulsazione continua per tristezza/malattia? */
}
.animate-pulse-once {
     animation: pulse 0.6s ease-in-out; /* Pulsazione singola per guarigione */
}

.animate-poof {
    /* Da applicare a #poop-indicator quando viene pulito */
     animation: poof 0.3s ease-out forwards; /* forwards mantiene stato finale */
}

.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.animate-fade-out {
     animation: fadeOut 0.5s ease forwards;
}
/* ... (stili esistenti) ... */

#stats {
    margin-bottom: 20px;
    /* Rimuovi line-height se non serve più */
}

.stat-bar-container {
    display: flex; /* Allinea elementi orizzontalmente */
    align-items: center; /* Allinea verticalmente al centro */
    margin: 8px 0; /* Spazio tra le barre */
    font-size: 0.95em;
}

.stat-label {
    font-weight: bold;
    min-width: 70px; /* Larghezza minima per allineare le barre */
    display: inline-block; /* Per applicare min-width */
    margin-right: 5px;
}

.stat-bar-outer {
    flex-grow: 1; /* Occupa lo spazio rimanente */
    height: 18px;
    background-color: #e0e0e0;
    border-radius: 9px;
    overflow: hidden; /* Nasconde la parte della barra interna che esce */
    margin: 0 8px; /* Spazio prima e dopo la barra */
    border: 1px solid #ccc;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.stat-bar-inner {
    height: 100%;
    background-color: #4CAF50; /* Colore base (verde) */
    border-radius: 9px;
    /* La larghezza sarà impostata da JavaScript */
    width: 50%; /* Default iniziale */
    transition: width 0.3s ease-out, background-color 0.3s ease-out; /* Transizione fluida */
    text-align: center; /* Opzionale: per testo dentro la barra */
    color: white; /* Opzionale: per testo dentro la barra */
    font-size: 0.8em; /* Opzionale: per testo dentro la barra */
    line-height: 18px; /* Opzionale: per testo dentro la barra */
}

.stat-value {
    font-weight: bold;
    min-width: 25px; /* Spazio per il numero */
    text-align: right;
}

/* Colori Dinamici per le Barre Interne */
/* Fame: Invertita (pieno è male) */
#hunger-bar { background-color: #f44336; /* Rosso quando piena */ }
#hunger-bar.medium { background-color: #ff9800; /* Arancione */ }
#hunger-bar.low { background-color: #4CAF50; /* Verde quando bassa (bene) */ }

/* Felicità: Normale (pieno è bene) */
#happiness-bar { background-color: #4CAF50; /* Verde quando piena */ }
#happiness-bar.medium { background-color: #ffeb3b; /* Giallo */ }
#happiness-bar.low { background-color: #f44336; /* Rosso quando bassa (male) */ }

/* Salute: Normale */
#health-bar { background-color: #4CAF50; }
#health-bar.medium { background-color: #ff9800; }
#health-bar.low { background-color: #f44336; }

/* Pulizia: Normale */
#cleanliness-bar { background-color: #2196F3; } /* Blu per pulizia */
#cleanliness-bar.medium { background-color: #ffeb3b; }
#cleanliness-bar.low { background-color: #795548; } /* Marrone quando bassa (male) */

/* ... (stili esistenti) ... */

/* Stili Overlay Minigioco */
#minigame-overlay {
    position: fixed; /* Resta fisso durante lo scroll */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Sfondo scuro semitrasparente */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Assicura sia sopra a tutto */
    opacity: 0; /* Inizia trasparente */
    transition: opacity 0.3s ease-in-out;
    pointer-events: none; /* Non interagibile quando nascosto */
}

#minigame-overlay:not(.hidden) {
    opacity: 1; /* Rendi visibile */
    pointer-events: auto; /* Rendi interagibile */
}

#minigame-content {
    background-color: #fff;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    text-align: center;
    width: 90%;
    max-width: 450px; /* Larghezza massima */
    border: 2px solid #ccc;
}
/* Stili per modalità notte (se attiva) */
body.night-mode #minigame-content {
    background-color: #34495e;
    border-color: #7f8c8d;
    color: #ecf0f1;
}
body.night-mode #minigame-content h3 {
     color: #ecf0f1;
}

#minigame-info {
    display: flex;
    justify-content: space-around;
    margin: 10px 0 15px 0;
    font-weight: bold;
}

#minigame-area {
    position: relative; /* Contesto per posizionamento oggetti */
    height: 300px; /* Altezza area di gioco */
    background-color: #e8f4f8; /* Sfondo leggero per l'area */
    border-radius: 5px;
    overflow: hidden; /* Nasconde oggetti che escono */
    border: 1px solid #b0c4de;
    cursor: crosshair; /* Cambia cursore sull'area */
}
body.night-mode #minigame-area {
    background-color: #4a6f92;
     border-color: #7f8c8d;
}


/* Stile Oggetti che Cadono */
.falling-object {
    position: absolute;
    top: -30px; /* Inizia appena sopra l'area */
    width: 25px;
    height: 25px;
    /* background-color: red; */ /* Sostituito da testo/immagine */
    font-size: 22px; /* Dimensione carattere (es. cuore) */
    line-height: 25px; /* Allinea verticalmente il carattere */
    text-align: center;
    /* background-image: url('img/heart.png'); */ /* Alternativa con immagine */
    /* background-size: contain; */
    /* background-repeat: no-repeat; */
    cursor: pointer;
    user-select: none; /* Impedisce selezione testo */
    /* Animazione definita sotto */
    animation: fall-animation linear; /* nome, timing, NIENTE 'infinite' */
}

@keyframes fall-animation {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(calc(300px + 40px)); /* Altezza area + un po' sotto */
    }
}

/* Animazione quando un oggetto viene preso */
.falling-object.caught {
    animation: none; /* Ferma animazione caduta */
    transition: transform 0.2s ease-out, opacity 0.2s ease-out;
    transform: scale(1.5);
    opacity: 0;
}

#minigame-close-button {
    margin-top: 15px;
    padding: 8px 15px;
    /* Stili simili agli altri bottoni */
}
/* Nascondi bottone chiusura all'inizio */
#minigame-close-button.hidden {
     display: none;
}
/* ... (stili esistenti, inclusi quelli per #minigame-overlay, #minigame-content) ... */

/* Stili specifici per il Minigioco CURA */
#minigame-content.heal-minigame {
    /* Stili leggermente diversi se necessario, es. larghezza */
    max-width: 350px;
}

#heal-instructions {
    font-size: 0.9em;
    margin-bottom: 15px;
    color: #555;
}
body.night-mode #heal-instructions {
    color: #ccc;
}

#heal-track {
    position: relative;
    height: 30px;
    background-color: #d0d0d0;
    border-radius: 15px;
    margin: 20px 0;
    overflow: hidden;
    border: 1px solid #aaa;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}
body.night-mode #heal-track {
    background-color: #566573;
    border-color: #7f8c8d;
}

/* Adatta la cornice per la modalità notte */
body.night-mode #character-image {
    border-color: #aaa; /* Colore bordo più chiaro */
    background-color: #4a5a6a; /* Sfondo interno più scuro */
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}


#heal-target-zone {
    position: absolute;
    top: 0;
    height: 100%;
    background-color: rgba(76, 175, 80, 0.6); /* Verde semitrasparente */
    border-left: 2px dashed #1a5d1e;
    border-right: 2px dashed #1a5d1e;
    /* Posizione e larghezza impostate da JS */
    z-index: 1;
}
body.night-mode #heal-target-zone {
     background-color: rgba(46, 204, 113, 0.6);
     border-color: #16a085;
}

#heal-indicator {
    position: absolute;
    top: 50%;
    left: 0; /* Parte da sinistra */
    transform: translateY(-50%);
    width: 10px; /* Larghezza indicatore */
    height: 90%; /* Altezza indicatore */
    background-color: #e74c3c; /* Rosso */
    border: 1px solid #c0392b;
    border-radius: 3px;
    z-index: 2;
    /* Animazione definita sotto e controllata da JS */
    animation-name: heal-indicator-move;
    animation-timing-function: linear;
    animation-play-state: paused; /* Non parte finché non avviato da JS */
    animation-fill-mode: forwards; /* Mantiene la posizione finale */
}
body.night-mode #heal-indicator {
    background-color: #ff7675;
    border-color: #d63031;
}


@keyframes heal-indicator-move {
    from { left: 0%; }
    to { left: calc(100% - 10px); } /* Larghezza track - larghezza indicatore */
}

#heal-feedback {
    margin-top: 15px;
    font-weight: bold;
    min-height: 1.2em; /* Spazio per il testo */
}

#heal-feedback.success { color: #27ae60; }
#heal-feedback.perfect { color: #f1c40f; font-size: 1.1em;} /* Giallo/Oro per perfetto */
#heal-feedback.fail { color: #c0392b; }

body.night-mode #heal-feedback.success { color: #2ecc71; }
body.night-mode #heal-feedback.perfect { color: #f39c12;}
body.night-mode #heal-feedback.fail { color: #e74c3c; }


#heal-attempts {
    font-size: 0.85em;
    color: #666;
    margin-top: 5px;
}
body.night-mode #heal-attempts {
    color: #aaa;
}

/* Rimuovi il bottone "Try/Stop" se l'intera area è cliccabile */
/* #heal-try-button { */
    /* margin-top: 10px; */
/* } */

/* Stili esistenti ... */

/* Stili per la Selezione Sesso nei Form */
.gender-selection {
    margin-top: 15px; /* Spazio sopra */
    margin-bottom: 10px; /* Spazio sotto */
    text-align: left; /* Allinea etichette a sinistra nel form centrato */
    /* Aggiungi padding per non farli stare attaccati ai bordi */
    padding-left: 10%;
    padding-right: 10%;
}

.form-label { /* Etichetta principale del gruppo (es. "Il tuo Sesso:") */
    display: block; /* Su una riga separata */
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 0.9em;
    color: #555;
}

.gender-selection label {
    margin-right: 15px; /* Spazio tra le opzioni radio */
    cursor: pointer;
    font-size: 0.9em;
    display: inline-block; /* Mantiene le opzioni sulla stessa linea (se c'è spazio) */
}
/* Assicurati che non vadano a capo troppo facilmente */
.gender-selection label:last-child {
     margin-right: 0;
}
/* Stili esistenti ... */

/* Stili per l'overlay di nascita (potresti averne già) */
#hatch-overlay {
    /* ... (stili esistenti: position, background, display, z-index, opacity, transition) ... */
    /* Assicurati che display: flex; align-items: center; justify-content: center; siano presenti */
}

#hatch-overlay .hatch-content { /* Nuovo contenitore interno */
    background-color: white;
    padding: 20px 30px;
    border-radius: 10px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    opacity: 1; /* Il contenuto è visibile quando l'overlay lo è */
    transform: scale(1); /* Stato iniziale per transizione */
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}
body.night-mode #hatch-overlay .hatch-content {
    background-color: #34495e;
    border: 1px solid #7f8c8d;
    color: #ecf0f1;
}

#hatch-overlay .hatch-content.hidden-content { /* Per nascondere/mostrare form */
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
}


/* Stili per l'uovo e la sua animazione */
#egg-container {
    height: 100px; /* O dimensione desiderata */
    margin: 20px auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

#egg-image {
    max-height: 100%;
    max-width: 100%;
    /* Aggiungi animazione dondolio */
    animation: egg-wobble 2s infinite ease-in-out;
    transform-origin: bottom center; /* Dondola dalla base */
}

@keyframes egg-wobble {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-4deg); }
  75% { transform: rotate(4deg); }
}

/* Animazione opzionale per la schiusa (effetto "crack") */
#egg-container.cracking img {
    animation: egg-crack 0.5s ease-in-out forwards;
}

@keyframes egg-crack {
    0% { transform: scale(1) rotate(0deg); opacity: 1;}
    50% { transform: scale(1.1) rotate(5deg); }
    100% { transform: scale(0.8) rotate(-5deg); opacity: 0; }
}

/* Nascondi il form inizialmente */
#hatch-form {
    margin-top: 15px;
    opacity: 0; /* Inizia nascosto */
    transition: opacity 0.5s ease-in; /* Appare gradualmente */
}
#hatch-form.visible {
    opacity: 1; /* Rendi visibile */
}


/* Stili per i campi del form (come prima o aggiustati) */
#hatch-form label { display: block; margin-top: 10px; }
#hatch-form input[type="text"] { width: 80%; padding: 8px; margin-top: 3px; }
#hatch-form .gender-selection { margin-top: 15px; text-align: center;}
#hatch-form .gender-selection label { margin: 0 10px; }
#hatch-form button { margin-top: 20px; }
#hatch-message { color: red; margin-top: 10px; min-height: 1em; }

.gender-selection input[type="radio"] {
    margin-right: 4px; /* Spazio tra il pallino e il testo */
    vertical-align: middle; /* Allinea meglio con il testo */
    cursor: pointer;
}

/* Stili per Modalità Notte */
body.night-mode .form-label {
    color: #ccc;
}
/* Il colore del testo delle label radio dovrebbe essere già gestito
   dalla regola generica per il testo in night-mode */
#tamagotchi-name-display {
    font-weight: bold;
    margin-top: -10px;
    margin-bottom: 10px;
    text-align: center;
    /* Stili di Debug Temporanei */
    border: 2px dotted lime !important;
    padding: 5px !important;
    min-height: 1.5em !important; /* Assicura altezza minima */
    color: lime !important; /* Colore molto visibile */
    background-color: rgba(0, 0, 0, 0.5) !important; /* Sfondo per contrasto */
}
#restart-container {
    /* Stili per posizionamento/spaziatura */
}
#restart-button {
    padding: 10px 20px;
    font-size: 1.1em;
    background-color: #f1c40f; /* Giallo/Oro per risaltare */
    color: #333;
    border: 1px solid #e6ac00;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}
#restart-button:hover {
    background-color: #e6ac00;
}
body.night-mode #restart-button {
    background-color: #f39c12;
    border-color: #e67e22;
    color: #fff;
}
 body.night-mode #restart-button:hover {
    background-color: #e67e22;
}

/* Stili esistenti ... */

/* Stili Overlay Selezione Personaggio */
#character-select-overlay {
    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: 1050; /* Sopra il gioco, ma sotto eventuali altri overlay se necessario */
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
}

#character-select-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.character-select-content {
    background-color: #fff;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    text-align: center;
    width: 90%;
    max-width: 500px; /* Un po' più largo per mostrare opzioni */
    border: 2px solid #ccc;
}
body.night-mode .character-select-content {
    background-color: #34495e;
    border-color: #7f8c8d;
    color: #ecf0f1;
}
body.night-mode .character-select-content h2 {
     color: #ecf0f1;
}

#character-options {
    display: flex; /* Mette le opzioni in riga */
    flex-wrap: wrap; /* Va a capo se non c'è spazio */
    justify-content: center; /* Centra le opzioni */
    gap: 20px; /* Spazio tra le opzioni */
    margin: 20px 0;
    padding: 10px;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}
body.night-mode #character-options {
    border-color: #566573;
}


.char-option {
    border: 3px solid transparent; /* Bordo per feedback selezione */
    padding: 5px;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.char-option:hover {
    transform: scale(1.05);
}

.char-option.selected {
    border-color: #007bff; /* Colore per selezione */
    transform: scale(1.1);
}
body.night-mode .char-option.selected {
    border-color: #5dade2;
}


.char-option img {
    display: block;
    width: 80px; /* Dimensione preview */
    height: 80px;
    object-fit: contain; /* Adatta immagine senza distorcerla */
}

#confirm-select-button {
    padding: 10px 20px;
    /* Stili simili altri bottoni */
}
#confirm-select-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}