/* Colors & Minds — sito di presentazione e pagine legali.
   Un solo carattere (Bricolage Grotesque, variabile: opsz, wdth, wght),
   servito dal sito stesso: nessuna richiesta a server di terzi. */

@font-face {
  font-family: "Bricolage";
  src: url("/fonts/bricolage.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}

:root {
  --paper: #eef0f3;
  --ink: #15171c;
  --muted: #565c68;
  --rule: #c9ced6;
  --screen: #0d1117;
  --screen-ink: #e6edf3;
  --screen-muted: #8b949e;
  --focus: #1e88e5;

  /* Colori di gioco: gli stessi dell'app (AppColors.game*). */
  --red: #e53935;
  --green: #43a047;
  --blue: #1e88e5;
  --yellow: #fdd835;
  --orange: #fb8c00;
  --purple: #8e24aa;

  --measure: 66ch;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #171a20;
    --ink: #e6edf3;
    --muted: #9aa3b0;
    --rule: #2d333d;
    --focus: #58a6ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #171a20;
  --ink: #e6edf3;
  --muted: #9aa3b0;
  --rule: #2d333d;
  --focus: #58a6ff;
  color-scheme: dark;
}

/* Il sito è in due lingue: si mostra solo il testo della lingua attiva. */
html[lang="it"] body [lang="en"],
html[lang="en"] body [lang="it"] { display: none !important; }

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Bricolage", system-ui, sans-serif;
  font-size: 1.125rem;
  line-height: 1.55;
  font-variation-settings: "opsz" 14;
  overflow-x: hidden;
}

a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  background: var(--ink);
  color: var(--paper);
  padding: 8px 14px;
  border-radius: 8px;
  z-index: 10;
}
.skip:focus { top: 12px; }

/* ── Testata ──────────────────────────────────────────── */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1160px;
  margin: 0 auto;
  padding: 20px var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.125rem;
  font-variation-settings: "opsz" 24;
  letter-spacing: -0.01em;
}
.brand img { width: 40px; height: 40px; border-radius: 10px; }

.top-actions { display: flex; align-items: center; gap: 8px; }

.lang {
  font: inherit;
  font-size: 0.9375rem;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
.lang:hover { border-color: var(--ink); }

.top-play {
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
}

/* ── Hero ─────────────────────────────────────────────── */

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
  max-width: 1160px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 56px) var(--gutter) clamp(56px, 8vw, 104px);
}
@media (min-width: 920px) {
  .hero { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); }
}

.hero h1 {
  margin: 0 0 24px;
  font-size: clamp(2.5rem, 6.2vw, 4.75rem);
  line-height: 0.98;
  font-weight: 750;
  font-variation-settings: "opsz" 96;
  letter-spacing: -0.035em;
  max-width: 12ch;
  text-wrap: balance;
}

.hero .lede {
  margin: 0 0 32px;
  max-width: 36ch;
  font-size: clamp(1.125rem, 1.6vw, 1.3125rem);
  color: var(--muted);
}

.ctas { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 24px;
  border-radius: 14px;
  font: inherit;
  font-weight: 650;
  font-size: 1.0625rem;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid var(--ink);
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-secondary { background: transparent; color: var(--ink); }
.btn-primary:hover { text-decoration: underline; }
.btn-secondary:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.btn svg { width: 20px; height: 20px; flex: none; }

.cta-note { margin: 14px 0 0; font-size: 0.9375rem; color: var(--muted); }

/* ── Lo schermo di prova ─────────────────────────────── */

.screen {
  container-type: inline-size;
  position: relative;
  width: 100%;
  max-width: 460px;
  justify-self: center;
  background: var(--screen);
  color: var(--screen-ink);
  border-radius: 28px;
  padding: 22px 20px 20px;
  border: 1px solid #30363d;
  box-shadow: 0 30px 60px -30px rgba(13, 17, 23, 0.55);
}

.screen-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 0.875rem;
  color: var(--screen-muted);
  min-height: 1.4em;
}

