:root {
  --bg: #0f172a;
  --card: #1e293b;
  --card-on: #134e4a;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #2bb3a8;
  --danger: #ef4444;
  --line: #334155;
  --on-accent: #0f172a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg) center / cover fixed; }
html, body { margin: 0; color: var(--text); }
body { background: transparent; }
/* Con un'immagine di sfondo: velo del colore di sfondo, per tenere leggibili i testi. */
body.conimg::before { content: ""; position: fixed; inset: 0; background: var(--bg); opacity: .62; z-index: -1; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}
header { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .02em; color: var(--accent); }
.brand img { width: 40px; height: 40px; border-radius: 50%; }
.sede { display: block; max-height: 44px; max-width: 60%; width: auto; height: auto; object-fit: contain; }
select { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 15px; }
main { flex: 1; max-width: 560px; width: 100%; margin: 0 auto; }
h1 { font-size: 24px; margin: 8px 0 4px; }
.hint { color: var(--muted); margin: 0 0 16px; }
.lingue { display: grid; gap: 12px; }
.lingua {
  display: flex; align-items: center; gap: 14px; width: 100%;
  background: var(--card); color: var(--text); border: 2px solid transparent;
  border-radius: 16px; padding: 16px; font-size: 20px; font-weight: 600; text-align: left;
  cursor: pointer; min-height: 68px;
}
.lingua.on { background: var(--card-on); border-color: var(--accent); }
.lingua:active { transform: scale(.99); }
.bandiera { font-size: 34px; line-height: 1; width: 44px; text-align: center; }
.player { margin-top: 22px; background: var(--card); border-radius: 16px; padding: 16px; display: grid; gap: 14px; }
.ora { display: flex; align-items: center; gap: 12px; }
.ora-nome { font-size: 18px; font-weight: 700; }
.stato { color: var(--muted); font-size: 14px; }
.stato.ok::before { content: "● "; color: #22c55e; }
.volume { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
.volume input { width: 100%; }
.stop { background: transparent; color: var(--danger); border: 1px solid var(--danger); border-radius: 12px; padding: 12px; font-size: 16px; }
.domande { margin-top: 22px; background: var(--card); border-radius: 16px; padding: 16px; display: grid; gap: 10px; }
.domande h2 { font-size: 18px; margin: 0; }
.domande textarea, .domande input {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; font: inherit; font-size: 16px; resize: vertical;
}
.invia { background: var(--accent); color: var(--on-accent); border: 0; border-radius: 12px; padding: 14px; font-size: 17px; font-weight: 700; }
.invia:disabled { opacity: .5; }
.esito { margin: 0; min-height: 1.2em; color: var(--muted); }
.esito.ok { color: #22c55e; }
.esito.ko { color: var(--danger); }
.avviso { margin-top: 16px; background: #7c2d12; color: #fff; border-radius: 12px; padding: 14px; font-weight: 600; cursor: pointer; }
footer { color: var(--muted); font-size: 12px; text-align: center; padding: 22px 0 14px; display: grid; gap: 6px; justify-items: center; }
footer a { color: var(--muted); }
.nota-privacy { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.nota-privacy a { color: var(--muted); }
footer p { margin: 0; line-height: 1.6; }
.mwtl { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.mwtl img { width: 40px; height: 40px; border-radius: 50%; }
.copy { font-size: 11px; opacity: .8; }
[dir="rtl"] .lingua { text-align: right; }
.logo { display: block; max-width: 70%; max-height: 84px; width: auto; height: auto; margin: 6px auto 10px; object-fit: contain; }
.benvenuto { margin: 0 0 16px; white-space: pre-line; overflow-wrap: anywhere; }
.videobox { display: grid; gap: 10px; }
.videobox.top { margin: 4px 0 18px; }
.v-azioni { display: flex; gap: 10px; flex-wrap: wrap; }
.v-azioni button { flex: 1 1 auto; }
.sec { background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 16px; cursor: pointer; }
.sec:active { transform: scale(.99); }
.videobox video { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; display: block; }
.videobox .hint { margin: 6px 0 0; font-size: 14px; }
.videobox .esito { min-height: 0; }
.bloccato { margin-top: 14px; }

/* ---------- trascrizione (secondo video, da leggere) ---------- */
.testo.videobox { margin: 0 0 18px; }
.t-stage { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; }
.t-rot { position: absolute; inset: 0; }
.t-stage video { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; object-fit: contain; border-radius: 0; transform-origin: center; transform: translate(var(--tx, 0px), var(--ty, 0px)) scale(var(--s, 1)); }
.t-btn { background: rgba(15, 23, 42, .82); color: #fff; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; padding: 8px 14px; font-size: 15px; cursor: pointer; }
.t-piena { position: absolute; inset-inline-end: 8px; bottom: 8px; }
.t-barra { position: absolute; top: max(10px, env(safe-area-inset-top)); inset-inline: 10px; display: flex; justify-content: space-between; gap: 10px; z-index: 2; }
.t-aiuto { position: absolute; left: 12px; right: 12px; bottom: max(14px, env(safe-area-inset-bottom)); margin: 0; padding: 10px 12px; border-radius: 12px; background: rgba(15, 23, 42, .88); color: #fff; font-size: 14px; text-align: center; z-index: 2; pointer-events: none; }
/* Schermo intero: a tutta pagina (anche su iPhone, dove l'API dello schermo intero non c'è per questi elementi). */
.t-stage.full { position: fixed; inset: 0; z-index: 100; border-radius: 0; aspect-ratio: auto; touch-action: none; overscroll-behavior: contain; }
.t-stage.full .t-piena { display: none; }
.t-stage.full .t-rot { inset: auto; left: 50%; top: 50%; width: 100vw; height: 100vh; height: 100dvh; transform: translate(-50%, -50%); }
.t-stage.full .t-rot.r90 { width: 100vh; width: 100dvh; height: 100vw; transform: translate(-50%, -50%) rotate(90deg); }
body.t-aperta { overflow: hidden; }

/* ---------- sondaggio e quiz (telefono) ---------- */
.sondaggio { margin-top: 22px; background: var(--card); border: 1px solid var(--accent); border-radius: 16px; padding: 16px; display: grid; gap: 12px; }
.s-meta { margin: 0; color: var(--muted); font-size: 13px; letter-spacing: .04em; text-transform: uppercase; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.s-tag { background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 800; }
.s-domanda { margin: 0; font-size: 21px; line-height: 1.3; word-break: break-word; }
.s-opzioni { display: grid; gap: 10px; }
.s-opz { display: grid; gap: 4px; }
.s-btn { position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; min-height: 52px;
  background: var(--bg); color: var(--text); border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; font: inherit; font-size: 17px; }
.s-btn:disabled { opacity: 1; }
.s-btn.sel { border-color: var(--accent); background: var(--card-on); }
.s-btn .mark { flex: 0 0 24px; height: 24px; border: 2px solid var(--muted); display: grid; place-items: center; font-size: 15px; font-weight: 900; color: var(--on-accent); }
.s-btn .mark.cerchio { border-radius: 50%; }
.s-btn .mark.quadro { border-radius: 6px; }
.s-btn.sel .mark { background: var(--accent); border-color: var(--accent); }
.s-btn .testo { flex: 1; position: relative; z-index: 1; word-break: break-word; }
.s-btn .barra { position: absolute; inset: 0 auto 0 0; background: rgba(43, 179, 168, .28); width: 0; transition: width .4s ease; z-index: 0; }
[dir="rtl"] .s-btn .barra { inset: 0 0 0 auto; }
.s-btn .num { position: relative; z-index: 1; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; white-space: nowrap; }
.s-btn .num b { color: var(--text); font-size: 17px; }
.s-esito-q { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; padding: 0 4px; }
.s-esito-q.giusta { color: #22c55e; }
.s-esito-q.sbagliata { color: var(--danger); }
.s-esito-q .ico { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 14px; line-height: 1; }
.s-esito-q.giusta .ico { background: #22c55e; }
.s-esito-q.sbagliata .ico { background: var(--danger); }
.s-tua { color: var(--muted); font-weight: 600; }
.s-tot { margin: 0; color: var(--muted); font-size: 14px; }
[dir="rtl"] footer .copy, [dir="rtl"] footer .nomi, [dir="rtl"] footer .mwtl { direction: ltr; unicode-bidi: isolate; }

/* Sottotitoli (modulo Traduzione AI) */
.sott { margin: 0 0 18px; }
.sott .v-azioni { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.s-lingua { min-height: 44px; border-radius: 10px; padding: 0 10px; background: #232a3d; color: #fff; border: 1px solid #3d4254; font: inherit; }
.s-wrap { position: relative; margin-top: 10px; background: #05070d; border-radius: 14px; padding: 16px 16px 52px; min-height: 120px; }
.s-testo p { margin: 0 0 8px; font-size: 20px; line-height: 1.4; color: #fff; }
.s-testo p.parz { color: #c9d6e2; }
.s-testo p.attesa { color: #98a2b6; font-size: 16px; }
.s-pieno { position: absolute; right: 10px; bottom: 10px; }
.s-wrap.piena { position: fixed; inset: 0; z-index: 50; margin: 0; border-radius: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 24px 22px 70px; }
.s-wrap.piena .s-testo p { font-size: 30px; }
[dir="rtl"] .s-pieno { right: auto; left: 10px; }
