/* ============================================================
   1. IMPOSTAZIONI GENERALI (BODY E RESET)
   ============================================================ */
* { box-sizing: border-box; }

.body-manuale {
    background: #3e2723;
    margin: 0;
    padding: 0;
    font-family: 'Fredoka One', sans-serif;
}

/* QUESTO È FONDAMENTALE: spinge giù tutto il contenuto per non 
   farlo finire sotto l'header in legno */
main, .manuale-pergamena, .laboratorio-container {
    margin-top: 160px !important; 
    margin-bottom: 50px;
}

@media (max-width: 768px) {
    main, .manuale-pergamena, .laboratorio-container {
        margin-top: 180px !important; /* Ancora più spazio su mobile */
    }
}

/* ============================================================
   2. LA PERGAMENA (IL CONTENITORE GIALLO)
   ============================================================ */
.manuale-pergamena {
    background: #f4e4bc;
    max-width: 950px;
    margin-left: auto;
    margin-right: auto;
    padding: 40px;
    border: 15px solid transparent;
    border-image: url('../img/border-vintage.png') 30 round;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    color: #4e342e;
    position: relative;
    overflow: hidden; /* Evita che le immagini escano dai bordi */
}

@media (max-width: 768px) {
    .manuale-pergamena {
        padding: 20px;
        border-width: 8px;
        width: 95%; /* Lascia un po' di margine ai lati dello schermo */
    }
    
    .header-magico h1 { font-size: 2.2rem !important; }
}

.header-magico h1 {
    font-family: 'Pirata One', cursive;
    font-size: 3.5rem;
    color: #a02d2d;
    text-align: center;
    margin-top: 0;
}

/* ============================================================
   3. LE FASI (IMMAGINI E TESTI)
   ============================================================ */
.fase-manuale {
    display: flex;
    flex-direction: row; /* Desktop: affiancati */
    align-items: center;
    gap: 30px;
    margin: 40px 0;
    padding-bottom: 20px;
    border-bottom: 2px dashed #d7ccc8;
}

.fase-manuale.reverse { flex-direction: row-reverse; }

.img-fase {
    width: 45%;
    max-width: 400px;
    height: auto;
    border-radius: 20px;
    box-shadow: 5px 5px 15px rgba(0,0,0,0.2);
}

.fase-testo { width: 55%; }

@media (max-width: 768px) {
    .fase-manuale, .fase-manuale.reverse {
        flex-direction: column !important; /* Mobile: uno sopra l'altro */
        text-align: center;
    }
    
    .img-fase, .fase-testo {
        width: 100% !important;
    }

    .img-fase { order: -1; margin-bottom: 15px; } /* Immagine sempre sopra */
}

/* ============================================================
   4. IL CALCOLATORE (BILANCIA ALCHIMISTA)
   ============================================================ */
.sezione-calcolatore {
    background: #6d4c41;
    color: white;
    padding: 25px;
    border-radius: 20px;
    text-align: center;
    width: 100%;
    max-width: 600px;
    margin: 40px auto;
}

.box-calcolo input {
    padding: 15px;
    font-size: 1.2rem;
    border-radius: 10px;
    border: none;
    margin: 15px 0;
    width: 80%;
    max-width: 250px;
    text-align: center;
}

.risultato { 
    font-size: 1.6rem; 
    color: #f4e4bc; 
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
}

/* ============================================================
   5. NAVIGAZIONE (I PULSANTI IN FONDO)
   ============================================================ */
.nav-basso {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
    padding-bottom: 30px;
    width: 100%;
}

.btn-magico {
    background: #a02d2d;
    color: white;
    text-decoration: none;
    padding: 15px 25px;
    border-radius: 50px;
    font-size: 1.1rem;
    text-align: center;
    transition: 0.3s;
    flex: 1; /* Fa sì che i tasti crescano insieme */
    max-width: 250px;
}

.btn-magico:hover { background: #63422e; transform: scale(1.05); }

@media (max-width: 768px) {
    .nav-basso {
        flex-direction: column; /* Tasti uno sopra l'altro */
        align-items: center;
    }
    
    .btn-magico {
        width: 90%;
        max-width: none;
    }
}