@font-face {
  font-family: "Archivo";
  src: url("/archivo.woff") format("woff");
  font-weight: 400 800;
  font-stretch: 100% 125%;
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --ink: var(--accent, #004685);
  --ink-soft: #55708f;
  --line: #cfdbe8;
  --tint: #eef3f9;
  --error: #b3261e;
  --rule: 1px solid var(--line);
  --pad: 20px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Archivo", system-ui, sans-serif;
  font-stretch: 100%;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.header, .screen, .footer {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

/* Intestazione fissa: logo e nome dell'evento */

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-top: max(14px, env(safe-area-inset-top));
  padding-bottom: 12px;
  background: var(--paper);
  border-bottom: var(--rule);
}

.brand { display: flex; align-items: center; gap: 14px; }
.logo { display: block; height: 36px; width: auto; }

.headline {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.1;
  font-weight: 600;
  font-stretch: 108%;
  letter-spacing: -.01em;
}

/* i tre stati decisi dalla regia: uno visibile alla volta */
.screen { flex: 1 0 auto; padding-bottom: 32px; }
.screen[hidden] { display: none; }

.waiting { padding-top: 48px; }
.waiting-text { margin: 0; font-size: 1.35rem; line-height: 1.3; font-weight: 500; }
.waiting-note { margin: 10px 0 0; color: var(--ink-soft); font-size: .9rem; }

.back { margin-top: 14px; }

.film { padding: 18px 0 8px; }

.title {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.2;
  font-weight: 600;
  font-stretch: 104%;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.mark {
  flex: none;
  width: 13px;
  height: 13px;
  border: 1.5px solid #9db4cf;
  border-radius: 50%;
  transform: translateY(1px);
  transition: background-color .2s, border-color .2s;
}

.film.done .mark { background: var(--ink); border-color: var(--ink); }

.link-btn {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: .95rem;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  cursor: pointer;
}

.link-btn[hidden] { display: none; }

/* Riepilogo dei titoli già presentati */

.recap { padding-top: 24px; }
.recap-head { margin: 0; font-size: 1.5rem; font-weight: 600; font-stretch: 104%; }
.recap-count { margin: 6px 0 0; color: var(--ink-soft); }
.recap-list { margin: 20px 0 0; padding: 0; list-style: none; border-top: var(--rule); }
.recap-list li { border-bottom: var(--rule); }

.recap-film {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  align-items: baseline;
  width: 100%;
  padding: 14px 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.recap-title { font-weight: 600; font-size: 1.05rem; }
.recap-detail { grid-column: 2; margin-top: 2px; color: var(--ink-soft); font-size: .88rem; }
.recap-list li:not(.done) .recap-detail { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.recap-list li.done .mark { background: var(--ink); border-color: var(--ink); }
.recap-note { margin: 16px 0 32px; color: var(--ink-soft); font-size: .88rem; }

/* Domande: etichetta leggera sopra ogni risposta, nessun filetto fra una domanda e l'altra */

.questions { margin-top: 2px; }
.film [data-question] { scroll-margin-top: 190px; }

.questions > * { margin: 14px 0 0; padding: 0; border: 0; min-width: 0; }

.question {
  display: block;
  margin: 0 0 8px;
  padding: 0;
  font-size: .98rem;
  font-weight: 500;
}

/* 4: conferma accanto alla domanda appena salvata */

.saved {
  margin-left: 8px;
  color: var(--ink-soft);
  font-size: .82rem;
  font-weight: 400;
  opacity: 0;
  transition: opacity .25s;
}

.is-saved .saved { opacity: 1; transition: none; }

.hint { color: var(--ink-soft); font-weight: 400; font-size: .88rem; }

/* Scala 1-5: cerchi da compilare, come su una scheda di valutazione */

.scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  max-width: 300px;
}

.anchors {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  margin-top: -2px;
  color: var(--ink-soft);
  font-size: .78rem;
}

.scale label, .choices label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #9db4cf;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .12s, color .12s;
}

.scale label {
  aspect-ratio: 1;
  min-height: 46px;
  border-radius: 50%;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

/* Scelte: pillole con lo stesso tratto dei cerchi */

.choices { display: flex; flex-wrap: wrap; gap: 8px; }

.choices label {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: .95rem;
}

.choices.even { display: grid; grid-template-columns: repeat(3, 1fr); max-width: 300px; }
.choices.even label { padding: 0 8px; }

.choices.multi label.on::before {
  content: "";
  width: 5px;
  height: 9px;
  margin: -3px 8px 0 -2px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.scale input, .choices input { position: absolute; inset: 0; opacity: 0; margin: 0; pointer-events: none; }
.scale label.on, .choices label.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.scale label:active, .choices label:active { background: var(--tint); }
.scale label.on:active, .choices label.on:active { background: var(--ink); }

.recap-film:focus-visible, .link-btn:focus-visible, .scale label:focus-within, .choices label:focus-within, .credits-link:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* Footer */

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-top: 8px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.credits-label { margin: 0; color: var(--ink-soft); font-size: .7rem; }
.credits-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; }
.credits-link img { display: block; height: 13px; width: auto; }

/* Conferma */

.toast {
  position: fixed;
  left: var(--pad);
  right: var(--pad);
  bottom: max(20px, calc(env(safe-area-inset-bottom) + 8px));
  max-width: 520px;
  margin: 0 auto;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  z-index: 20;
}

.toast.error { background: var(--error); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Regia: pensata per un portatile, stesso segno della scheda */

body.regia .header, body.regia .screen { max-width: 760px; }

.login { padding-top: 32px; }
.password {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 10px 0 14px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  border: var(--rule);
  border-radius: 8px;
}
.password:focus { outline: none; border-color: var(--ink); }
.login-error { margin: 12px 0 0; color: var(--error); font-weight: 500; }

.regia-btn {
  min-height: 44px;
  padding: 0 22px;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.regia-btn.on { color: var(--paper); background: var(--ink); border-color: var(--ink); }

.console { padding-top: 20px; }
.connected { margin: 0 0 16px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.regia-modes { display: flex; gap: 10px; }
.regia-list { margin: 22px 0 0; padding: 0; list-style: none; border-top: var(--rule); }
.regia-list li { border-bottom: var(--rule); }
.regia-film {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  width: 100%;
  padding: 14px 10px;
  font: inherit;
  color: var(--ink);
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}
.regia-film:hover { background: var(--tint); }
.regia-film.presented .mark { background: var(--ink); border-color: var(--ink); }
.regia-film.on { color: var(--paper); background: var(--ink); }
.regia-film.on .mark { background: var(--paper); border-color: var(--paper); }
.regia-film.on .recap-detail { color: var(--paper); }
.regia-btn:focus-visible, .regia-film:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
