/* ═══════════════════════════════════════════════════════════════════
   classi.css — stili condivisi della funzione "Classi"
   (classi.html · classe.html · classe-conferma.html)
   Si appoggia a /css/base.css (token :root, .btn*, reset, focus ring).
   Qui SOLO le aggiunte previste da docs/UX_CLASSI.md §1.2 / §1.5 / §1.6:
   colori semantici, pill, codice classe, tabella risultati, stepper,
   timer, stati vuoti, skeleton, dialog, toast, runner delle domande.
   Nessun token di base.css viene ridefinito.
═══════════════════════════════════════════════════════════════════ */

:root {
  /* §1.2 — colori semantici (mancano in base.css) */
  --ok-text: #86efac;      --ok-bg: rgba(22,163,74,.16);
  --warn-text: #fbbf24;    --warn-bg: rgba(251,191,36,.14);
  --err-text: #f87171;     --err-bg: rgba(160,26,54,.18);
  --info-text: #e8c875;    --info-bg: rgba(201,168,76,.12);
  --neutral-text: rgba(245,245,245,.65); --neutral-bg: rgba(255,255,255,.06);
  --label: rgba(245,245,245,.65);
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

html { scroll-behavior: auto; }
[hidden] { display: none !important; }
body { min-height: 100vh; overflow-wrap: anywhere; }
body.has-stepper { padding-bottom: 96px; }

/* ── Accessibilità di base ─────────────────────────────────────── */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; top: -100%; left: 16px; z-index: 9999;
  background: var(--gold); color: #0a0a0a; padding: 10px 18px;
  border-radius: var(--r-md); font-size: 14px; font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 8px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
::placeholder { color: rgba(245,245,245,.55); opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ── Topbar ────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 1100;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 24px; min-height: 64px;
  background: var(--bg-section); border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand { font-family: var(--font-heading); font-size: 20px; color: var(--text-primary); text-decoration: none; line-height: 1.15; white-space: nowrap; }
.brand small { display: block; font-family: var(--font-body); font-size: 12px; font-weight: 500; color: var(--label); letter-spacing: .04em; }
.back, .back-list {
  display: inline-block; line-height: 44px; min-height: 44px; padding: 0 6px;
  color: var(--gold-lt); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap;
}
.back:hover, .back-list:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .topbar { padding: 10px 16px; }
  .brand { font-size: 18px; }
  .back span.long { display: none; }
}

/* ── Layout ────────────────────────────────────────────────────── */
.wrap { max-width: 920px; margin: 0 auto; padding: 32px 24px 64px; }
.wrap-narrow { max-width: 480px; }
.wrap-runner { max-width: 720px; }
@media (max-width: 640px) { .wrap { padding: 20px 16px 48px; } }
h1 { font-size: 2rem; margin-bottom: 6px; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
@media (max-width: 640px) { h1 { font-size: 1.6rem; } }
.subtitle { color: var(--text-secondary); font-size: 15px; margin-bottom: 24px; max-width: 640px; }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 14px; }
.card-2 { background: var(--bg-card-2); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--text-secondary); font-size: 14px; }
.small { font-size: 13px; }
.help { font-size: 13px; color: var(--label); margin-top: 6px; line-height: 1.5; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
@media (max-width: 640px) {
  .actions.stack-m { flex-direction: column; align-items: stretch; }
  .actions.stack-m .btn { width: 100%; }
}

/* ── Bottoni: adattamenti (base.css definisce le varianti) ──────── */
.btn { min-height: 44px; }
/* bordo dei bottoni non primari a ≥ 3:1 sul fondo (WCAG 1.4.11): base.css usa .15/.2 */
.btn-secondary, .btn-ghost, .btn-outline { border-color: rgba(255,255,255,.35); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: default; transform: none !important; }
.btn-sm { min-height: 44px; padding: 8px 16px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-link { background: none; border: none; color: var(--gold-lt); text-decoration: underline; text-underline-offset: 2px; padding: 8px 4px; min-height: 44px; font: inherit; font-size: 14px; cursor: pointer; }
.btn-icon { min-width: 44px; padding-left: 10px; padding-right: 10px; }
.btn-danger { font-weight: 700; }

/* ── Form ──────────────────────────────────────────────────────── */
label, .label { display: block; font-size: 13px; font-weight: 600; color: var(--label); margin-bottom: 6px; }
fieldset { border: 1px solid var(--border-mid); border-radius: 12px; padding: 16px 18px 18px; margin: 0 0 16px; background: var(--bg-card); }
legend { padding: 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--gold); }
input[type=text], input[type=email], input[type=number], input[type=search], input[type=date], input[type=time], select, textarea {
  width: 100%; min-height: 44px; background: #0a0f1a; color: var(--text-primary);
  border: 1px solid rgba(255,255,255,.4); border-radius: 7px; padding: 9px 12px; font-size: 16px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 2px; background: var(--bg-card-2); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--err-text); }
textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23e8c875' stroke-width='2'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.field { margin-bottom: 16px; }
.field-error { display: none; margin-top: 6px; font-size: 13px; color: var(--err-text); line-height: 1.45; }
.field-error.show { display: block; }
.field-ok { margin-top: 6px; font-size: 14px; color: var(--ok-text); }
.status { margin: 14px 0 0; font-size: 14px; color: var(--text-secondary); min-height: 20px; line-height: 1.5; }
.status.err { color: var(--err-text); }
.status.ok { color: var(--ok-text); }
.chk { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; background: #0a0f1a; border: 1px solid rgba(255,255,255,.4); border-radius: 8px; cursor: pointer; font-size: 15px; font-weight: 500; color: var(--text-primary); }
.chk input { width: 20px; height: 20px; min-height: 0; accent-color: var(--gold); margin: 0; flex-shrink: 0; }
.chk:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.radio-list { display: flex; flex-direction: column; gap: 8px; }
.radio-row { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 15px; font-weight: 400; color: var(--text-primary); }
.radio-row:hover { background: rgba(255,255,255,.04); }
.radio-row input { width: 20px; height: 20px; min-height: 0; margin-top: 3px; accent-color: var(--gold); flex-shrink: 0; }
.radio-row:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
.radio-row .help { margin-top: 2px; display: block; }
.inline-radios { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-radios .radio-row { border: 1px solid var(--border-mid); min-width: 64px; justify-content: center; align-items: center; }

/* ── Pill di stato (§1.6) ──────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-full); font-size: 12px; font-weight: 600; line-height: 1.3; border: 1px solid currentColor; white-space: nowrap; }
.pill-ok { color: var(--ok-text); background: var(--ok-bg); border-color: rgba(134,239,172,.3); }
.pill-warn { color: var(--warn-text); background: var(--warn-bg); border-color: rgba(251,191,36,.3); }
.pill-err { color: var(--err-text); background: var(--err-bg); border-color: rgba(248,113,113,.3); }
.pill-info { color: var(--info-text); background: var(--info-bg); border-color: var(--gold-border); }
.pill-neutral { color: var(--neutral-text); background: var(--neutral-bg); border-color: rgba(255,255,255,.2); }
.pill-lg { font-size: 15px; padding: 8px 16px; }

/* ── Codice classe (§1.6) ──────────────────────────────────────── */
.class-code { display: inline-block; font-family: var(--font-mono); font-weight: 700; font-size: 40px; letter-spacing: .18em; color: var(--gold); background: var(--gold-light); border: 1px solid var(--gold-border); border-radius: var(--r-lg); padding: 16px 24px 16px 30px; user-select: all; -webkit-user-select: all; line-height: 1.1; }
.class-code-sm { font-family: var(--font-mono); font-weight: 700; font-size: 16px; letter-spacing: .16em; color: var(--gold); }
@media (max-width: 640px) { .class-code { font-size: 32px; padding: 14px 18px 14px 24px; } }

/* ── Tabs (.ai-tabs come dashboard.css, tab inattiva a .65) ───── */
.ai-tabs { display: flex; border-bottom: 1px solid var(--border); margin: 24px 0 16px; overflow-x: auto; }
.ai-tab-btn { flex: 1; min-height: 48px; padding: 12px 8px; font-family: var(--font-body); font-size: 14px; font-weight: 600; letter-spacing: .02em; color: var(--text-secondary); background: transparent; border: none; cursor: pointer; position: relative; transition: color var(--t-base), background var(--t-base); white-space: nowrap; }
.ai-tab-btn::after { content: ''; position: absolute; bottom: -1px; left: 12%; right: 12%; height: 2px; background: var(--gold); border-radius: 2px 2px 0 0; opacity: 0; transition: opacity var(--t-base); }
.ai-tab-btn[aria-selected="true"] { color: var(--gold); }
.ai-tab-btn[aria-selected="true"]::after { opacity: 1; }
.ai-tab-btn:hover { background: rgba(255,255,255,.04); }
.ai-tab-btn:focus-visible { outline-offset: -2px; }
[role="tabpanel"] { outline-offset: 4px; }
[role="tabpanel"][hidden] { display: none; }

/* ── Tabelle (studenti / risultati) ────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: 10px; }
table.results, table.students { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.results th, .results td, .students th, .students td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; min-height: 44px; }
.results th, .students th { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--label); background: var(--bg-card-2); white-space: normal; }
.results th .th-btn { background: none; border: none; color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; padding: 6px 0; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; text-align: left; }
.results th .th-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.results th[aria-sort] .th-btn::after { content: '↕'; opacity: .5; font-size: 12px; }
.results th[aria-sort="ascending"] .th-btn::after { content: '↑'; opacity: 1; }
.results th[aria-sort="descending"] .th-btn::after { content: '↓'; opacity: 1; }
.results th:first-child, .results td:first-child { position: sticky; left: 0; background: var(--bg-card); z-index: 1; min-width: 140px; box-shadow: 1px 0 0 var(--border); }
.results th:first-child { background: var(--bg-card-2); }
.results tbody th, .students tbody th { text-transform: none; font-size: 14px; letter-spacing: 0; color: var(--text-primary); background: var(--bg-card); font-weight: 600; }
.results tbody tr:hover td { background: rgba(255,255,255,.02); }
.results tbody tr:hover td:first-child { background: var(--bg-card-2); }
.results tfoot td { font-weight: 600; color: var(--text-secondary); background: var(--bg-card-2); }
.results tfoot td:first-child { background: var(--bg-card-2); }
.cell-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 8px; margin: -4px -8px; border-radius: 8px; background: none; border: none; color: var(--text-primary); font: inherit; cursor: pointer; text-align: left; }
.cell-btn:hover { background: rgba(255,255,255,.06); }
.cell-btn strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.results-cards { display: none; }
.students-cards { display: none; }
@media (max-width: 640px) {
  .table-wrap.responsive { display: none; }
  .results-cards, .students-cards { display: flex; flex-direction: column; gap: 10px; }
  .results-cards li, .students-cards li { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
  .results-cards .cell-btn { width: 100%; justify-content: space-between; margin: 0; padding: 8px 10px; border: 1px solid var(--border); }
}
.card-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.card-line:last-child { border-bottom: none; }
.student-name { font-weight: 600; color: var(--text-primary); }

/* ── Stato vuoto / skeleton ────────────────────────────────────── */
.empty { text-align: center; padding: 40px 20px; }
.empty svg { width: 40px; height: 40px; margin: 0 auto 12px; color: var(--gold); display: block; }
.empty h2, .empty h3 { font-family: var(--font-body); font-size: 18px; font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }
.empty p { color: var(--text-secondary); font-size: 15px; max-width: 460px; margin: 0 auto 16px; }
.skeleton { display: flex; flex-direction: column; gap: 12px; padding: 8px 0; }
.skeleton span { display: block; height: 18px; border-radius: 6px; background: rgba(255,255,255,.06); animation: sk 1.2s ease-in-out infinite alternate; }
.skeleton span:nth-child(2) { width: 80%; } .skeleton span:nth-child(3) { width: 60%; }
.skeleton.cards span { height: 96px; border-radius: 12px; width: 100% !important; }
@keyframes sk { from { opacity: .6; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .skeleton span { animation: none; } }
.error-box { background: var(--err-bg); border: 1px solid rgba(248,113,113,.3); border-radius: 10px; padding: 14px 16px; color: var(--text-primary); font-size: 15px; line-height: 1.5; }
.error-box .actions { margin-top: 12px; }
.notice { background: var(--info-bg); border: 1px solid var(--gold-border); border-radius: 10px; padding: 12px 16px; font-size: 14px; color: var(--text-primary); line-height: 1.5; }
.notice.warn { background: var(--warn-bg); border-color: rgba(251,191,36,.3); }
.notice.ok { background: var(--ok-bg); border-color: rgba(134,239,172,.3); }

/* ── Dialog ────────────────────────────────────────────────────── */
dialog.dlg { max-height: calc(100vh - 32px); overflow: auto; border: 1px solid var(--border-mid); border-radius: var(--r-lg); background: var(--bg-card); color: var(--text-primary); padding: 28px; max-width: min(480px, calc(100vw - 32px)); width: 100%; box-shadow: var(--shadow-md); margin: auto; }
dialog.dlg-wide { max-width: min(720px, calc(100vw - 32px)); }
dialog.dlg-side { max-width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
dialog.dlg::backdrop { background: rgba(0,0,0,.65); }
dialog.dlg-full { max-width: 100vw; width: 100vw; max-height: 100vh; height: 100vh; border: none; border-radius: 0; background: var(--bg); padding: 24px; display: flex; }
dialog.dlg-full[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
dialog.dlg-full:not([open]) { display: none; }
.dlg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.dlg-head h2 { font-size: 1.25rem; line-height: 1.25; }
.dlg-close { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--text-secondary); background: none; border: 1px solid transparent; font-size: 22px; line-height: 1; cursor: pointer; flex-shrink: 0; margin: -8px -8px 0 0; }
.dlg-close:hover { color: var(--text-primary); border-color: var(--border-mid); }
.dlg-body { font-size: 15px; line-height: 1.6; color: var(--text-secondary); }
.dlg-body p + p { margin-top: 8px; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 22px; }
@media (max-width: 640px) {
  dialog.dlg { padding: 20px; max-width: calc(100vw - 24px); }
  dialog.dlg-wide, dialog.dlg-side { max-width: 100vw; width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; border: none; margin: 0; }
  .dlg-actions { flex-direction: column-reverse; }
  .dlg-actions .btn { width: 100%; }
}

/* ── Toast (.glv-toast come dashboard.html) ───────────────────── */
.glv-toast { position: fixed; bottom: 24px; right: 24px; z-index: 9999; background: #141414; border: 1px solid rgba(201,150,42,.3); border-radius: 14px; padding: 14px 16px 14px 20px; display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--text-primary); box-shadow: var(--shadow-md); max-width: 360px; opacity: 0; transform: translateY(12px); transition: opacity .3s, transform .3s; pointer-events: none; }
.glv-toast.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.glv-toast.err { border-color: rgba(248,113,113,.45); }
.glv-toast-body { flex: 1; line-height: 1.45; }
.glv-toast-close { background: none; border: none; cursor: pointer; color: var(--text-secondary); font-size: 20px; line-height: 1; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; }
.glv-toast-close:hover { color: var(--text-primary); }
@media (max-width: 640px) { .glv-toast { left: 12px; right: 12px; max-width: none; bottom: 14px; } body.has-stepper .glv-toast { bottom: 84px; } }

/* ── Pannello Invita ───────────────────────────────────────────── */
details.invite { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; margin: 20px 0 8px; }
details.invite > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; cursor: pointer; font-weight: 600; font-size: 16px; min-height: 52px; border-radius: 12px; }
details.invite > summary::-webkit-details-marker { display: none; }
details.invite > summary .sum-hint { font-size: 14px; font-weight: 500; color: var(--gold-lt); }
details.invite[open] > summary .sum-hint::before { content: 'Nascondi'; }
details.invite:not([open]) > summary .sum-hint::before { content: 'Mostra'; }
.invite-body { padding: 4px 20px 20px; display: grid; grid-template-columns: auto 1fr; gap: 20px 28px; align-items: start; }
.invite-code { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.invite-link { display: flex; gap: 8px; align-items: stretch; }
.invite-link input { flex: 1; font-size: 14px; font-family: var(--font-mono); }
.invite-steps { margin: 12px 0 0; padding-left: 22px; color: var(--text-secondary); font-size: 15px; line-height: 1.6; list-style: decimal; }
.invite-steps li { margin-bottom: 4px; }
.invite-steps strong { color: var(--text-primary); }
.invite-bottom { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 720px) { .invite-body { grid-template-columns: 1fr; } .invite-code { align-items: stretch; text-align: center; } }
.proj-code { font-family: var(--font-mono); font-weight: 700; font-size: clamp(56px, 12vw, 120px); letter-spacing: .18em; color: var(--gold); line-height: 1.1; margin: 16px 0 28px; padding-left: .18em; }
.proj-steps { list-style: decimal; text-align: left; padding-left: 40px; font-size: clamp(18px, 3vw, 28px); line-height: 1.5; color: var(--text-primary); max-width: 900px; }
.proj-steps li { margin-bottom: 8px; }
.proj-steps strong { color: var(--gold); }

/* ── Card classe (elenco docente) ──────────────────────────────── */
.class-list { list-style: none; margin: 0; padding: 0; }
.class-list > li { margin: 0; padding: 0; }
.class-card { display: flex; flex-direction: column; gap: 10px; }
.class-card h2 { font-size: 1.25rem; }
.class-card h2 a { color: var(--text-primary); text-decoration: none; }
.class-card h2 a:hover { color: var(--gold-lt); text-decoration: underline; }
.class-card .meta { color: var(--text-secondary); font-size: 14px; }
.class-card .actions { justify-content: flex-end; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 200px; background: var(--bg-card-2); border: 1px solid var(--border-mid); border-radius: var(--r-md); box-shadow: var(--shadow-md); padding: 6px; }
.menu[hidden] { display: none; }
.menu button { display: block; width: 100%; text-align: left; padding: 10px 12px; min-height: 44px; border-radius: 6px; background: none; border: none; color: var(--text-primary); font: inherit; font-size: 14px; cursor: pointer; }
.menu button:hover { background: rgba(255,255,255,.06); }
.menu button.danger { color: var(--err-text); }
@media (max-width: 640px) { .class-card .actions { flex-direction: column; align-items: stretch; } .class-card .actions .btn, .class-card .actions .menu-wrap { width: 100%; } .class-card .actions .menu-wrap .btn { width: 100%; } }

/* ── Riga test assegnato ───────────────────────────────────────── */
.assign-row { padding: 14px 0; border-bottom: 1px solid var(--border); }
.assign-row:last-child { border-bottom: none; }
.assign-row h3 { font-family: var(--font-body); font-size: 16px; font-weight: 600; margin-bottom: 2px; }
.assign-row .meta { font-size: 14px; color: var(--text-secondary); margin-bottom: 10px; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.tag + .tag::before { content: ' · '; }

/* ── Catalogo (dialog Assegna) ─────────────────────────────────── */
.cat-filters { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; margin-bottom: 12px; }
@media (max-width: 640px) { .cat-filters { grid-template-columns: 1fr; } }
.cat-list { max-height: 40vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.cat-list .radio-row { align-items: center; border-bottom: 1px solid var(--border); border-radius: 0; }
.cat-list .radio-row:last-child { border-bottom: none; }
.cat-list .radio-row .t { flex: 1; }
.cat-list .radio-row .t .meta { display: block; font-size: 13px; color: var(--text-secondary); }
.cat-list .radio-row.assigned { cursor: default; }
.cat-list .radio-row.assigned input { opacity: .5; }
.cat-list .radio-row.assigned .t > span:first-child { color: var(--text-secondary); }
.cat-list .radio-row a { color: var(--gold-lt); font-size: 13px; text-decoration: underline; padding: 8px; min-height: 44px; display: inline-flex; align-items: center; }
details.opts { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
details.opts summary { cursor: pointer; font-weight: 600; color: var(--gold-lt); min-height: 44px; display: flex; align-items: center; }
.opts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .opts-grid { grid-template-columns: 1fr; } }
.opt-inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.opt-inline input[type=number] { width: 90px; }

/* ── Dettaglio risposte ────────────────────────────────────────── */
.ans-list { list-style: none; display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; }
.ans { background: var(--bg-card-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.ans-head { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.ans-head strong { color: var(--text-primary); font-size: 15px; }
.ans-q { font-size: 14px; color: var(--text-secondary); margin-bottom: 6px; }
.ans-given { font-size: 15px; color: var(--text-primary); white-space: pre-wrap; }
.grade-form { margin-top: 12px; display: grid; grid-template-columns: 120px 1fr; gap: 10px 12px; align-items: end; }
.grade-form .full { grid-column: 1 / -1; }
@media (max-width: 480px) { .grade-form { grid-template-columns: 1fr; } }

/* ── Runner (una domanda per schermata) ────────────────────────── */
.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: rgba(255,255,255,.08); }
.progress > span { display: block; height: 100%; background: var(--gold); width: 0; transition: width var(--t-base); }
.runner-title { font-family: var(--font-body); font-size: 15px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; text-align: center; margin: 0; line-height: 1.3; }
.timer { font-family: var(--font-mono); font-size: 16px; font-weight: 600; color: var(--text-primary); white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; min-width: 52px; justify-content: flex-end; }
.timer.last { color: var(--warn-text); }
.timer .lbl { font-family: var(--font-body); font-size: 12px; font-weight: 600; }
.section-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; }
.q { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 14px; }
.q h2 { font-family: var(--font-body); font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 8px; }
.q-type { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.q-text { font-size: 17px; color: var(--text-primary); margin-bottom: 14px; line-height: 1.5; }
.q-ctx { font-size: 15px; color: var(--text-700); background: #0a0f1a; border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; white-space: pre-wrap; line-height: 1.6; }
details.ctx { margin-bottom: 14px; }
details.ctx summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--gold-lt); font-weight: 600; font-size: 14px; }
details.ctx[open] summary .s-show { display: none; }
details.ctx:not([open]) summary .s-hide { display: none; }
.stmt { font-size: 15px; color: var(--text-primary); margin: 12px 0 6px; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; text-align: left; color: var(--text-primary); background: #0a0f1a; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; padding: 11px 14px; margin-bottom: 8px; cursor: pointer; font-size: 15px; font-family: inherit; line-height: 1.4; }
.opt .mark { width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); display: inline-flex; align-items: center; justify-content: center; }
.opt .mark svg { width: 14px; height: 14px; display: none; }
.opt.sel, .opt[aria-checked="true"] { border-color: var(--gold); background: rgba(201,168,76,.1); }
.opt[aria-checked="true"] .mark { border-color: var(--gold); background: var(--gold); color: #0a0a0a; }
.opt[aria-checked="true"] .mark svg { display: block; }
.opt-inline-group { display: flex; gap: 8px; flex-wrap: wrap; }
.opt-inline-group .opt { width: auto; min-width: 100px; margin: 0; }
.stmt-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.stmt-row:last-child { border-bottom: none; }
/* le righe con un campo crescono da sole (inline-block 44 px + margini); le altre restano a 1.9 */
.cloze { font-size: 16px; line-height: 1.9; color: var(--text-primary); }
.cloze p, .cloze div { line-height: 1.9; }
.cloze input, .cloze select { display: inline-block; width: auto; min-width: 90px; max-width: 100%; min-height: 44px; padding: 4px 10px; margin: 4px 3px; font-size: 16px; vertical-align: middle; }
.cloze select { padding-right: 32px; }
.match-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.match-row:last-child { border-bottom: none; }
.match-row .lft { font-size: 15px; color: var(--text-primary); }
@media (max-width: 480px) { .match-row { grid-template-columns: 1fr; gap: 6px; } }
.reo-list { display: flex; flex-direction: column; gap: 6px; }
.reo-item { display: flex; align-items: center; gap: 8px; background: #0a0f1a; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; padding: 8px 8px 8px 14px; font-size: 15px; }
.reo-item .txt { flex: 1; line-height: 1.45; }
.reo-item .btn { min-width: 44px; min-height: 44px; padding: 0 10px; }
textarea.open { width: 100%; min-height: 140px; }
.counter { font-size: 13px; color: var(--label); text-align: right; margin-top: 4px; }
.draft-status { font-size: 13px; color: var(--text-secondary); min-height: 20px; margin-top: 8px; }

.stepper { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1100; background: var(--bg-section); border-top: 1px solid var(--border); padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.stepper .btn { min-height: 48px; min-width: 110px; }
.stepper .count { font-size: 14px; font-weight: 600; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
@media (min-width: 721px) { .stepper { left: 50%; right: auto; transform: translateX(-50%); width: 100%; max-width: 720px; border-left: 1px solid var(--border); border-right: 1px solid var(--border); border-radius: 12px 12px 0 0; } }

/* ── Card test studente ────────────────────────────────────────── */
.group-title { font-family: var(--font-body); font-size: 15px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--gold); margin: 24px 0 10px; }
.tcard h3 { font-family: var(--font-body); font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.tcard .meta { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }
.tcard .meta time { color: var(--text-primary); }
.tcard .actions { margin-top: 12px; }
.score-big { font-family: var(--font-mono); font-size: 56px; font-weight: 700; color: var(--gold); line-height: 1; margin: 12px 0 8px; font-variant-numeric: tabular-nums; }
.outcome-list { list-style: none; padding: 0; margin: 16px 0; display: flex; flex-direction: column; gap: 8px; }
.outcome-list li { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; padding: 10px 12px; background: var(--bg-card-2); border-radius: 8px; font-size: 14px; }
.outcome-list li .n { font-weight: 700; min-width: 24px; }
.solution { margin-top: 6px; font-size: 14px; color: var(--text-secondary); width: 100%; }
.solution summary { cursor: pointer; color: var(--gold-lt); min-height: 44px; display: flex; align-items: center; }
.comment { border-left: 3px solid var(--gold); padding: 8px 12px; margin: 12px 0; color: var(--text-primary); font-size: 15px; font-style: italic; }

/* ── Segmenti (schede Iscriviti / Ho già un accesso) ───────────── */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--bg-card-2); padding: 4px; border-radius: 10px; margin: 20px 0; }
.seg button { min-height: 44px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--text-secondary); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; padding: 8px; }
.seg button[aria-selected="true"] { background: var(--bg-card); color: var(--gold); border-color: var(--gold-border); }
