/* ==========================================================================
   Quaderno di esercizi (js/nb/exbook.js)
   L'esercizio (testo o foto) resta in alto, la pagina a mano scorre sotto;
   la correzione dell'IA si apre accanto alla pagina.
   ========================================================================== */
.ex-panel { flex: none; position: relative; z-index: 2; background: var(--sheet); border-bottom: 1px solid var(--stroke); --exh: min(30vh, 250px); }
.ex-head { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; min-height: 46px; padding: 6px 12px 6px 6px; }
.ex-head .btn { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.ex-head .btn svg { width: 15px; height: 15px; flex: none; }
.ex-n { font-size: 15px; white-space: nowrap; }
.ex-of { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.ex-peek { display: none; flex: 1; min-width: 0; color: var(--ink-2); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-toggle { flex: none; }
.ex-toggle svg { transition: transform 0.2s var(--ease); }
/* chiuso: una riga sola con l'inizio del testo, la pagina ha tutto lo spazio */
.ex-panel.shut .ex-head { cursor: pointer; }
.ex-panel.shut .ex-toggle svg { transform: rotate(-90deg); }
.ex-panel.shut .ex-peek { display: block; }
.ex-panel.shut :is(.nb-grow, .ex-body, .ex-grip, [data-ex="edit"], [data-ex="space"]) { display: none; }

.ex-body { max-height: var(--exh); overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 0 16px 14px 48px; }
.ex-text { font-size: 16px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; }
.ex-q.both { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 40%); gap: 16px; align-items: start; }
.ex-img { display: block; max-width: min(100%, 860px); padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: #fff; cursor: zoom-in; box-shadow: 0 0 0 1px var(--stroke); }
.ex-img img { display: block; max-width: 100%; height: auto; }
.ex-img img:not([src]) { width: 200px; height: 90px; }
.ex-empty { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; padding: 2px 0; }
.ex-empty p { margin: 0; color: var(--ink-2); font-size: 15px; }
.ex-empty div { display: flex; gap: 8px; flex-wrap: wrap; }
.ex-empty .btn, .ex-ed-img .btn, .ex-fb .btn { display: inline-flex; align-items: center; gap: 8px; }
.ex-empty .btn svg, .ex-ed-img .btn svg, .ex-fb .btn svg { width: 16px; height: 16px; flex: none; }
/* maniglia: più o meno spazio all'esercizio */
.ex-grip { position: absolute; left: 0; right: 0; bottom: -9px; height: 18px; display: grid; place-items: center; cursor: ns-resize; touch-action: none; z-index: 3; }
.ex-grip i { width: 44px; height: 4px; border-radius: 4px; background: var(--ink-4); transition: background 0.15s, width 0.15s; }
.ex-grip:hover i, .ex-grip:active i { background: var(--ink-2); width: 56px; }

/* voto: nella barra dell'esercizio e nelle schede */
.ex-score { flex: none; display: inline-flex; align-items: baseline; gap: 1px; height: 28px; padding: 0 10px; border: 0; border-radius: 999px; background: var(--fill-2); color: var(--ink); font: inherit; font-size: 15px; font-weight: 700; line-height: 28px; font-variant-numeric: tabular-nums; cursor: pointer; }
.ex-score[hidden] { display: none; }
.ex-score small { font-size: 11px; font-weight: 500; opacity: 0.7; }
.ex-score.good, .ex-chip.good { background: var(--ok-fill); color: var(--ok); }
.ex-score.mid, .ex-chip.mid { background: color-mix(in srgb, var(--hint) 14%, transparent); color: var(--hint); }
.ex-score.bad, .ex-chip.bad { background: var(--ko-fill); color: var(--ko); }

/* ---------- correzione, accanto alla pagina ---------- */
.nb-transcript.ex-fb { width: 384px; gap: 14px; -webkit-user-select: text; user-select: text; }
.ex-fb-body { display: flex; flex-direction: column; gap: 18px; }
.ex-verdict { display: flex; align-items: center; gap: 14px; }
.ex-voto { flex: none; width: 78px; height: 78px; border-radius: 22px; display: grid; place-content: center; text-align: center; background: var(--fill-2); }
.ex-voto b { font-family: var(--font-display); font-size: 34px; line-height: 1; letter-spacing: -0.02em; }
.ex-voto small { margin-top: 3px; font-size: 11px; color: var(--ink-3); }
.ex-voto.good { background: var(--ok-fill); } .ex-voto.good b { color: var(--ok); }
.ex-voto.mid { background: color-mix(in srgb, var(--hint) 14%, transparent); } .ex-voto.mid b { color: var(--hint); }
.ex-voto.bad { background: var(--ko-fill); } .ex-voto.bad b { color: var(--ko); }
.ex-verdict-t { min-width: 0; }
.ex-verdict-t p { margin: 7px 0 0; font-size: 14.5px; line-height: 1.45; }
.ex-chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.ex-sec h4 { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 0 0 8px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.ex-sec h4 span { text-transform: none; letter-spacing: 0; font-weight: 500; }
.ex-next { padding: 12px 14px; border-radius: 14px; background: var(--fill); }
.ex-next ol, .ex-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.45; }
.ex-list.dim { color: var(--ink-2); }
.ex-crit { list-style: none; margin: 0 -4px; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.ex-crit li { display: flex; gap: 10px; padding: 8px 10px; border-radius: 11px; }
.ex-crit li.no { background: var(--ko-fill); }
.ex-crit li.par { background: color-mix(in srgb, var(--hint) 10%, transparent); }
.ex-crit i { flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--ink-4); }
.ex-crit i svg { width: 13px; height: 13px; stroke-width: 2.8; }
.ex-crit li.ok i { background: var(--ok); }
.ex-crit li.no i { background: var(--ko); }
.ex-crit li.par i { background: var(--hint); }
.ex-crit div { min-width: 0; }
.ex-crit b { font-size: 14px; font-weight: 600; }
.ex-crit li.ok b { font-weight: 500; color: var(--ink-2); }
.ex-crit em { margin-left: 7px; padding: 1px 7px; border-radius: 999px; background: var(--fill-3); color: var(--ink-2); font-style: normal; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; vertical-align: 1px; }
.ex-crit p { margin: 2px 0 0; font-size: 13.5px; line-height: 1.42; color: var(--ink-2); }
.ex-crit li.no p, .ex-crit li.par p { color: var(--ink); }
.ex-rec { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13.5px; }
.ex-rec li { display: grid; grid-template-columns: minmax(0, 1fr) 84px auto; align-items: center; gap: 10px; }
.ex-rec span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-rec i { height: 6px; border-radius: 6px; background: var(--fill-3); overflow: hidden; }
.ex-rec u { display: block; height: 100%; border-radius: 6px; background: var(--ko); text-decoration: none; }
.ex-rec small { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ex-more summary { cursor: pointer; font-size: 14px; color: var(--ink-2); padding: 4px 0; }
.ex-pre { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--fill); color: var(--ink-2); font-size: 13.5px; line-height: 1.5; overflow-x: auto; overflow-wrap: anywhere; }
.ex-when { margin: 0; }
.ex-busy { display: flex; align-items: center; gap: 10px; font-size: 14.5px; color: var(--ink-2); animation: fadeIn 0.2s ease-out both; }
.ex-busy .as-orb { margin-top: 0; flex: none; }
.ex-err { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--ko-fill); color: var(--ko); font-size: 14px; line-height: 1.4; }
.ex-stale { margin: 0; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--hint) 12%, transparent); color: var(--hint); font-size: 13.5px; }
.ex-fb-none { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.ex-fb-none p { margin: 0; font-size: 14.5px; line-height: 1.45; color: var(--ink-2); }
.ex-fb-foot { margin-top: auto; padding-top: 4px; }

/* ---------- finestre: testo e foto dell'esercizio, criteri del prof ---------- */
.nb-modal.ex-edit { width: min(620px, 100%); }
.nb-modal.ex-rub { width: min(760px, 100%); }
.ex-ta { display: block; width: 100%; min-height: 150px; padding: 12px 14px; resize: vertical; font-size: 16px; line-height: 1.45; }
.ex-rub .ex-ta { margin-top: 12px; min-height: 300px; font-size: 14.5px; }
.ex-ed-img { margin-top: 12px; display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.ex-ed-img img { display: block; max-width: min(100%, 360px); max-height: 220px; border-radius: 10px; background: #fff; box-shadow: 0 0 0 1px var(--stroke); }
.ex-ed-img div { display: flex; gap: 8px; }
.ex-rub .nb-modal-actions { align-items: center; }
.nb-modal.ex-fb-modal { width: min(560px, 100%); }

/* ---------- sul computer (sola lettura): l'esercizio sopra la sua pagina ---------- */
.ex-card { width: 100%; padding: 14px 18px 16px; border-radius: 16px; background: var(--raised); box-shadow: 0 0 0 1px var(--stroke); display: grid; gap: 10px; }
.ex-card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ex-card .small-note { margin: 0; }

@media (max-width: 760px) {
  .ex-head { padding-right: 8px; gap: 6px; }
  .ex-head .btn { padding: 0 10px; }
  .ex-body { padding-left: 14px; padding-right: 14px; }
  .ex-q.both { grid-template-columns: 1fr; }
  .ex-panel { --exh: min(28vh, 220px); }
  .ex-head .btn:not(.ex-judge) { width: 36px; padding: 0; justify-content: center; }
  .nb-transcript.ex-fb { width: auto; max-height: 70%; }
}
@media (max-width: 480px) {
  .ex-head { gap: 4px; padding: 6px 6px 6px 2px; }
  .ex-head .btn.ex-judge { padding: 0 10px; }
  .ex-score { padding: 0 8px; }
}