.timer {
  height: 4px;
  margin: 12px 0 0;
  border-radius: 2px;
  background: #21262d;
  overflow: hidden;
}
.timer span {
  display: block;
  height: 100%;
  width: 100%;
  background: #3fb950;
  transform-origin: left center;
}

.stage {
  min-height: 272px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px 4px 16px;
}

.prompt {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--screen-muted);
}

/* La parola-stimolo: stretta e pesantissima, scala con il riquadro e con
   la lunghezza della parola (--len, impostata dallo script). */
.word {
  margin: 4px 0 0;
  font-weight: 800;
  font-stretch: 75%;
  font-variation-settings: "opsz" 96;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  line-height: 1;
  font-size: min(7.5rem, calc(150cqi / (var(--len, 5) + 1.4)));
  white-space: nowrap;
}

.result h2 {
  margin: 0 0 10px;
  font-size: 1.75rem;
  line-height: 1.1;
  font-weight: 750;
  font-variation-settings: "opsz" 48;
  letter-spacing: -0.02em;
}
.result p { margin: 0 auto 6px; max-width: 30ch; color: var(--screen-muted); font-size: 1rem; }
.result .again {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.result .btn { min-height: 46px; font-size: 1rem; border-color: var(--screen-ink); }
.result .btn-primary { background: var(--screen-ink); color: var(--screen); }
.result .btn-secondary { color: var(--screen-ink); }

.choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice {
  font: inherit;
  font-size: clamp(0.8125rem, 3.6cqi, 0.9375rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  min-height: 56px;
  padding: 0 4px;
  border-radius: 16px;
  border: 2px solid transparent;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: transform 120ms ease-out;
}
.choice:active { transform: scale(0.94); }
.choice[data-c="red"] { background: var(--red); }
.choice[data-c="green"] { background: var(--green); }
.choice[data-c="blue"] { background: var(--blue); }
.choice[data-c="yellow"] { background: var(--yellow); color: #15171c; text-shadow: none; }
.choice[data-c="orange"] { background: var(--orange); }
.choice[data-c="purple"] { background: var(--purple); }
.choice:disabled { cursor: default; }
.choices.is-idle .choice { opacity: 0.3; }
.choice:focus-visible { outline-color: var(--screen-ink); }

.keys {
  margin: 12px 0 0;
  font-size: 0.8125rem;
  color: var(--screen-muted);
  text-align: center;
}
@media (pointer: coarse) { .keys { display: none; } }

/* Risposta sbagliata: lo schermo trema. Come nell'app, nessun rosso/verde
   di feedback, che si confonderebbe con i colori di gioco. */
.screen.is-wrong { animation: shake 320ms ease-in-out; }
@keyframes shake {
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}

/* ── Sezioni ──────────────────────────────────────────── */

.band {
  border-top: 1px solid var(--rule);
}
.band-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: clamp(56px, 8vw, 96px) var(--gutter);
  display: grid;
  gap: 24px 64px;
}
@media (min-width: 920px) {
  .band-inner { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
}

.band h2 {
  margin: 0;
  font-size: clamp(1.75rem, 3.4vw, 2.5rem);
  line-height: 1.05;
  font-weight: 750;
  font-variation-settings: "opsz" 72;
  letter-spacing: -0.025em;
  max-width: 14ch;
}
.band p { margin: 0 0 1em; max-width: var(--measure); }
.band p:last-child { margin-bottom: 0; }

/* Le due domande, sulla stessa parola. */
.modes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}
.specimen {
  margin: 0 0 4px;
  font-weight: 800;
  font-stretch: 75%;
  font-variation-settings: "opsz" 96;
  text-transform: uppercase;
  font-size: clamp(4rem, 12vw, 7.5rem);
  line-height: 0.9;
  color: var(--purple);
  letter-spacing: -0.01em;
}
:root[data-theme="dark"] .specimen { color: #b45bd0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .specimen { color: #b45bd0; }
}
.mode-pair {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
}
@media (min-width: 600px) { .mode-pair { grid-template-columns: 1fr 1fr; } }
.mode h3 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 700;
  font-variation-settings: "opsz" 24;
}
.mode p { margin: 0; color: var(--muted); }
.swatch {
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  border-radius: 4px;
  vertical-align: -0.05em;
  margin-right: 0.35em;
}

/* Tabella delle difficoltà. */
.levels {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.levels caption {
  caption-side: bottom;
  text-align: left;
  padding-top: 14px;
  color: var(--muted);
  font-size: 0.9375rem;
}
.levels th, .levels td {
  text-align: left;
  padding: 14px 12px 14px 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: baseline;
}
.levels thead th { font-size: 0.9375rem; font-weight: 500; color: var(--muted); }
.levels tbody th { font-weight: 700; font-size: 1.25rem; font-variation-settings: "opsz" 24; }
.levels td:not(:first-child), .levels th:not(:first-child) { text-align: right; }
.levels tr > :last-child { padding-right: 0; }

.facts {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.facts li { padding-left: 1.2em; position: relative; max-width: var(--measure); }
.facts li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.5em;
  height: 0.5em;
  border-radius: 2px;
  background: var(--muted);
}
.facts li:nth-child(6n + 1)::before { background: var(--red); }
.facts li:nth-child(6n + 2)::before { background: var(--green); }
.facts li:nth-child(6n + 3)::before { background: var(--blue); }
.facts li:nth-child(6n + 4)::before { background: var(--yellow); }
.facts li:nth-child(6n + 5)::before { background: var(--orange); }
.facts li:nth-child(6n + 6)::before { background: var(--purple); }

/* ── Piè di pagina ────────────────────────────────────── */

.foot {
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
  color: var(--muted);
}
.foot-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 32px var(--gutter) 48px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px 32px;
}
.foot p { margin: 0; }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }

