/* Cevitameter — stile Telefono Amico Cevita */

@font-face {
  font-family: 'Faustina';
  src: url("../fonts/faustina.woff2") format('woff2');
  font-weight: 300 800;
  font-display: swap;
}
@font-face {
  font-family: 'Open Sans';
  src: url("../fonts/open-sans.woff2") format('woff2');
  font-weight: 300 800;
  font-display: swap;
}

:root {
  --verde: #0e7162;
  --verde-scuro: #0a574b;
  --rosso: #ec1d25;
  --nero: #231f20;
  --crema: #f7f3ea;
  --sabbia: #e9dfcb;
  --acqua: #82c0c7;
  --acqua-scuro: #3f8e97;
  --ocra: #d9a441;
  --ocra-scuro: #a97719;
  --bianco: #fffdf8;
  --grigio: #6b6560;
  --raggio: 14px;
  --ombra: 0 6px 24px rgba(35, 31, 32, 0.08);
  --titoli: 'Faustina', Georgia, 'Times New Roman', serif;
  --testo: 'Open Sans', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--crema);
  color: var(--nero);
  font-family: var(--testo);
  font-size: 17px;
  line-height: 1.45;
}

h1, h2, h3, .titolo {
  font-family: var(--titoli);
  color: var(--verde);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.5em;
  overflow-wrap: anywhere;
}
h1 { font-size: 1.7rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 0.8em; }
a { color: var(--verde); }
[hidden] { display: none !important; }

