/* --- STRUTTURA GENERALE & SFONDO --- */
.body-sapienza {
    background: #2c1e14; /* Sfondo scuro tipo grotta */
    background-image: radial-gradient(circle, #4a3528 0%, #2c1e14 100%);
    color: #f4e4bc;
    font-family: 'Fredoka One', sans-serif;
    margin: 0;
    padding: 20px 15px; /* Ridotto il padding verticale per eliminare lo spazio in alto */
    min-height: 100vh;
}

/* --- IL LIBRO / PERGAMENA CENTRALE --- */
.libro-magico {
    max-width: 1050px; /* Allargato leggermente per sfruttare meglio lo schermo */
    margin: 20px auto 40px auto; /* Centrato con margine controllato in alto */
    background: #fdf5e6; /* Colore carta antica */
    border: 8px solid #63422e;
    border-radius: 20px;
    padding: 35px 40px; /* Ridotto da 80px a 35px per eliminare il vuoto interno */
    color: #4a3528;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

/* --- SEZIONE INTESTAZIONE MAESTRO LIEVITO --- */
.sezione-maestro {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 25px;
    padding: 20px 25px;
    background: rgba(160, 45, 45, 0.05);
    border-radius: 20px;
    margin-bottom: 35px;
}

.img-maestro {
    width: 180px;
    height: 180px;
    object-fit: cover;
    flex-shrink: 0;
    border-radius: 50%;
    border: 4px solid #a02d2d;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.bolla-dialogo h1 {
    font-family: 'Pirata One', cursive;
    color: #a02d2d;
    font-size: 2.4rem;
    margin: 0 0 10px 0;
}

.bolla-dialogo p {
    font-family: 'Quicksand', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
}

/* --- GRIGLIA CARDS INCANTESIMI --- */
.griglia-incantesimi {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 35px;
}

.incantesimo-card {
    background: rgba(160, 45, 45, 0.08);
    padding: 22px 18px;
    border-radius: 15px;
    border-left: 5px solid #a02d2d;
    transition: transform 0.25s ease, background 0.25s ease;
}

.incantesimo-card:hover {
    transform: translateY(-4px);
    background: rgba(160, 45, 45, 0.15);
}

.incantesimo-card h2 {
    font-size: 1.25rem;
    margin: 5px 0 10px 0;
    color: #2c1e14;
}

.incantesimo-card p {
    font-family: 'Quicksand', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
}

.icona-magica {
    font-size: 2.2rem;
}

/* --- PERGAMENA STORIA --- */
.pergamena {
    margin-top: 30px;
    background: #f4e4bc;
    padding: 25px 30px;
    border: 2px solid #d4a373;
    border-radius: 12px;
    font-family: 'Quicksand', sans-serif;
    font-weight: 600;
    line-height: 1.5;
}

.pergamena h2 {
    font-family: 'Fredoka One', sans-serif;
    color: #63422e;
    font-size: 1.5rem;
    margin-top: 0;
}

/* --- PULSANTI NAVIGAZIONE --- */
.nav-basso {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 40px;
}

.btn-magico {
    display: inline-block;
    background: #a02d2d;
    color: #ffffff;
    text-decoration: none;
    padding: 12px 25px;
    border-radius: 50px;
    font-family: 'Fredoka One', sans-serif;
    font-size: 1rem;
    transition: all 0.25s ease;
    border: 2px solid transparent;
    text-align: center;
}

.btn-magico:hover {
    background: #63422e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 850px) {
    .griglia-incantesimi {
        grid-template-columns: 1fr;
    }

    .sezione-maestro {
        flex-direction: column;
        text-align: center;
    }

    .img-maestro {
        width: 140px;
        height: 140px;
    }

    .libro-magico {
        padding: 20px 15px;
        margin-top: 10px;
    }

    .nav-basso {
        flex-direction: column;
        gap: 12px;
    }

    .btn-magico {
        width: 100%;
        max-width: 280px;
        box-sizing: border-box;
    }
}