/* Wrapped 2026 — stessa famiglia visiva del sito: carta, inchiostro, un solo accento. */

:root {
  --paper: #fbf7f1;
  --paper-line: #e7ddd0;
  --ink: #111111;
  --soft: #6f655d;
  --red: #c8372d;
  --tile-ok: #4f8f4a;
  --tile-near: #d2a02a;
  --tile-no: #8b8178;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@font-face {
  font-family: "Tanker";
  src: url("../Tanker-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Manrope", Arial, Helvetica, sans-serif;
  background: #1b1917;
  color: var(--ink);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
}

/* ---------- PIN (uguale al sito) ---------- */

.site-lock {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(180deg, #fffaf4, #f3e8dd);
}

.site-lock[hidden] {
  display: none;
}

.site-lock-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid rgba(17, 17, 17, 0.1);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 24px 46px rgba(0, 0, 0, 0.1);
}

.site-lock-kicker {
  margin: 0 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--soft);
}

.site-lock-card h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 0.95;
}

.site-lock-copy {
  margin: 14px 0 18px;
  line-height: 1.6;
  color: var(--soft);
}

.site-lock-input {
  width: 100%;
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(17, 17, 17, 0.14);
  border-radius: 16px;
  font: inherit;
  font-size: 1.05rem;
  letter-spacing: 0.18em;
  text-align: center;
}

.site-lock-button {
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fffaf5;
  cursor: pointer;
}

.site-lock-error {
  margin: 12px 0 0;
  color: #9d3448;
  font-size: 0.92rem;
}

/* ---------- Cornice ---------- */

.stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
}

.frame {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--ink);
  user-select: none;
}

@media (min-width: 620px) {
  .frame {
    width: min(430px, calc((100dvh - 48px) * 0.5));
    height: min(100dvh - 48px, 900px);
    border-radius: 26px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  }
}

/* ---------- Barra di avanzamento ---------- */

.progress {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 14px;
  right: 14px;
  z-index: 10;
  display: flex;
  gap: 3px;
  pointer-events: none;
}

.progress span {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.22;
  transition: opacity 240ms ease;
}

.progress span.is-done {
  opacity: 0.95;
}

.topbar {
  position: absolute;
  top: calc(max(12px, env(safe-area-inset-top)) + 14px);
  left: 18px;
  right: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topbar a {
  padding: 8px;
  color: inherit;
  text-decoration: none;
  opacity: 0.7;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.sound {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
}

.sound[hidden] {
  display: none;
}

.sound svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sound .sound-off,
.sound[aria-pressed="false"] .sound-on {
  display: none;
}

.sound[aria-pressed="false"] .sound-off {
  display: inline;
}

.sound:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -6px;
}

.frame .progress,
.frame .topbar {
  color: var(--paper);
}

/* ---------- Schede ---------- */

/* Ogni scheda ha una foto in alto che sfuma nel colore del tema; il testo sta in basso.
   --foto: immagine, --pos: punto da tenere inquadrato, --foto-h: quanta altezza occupa. */
.slide {
  --foto-h: 56%;
  --pos: center;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 18px;
  padding: 84px 26px max(34px, env(safe-area-inset-bottom));
  background-color: var(--bg);
  isolation: isolate;
  opacity: 0;
  visibility: hidden;
  transition: opacity 320ms ease, visibility 0s linear 320ms;
}

.slide.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity 320ms ease;
}

.slide::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: -1;
  height: var(--foto-h);
  background: var(--foto) var(--pos) / cover no-repeat;
}

.slide::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(17, 17, 17, 0.5) 0%, rgba(17, 17, 17, 0) 15%),
    linear-gradient(180deg, transparent calc(var(--foto-h) * 0.5), var(--bg) calc(var(--foto-h) - 1px));
  pointer-events: none;
}

.slide.is-dense {
  --foto-h: 40%;
}

.slide.t-paper {
  --bg: var(--paper);
  color: var(--ink);
}

.slide.t-ink {
  --bg: var(--ink);
  color: var(--paper);
}

