/* ============================================================
   stile-problema-dsa.css
   Foglio di stile condiviso per le pagine DSA (Problema 1, 
   Problema 2 e relativi template) — Matefilia
   Non modificare i nomi delle classi: sono richiamati dall'HTML.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@300;400;600;700&display=swap');

:root {
    --bg:         #fdf6e3;
    --surface:    #fffdf5;
    --border:     #c8b97a;
    --text:       #1a1a1a;
    --muted:      #4a4a4a;
    --green:      #1a6b35;
    --green-lt:   #d4edda;
    --blue:       #003d99;
    --blue-lt:    #ddeeff;
    --orange:     #b85c00;
    --orange-lt:  #fff0d6;
    --purple:     #5a0099;
    --red:        #b30000;
    --sol-border: #003d99;
    --sol-bg:     #f0f5ff;
    --radius:     10px;
    --font-body:  'Lexend', 'Comic Sans MS', 'Arial', sans-serif;
    --lh:         2.0;
    --ls:         0.04em;
}

* { box-sizing: border-box; }

body {
    font-family: var(--font-body);
    font-size: 1.15rem;
    line-height: var(--lh);
    letter-spacing: var(--ls);
    word-spacing: 0.12em;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
}

.container {
    max-width: 860px;
    margin: 30px auto;
    background: var(--surface);
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.10);
    padding: 28px 36px 40px;
}

.header-box {
    width: 100%;
    border: 2.5px dashed var(--green);
    border-radius: var(--radius);
    margin-bottom: 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
}
.header-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    text-decoration: none;
    background: var(--surface);
}
.header-link img { max-height: 56px; height: auto; }

.main-page-title {
    font-size: 2em;
    font-weight: 700;
    text-align: center;
    margin: 10px 0 20px;
    line-height: 1.3;
}
.main-page-title .blue { color: var(--blue); }
.main-page-title .red  { color: var(--red);  }

.separator {
    border: 0;
    height: 2.5px;
    background: linear-gradient(to right, transparent, var(--green), transparent);
    margin: 18px 0 26px;
}

.dsa-info-box {
    background: var(--orange-lt);
    border-left: 5px solid var(--orange);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 24px;
    font-size: 1rem;
    color: #5c3000;
}
body.alto-contrasto .dsa-info-box {
    color: #ffcc80;
    border-left-color: #ffa726;
    background: #2a1500;
}
.dsa-info-box strong { color: var(--orange); }

.problem-text {
    background: var(--green-lt);
    border-left: 5px solid var(--green);
    border-radius: var(--radius);
    padding: 16px 22px;
    margin-bottom: 22px;
    font-size: 1.1rem;
}
body.alto-contrasto .problem-text { color: #fff; }

.problem-text h2 {
    color: var(--green);
    font-size: 1.5em;
    font-weight: 700;
    margin: 0 0 8px;
    border-bottom: 2px solid var(--green);
    padding-bottom: 4px;
}
.problem-text p { margin: 8px 0 0; }

.solution-button {
    background: var(--blue-lt);
    color: var(--blue);
    border: 2.5px solid var(--blue);
    padding: 12px 26px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-radius: 30px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease;
    margin: 6px 4px;
}
.solution-button:hover, .solution-button:focus {
    background: var(--blue);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,61,153,0.3);
    outline: none;
}
.solution-button.open { background: var(--blue); color: #fff; }

.solution-container { display: none; }

.solution {
    background: var(--sol-bg);
    border-left: 6px solid var(--sol-border);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 20px 22px 20px 28px;
    margin: 14px 0 14px 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.solution h3 {
    color: var(--blue);
    font-size: 1.15em;
    font-weight: 700;
    margin: 24px 0 8px;
    border-bottom: 2px solid var(--blue-lt);
    padding-bottom: 4px;
}
.solution h3:first-child { margin-top: 0; }
.solution h4 {
    color: var(--purple);
    font-size: 1.05em;
    font-weight: 600;
    margin: 18px 0 6px;
}
.solution p { margin: 10px 0; }
.solution ul, .solution ol { padding-left: 1.6em; margin: 10px 0; }
.solution ul li, .solution ol li { margin-bottom: 8px; line-height: 1.85; }

mjx-container { overflow-x: auto; padding: 4px 0; }

.risultato-box {
    background: #e8f5e9;
    border: 2.5px solid var(--green);
    border-radius: var(--radius);
    padding: 14px 20px;
    margin: 16px 0;
    font-weight: 600;
    text-align: center;
}
body.alto-contrasto .risultato-box {
    background: #003318;
    border-color: #00e676;
    color: #fff;
}

.attenzione-box {
    background: #fff0f0;
    border: 2px solid var(--red);
    border-radius: var(--radius);
    padding: 12px 18px;
    margin: 14px 0;
    color: #7a0000;
    font-weight: 600;
}
body.alto-contrasto .attenzione-box { background: #2a0000; color: #ffaaaa; border-color: #ff5555; }

.formula-box {
    background: #fff;
    border-left: 4px solid var(--blue);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 12px 18px;
    margin: 14px 0;
    overflow-x: auto;
}
body.alto-contrasto .formula-box { background: #0d1f3c; }

.my-table {
    border-collapse: collapse;
    border: 2px solid var(--text);
    margin: 15px auto;
    font-size: 0.95rem;
}
.my-table td, .my-table th {
    border: 1px solid var(--text);
    padding: 8px 12px;
    white-space: nowrap;
}
@media (max-width: 600px) {
    .my-table { font-size: 0.8rem; }
    .my-table td, .my-table th { padding: 5px 7px; }
}
.my-table th {
    background: var(--green);
    color: #fff;
    font-weight: 700;
}
body.alto-contrasto .my-table th {
    background: #003318;
    color: #00e676;
}

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.graph {
    text-align: center;
    max-width: 600px;
    margin: 22px auto;
    padding: 14px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
}
.graph img { max-width: 100%; height: auto; border-radius: 6px; }
.graph p { font-size: 0.93rem; color: var(--muted); margin-top: 8px; }
.graph .graph-caption { font-size: 0.93rem; color: var(--muted); margin-top: 8px; display: block; }
body.alto-contrasto .graph { background: #ffffff; border-color: #ffa726; }
body.alto-contrasto .graph p,
body.alto-contrasto .graph .graph-caption { color: #000000; }

.metodo-separator {
    border: 0;
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

.btn-nascondi {
    background: var(--orange);
    color: #fff;
    border: none;
    padding: 11px 28px;
    border-radius: 28px;
    font-family: var(--font-body);
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
    display: block;
    margin: 18px auto 6px;
    transition: all 0.25s ease;
}
.btn-nascondi:hover, .btn-nascondi:focus {
    background: #944a00;
    transform: translateY(-2px);
    outline: none;
}

.footer {
    text-align: center;
    margin-top: 44px;
    padding-top: 22px;
    border-top: 2px solid var(--border);
}
.footer button, .footer a.btn-nav {
    font-family: var(--font-body);
    font-size: 0.98rem;
    font-weight: 700;
    padding: 11px 22px;
    border-radius: 28px;
    border: none;
    cursor: pointer;
    margin: 6px 5px;
    color: #fff;
    transition: all 0.25s ease;
    text-decoration: none;
    display: inline-block;
}
.footer .btn-stampa   { background: var(--purple); }
.footer .btn-stampa:hover { background: #7a00cc; transform: translateY(-2px); }
.footer .btn-indice   { background: #1a237e; }
.footer .btn-indice:hover { background: #3949ab; transform: translateY(-2px); }
.footer .btn-p1      { background: #007bff; }
.footer .btn-p1:hover { background: #339aff; transform: translateY(-2px); }
.footer .btn-p2      { background: #0056b3; }
.footer .btn-p2:hover { background: #007bff; transform: translateY(-2px); }
.footer .btn-standard { background: #007bff; }
.footer .btn-standard:hover { background: #339aff; transform: translateY(-2px); }
.footer .btn-q      { background: #c87800; }
.footer .btn-q:hover { background: #e69500; transform: translateY(-2px); }

#acc-panel {
    background: var(--surface);
    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: 16px 0 0 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: var(--font-body);
    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; }

body.alto-contrasto {
    --bg: #000; --surface: #111; --text: #fff; --muted: #ccc;
    --border: #555; --green: #00e676; --green-lt: #003318;
    --blue: #82b1ff; --blue-lt: #0d1f3c; --orange-lt: #2a1500;
    --orange: #ffa726; --sol-bg: #0d1f3c; --sol-border: #82b1ff;
}

#btn-top {
    position: fixed; bottom: 20px; right: 4px;
    background: var(--purple); 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; }
body.alto-contrasto #btn-top { background: #ffa726; color: #000; }

.btn-leggi {
    display: inline-flex; align-items: center; gap: 7px;
    background: #fff; color: var(--green); border: 2px solid var(--green);
    padding: 7px 16px; border-radius: 22px;
    font-family: var(--font-body); font-size: 0.88rem; font-weight: 700;
    cursor: pointer; margin: 10px 0 4px; transition: all 0.2s;
}
.btn-leggi:hover, .btn-leggi.speaking { background: var(--green); color: #fff; }
body.alto-contrasto .btn-leggi { background: #003318; color: #00e676; border-color: #00e676; }

#btn-ferma {
    display: none; background: var(--red); color: #fff; border: none;
    border-radius: 20px; padding: 7px 16px;
    font-family: var(--font-body); font-size: 0.88rem; font-weight: 700;
    cursor: pointer; margin: 6px 0 4px 8px; transition: background 0.2s;
}
#btn-ferma:hover { background: #8b0000; }

.audio-testo { display: none; }

.citazione {
    color: var(--muted);
    font-size: 1.0rem;
}
.mini-separator {
    border: 0;
    height: 2px;
    width: 80px;
    background: var(--green);
    margin: 14px auto 18px;
}

@media print {
    .btn-nascondi, .solution-button, .footer, .dsa-info-box,
    #btn-top, #acc-panel, .btn-leggi, #btn-ferma { display: none !important; }
    .solution-container { display: block !important; }
}

@media (max-width: 600px) {
    .container { padding: 16px 14px 28px; }
    .main-page-title { font-size: 1.5em; }
    .footer button, .footer a.btn-nav { display: block; width: 90%; margin: 6px auto; }
    #acc-panel { flex-direction: column; align-items: flex-start; }
}
.logo-moderno-container {
    display: flex;
    align-items: center;
    gap: 8px;
}
.logo-storico-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.url-text {
    font-size: 0.85rem;
    color: #555;
    font-weight: 600;
}
.dal-anno {
    font-size: 0.72rem;
    color: #999;
    font-style: italic;
    letter-spacing: 0.5px;
}
@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 0 rgba(26,107,53,0.4); }
    50%       { box-shadow: 0 0 0 7px rgba(26,107,53,0); }
}

.question-block { margin-bottom: 36px; }