/*
  Prenotazioni · ParcheggiAPP, presentazione. Direzione A «Chiara e ordinata»:
  fondo chiaro dell'app, indaco come unico accento, segnaletica orizzontale leggera
  (stalli visti dall'alto, codici P·00 in monospazio, corsia e mezzeria tratteggiate).
  Lo stallo pieno è ciò che esiste già, quello tratteggiato è l'evoluzione possibile.
  Contrasti misurati in .tmp/prenotazioni/design-A/direzione.md: tutti i testi ≥ 4,5:1.
*/
:root {
  /* Colori dell'app */
  --fondo: #f3f3f3;          /* sfondo delle pagine dell'app */
  --carta: #ffffff;          /* card, superfici */
  --indaco: #4361ee;         /* accento: voce attiva, pulsanti, stallo assegnato, marchio */
  --hover: #f1f5f9;
  --ink: #1e293b;            /* testo principale */
  --slate: #64748b;          /* testo secondario: SOLO su bianco (4,76:1) */
  --verde: #198754;
  --giallo: #ffc107;
  --rosso: #dc3545;          /* solo stati, mai colore di marca */

  /* Toni derivati */
  --indaco-testo: #3a54e0;   /* indaco per testi su fondo chiaro (5,37:1 su #f3f3f3) */
  --indaco-scuro: #2f45c4;   /* hover e pressione */
  --indaco-tenue: #eef1fd;   /* velatura dello stallo assegnato */
  --indaco-velo: rgba(67, 97, 238, .2);
  --slate-testo: #556274;    /* testo secondario su #f3f3f3 (5,59:1) */
  --linea: #dfe3ea;
  --stallo: #cdd3dd;         /* strisce degli stalli (grafica, non testo) */
  --auto: #e7eaef;           /* sagome delle auto negli stalli vicini */
  --notte: #1e293b;          /* player e tooltip */

  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "SF Pro Text", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", -apple-system, "SF Pro Display", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Mono", "SF Mono", ui-monospace, Consolas, Menlo, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* Kit movimento (etichette fluttuanti) e scrittura (campo, manina) */
  --mv-surface: var(--carta); --mv-text: var(--ink); --mv-line: var(--linea); --mv-accent: var(--indaco); --mv-accent-ink: #fff;
  --mv-highlight: #a3cfbb; --mv-muted: var(--slate-testo);
  --ty-text: var(--ink); --ty-muted: var(--slate); --ty-caret: var(--indaco); --ty-send: var(--indaco); --ty-ring: var(--indaco);
  --ty-finger: #fff; --ty-finger-line: var(--indaco-scuro); --ty-finger-mark: #b9c5f8;

  /* Kit postazione: Mac, Windows e iPhone con i colori della presentazione */
  --st-font: var(--font);
  --st-accent: var(--indaco);
  --st-pick-fg: var(--ink);
  --st-pick-border: var(--linea);
  --st-pick-on-bg: var(--indaco);
  --st-pick-on-fg: #fff;
  --st-mac-wallpaper: radial-gradient(90% 70% at 12% 0%, #ffffff 0%, transparent 60%), radial-gradient(80% 80% at 100% 100%, #6f86f2 0%, transparent 62%), linear-gradient(160deg, #e9edfd 0%, #b8c4f8 52%, #7d93f3 100%);
  --st-win-wallpaper: radial-gradient(70% 90% at 50% 112%, #4361ee 0%, transparent 70%), radial-gradient(60% 60% at 50% 70%, #c9d3fb 0%, transparent 70%), linear-gradient(180deg, #f3f5fe 0%, #c4cffa 55%, #8196f4 100%);
  --st-phone-wallpaper: radial-gradient(100% 60% at 0% 0%, #c9d3fb 0%, transparent 60%), radial-gradient(100% 70% at 100% 100%, #2f45c4 0%, transparent 65%), linear-gradient(170deg, #8fa2f7 0%, #5a76f2 50%, #2f45c4 100%);

  font-family: var(--font);
  color-scheme: light;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html.story-guided { scroll-behavior: auto; }
body { margin: 0; background: var(--fondo); color: var(--ink); overflow-x: hidden; }
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2 { font-family: var(--font-display); font-weight: 650; letter-spacing: -0.032em; line-height: 1.04; text-wrap: balance; }
h1 { font-size: clamp(40px, min(4.9vw, 8vh), 80px); }
h2 { font-size: clamp(32px, min(3.5vw, 6.4vh), 58px); }
.soft { color: var(--indaco-testo); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .35; }
:where(button, a):focus-visible { outline: 3px solid var(--indaco); outline-offset: 3px; }
img { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 12px; left: 16px; z-index: 100; transform: translateY(-160%); background: #fff; color: var(--ink); padding: 12px 20px; font-weight: 700; border-radius: 8px; transition: transform .2s ease; }
.skip-link:focus { transform: none; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: inherit; }

/* Testata: pillola bianca con il marchio */
.masthead { position: fixed; inset: 0 0 auto; z-index: 40; height: 72px; padding: 0 clamp(16px, 4vw, 56px); display: flex; align-items: center; pointer-events: none; }
.brand { pointer-events: auto; display: inline-flex; align-items: center; gap: 10px; padding: 5px 16px 5px 5px; border-radius: 999px; background: rgba(255, 255, 255, .92); border: 1px solid var(--linea); box-shadow: 0 8px 24px rgba(30, 41, 59, .06); font-weight: 650; font-size: 15px; letter-spacing: -.01em; backdrop-filter: blur(10px); }
.brand-mark { width: 32px; height: 32px; flex: none; }
.brand-product { padding-left: 10px; border-left: 1px solid var(--linea); color: var(--slate); font-weight: 600; font-size: 13px; }

/* Etichette di capitolo: il codice dello stallo, come dipinto sull'asfalto */
.eyebrow, .track { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; font-size: 12.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--slate-testo); }
.code { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border: 1.5px solid currentColor; border-radius: 6px; font-family: var(--font-mono); font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--indaco-testo); }
.track .is-now { display: inline-flex; align-items: center; gap: 7px; letter-spacing: .08em; }
.track .is-now::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--verde); }
/* Evoluzione possibile: bordo tratteggiato, come uno stallo non ancora tracciato */
.evo-tag { display: inline-flex; align-items: center; height: 26px; padding: 0 11px; border: 1.5px dashed var(--slate-testo); border-radius: 999px; letter-spacing: .08em; color: var(--ink); background: var(--carta); }
.proto-label { display: inline-flex; align-items: center; height: 26px; padding: 0 11px; border-radius: 999px; background: var(--indaco); color: #fff; letter-spacing: .1em; }

/* Capitoli e pulsanti */
.chapter { position: relative; min-height: 100vh; min-height: 100svh; }
.lead { margin-top: 20px; font-size: clamp(17px, 1.35vw, 20px); line-height: 1.55; color: var(--slate-testo); max-width: 40ch; }
.button { display: inline-flex; align-items: center; gap: 10px; padding: 14px 24px; border-radius: 999px; border: 0; font-weight: 650; font-size: 15px; transition: background .2s ease, transform .2s ease, box-shadow .2s ease; }
.button.primary { background: var(--indaco); color: #fff; box-shadow: 0 10px 24px -8px var(--indaco-velo), 0 4px 12px var(--indaco-velo); }
.button.primary:hover { background: var(--indaco-scuro); transform: translateY(-1px); }
.text-link { font-size: 14px; font-weight: 600; color: var(--slate-testo); }
.text-link:hover { color: var(--indaco-testo); }

/* Riquadro al posto di una schermata che non si è potuta disegnare (pr-ui.js mancante o in errore) */
.pr-missing { display: grid; place-items: center; width: 100%; height: 100%; min-height: 140px; padding: 16px; background: repeating-linear-gradient(135deg, var(--fondo) 0 14px, #fff 14px 28px); color: var(--slate-testo); font: 600 16px/1.3 var(--font); text-align: center; }
.pr-missing span { display: grid; gap: 2px; padding: 10px 18px; border-radius: 16px; background: #fff; border: 1.5px dashed var(--stallo); }
.pr-missing small { font-size: 12px; font-weight: 600; color: var(--slate); }

/* =========================================================================
   Motivo: stalli visti dall'alto
   ========================================================================= */
.lot { --gap: 26px; display: flex; align-items: stretch; pointer-events: none; }
.stall { position: relative; flex: none; width: calc(var(--pw) + var(--gap) * 2); height: calc(var(--pw) * 660 / 320 + 64px); border: 3px solid var(--stallo); border-bottom: 0; margin-left: -3px; transition: border-color .5s ease, background .5s ease; }
.stall-code { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); font: 700 11px/1 var(--font-mono); letter-spacing: .08em; color: var(--slate-testo); transition: color .4s ease; }
.stall.is-mine { z-index: 1; }
.stall.is-mine .phone-slot { position: absolute; left: var(--gap); right: var(--gap); bottom: 18px; width: auto; }
/* Sagoma di un'auto vista dall'alto, appena accennata */
.car { position: absolute; left: 25%; right: 25%; top: 30%; bottom: 14%; border-radius: 34% 34% 22% 22% / 16% 16% 10% 10%; background: var(--auto); }
.car::before { content: ""; position: absolute; left: 12%; right: 12%; top: 18%; height: 15%; border-radius: 40% 40% 12% 12%; background: rgba(255, 255, 255, .7); }
.car::after { content: ""; position: absolute; left: 14%; right: 14%; bottom: 14%; height: 9%; border-radius: 12% 12% 30% 30%; background: rgba(255, 255, 255, .55); }
.car.is-alt { top: 32%; bottom: 8%; background: #e9ebf0; }
/* Corsia: segnaletica tratteggiata */
.lane { height: 3px; background: repeating-linear-gradient(90deg, var(--stallo) 0 34px, transparent 34px 60px); }
/* Stallo assegnato: strisce indaco e una velatura chiara (apertura, esito nelle scene, chiusura) */
.stall.is-assigned, .intro-visual .stall.is-mine, .stage.is-assigned .stall.is-mine { border-color: var(--indaco); background: linear-gradient(to bottom, var(--indaco-tenue), rgba(238, 241, 253, 0) 85%); }
.intro-visual .stall.is-mine .stall-code, .stage.is-assigned .stall.is-mine .stall-code { color: var(--indaco-testo); }
/* Evoluzione: lo stallo del telefono è tratteggiato, come un posto non ancora tracciato */
.stage.is-evo .stall.is-mine { border-style: dashed; border-color: var(--slate-testo); background: none; }
.stage.is-evo .stall.is-mine .stall-code { color: var(--slate-testo); }

/* Etichette che fluttuano (kit movimento): pillole bianche con l'icona indaco */
.fluttua > span { gap: 8px; padding: 9px 15px 9px 12px; border-color: var(--linea); font-size: 15px; font-weight: 650; box-shadow: 0 14px 32px -10px rgba(30, 41, 59, .22); }
.fluttua svg, .stage-tag svg { width: 17px; height: 17px; flex: none; fill: none; stroke: var(--indaco); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.fluttua.is-ok > span { border-color: #a3cfbb; }
.fluttua.is-ok svg, .stage-tag.is-ok svg { stroke: var(--verde); }

/* =========================================================================
   00 Apertura
   ========================================================================= */
.intro { height: 100vh; height: 100svh; min-height: 600px; overflow: hidden; background: var(--fondo); }
.intro::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse 46% 70% at 72% 52%, #ffffff 0%, rgba(255, 255, 255, 0) 70%); }
.intro-copy { position: absolute; z-index: 4; left: clamp(16px, 6vw, 110px); top: 50%; transform: translateY(-46%); width: min(36rem, 40vw); }
.intro-lead { margin-top: 22px; font-size: clamp(16px, 1.3vw, 19px); line-height: 1.55; color: var(--slate-testo); max-width: 44ch; }
.intro-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: 30px; }
.intro-visual { --pw: min(272px, calc((100svh - 300px) * 320 / 660), 19vw); --stall: calc(var(--pw) + 52px - 3px); position: absolute; z-index: 3; left: 37vw; right: 0; top: 50%; transform: translateY(-48%); }
.intro-visual .lot { justify-content: flex-start; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 30%, #000 68%, transparent 96%); mask-image: linear-gradient(90deg, transparent 0, #000 30%, #000 68%, transparent 96%); }
.intro-visual .lane { margin-top: 34px; -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 70%, transparent); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 70%, transparent); }
.intro-visual .fluttua { z-index: 3; }

/* =========================================================================
   Scene: copia a sinistra, palcoscenico a destra (struttura comune)
   ========================================================================= */
.scene { background: var(--fondo); overflow: hidden; }
.spread {
  min-height: 100vh; min-height: 100svh; display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  align-items: center; gap: clamp(28px, 4vw, 72px); padding: 110px clamp(16px, 5vw, 96px) 110px; max-width: 1640px; margin: 0 auto;
}
.is-wide .spread, .is-mail .spread { grid-template-columns: minmax(0, .74fr) minmax(0, 1.26fr); }
.copy { position: relative; z-index: 2; }
.lead-note { margin-top: 14px; max-width: 44ch; padding: 10px 14px; border: 1.5px dashed var(--stallo); border-radius: 12px; font-size: 14.5px; line-height: 1.5; color: var(--slate-testo); }
.lead-note b { color: var(--ink); }
.step-choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; padding-top: 22px; background: repeating-linear-gradient(90deg, var(--stallo) 0 18px, transparent 18px 30px) top left / 100% 2px no-repeat; }
.step-choices button { padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; border: 1px solid var(--linea); background: var(--carta); color: var(--ink); transition: background .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease; }
.step-choices button:hover { background: var(--hover); border-color: #c7cfdb; }
.step-choices button[aria-pressed="true"] { background: var(--indaco); border-color: var(--indaco); color: #fff; box-shadow: 0 6px 16px var(--indaco-velo); }
/* La didascalia ha a sinistra una striscia tratteggiata: la mezzeria della corsia */
.step-caption { position: relative; margin-top: 20px; min-height: 4.8em; font-size: 16px; line-height: 1.55; color: var(--ink); max-width: 46ch; padding-left: 18px; }
.step-caption::before { content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 3px; border-radius: 2px; background: repeating-linear-gradient(to bottom, var(--indaco) 0 10px, transparent 10px 16px); }

.stage { position: relative; width: 100%; }
/* Telefono parcheggiato nello stallo: la larghezza visibile dipende dall'altezza dello schermo */
.is-phone .stage { --pw: min(300px, calc((100svh - 300px) * 320 / 660)); display: flex; flex-direction: column; align-items: center; }
.lot-scene { flex: none; justify-content: center; width: 170%; -webkit-mask-image: linear-gradient(90deg, transparent 12%, #000 40%, #000 60%, transparent 88%); mask-image: linear-gradient(90deg, transparent 12%, #000 40%, #000 60%, transparent 88%); }
.is-phone .stage .lane { width: 100%; margin-top: 22px; -webkit-mask-image: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent); mask-image: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent); }
/* Etichetta accanto al telefono: cambia a ogni passaggio */
.stage-tag { position: absolute; z-index: 3; left: calc(50% + var(--pw) / 2 - 24px); top: 22%; display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px 9px 12px; border-radius: 999px; background: var(--carta); color: var(--ink); border: 1px solid var(--linea); font-size: 15px; font-weight: 650; white-space: nowrap; box-shadow: 0 14px 32px -10px rgba(30, 41, 59, .22); }
.stage-tag:empty { display: none; }
.stage-tag.is-ok { border-color: #a3cfbb; }
.stage-tag.is-evo { border: 1.5px dashed var(--slate-testo); }
.stage-tag.is-evo svg { stroke: var(--slate-testo); }
.stage-tag .mono { font-size: 15px; }
.stage-tag.is-new { animation: tag-in .5s var(--ease) both; }
@keyframes tag-in { from { opacity: 0; transform: translateY(10px) scale(.96); } }

/* Schermate dentro i dispositivi */
.screen-layer { position: absolute; inset: 0; overflow: hidden; }
.screen-layer > .pr-app { height: 100%; }
/* Il cursore del kit scrittura lampeggia solo mentre la targa si scrive */
.ty-input:not(.is-typing) .ty-text::after { display: none; }
.phone-fallback { position: absolute; inset: 0; border-radius: 40px; overflow: hidden; background: #fff; }
/* MacBook: il browser a tutto schermo */
.is-wide .stage { max-width: min(100%, calc((100svh - 240px) * 1.55)); margin-inline: auto; }
.mb-view .mac-win.is-browser { border-radius: 0; border: 0; box-shadow: none; }
.macbook .mb-screen { box-shadow: 0 40px 80px -28px rgba(30, 41, 59, .4); }
/* PC Windows: monitor con il browser e la barra delle applicazioni */
#ingresso .stage { max-width: min(100%, calc((100svh - 270px) * 1.62)); }
.monitor .mon-screen { box-shadow: 0 40px 80px -28px rgba(30, 41, 59, .4); }
.desk { background: var(--st-win-wallpaper); }
.desk .wf-win.is-browser { border-radius: 0; border: 0; box-shadow: none; }
.desk .wf-win.is-browser .wf-body { display: flex; flex-direction: column; overflow: hidden; background: var(--fondo); }
.win-addr { flex: 0 0 38px; display: flex; align-items: center; padding: 0 12px; background: #f7f8fa; border-bottom: 1px solid #e2e5ea; }
.win-addr span { flex: 1; display: flex; align-items: center; gap: 8px; height: 26px; padding: 0 12px; border-radius: 999px; background: #fff; border: 1px solid #e2e5ea; font-size: 12.5px; color: #3b4350; }
.win-lock { position: relative; width: 8px; height: 7px; border-radius: 1px; background: #8b95a3; margin-top: 3px; flex: none; }
.win-lock::before { content: ""; position: absolute; left: 1px; top: -5px; width: 4px; height: 5px; border: 1.5px solid #8b95a3; border-bottom: 0; border-radius: 3px 3px 0 0; }
.win-page { position: relative; flex: 1; min-height: 0; overflow: hidden; }

/* =========================================================================
   06 Le email: tre schede che arrivano e si impilano
   ========================================================================= */
.is-mail .stage { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.mail-stack { position: relative; width: min(100%, 560px); height: clamp(360px, calc(100svh - 380px), 440px); }
.mail { position: absolute; left: 50%; top: 50%; width: min(100%, 480px); max-height: 100%; display: flex; flex-direction: column; overflow: hidden; border-radius: 18px; background: var(--carta); border: 1px solid var(--linea); box-shadow: 0 30px 60px -24px rgba(30, 41, 59, .35); transform-origin: 50% 100%; transition: transform .7s var(--ease), opacity .5s ease; }
.mail-body { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.mail-body > .pr-app { height: auto; }
/* Stato delle schede: davanti quella del passaggio, dietro quelle già arrivate, nascoste quelle che arriveranno */
.mail { transform: translate(-50%, calc(-50% + 48px)) scale(.96); opacity: 0; z-index: 1; }
.mail-stack[data-step="0"] .mail[data-mail="0"],
.mail-stack[data-step="1"] .mail[data-mail="1"],
.mail-stack[data-step="2"] .mail[data-mail="2"] { transform: translate(-50%, -50%); opacity: 1; z-index: 3; }
.mail-stack[data-step="1"] .mail[data-mail="0"],
.mail-stack[data-step="2"] .mail[data-mail="1"] { transform: translate(calc(-50% - 30px), calc(-50% - 14px)) rotate(-4deg) scale(.95); opacity: .85; z-index: 2; }
.mail-stack[data-step="2"] .mail[data-mail="0"] { transform: translate(calc(-50% - 54px), calc(-50% - 26px)) rotate(-7deg) scale(.9); opacity: .6; z-index: 1; }
.mail-count { order: -1; display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 11px; border-radius: 999px; background: var(--carta); border: 1px solid var(--linea); font-size: 13.5px; font-weight: 650; color: var(--ink); }
.mail-count svg { width: 16px; height: 16px; fill: none; stroke: var(--indaco); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* =========================================================================
   07 Installazione: quattro schede, scorrimento libero
   ========================================================================= */
.install { display: flex; align-items: center; padding: 110px clamp(16px, 6vw, 110px) 120px; background: var(--carta); }
.install-inner { width: 100%; max-width: 1240px; margin: 0 auto; }
.install-head { max-width: 62rem; }
.install-head .lead { max-width: 56ch; }
.schede { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-top: clamp(36px, 6vh, 64px); }
/* Ogni scheda è uno stallo: tre lati, aperto verso la corsia */
.scheda { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 22px 22px 28px; border: 3px solid var(--stallo); border-bottom: 0; margin-left: -3px; background: linear-gradient(to bottom, #fff, rgba(255, 255, 255, 0)); }
.scheda:first-child { margin-left: 0; }
.scheda-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--indaco-tenue); }
.scheda-ico svg { width: 22px; height: 22px; fill: none; stroke: var(--indaco); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.scheda-code { position: absolute; right: 18px; top: 20px; font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--slate); }
.scheda h3 { font-family: var(--font-display); font-size: 20px; font-weight: 650; letter-spacing: -.015em; }
.scheda p { font-size: 15px; line-height: 1.55; color: var(--slate); }
.install .lane { margin-top: 0; }
.schede + .lane { height: 3px; }

/* =========================================================================
   09 Provatelo voi: la postazione occupa la slide, sopra titolo, comandi e missioni
   ========================================================================= */
.prova { display: flex; height: 100vh; height: 100svh; min-height: 620px; padding: 80px clamp(16px, 4vw, 64px) 76px; background: var(--fondo); overflow: hidden; }
.prova-inner { position: relative; flex: 1; width: 100%; max-width: 1500px; min-height: 0; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 10px 24px; }
.prova-head { grid-column: 1; grid-row: 1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; min-width: 0; }
.prova-head .track { margin: 0; align-self: center; }
.prova-head h2 { font-size: clamp(24px, 2.2vw, 34px); }
.prova-lead { flex-basis: 100%; font-size: 14px; line-height: 1.5; color: var(--slate-testo); max-width: 90ch; }
.proto-bar { grid-column: 2; grid-row: 1; align-self: start; display: flex; align-items: center; gap: 8px; }
.proto-reset { padding: 7px 16px; border-radius: 999px; border: 1px solid var(--linea); background: var(--carta); color: var(--indaco-testo); font-size: 13px; font-weight: 650; }
.proto-reset:hover { border-color: var(--indaco); }
/* Missioni: una riga tutta loro sotto il titolo, vanno a capo (mai scorrimento di lato: know-how §2) */
.missions-box { grid-column: 1 / -1; grid-row: 2; min-width: 0; }
.missions-sum { display: none; }
.missions { display: flex; flex-wrap: wrap; gap: 6px 8px; counter-reset: mission; min-width: 0; }
.missions li { display: inline-flex; align-items: center; gap: 8px; padding: 4px 14px 4px 4px; border-radius: 999px; counter-increment: mission; background: var(--carta); border: 1px solid var(--linea); font-size: 13px; font-weight: 600; transition: background .3s ease, border-color .3s ease; }
.missions li::before { content: counter(mission); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--indaco-tenue); color: var(--indaco-testo); font: 700 11px/1 var(--font-mono); }
.missions li.is-done { background: var(--indaco-tenue); border-color: var(--indaco); }
.missions li.is-done::before { content: "✓"; background: var(--indaco); color: #fff; font-family: var(--font); }
.proto-station { grid-column: 1 / -1; grid-row: 3; min-height: 0; min-width: 0; }
.proto-note { grid-column: 1 / -1; grid-row: 4; font-size: 12.5px; color: var(--slate-testo); text-align: center; }

/* =========================================================================
   10 Alesca
   ========================================================================= */
.outro { display: grid; place-items: center; background: var(--carta); padding: 110px 16px 130px; overflow: hidden; }
.outro-inner { display: flex; flex-direction: column; align-items: center; text-align: center; width: 100%; max-width: 60rem; min-width: 0; }
.outro .eyebrow { justify-content: center; }
.outro h2 { font-size: clamp(34px, min(4vw, 7vh), 64px); max-width: 18ch; }
.outro-lead { margin-top: 20px; font-size: clamp(17px, 1.35vw, 20px); line-height: 1.55; color: var(--slate); max-width: 44ch; }
.outro .button { margin-top: 30px; }
.outro-lot { display: flex; justify-content: center; width: 100%; overflow: hidden; margin-top: clamp(36px, 6vh, 64px); -webkit-mask-image: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent); mask-image: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent); }
.outro-lot .stall { --pw: 110px; width: 150px; height: 168px; display: grid; place-items: center; }
.outro-lot .stall.is-mine { border-color: var(--indaco); background: linear-gradient(to bottom, var(--indaco-tenue), rgba(238, 241, 253, 0)); }
.outro-lot img { width: 112px; height: auto; }

/* =========================================================================
   Indice e player
   ========================================================================= */
/* Indice laterale: ogni capitolo è uno stallo; quello corrente è assegnato */
.chapter-nav { position: fixed; right: 22px; top: 50%; z-index: 30; display: grid; gap: 10px; transform: translateY(-50%); }
.chapter-nav a { position: relative; display: block; width: 12px; height: 18px; }
.chapter-nav a::after { content: ""; position: absolute; inset: 0; border: 2px solid rgba(85, 98, 116, .45); border-bottom: 0; border-radius: 2px 2px 0 0; transition: background .25s ease, border-color .25s ease; }
.chapter-nav a[aria-current]::after { background: var(--indaco); border-color: var(--indaco); }
.chapter-nav a span { position: absolute; right: 24px; top: 50%; transform: translate(6px, -50%); white-space: nowrap; pointer-events: none; padding: 6px 12px; border-radius: 999px; background: var(--notte); color: #fff; font-size: 12.5px; font-weight: 600; opacity: 0; transition: opacity .2s ease, transform .2s ease; }
.chapter-nav a:hover span, .chapter-nav a:focus-visible span { opacity: 1; transform: translate(0, -50%); }

.player { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 30; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; padding: 5px; border-radius: 999px; overflow: hidden; background: rgba(30, 41, 59, .9); border: 1px solid rgba(255, 255, 255, .14); backdrop-filter: blur(14px); box-shadow: 0 16px 40px rgba(30, 41, 59, .25); color: #fff; }
.player > button { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: #fff; font-size: 16px; }
.player > button:hover:not(:disabled) { background: rgba(255, 255, 255, .14); }
.player > .chapter-jump { font-size: 20px; line-height: 1; padding-bottom: 3px; }
.player #play { background: var(--indaco); color: #fff; }
.player #play:hover { background: #5a76f2; }
.player-counter { min-width: 60px; white-space: nowrap; text-align: center; font: 700 11.5px/1 var(--font-mono); letter-spacing: .04em; }
.player-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; }
.player-progress i { display: block; height: 100%; background: #8fa2f7; transform-origin: left; transform: scaleX(0); transition: transform .3s ease; }

/* Stato della scena fissata */
.story-progress { display: none; }
.story-chapter .story-progress { display: flex; align-items: center; gap: 14px; margin-top: 22px; font-size: 12.5px; font-weight: 700; }
.story-chapter .story-progress + .step-choices { margin-top: 10px; }
.story-position { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--indaco-testo); }
.story-hint { margin-left: auto; color: var(--slate-testo); font-size: 12px; font-weight: 600; }
.story-chapter .spread { height: 100vh; height: 100svh; min-height: 0; }

@media (max-height: 800px) and (min-width: 901px) {
  .story-chapter .lead { display: none; }
  .story-chapter .lead-note { margin-top: 16px; }
  .story-chapter .spread { padding-top: 92px; padding-bottom: 100px; }
  .step-caption { min-height: 0; }
  .prova-lead { display: none; }
  .prova { padding-top: 76px; padding-bottom: 72px; }
}
/* Schermo basso (sotto la soglia del pin): il capitolo cresce e la postazione prende la larghezza */
@media (max-height: 640px) and (min-width: 901px) {
  .prova { height: auto; min-height: 100svh; padding-bottom: 96px; }
  .prova-inner { grid-template-rows: auto auto auto auto; }
  .proto-station { height: calc(min(100vw - 2 * clamp(16px, 4vw, 64px), 1500px) * .625 + 56px); }
}
@media (max-width: 1100px) and (min-width: 901px) {
  .chapter-nav { right: 10px; }
  .schede { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 18px; }
  .scheda:nth-child(3) { margin-left: 0; }
}

/* =========================================================================
   Telefono e tablet stretto
   ========================================================================= */
@media (max-width: 900px) {
  h2 { font-size: clamp(26px, 7vw, 40px); }
  .masthead { height: 60px; }
  .brand { font-size: 14px; padding: 4px 12px 4px 4px; }
  .brand-mark { width: 28px; height: 28px; }
  .brand-product { font-size: 12px; }
  .chapter-nav { display: none; }
  .eyebrow, .track { margin-bottom: 12px; font-size: 11px; gap: 10px; }
  .code { height: 21px; font-size: 11px; padding: 0 6px; }
  .evo-tag, .proto-label { height: 22px; padding: 0 9px; }
  .fluttua > span { font-size: 12px; padding: 6px 10px 6px 9px; gap: 6px; }
  .fluttua svg { width: 14px; height: 14px; }

  /* Apertura: piazzale sopra, testo sotto */
  .intro-copy { left: 16px; right: 16px; top: auto; bottom: calc(92px + env(safe-area-inset-bottom)); width: auto; transform: none; }
  .intro-copy h1 { font-size: clamp(30px, 8.4vw, 44px); }
  .intro-lead { margin-top: 12px; font-size: 15px; }
  .intro-actions { margin-top: 16px; gap: 12px 18px; }
  .intro-actions .button { padding: 12px 18px; font-size: 14px; }
  .intro::before { background: radial-gradient(ellipse 80% 40% at 50% 26%, #fff 0%, rgba(255, 255, 255, 0) 70%); }
  .intro-visual { --pw: min(240px, calc((100svh - 515px) * 320 / 660), 40vw); left: 0; right: 0; top: 68px; transform: none; }
  .intro-visual .lot { --gap: 16px; justify-content: center; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22%, #000 78%, transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 22%, #000 78%, transparent 100%); }
  .intro-visual .stall { height: calc(var(--pw) * 660 / 320 + 42px); }
  .intro-visual .stall-code { top: 9px; font-size: 9.5px; }
  .intro-visual .stall.is-mine .phone-slot { bottom: 12px; }
  .intro-visual .is-far, .intro-visual .lane { display: none; }

  /* Scene senza pin (schermo basso o movimento ridotto): una colonna che scorre */
  .spread, .is-wide .spread, .is-mail .spread { grid-template-columns: minmax(0, 1fr); padding: 80px 16px 104px; gap: 22px; }
  .scene .lead { display: none; }
  .step-choices { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 16px -16px 0; padding: 0 16px; background: none; }
  .step-choices::-webkit-scrollbar { display: none; }
  .step-choices button { flex: none; padding: 7px 12px; font-size: 13px; }
  .step-caption { min-height: 0; margin-top: 14px; font-size: 14px; line-height: 1.5; padding-left: 13px; }
  .is-phone .stage { --pw: min(260px, 64vw); }
  .lot-scene .stall { --gap: 14px; height: calc(var(--pw) * 660 / 320 + 36px); }
  .lot-scene .stall-code { top: 8px; font-size: 9.5px; }
  .lot-scene .stall.is-mine .phone-slot { bottom: 8px; }
  .is-phone .stage .lane, .stage-tag, .lot-scene .car { display: none; }
  .is-wide .stage, #ingresso .stage { max-width: none; }
  .lead-note { font-size: 13px; padding: 8px 12px; }
  .mail-stack { height: clamp(320px, 62svh, 460px); }
  .mail { width: min(100% - 40px, 440px); }
  .mail-count { display: none; }

  /* Scena fissata: una colonna, il dispositivo riempie lo spazio che resta (come Calibro) */
  .story-chapter .spread { display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; gap: 12px; padding: 72px 16px calc(84px + env(safe-area-inset-bottom)); }
  .story-chapter .copy { display: contents; }
  .story-chapter .track { display: none; }
  .story-chapter .track.is-evo { display: flex; order: 0; margin: 0; }
  .story-chapter h2 { order: 1; font-size: clamp(24px, 6.6vw, 34px); }
  .story-chapter .lead, .story-chapter .lead-note { display: none; }
  .story-chapter .story-progress { order: 2; margin: 0; }
  .story-chapter .story-hint { display: none; }
  .story-chapter .step-choices { order: 3; margin: 0 -16px; padding-top: 0; }
  .story-chapter .track, .story-chapter h2, .story-chapter .story-progress, .story-chapter .step-choices, .story-chapter .step-caption { flex-shrink: 0; }
  .story-chapter .step-caption { order: 4; margin: 0; font-size: 13.5px; line-height: 1.45; }
  .story-chapter .stage { order: 5; flex: none; margin-top: 4px; }
  .story-chapter.is-phone .stage { --pw: min(300px, calc((100svh - 420px) * 320 / 660), 70vw); }
  /* 08: l'etichetta «Evoluzione possibile» in più toglie spazio al telefono */
  #risorse.story-chapter .stage { --pw: min(300px, calc((100svh - 450px) * 320 / 660), 70vw); }
  .story-chapter.is-mail .stage { flex: 1; min-height: 0; }
  .story-chapter .mail-stack { height: 100%; }

  .install { padding: 84px 16px 110px; }
  .schede { grid-template-columns: minmax(0, 1fr); row-gap: 14px; margin-top: 28px; }
  .scheda { margin-left: 0; padding: 18px 18px 22px; }
  .scheda h3 { font-size: 18px; }
  .scheda p { font-size: 14px; }

  /* Il capitolo del prototipo non è fissato: cresce in altezza e il telefono prende la larghezza */
  .prova { height: auto; min-height: 100svh; padding: 68px 12px calc(88px + env(safe-area-inset-bottom)); }
  .prova-inner { display: flex; flex-direction: column; gap: 8px; }
  .prova-head { gap: 2px 10px; }
  .prova-head .track { display: none; }
  .prova-head h2 { font-size: clamp(20px, 5.6vw, 26px); }
  .prova-lead { display: none; }
  .proto-bar { position: absolute; right: 0; top: 2px; }
  .prova-head { padding-right: 120px; }
  .proto-reset { padding: 5px 12px; font-size: 12.5px; }
  /* Due colonne, il testo va a capo dentro la pillola: meno righe, più spazio per il telefono */
  .missions-sum { display: flex; align-items: center; gap: 8px; width: max-content; max-width: 100%; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--linea); background: var(--carta); font-size: 12.5px; font-weight: 650; cursor: pointer; list-style: none; }
  .missions-sum::-webkit-details-marker { display: none; }
  .missions-sum::after { content: "▾"; color: var(--indaco-testo); }
  .missions-box[open] .missions-sum::after { content: "▴"; }
  .missions-sum b { font-family: var(--font-mono); font-size: 11.5px; color: var(--indaco-testo); }
  .missions-box[open] .missions { margin-top: 6px; }
  .missions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 6px; }
  .missions li { font-size: 11px; line-height: 1.25; padding: 3px 10px 3px 3px; gap: 6px; border-radius: 14px; }
  .missions li::before { flex: none; }
  .missions li::before { width: 18px; height: 18px; font-size: 10px; }
  /* iPhone 393×852 largo (100vw - 90px), più il selettore dei dispositivi */
  .proto-station { flex: none; height: calc((100vw - 90px) * 852 / 393 + 50px); }
  .proto-note { font-size: 10.5px; line-height: 1.3; }

  .outro { padding: 90px 16px 120px; }
  .outro h2 { font-size: clamp(28px, 7.6vw, 40px); }
  .outro-lead { font-size: 16px; }
  .outro-lot .stall { flex: none; width: 110px; height: 128px; }
  .outro-lot .stall:first-child, .outro-lot .stall:last-child { display: none; }
  .outro-lot img { width: 84px; }
}
@media (max-width: 900px) and (max-height: 700px) {
  .story-chapter .step-caption { display: none; }
  .intro-lead { display: none; }
}
@media (max-width: 600px) { .player-counter { min-width: 48px; } .player > button { width: 38px; height: 38px; } }
/* Telefono in orizzontale: la postazione prende tutta l'altezza */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  .prova { padding-top: 12px; padding-bottom: 12px; }
  .prova { height: 100svh; min-height: 0; }
  .prova-head, .missions-box, .proto-note { display: none; }
  .proto-station { flex: 1; height: auto; }
}

/* Movimento ridotto: niente ingressi né fluttuazioni, si vede subito lo stato finale */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition: none !important; }
}
