/* =====================================================================
   Serata Quiz — La Botte 17
   Design system ricavato dal sito: rosso #e84242, crema #f5e7c1, nero #121212,
   font Rakkas (titoli) + Inter (testo), bottoni a pillola, card arrotondate.
   ===================================================================== */
:root {
  --rosso: #e84242;
  --rosso-scuro: #c93434;
  --rosso-chiaro: #f07a7a;
  --crema: #f5e7c1;
  --crema-scura: #e8d7a8;
  --crema-chiara: #faf3df;
  --nero: #121212;
  --nero-2: #1c1c1c;
  --nero-3: #2a2a2a;
  --grigio: #6f6f6f;
  --grigio-chiaro: #d8d2c4;
  --bianco: #ffffff;
  --verde: #2fa36b;
  --verde-scuro: #23834f;
  --oro: #e8b931;
  --ocra: #c98a2e;
  --argento: #b8b8b8;
  --bronzo: #c47b43;

  --font-display: 'Rakkas', 'Georgia', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --r-card: 24px;
  --r-pill: 999px;
  --r-input: 16px;
  --shadow: 0 10px 28px rgba(18, 18, 18, 0.18);
  --shadow-sm: 0 4px 12px rgba(18, 18, 18, 0.12);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.4;
  color: var(--nero);
  background: var(--crema);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior-y: contain;
}
body.theme-dark { background: var(--nero); color: var(--crema); }
body.theme-red { background: var(--rosso); color: var(--crema); }
body.player, body.player * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
body.player input, body.player textarea {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

h1, h2, h3, .display { font-family: var(--font-display); font-weight: 400; margin: 0; line-height: 1; letter-spacing: 0.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
img { max-width: 100%; display: block; }
a { color: inherit; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + var(--sat)) 16px 10px;
  background: var(--bianco);
  box-shadow: 0 2px 10px rgba(18,18,18,0.08);
}
.topbar .logo { height: 34px; width: auto; }
.topbar .right { display: flex; align-items: center; gap: 8px; }
.theme-dark .topbar { background: var(--nero-2); box-shadow: 0 2px 10px rgba(0,0,0,0.5); }
.theme-dark .topbar .logo { filter: none; }

.page { padding: 16px 16px calc(24px + var(--sab)); max-width: 640px; margin: 0 auto; }
.page.with-tabs { padding-bottom: calc(96px + var(--sab)); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.mt { margin-top: 12px; }
.mt-lg { margin-top: 24px; }
.mb { margin-bottom: 12px; }

/* ---------- Testi ---------- */
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--grigio); }
.theme-dark .eyebrow, .theme-red .eyebrow { color: rgba(245,231,193,0.7); }
.title-xl { font-size: clamp(44px, 12vw, 72px); }
.title-lg { font-size: clamp(34px, 9vw, 52px); }
.title-md { font-size: clamp(26px, 7vw, 36px); }
.title-sm { font-size: 22px; }
.text-lg { font-size: 19px; font-weight: 600; line-height: 1.3; }
.text-md { font-size: 16px; }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.muted { color: var(--grigio); }
.theme-dark .muted, .theme-red .muted { color: rgba(245,231,193,0.65); }
.bold { font-weight: 700; }
.extrabold { font-weight: 800; }
.red { color: var(--rosso); }
.green { color: var(--verde); }
.cream { color: var(--crema); }
.gold { color: var(--oro); }
.tabular { font-variant-numeric: tabular-nums; }
.question-text { font-size: clamp(20px, 5.6vw, 26px); font-weight: 800; line-height: 1.25; letter-spacing: -0.01em; }

