/* PONELI: stili degli strumenti (bacheca, mappa, storie, agenda, flashcard, timer, gettoni, emozioni) */
.icona-tipo { font-size: 1.6rem; }
.strumenti { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.strumenti label { font-weight: 600; margin: 0; }
.strumenti select { width: auto; min-height: 44px; }
.aiuto-riga { color: var(--testo-tenue); font-size: .9rem; margin: 8px 0 0; }

/* ===== Bacheca (dal componente originale) ===== */
.bacheca {
  --paper: #f4f7f4; --grid: #d5e3dd; --grid-strong: #b9cfc6; --line: #c9d8d2;
  --note-ink: #26231c; --note-sub: #5b5446; --shadow: rgba(31, 43, 42, .18);
}
:root[data-tema="scuro"] .bacheca { --paper: #162020; --grid: #22302f; --grid-strong: #2d3f3d; --line: #2f4240; --shadow: rgba(0,0,0,.45); }
.bacheca .select-colore { background: var(--note-bg); color: var(--note-ink); font-weight: 700; }
.legenda { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .9rem; color: var(--testo-tenue); margin: 0 0 12px; }
.legenda span { display: inline-flex; align-items: center; gap: 6px; }
.legenda i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,.12); background: var(--note-bg); }
:root[data-tema="scuro"] .legenda i { background: var(--note-bg-dark); }
.legenda input { font: inherit; color: var(--testo); background: transparent; border: 0; border-bottom: 1px dashed var(--bordo); padding: 1px 2px; min-height: 0; width: auto; border-radius: 0; }
.legenda input:focus { outline: none; border-bottom-color: var(--primario); }
.bacheca-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.lavagna {
  position: relative; background-color: var(--paper);
  background-image: linear-gradient(var(--grid-strong) 1px, transparent 1px), linear-gradient(90deg, var(--grid-strong) 1px, transparent 1px), linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 100px 100px, 100px 100px, 10px 10px, 10px 10px;
}
.nota-postit {
  position: absolute; padding: 30px 18px 16px; color: var(--note-ink); background: var(--note-bg); width: 272px;
  box-shadow: 0 1px 1px var(--shadow), 0 10px 18px -8px var(--shadow);
  transform: rotate(var(--rot, 0deg)); transition: box-shadow .15s, transform .15s;
}
:root[data-tema="scuro"] .nota-postit { background: var(--note-bg-dark); color: #f1ede4; --note-sub: #d6cdb9; }
.nota-postit.trascina { box-shadow: 0 2px 2px var(--shadow), 0 22px 30px -10px var(--shadow); transform: rotate(0) scale(1.02); transition: none; }
.maniglia { position: absolute; top: 0; left: 0; right: 0; height: 26px; cursor: grab; touch-action: none; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; }
.maniglia::before { content: ""; position: absolute; left: 50%; top: -9px; width: 86px; height: 20px; transform: translateX(-50%) rotate(-2deg); background: rgba(255,255,255,.55); border: 1px solid rgba(0,0,0,.06); }
.maniglia .matita { font-weight: 800; font-size: 13px; color: var(--note-sub); position: relative; }
.maniglia .pulsanti { position: relative; display: flex; gap: 4px; align-items: center; }
.nota-x { border: 0; background: transparent; color: var(--note-sub); font-size: 20px; font-weight: 700; line-height: 1; cursor: pointer; padding: 2px 5px; border-radius: 4px; }
.nota-x:hover { background: rgba(0,0,0,.08); }
.nota-occhio { display: none; font: 700 12px var(--font); color: var(--note-ink); background: rgba(255,255,255,.6); border: 1px solid rgba(0,0,0,.12); border-radius: 20px; padding: 2px 9px; cursor: pointer; }
.nota-titolo { font-weight: 800; font-size: 19px; line-height: 1.15; margin: 0 0 8px; outline: none; }
.nota-corpo { font-family: "Comic Sans MS", "Comic Neue", "Chalkboard SE", "Segoe Print", sans-serif; font-size: 18px; line-height: 1.3; outline: none; min-height: 2em; }
.nota-corpo p { margin: 0 0 6px; }
.nota-postit :focus-visible { outline: 2px solid var(--primario); outline-offset: 2px; }
.lavagna-vuota { position: absolute; left: 50%; top: 120px; transform: translateX(-50%); max-width: 420px; margin: 0; padding: 18px 22px; text-align: center; color: var(--testo-tenue); background: var(--superficie); border: 1px dashed var(--line); border-radius: 10px; }
.quiz .nota-occhio { display: inline-block; }
.quiz .nota-postit:not(.rivelata) .nota-corpo { display: none; }
.quiz .nota-postit:not(.rivelata) .nota-titolo { margin: 0; }
@media (max-width: 760px) {
  .bacheca-scroll { overflow: visible; border: 0; }
  .lavagna { min-width: 0 !important; height: auto !important; display: flex; flex-direction: column; gap: 18px; padding: 14px 4px; }
  .nota-postit { position: relative; left: auto !important; top: auto !important; width: auto; }
  .maniglia { cursor: default; }
  .lavagna-vuota { position: static; transform: none; }
}

/* ===== Mappa ===== */
.mappa-area { position: relative; overflow: auto; border: 1px solid var(--bordo); border-radius: 10px; background: var(--superficie); height: calc(100vh - 260px); min-height: 420px; }
.mappa-tela { position: relative; width: 2400px; height: 1600px; background-image: radial-gradient(var(--bordo) 1px, transparent 1px); background-size: 24px 24px; }
.mappa-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.mappa-svg path.linea { stroke: var(--testo-tenue); stroke-width: 2.5; fill: none; }
.mappa-svg path.presa { stroke: transparent; stroke-width: 18; fill: none; pointer-events: stroke; cursor: pointer; }
.mappa-svg path.presa:hover + path.linea { stroke: var(--pericolo); stroke-width: 4; }
.mappa-svg text { fill: var(--testo); font-size: 14px; font-family: var(--font); paint-order: stroke; stroke: var(--superficie); stroke-width: 4px; }
.nodo { position: absolute; min-width: 140px; max-width: 260px; background: var(--superficie); border: 3px solid var(--colore, #6366f1); border-radius: 14px; padding: 10px 12px; box-shadow: var(--ombra); cursor: grab; touch-action: none; user-select: none; }
.nodo.selezionato { box-shadow: 0 0 0 4px var(--accento); }
.nodo.sorgente { box-shadow: 0 0 0 4px #10b981; }
.nodo-titolo { font-weight: 700; font-size: 1.05rem; background: var(--colore); color: #fff; margin: -10px -12px 8px; padding: 6px 12px; border-radius: 10px 10px 0 0; }
.nodo-testo { font-size: .95rem; white-space: pre-wrap; }
.nodo img { max-width: 100%; border-radius: 8px; margin-top: 6px; display: block; pointer-events: none; }
.nodo .formula { margin-top: 6px; overflow-x: auto; }
.nodo a { font-size: .9rem; }
.colori { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.colori button { width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.colori button[aria-pressed="true"] { border-color: var(--testo); }
.anteprima-img { max-width: 160px; max-height: 120px; display: block; margin: 6px 0; border-radius: 8px; }

/* ===== Storie sociali ===== */
.storia-griglia { display: grid; gap: 18px; grid-template-columns: repeat(var(--colonne, 2), minmax(0, 1fr)); }
.vignetta { background: var(--superficie); border: 3px solid var(--testo); border-radius: 6px; display: flex; flex-direction: column; break-inside: avoid; }
.vignetta-scena { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--sfondo-vignetta, #fff); border-bottom: 3px solid var(--testo); }
.vignetta-numero { position: absolute; top: 6px; left: 8px; background: var(--testo); color: var(--sfondo); border-radius: 999px; font-weight: 800; font-size: .85rem; padding: 0 9px; z-index: 5; }
.elemento { position: absolute; touch-action: none; }
.modificabile .elemento { cursor: grab; }
.elemento.selezionato { outline: 3px dashed var(--accento); outline-offset: 3px; }
.elemento img { width: 100%; height: auto; display: block; pointer-events: none; user-select: none; }
.fumetto { background: #fff; color: #111; border: 2.5px solid #111; border-radius: 22px; padding: 8px 12px; font-family: "Comic Sans MS", "Comic Neue", "Chalkboard SE", "Segoe Print", sans-serif; font-size: clamp(12px, 1.4vw, 18px); line-height: 1.25; text-align: center; position: relative; }
.fumetto::after { content: ""; position: absolute; bottom: -14px; left: var(--coda, 30%); border: 8px solid transparent; border-top: 14px solid #111; border-bottom: 0; }
.fumetto::before { content: ""; position: absolute; bottom: -9px; left: calc(var(--coda, 30%) + 2.5px); border: 5.5px solid transparent; border-top: 10px solid #fff; border-bottom: 0; z-index: 1; }
.fumetto.pensiero { border-radius: 50%; padding: 14px 16px; }
.fumetto.pensiero::after, .fumetto.pensiero::before { display: none; }
.fumetto.didascalia-box { border-radius: 2px; background: #fff7c2; }
.fumetto.didascalia-box::after, .fumetto.didascalia-box::before { display: none; }
.vignetta-testo { padding: 10px 12px; font-size: 1.1rem; min-height: 3em; outline: none; }
.vignetta-testo:empty::before { content: attr(data-segnaposto); color: var(--testo-tenue); }
.vignetta-strumenti { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 8px; border-top: 1px solid var(--bordo); background: var(--superficie-2); }
.vignetta-strumenti .btn { min-height: 34px; padding: 3px 10px; font-size: .85rem; }
.lettura { position: fixed; inset: 0; background: var(--sfondo); z-index: 900; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; gap: 14px; }
.lettura .vignetta { width: min(900px, 100%); max-height: 78vh; }
.lettura .vignetta-testo { font-size: 1.6rem; text-align: center; }
.lettura-comandi { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.lettura-comandi .btn { min-width: 120px; font-size: 1.1rem; }
@media (max-width: 700px) { .storia-griglia { grid-template-columns: 1fr; } }
@media print { .vignetta-strumenti { display: none; } .storia-griglia { gap: 10px; } }

/* ===== Agenda visiva ===== */
.agenda { display: flex; gap: 14px; flex-wrap: wrap; align-items: stretch; }
.agenda.verticale { flex-direction: column; max-width: 640px; }
.passo { background: var(--superficie); border: 3px solid var(--bordo); border-radius: 16px; padding: 12px; width: 180px; display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; text-align: center; }
.agenda.verticale .passo { width: auto; flex-direction: row; text-align: left; }
.passo img { width: 120px; height: 120px; object-fit: contain; background: #fff; border-radius: 10px; }
.agenda.verticale .passo img { width: 80px; height: 80px; }
.passo .passo-testo { font-size: 1.2rem; font-weight: 700; flex: 1; }
.passo.fatto { opacity: .45; border-style: dashed; }
.passo.fatto img { filter: grayscale(1); }
.passo.attuale { border-color: var(--accento); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accento) 35%, transparent); }
.passo .spunta { width: 52px; height: 52px; border-radius: 50%; border: 3px solid var(--ok-testo); background: var(--superficie); font-size: 1.6rem; cursor: pointer; color: var(--ok-testo); }
.passo.fatto .spunta { background: var(--ok-testo); color: var(--superficie); }
.passo .mini { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.passo .mini button { border: 1px solid var(--bordo); background: var(--superficie-2); color: var(--testo); border-radius: 8px; padding: 2px 8px; cursor: pointer; font: inherit; font-size: .85rem; }
.passo .numero { position: absolute; top: -12px; left: -12px; background: var(--primario); color: var(--primario-testo); border-radius: 50%; width: 30px; height: 30px; display: grid; place-items: center; font-weight: 800; }
.passo-nuovo { border: 3px dashed var(--bordo); background: transparent; color: var(--testo-tenue); font: inherit; font-weight: 700; cursor: pointer; }

/* ===== Flashcard ===== */
.carte-elenco { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.carta-modifica { background: var(--superficie); border: 1px solid var(--bordo); border-radius: 14px; padding: 12px; display: grid; gap: 6px; }
.carta-modifica img { max-height: 90px; object-fit: contain; align-self: center; }
.studio { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.carta { width: min(560px, 100%); aspect-ratio: 3 / 2; perspective: 1200px; cursor: pointer; border: 0; background: none; padding: 0; font: inherit; color: inherit; }
.carta-interno { position: relative; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d; }
.carta.girata .carta-interno { transform: rotateY(180deg); }
.carta-faccia { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 20px; background: var(--superficie); border: 3px solid var(--primario); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 20px; font-size: 1.8rem; font-weight: 700; text-align: center; box-shadow: var(--ombra); }
.carta-faccia img { max-height: 55%; max-width: 70%; object-fit: contain; }
.carta-retro { transform: rotateY(180deg); border-color: var(--accento); }
.studio-conta { color: var(--testo-tenue); }
@media (prefers-reduced-motion: reduce) { .carta-interno { transition: none; } }

/* ===== Timer ===== */
.timer-box { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.timer-disco { width: min(420px, 80vw); height: min(420px, 80vw); }
.timer-tempo { font-size: 3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.timer-preset { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ===== Gettoni ===== */
.piani { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.piano { background: var(--superficie); border: 1px solid var(--bordo); border-radius: 16px; padding: 18px; }
.piano h3 { margin: 0 0 4px; font-size: 1.2rem; }
.piano .premio { color: var(--testo-tenue); margin: 0 0 10px; }
.caselle { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.casella { width: 54px; height: 54px; border-radius: 50%; border: 3px dashed var(--bordo); display: grid; place-items: center; font-size: 1.8rem; }
.casella.piena { border-style: solid; border-color: var(--accento); background: color-mix(in srgb, var(--accento) 18%, var(--superficie)); }
.casella img { width: 38px; height: 38px; object-fit: contain; }
.piano.completo { border: 3px solid var(--ok-testo); }
.piano .festa { color: var(--ok-testo); font-weight: 800; font-size: 1.2rem; }

/* ===== Emozioni ===== */
.emozioni-scelta { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.emozione-btn { border: 3px solid var(--bordo); background: var(--superficie); border-radius: 18px; padding: 14px 8px; cursor: pointer; font: inherit; font-weight: 700; color: var(--testo); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.emozione-btn .faccia { font-size: 3.4rem; line-height: 1; }
.emozione-btn[aria-pressed="true"] { border-color: var(--primario); background: var(--info-sfondo); }
.intensita { display: flex; gap: 8px; flex-wrap: wrap; }
.intensita label { display: flex; align-items: center; gap: 6px; font-weight: 600; border: 2px solid var(--bordo); border-radius: 999px; padding: 6px 14px; cursor: pointer; margin: 0; }
.intensita input { width: 20px; height: 20px; }
.storico-emo { display: flex; flex-wrap: wrap; gap: 6px; }
.storico-emo span { font-size: 1.8rem; }

/* ===== Calendario ===== */
.calendario-box { background: var(--superficie); border: 1px solid var(--bordo); border-radius: var(--raggio); padding: 12px; }
.fc { --fc-border-color: var(--bordo); --fc-page-bg-color: var(--superficie); --fc-neutral-bg-color: var(--superficie-2); --fc-today-bg-color: color-mix(in srgb, var(--accento) 15%, transparent); --fc-button-bg-color: var(--primario); --fc-button-border-color: var(--primario); --fc-button-hover-bg-color: var(--primario-hover); --fc-button-hover-border-color: var(--primario-hover); --fc-button-active-bg-color: var(--primario-hover); --fc-button-text-color: var(--primario-testo); }
.fc .fc-toolbar-title { font-size: 1.3rem; text-transform: capitalize; }
.fc a { color: inherit; text-decoration: none; }
.legenda-cal { display: flex; gap: 14px; flex-wrap: wrap; color: var(--testo-tenue); font-size: .9rem; margin: 8px 0; }
@media (max-width: 640px) { .fc .fc-toolbar { flex-direction: column; gap: 8px; } }
.timer-box:fullscreen { background: var(--sfondo); justify-content: center; }
.vignetta-strumenti select { width: auto; min-height: 34px; padding: 2px 8px; font-size: .85rem; }

/* ===== Responsive strumenti ===== */
@media (max-width: 1100px) {
  .storia-griglia { grid-template-columns: repeat(min(var(--colonne, 2), 2), minmax(0, 1fr)); }
  .mappa-area { height: calc(100vh - 300px); }
}
@media (max-width: 900px) {
  .strumenti { gap: 6px; }
  .strumenti .btn { min-height: 40px; padding: 6px 12px; }
  .passo { width: 150px; }
  .passo img { width: 100px; height: 100px; }
  .piani { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .storia-griglia { grid-template-columns: 1fr; }
  .strumenti .btn { font-size: .85rem; padding: 5px 10px; }
  .mappa-area { height: 65vh; min-height: 360px; }
  .agenda:not(.verticale) .passo { width: calc(50% - 7px); }
  .passo img { width: 84px; height: 84px; }
  .piani { grid-template-columns: 1fr; }
  .emozioni-scelta { grid-template-columns: repeat(2, 1fr); }
  .emozione-btn .faccia { font-size: 2.6rem; }
  .carta-faccia { font-size: 1.3rem; }
  .lettura .vignetta-testo { font-size: 1.2rem; }
  .lettura-comandi .btn { min-width: 0; flex: 1 1 40%; }
  .timer-tempo { font-size: 2.2rem; }
  .vignetta-strumenti .btn { padding: 3px 8px; }
}

/* ===== Stampa bacheca: versione leggera (niente griglia, ombre e rotazioni, che rallentano o bloccano l'anteprima di stampa) ===== */
@media print {
  .bacheca-scroll { overflow: visible !important; border: 0 !important; }
  .lavagna { background: none !important; height: auto !important; min-width: 0 !important; display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 0 !important; }
  .nota-postit { position: static !important; width: auto !important; transform: none !important; box-shadow: none !important; transition: none !important;
    border: 1px solid #999; break-inside: avoid; page-break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; padding: 12px 14px; }
  .nota-postit::before, .nota-postit::after { display: none !important; }
  .maniglia, .nota-x, .nota-occhio, .nota-postit button { display: none !important; }
  .legenda input { border: 0 !important; }
}

/* ===== Lavagna ===== */
.lavagna-barra { gap: 6px 10px; margin-bottom: 8px; }
.lavagna-barra .gruppo { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.lavagna-barra .btn { min-height: 40px; padding: 6px 10px; }
.lavagna-barra .btn-strumento { min-width: 44px; font-size: 1.1rem; padding: 4px 8px; }
.lavagna-barra .btn[aria-pressed="true"] { background: var(--primario); color: #fff; border-color: var(--primario); }
.lavagna-barra .btn:disabled { opacity: .4; cursor: default; }
.tavolozza .colore { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(0,0,0,.25); cursor: pointer; padding: 0; }
.tavolozza .colore[aria-pressed="true"] { outline: 3px solid var(--primario); outline-offset: 2px; }
.tavolozza input[type=color] { width: 36px; height: 34px; padding: 0 2px; border-radius: 8px; cursor: pointer; }
.gruppo-spessore input[type=range] { width: 120px; min-height: 0; padding: 0; }
.anteprima-pennello { display: inline-block; border-radius: 50%; border: 1px solid #888; vertical-align: middle; }
.etichetta-mini { font-size: .85rem; color: var(--testo-tenue); }
.riempi { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: .9rem; }
.lavagna-pagina { font-weight: 600; font-size: .9rem; padding: 0 4px; white-space: nowrap; }
.lavagna-area { width: 100%; display: flex; justify-content: center; }
.lavagna-tavola { position: relative; overflow: hidden; border: 1px solid var(--bordo); border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.08);
  touch-action: none; user-select: none; -webkit-user-select: none; background: #fff; }
.lavagna-tavola canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.lavagna-inchiostro { pointer-events: none; }
.lavagna-tavola[data-strumento="p"] .lavagna-vivo, .lavagna-tavola[data-strumento="h"] .lavagna-vivo,
.lavagna-tavola[data-strumento^="l"] .lavagna-vivo, .lavagna-tavola[data-strumento="a"] .lavagna-vivo,
.lavagna-tavola[data-strumento="r"] .lavagna-vivo, .lavagna-tavola[data-strumento="o"] .lavagna-vivo,
.lavagna-tavola[data-strumento="tr"] .lavagna-vivo, .lavagna-tavola[data-strumento="ax"] .lavagna-vivo { cursor: crosshair; }
.lavagna-tavola[data-strumento="g"] .lavagna-vivo { cursor: none; }
.lavagna-tavola[data-strumento="t"] .lavagna-vivo, .lavagna-tavola[data-strumento="f"] .lavagna-vivo { cursor: text; }
.lavagna-oggetti { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; transform-origin: 0 0; }
.lavagna-oggetti .ogg { position: absolute; line-height: 1.25; white-space: pre; }
.lavagna-oggetti .ogg-i img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.lavagna-tavola[data-strumento="v"] .ogg { cursor: move; }
.lavagna-tavola[data-strumento="v"] .ogg:hover { outline: 2px dashed rgba(37,99,235,.5); outline-offset: 4px; }
.lavagna-oggetti .ogg.sel { outline: 3px solid #2563eb; outline-offset: 4px; }
.ogg-ctrl { position: absolute; left: 0; bottom: 100%; margin-bottom: 8px; display: flex; gap: 4px; transform-origin: 0 100%; white-space: nowrap; }
.ogg-ctrl button { font: 600 16px/1 system-ui, sans-serif; color: #111; background: #fff; border: 1px solid #94a3b8; border-radius: 8px; min-width: 36px; height: 36px; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.ogg-ctrl button.pericolo { color: #b91c1c; }
.maniglia { position: absolute; right: -10px; bottom: -10px; background: #2563eb; border: 2px solid #fff; border-radius: 50%; cursor: nwse-resize; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.ogg-f .katex { font-size: 1em; }
.tasti-formula { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0; }
.tasti-formula .btn { min-width: 44px; font-family: 'Times New Roman', serif; font-size: 1rem; }
.formula-anteprima { min-height: 48px; font-size: 1.6rem; padding: 8px; border: 1px dashed var(--bordo); border-radius: 8px; overflow-x: auto; }
body.tutto-schermo .lavagna-barra { margin-bottom: 6px; }
body.tutto-schermo.editor-lavagna .crediti { display: none; }
@media (max-width: 700px) {
  .lavagna-barra .btn { min-height: 36px; padding: 4px 8px; }
  .lavagna-barra .btn-strumento { min-width: 38px; font-size: 1rem; }
  .tavolozza .colore { width: 26px; height: 26px; }
  .gruppo-spessore input[type=range] { width: 90px; }
}
@media print {
  .editor-lavagna .lavagna-tavola { box-shadow: none; }
}

/* ===== Elementi comuni dei nuovi strumenti ===== */
.mini { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.mini button { border: 1px solid var(--bordo); background: var(--superficie-2); color: var(--testo); border-radius: 8px; padding: 2px 8px; cursor: pointer; font: inherit; font-size: .85rem; min-height: 32px; }
.strumenti .check { align-items: center; font-weight: 600; }
.strumenti .check input { margin-top: 0; }
.gruppo-modifica, .gruppo-lettura { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gruppo-modifica[hidden], .gruppo-lettura[hidden] { display: none; }

/* ===== Tabella CAA ===== */
.caa-frase { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--superficie); border: 2px solid var(--bordo); border-radius: 14px; padding: 10px; margin-bottom: 14px; min-height: 96px; }
.caa-frase[hidden] { display: none; }
.caa-frase-parole { flex: 1; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; min-width: 200px; }
.caa-frase-voce { display: inline-flex; flex-direction: column; align-items: center; font-weight: 700; font-size: .95rem; }
.caa-frase-voce img { width: 56px; height: 56px; object-fit: contain; }
.caa-frase-azioni { display: flex; gap: 6px; }
.caa-griglia { display: grid; grid-template-columns: repeat(var(--colonne, 4), minmax(0, 1fr)); gap: 10px; }
.caa-cella-box { display: flex; flex-direction: column; gap: 4px; }
.caa-cella { width: 100%; aspect-ratio: 1 / 1; border: 3px solid rgba(0,0,0,.18); border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px; cursor: pointer; color: #111; font: inherit; box-shadow: 0 2px 6px rgba(0,0,0,.08); transition: transform .12s; }
.caa-cella:active, .caa-cella.premuta { transform: scale(.94); }
.caa-cella img { width: 75%; height: 70%; object-fit: contain; pointer-events: none; }
.caa-testo { font-weight: 800; font-size: clamp(.85rem, 2vw, 1.3rem); text-align: center; line-height: 1.1; }
.caa-vuota { font-size: 2.5rem; color: #999; }
.caa-nuova { background: var(--superficie-2); border-style: dashed; font-weight: 700; color: var(--testo); }
.caa-anteprima { width: 120px; height: 120px; object-fit: contain; display: block; margin: 0 auto 8px; }
@media (max-width: 600px) { .caa-griglia { grid-template-columns: repeat(min(var(--colonne, 4), 3), minmax(0, 1fr)); gap: 6px; } .caa-frase-voce img { width: 40px; height: 40px; } }

/* ===== Lettura facilitata ===== */
.lettura-modifica { width: 100%; min-height: 50vh; font-size: 1.2rem; line-height: 1.6; }
.lettura-box { position: relative; border-radius: 14px; border: 1px solid var(--bordo); padding: clamp(16px, 4vw, 48px); overflow: hidden; }
.lettura-box[data-sfondo="bianco"] { background: #fff; color: #111; }
.lettura-box[data-sfondo="crema"] { background: #fbf5e3; color: #1b1b1b; }
.lettura-box[data-sfondo="azzurro"] { background: #e3f1fb; color: #102a43; }
.lettura-box[data-sfondo="giallo"] { background: #fff6b3; color: #1b1b1b; }
.lettura-box[data-sfondo="scuro"] { background: #1d2430; color: #f4f1e8; }
.lettura-foglio { font-family: Verdana, Tahoma, 'Trebuchet MS', Arial, sans-serif; letter-spacing: .04em; word-spacing: .16em; max-width: 46em; margin: 0 auto; }
.lettura-foglio p { margin: 0 0 .6em; }
.lettura-foglio .parola { cursor: pointer; border-radius: 6px; padding: 0 .06em; transition: background .1s; }
.lettura-foglio .parola:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.lettura-foglio .parola.attiva { background: #ffd43b; color: #111; box-shadow: 0 0 0 3px #ffd43b; }
.righello { position: absolute; inset: 0; pointer-events: none; --y: 120px; --h: 60px;
  background: linear-gradient(to bottom, rgba(0,0,0,.42) 0, rgba(0,0,0,.42) calc(var(--y) - var(--h) / 2), transparent calc(var(--y) - var(--h) / 2), transparent calc(var(--y) + var(--h) / 2), rgba(0,0,0,.42) calc(var(--y) + var(--h) / 2)); }
.righello[hidden] { display: none; }

/* ===== Esercizi ===== */
.consegna { font-size: 1.2rem; font-weight: 700; }
.scelta-modo { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.scelta-modo-btn { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left; cursor: pointer; font: inherit; color: var(--testo); }
.scelta-modo-btn .icona { font-size: 2rem; }
.es-testa { display: flex; gap: 10px; align-items: center; font-size: 1.15rem; margin-bottom: 6px; }
.es-lista { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.es-riga { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--superficie); border: 1px solid var(--bordo); border-radius: 12px; padding: 8px; }
.es-riga input { flex: 1; min-width: 140px; }
.es-riga select { width: auto; }
.es-riga .numero { font-weight: 800; color: var(--testo-tenue); min-width: 1.5em; }
.es-riga .freccia { font-size: 1.4rem; }
.img-scelta { width: 48px; height: 48px; padding: 2px; display: inline-grid; place-items: center; font-size: 1.3rem; }
.img-scelta img { width: 42px; height: 42px; object-fit: contain; }
.carta-es { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 84px; padding: 10px 14px; border: 3px solid var(--bordo); border-radius: 14px; background: var(--superficie); color: var(--testo); font: inherit; font-weight: 700; font-size: 1.1rem; cursor: pointer; transition: transform .12s, border-color .12s; }
.carta-es img { width: 90px; height: 90px; object-fit: contain; }
.carta-es.scelta { border-color: #2563eb; transform: scale(1.04); box-shadow: 0 0 0 4px rgba(37,99,235,.25); }
.carta-es.giusta, .posto.giusta { border-color: #2f9e44; background: #e3f6e7; color: #14532d; }
.carta-es.sbagliata, .posto.sbagliata { border-color: #e5484d; background: #fde8e8; animation: scuoti .35s; }
@keyframes scuoti { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.abbina { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.abbina-col { display: flex; flex-direction: column; gap: 10px; }
.riordina-posti, .riordina-mazzo { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.posto { position: relative; min-width: 120px; min-height: 120px; border: 3px dashed var(--bordo); border-radius: 14px; background: var(--superficie-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px; font: inherit; font-weight: 700; color: var(--testo); cursor: pointer; }
.posto.pieno { border-style: solid; background: var(--superficie); }
.posto img { width: 80px; height: 80px; object-fit: contain; }
.posto .numero { position: absolute; top: 4px; left: 8px; font-size: .85rem; color: var(--testo-tenue); }
.riordina-mazzo .carta-es { min-width: 120px; }
.riga-completa { display: flex; gap: 12px; align-items: center; margin: 10px 0; }
.mini-img { width: 64px; height: 64px; object-fit: contain; flex: none; }
.frase-completa { font-size: 1.35rem; line-height: 2.2; margin: 0; }
.frase-completa .buco { display: inline-block; width: auto !important; max-width: 60%; min-height: 0 !important; vertical-align: baseline; padding: 2px 8px; font-size: 1.2rem; border: 0; border-bottom: 3px solid var(--primario); border-radius: 6px 6px 0 0; background: var(--superficie-2); margin: 0 4px; }
.frase-completa .buco.giusta { border-color: #2f9e44; background: #e3f6e7; }
.frase-completa .buco.sbagliata { border-color: #e5484d; background: #fde8e8; }
.banca-parole { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px; border: 1px dashed var(--bordo); border-radius: 12px; margin-bottom: 10px; }
.chip { border: 2px solid var(--primario); background: var(--superficie); color: var(--primario); border-radius: 999px; padding: 6px 14px; font: inherit; font-weight: 700; cursor: pointer; }
.vf-riga { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 10px; border: 2px solid var(--bordo); border-radius: 14px; margin: 8px 0; background: var(--superficie); }
.vf-riga.giusta { border-color: #2f9e44; background: #e3f6e7; color: #14532d; }
.vf-riga.sbagliata { border-color: #e5484d; background: #fde8e8; color: #7f1d1d; }
.vf-testo { border: 0; background: none; font: inherit; font-size: 1.2rem; font-weight: 600; text-align: left; color: inherit; cursor: pointer; }
.vf-bottoni { display: flex; gap: 8px; }
.vf-riga.fatto .vf-bottoni { display: none; }
.vf-esito { grid-column: 2 / -1; font-weight: 800; }
.vf-esito:empty { display: none; }
.esito-box { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 16px; padding: 16px; border-radius: 14px; background: var(--superficie-2); font-size: 1.2rem; }
.esito-box.ok { background: #e3f6e7; color: #14532d; }
.esito-stelle { font-size: 2rem; }
@media (max-width: 600px) {
  .abbina { gap: 10px; }
  .carta-es { font-size: .95rem; padding: 8px; min-height: 64px; }
  .carta-es img { width: 60px; height: 60px; }
  .vf-riga { grid-template-columns: 48px 1fr; }
  .vf-bottoni { grid-column: 1 / -1; }
  .mini-img { width: 48px; height: 48px; }
}

/* ===== Task analysis (avanzamento) ===== */
.avanzamento { height: 16px; background: var(--superficie-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--bordo); }
.avanzamento span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #2f9e44, #74c69d); transition: width .3s; }
.avanzamento[hidden], .avanzamento-testo[hidden] { display: none; }
.avanzamento-testo { display: block; font-weight: 800; font-size: 1.2rem; margin: 6px 0 12px; }

/* ===== Prima-poi e scelte ===== */
.pp-griglia { display: flex; gap: 16px; align-items: stretch; justify-content: center; flex-wrap: wrap; margin: 10px 0; }
.pp-riquadro { flex: 1 1 220px; max-width: 420px; display: flex; flex-direction: column; gap: 10px; align-items: center; background: var(--superficie); border: 4px solid var(--bordo); border-radius: 20px; padding: 14px; transition: opacity .2s, transform .2s; }
.pp-etichetta { font-size: 1.6rem; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.pp-contenuto, .pp-img-btn { border: 0; background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; font: inherit; color: var(--testo); width: 100%; }
.pp-contenuto img, .pp-img-btn img { width: min(100%, 260px); aspect-ratio: 1; object-fit: contain; }
.pp-img-btn { min-height: 160px; justify-content: center; border: 2px dashed var(--bordo); border-radius: 14px; }
.pp-testo { font-size: 1.5rem; font-weight: 800; text-align: center; }
.pp-freccia { align-self: center; font-size: 3rem; color: var(--testo-tenue); }
.pp-primapoi .pp-riquadro.attuale { border-color: #2f9e44; box-shadow: 0 0 0 6px rgba(47,158,68,.2); }
.pp-primapoi .pp-riquadro.fatto { opacity: .4; }
.pp-primapoi .pp-riquadro.fatto .pp-etichetta::after { content: ' ✓'; color: #2f9e44; }
.pp-scelta .pp-riquadro.scelto { border-color: #2563eb; transform: scale(1.05); box-shadow: 0 0 0 6px rgba(37,99,235,.2); }
.pp-scelta .pp-riquadro.non-scelto { opacity: .35; }
.pp-messaggio { font-size: 1.3rem; font-weight: 800; text-align: center; }
@media (max-width: 600px) { .pp-freccia { transform: rotate(90deg); font-size: 2rem; } .pp-riquadro { flex-basis: 100%; } .pp-etichetta { font-size: 1.2rem; } }

/* ===== Semaforo del rumore ===== */
.semaforo-box { display: flex; gap: 32px; flex-wrap: wrap; align-items: flex-start; justify-content: center; }
.semaforo { display: flex; flex-direction: column; gap: 18px; padding: 22px; background: #22252b; border-radius: 40px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.semaforo .luce { width: min(26vh, 34vw, 190px); aspect-ratio: 1; border-radius: 50%; background: #3a3d44; transition: background .3s, box-shadow .3s; }
.semaforo.rosso .rosso { background: #ff3b3b; box-shadow: 0 0 50px 12px rgba(255,59,59,.7); }
.semaforo.giallo .giallo { background: #ffd43b; box-shadow: 0 0 50px 12px rgba(255,212,59,.7); }
.semaforo.verde .verde { background: #37d26a; box-shadow: 0 0 50px 12px rgba(55,210,106,.7); }
.semaforo-lato { flex: 1 1 280px; max-width: 460px; }
.semaforo-lato input[type=range] { width: 100%; min-height: 0; padding: 0; }
.semaforo-msg { font-size: 1.8rem; font-weight: 900; min-height: 2.4em; margin: 0 0 10px; }
.livello { position: relative; height: 22px; background: linear-gradient(90deg, #37d26a, #ffd43b 55%, #ff3b3b); border-radius: 999px; opacity: .35; margin-bottom: 8px; }
.livello span { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(0,0,0,.55); border-radius: 999px; }
.livello i { position: absolute; top: -4px; bottom: -4px; width: 3px; background: #111; }
body.tutto-schermo .semaforo-box { min-height: calc(100vh - 90px); align-items: center; }
body.tutto-schermo .semaforo .luce { width: min(27vh, 30vw); }

/* ===== Matematica ===== */
.schede-mat { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.schede-mat [role=tab] { border: 2px solid var(--bordo); background: var(--superficie); color: var(--testo); border-radius: 999px; padding: 8px 16px; font: inherit; font-weight: 700; cursor: pointer; min-height: 44px; }
.schede-mat [aria-selected="true"] { background: var(--primario); color: var(--primario-testo); border-color: var(--primario); }
.mat-campo { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; margin: 0; }
.mat-campo input { min-height: 40px; }
.mat-info { font-size: 1.3rem; font-weight: 800; min-height: 1.6em; }
.mat-svg { background: var(--superficie); border: 1px solid var(--bordo); border-radius: 14px; padding: 8px; overflow-x: auto; }
.linea-svg { width: 100%; min-width: 640px; height: auto; color: var(--testo); }
.linea-svg .tacca { cursor: pointer; }
.linea-svg .tacca:focus { outline: none; }
.linea-svg .tacca:focus line, .linea-svg .tacca:hover line { stroke: #2563eb; }
.linea-svg .num-et { font: 700 24px system-ui, sans-serif; fill: currentColor; }
.linea-svg .num-et.piccolo { font-size: 16px; }
.linea-svg .segnato .num-et { fill: #2563eb; font-size: 28px; }
.linea-svg .salto-et { font: 800 26px system-ui, sans-serif; }
.abaco { display: flex; gap: clamp(10px, 3vw, 40px); justify-content: center; align-items: flex-end; padding: 16px; background: var(--superficie); border: 1px solid var(--bordo); border-radius: 14px; }
.abaco-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.abaco-asta { position: relative; width: 60px; height: 330px; display: flex; flex-direction: column-reverse; align-items: center; gap: 2px; padding-bottom: 2px; }
.abaco-asta::before { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 8px; margin-left: -4px; background: #b08a5a; border-radius: 4px; z-index: 0; }
.pallina { position: relative; z-index: 1; width: 56px; height: 30px; border-radius: 50%; box-shadow: inset 0 -5px 8px rgba(0,0,0,.25), 0 1px 2px rgba(0,0,0,.3); }
.abaco-base { display: flex; flex-direction: column; align-items: center; border-top: 6px solid; padding-top: 4px; width: 90px; font-size: 1.6rem; font-weight: 800; }
.abaco-totale { text-align: center; font-size: clamp(2.5rem, 8vw, 5rem); font-weight: 900; letter-spacing: .1em; margin-top: 10px; }
.pitagorica { border-collapse: collapse; margin: 0 auto; }
.pitagorica th, .pitagorica td { border: 1px solid var(--bordo); padding: 0; text-align: center; }
.pitagorica button { width: clamp(30px, 7vw, 58px); height: clamp(30px, 6vw, 48px); border: 0; background: none; font: inherit; font-weight: 700; font-size: clamp(.8rem, 2vw, 1.15rem); color: var(--testo); cursor: pointer; }
.pitagorica th { background: var(--superficie-2); }
.pitagorica th button { font-weight: 900; }
.pitagorica td { background: var(--superficie); }
.pitagorica td.quadrato { background: #f3f0ff; }
.pitagorica .evid { background: #fff3bf; }
.pitagorica td.croce { background: #dbeafe; }
.pitagorica td.scelta { background: #2563eb; }
.pitagorica td.scelta button { color: #fff; font-size: 1.3rem; }
.frazioni { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; align-items: flex-start; }
.fraz-pannello { background: var(--superficie); border: 1px solid var(--bordo); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.fraz-svg { width: 260px; max-width: 80vw; height: auto; color: var(--testo); }
.fraz-svg .fetta { cursor: pointer; transition: fill .15s; }
.fraz-scritta { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.fraz { display: inline-flex; flex-direction: column; align-items: center; font-size: 2.6rem; font-weight: 900; line-height: 1.05; }
.fraz span:first-child { border-bottom: 4px solid currentColor; padding: 0 10px; }
.fraz-confronto { flex-basis: 100%; text-align: center; }
@media (max-width: 600px) { .semaforo-msg { font-size: 1.3rem; min-height: 0; } .semaforo { padding: 14px; gap: 12px; border-radius: 28px; } }
