/* ==========================================================================
   La matematica in italiano – stile comune a sito (body.web) e stampa (body.stampa)
   ========================================================================== */

/* Simboli matematici (≠, ≤, ≥, ∈, ∥ …) da un font che li disegna bene;
   se non è installato si passa al font successivo. */
@font-face {
  font-family: "Simboli";
  src: local("Noto Sans Math"), local("NotoSansMath-Regular"), local("DejaVu Sans");
  unicode-range: U+2200-22FF, U+2A7D-2A7E;
}

:root {
  --carta: #fbfaf7;
  --superficie: #ffffff;
  --inchiostro: #1f2328;
  --tenue: #5b6470;
  --linea: #dcd8cf;
  --l1: #0f7b6c;        --l1-fondo: #e3f3ef;
  --l2: #5b4bb7;        --l2-fondo: #ecebfa;
  --esempio: #2f6690;   --esempio-fondo: #eaf2f8;
  --attenzione: #b26a00; --attenzione-fondo: #fdf3e1;
  --regola: #b3261e;    --regola-fondo: #fbeceb;
  --zh: #475569;
  --font-it: "Simboli", "Noto Sans", "Helvetica Neue", Arial, "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-zh: "Noto Sans CJK SC", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.web {
    --carta: #16181c; --superficie: #1e2126; --inchiostro: #e8e6e1; --tenue: #a0a7b1; --linea: #353a42;
    --l1: #4cc3b0; --l1-fondo: #17312d; --l2: #a99cf0; --l2-fondo: #26233d;
    --esempio: #82b7df; --esempio-fondo: #1a2733; --attenzione: #f0b45a; --attenzione-fondo: #33281a;
    --regola: #f08a83; --regola-fondo: #351e1d; --zh: #b4bfcd;
  }
}
:root[data-theme="dark"] body.web {
  --carta: #16181c; --superficie: #1e2126; --inchiostro: #e8e6e1; --tenue: #a0a7b1; --linea: #353a42;
  --l1: #4cc3b0; --l1-fondo: #17312d; --l2: #a99cf0; --l2-fondo: #26233d;
  --esempio: #82b7df; --esempio-fondo: #1a2733; --attenzione: #f0b45a; --attenzione-fondo: #33281a;
  --regola: #f08a83; --regola-fondo: #351e1d; --zh: #b4bfcd;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--carta);
  color: var(--inchiostro);
  font-family: var(--font-it);
  line-height: 1.55;
}
[lang="zh-Hans"], .zh { font-family: var(--font-zh); }
.zh { color: var(--zh); }
h1, h2, h3 { line-height: 1.25; }
p { margin: 0 0 .4em; }
strong { font-weight: 700; }

/* --- Testata unità ------------------------------------------------------- */
.testa-unita { border-bottom: 3px solid var(--inchiostro); padding-bottom: .6rem; margin-bottom: 1.4rem; }
.testa-unita .parte { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; color: var(--tenue); margin: 0; }
.testa-unita h1 { font-size: 2rem; margin: .2rem 0 0; }
.titolo-zh { font-size: 1.35rem; color: var(--zh); margin: .1rem 0 0; }

h2 { font-size: 1.3rem; margin: 2rem 0 .8rem; }
.sez > h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .6rem; }
.h-zh { font-weight: 500; color: var(--zh); font-size: .9em; }

/* --- Etichette di livello ------------------------------------------------ */
.badge {
  display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .03em;
  padding: .15em .6em; border-radius: 999px; border: 1.5px solid currentColor;
  white-space: nowrap; vertical-align: middle;
}
.badge.l1 { color: var(--l1); background: var(--l1-fondo); }
.badge.l2 { color: var(--l2); background: var(--l2-fondo); }
.sez.l1 > h2 { border-left: 5px solid var(--l1); padding-left: .6rem; }
.sez.l2 > h2 { border-left: 5px solid var(--l2); padding-left: .6rem; }

