/* --- 1. AMBIENTE NOTTURNO & LAYOUT --- */
.body-faro {
    background: #0a192f; /* Blu scuro notte profondissima */
    margin: 0;
    padding: 0;
    overflow: hidden; /* Impedisce scroll molesti su mobile */
    width: 100vw;
    height: 100vh;
    font-family: 'Fredoka One', cursive;
}

.cielo-faro {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- 2. IL FARO (CENTRO DELLA MAPPA) --- */
/* --- IL FARO (SPOSTATO IN BASSO) --- */
.faro-container {
    position: absolute; /* Cambiato da relative a absolute */
    bottom: 20;          /* Incollato al fondo dello schermo */
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    text-align: center;
    pointer-events: none; /* Così non disturba i click delle bolle vicine */
}

.faro-grafica {
    max-width: 350px; /* Un po' più piccolo per lasciare spazio al cielo */
    width: 60vw;      /* Responsive */
    height: auto;
    filter: drop-shadow(0 0 30px rgba(255, 255, 255, 0.2));
    vertical-align: bottom; /* Rimuove spazi bianchi sotto l'immagine */
}




/* --- 3. IL SISTEMA DELLE BOLLE (ZONA CLICCABILE) --- */
.zona-bolle {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* TRUCCO: clicchi attraverso il vuoto */
    z-index: 10;
}

.bolla-sapienza {
    position: absolute;
    /* Dimensioni Responsive */
    width: 28vw; 
    height: 28vw;
    max-width: 160px;
    max-height: 160px;
    min-width: 110px;
    min-height: 110px;
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    
    cursor: pointer;
    pointer-events: auto; /* RIATTIVA IL CLICK SOLO SULLA BOLLA */
    z-index: 20;
    
    background: radial-gradient(circle, var(--color) 0%, transparent 75%);
    border-radius: 50%;
    
    /* Animazione Fluttuante */
    animation: fluttuaMagico 6s ease-in-out infinite;
    animation-delay: var(--delay);
    transition: transform 0.3s ease, filter 0.3s ease;
}

.bolla-sapienza img {
    width: 50%;
    height: auto;
    filter: drop-shadow(0 0 10px white);
}

/* --- 4. TESTI E LEGGIBILITÀ --- */
.info-testo-bolla {
    margin-top: 8px;
    pointer-events: none;
}

.titolo-ingrediente {
    color: #FFD700; /* Oro brillante */
    font-size: clamp(0.7rem, 2.5vw, 1.1rem); /* Font fluido */
    text-shadow: 2px 2px 4px rgba(0,0,0,0.9), 0 0 10px var(--color);
    display: block;
    text-transform: uppercase;
}

.label-bolla {
    color: #ffffff; /* Bianco puro */
    font-size: clamp(0.5rem, 1.8vw, 0.8rem);
    text-shadow: 1px 1px 3px black;
    max-width: 90%;
    line-height: 1.1;
}

/* --- 5. ANIMAZIONI ED EFFETTI --- */
@keyframes fluttuaMagico {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(15px, -35px) scale(1.05); }
    66% { transform: translate(-15px, -15px) scale(0.95); }
}

.bolla-sapienza:hover {
    transform: scale(1.15) !important;
    filter: brightness(1.3);
}

/* --- 6. NAVIGAZIONE E MODAL --- */
.btn-ritorno {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #63422e;
    color: #f4e4bc;
    padding: 12px 20px;
    border: 3px solid #f4e4bc;
    border-radius: 50px;
    text-decoration: none;
    z-index: 100;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.modal-pergamena {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 200;
    justify-content: center;
    align-items: center;
}

.contenuto-pergamena {
    background: #f4e4bc;
    padding: 30px;
    border: 8px solid #63422e;
    width: 85%;
    max-width: 450px;
    border-radius: 15px;
    position: relative;
    color: #63422e;
    max-height: 80vh;
    overflow-y: auto;
}

/* --- LA BOLLA MADRE (EFFETTO SAPONE) --- */
.bolla-madre {
    position: absolute;
    top: 40%; left: 50%;
    transform: translate(-50%, -50%);
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 60%, transparent 70%);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 50; /* Sopra tutto */
    pointer-events: auto;
    transition: all 0.3s ease;
    animation: fluttuaMadre 5s ease-in-out infinite;
}

.label-madre {
    color: white;
    font-size: 0.9rem;
    text-align: center;
    font-family: 'Fredoka One', cursive;
    text-shadow: 0 0 10px rgba(255,255,255,0.5);
    padding: 20px;
}

@keyframes fluttuaMadre {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -55%) scale(1.05); }
}

/* Stato di scoppio della bolla madre */
.bolla-madre.scoppiata {
    animation: scoppioMadre 0.4s ease-out forwards;
    pointer-events: none; /* Non più cliccabile */
}

@keyframes scoppioMadre {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.3); opacity: 0.5; border-width: 10px; }
    100% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
}

