/* host.css — stili specifici della vista docente (proiettata). */

.host-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap;
  padding: 9px clamp(12px, 2vw, 22px);
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(12px);
}
.host-header .brand .name { font-size: 1.05rem; }
.host-header .brand .logo { width: 30px; height: 30px; border-radius: 6px; }
.host-header .brand .logo svg { width: 18px; height: 18px; }
.hnav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hnav .brand { margin-right: 8px; }
.session-actions { display: inline-flex; align-items: center; gap: 8px; }
.host-header .hnav > .session-actions:not(:has(> :not([hidden]))) { display: none; }
.hgame { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; width: 100%; }
.hgame:not(:has(.hinfo > :not([hidden]), .hplay > :not([hidden]), .quiz-elapsed:not([hidden]))) { display: none; }
.hgame:has(.hinfo > :not([hidden]), .hplay > :not([hidden]), .quiz-elapsed:not([hidden])) { border-top: 1px solid var(--border); padding-top: 8px; }
.hplay { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: 1 1 0; min-width: 0; flex-wrap: wrap; }
.system-clock, .quiz-elapsed { font-variant-numeric: tabular-nums; white-space: nowrap; }
.system-clock { font-family: inherit; font-size: .95rem; font-weight: 600; }
.quiz-elapsed { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; flex: 0 0 auto; }
.quiz-elapsed b { font-size: 1.1rem; }
@media (max-width: 900px) {
  .hgame .hinfo, .hgame .hplay { flex: 1 1 100%; justify-content: center; }
  .quiz-elapsed { margin-inline: auto; }
}

/* Informazioni e comandi della domanda, nella seconda riga durante la partita. */
.hinfo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1 1 0; min-width: 0; }
.pill.mono { font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace; letter-spacing: 0.06em; }
.pill.counter b { color: var(--text); font-size: 1rem; }
.pill.counter .slash { color: var(--muted); margin: 0 1px; }
.htimer {
  display: inline-flex; align-items: baseline; gap: 1px;
  font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.15rem;
  padding: 3px 10px; border: 1px solid var(--border-strong);
  min-width: 46px; justify-content: center;
}
.htimer.warn { color: var(--bad); border-color: var(--bad); }
#automaticCountdown.warn { color: var(--bad); border-color: var(--bad); }
.htimer b { font-size: 1.15rem; }
#pauseTimeBtn {
  flex: 0 0 38px; width: 38px; min-width: 38px; max-width: 38px;
  height: 38px; min-height: 38px; max-height: 38px; padding: 0;
}
#pauseTimeBtn svg { display: block; width: 22px; height: 22px; flex: none; }
#pauseTimeBtn .play-symbol, #pauseTimeBtn[aria-pressed="true"] .pause-symbol { display: none; }
#pauseTimeBtn[aria-pressed="true"] .play-symbol { display: inline; }