/* --- Obiettivi, legenda -------------------------------------------------- */
.obiettivi ul, .passi { padding-left: 1.3rem; }
.obiettivi li, .passi li { margin-bottom: .45rem; }
.obiettivi li .it, .passi li .it { display: block; }
.obiettivi li .zh, .passi li .zh { display: block; font-size: .92em; }
.passi li::marker { font-weight: 700; color: var(--l1); }
.legenda { font-size: .88rem; color: var(--tenue); border: 1px solid var(--linea); border-radius: 8px; padding: .6rem .8rem; }
.legenda p { margin: .2rem 0; }

/* --- Frasi italiano + cinese -------------------------------------------- */
.coppia { margin: .5rem 0 .8rem; }
.coppia .it { margin: 0; }
.coppia .zh { margin: .1rem 0 0; font-size: .95em; }
.aiuto summary { cursor: pointer; font-size: .78rem; color: var(--l2); display: inline-block; }
.aiuto .zh { font-size: .9em; }

/* Frazione in verticale: {{3/4}} */
.fr { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle;
      font-size: .9em; line-height: 1.1; margin: 0 .12em; }
.fr-n { border-bottom: 1.5px solid currentColor; padding: 0 .2em; }
.fr-d { padding: 0 .2em; }

/* Periodo di un numero decimale: 0,~{3} */
.periodo { text-decoration: overline; text-decoration-thickness: 1.5px; }
.punto-cinese { position: relative; display: inline-block; }
.punto-cinese::after { content: ""; position: absolute; left: 50%; top: .02em; width: .2em; height: .2em;
                       margin-left: -.1em; border-radius: 50%; background: currentColor; }
.fig-quadretto-pc { stroke-width: .6; }

/* Parola con traduzione sopra */
ruby.g { ruby-position: over; }
ruby.g rt { font-size: .66em; color: var(--l2); font-weight: 500; }

/* --- Riquadri ------------------------------------------------------------ */
.riquadro {
  margin: .9rem 0; padding: .7rem .9rem; border-radius: 8px;
  border: 1px solid var(--linea); border-left-width: 5px; background: var(--superficie);
  break-inside: avoid;
}
.riquadro .etichetta { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: .35rem; }
.riquadro .coppia { margin: 0; }
.esempio { border-left-color: var(--esempio); background: var(--esempio-fondo); }
.esempio .etichetta { color: var(--esempio); }
.attenzione { border-left-color: var(--attenzione); background: var(--attenzione-fondo); border-left-style: double; border-left-width: 6px; }
.attenzione .etichetta { color: var(--attenzione); }
.attenzione .etichetta::before { content: "⚠ "; }
.regola { border: 2px solid var(--regola); background: var(--regola-fondo); }
.regola .etichetta { color: var(--regola); }
.regola .it { font-size: 1.05em; }
.problema { border-left-color: var(--l2); }
.problema .etichetta { color: var(--l2); }
.svolgimento { margin-top: .6rem; padding-top: .5rem; border-top: 1px dashed var(--linea); }
.risposta { margin-top: .4rem; font-weight: 600; }

.formula {
  font-variant-numeric: tabular-nums; font-size: 1.08em; white-space: pre-wrap;
  padding: .1rem 0; overflow-wrap: anywhere;
}