/* --- LE BOLLE SEGRETE (NASCOSTE ALL'INIZIO) --- */
.bolla-segreta {
    /* Inizialmente sono tutte al centro, invisibili */
    top: 50% !important; 
    left: 50% !important;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Effetto molla */
    pointer-events: none; /* Non cliccabili finché non appaiono */
}

/* Stato visibile dopo lo scoppio */
.bolla-segreta.visibile {
    /* Usano le coordinate casuali calcolate in PHP */
    top: var(--target-top) !important;
    left: var(--target-left) !important;
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto; /* Tornano cliccabili */
    /* Dopo lo scoppio, riprendono a fluttuare */
    animation: fluttuaMagico 6s ease-in-out infinite;
    animation-delay: var(--delay);
}
/* --- RESET E STRUTTURA --- */
.body-faro {
    background: #0a192f;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Fondamentale: niente barre di scorrimento */
    width: 100vw;
    height: 100vh;
    font-family: 'Fredoka One', cursive;
}

.cielo-faro {
    position: relative;
    width: 100%;
    height: 100%;
}

/* --- IL FARO (POSIZIONAMENTO RESPONSIVE) --- */
.faro-container {
    position: absolute;
    bottom: -10px; /* Lo appoggiamo al fondo */
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    pointer-events: none;
    text-align: center;
}

.faro-grafica {
    width: 50vw; /* Su mobile occupa metà larghezza */
    max-width: 320px; /* Su PC non diventa gigante */
    height: auto;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.1));
}

/* --- LA ZONA DELLE BOLLE --- */
.zona-bolle {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 10;
    pointer-events: none;
}

/* BOLLA MADRE */
.bolla-madre {
    position: absolute;
    top: 40%; left: 50%;
    transform: translate(-50%, -50%);
    width: 180px; height: 180px;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    z-index: 50;
    animation: fluttuaMadre 4s ease-in-out infinite;
}

.label-madre {
    color: white;
    font-size: clamp(0.8rem, 3vw, 1rem);
    text-align: center;
    text-shadow: 0 0 10px rgba(255,255,255,0.5);
    padding: 15px;
}

/* EFFETTO SCINTILLIO (SPARKLES) */
.sparkle {
    position: absolute;
    width: 10px; height: 10px;
    background: white;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    z-index: 60;
}

/* --- BOLLE SEGRETE RESPONSIVE --- */
.bolla-segreta {
    position: absolute;
    top: 40% !important; left: 50% !important; /* Partono dal centro del cielo */
    transform: translate(-50%, -50%) scale(0);
    width: 25vw; height: 25vw;
    max-width: 140px; max-height: 140px;
    min-width: 90px; min-height: 90px;
    background: radial-gradient(circle, var(--color) 0%, transparent 75%);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 20;
}

.bolla-segreta.visibile {
    top: var(--target-top) !important;
    left: var(--target-left) !important;
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* TESTI */
.titolo-ingrediente {
    color: #FFD700;
    font-size: clamp(0.6rem, 2vw, 0.9rem);
    text-shadow: 1px 1px 3px black;
}

/* ANIMAZIONI */
@keyframes fluttuaMadre {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -55%) scale(1.05); }
}

@keyframes sparkleAnim {
    0% { transform: translate(0,0) scale(1); opacity: 1; }
    100% { transform: translate(var(--x), var(--y)) scale(0); opacity: 0; }
}
/* --- MENU NAVIGAZIONE RESPONSIVE --- */
.menu-faro {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000; /* Sopra a tutto, anche al modal */
}

.hamburger {
    width: 45px;
    height: 35px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    background: rgba(99, 66, 46, 0.8);
    padding: 10px;
    border-radius: 8px;
    border: 2px solid #f4e4bc;
}

.hamburger span {
    display: block;
    height: 4px;
    width: 100%;
    background: #f4e4bc;
    border-radius: 10px;
    transition: 0.3s;
}

/* Stile Lista Links */
.nav-links {
    position: fixed;
    right: -100%; /* Nascosto a destra */
    top: 0;
    width: 70%;
    height: 100vh;
    background: #63422e;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    list-style: none;
    transition: 0.5s;
    margin: 0;
    box-shadow: -5px 0 15px rgba(0,0,0,0.5);
}

.nav-links.active {
    right: 0; /* Entra in scena */
}

.nav-links li {
    margin: 20px 0;
}

.nav-links a {
    color: #f4e4bc;
    text-decoration: none;
    font-size: 1.5rem;
    font-family: 'Fredoka One', cursive;
    transition: 0.3s;
}

.nav-links a:hover, .nav-links a.active {
    color: #FFD700;
}

/* --- MEDIA QUERY PER DESKTOP --- */
@media (min-width: 1024px) {
    .nav-links {
        position: static;
        height: auto;
        width: auto;
        flex-direction: row;
        background: transparent;
        box-shadow: none;
        right: 0;
    }
    .hamburger { display: none; } /* Nascondi hamburger su PC */
    .nav-links li { margin: 0 15px; }
    .nav-links a { font-size: 1.1rem; }
    .menu-faro { top: 30px; right: 40px; }
}