/* Gruppo comandi (a destra). */
.hctrl { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.hctrl .btn.icon { padding: 8px 10px; font-size: 1rem; line-height: 1; }
.hctrl #settingsBtn { width: 38px; min-width: 38px; flex: none; padding: 0; }
.hctrl #settingsBtn svg { display: block; flex: none; width: 22px; height: 22px; pointer-events: none; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, transparent); }
.btn.danger:hover { color: var(--bad); border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
#hostUser { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbAdvance-pulse { }

/* Barra timer sottile sul bordo inferiore dell'header. */
.htimerbar { position: absolute; left: 0; right: 0; bottom: -10px; height: 22px; padding: 9px 0 10px; background: transparent; cursor: ew-resize; }
.htimerbar span { display: block; height: 3px; width: 100%; transform-origin: left; background: var(--brand-grad); transition: transform 0.2s linear; pointer-events: none; }
.htimerbar:hover span, .htimerbar:focus-visible span { height: 5px; }
.htimerbar:focus-visible { outline: 2px solid var(--brand-1); outline-offset: 1px; }
.htimerbar.warn span { background: var(--warning-fill); }

/* Tutti gli elementi dell'header (PIN, avanzamento, conteggio, timer, nome
   docente e tasti) alla stessa altezza, verticalmente centrati. */
.host-header .hinfo > *, .host-header .hctrl > :not(.theme-toggle), .host-header .hnav > :not(.brand), .host-header .session-actions > .btn, .host-header .hplay > * {
  height: 38px; min-height: 0;
  display: inline-flex; align-items: center; justify-content: center;
}

.host-main { flex: 1; display: flex; flex-direction: column; }
/* Pannello non modale sotto il bordo destro dell'header: nessun oscuramento
   della lavagna, nessun blocco dei comandi e nessuno spostamento del quiz. */
.join-requests-panel {
  position: absolute; top: calc(100% + 8px); right: 12px; z-index: 20;
  width: min(340px, calc(100vw - 24px)); padding: 12px;
  max-height: min(420px, 55dvh); overflow-y: auto; overscroll-behavior: contain;
  color: var(--text); background: var(--join-panel-bg);
  border: 1px solid var(--border-strong); border-top: 3px solid var(--brand-1);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
}
.join-requests-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: grab; touch-action: none; user-select: none; }
.join-requests-header.dragging { cursor: grabbing; }
.join-requests-header:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.join-requests-header h2 { font-size: 1rem; margin: 0; }
.join-requests-header .btn { padding: 5px 9px; }
.join-request-card { padding: 12px 0; border-bottom: 1px solid var(--border); }
.join-request-card:last-child { border-bottom: 0; padding-bottom: 0; }
.join-request-card h3 { font-size: 0.95rem; overflow-wrap: anywhere; }
.join-request-card p { margin: 8px 0 14px; font-size: 0.82rem; line-height: 1.5; }
/* Colori condivisi con gli altri menu nativi in styles.css. */
.join-request-card select { width: 100%; font-size: 0.82rem; padding: 10px; }
.join-recovery-toggle {
  display: block; margin-top: 6px; padding: 7px 0; border: 0;
  background: transparent; color: var(--muted); font-size: 0.78rem;
  text-align: left; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.join-recovery-toggle:hover { color: var(--text); }
.join-recovery-toggle:focus-visible { outline: 2px solid var(--brand-1); outline-offset: 3px; }
.join-request-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.join-request-actions .btn { padding: 7px 10px; font-size: 0.82rem; }

/* ---- Setup ---- */
.setup-card { width: min(640px, 100%); padding: clamp(24px, 4vw, 44px); }
[data-screen="setup"] .setup-card { width: min(736px, 100%); }
.setup-card h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: 6px; }
.quiz-list {
  display: flex; flex-direction: column; gap: 10px; margin: 20px 0;
  max-height: 46vh; overflow-y: auto; padding: 2px;
  scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent;
}
.quiz-list::-webkit-scrollbar { width: 8px; }
.quiz-list::-webkit-scrollbar-track { background: transparent; }
.quiz-list::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 8px; }
.quiz-list::-webkit-scrollbar-thumb:hover { background: var(--scroll-hover); }
.quiz-opt {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 18px 15px 20px; border-radius: var(--radius-sm);
  background: var(--list-bg); border: 1px solid var(--border);
  cursor: pointer; transition: border 0.2s, background 0.2s, transform 0.1s;
}
/* Barra accento a sinistra: invisibile finché non selezionato. */
.quiz-opt::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--brand-grad); opacity: 0; transition: opacity 0.2s;
}
.quiz-opt:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.quiz-opt.selected {
  border-color: var(--brand-1);
  background: var(--selection-bg);
  /* Anello INTERNO: non viene ritagliato dall'overflow della lista (era il caso
     del primo box in cima). */
  box-shadow: inset 0 0 0 2px var(--brand-1);
}
.quiz-opt.selected::before { opacity: 1; }
.quiz-opt.selected .t { color: var(--text); }
.quiz-opt.selected .s { color: color-mix(in srgb, var(--text) 78%, transparent); }
.quiz-opt.invalid { opacity: 0.55; cursor: not-allowed; }
.quiz-opt .t { font-weight: 700; font-size: 1.05rem; }
.quiz-opt .s { color: var(--muted); font-size: 0.9rem; }
.quiz-actions { display: flex; align-items: center; gap: 6px; }
.quiz-select { flex: 1; min-width: 0; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.quiz-select:disabled { cursor: not-allowed; }
.quiz-select:focus-visible, .quiz-act:focus-visible { outline: 2px solid var(--brand-1); outline-offset: 4px; }
.quiz-select .t, .quiz-select .s { overflow-wrap: anywhere; }
.quiz-actions { flex: none; }
.quiz-act svg { width: 19px; height: 19px; }
.quiz-act:disabled { opacity: 0.4; cursor: not-allowed; }
.quiz-preview { width: min(760px, calc(100vw - 32px)); }
.quiz-preview .modal-header { flex-wrap: wrap; }
.quiz-preview .modal-header h2 { min-width: 0; overflow-wrap: anywhere; }
.preview-controls { display: flex; flex: none; gap: 4px; margin-left: auto; }
.preview-summary { color: var(--muted); font-size: 0.9rem; margin-bottom: 12px; }
.preview-list { margin: 0; padding-left: 28px; }
.preview-list > li { padding: 4px 0 4px 6px; border-bottom: 1px solid var(--border); }
.preview-list > li::marker { color: var(--preview-marker); font-weight: 700; }
.preview-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; padding: 10px 8px; border: 0; background: transparent; color: var(--text);
  text-align: left; cursor: pointer; border-radius: var(--radius-sm);
}
@media (pointer: coarse) {
  .host-header .hctrl #settingsBtn { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
}
.host-header #hostUser { display: block; line-height: 24px; }
@media (max-width: 600px) {
  .hctrl { gap: 6px; }
  #hostUser { max-width: 110px; }
  .hnav .brand .name { display: none; }
  .hnav .brand { margin-right: 0; }
  .hnav .btn { padding-inline: 10px; }
}
.preview-toggle > span:first-child { min-width: 0; }
.preview-toggle:hover, .preview-toggle[aria-expanded="true"] { background: var(--selection-bg); }
.preview-toggle:focus-visible { outline: 2px solid var(--brand-1); outline-offset: 2px; }
.preview-chevron { flex: none; color: var(--preview-marker); font-size: 1.2rem; }
.preview-toggle[aria-expanded="true"] .preview-chevron { transform: rotate(180deg); }
.preview-question { font-size: 0.95rem; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.preview-meta { display: block; color: var(--muted); font-size: 0.78rem; margin-top: 4px; }
.preview-answers { margin: 4px 0 10px 8px; padding: 8px 14px 14px; background: var(--list-bg); border-left: 3px solid var(--preview-marker); }
.preview-answers-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 0.8rem; }
.preview-options { margin: 4px 0 0; padding-left: 26px; }
.preview-options > li { padding: 8px 0 8px 6px; font-size: 0.9rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.preview-options > li + li { border-top: 1px solid var(--border); }
.preview-options > li::marker { color: var(--preview-marker); font-weight: 700; }
.preview-option { display: flex; align-items: flex-start; gap: 12px; }
.preview-option-text { flex: 1; min-width: 0; }
.preview-correct { flex: none; color: var(--good); font-weight: 800; font-size: 1.1rem; line-height: 1.2; }
.quiz-act {
  width: 28px; height: 28px; display: grid; place-items: center;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  cursor: pointer; text-decoration: none; font-size: 0.9rem; border-radius: var(--radius-sm);
}
.quiz-act:hover { color: var(--text); border-color: var(--border-strong); }

/* ---- Login docente ---- */
#authSub { margin-bottom: 20px; }
.auth-error { color: var(--bad); text-align: center; margin-top: 10px; min-height: 1.2em; font-weight: 600; }
#authToggle { color: var(--brand-1); font-weight: 600; }
.auth-or { text-align: center; color: var(--muted); font-size: 0.85rem; margin: 14px 0; position: relative; }
.auth-or::before, .auth-or::after { content: ""; position: absolute; top: 50%; width: 38%; height: 1px; background: var(--border); }
.auth-or::before { left: 0; } .auth-or::after { right: 0; }

/* ---- Pannello impostazioni ---- */
#settingsOverlay { scroll-padding-block: 16px 120px; }
.settings-footer {
  position: sticky; bottom: 0; z-index: 1; margin-top: 24px; padding: 12px;
  background: var(--modal-bg); border: 1px solid var(--border-strong);
}
.settings-footer #settingsMsg { font-size: .9rem; line-height: 1.4; overflow-wrap: anywhere; }
.settings-footer .modal-actions { margin-top: 10px; }
.set-body { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.set-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; cursor: pointer; }
.set-row input { width: 18px; height: 18px; accent-color: var(--brand-1); flex: none; }
.set-row span { line-height: 1.3; }
.users-box { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; max-height: 34vh; overflow-y: auto; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--border); }
.user-row .ui { flex: 1; min-width: 0; }
.user-row .ue { color: var(--muted); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row .roles { display: flex; gap: 6px; }
.role-btn { font-size: 0.8rem; padding: 4px 9px; border: 1px solid var(--border-strong); background: transparent; color: var(--muted); cursor: pointer; }
.role-btn.active { color: var(--on-brand); background: var(--brand-1); border-color: var(--brand-1); }
.role-badge { font-size: 0.75rem; color: var(--accent-2); font-weight: 700; }

/* ---- Storico e report (tabelle compatte) ---- */
.reports-card, .report-card { width: min(1040px, 100%); margin: 0 auto; padding: clamp(16px, 2.2vw, 26px); background: var(--report-bg); }
.reports-list { margin-top: 12px; }
.report-card h1 { font-size: 1.4rem; }
.rsub { font-size: 0.75rem; color: var(--muted); margin: 22px 0 8px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.rtable { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.rtable th {
  text-align: left; font-weight: 700; color: var(--muted); font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.05em; padding: 6px 8px; white-space: nowrap;
  border-bottom: 1px solid var(--border-strong);
  position: sticky; top: 0; background: var(--report-head-bg); z-index: 1;
}
.rtable td { padding: 5px 8px; border-bottom: 1px solid var(--border); }
.rtable tbody tr { cursor: default; }
.rtable tbody tr.clickable { cursor: pointer; }
.rtable tbody tr.clickable:hover td { background: var(--report-hover-bg); }
.rtable .num { text-align: right; }
.rtable .report-actions { width: 1%; text-align: right; white-space: nowrap; }
.btn.report-delete { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; color: var(--bad); }
.btn.report-delete svg { flex: none; pointer-events: none; }
.btn.report-delete:hover { border-color: var(--bad); }
@media (pointer: coarse) { .btn.report-delete { width: 44px; height: 44px; } }
.rtable .qtext { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rtable .acorr { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--good); font-weight: 600; }
.rtable .who { font-weight: 600; white-space: nowrap; }

/* Distribuzione risposte per opzione (mini barre). L'opzione corretta è marcata
   da una sottolineatura verde (non da un riquadro). */
.dist { display: inline-flex; align-items: flex-end; gap: 3px; height: 20px; }
.dist .seg { position: relative; width: 11px; min-height: 2px; box-shadow: inset 0 0 0 1px var(--chart-outline); }
.dist .seg.correct::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px; background: var(--good);
}
.rtable td.center, .rtable th.center { text-align: center; }

/* Percentuale corrette con barra */
.pct { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.pct .bar { width: 60px; height: 6px; background: var(--report-track-bg); position: relative; }
.pct .bar > i { position: absolute; inset: 0 auto 0 0; background: var(--chart-good); }
.pct.low .bar > i { background: var(--chart-bad); }
.pct.mid .bar > i { background: var(--chart-warning); }

/* Matrice esiti per domanda: priorità alle risposte (celle compatte a larghezza
   fissa); le colonne identità restano "congelate" a sinistra durante lo scroll. */
.rtable td.mx, .rtable th.mx { width: 22px; min-width: 22px; text-align: center; padding: 5px 2px; font-weight: 800; }
.mx.ok { color: var(--good); } .mx.no { color: var(--bad); } .mx.na { color: var(--faint); }

.rtable.students th:first-child, .rtable.students td:first-child {
  position: sticky; left: 0; width: 44px; min-width: 44px; z-index: 2; background: var(--report-bg);
}
.rtable.students th:nth-child(2), .rtable.students td:nth-child(2) {
  position: sticky; left: 44px; z-index: 2; background: var(--report-bg);
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rtable.students thead th:first-child, .rtable.students thead th:nth-child(2) { z-index: 4; background: var(--report-head-bg); }

/* Overlay dettaglio domanda (risposte incolonnate, colore+forma, corrette in verde) */
#qOverlay { background: var(--report-bg); }
.qo-qtext { color: var(--text); font-weight: 600; margin: 8px 0 14px; line-height: 1.35; white-space: pre-wrap; }
.qo-options { display: flex; flex-direction: column; gap: 8px; }
.qo-opt {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 16px; border: 1px solid var(--border); overflow: hidden;
}
.qo-opt .qo-bar { position: absolute; inset: auto auto 0 0; height: 6px; background: var(--distribution-color); box-shadow: inset 0 0 0 1px var(--chart-outline); }
.qo-opt > *:not(.qo-bar) { position: relative; z-index: 1; }
.qo-glyph { --on-answer: var(--chart-ink); width: 26px; height: 26px; flex: none; display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--chart-outline); }
.qo-glyph svg { width: 16px; height: 16px; }
.qo-label { flex: 1; min-width: 0; overflow-wrap: anywhere; line-height: 1.3; }
.qo-opt .cnt { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; white-space: nowrap; }
.qo-opt.correct { border-color: var(--good); background: var(--report-correct-bg); }
.qo-opt.correct .cnt { color: var(--good); }
.qo-check { color: var(--good); font-weight: 900; margin-left: 6px; }

/* ---- Lobby ---- */
.lobby { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(20px, 3vw, 40px); align-items: start; }
.join-panel { padding: clamp(16px, 2vw, 28px); text-align: center; min-width: 0; }
.pin-display { font-size: clamp(2.6rem, 5.2vw, 4.5rem); font-weight: 900; letter-spacing: 0.05em; line-height: 1.05;
  white-space: nowrap; max-width: 100%; overflow: hidden;
  font-variant-numeric: tabular-nums; background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pin-label { color: var(--muted); text-transform: uppercase; letter-spacing: 0.2em; font-size: 0.8rem; font-weight: 700; }
.qr { margin: 18px auto 8px; width: min(100%, 680px, max(240px, calc(100dvh - 300px))); background: var(--qr-paper); }
.qr img { width: 100%; height: auto; display: block; }
.join-url { word-break: break-all; color: var(--muted); font-size: 0.95rem; }
.players-panel { padding: clamp(18px, 2.4vw, 26px); min-height: 280px; min-width: 0; }
.players-panel h2 { font-size: 1.2rem; margin-bottom: 4px; }
.player-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.player-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border: 1px solid var(--border); font-weight: 600; font-size: 0.95rem;
  background: var(--surface-strong);
  animation: pop 0.4s cubic-bezier(0.2,0.9,0.3,1.3) both;
}
.chip-x {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 0.85rem; line-height: 1; padding: 0 2px;
}
.chip-x:hover { color: var(--bad); }
.player-chip.off { opacity: 0.45; }
.empty-hint { color: var(--muted); margin-top: 24px; text-align: center; font-size: 1.05rem; }
/* Tasti della lobby (Ingressi / Avvia) alla stessa altezza. */
#lockBtn, #startBtn { height: 46px; min-height: 0; display: inline-flex; align-items: center; justify-content: center; }

/* ---- Question / reveal ---- */
.q-stage { flex: 1; display: flex; flex-direction: column; gap: clamp(12px, 1.8vw, 22px);
  padding: clamp(14px, 2.4vw, 30px) clamp(16px, 3vw, 44px); position: relative; }
.q-stage[data-screen="question"] {
  display: grid; grid-template-rows: auto minmax(min-content, 1fr) auto;
}
.q-tags { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.q-heading { display: flex; align-items: flex-start; gap: 16px; min-width: 0; }
.q-heading .q-tags { flex: 1; min-width: 0; }
/* Pannello sovrapposto: comparsa e scomparsa non alterano la griglia. */
.early-reveal-overlay {
  position: absolute; z-index: 2; width: 220px; max-width: calc(100% - 32px);
  top: calc(clamp(14px, 2.4vw, 30px) + 42px); right: clamp(16px, 3vw, 44px);
  pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 12px 16px; text-align: center; color: var(--text); background: var(--bg);
  border: 2px solid var(--brand-1); box-shadow: var(--shadow-sm);
  animation: earlyRevealPulse 1.4s ease-in-out infinite;
}
.early-reveal-label { font-size: .88rem; font-weight: 700; }
.early-reveal-number { font-size: clamp(3rem, 5vw, 4.5rem); line-height: 1; font-variant-numeric: tabular-nums; }
.early-reveal-status { font-size: .78rem; color: var(--muted); }
.early-reveal-overlay.warn { border-color: var(--bad); }
.early-reveal-overlay.warn .early-reveal-number { color: var(--bad); }
.early-reveal-overlay.paused { animation: none; }
@keyframes earlyRevealPulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand-1) 22%, transparent); } }
@media (prefers-reduced-motion: reduce) { .early-reveal-overlay { animation: none; } }
@media (max-width: 600px) {
  .q-heading { flex-wrap: wrap; }
  .q-heading .q-tags { flex-basis: 100%; }
  .early-reveal-overlay { width: 180px; }
}
.review-badge {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--brand-1); border: 1px solid color-mix(in srgb, var(--brand-1) 45%, transparent);
  padding: 3px 10px; background: color-mix(in srgb, var(--brand-1) 12%, transparent);
}
/* Indicatore del tipo di domanda; enfatizzato per la scelta multipla. */
.q-kind {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.82rem; font-weight: 700; letter-spacing: 0.02em;
  padding: 4px 12px; border: 1px solid var(--border-strong); color: var(--muted);
}
.q-kind .box { width: 13px; height: 13px; border: 2px solid currentColor; flex: none; }
.q-kind.multi {
  color: var(--text);
  border-color: var(--brand-1);
  background: color-mix(in srgb, var(--brand-1) 16%, transparent);
  font-size: 0.92rem;
}
.q-kind.multi .box { position: relative; }
.q-kind.multi .box::after { content: "✓"; position: absolute; inset: -4px 0 0 1px; font-size: 12px; font-weight: 900; }
.q-text {
  font-size: clamp(1.3rem, 2.6vw, 2.1rem); font-weight: 700; line-height: 1.25; letter-spacing: -0.01em;
  /* Usa tutta la riga e centra il testo nello spazio sopra le risposte. */
  display: grid; align-content: center;
  width: 100%; min-width: 0; margin: 0;
  text-align: center; white-space: pre-wrap; text-wrap: wrap; overflow-wrap: anywhere;
}
/* Le tessere restano in basso e crescono solo quando serve al loro contenuto.
   Lo spazio libero sopra di esse viene assegnato alla domanda. */