/* ---------- Card ---------- */
.card {
  background: var(--bianco);
  color: var(--nero);
  border-radius: var(--r-card);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card.dark { background: var(--nero); color: var(--crema); }
.card.red { background: var(--rosso); color: var(--crema); }
.card.cream { background: var(--crema); color: var(--nero); }
.card.flat { box-shadow: none; }
.card.tight { padding: 14px 16px; }
.theme-dark .card { background: var(--nero-2); color: var(--crema); box-shadow: none; border: 1px solid rgba(245,231,193,0.08); }
.theme-dark .card.red { background: var(--rosso); }
.theme-dark .card.cream { background: var(--crema); color: var(--nero); }
.theme-dark .card.light { background: var(--bianco); color: var(--nero); }

/* ---------- Bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 24px;
  border-radius: var(--r-pill);
  font-weight: 700; font-size: 16px; letter-spacing: 0.03em; text-transform: uppercase;
  background: var(--rosso); color: var(--crema);
  border: 2px solid var(--rosso);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
  user-select: none; -webkit-user-select: none;
  text-decoration: none;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn.block { width: 100%; }
.btn.lg { min-height: 64px; font-size: 18px; }
.btn.sm { min-height: 40px; padding: 8px 16px; font-size: 13px; }
.btn.xs { min-height: 34px; padding: 6px 12px; font-size: 12px; box-shadow: none; }
.btn.cream { background: var(--crema); color: var(--rosso); border-color: var(--crema); }
.btn.dark { background: var(--nero); color: var(--crema); border-color: var(--nero); }
.btn.white { background: var(--bianco); color: var(--nero); border-color: var(--bianco); }
.btn.green { background: var(--verde); color: #fff; border-color: var(--verde); }
.btn.outline { background: transparent; color: var(--rosso); border-color: var(--rosso); box-shadow: none; }
.btn.outline-cream { background: transparent; color: var(--crema); border-color: var(--crema); box-shadow: none; }
.btn.outline-dark { background: transparent; color: var(--nero); border-color: var(--nero); box-shadow: none; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: inherit; text-transform: none; letter-spacing: 0; font-weight: 600; }
.theme-dark .btn.ghost { color: var(--crema); }
.theme-dark .btn.outline-dark { color: var(--crema); border-color: rgba(245,231,193,0.5); }
.btn.icon { width: 44px; min-height: 44px; padding: 0; border-radius: 50%; font-size: 20px; }
.btn.round { border-radius: 50%; width: 56px; height: 56px; min-height: 56px; padding: 0; font-size: 24px; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-grid.three { grid-template-columns: 1fr 1fr 1fr; }

/* ---------- Chip / pill ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--crema); color: var(--nero);
  white-space: nowrap;
}
.chip.red { background: var(--rosso); color: var(--crema); }
.chip.dark { background: var(--nero); color: var(--crema); }
.chip.green { background: var(--verde); color: #fff; }
.chip.white { background: var(--bianco); color: var(--nero); }
.chip.outline { background: transparent; border: 1.5px solid currentColor; }
.chip.gold { background: var(--oro); color: var(--nero); }
.chip.gray { background: #e9e5db; color: var(--grigio); }
.theme-dark .chip.gray { background: var(--nero-3); color: var(--grigio-chiaro); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Input ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--grigio); }
.theme-dark .field label { color: rgba(245,231,193,0.7); }
.input, .select, .textarea {
  width: 100%; min-height: 52px; padding: 12px 16px;
  border-radius: var(--r-input);
  border: 2px solid var(--grigio-chiaro);
  background: var(--bianco); color: var(--nero);
  font-size: 17px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none; appearance: none;
}
.textarea { min-height: 88px; resize: vertical; line-height: 1.35; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--rosso); box-shadow: 0 0 0 4px rgba(232,66,66,0.15); }
.theme-dark .input, .theme-dark .select, .theme-dark .textarea { background: var(--nero-3); color: var(--crema); border-color: rgba(245,231,193,0.15); }
.input.big { min-height: 64px; font-size: 22px; font-weight: 700; text-align: center; }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236f6f6f' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.stepper { display: flex; align-items: center; gap: 0; border: 2px solid var(--grigio-chiaro); border-radius: var(--r-input); background: var(--bianco); overflow: hidden; }
.theme-dark .stepper { background: var(--nero-3); border-color: rgba(245,231,193,0.15); }
.stepper button { width: 56px; min-height: 52px; font-size: 26px; font-weight: 700; color: var(--rosso); }
.stepper .val { flex: 1; text-align: center; font-size: 22px; font-weight: 800; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid rgba(18,18,18,0.08); }
.theme-dark .switch { border-color: rgba(245,231,193,0.08); }
.switch:last-child { border-bottom: 0; }
.switch .lbl { font-weight: 600; }
.switch .sub { font-size: 13px; color: var(--grigio); margin-top: 2px; }
.theme-dark .switch .sub { color: rgba(245,231,193,0.6); }
.toggle { position: relative; width: 52px; height: 32px; border-radius: 999px; background: #cfcabd; transition: background 0.2s; flex: none; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.25); transition: transform 0.2s var(--ease); }
.toggle.on { background: var(--verde); }
.toggle.on::after { transform: translateX(20px); }
.theme-dark .toggle { background: var(--nero-3); }
.theme-dark .toggle.on { background: var(--verde); }
.segmented { display: flex; gap: 4px; padding: 4px; background: #e9e5db; border-radius: var(--r-pill); }
.theme-dark .segmented { background: var(--nero-3); }
.segmented button { flex: 1; min-height: 40px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--grigio); padding: 0 6px; }
.theme-dark .segmented button { color: rgba(245,231,193,0.6); }
.segmented button.on { background: var(--rosso); color: var(--crema); box-shadow: var(--shadow-sm); }

/* ---------- Opzioni di risposta ---------- */
.options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 64px; padding: 12px 14px;
  border-radius: 18px;
  background: var(--bianco); color: var(--nero);
  border: 2.5px solid transparent;
  box-shadow: var(--shadow-sm);
  text-align: left; font-size: 17px; font-weight: 600; line-height: 1.25;
  transition: transform 0.15s var(--ease), background 0.15s, border-color 0.15s, color 0.15s;
}
.opt:active:not(:disabled) { transform: scale(0.98); }
.opt .letter {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--crema); color: var(--rosso);
  font-family: var(--font-display); font-size: 22px; line-height: 1; padding-top: 3px;
}
.opt.selected { background: var(--rosso); color: var(--crema); border-color: var(--rosso); }
.opt.selected .letter { background: var(--crema); color: var(--rosso); }
.opt.correct { background: var(--verde); color: #fff; border-color: var(--verde); }
.opt.correct .letter { background: #fff; color: var(--verde); }
.opt.wrong { background: var(--bianco); color: var(--nero); border-color: var(--rosso); opacity: 0.9; }
.opt.wrong .letter { background: var(--rosso); color: var(--crema); }
.opt.dim { opacity: 0.55; }
.opt:disabled { cursor: default; opacity: 1; }
.opt:disabled.dim { opacity: 0.5; }
.opt .mark { margin-left: auto; font-size: 22px; flex: none; }
.opt .check { flex: none; width: 26px; height: 26px; border-radius: 8px; border: 2.5px solid var(--grigio-chiaro); margin-left: auto; display: grid; place-items: center; font-size: 16px; }
.opt.selected .check { border-color: var(--crema); background: var(--crema); color: var(--rosso); }
.opt.correct .check { border-color: #fff; background: #fff; color: var(--verde); }
.theme-dark .opt { background: var(--nero-3); color: var(--crema); box-shadow: none; }
.theme-dark .opt.correct { background: var(--verde); color: #fff; }

/* ---------- Buzz ---------- */
.buzz-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 10px 0; }
.buzz {
  position: relative;
  width: min(78vw, 300px); height: min(78vw, 300px);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff7a7a 0%, var(--rosso) 45%, var(--rosso-scuro) 100%);
  color: var(--crema);
  font-family: var(--font-display); font-size: clamp(44px, 16vw, 72px); line-height: 1;
  box-shadow: 0 18px 40px rgba(201,52,52,0.45), inset 0 -10px 24px rgba(0,0,0,0.25), inset 0 8px 16px rgba(255,255,255,0.25);
  border: 8px solid var(--crema);
  transition: transform 0.12s var(--ease), box-shadow 0.12s;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.buzz:active:not(:disabled) { transform: scale(0.94); box-shadow: 0 6px 18px rgba(201,52,52,0.4), inset 0 -4px 10px rgba(0,0,0,0.25); }
.buzz:disabled { opacity: 1; filter: grayscale(0.6) brightness(0.8); }
.buzz.done { background: radial-gradient(circle at 35% 30%, #4ec48d 0%, var(--verde) 45%, var(--verde-scuro) 100%); box-shadow: 0 18px 40px rgba(47,163,107,0.45), inset 0 -10px 24px rgba(0,0,0,0.25); }
.buzz.done .pos { font-size: clamp(64px, 26vw, 120px); }
.buzz.locked { background: radial-gradient(circle at 35% 30%, #666 0%, #3a3a3a 45%, #222 100%); box-shadow: none; }
.buzz .sub { display: block; font-family: var(--font-body); font-size: 13px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; margin-top: 6px; opacity: 0.85; }
@keyframes buzzpulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.03); } }
.buzz.ready { animation: buzzpulse 1.6s ease-in-out infinite; }

/* ---------- Timer ---------- */
.ring { position: relative; width: 84px; height: 84px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.ring .track { stroke: rgba(18,18,18,0.1); }
.theme-dark .ring .track, .theme-red .ring .track { stroke: rgba(245,231,193,0.18); }
.ring .bar { stroke: var(--rosso); transition: stroke 0.3s; }
.ring.warn .bar { stroke: var(--oro); }
.ring.urgent .bar { stroke: var(--rosso); }
.ring .num { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 32px; line-height: 1; padding-top: 4px; }
.ring.lg { width: 140px; height: 140px; }
.ring.lg .num { font-size: 56px; }
.ring.xl { width: 220px; height: 220px; }
.ring.xl circle { stroke-width: 10; }
.ring.xl .num { font-size: 96px; }
@keyframes urgentpulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.ring.urgent .num { animation: urgentpulse 0.5s ease-in-out infinite; color: var(--rosso); }
.theme-red .ring.urgent .num { color: var(--crema); }
.timebar { height: 8px; border-radius: 999px; background: rgba(18,18,18,0.1); overflow: hidden; }
.timebar > i { display: block; height: 100%; background: var(--rosso); border-radius: 999px; transition: width 0.2s linear; }

/* ---------- Liste ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 18px;
  background: var(--bianco); color: var(--nero);
  box-shadow: var(--shadow-sm);
}
.item.clickable { cursor: pointer; transition: transform 0.15s var(--ease); }
.item.clickable:active { transform: scale(0.985); }
.theme-dark .item { background: var(--nero-2); color: var(--crema); box-shadow: none; border: 1px solid rgba(245,231,193,0.08); }
.item .num {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--crema); color: var(--rosso);
  font-family: var(--font-display); font-size: 20px; line-height: 1; padding-top: 3px;
}
.item .num.gold { background: var(--oro); color: var(--nero); }
.item .num.silver { background: var(--argento); color: var(--nero); }
.item .num.bronze { background: var(--bronzo); color: #fff; }
.item .num.me { background: var(--rosso); color: var(--crema); }
.item .main { flex: 1; min-width: 0; }
.item .name { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .sub { font-size: 12.5px; color: var(--grigio); margin-top: 2px; }
.theme-dark .item .sub { color: rgba(245,231,193,0.6); }
.item .score { font-family: var(--font-display); font-size: 26px; line-height: 1; padding-top: 4px; flex: none; }
.item.me { outline: 2.5px solid var(--rosso); }
.item.highlight { background: var(--crema); }
.theme-dark .item.highlight { background: #3a2a2a; }
.online { width: 9px; height: 9px; border-radius: 50%; background: #bbb; flex: none; }
.online.on { background: var(--verde); box-shadow: 0 0 0 3px rgba(47,163,107,0.25); }

/* ---------- Podio ---------- */
.podium { display: grid; grid-template-columns: 1fr 1.25fr 1fr; gap: 8px; align-items: end; margin: 8px 0; }
.podium .step { text-align: center; border-radius: 20px 20px 8px 8px; padding: 14px 8px 12px; color: var(--nero); }
.podium .step.p1 { background: var(--oro); min-height: 170px; }
.podium .step.p2 { background: var(--argento); min-height: 130px; }
.podium .step.p3 { background: var(--bronzo); min-height: 110px; color: #fff; }
.podium .place { font-family: var(--font-display); font-size: 48px; line-height: 1; }
.podium .step.p1 .place { font-size: 64px; }
.podium .tname { font-weight: 800; font-size: 15px; margin-top: 6px; word-break: break-word; }
.podium .tscore { font-weight: 700; font-size: 14px; opacity: 0.85; margin-top: 2px; }

/* ---------- Risultato ---------- */
.result-banner { border-radius: var(--r-card); padding: 22px 18px; text-align: center; color: #fff; }
.result-banner.ok { background: var(--verde); }
.result-banner.ko { background: var(--rosso); color: var(--crema); }
.result-banner.none { background: var(--nero); color: var(--crema); }
.result-banner .big { font-family: var(--font-display); font-size: clamp(56px, 20vw, 88px); line-height: 1; }
.result-banner .lbl { font-weight: 800; font-size: 18px; letter-spacing: 0.04em; text-transform: uppercase; }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
.pop { animation: pop 0.5s var(--ease) both; }
@keyframes fadeup { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.fadeup { animation: fadeup 0.35s var(--ease) both; }

/* ---------- Tab bar (admin) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  padding: 8px 8px calc(8px + var(--sab));
  background: var(--nero-2); border-top: 1px solid rgba(245,231,193,0.1);
}
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border-radius: 14px; font-size: 11px; font-weight: 700; letter-spacing: 0.03em; color: rgba(245,231,193,0.55); text-transform: uppercase; }
.tabbar button .ico { font-size: 20px; line-height: 1; }
.tabbar button.on { color: var(--crema); background: rgba(232,66,66,0.25); }
.tabbar button .badge { position: absolute; }

/* ---------- Sheet (pannello modale dal basso) ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,0.55); display: flex; align-items: flex-end; justify-content: center; animation: fadein 0.2s; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.sheet { width: 100%; max-width: 640px; max-height: 92dvh; overflow: auto; background: var(--bianco); color: var(--nero); border-radius: 28px 28px 0 0; padding: 12px 18px calc(20px + var(--sab)); animation: slideup 0.3s var(--ease); }
.theme-dark .sheet { background: var(--nero-2); color: var(--crema); }
@keyframes slideup { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet .handle { width: 44px; height: 5px; border-radius: 999px; background: rgba(128,128,128,0.4); margin: 0 auto 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }

/* ---------- Toast / banner ---------- */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(90px + var(--sab)); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--nero); color: var(--crema); padding: 12px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow); animation: fadeup 0.25s var(--ease); max-width: 100%; text-align: center; }
.toast.err { background: var(--rosso); }
.toast.ok { background: var(--verde); color: #fff; }
.banner-offline { position: fixed; top: calc(60px + var(--sat)); left: 50%; transform: translateX(-50%); z-index: 50; background: var(--nero); color: var(--crema); padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow); }
.banner-offline .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--oro); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }
.message-banner { background: var(--nero); color: var(--crema); border-radius: 18px; padding: 12px 16px; font-weight: 600; display: flex; gap: 10px; align-items: flex-start; }
.message-banner .ico { font-size: 20px; }

/* ---------- Varie ---------- */
.hero { background: var(--rosso); color: var(--crema); margin: -16px -16px 16px; padding: 24px 16px 28px; text-align: center; border-radius: 0 0 32px 32px; }
.hero .logo-big { height: 56px; width: auto; margin: 0 auto 10px; }
.divider { height: 1px; background: rgba(18,18,18,0.08); margin: 8px 0; }
.theme-dark .divider { background: rgba(245,231,193,0.1); }
.qr-box { background: #fff; border-radius: 20px; padding: 12px; width: min(70vw, 280px); margin: 0 auto; }
.qr-box img, .qr-box svg { width: 100%; height: auto; }
.statgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: rgba(18,18,18,0.05); border-radius: 16px; padding: 10px 8px; text-align: center; }
.theme-dark .stat { background: var(--nero-3); }
.stat .v { font-family: var(--font-display); font-size: 28px; line-height: 1; padding-top: 4px; }
.stat .k { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--grigio); margin-top: 4px; }
.theme-dark .stat .k { color: rgba(245,231,193,0.6); }
.dist { display: flex; flex-direction: column; gap: 6px; }
.dist .bar { position: relative; height: 34px; border-radius: 10px; background: rgba(18,18,18,0.06); overflow: hidden; display: flex; align-items: center; padding: 0 10px; font-size: 14px; font-weight: 600; }
.theme-dark .dist .bar { background: var(--nero-3); }
.dist .bar > i { position: absolute; inset: 0 auto 0 0; background: rgba(232,66,66,0.35); }
.dist .bar.correct > i { background: rgba(47,163,107,0.5); }
.dist .bar span { position: relative; z-index: 1; }
.dist .bar .n { margin-left: auto; font-weight: 800; }
.answer-list .item { align-items: flex-start; }
.verdict { display: flex; gap: 6px; flex: none; }
.verdict button { width: 44px; height: 44px; border-radius: 50%; font-size: 20px; background: var(--nero-3); color: var(--crema); border: 2px solid transparent; }
.verdict button.ok.on { background: var(--verde); border-color: var(--verde); color: #fff; }
.verdict button.ko.on { background: var(--rosso); border-color: var(--rosso); color: var(--crema); }
.verdict button.auto { border-color: rgba(245,231,193,0.3); border-style: dashed; }
.phase-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-weight: 800; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.phase-pill.pronta { background: var(--nero-3); color: var(--crema); }
.phase-pill.aperta { background: var(--verde); color: #fff; }
.phase-pill.chiusa { background: var(--oro); color: var(--nero); }
.phase-pill.rivelata { background: var(--crema); color: var(--rosso); }
.phase-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.phase-pill.aperta .dot { animation: blink 1s infinite; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 70; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px; animation: fall 3.2s linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: 0.7; } }
.qlist .item { padding: 10px 12px; }
.qlist .item .txt { font-size: 14.5px; font-weight: 600; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.qlist .item.current { outline: 2.5px solid var(--rosso); }
.qlist .item.played { opacity: 0.75; }
.type-ico { flex: none; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-size: 17px; background: var(--crema); color: var(--nero); }
.theme-dark .type-ico { background: var(--nero-3); color: var(--crema); }
.kbd-row { display: flex; gap: 8px; flex-wrap: wrap; }
.big-number { font-family: var(--font-display); font-size: clamp(64px, 24vw, 120px); line-height: 1; }
.wave { height: 28px; background-size: 100% 100%; background-repeat: no-repeat; }
.logo-mark { height: 80px; width: auto; margin: 0 auto; }

@media (min-width: 720px) {
  .page { padding-top: 24px; }
  .btn.lg { min-height: 68px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* selettore tipo domanda: 5 voci anche su schermi stretti */
#type-seg { display: grid; grid-template-columns: repeat(5, 1fr); border-radius: 18px; }
#type-seg button { border-radius: 14px; font-size: 10px; line-height: 1.2; padding: 6px 2px; min-height: 52px; letter-spacing: 0.02em; }

/* =====================================================================
   v2 — più aria, layout tablet per il presentatore, animazioni squadre
   ===================================================================== */
.stack { gap: 14px; }
.card { padding: 22px 20px; }
.item { padding: 14px 16px; }
.eyebrow { margin-bottom: 2px; }
.page { padding: 18px 16px calc(28px + var(--sab)); }

/* ---------- Presentatore: barra azioni sempre visibile ---------- */
.tabbar { height: calc(72px + var(--sab)); }
.page.with-tabs { padding-bottom: calc(172px + var(--sab)); }
.actionbar {
  position: fixed; left: 0; right: 0; bottom: calc(72px + var(--sab)); z-index: 29;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 12px 10px;
  background: linear-gradient(to top, rgba(18,18,18,0.97) 70%, rgba(18,18,18,0));
}
.actionbar.hidden { display: none; }
.actionbar .primary-action { flex: 1; min-height: 62px; font-size: 17px; letter-spacing: 0.04em; }
.actionbar .btn.side { width: 54px; min-height: 54px; padding: 0; flex: none; border-radius: 50%; font-size: 18px; }
.actionbar .btn.side.wide { width: auto; padding: 0 16px; border-radius: 999px; font-size: 13px; }
.actionbar .hint { position: absolute; left: 0; right: 0; top: -14px; text-align: center; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(245,231,193,0.6); }

/* passi del flusso domanda */
.steps { display: flex; gap: 6px; }
.steps .st { flex: 1; text-align: center; font-size: 11px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; padding: 9px 4px; border-radius: 12px; background: var(--nero-3); color: rgba(245,231,193,0.4); position: relative; }
.steps .st.done { color: var(--verde); }
.steps .st.now { background: var(--rosso); color: var(--crema); box-shadow: 0 6px 16px rgba(232,66,66,0.35); }
.steps .st small { display: block; font-size: 16px; line-height: 1; margin-bottom: 3px; }

.guide { display: grid; gap: 10px; }
.guide .g { display: flex; gap: 12px; align-items: flex-start; }
.guide .g .n { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--crema); color: var(--rosso); display: grid; place-items: center; font-family: var(--font-display); font-size: 17px; padding-top: 2px; }
.guide .g p { font-size: 14.5px; line-height: 1.4; }

.big-count { font-family: var(--font-display); font-size: 56px; line-height: 1; }
.answer-key { border-left: 5px solid var(--rosso); }
.opt-key { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.opt-key .opt-line { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: rgba(18,18,18,0.06); font-weight: 600; line-height: 1.3; }
.opt-key .opt-line.ok { background: rgba(47,163,107,0.22); }
.opt-key .letter { font-weight: 800; min-width: 1.2em; }
.opt-key .mark { margin-left: auto; color: var(--verde-scuro); font-weight: 800; }
.live-grid { display: grid; gap: 14px; }
.hint-card { background: rgba(245,231,193,0.06); border: 1px dashed rgba(245,231,193,0.25); border-radius: 18px; padding: 14px 16px; font-size: 14px; color: rgba(245,231,193,0.8); line-height: 1.45; }
.msg-banner { display: flex; align-items: center; gap: 10px; background: var(--crema); color: var(--nero); border-radius: 16px; padding: 10px 14px; font-weight: 600; font-size: 14px; }
.msg-banner .x { margin-left: auto; width: 32px; height: 32px; border-radius: 50%; background: rgba(18,18,18,0.08); display: grid; place-items: center; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Presentatore: layout tablet (iPad) ---------- */
body.is-tablet { font-size: 17px; }
body.is-tablet .topbar { margin-left: 108px; }
body.is-tablet .tabbar {
  top: 0; bottom: 0; left: 0; right: auto; width: 108px; height: auto;
  flex-direction: column; justify-content: flex-start; gap: 8px;
  padding: calc(16px + var(--sat)) 10px 16px;
  border-top: 0; border-right: 1px solid rgba(245,231,193,0.1);
}
body.is-tablet .tabbar button { flex: 0 0 auto; width: 100%; padding: 14px 4px; border-radius: 18px; font-size: 12px; }
body.is-tablet .tabbar button .ico { font-size: 26px; }
body.is-tablet .page.with-tabs { margin-left: 108px; max-width: 1100px; padding: 28px 32px calc(120px + var(--sab)); }
body.is-tablet .actionbar { left: 108px; bottom: 0; padding: 14px 32px calc(18px + var(--sab)); }
body.is-tablet .actionbar .primary-action { min-height: 68px; font-size: 19px; max-width: 640px; margin: 0 auto; }
body.is-tablet .actionbar .btn.side { width: 60px; min-height: 60px; }
body.is-tablet .live-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 24px; align-items: start; }
body.is-tablet .card { padding: 26px 26px; border-radius: 28px; }
body.is-tablet .question-text { font-size: 30px; }
body.is-tablet .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
body.is-tablet .two-col .list { display: contents; }
body.is-tablet .list.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
body.is-tablet .ring.lg { width: 170px; height: 170px; }
body.is-tablet .ring.lg .num { font-size: 68px; }
body.is-tablet .sheet { border-radius: 28px; max-width: 720px; margin-bottom: 24px; max-height: 88dvh; }
body.is-tablet .sheet-backdrop { align-items: center; }
body.is-tablet .toast-wrap { bottom: 120px; left: 108px; }
body.is-tablet .steps .st { padding: 12px 6px; font-size: 12px; }
body.is-tablet .big-count { font-size: 72px; }

/* ---------- Squadre: animazioni ---------- */
.options .opt { animation: fadeup 0.45s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(40px) scale(0.96); } to { opacity: 1; transform: none; } }
.podium .step { animation: rise 0.7s var(--ease) both; }
.podium .step.p2 { animation-delay: 0.1s; }
.podium .step.p1 { animation-delay: 0.35s; }
.podium .step.p3 { animation-delay: 0.2s; }
@keyframes shimmer { 0%, 100% { box-shadow: 0 0 0 0 rgba(232,185,49,0.0); } 50% { box-shadow: 0 0 40px 6px rgba(232,185,49,0.55); } }
.podium .step.p1 { animation: rise 0.7s var(--ease) 0.35s both, shimmer 2.2s ease-in-out 1.1s infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.breathe { animation: breathe 1.6s ease-in-out infinite; display: inline-block; }
@keyframes swing { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }
.swing { display: inline-block; animation: swing 1s ease-in-out infinite; transform-origin: 50% 20%; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-12px); } 40% { transform: translateX(12px); } 60% { transform: translateX(-8px); } 80% { transform: translateX(8px); } }
.shake { animation: shake 0.5s ease both; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.bounce { animation: bounce 0.9s ease-in-out infinite; }
@keyframes shockwave { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(1.9); opacity: 0; } }
.buzz-wrap { position: relative; }
.buzz-wrap .wave-ring { position: absolute; left: 50%; top: 50%; width: min(78vw, 300px); height: min(78vw, 300px); margin: calc(min(78vw, 300px) / -2) 0 0 calc(min(78vw, 300px) / -2); border-radius: 50%; border: 6px solid var(--rosso); pointer-events: none; animation: shockwave 0.7s var(--ease) forwards; }
.result-banner .big { animation: pop 0.6s var(--ease) 0.15s both; }
.result-banner.ok { background: linear-gradient(160deg, #3bb97d, var(--verde) 60%, #227a50); }
.result-banner.ko { background: linear-gradient(160deg, #f06060, var(--rosso) 60%, #b52a2a); }
@keyframes slidein { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: none; } }
.message-banner { animation: slidein 0.4s var(--ease) both; }

/* timer gigante negli ultimi 10 secondi (non blocca i tocchi) */
.bigtimer { position: fixed; inset: 0; z-index: 44; pointer-events: none; display: none; place-items: center; }
.bigtimer.on { display: grid; }
.bigtimer .vig { position: absolute; inset: 0; box-shadow: inset 0 0 110px rgba(232,66,66,0.6); animation: vig 1s ease-out infinite; }
.bigtimer .n { font-family: var(--font-display); font-size: min(50vh, 78vw); line-height: 1; color: var(--rosso); opacity: 0.32; text-shadow: 0 12px 40px rgba(232,66,66,0.45); animation: bigpulse 1s ease-out; }
.bigtimer.strong .n { opacity: 0.6; }
.bigtimer .lbl { position: absolute; bottom: 12vh; left: 0; right: 0; text-align: center; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; font-size: 14px; color: var(--rosso); opacity: 0.8; }
@keyframes bigpulse { 0% { transform: scale(1.25); opacity: 0.6; } 40% { transform: scale(1); } 100% { transform: scale(1); } }
@keyframes vig { 0% { opacity: 1; } 100% { opacity: 0.3; } }

/* flash a tutto schermo: giusto / sbagliato */
.flash { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; pointer-events: none; animation: flashin 0.25s var(--ease) both; }
.flash.out { animation: flashout 0.45s ease both; }
.flash.ko { background: rgba(232,66,66,0.94); }
.flash.ok { background: rgba(47,163,107,0.9); }
.flash .inner { display: flex; flex-direction: column; align-items: center; gap: 2vh; }
.flash .big-x { width: 58vmin; height: 58vmin; animation: shake 0.55s ease 0.25s both; }
.flash .big-x line { stroke: var(--crema); stroke-width: 14; stroke-linecap: round; stroke-dasharray: 130; stroke-dashoffset: 130; animation: draw 0.3s var(--ease) forwards; }
.flash .big-x line:nth-child(2) { animation-delay: 0.14s; }
.flash .word { font-family: var(--font-display); font-size: 15vmin; line-height: 1; color: #fff; text-shadow: 0 8px 30px rgba(0,0,0,0.25); animation: pop 0.5s var(--ease) both; }
.flash .pts { font-family: var(--font-display); font-size: 30vmin; line-height: 1; color: #fff; text-shadow: 0 10px 40px rgba(0,0,0,0.3); animation: pop 0.6s var(--ease) 0.1s both; }
.flash .sub { font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255,255,255,0.9); font-size: 15px; animation: fadeup 0.4s var(--ease) 0.3s both; }
@keyframes flashin { from { opacity: 0; } to { opacity: 1; } }
@keyframes flashout { from { opacity: 1; } to { opacity: 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.confetti-canvas { position: fixed; inset: 0; z-index: 85; pointer-events: none; }
@keyframes countpop { 0% { transform: scale(1); } 50% { transform: scale(1.25); color: var(--verde); } 100% { transform: scale(1); } }
.countpop { animation: countpop 0.5s var(--ease); display: inline-block; }
@media (max-width: 480px) { body.admin .topbar .chip.red { display: none; } }
body.admin .topbar .right { gap: 4px; }
/* barra azioni: suggerimento dentro la barra, niente sovrapposizioni */
.actionbar { flex-wrap: wrap; padding-top: 8px; background: linear-gradient(to top, rgba(18,18,18,0.98) 85%, rgba(18,18,18,0)); }
.actionbar .hint { position: static; width: 100%; order: -1; margin-bottom: 2px; }
.page.with-tabs { padding-bottom: calc(196px + var(--sab)); }
body.is-tablet .page.with-tabs { padding-bottom: calc(140px + var(--sab)); }
.actionbar { background: var(--nero); border-top: 1px solid rgba(245,231,193,0.08); }
/* iPad verticale: una colonna larga; due colonne solo da 1000px (iPad orizzontale) */
body.is-tablet .live-grid { grid-template-columns: 1fr; }
body.is-tablet .two-col { grid-template-columns: 1fr; }
body.is-tablet .list.cols { grid-template-columns: 1fr; }
@media (min-width: 1000px) {
  body.is-tablet .live-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
  body.is-tablet .two-col { grid-template-columns: 1fr 1fr; }
  body.is-tablet .list.cols { grid-template-columns: 1fr 1fr; }
}

.hint-join { background: var(--crema); color: var(--nero); border-radius: 16px; padding: 12px 14px; font-size: 14.5px; line-height: 1.45; }
button.item { font: inherit; color: inherit; }