/* ── Pagine legali ────────────────────────────────────── */

.doc {
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(24px, 5vw, 56px) var(--gutter) 80px;
}
.doc h1 {
  margin: 0 0 8px;
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  line-height: 1;
  font-weight: 750;
  font-variation-settings: "opsz" 96;
  letter-spacing: -0.03em;
}
.doc .updated { margin: 0 0 32px; color: var(--muted); font-size: 0.9375rem; }
.doc .summary {
  margin: 0 0 40px;
  padding: 20px 22px;
  border-left: 4px solid var(--blue);
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  border-radius: 0 12px 12px 0;
}
.doc .summary p { margin: 0; }
.doc nav.toc { margin: 0 0 48px; }
.doc nav.toc h2 { font-size: 1rem; margin: 0 0 8px; font-weight: 600; color: var(--muted); }
.doc nav.toc ol { margin: 0; padding-left: 1.4em; columns: 2 16em; column-gap: 32px; }
.doc nav.toc li { margin: 0 0 4px; break-inside: avoid; }
.doc h2 {
  margin: 48px 0 12px;
  font-size: 1.5rem;
  line-height: 1.15;
  font-weight: 700;
  font-variation-settings: "opsz" 36;
  letter-spacing: -0.015em;
  scroll-margin-top: 16px;
}
.doc h3 { margin: 28px 0 8px; font-size: 1.125rem; font-weight: 700; }
.doc p, .doc li { max-width: var(--measure); }
.doc ul { padding-left: 1.3em; }
.doc li { margin: 0 0 6px; }
.doc .tag {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 1px 9px;
  vertical-align: 0.2em;
}

/* ── Movimento ridotto ────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .screen.is-wrong { animation: none; }
}

/* Testata sui telefoni stretti: il nome resta su una riga. */
.brand { white-space: nowrap; }
/* Sul telefono i due pulsanti occupano tutta la larghezza, uno sopra l'altro. */
@media (max-width: 520px) {
  .ctas { flex-direction: column; }
  .ctas .btn { width: 100%; }
}
@media (max-width: 420px) {
  .top { gap: 8px; }
  .brand { gap: 8px; font-size: 1rem; }
  .brand img { width: 32px; height: 32px; border-radius: 8px; }
  .lang, .top-play { padding: 6px 11px; }
}