.logo { display: block; height: 44px; width: auto; }
.muted { color: var(--grigio); font-size: 0.9rem; }
.center { text-align: center; }
.errore { color: #a8121a; font-weight: 600; min-height: 1.4em; }

/* --- Componenti --- */

.card {
  background: var(--bianco);
  border: 1px solid var(--sabbia);
  border-radius: var(--raggio);
  padding: 18px;
  box-shadow: var(--ombra);
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--sabbia);
  border-radius: 12px;
  background: #fff;
  color: var(--nero);
  font: 600 1rem var(--testo);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { background: #f3ede0; }
.btn:active { transform: scale(0.98); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--acqua);
  outline-offset: 2px;
}
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-primario { background: var(--verde); border-color: var(--verde); color: #fff; }
.btn-primario:hover { background: var(--verde-scuro); }
.btn-rosso { background: #fff; border-color: var(--rosso); color: #b3141b; }
.btn-rosso:hover { background: #fdeceb; }
.btn-piccolo { min-height: 36px; padding: 6px 10px; font-size: 0.88rem; }
.btn-largo { width: 100%; }

input[type="text"], input[type="password"], input[type="tel"], textarea, select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #cfc4ae;
  border-radius: 12px;
  background: #fff;
  color: var(--nero);
  font: 400 1rem var(--testo);
}
textarea { min-height: 96px; resize: vertical; }
label { display: block; font-weight: 600; margin: 12px 0 4px; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--sabbia);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-verde { background: var(--verde); color: #fff; }
.badge-rosso { background: var(--rosso); color: #fff; }
.badge-ocra { background: var(--ocra); color: var(--nero); }

.riga { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.riga-spazio { justify-content: space-between; }
.pila { display: grid; gap: 12px; }

/* --- Telefono del partecipante --- */

.telefono {
  max-width: 520px;
  margin: 0 auto;
  padding: 18px 16px 110px;
}
.telefono .logo { margin: 4px auto 18px; height: 40px; }
.telefono h1 { text-align: center; font-size: 1.5rem; }
.scala-domanda { margin-bottom: 12px; }
.scala-testo { margin: 0 0 12px; font-weight: 600; text-align: center; }
.scala-voti { display: flex; justify-content: space-between; gap: 6px; }
.scala-voto {
  flex: 1; max-width: 64px; min-height: 54px; padding: 0;
  border: 2px solid var(--verde); border-radius: 14px; background: var(--bianco); color: var(--verde-scuro);
  font-family: var(--titoli); font-size: 1.5rem; font-weight: 700; cursor: pointer;
}
.scala-voto.scelta { background: var(--verde); color: #fff; box-shadow: 0 0 0 3px var(--bianco), 0 0 0 5px var(--nero); }
.scala-voto[disabled] { cursor: not-allowed; }
.scala-voto[disabled]:not(.scelta) { opacity: 0.45; }
.scala-estremi { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: 0.85rem; color: var(--grigio); }
.miei-biglietti { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.miei-biglietti li {
  padding: 10px 12px; border-radius: 10px; background: #fff3c4; border-left: 5px solid var(--ocra);
  word-break: break-word; overflow-wrap: anywhere;
}
.riga-invio { display: flex; gap: 8px; align-items: stretch; margin-bottom: 8px; }
.riga-invio input { flex: 1; min-width: 0; }
.parole { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.parole li {
  padding: 6px 14px; border-radius: 999px; background: var(--sabbia);
  font-weight: 600; word-break: break-word; overflow-wrap: anywhere;
}

.opzione {
  width: 100%;
  min-height: 58px;
  padding: 14px 16px;
  border: 0;
  border-radius: 16px;
  color: #fff;
  font: 600 1.08rem var(--testo);
  text-align: center;
  cursor: pointer;
  overflow-wrap: anywhere;
  transition: transform 0.08s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
.opzione:active { transform: scale(0.98); }
.opzione[disabled] { opacity: 0.55; cursor: not-allowed; }
.opzione.scelta { box-shadow: 0 0 0 4px var(--bianco), 0 0 0 7px var(--nero); }
.colore-0 { background: var(--verde); }
.colore-1 { background: var(--acqua-scuro); }
.colore-2 { background: var(--ocra-scuro); }
.colore-3 { background: #7a5c8e; }
.colore-4 { background: #b3541e; }
.colore-5 { background: #4d6b3c; }
.colore-6 { background: #2f6f9f; }
.colore-7 { background: #8a3b4d; }

.grazie { text-align: center; padding: 26px 18px; }
.grazie .spunta {
  width: 64px; height: 64px; margin: 0 auto 12px;
  border-radius: 50%; background: var(--verde); color: #fff;
  display: grid; place-items: center; font-size: 34px;
  animation: sboccia 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}
.avviso { text-align: center; padding: 34px 18px; }
.avviso .titolo { font-size: 1.4rem; }

/* Barra fissa in basso (domande, reazioni) e foglio a tutto schermo */
#fisso {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; gap: 8px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  max-width: 520px; margin: 0 auto;
  background: linear-gradient(to bottom, rgba(247, 243, 234, 0), var(--crema) 26%);
}
#fisso:empty { display: none; }
.reazioni { order: -1; display: flex; justify-content: center; gap: 10px; }
.reazione {
  flex: 1; max-width: 76px; min-height: 52px; padding: 4px;
  border: 1px solid var(--sabbia); border-radius: 26px; background: var(--bianco);
  font-size: 1.6rem; line-height: 1; cursor: pointer; box-shadow: var(--ombra);
  transition: transform 0.15s ease-out, opacity 0.2s;
}
.reazione:active { transform: scale(0.9); }
.reazione[disabled] { opacity: 0.45; cursor: default; }
.reazione.toccata { opacity: 1; transform: translateY(-8px) scale(1.15); border-color: var(--verde); }
body.con-barra .telefono { padding-bottom: 150px; }
body.bloccato { overflow: hidden; }
.chiedi { box-shadow: var(--ombra); }
.chiedi .conta { font-weight: 400; opacity: 0.85; }
.foglio { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 20; overflow-y: auto; background: var(--crema); animation: entra-su 0.25s ease-out both; }
.foglio .telefono { padding-bottom: 40px; }
.foglio-testata {
  position: sticky; top: 0; z-index: 1;
  display: flex; justify-content: space-between; align-items: center;
  max-width: 520px; margin: 0 auto; padding: 12px 16px;
  background: var(--crema); border-bottom: 1px solid var(--sabbia);
}
.foglio-testata .titolo { font-size: 1.4rem; margin: 0; }
.nota { min-height: 1.4em; margin: 8px 0 4px; font-weight: 600; }
.nota-ok { color: var(--verde); }
.domande { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.domanda {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--bianco); border-radius: var(--raggio); padding: 12px;
  box-shadow: var(--ombra); border-left: 5px solid var(--sabbia);
}
.domanda.answering { border-left-color: var(--rosso); }
.domanda.answered { opacity: 0.6; }
.domanda-testo { flex: 1; min-width: 0; word-break: break-word; overflow-wrap: anywhere; }
.domanda-testo .badge { margin-bottom: 4px; }
.voto {
  flex: none; min-width: 58px; min-height: 48px; padding: 6px 8px;
  border: 2px solid var(--verde); border-radius: 12px; background: var(--bianco); color: var(--verde);
  font: 700 1rem var(--testo); cursor: pointer;
}
.voto.votata { background: var(--verde); color: #fff; }
.voto[disabled] { opacity: 0.6; }

/* --- Schermo condiviso --- */

body.schermo { overflow: hidden; }
.palco {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 3.2vh 4vw 3vh;
  gap: 2.5vh;
  position: relative;
  overflow: hidden;
}
.palco::before {
  content: "";
  position: absolute; right: -14vh; top: -14vh; width: 52vh; height: 52vh; border-radius: 50%;
  background: radial-gradient(circle, rgba(236, 29, 37, 0.07), transparent 70%);
  pointer-events: none;
}
.palco-testata { display: flex; justify-content: space-between; align-items: center; gap: 3vw; }
.palco-testata .logo { height: 8.5vh; }
.entra {
  display: flex; align-items: center; gap: 1.6vw;
  background: #fff; border: 1px solid var(--sabbia); border-radius: 2vh;
  padding: 1.2vh 1.6vw; font-size: 2.6vh; box-shadow: var(--ombra);
}
.entra strong { font-weight: 700; }
.entra .codice { color: var(--rosso); font-weight: 700; font-size: 4.2vh; letter-spacing: 0.12em; white-space: nowrap; }
.palco-corpo { min-height: 0; display: flex; flex-direction: column; }
.palco-titolo { font-size: 6.2vh; margin-bottom: 1vh; }
.palco-sotto { font-size: 2.5vh; color: var(--grigio); margin-bottom: 2vh; }
.palco-contenuto { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; }

.barre { display: grid; gap: 2.2vh; }
.barra-riga .barra-testa { display: flex; justify-content: space-between; gap: 2vw; font-size: 3.4vh; font-weight: 600; }
.barra-riga .barra-testa span:first-child { overflow-wrap: anywhere; }
.barra-pista { height: 4.6vh; border-radius: 2.3vh; background: rgba(35, 31, 32, 0.06); overflow: hidden; margin-top: 0.6vh; }
.barra { height: 100%; width: 0; min-width: 0; border-radius: 2.3vh; transition: width 0.9s cubic-bezier(0.2, 0.8, 0.2, 1); }
.barre.compatte { gap: 1.3vh; }
.barre.compatte .barra-testa { font-size: 2.7vh; }
.barre.compatte .barra-pista { height: 3.2vh; }

.domande-schermo { list-style: none; margin: 0; padding: 0.5vh; display: grid; gap: 1.4vh; overflow: hidden; min-height: 0; flex: 0 1 auto; }
.domanda-schermo {
  display: flex; align-items: center; gap: 2vw;
  background: var(--bianco); border-radius: 1.8vh; padding: 1.3vh 2vw;
  border-left: 1vh solid var(--sabbia); box-shadow: var(--ombra);
  font-size: 2.8vh; animation: entra-su 0.35s ease-out both;
}
.domanda-schermo .voti { flex: none; min-width: 7vw; font-weight: 700; color: var(--verde); white-space: nowrap; }
.domanda-schermo .testo {
  flex: 1; min-width: 0; overflow-wrap: anywhere; overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
}
.domanda-schermo .stato { flex: none; font-size: 2.2vh; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--grigio); }
.domanda-schermo.answering { border-left-color: var(--rosso); box-shadow: 0 0 0 0.4vh var(--rosso), var(--ombra); font-size: 3.3vh; }
.domanda-schermo.answering .testo { -webkit-line-clamp: 3; line-clamp: 3; }
.domanda-schermo.answering .stato { color: var(--rosso); }
.domanda-schermo.answered { opacity: 0.5; }

.attesa { text-align: center; }
#qr { line-height: 0; }
.qr-piccolo { height: 12vh; width: 12vh; border-radius: 1vh; background: #fff; }
.qr-grande { height: 38vh; width: 38vh; margin: 1vh auto 2vh; display: block; border-radius: 2vh; background: #fff; box-shadow: var(--ombra); }
.attesa .attesa-codice { font-size: 3vh; }
.attesa .codice { color: var(--rosso); letter-spacing: 0.1em; white-space: nowrap; }
.attesa .titolo { font-size: 7vh; }
.attesa p { font-size: 3.4vh; color: var(--grigio); }

.scala-schermo { display: grid; gap: 3vh; }
.scala-riga { display: grid; grid-template-columns: 1fr auto 30vw; align-items: center; gap: 3vw; }
.scala-affermazione { font-size: 3.6vh; font-weight: 600; word-break: break-word; overflow-wrap: anywhere; }
.scala-media { text-align: center; min-width: 12vw; }
.scala-media .numero { display: block; font-family: var(--titoli); font-size: 9vh; font-weight: 700; line-height: 1; color: var(--verde); }
.scala-media .su { font-size: 2.2vh; color: var(--grigio); }
.scala-colonne { display: flex; align-items: flex-end; gap: 1vw; }
.scala-colonna { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.6vh; font-size: 2.2vh; }
.scala-colonna .quanti { min-height: 2.8vh; font-weight: 600; }
.scala-colonna .livello { color: var(--grigio); }
.scala-pista { width: 100%; height: 12vh; display: flex; align-items: flex-end; border-bottom: 0.4vh solid var(--sabbia); }
.scala-barra { width: 100%; height: 0; background: var(--acqua-scuro); border-radius: 0.8vh 0.8vh 0 0; transition: height 0.5s ease-out; }
.scala-schermo.compatta { gap: 1.6vh; }
.scala-schermo.compatta .scala-affermazione { font-size: 2.7vh; }
.scala-schermo.compatta .scala-media .numero { font-size: 5.6vh; }
.scala-schermo.compatta .scala-media .su { display: none; }
.scala-schermo.compatta .scala-pista { height: 5.4vh; }
.scala-schermo.compatta .scala-colonna { font-size: 1.8vh; gap: 0.2vh; }
.scala-schermo.compatta .scala-colonna .quanti { min-height: 2.2vh; }

.bacheca {
  list-style: none; margin: 0; padding: 1vh 1vw; display: grid; gap: 2.4vh 1.8vw;
  grid-template-columns: repeat(3, 1fr); align-content: center; align-items: start; max-height: 64vh; overflow: hidden;
}
.bacheca.medie, .bacheca.tante { grid-template-columns: repeat(5, 1fr); gap: 1.8vh 1.2vw; }
.nota-carta {
  padding: 2vh 1.4vw; border-radius: 0.6vh; box-shadow: 0 0.8vh 2vh rgba(35, 31, 32, 0.16);
  font-size: 3vh; line-height: 1.3; word-break: break-word; overflow-wrap: anywhere;
  animation: sboccia 0.5s ease-out both;
}
.bacheca.medie .nota-carta { font-size: 2.2vh; padding: 1.4vh 1vw; }
.bacheca.tante .nota-carta { font-size: 1.8vh; padding: 1.2vh 0.9vw; line-height: 1.25; }
.tono-0 { background: #fff3c4; }
.tono-1 { background: #cfe8eb; }
.tono-2 { background: #f2d28b; }

.nuvola { display: block; width: 100%; height: 60vh; overflow: hidden; }
.nuvola text {
  font-family: var(--titoli); font-weight: 700; text-anchor: middle; fill: currentColor;
  animation: nuvola-entra 0.7s ease-out both;
  transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), font-size 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes nuvola-entra { from { opacity: 0; font-size: 0.3vh; } }
.tinta-0 { color: var(--verde); }
.tinta-1 { color: var(--acqua-scuro); }
.tinta-2 { color: var(--ocra-scuro); }
.tinta-3 { color: var(--nero); }
.tinta-4 { color: #b3541e; }

#strato { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 5; pointer-events: none; overflow: hidden; }
.vola { position: absolute; bottom: -10vh; opacity: 0; animation: sale 3.2s ease-out both; }
@keyframes sale {
  0% { transform: translateY(0) scale(0.6); opacity: 0; }
  12% { opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translateY(-78vh) scale(1.25); opacity: 0; }
}

/* --- Pannello moderatore --- */

.pannello { max-width: 980px; margin: 0 auto; padding: 16px 14px 60px; }
.pannello-testata { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.pannello-testata .logo { height: 38px; }
.accesso { max-width: 380px; margin: 8vh auto 0; }
.elenco { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.attivita { border-left: 6px solid var(--sabbia); }
.attivita.corrente { border-left-color: var(--verde); box-shadow: 0 0 0 2px var(--verde), var(--ombra); }
.attivita h3 { margin: 4px 0 6px; }
.riassunto { font-size: 0.92rem; color: var(--grigio); margin-bottom: 10px; overflow-wrap: anywhere; }
.codice-grande { font-family: var(--titoli); font-size: 1.6rem; font-weight: 700; color: var(--rosso); letter-spacing: 0.1em; }
.colonne { display: grid; gap: 16px; }
@media (min-width: 860px) { .colonne { grid-template-columns: 1.4fr 1fr; align-items: start; } }

.coda { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.coda li { display: grid; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--crema); border-left: 5px solid var(--sabbia); }
.coda li.answering { border-left-color: var(--rosso); }
.coda li.answered { opacity: 0.65; }
.coda-testo { word-break: break-word; overflow-wrap: anywhere; }
.coda-bassa { max-height: 260px; overflow-y: auto; }
.conteggi { font-size: 1.15rem; margin: 10px 0; white-space: pre-wrap; }
.parole-mod { justify-content: flex-start; max-height: 220px; overflow-y: auto; margin-bottom: 10px; }
.parole-mod li { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; font-weight: 400; background: var(--crema); border: 1px solid var(--sabbia); }
.parole-mod li.nascosta { opacity: 0.7; text-decoration: line-through; }
.parole-mod li.nascosta .btn-testo { text-decoration: none; }
.btn-testo {
  border: 0; background: none; padding: 4px 6px; font: inherit; font-size: 0.85rem; font-weight: 600;
  color: var(--verde-scuro); text-decoration: underline; cursor: pointer; border-radius: 6px;
}

/* --- Animazioni --- */

@keyframes sboccia { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes entra-su { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.compare { animation: entra-su 0.35s ease-out both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .vola { bottom: 4vh; opacity: 1; }
}