.slide.t-red {
  --bg: var(--red);
  color: var(--paper);
}

/* Foto a tutta altezza, testo sopra */
.slide.t-photo {
  --bg: var(--ink);
  --foto-h: 100%;
  color: var(--paper);
}

.slide.t-photo::after {
  background: linear-gradient(180deg, rgba(17, 17, 17, 0.5) 0%, rgba(17, 17, 17, 0) 26%, rgba(17, 17, 17, 0.12) 46%, rgba(17, 17, 17, 0.8) 66%, rgba(17, 17, 17, 0.94) 100%);
}

.slide.t-photo.is-game::after {
  background: rgba(17, 17, 17, 0.64);
}

/* Entrata a scalare */
.slide > * {
  opacity: 0;
  transform: translateY(14px);
}

.slide.is-active > * {
  opacity: 1;
  transform: none;
  transition: opacity 520ms var(--ease), transform 620ms var(--ease);
  transition-delay: calc(var(--i, 0) * 90ms + 120ms);
}

.slide > *:nth-child(1) { --i: 0; }
.slide > *:nth-child(2) { --i: 1; }
.slide > *:nth-child(3) { --i: 2; }
.slide > *:nth-child(4) { --i: 3; }
.slide > *:nth-child(5) { --i: 4; }
.slide > *:nth-child(6) { --i: 5; }

/* ---------- Tipografia ---------- */

.kicker {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.72;
}

.title {
  margin: 0;
  font-family: "Tanker", "Cormorant Garamond", serif;
  font-weight: 400;
  font-size: clamp(2.5rem, 12.5vw, 3.5rem);
  line-height: 0.94;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

.title.is-cover {
  font-size: clamp(3.6rem, 19vw, 5rem);
  line-height: 0.88;
}

.title.is-small {
  font-size: clamp(2rem, 9.4vw, 2.7rem);
}

.figure {
  margin: 0;
  font-family: "Tanker", "Cormorant Garamond", serif;
  font-weight: 400;
  font-size: clamp(5rem, 28vw, 7.6rem);
  line-height: 0.84;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}

.figure.is-mid {
  font-size: clamp(3.6rem, 19vw, 5.2rem);
}

.figure small {
  display: block;
  margin-top: 12px;
  font-family: "Manrope", Arial, sans-serif;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0;
}

.copy {
  margin: 0;
  max-width: 34ch;
  font-size: 1.02rem;
  line-height: 1.5;
}

.copy.is-soft {
  opacity: 0.74;
  font-size: 0.92rem;
}

.quote {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-weight: 600;
  font-size: clamp(1.9rem, 8.6vw, 2.5rem);
  line-height: 1.08;
  text-wrap: balance;
}

.quote.is-small {
  font-size: clamp(1.3rem, 5.8vw, 1.6rem);
  line-height: 1.2;
}

.source {
  margin: -8px 0 0;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  opacity: 0.72;
}

/* ---------- Righe di dati ---------- */

.rows {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid currentColor;
}

.rows li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid color-mix(in srgb, currentColor 28%, transparent);
  font-size: 0.98rem;
  line-height: 1.35;
}

.rows li b {
  font-family: "Tanker", serif;
  font-weight: 400;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rows li span small {
  display: block;
  margin-top: 2px;
  font-size: 0.82rem;
  opacity: 0.7;
}

.rows.is-stacked li {
  grid-template-columns: 1fr;
  gap: 2px;
}

.rows.is-stacked li span {
  font-size: 1.04rem;
}

.rows.is-stacked li strong {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.72;
}

/* ---------- Confronto a barre ---------- */

.duel {
  display: grid;
  gap: 14px;
}

.duel-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  align-items: baseline;
  font-size: 0.95rem;
}

.duel-row b {
  font-family: "Tanker", serif;
  font-weight: 400;
  font-size: 1.45rem;
  font-variant-numeric: tabular-nums;
}

.duel-bar {
  grid-column: 1 / -1;
  height: 12px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  overflow: hidden;
}