.answers.host { align-content: start; width: 100%; }
.answers.host .answer {
  cursor: default; pointer-events: none;
  min-height: clamp(64px, 9vw, 200px);
  font-size: clamp(1.1rem, 1.7vw, 1.7rem);
}
.q-hint { text-align: center; color: var(--muted); font-size: 0.92rem; }

/* ---- Leaderboard ---- */
.board-stage { justify-content: flex-start; }
.board-title { text-align: center; font-size: clamp(1.3rem, 2.6vw, 1.9rem); font-weight: 800; margin: 4px 0 6px; }
.board { width: min(820px, 100%); margin: 0 auto; display: flex; flex-direction: column; gap: 7px; }
.lb-row {
  display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px;
  padding: 9px 14px; border: 1px solid var(--border);
  background: var(--surface); position: relative; overflow: hidden;
  animation: rise 0.4s cubic-bezier(0.2,0.8,0.2,1) both;
}
.lb-row .bar { position: absolute; inset: 0; background: var(--leader-fill); transform-origin: left; transform: scaleX(0); transition: transform 0.8s cubic-bezier(0.2,0.8,0.2,1); z-index: 0; }
.lb-row > * { position: relative; z-index: 1; }
.lb-row .rank { font-size: 1.15rem; font-weight: 800; text-align: center; color: var(--muted); }
.lb-row .who { font-weight: 600; font-size: 1.05rem; }
.lb-row .pts { font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.lb-row.top1 .rank { color: var(--rank-gold); } .lb-row.top2 .rank { color: var(--rank-silver); } .lb-row.top3 .rank { color: var(--rank-bronze); }

/* ---- Podio finale ---- */
.podium-wrap { width: min(900px, 100%); margin: 0 auto; padding: clamp(16px, 3vw, 32px); text-align: center; }
.podium-wrap h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin-bottom: 6px; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: clamp(10px, 2vw, 24px); margin: 40px 0 24px; min-height: 260px; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 12px; width: clamp(90px, 22vw, 200px); }
.pod .avatar { width: clamp(56px, 8vw, 84px); height: clamp(56px, 8vw, 84px); border-radius: 50%; display: grid; place-items: center;
  font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 900; background: var(--brand-grad); color: var(--on-brand); box-shadow: var(--shadow-sm); }
.pod .who { font-weight: 800; font-size: clamp(1rem, 2vw, 1.3rem); }
.pod .pts { color: var(--muted); font-variant-numeric: tabular-nums; }
.pod .stand { width: 100%; display: grid; place-items: start center; padding-top: 14px;
  font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 900; color: var(--podium-text);
  text-shadow: var(--podium-text-shadow);
  animation: standRise 0.7s cubic-bezier(0.2,0.9,0.3,1.2) both; }
@keyframes standRise { from { transform: scaleY(0.2); opacity: 0; } to { transform: scaleY(1); opacity: 1; } }
.pod.p1 .stand { height: 180px; background: var(--podium-gold); }
.pod.p2 .stand { height: 130px; background: var(--podium-silver); }
.pod.p3 .stand { height: 100px; background: var(--podium-bronze); }
.pod.p1 { order: 2; } .pod.p2 { order: 1; } .pod.p3 { order: 3; }
.saved-note { color: var(--muted); font-size: 0.9rem; margin-top: 8px; }
.saved-note code { background: var(--code-bg); padding: 2px 6px; }

@media (max-width: 820px) {
  .lobby { grid-template-columns: 1fr; }
}