/* --- Tabelle ------------------------------------------------------------- */
table { border-collapse: collapse; width: 100%; margin: .6rem 0 1rem; font-size: .95em; }
th, td { text-align: left; vertical-align: top; padding: .4rem .55rem; border-bottom: 1px solid var(--linea); }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--tenue); border-bottom: 2px solid var(--linea); }
tr { break-inside: avoid; }
.parole .art { color: var(--tenue); margin-right: .25em; }
.parole .pl { display: block; font-size: .8em; color: var(--tenue); }
.parole .nota { font-size: .8em; color: var(--attenzione); margin-top: .15rem; }
.piccolo { font-size: .82em; color: var(--tenue); }
.leggi .scritto { font-weight: 700; white-space: nowrap; font-size: 1.05em; width: 30%; }
.leggi .it { display: block; }
.leggi .zh { display: block; font-size: .9em; }
.frasi td.it { width: 55%; }
.confronto td:first-child .it, .confronto td:first-child .zh { display: block; }
.confronto td:first-child .zh { font-size: .9em; }
.confronto .scritto { font-weight: 700; font-size: 1.05em; width: 28%; }
.confronto td:nth-child(2) { background: var(--l1-fondo); }
.sottotitolo { font-weight: 700; margin-top: .8rem; }

/* Figure geometriche */
.figure { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem 1rem; margin: .8rem 0 1.2rem; }
.figura { margin: 0; text-align: center; break-inside: avoid; position: relative; }
.figura-svg { width: 100%; max-width: 190px; height: auto; display: block; margin: 0 auto; overflow: visible; }
.fig-forma { fill: var(--esempio-fondo); stroke: var(--inchiostro); stroke-width: 2; stroke-linejoin: round; }
.fig-diagonale { stroke: var(--l2); stroke-width: 1.5; stroke-dasharray: 5 3; }
.fig-segno { fill: none; stroke: var(--regola); stroke-width: 1.6; }
.fig-altezza { stroke: var(--l1); stroke-width: 1.5; stroke-dasharray: 4 3; }
.fig-linea { stroke: var(--l1); stroke-width: 1.8; }
.fig-prolungamento { stroke: var(--tenue); stroke-width: 1.2; stroke-dasharray: 2 3; }
.fig-altezza-retto { fill: none; stroke: var(--l1); stroke-width: 1.2; }
.fig-misura { font: 600 11px var(--font-it); fill: var(--esempio); dominant-baseline: middle; }
.fig-h { fill: var(--l1); font-style: italic; font-weight: 700; }
.fig-q1 { fill: var(--l1-fondo); stroke: var(--l1); stroke-width: 1.5; }
.fig-q2 { fill: var(--l2-fondo); stroke: var(--l2); stroke-width: 1.5; }
.fig-q3 { fill: var(--attenzione-fondo); stroke: var(--attenzione); stroke-width: 1.5; }
.fig-q1, .fig-q2, .fig-q3 { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.fig-quadretto { stroke: var(--tenue); stroke-width: .5; opacity: .6; }
.fig-area { font: 700 12px var(--font-it); fill: var(--inchiostro); text-anchor: middle; dominant-baseline: middle; }
.fig-cerchio { fill: none; stroke: var(--inchiostro); stroke-width: 2; }
.fig-pieno { fill: var(--attenzione-fondo); stroke: var(--attenzione); stroke-width: 1.5; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.fig-buco { fill: var(--carta); stroke: var(--attenzione); stroke-width: 1.5; }
body.stampa .fig-buco { fill: #fff; }
.fig-evidenza { fill: none; stroke: var(--regola); stroke-width: 4; stroke-linecap: round; }
.fig-retta { stroke: var(--l2); stroke-width: 1.8; }
.fig-punto { fill: var(--inchiostro); }
.fig-parte-piena { fill: var(--attenzione); fill-opacity: .55; stroke: var(--inchiostro); stroke-width: 1.5;
                   -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.fig-parte-vuota { fill: var(--superficie); stroke: var(--inchiostro); stroke-width: 1.5; }
.fig-zero { stroke-width: 3; }
.fig-griglia { stroke: var(--linea); stroke-width: .8; }
.fig-asse { font: 500 9px var(--font-it); fill: var(--tenue); text-anchor: middle; dominant-baseline: middle; }
.fig-asse-sx { text-anchor: start; font-size: 10px; fill: var(--inchiostro); }
.fig-asse-dx { text-anchor: end; }
.fig-valore { fill: var(--inchiostro); font-weight: 700; }
.fig-barra { stroke: var(--inchiostro); stroke-width: 1; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.fig-c0 { fill: var(--l1); } .fig-c1 { fill: var(--l2); } .fig-c2 { fill: var(--attenzione); }
.fig-c3 { fill: var(--esempio); } .fig-c4 { fill: var(--regola); }
.fig-barra.fig-c0, .fig-barra.fig-c1, .fig-barra.fig-c2, .fig-barra.fig-c3, .fig-barra.fig-c4 { fill-opacity: .75; }
.figure:has(> .figura .grafico) { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important; }
.figure .grafico { max-width: 340px !important; }
.fig-angolo { fill: var(--attenzione); fill-opacity: .35; stroke: var(--attenzione); stroke-width: 1.2;
              -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.fig-angolo2 { fill: var(--l2); stroke: var(--l2); }
.fig-doppia { stroke-dasharray: 3 2; }
.fig-immagine { fill: var(--l2); fill-opacity: .18; stroke: var(--l2); stroke-width: 2; stroke-dasharray: 5 3; }
.fig-faccia { fill: var(--esempio-fondo); stroke: none; }
.fig-spigolo { stroke: var(--inchiostro); stroke-width: 1.8; fill: none; stroke-linejoin: round; }
.fig-faccia.fig-spigolo { fill: var(--esempio-fondo); }
.fig-nascosto { stroke: var(--tenue); stroke-width: 1.3; stroke-dasharray: 4 3; fill: none; }
.fig-quadrante { font: 700 16px var(--font-it); fill: var(--l2); opacity: .55; text-anchor: middle; dominant-baseline: middle; }
.fig-punto-piano { fill: var(--regola); }
.fig-etichetta-punto { text-anchor: start; }
.figure .piano { max-width: 280px !important; }
.fig-grafico { fill: none; stroke-width: 2.4; stroke-linejoin: round; }
.fig-g0 { stroke: var(--regola); } .fig-g1 { stroke: var(--l2); } .fig-g2 { stroke: var(--l1); }
.fig-etichetta-grafico { font: 700 10px var(--font-it); text-anchor: end; paint-order: stroke; stroke: var(--superficie); stroke-width: 3px; }
.fig-t0 { fill: var(--regola); } .fig-t1 { fill: var(--l2); } .fig-t2 { fill: var(--l1); }
.fig-piatto-sx { fill: var(--l1-fondo); } .fig-piatto-dx { fill: var(--l2-fondo); }
.fig-piatto-sx, .fig-piatto-dx { fill-opacity: 1; }
.fig-testo-bilancia { font: 700 11px var(--font-it); fill: var(--inchiostro); text-anchor: middle; dominant-baseline: middle; }
.fig-vertice { font: 700 11px var(--font-it); fill: var(--inchiostro); text-anchor: middle; dominant-baseline: middle; }
.figura figcaption strong { display: block; margin-top: .2rem; }
.figura figcaption .zh { display: block; font-size: .92em; }
.nota-figura { white-space: pre-line; font-size: .86em; color: var(--inchiostro); margin: .25rem 0 0; font-variant-numeric: tabular-nums; }
.nota-figura .zh { display: block; color: var(--zh); }
.nota-figura .zh { font-size: 1em !important; }
.figura .lettera { position: absolute; left: 0; top: 0; font-weight: 700; }
.figura .riga { display: block; width: 80%; min-width: 0; margin: .4rem auto 0; height: 1.4em; border-bottom: 1px solid var(--tenue); }
body.stampa .figure { grid-template-columns: repeat(4, 1fr); }
/* Una figura da sola si vede più grande */
.figure:has(> .figura:only-child) { grid-template-columns: minmax(0, 260px) !important; }
.figure:has(> .figura:only-child) .figura-svg { max-width: 260px; }
body.stampa .fig-forma { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

/* Tabella generica */
.tabella-scorre { overflow-x: auto; }
.tabella td, .tabella th { text-align: center; }
.tabella th { text-transform: none; font-size: .9rem; }
.tabella td:first-child, .tabella th:first-child { text-align: left; }

/* Divisione in colonna all'italiana */
.divisione-box { break-inside: avoid; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 2rem; margin: .5rem 0 1rem 1rem; }
.divisione { width: auto; margin: 0; font-size: 1.15em; font-variant-numeric: tabular-nums; }
.divisione td { border: 0; padding: .05rem .18rem; min-width: 1.1em; text-align: center; }
.divisione .div-prodotto { border-bottom: 1.5px solid var(--inchiostro); color: var(--tenue); }
.divisione .div-destra { border-left: 2px solid var(--inchiostro); padding-left: .6rem; text-align: left; min-width: 3em; }
.divisione .div-divisore { border-bottom: 2px solid var(--inchiostro); font-weight: 700; }
.divisione .div-quoziente { font-weight: 700; color: var(--regola); }

/* Scomposizione in colonna */
.colonne { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 2.5rem; margin: .5rem 0 1rem 1rem; }
.colonna { width: auto; margin: 0; font-size: 1.1em; font-variant-numeric: tabular-nums; }
.colonna td { border: 0; padding: .1rem .7rem; text-align: right; }
.colonna td:first-child { border-right: 2px solid var(--inchiostro); }
.colonna td:last-child { text-align: left; color: var(--regola); font-weight: 700; }

/* --- Esercizi ------------------------------------------------------------ */
.titolo-esercizi { border-top: 3px solid var(--inchiostro); padding-top: 1rem; }
.esercizio { margin: 1rem 0 1.6rem; break-inside: avoid; }
.esercizio h3 { margin: 0 0 .3rem; display: flex; align-items: center; gap: .5rem; font-size: 1rem; }
.esercizio h3 .n {
  display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: var(--inchiostro); color: var(--carta); font-size: .9rem;
}
.consegna { font-weight: 700; margin: 0; }
.consegna-zh { color: var(--zh); font-size: .92em; margin: 0 0 .5rem; }
.voci { padding-left: 1.6rem; list-style: lower-alpha; }
.voci > li { margin: .5rem 0; }
.riga { display: inline-block; min-width: 12rem; width: 60%; border-bottom: 1px solid var(--tenue); height: 1.1em; vertical-align: bottom; }
.vuoto { display: inline-block; min-width: 7rem; border-bottom: 1px solid var(--tenue); height: 1em; vertical-align: bottom; }
.spazio { height: 5.5rem; margin-top: .3rem; border: 1px dashed var(--linea); border-radius: 6px; }
.vf li { display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.vf li { display: list-item; }
.vf li > span:first-child { display: inline; }
.caselle { float: right; display: inline-flex; gap: .4rem; }
.casella {
  display: inline-grid; place-items: center; min-width: 1.5rem; height: 1.5rem; padding: 0 .2rem;
  border: 1.5px solid var(--tenue); border-radius: 4px; font-size: .8rem; font-weight: 700; color: var(--tenue);
}
.opzioni { list-style: none; padding-left: .3rem; margin: .3rem 0; }
.opzioni li { display: flex; gap: .5rem; align-items: center; margin: .25rem 0; }
.opzioni .casella { min-width: 1.1rem; height: 1.1rem; border-radius: 50%; }
.banca { display: flex; flex-wrap: wrap; gap: .4rem .8rem; border: 1.5px solid var(--inchiostro); border-radius: 6px; padding: .45rem .7rem; margin: .5rem 0; }
.banca span { font-weight: 600; }
.abbina { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 3rem; }
.abbina ul { list-style: none; padding: 0; margin: 0; }
.abbina li { padding: .3rem 0; border-bottom: 1px dotted var(--linea); }
.abbina .num { display: inline-block; min-width: 1.5rem; font-weight: 700; color: var(--tenue); }
.soluzione { margin-top: .5rem; font-size: .92em; }
.soluzione summary { cursor: pointer; color: var(--l1); font-weight: 600; }
.soluzione p { margin: .4rem 0 0; padding: .5rem .7rem; background: var(--l1-fondo); border-radius: 6px; }

/* --- Indice -------------------------------------------------------------- */
.indice { list-style: none; padding: 0; margin: 0 0 1rem; }
.indice li { border-bottom: 1px solid var(--linea); }
.indice li > a, .indice li.in-preparazione { display: flex; flex-wrap: wrap; gap: .1rem .8rem; align-items: baseline; padding: .55rem .3rem; }
.indice a { color: inherit; text-decoration: none; }
.indice li.pronta a span:first-child { font-weight: 700; color: var(--l1); }
.indice li.pronta a:hover { background: var(--l1-fondo); }
.indice .in-preparazione { color: var(--tenue); }
.indice .in-preparazione .zh { color: var(--tenue); }
.indice .stato { margin-left: auto; font-size: .75rem; font-style: italic; }

/* ==========================================================================
   SITO
   ========================================================================== */
body.web main { max-width: 52rem; margin: 0 auto; padding: 1rem 16px 3rem; }
.barra {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .4rem 1rem;
  padding: .7rem 16px; background: var(--superficie); border-bottom: 1px solid var(--linea);
}
.marchio { font-weight: 800; color: inherit; text-decoration: none; }
.marchio span { font-weight: 500; color: var(--zh); margin-left: .4rem; }
.barra nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.barra nav a { color: var(--l1); text-decoration: none; font-weight: 600; font-size: .92rem; }
.comandi {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem 1.2rem;
  padding: .5rem 16px; background: color-mix(in srgb, var(--carta) 92%, transparent);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--linea);
}
.comandi .gruppo { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.etichetta-comando { font-size: .8rem; color: var(--tenue); margin-right: .2rem; }
.comandi button {
  font: inherit; font-size: .82rem; padding: .35rem .75rem; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--linea); background: var(--superficie); color: var(--inchiostro); min-height: 2.2rem;
}
.comandi button[aria-pressed="true"] { background: var(--inchiostro); color: var(--carta); border-color: var(--inchiostro); }
.copertina-web { text-align: center; padding: 2rem 0 1rem; }
.copertina-web h1 { font-size: 2.2rem; margin: 0; }
.sottotitolo-libro { color: var(--tenue); margin-top: .8rem; }
.copertina-web .autore { margin-top: 1rem; font-weight: 600; }
.parte-indice h2 { border-bottom: 2px solid var(--inchiostro); padding-bottom: .3rem; }
.piede { text-align: center; color: var(--tenue); font-size: .8rem; padding: 2rem 16px; }
.cerca { display: block; font-weight: 600; margin-bottom: .5rem; }
.cerca input {
  display: block; width: 100%; margin-top: .3rem; font: inherit; padding: .55rem .75rem;
  border: 1.5px solid var(--linea); border-radius: 8px; background: var(--superficie); color: var(--inchiostro);
}

/* Filtri del sito (impostati da manuale.js) */
html[data-livello="1"] body.web .sez.l2,
html[data-livello="2"] body.web .sez.l1 { display: none; }
html[data-zh="off"] body.web .unita .zh,
html[data-zh="off"] body.web .unita .consegna-zh,
html[data-zh="off"] body.web .unita .h-zh,
html[data-zh="off"] body.web .unita .titolo-zh,
html[data-zh="off"] body.web .unita .aiuto,
html[data-zh="off"] body.web .unita ruby.g rt { display: none; }

@media (max-width: 600px) {
  .testa-unita h1 { font-size: 1.6rem; }
  .abbina { grid-template-columns: 1fr; }
  .leggi .scritto { white-space: normal; }
  .frasi td { display: block; border: 0; padding: .1rem .3rem; width: auto !important; }
  .frasi tr { display: block; border-bottom: 1px solid var(--linea); padding: .3rem 0; }
  .riga { width: 100%; }
  .caselle { float: none; display: flex; margin-top: .2rem; }
}

/* ==========================================================================
   STAMPA (A4)
   ========================================================================== */
@page {
  size: A4;
  margin: 16mm 15mm 18mm;
  @bottom-center { content: counter(page); font-family: "Noto Sans", sans-serif; font-size: 9pt; color: #5b6470; }
}
@page :first { @bottom-center { content: none; } }

body.stampa { background: #fff; font-size: 10.5pt; }
body.stampa .aiuto summary { display: none; }
body.stampa .aiuto > .zh { display: block; font-size: .85em; }
body.stampa details.aiuto:not([open]) > *:not(summary) { display: block; }
body.stampa h2 { break-after: avoid; break-inside: avoid; }
body.stampa .unita { break-before: page; }
body.stampa .esercizi { break-before: page; }
body.stampa .soluzioni { break-before: page; font-size: .92em; }
body.stampa .soluzioni p { margin-bottom: .5rem; }
body.stampa .riquadro, body.stampa .esempio, body.stampa .attenzione, body.stampa .regola { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
body.stampa .badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

.copertina { height: 250mm; display: flex; flex-direction: column; justify-content: center; text-align: center; }
.copertina h1 { font-size: 34pt; margin: 0; }
.copertina .titolo-zh { font-size: 22pt; }
.copertina .sottotitolo-libro { font-size: 13pt; margin-top: 1.5rem; }
.copertina .autore { margin-top: 2.5rem; font-size: 14pt; font-weight: 600; }
.copertina .versione { margin-top: 3rem; color: #5b6470; font-size: 9pt; }
.indice-stampa { break-before: page; }
.indice-stampa h3 { margin: 1.1rem 0 .3rem; font-size: 11pt; }
.indice-stampa .indice li { display: flex; flex-wrap: wrap; gap: .1rem .8rem; padding: .2rem .3rem; font-size: 9.5pt; }
.indice-stampa .indice li.pronta span:first-child { font-weight: 700; }
.indice-stampa a { color: inherit; text-decoration: none; }
.indice-stampa .indice li.pronta { display: block; }
.indice-stampa .indice li.pronta a { display: flex; align-items: baseline; gap: .1rem .8rem; }
.indice-stampa .puntini { flex: 1; border-bottom: 1px dotted var(--tenue); min-width: 1.5rem; }
.indice-stampa .pagina { font-variant-numeric: tabular-nums; min-width: 2.2em; text-align: right; font-weight: 600; }
.indice-stampa .indice-finale { margin-top: 1.2rem; }
.glossario-stampa { break-before: page; }

/* La retta dei numeri occupa tutta la larghezza */
.figure:has(> .figura .retta-numerica) { grid-template-columns: 1fr !important; }
.figure .retta-numerica { max-width: 100% !important; }

/* In stampa: tabelle brevi, scomposizioni e titoletti non si spezzano tra due pagine */
body.stampa .tabella-scorre, body.stampa .colonne, body.stampa .frasi, body.stampa .leggi,
body.stampa .confronto, body.stampa .legenda { break-inside: avoid; }
body.stampa .sottotitolo { break-after: avoid; }
body.stampa .tabella-scorre { overflow: visible; }
/* Il piano cartesiano si vede più grande */
.figure:has(> .figura .piano) { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important; }
.figure .piano { max-width: 360px !important; }

/* Licenza in copertina */
.licenza { max-width: 36rem; margin: 2rem auto 0; font-size: .8rem; color: var(--tenue); text-align: center; }
.licenza p { margin: .3rem 0; }
.licenza a { color: inherit; }
body.stampa .licenza { font-size: 8.5pt; margin-top: 4rem; }
.piede a { color: inherit; }
.indice-stampa h3 { break-after: avoid; }

/* Nome dell'autore con il link all'email */
.autore a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