.duel-bar i {
  display: block;
  width: var(--w);
  height: 100%;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
}

.slide.is-active .duel-bar i {
  transform: scaleX(1);
  transition: transform 900ms var(--ease) 520ms;
}

/* ---------- Domande ---------- */

.choices {
  display: grid;
  gap: 10px;
}

.choice {
  padding: 16px 18px;
  border: 2px solid currentColor;
  border-radius: 16px;
  background: transparent;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms var(--ease);
}

.choice:active {
  transform: scale(0.98);
}

.quiz .ask {
  display: contents;
}

.quiz .answer {
  display: none;
}

.quiz.is-answered .ask {
  display: none;
}

.quiz.is-answered .answer {
  display: contents;
}

.verdict {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Tessere di Parole ---------- */

.tiles {
  display: flex;
  gap: 6px;
}

.tile {
  display: grid;
  place-items: center;
  width: 48px;
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--tile-ok);
  color: #fff;
  font-family: "Tanker", serif;
  font-size: 1.7rem;
  text-transform: uppercase;
}

.game {
  display: grid;
  gap: 6px;
  justify-content: center;
}

.game-row {
  display: grid;
  grid-template-columns: repeat(5, min(13.2vw, 52px));
  gap: 6px;
}

@media (min-width: 620px) {
  .game-row {
    grid-template-columns: repeat(5, 48px);
  }
}

.cell {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 2px solid var(--paper-line);
  border-radius: 8px;
  background: #fff;
  font-family: "Tanker", serif;
  font-size: 1.55rem;
  text-transform: uppercase;
}

.cell.is-filled {
  border-color: var(--ink);
}

.cell.is-ok,
.key.is-ok {
  border-color: var(--tile-ok);
  background: var(--tile-ok);
  color: #fff;
}

.cell.is-near,
.key.is-near {
  border-color: var(--tile-near);
  background: var(--tile-near);
  color: #fff;
}

.cell.is-no,
.key.is-no {
  border-color: var(--tile-no);
  background: var(--tile-no);
  color: #fff;
}

.game-row.is-shake {
  animation: shake 320ms ease;
}

@keyframes shake {
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.keyboard {
  display: grid;
  gap: 6px;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.key {
  flex: 1 1 0;
  max-width: 38px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--paper-line);
  border-radius: 7px;
  background: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
}

.key.is-wide {
  flex: 1.7 1 0;
  max-width: 62px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.slide.is-game {
  justify-content: flex-start;
  gap: 14px;
  padding-top: 78px;
}

.slide.is-game .title {
  font-size: clamp(1.9rem, 8.6vw, 2.4rem);
}

.game-status {
  min-height: 1.4em;
  margin: 0;
  font-size: 0.92rem;
  text-align: center;
}

.cta {
  align-self: flex-start;
  padding: 14px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  cursor: pointer;
}

.slide.is-game .cta {
  align-self: center;
}

.t-ink .cta,
.t-red .cta {
  background: var(--paper);
  color: var(--ink);
}

a.cta {
  text-decoration: none;
}

.hint {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.6;
}

.signoff {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-weight: 600;
  font-size: 1.5rem;
}

[hidden] {
  display: none !important;
}

@media (max-height: 700px) {
  .slide {
    gap: 12px;
    padding-top: 70px;
  }

  .rows li {
    padding: 8px 0;
    font-size: 0.92rem;
  }

  .figure {
    font-size: clamp(4.2rem, 23vw, 6rem);
  }

  .key {
    height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .slide,
  .slide.is-active,
  .slide > *,
  .slide.is-active > *,
  .slide.is-active .duel-bar i {
    transition: none;
  }

  .slide > * {
    transform: none;
  }

  .duel-bar i {
    transform: scaleX(1);
  }

  .game-row.is-shake {
    animation: none;
  }
}

/* Il gioco sta sopra una foto scurita: caselle e tasti restano chiari */
.cell,
.key {
  color: var(--ink);
}

.t-photo .cta {
  background: var(--paper);
  color: var(--ink);
}
