/* STILE TEST 4 SUI LIMITI NOTEVOLI - VERSIONE DSA (Puzzle e Abbinamento)
   Base: stile-test3-limiti-notevoli-dsa.css (stessa palette DSA, stessi componenti,
   stesso pannello accessibilità testo/contrasto/spaziatura) + blocchi puzzle e abbinamento in fondo. */

:root {
    --bg-dsa: #fdf6e3;          /* Sfondo crema/paglierino per ridurre l'abbagliamento */
    --text-dsa: #202124;        /* Grigio quasi nero per contrasto morbido */
    --primary-blue: #0056b3;
    --verify-blue: #004494;
    --reset-red: #b22222;
    --index-bordeaux: #800020;
    --step-bg: #fff9e6;         /* Sfondo evidenziato per i passaggi */
    --green-dsa: #1a6b35;       /* Verde DSA (coerente con stile-questionario-dsa.css) */
    --purple: #5a0099;          /* Pannello accessibilità (coerente con la teoria DSA) */
}

body {
    /* Verdana è uno dei font più leggibili per DSA tra quelli standard */
    font-family: 'Verdana', 'Geneva', sans-serif;
    background-color: var(--bg-dsa);
    color: var(--text-dsa);
    line-height: 1.8;           /* Interlinea aumentata per evitare sovrapposizioni */
    letter-spacing: 0.05em;     /* Spaziatura tra lettere aumentata */
    margin: 0;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.main-test-wrapper {
    background-color: #ffffff;
    max-width: 1200px;
    width: 100%;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    margin-top: 20px;
    box-sizing: border-box;
}

/* Header v3 (DSA): bordo tratteggiato verde, breadcrumb, main-menu */
.header-box {
    border: 2.5px dashed var(--green-dsa);
    padding: 12px 14px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    row-gap: 8px;
    background-color: #ffffff;
    cursor: pointer;
    margin-bottom: 18px;
    border-radius: 10px;
}
.header-box .brand-left,
.header-box .brand-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.header-box img { height: 50px; width: auto; }
.header-box .site-url { font-size: 0.9rem; color: #555; font-weight: 600; }
.header-box .logo-block { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.header-box .since { font-size: 0.78rem; color: #999; font-style: italic; }

.breadcrumb {
    font-size: 1rem;
    margin-bottom: 22px;
    color: #555;
}
.breadcrumb a {
    color: var(--green-dsa);
    text-decoration: none;
    font-weight: 700;
}

.main-menu {
    background-color: #f4f7f5;
    border: 1.5px solid var(--green-dsa);
    border-radius: 10px;
    margin-bottom: 28px;
    padding: 6px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}
.main-menu a {
    display: inline-block;
    padding: 11px 20px;
    color: var(--text-dsa);
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}
.main-menu a:hover, .main-menu a.current {
    background-color: var(--green-dsa);
    color: #ffffff;
}

@media (max-width: 420px) {
    .header-box img { height: 38px; }
    .header-box .site-url { font-size: 0.8rem; }
}

/* Titoli e Istruzioni */
h1 {
    font-size: 2rem;
    color: var(--primary-blue);
    text-align: center;
    margin: 10px 0;
}

.instruction-text {
    background-color: #e7f3ff;
    border-left: 6px solid #0056b3;
    padding: 20px;
    font-weight: bold;
    margin-bottom: 30px;
    border-radius: 4px;
}

/* Box argomenti (verde) */
.topics-box {
    background: #d4edda;
    padding: 15px;
    border-left: 4px solid #28a745;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

/* Box istruzioni smartphone (giallo) */
.instruction-box {
    background: #fff3cd;
    padding: 15px;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

/* Domande e Formule */
.question {
    background: #fff;
    border: 2px solid #ced4da;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 40px;        /* Molto spazio tra una domanda e l'altra */
}

.question h3 {
    color: var(--primary-blue);
    font-size: 1.4rem;
    margin-bottom: 15px;
}

/* Ingrandimento formule MathJax per DSA */
.mjx-chtml, .MathJax {
    font-size: 1.25rem !important;
    margin: 15px 0 !important;
}

/* Opzioni di risposta larghe e ben distanziate */
label {
    display: block;
    background: #f8f9fa;
    padding: 15px;
    margin: 12px 0;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    cursor: pointer;
    transition: background 0.2s;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

label:hover {
    background: #e9ecef;
}

input[type="radio"] {
    transform: scale(1.5);      /* Radio button più grandi per facilitare il clic */
    margin-right: 15px;
}

/* Soluzioni */
.solution {
    display: none;
    margin-top: 0;              /* 🔥 fondamentale */
    padding: 20px;
    background-color: var(--step-bg);
    border-radius: 0 8px 8px 8px; /* 🔥 angoli coerenti col bottone */
    border: 1px dashed #d4a017;
    border-top: none;           /* 🔥 elimina doppio bordo */
    font-size: 1.1rem;
}

.solution ol {
    line-height: 1.8;
}

/* BOTTONI - Grandi e con colori differenziati */
button {
    font-family: 'Verdana', sans-serif;
    padding: 15px 25px;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    margin: 10px;
}

.btn-secondary, .solution-btn, .solution-toggle-btn {
    background-color: #4a9edd;
    color: white;
    border: 2px solid #0056b3;   /* ✔️ AGGIUNTO BORDO CONTRASTO */
}
.btn-secondary:hover, .solution-btn:hover, .solution-toggle-btn:hover {
    background-color: #1a6fa8;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
}
/* Stato quando la soluzione è aperta (Rosso) */
.btn-active {
    background-color: #d9534f !important;
    color: white !important;

    border: 2px solid #b52b27 !important;  /* ✔️ bordo coerente e visibile */
    border-bottom: none !important;

    border-radius: 10px 10px 0 0 !important;
    padding-bottom: 17px !important;
}.btn-active {
    background-color: #d9534f !important;
    color: white !important;

    border-bottom: none !important;
    border-radius: 10px 10px 0 0 !important;

    padding-bottom: 17px !important; /* per allinearsi al box sotto */
}

/* Ascolta (Verde) */
button.btn-listen {
    background-color: #28a745 !important;
    color: white !important;
    border: 2px solid #1e7e34 !important;  /* ✔️ bordo più scuro per contrasto */
	
}

button.btn-listen:hover {
    background-color: #ffffff !important;
    color: #28a745 !important;
    border: 2px solid #28a745 !important;
}
.btn-listen.is-playing {
    background-color: #ffc107 !important;
    color: #333;
    border-color: #e0a800;
}
/* Verifica (Blu) */
.btn-verify {
    background-color: var(--verify-blue);
    color: white;
}

.btn-verify:hover {
    background-color: #003d82;
}

/* Ricomincia (Nero) */
.btn-reset {
    background-color: #333333;
    color: white;
}

.btn-reset:hover {
    background-color: #1a1a1a;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transform: translateY(-2px);
}

/* Stampa (Viola) */
.btn-print {
    background-color: #6f42c1;
    color: white;
}

.btn-print:hover {
    background-color: #5a32a3;
}

/* Indice (Bordeaux) */
.btn-index {
    background-color: var(--index-bordeaux);
    color: white;
}

.btn-index:hover {
    background-color: #600018;
    transform: translateY(-2px);
}
.btn-home-test { background-color: #17a2b8 !important; color: white !important; }
.btn-home-test:hover { background-color: #117a8b !important; }
/* --- LICENSE BOX (Creative Commons) e LINK VALIDAZIONE (v3) --- */
footer.site-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
    text-align: center;
    font-size: 0.95rem;
    color: #555;
}
.license-box {
    background-color: #fafafa;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 18px;
    margin-top: 20px;
    font-size: 0.88rem;
    color: #777;
}
.validation-link {
    margin-top: 15px;
    font-size: 0.85rem;
    color: #999;
}
.validation-link a {
    color: #999;
    text-decoration: none;
}
.validation-link a:hover {
    text-decoration: underline;
}

/* Immagini all'interno delle soluzioni */
.solution-image {
    text-align: center;
    margin: 18px 0;
}
.solution-image img {
    max-width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
}

/* Teoria (Blu chiaro) */
.btn-theory {
    background-color: #007bff;
    color: white;
}

.btn-theory:hover {
    background-color: #0056b3;
}

/* Bottone per tornare alla Versione Standard (Arancione) */
.btn-standard-version {
    background-color: #ff8c00;
    color: white;
}

.btn-standard-version:hover {
    background-color: #e67e00;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transform: translateY(-2px);
}

button:hover {
    transform: translateY(-3px);
    filter: brightness(1.1);
}


/* Footer centrato e ordinato */
.footer-container {
    display: block;
    text-align: center;
    margin-top: 20px;
    padding: 20px 0;
}
.footer-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

/* Risultati chiari */
.results {
    margin: 30px auto;   /* ✔️ CENTRATO ORIZZONTALMENTE */
    padding: 20px;
    border-radius: 10px;
    background-color: #e9ecef;
    width: 100%;
    max-width: 800px;
    text-align: center;  /* ✔️ TESTO CENTRATO (opzionale ma utile) */
}

.results h2, .results h3 {
    color: var(--primary-blue);
    margin-top: 0;
}

.correct { color: green; font-weight: bold; }
.incorrect { color: red; font-weight: bold; }

/* --- RESPONSIVE SMARTPHONE --- */
@media (max-width: 768px) {
    .main-test-wrapper {
        max-width: 100%;
        padding: 15px;
        margin: 0;
        border-radius: 8px;
    }
    
    body {
        padding: 5px;
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    .instruction-text {
        padding: 12px;
        font-size: 0.9rem;
    }
    
    .question {
        padding: 15px;
    }
    
    .question h3 {
        font-size: 1.3rem;
    }
    
    label {
        padding: 12px;
        font-size: 1rem;
    }
    
    button {
        font-size: 1rem;
        padding: 12px 20px;
    }
    
    .header-box img {
        max-height: 35px;
    }
    
    .solution {
        padding: 15px;
        font-size: 1rem;
    }
}

/* --- REGOLE PER LA STAMPA --- */
@media print {
    .solution {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    button, 
    .footer-buttons, 
    .header-box, 
    .breadcrumb,
    .main-menu,
    footer.site-footer,
    input[type="radio"], 
    hr,
    .btn-listen {
        display: none !important;
    }

    .question {
        page-break-inside: avoid;
        border: none !important;
        border-bottom: 1px solid #ddd !important;
        margin-bottom: 30px !important;
        padding-bottom: 20px !important;
    }

    img {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid;
    }
    
    body {
        background: white !important;
    }
    
    .main-test-wrapper {
        box-shadow: none !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .solution {
        background: #fffef5 !important;
        border-left: 3px solid #999 !important;
        page-break-inside: avoid;
    }
    
    .footer-container { 
        display: none !important; 
    }
}
/*
@media (min-width: 600px) {
    .footer-container {
        flex-direction: row;
        justify-content: center;
    }
}
*/
/* --- INVERSIONE COLORI FOOTER AL HOVER --- */

/* Verifica (Verde) */
.btn-verify {
    background-color: #28a745;
    color: white;
    border: 2px solid #28a745;
}
.btn-verify:hover {
    background-color: white;
    color: #28a745;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

/* Ricomincia (Nero) */
.btn-reset {
    background-color: #333333;
    color: white;
    border: 2px solid #333333;
}
.btn-reset:hover {
    background-color: white;
    color: #333333;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transform: translateY(-2px);
}

/* Stampa (Viola) */
.btn-print {
    background-color: #6f42c1;
    color: white;
    border: 2px solid #6f42c1;
}
.btn-print:hover {
    background-color: white;
    color: #6f42c1;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

/* DSA (Arancione) */
.btn-dsa {
    background-color: #ff9800 !important;
    color: white !important;
    border: 2px solid #ff9800 !important;
}
.btn-dsa:hover {
    background-color: white !important;
    color: #ff9800 !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
    transform: translateY(-2px);
}

/* Indice (Bordeaux) */
.btn-index {
    background-color: #800020;
    color: white;
    border: 2px solid #800020;
}
.btn-index:hover {
    background-color: white;
    color: #800020;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}
/* Versione Standard (Arancione) */
.btn-standard-version {
    background-color: #ff8c00;
    color: white;
    border: 2px solid #ff8c00;
}
.btn-standard-version:hover {
    background-color: white;
    color: #ff8c00;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}
/* --- STILE PER IL BOTTONE "ALTRI TEST SU QUESTO ARGOMENTO" --- */
.btn-altri-test {
    background-color: #0056b3 !important;
    color: #ffffff !important;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    display: inline-block;
    line-height: normal;
    box-sizing: border-box;
}

.btn-altri-test:hover {
    background-color: #003d80 !important;
}

.btn-altri-test:active {
    transform: scale(0.98);
}
/* Teoria (Blu) */
.btn-theory {
    background-color: #007bff;
    color: white;
    border: 2px solid #007bff;
}
.btn-theory:hover {
    background-color: white;
    color: #007bff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}
/* ============================================================ */
/* BOTTONE AIUTO e BOX HINT - Versione DSA                      */
/* ============================================================ */

/* Contenitore bottoni sotto ogni domanda */
.solution-button-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-start;
    margin-top: 10px;
}

/* Bottone Aiuto (Blu vivace → Azzurrino quando aperto) */
.btn-aiuto {
    background-color: #ffb703;   /* ambra caldo */
    color: #333;
    border: 2px solid #0056b3;
    padding: 15px 25px;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    margin: 10px;
    font-family: 'Verdana', sans-serif;
}

.btn-aiuto:hover {
    background-color: #f4a300;
    color: white;
    transform: translateY(-2px);
}

/* Stato aperto: si fonde con il box hint azzurrino */
.btn-aiuto.is-active {
    background-color: #e7f1ff !important;
    color: #084298 !important;
    border: 2px solid #74c0fc !important;
    border-bottom: none !important;
    border-radius: 10px 10px 0 0 !important;
    padding-bottom: 17px !important;
    transform: none !important;
}

.btn-aiuto.is-active:hover {
    background-color: #d0ebff !important;
    transform: none !important;
}

/* Box suggerimento (hint) */
.hint-box {
    display: none;
    margin-top: 0;
    padding: 15px 18px;
    background: #e7f1ff;
    border: 2px solid #74c0fc;
    border-radius: 0 8px 8px 8px;
    font-size: 1rem;
    line-height: 1.8;
    color: #084298;
}

.hint-box.visible {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .solution-button-container {
        flex-direction: column;
        align-items: stretch;
    }
    .btn-aiuto {
        width: 100%;
        margin: 5px 0;
    }
}

/* ---- Bottone torna su (flottante, appare dopo 300px di scroll) ---- */
#btn-top {
    position: fixed;
    bottom: 20px;
    right: 4px;
    background: #9C27B0;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: background 0.2s;
}
#btn-top:hover { background: #7a00cc; }

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
}

@media print {
    #btn-top { display: none !important; }
}

/* ============================================================ */
/* AGGIUNTE: classi usate dal generatore JS ma non definite nel  */
/* modello originale (problem-text, options, separator)          */
/* ============================================================ */
.problem-text {
    background-color: #f0f7ff;
    border: 1px solid #d0e3ff;
    border-left: 3px solid #007bff;
    padding: 18px 22px;
    border-radius: 4px 8px 8px 4px;
    margin: 15px 0 20px 0;
}
.problem-text p {
    margin: 0 0 12px 0;
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-dsa);
}

.options {
    margin-top: 10px;
}

.separator {
    border: 0;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--green-dsa), transparent);
    margin: 20px 0;
}
/* Stili addizionali per footer e licenza */
.license-box img {
    border-width: 0;
    margin-bottom: 10px;
}

.license-box a {
    color: #555;
    font-weight: bold;
}

/* Risultati nascondibili */
.results {
    display: none;
}


/* ============================================================ */
/* PANNELLO ACCESSIBILITÀ (testo/contrasto/spaziatura)           */
/* stesso pannello usato nella pagina di teoria DSA               */
/* ============================================================ */
#acc-panel {
    background: #ffffff;
    border: 2px solid var(--purple);
    border-radius: 14px;
    padding: 10px 14px;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    min-width: 0;
    margin: 0 0 20px 0;
}
#acc-panel label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--purple);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 2px;
    display: block;
}
#acc-panel button {
    font-family: inherit;
    background: var(--purple);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 7px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
#acc-panel button:hover { background: #7a00cc; }
#acc-panel .acc-row { display: flex; gap: 6px; align-items: center; }
#acc-panel input[type=range] { flex: 1; accent-color: var(--purple); width: 80px; min-width: 0; }

@media print {
    #acc-panel { display: none !important; }
}
@media (max-width: 600px) {
    #acc-panel { flex-direction: column; align-items: flex-start; }
}

/* ============================================================ */
/* ALTO CONTRASTO                                                 */
/* ============================================================ */
body.alto-contrasto { background-color: #000; color: #fff; }
body.alto-contrasto .main-test-wrapper { background-color: #111; box-shadow: none; }
body.alto-contrasto .header-box { background-color: #111; border-color: #00e676; }
body.alto-contrasto .breadcrumb { color: #ccc; }
body.alto-contrasto .breadcrumb a,
body.alto-contrasto .header-box .site-url,
body.alto-contrasto .header-box .since { color: #ccc; }
body.alto-contrasto .main-menu { background-color: #111; border-color: #00e676; }
body.alto-contrasto .main-menu a { color: #fff; }
body.alto-contrasto .main-menu a:hover,
body.alto-contrasto .main-menu a.current { background-color: #00e676; color: #000; }
body.alto-contrasto h1 { color: #00e676; }
body.alto-contrasto .instruction-text {
    background-color: #0d1f3c;
    border-left-color: #4a9edd;
    color: #fff;
}
body.alto-contrasto .instruction-box {
    background-color: #3a2f00;
    border-left-color: #ffc107;
    color: #fff;
}
body.alto-contrasto .question {
    background-color: #111;
    border-color: #333;
}
body.alto-contrasto .question h3 { color: #4a9edd; }
body.alto-contrasto .problem-text {
    background-color: #0d1f3c;
    border-color: #2a4a7a;
    border-left-color: #4a9edd;
}
body.alto-contrasto .problem-text p { color: #fff; }
body.alto-contrasto label {
    background-color: #1a1a1a;
    border-color: #444;
    color: #fff;
}
body.alto-contrasto label:hover { background-color: #262626; }
/* Il pannello accessibilità resta bianco: l'etichetta "Testo" non deve prendere lo sfondo scuro delle risposte */
body.alto-contrasto #acc-panel label,
body.alto-contrasto #acc-panel label:hover {
    background-color: transparent;
    border-color: transparent;
    color: var(--purple);
}
body.alto-contrasto .solution {
    background-color: #1f1a00;
    border-color: #d4a017;
    color: #fff;
}
body.alto-contrasto .hint-box {
    background-color: #0d1f3c;
    border-color: #4a9edd;
    color: #fff;
}
body.alto-contrasto footer.site-footer { color: #ccc; border-top-color: #333; }
body.alto-contrasto .license-box {
    background-color: #111;
    border-color: #333;
    color: #aaa;
}
body.alto-contrasto .license-box a { color: #ccc; }
body.alto-contrasto .validation-link a { color: #888; }

/* Riepilogo risultati in alto contrasto */
body.alto-contrasto .results {
    background-color: #0d1f3c;
    border: 2px solid #4a9edd;
    color: #fff;
}
body.alto-contrasto .results h2,
body.alto-contrasto .results h3 { color: #00e676; }
body.alto-contrasto .results p { color: #fff; }
body.alto-contrasto .results hr { display: block; border: 0; border-top: 1px solid #4a9edd; }
body.alto-contrasto .results .correct { color: #00e676; }
body.alto-contrasto .results .incorrect { color: #ff8a80; }

/* ---------- Smartphone: meno padding per guadagnare spazio alle formule ---------- */
@media (max-width: 600px) {
    .main-test-wrapper { padding: 12px; }
}

/* Soluzioni visibili solo durante la preparazione della stampa (classe aggiunta e rimossa da stampaTest) */
body.in-stampa .solution { display: block !important; }

/* Pannello accessibilità: etichetta "Testo", cursore e percentuale su un'unica riga
   (vale anche in alto contrasto: l'id vince sulla regola generale delle etichette) */
#acc-panel > div {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}
#acc-panel > div label {
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    white-space: nowrap;
}
/* La percentuale resta leggibile anche in alto contrasto (il pannello è bianco, il testo della pagina diventa bianco) */
#acc-panel #font-val { color: #333; }


/* ============================================================ */
/* TEST 4 (DSA): BARRA DI PROGRESSO                              */
/* ============================================================ */
.prog-wrapper {
    position: sticky;
    top: 10px;
    z-index: 100;
    background: #fff;
    border: 2px solid #ced4da;
    border-radius: 12px;
    padding: 10px 15px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.prog-label { font-size: 0.95rem; color: #1a6b35; margin-right: 5px; font-weight: bold; }
.prog-bar { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.prog-item {
    width: 44px; height: 44px; min-width: 44px;
    margin: 0; padding: 0;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; font-size: 1rem;
    background: #e9ecef; color: #333;
    border: 2px solid #ced4da;
    letter-spacing: 0;
    cursor: pointer;
}
.prog-item:hover { transform: scale(1.08); }
.prog-item.answered { background: #ffc107; border-color: #e0a800; color: #333; }
.prog-item.correct { background: #28a745 !important; border-color: #1e7e34 !important; color: #fff !important; }
.prog-item.wrong   { background: #dc3545 !important; border-color: #bd2130 !important; color: #fff !important; }
.prog-item.partial { background: #17a2b8 !important; border-color: #117a8b !important; color: #fff !important; }
.prog-item.correct::after { content: '✓'; font-size: 0.7em; margin-left: 1px; }
.prog-item.wrong::after   { content: '✗'; font-size: 0.7em; margin-left: 1px; }
.prog-item.partial::after { content: '\25D0'; font-size: 0.7em; margin-left: 1px; }
/* ============================================================ */
/* TEST 4 (DSA): ISTRUZIONI                                      */
/* ============================================================ */
.instruction-text p { margin: 0 0 12px; font-weight: normal; }
.instruction-text p strong { color: var(--primary-blue); }
.instruction-text .btn-listen { margin: 4px 0 0; }

/* ============================================================ */
/* TEST 4 (DSA): PUZZLE                                          */
/* ============================================================ */
.catena {
    background: #fff;
    border: 2px solid #ced4da;
    border-radius: 10px;
    padding: 12px 18px;
    margin: 12px 0 18px;
}
.problem-text .catena p.passo {
    margin: 8px 0;
    font-size: 1.2rem;
    line-height: 3;
}

/* Il buco da riempire: grande e ben visibile */
button.buco {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    min-height: 56px;
    margin: 4px 8px;
    padding: 6px 14px;
    background: #fff;
    color: #0056b3;
    border: 3px dashed #4a9edd;
    border-radius: 10px;
    font-size: 1.15rem;
    font-weight: bold;
    vertical-align: middle;
    cursor: pointer;
}
button.buco:hover { background: #e7f1ff; transform: none; filter: none; }
button.buco.pieno { border-style: solid; border-color: #007bff; background: #eef5ff; }
button.buco.ok  { border-style: solid; border-color: #28a745; background: #e8f8f0; color: #1e7e34; }
button.buco.ko  { border-style: solid; border-color: #dc3545; background: #fde8e8; color: #bd2130; }
button.buco.ok::after { content: ' ✓'; }
button.buco.ko::after { content: ' ✗'; }

/* Quando una tessera e' selezionata, i buchi "si accendono" */
.question.ha-selezione button.buco {
    border-color: #007bff;
    box-shadow: 0 0 0 4px rgba(0,123,255,0.25);
}

/* Le tessere: numerate, per poterle ritrovare quando si ascolta il quesito */
.tessere {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 18px 0 8px;
    padding: 16px;
    background: #f8f9fa;
    border: 2px dashed #adb5bd;
    border-radius: 10px;
    counter-reset: tessera;
}
button.tessera {
    counter-increment: tessera;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 10px 16px;
    min-height: 56px;
    background: #eef2f7;
    color: #1a4a82;
    border: 3px solid #007bff;
    border-radius: 10px;
    font-size: 1.15rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}
button.tessera::before {
    content: counter(tessera);
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6em;
    height: 1.6em;
    border-radius: 50%;
    background: #1a4a82;
    color: #fff;
    font-size: 0.85rem;
    letter-spacing: 0;
}
button.tessera:hover { background: #007bff; color: #fff; transform: none; filter: none; }
button.tessera:hover::before { background: #fff; color: #007bff; }
button.tessera.selezionata { background: #0056b3; color: #fff; box-shadow: 0 0 10px rgba(0,123,255,0.7); }
button.tessera.selezionata::before { background: #fff; color: #0056b3; }
button.tessera:disabled,
button.tessera.usata {
    opacity: 0.3;
    border-style: dashed;
    cursor: not-allowed;
    background: #eef2f7;
    color: #1a4a82;
}
.nota-puzzle { font-size: 1rem; color: #444; margin: 6px 0 14px; }

/* ============================================================ */
/* TEST 4 (DSA): ABBINAMENTO                                     */
/* ============================================================ */
.opzioni-box {
    background: #eaf3fb;
    border: 2px solid #cfe2f3;
    border-radius: 10px;
    padding: 12px 20px;
    margin: 12px 0 18px;
}
.opzioni-box .opzione {
    margin: 12px 0;
    display: flex;
    gap: 12px;
    align-items: baseline;
    font-size: 1.15rem;
}
.opzioni-box .lettera { flex: 0 0 auto; font-weight: bold; color: #0056b3; }

.abbina-riga {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    background: #f8f9fa;
    border: 2px solid #e1e4e8;
    border-left: 6px solid #ced4da;
    border-radius: 10px;
    padding: 14px 16px;
    margin: 14px 0;
}
.abbina-riga .limite { flex: 1 1 280px; font-size: 1.15rem; }
.abbina-riga .scelte { display: flex; flex-wrap: wrap; gap: 10px; }
.abbina-riga.ok { border-left-color: #28a745; background: #e8f8f0; }
.abbina-riga.ko { border-left-color: #dc3545; background: #fde8e8; }

/* Le scelte A-E: radio nascosti, pulsanti-lettera grandi */
label.scelta {
    position: relative;
    display: inline-block;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
}
label.scelta:hover { background: none; }
label.scelta input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    transform: none;
}
label.scelta span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    min-height: 56px;
    background: #fff;
    color: #1a4a82;
    border: 3px solid #007bff;
    border-radius: 10px;
    font-size: 1.25rem;
    font-weight: bold;
    cursor: pointer;
    letter-spacing: 0;
    transition: all 0.15s ease;
}
label.scelta:hover span { background: #e7f1ff; }
label.scelta input:checked + span { background: #007bff; color: #fff; }
label.scelta input:focus-visible + span { outline: 4px solid #ffc107; outline-offset: 2px; }

.results .partial { color: #b8860b; font-weight: bold; }

@media (max-width: 600px) {
    .abbina-riga { flex-direction: column; align-items: flex-start; }
    .abbina-riga .limite { flex: 0 0 auto; }
    .prog-item { width: 40px; height: 40px; min-width: 40px; }
    button.buco { min-width: 100px; }
    .problem-text .catena p.passo { line-height: 3.1; }
}

/* ============================================================ */
/* TEST 4 (DSA): STAMPA                                          */
/* ============================================================ */
@media print {
    .nota-puzzle, .prog-wrapper, .instruction-text { display: none !important; }
    /* buchi e tessere sono bottoni: restano visibili, altrimenti il puzzle risulterebbe incompleto */
    button.buco { display: inline-flex !important; border: 2px solid #333 !important; background: #fff !important; color: #000 !important; }
    .tessere { display: flex !important; background: #fff !important; border: 1px dashed #666 !important; break-inside: avoid; }
    button.tessera { display: inline-flex !important; opacity: 1 !important; background: #fff !important; color: #000 !important; border: 2px solid #333 !important; border-style: solid !important; }
    button.tessera::before { background: #333 !important; color: #fff !important; }
    .abbina-riga, .opzioni-box { break-inside: avoid; }
}

/* ============================================================ */
/* TEST 4 (DSA): ALTO CONTRASTO                                  */
/* ============================================================ */
body.alto-contrasto .instruction-text p strong { color: #00e676; }
body.alto-contrasto .instruction-text a { color: #4fc3f7; }
body.alto-contrasto .prog-wrapper { background: #111; border-color: #444; }
body.alto-contrasto .prog-label { color: #00e676; }
body.alto-contrasto .prog-item { background: #1a1a1a; color: #fff; border-color: #888; }
body.alto-contrasto .prog-item.answered { background: #ffc107; color: #000; border-color: #e0a800; }
body.alto-contrasto .catena { background: #0d1f3c; border-color: #2a4a7a; }
body.alto-contrasto .problem-text .catena p.passo,
body.alto-contrasto .opzioni-box .opzione,
body.alto-contrasto .abbina-riga .limite { color: #fff; }
body.alto-contrasto button.buco { background: #111; color: #4fc3f7; border-color: #4a9edd; }
body.alto-contrasto button.buco:hover { background: #1a2a44; }
body.alto-contrasto button.buco.pieno { background: #0d1f3c; color: #fff; border-color: #4fc3f7; }
body.alto-contrasto button.buco.ok { background: #003d1f; color: #00e676; border-color: #00e676; }
body.alto-contrasto button.buco.ko { background: #4a0d0d; color: #ff8a80; border-color: #ff8a80; }
body.alto-contrasto .tessere { background: #1a1a1a; border-color: #666; }
body.alto-contrasto button.tessera { background: #0d1f3c; color: #fff; border-color: #4a9edd; }
body.alto-contrasto button.tessera::before { background: #4a9edd; color: #000; }
body.alto-contrasto button.tessera:hover { background: #4a9edd; color: #000; }
body.alto-contrasto button.tessera:hover::before { background: #000; color: #4a9edd; }
body.alto-contrasto button.tessera.selezionata { background: #ffc107; color: #000; border-color: #ffc107; }
body.alto-contrasto button.tessera.selezionata::before { background: #000; color: #ffc107; }
body.alto-contrasto button.tessera:disabled,
body.alto-contrasto button.tessera.usata { background: #0d1f3c; color: #fff; }
body.alto-contrasto .nota-puzzle { color: #ccc; }
body.alto-contrasto .opzioni-box { background: #0d1f3c; border-color: #2a4a7a; }
body.alto-contrasto .opzioni-box .lettera { color: #00e676; }
body.alto-contrasto .abbina-riga { background: #1a1a1a; border-color: #444; border-left-color: #888; }
body.alto-contrasto .abbina-riga.ok { background: #003d1f; border-left-color: #00e676; }
body.alto-contrasto .abbina-riga.ko { background: #4a0d0d; border-left-color: #ff8a80; }
body.alto-contrasto label.scelta,
body.alto-contrasto label.scelta:hover { background: none; border: none; }
body.alto-contrasto label.scelta span { background: #111; color: #fff; border-color: #4a9edd; }
body.alto-contrasto label.scelta:hover span { background: #1a2a44; }
body.alto-contrasto label.scelta input:checked + span { background: #4a9edd; color: #000; }
body.alto-contrasto .results .partial { color: #ffd54f; }
body.alto-contrasto .btn-aiuto { color: #000; }

/* Formule lunghe: le colonne possono restringersi (nessuna barra di scorrimento) */
.abbina-riga .limite { min-width: 0; }
button.tessera { max-width: 100%; }
.opzioni-box .opzione > span:last-child { min-width: 0; }
/* il tasto Ascolta sta all'inizio del quesito */
.problem-text > .btn-listen { margin: 0 0 14px; }
