/* ==========================================================================
   PIP — tutorial "Scarica l'app" (scarica.html), stile distopia del sito:
   carta + inchiostro + rosso timbro. Le schermate del telefono sono disegnate
   in HTML/CSS (barra di Safari/Chrome, menu, conferme) con l'elemento da
   toccare evidenziato in rosso che pulsa.
   ========================================================================== */
@font-face {
  font-family: 'Coluna Rounded';
  src: url('../assets/fonts/coluna-rounded.otf') format('opentype');
  font-display: swap;
}
:root {
  --carta: #e8e6df;
  --carta-2: #f2f0ea;
  --inchiostro: #0b0b0b;
  --rosso: #ff1e1e;
  --grigio: #6b6860;
  --display: 'Coluna Rounded', 'Arial Narrow', Impact, sans-serif;
  --mono: 'Martian Mono', ui-monospace, monospace;
  --serif: 'Instrument Serif', Georgia, serif;
  --bordo: 1.5px solid var(--inchiostro);
  --sys: -apple-system, BlinkMacSystemFont, 'SF Pro Text', Roboto, 'Segoe UI', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: hidden; }
/* niente zoom da doppio tocco: toccando "Avanti" piu' volte di seguito Safari zoomava sul
   pulsante invece di premerlo. Lo zoom con due dita resta disponibile. */
html { touch-action: manipulation; }
body {
  background: var(--carta); color: var(--inchiostro);
  font-family: var(--mono); font-weight: 300; font-size: 13px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; min-height: 100svh;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
strong { font-weight: 600; }
.grana {
  position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: .18; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

/* ---------- testata ---------- */
.testa {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(env(safe-area-inset-top) + 12px) 18px 12px;
  background: var(--carta); border-bottom: var(--bordo);
}
.testa-logo img { height: 34px; width: auto; filter: invert(1); }
.cambia { border: var(--bordo); padding: 7px 12px 6px; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; }
.cambia[hidden] { display: none; }

/* ---------- intro ---------- */
.tutorial { max-width: 1040px; margin: 0 auto; padding: 22px 18px calc(110px + env(safe-area-inset-bottom)); }
.kicker { font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: var(--grigio); }
.titolo { font-family: var(--display); font-weight: 400; text-transform: uppercase; line-height: .9; font-size: clamp(46px, 9vw, 110px); margin-top: 8px; }
.titolo span { color: var(--rosso); }
.sussurro { font-family: var(--serif); font-style: italic; font-size: clamp(19px, 2.4vw, 28px); margin-top: 6px; }

/* ---------- passi ---------- */
.passi { margin-top: 22px; }
.passo { display: none; grid-template-columns: auto 1fr; gap: 22px; align-items: center; }
.passo.attivo { display: grid; animation: entra .35s cubic-bezier(.2, .8, .2, 1) both; }
.passo.attivo.da-sx { animation-name: entraSx; }
@keyframes entra { from { opacity: 0; transform: translateX(26px); } }
@keyframes entraSx { from { opacity: 0; transform: translateX(-26px); } }
.spiega .n { font-family: var(--display); font-weight: 400; font-size: 54px; line-height: .9; color: var(--rosso); display: block; }
.spiega h2 { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: clamp(30px, 4.6vw, 54px); line-height: .95; margin-top: 4px; }
.spiega p { margin-top: 12px; font-size: 12.5px; line-height: 1.75; max-width: 42ch; }
.nota-fine { color: var(--grigio); font-size: 11px !important; }

/* ---------- il telefono disegnato ---------- */
.tel {
  height: clamp(300px, 54svh, 560px); aspect-ratio: 390 / 844;
  border-radius: 30px; padding: 7px; background: var(--inchiostro);
  box-shadow: 9px 9px 0 var(--rosso);
}
.schermo { position: relative; width: 100%; height: 100%; border-radius: 23px; overflow: hidden; background: var(--carta); font-family: var(--sys); font-weight: 400; color: #111; }
.app-sotto { position: absolute; inset: 0; background: url('../assets/app-splash.webp') center top / cover; }
.app-sotto.con-barra { top: 13%; }
.app-sotto.scuro::after { content: ''; position: absolute; inset: 0; background: rgba(0, 0, 0, .42); }

/* evidenziato: cornice rossa che pulsa */
.evid { outline: 2.5px solid var(--rosso); outline-offset: 2px; animation: pulsa 1.3s ease-in-out infinite; }
@keyframes pulsa { 50% { outline-offset: 5px; outline-color: rgba(255, 30, 30, .35); } }
.evid-punto { position: relative; }
.evid-punto::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px;
  border: 2.5px solid var(--rosso); border-radius: 50%; animation: anello 1.3s ease-out infinite;
}
@keyframes anello { from { transform: scale(.7); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
.evid-testo { color: var(--rosso) !important; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; animation: lampo 1.3s steps(1) infinite; }
@keyframes lampo { 50% { opacity: .45; } }

/* icone (SVG in data URI, tratto scuro) */
.lucchetto, [class^="ico-"] { display: inline-block; flex: none; background: center / contain no-repeat; }
.lucchetto { width: 8px; height: 9px; margin-right: 5px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 12'%3E%3Crect x='1' y='5' width='8' height='6.5' rx='1.2' fill='%23555'/%3E%3Cpath d='M3 5V3.5a2 2 0 0 1 4 0V5' fill='none' stroke='%23555' stroke-width='1.3'/%3E%3C/svg%3E"); }
.ico-indietro, .ico-avanti, .ico-condividi, .ico-libro, .ico-schede, .ico-menu, .ico-piu { width: 17px; height: 17px; }
.ico-indietro { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15 5l-7 7 7 7' fill='none' stroke='%23007aff' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E"); }
.ico-avanti { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 5l7 7-7 7' fill='none' stroke='%23b8b8bd' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E"); }
.ico-condividi { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3v12M7.5 7.5 12 3l4.5 4.5M6 11H5v10h14V11h-1' fill='none' stroke='%23007aff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.ico-libro { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 5c3-1 6-1 8 1 2-2 5-2 8-1v14c-3-1-6-1-8 1-2-2-5-2-8-1z M12 6v14' fill='none' stroke='%23007aff' stroke-width='1.8'/%3E%3C/svg%3E"); }
.ico-schede { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='4' y='7' width='13' height='13' rx='2' fill='none' stroke='%23007aff' stroke-width='1.8'/%3E%3Cpath d='M8 4h10a2 2 0 0 1 2 2v10' fill='none' stroke='%23007aff' stroke-width='1.8'/%3E%3C/svg%3E"); }
.ico-menu { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='5' r='2' fill='%23333'/%3E%3Ccircle cx='12' cy='12' r='2' fill='%23333'/%3E%3Ccircle cx='12' cy='19' r='2' fill='%23333'/%3E%3C/svg%3E"); }
.ico-piu { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='4' y='4' width='16' height='16' rx='4' fill='none' stroke='%23111' stroke-width='1.8'/%3E%3Cpath d='M12 8.5v7M8.5 12h7' stroke='%23111' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E"); }

/* Safari: barra indirizzo in basso + strumenti */
.safari-barra {
  position: absolute; left: 7%; right: 7%; bottom: 12%; height: 8%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(250, 250, 252, .97); border-radius: 999px; box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
  font-size: clamp(7px, 1.6svh, 10px); white-space: nowrap; overflow: hidden;
}
.safari-strumenti {
  position: absolute; left: 0; right: 0; bottom: 0; height: 10%;
  display: flex; align-items: center; justify-content: space-around;
  background: rgba(247, 247, 249, .97); border-top: 1px solid #ddd;
}
/* foglio di condivisione */
.foglio { position: absolute; left: 0; right: 0; bottom: 0; background: #f2f2f7; border-radius: 16px 16px 0 0; padding: 10px 8px 14px; font-size: clamp(8px, 1.7svh, 11px); animation: sale .5s .1s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes sale { from { transform: translateY(100%); } }
.foglio-testa { display: flex; align-items: center; gap: 8px; padding: 4px 4px 10px; }
.foglio-testa img, .ci-corpo img { width: 30px; height: 30px; border-radius: 7px; }
.foglio-testa span { font-weight: 600; display: flex; flex-direction: column; }
.foglio-testa small { font-weight: 400; color: #888; font-size: .85em; }
.foglio .riga, .menu-chrome .riga { display: flex; align-items: center; justify-content: space-between; background: #fff; padding: 9px 10px; border-bottom: 1px solid #e5e5ea; }
.foglio .riga:first-of-type { border-radius: 10px 10px 0 0; }
.foglio .riga:last-of-type { border-radius: 0 0 10px 10px; border-bottom: 0; }
.foglio .riga.evid { position: relative; z-index: 1; border-radius: 6px; font-weight: 600; }
/* conferma iPhone */
.conferma-ios { position: absolute; left: 0; right: 0; top: 6%; background: #f2f2f7; border-radius: 14px 14px 0 0; padding-bottom: 18px; font-size: clamp(8px, 1.7svh, 11px); animation: scende .45s .1s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes scende { from { transform: translateY(40px); opacity: 0; } }
.ci-testa { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 10px 8px; border-bottom: 1px solid #ddd; white-space: nowrap; }
.ci-testa b { font-size: .92em; }
.ci-testa span { color: #007aff; }
.ci-corpo { display: flex; align-items: center; gap: 10px; margin: 12px 10px 0; background: #fff; border-radius: 10px; padding: 10px; }

/* Chrome: barra in alto, menu, conferma */
.chrome-barra {
  position: absolute; left: 0; right: 0; top: 0; height: 13%;
  display: flex; align-items: flex-end; gap: 6px; padding: 0 8px 8px; background: #fff; border-bottom: 1px solid #ddd;
  font-size: clamp(7px, 1.5svh, 10px); white-space: nowrap;
}
.chrome-barra > .lucchetto { margin: 0 0 3px 8px; }
.chrome-barra .ico-menu { margin-left: auto; }
.chrome-barra.evid { outline-offset: -4px; }
.menu-chrome { position: absolute; right: 5px; top: 10%; width: 64%; background: #fff; border-radius: 8px; box-shadow: 0 6px 22px rgba(0, 0, 0, .3); overflow: hidden; font-size: clamp(8px, 1.7svh, 11px); animation: scende .4s .1s both; }
.menu-chrome .riga.evid { position: relative; z-index: 1; font-weight: 600; outline-offset: -3px; }
.conferma-android { position: absolute; left: 9%; right: 9%; top: 34%; background: #fff; border-radius: 16px; padding: 16px 14px 12px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: clamp(8px, 1.7svh, 11px); animation: scende .45s .1s both; }
.conferma-android img { width: 38px; height: 38px; border-radius: 10px; margin-bottom: 4px; }
.conferma-android > span { color: #666; }
.ca-tasti { align-self: stretch; display: flex; justify-content: flex-end; gap: 16px; margin-top: 10px; color: #1a73e8; }

/* schermata Home finale */
.schermo.home { background: linear-gradient(160deg, #3a3835, #121110); }
.griglia-app { position: absolute; inset: 12% 9% auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 26px 12%; }
.griglia-app i { aspect-ratio: 1; border-radius: 22%; background: rgba(255, 255, 255, .14); }
.icona-pip { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.icona-pip img { width: 100%; aspect-ratio: 1; border-radius: 22%; outline: 2.5px solid var(--rosso); outline-offset: 3px; animation: pulsa 1.3s ease-in-out infinite, rimbalza .6s .3s cubic-bezier(.3, 1.8, .5, 1) both; }
@keyframes rimbalza { from { transform: scale(.3); opacity: 0; } }
.icona-pip small { position: absolute; top: 104%; color: #fff; font-size: clamp(6px, 1.2svh, 9px); white-space: nowrap; }

/* tasto finale (come il sito) */
.bottone {
  display: inline-flex; align-items: center; gap: 20px; margin-top: 22px;
  background: var(--inchiostro); color: var(--carta); text-decoration: none;
  font-family: var(--display); font-size: clamp(24px, 3vw, 34px); text-transform: uppercase;
  padding: 16px 24px 12px; border: var(--bordo); box-shadow: 8px 8px 0 var(--rosso);
  transition: transform .15s, box-shadow .15s, background .15s, color .15s;
}
.bottone:hover { transform: translate(4px, 4px); box-shadow: 4px 4px 0 var(--rosso); background: var(--rosso); color: var(--inchiostro); }
.freccia { display: inline-block; width: 26px; height: 2px; background: currentColor; position: relative; }
.freccia::after { content: ''; position: absolute; right: 0; top: -4px; width: 9px; height: 9px; border-top: 2px solid currentColor; border-right: 2px solid currentColor; transform: rotate(45deg); }
.freccia-sx { transform: scaleX(-1); }

/* ---------- comandi in basso ---------- */
.comandi {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
  background: var(--carta-2); border-top: var(--bordo);
}
.cmd { height: 56px; min-width: 56px; border: var(--bordo); touch-action: manipulation; user-select: none; -webkit-user-select: none; display: inline-flex; align-items: center; justify-content: center; gap: 12px; padding: 0 14px; }
.cmd:disabled { opacity: .25; cursor: default; }
.cmd-avanti { background: var(--rosso); font-family: var(--display); font-size: 23px; text-transform: uppercase; padding: 3px 24px 0; min-width: 148px; box-shadow: 4px 4px 0 var(--inchiostro); }
.cmd-avanti[hidden] { display: none; }
.avanz { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; font-size: 10px; letter-spacing: .2em; }
.tacche { display: flex; gap: 4px; }
.tacche i { flex: 1; height: 6px; border: 1.5px solid var(--inchiostro); }
.tacche i.fatta { background: var(--rosso); }

/* telefono stretto/basso: tutto in colonna e compatto */
@media (max-width: 700px) {
  .tutorial { padding-top: 14px; }
  .intro .titolo { font-size: 34px; margin-top: 4px; }
  .intro .titolo br { display: none; }
  .sussurro { display: none; }
  .passi { margin-top: 12px; }
  .spiega p { font-size: 11.5px; line-height: 1.65; margin-top: 8px; }
  .passo { grid-template-columns: 1fr; justify-items: center; gap: 16px; text-align: left; }
  .spiega { justify-self: stretch; }
  .spiega .n { font-size: 40px; display: inline; margin-right: 10px; }
  .spiega h2 { display: inline; font-size: 32px; }
  .tel { height: clamp(186px, calc(100svh - 476px), 440px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}


/* ---------- domande ---------- */
body[data-fase="domanda"] .passi, body[data-fase="domanda"] .comandi { display: none; }
body[data-fase="passi"] .domanda { display: none; }
.domanda { margin-top: 22px; animation: entra .35s cubic-bezier(.2, .8, .2, 1) both; }
.domanda[hidden] { display: none; }
.d-n { font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: var(--rosso); }
.d-titolo { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: clamp(34px, 6vw, 64px); line-height: .95; margin-top: 4px; }
.d-titolo span { color: var(--rosso); }
.scelte { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; max-width: 640px; }
.scelta {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  border: var(--bordo); background: var(--carta-2); padding: 20px 18px 16px; box-shadow: 6px 6px 0 var(--inchiostro);
  transition: transform .12s, box-shadow .12s, background .12s;
}
.scelta:hover, .scelta:focus-visible { background: var(--rosso); }
.scelta:active { transform: translate(4px, 4px); box-shadow: 2px 2px 0 var(--inchiostro); }
.scelta b { font-family: var(--display); font-weight: 400; font-size: clamp(30px, 5vw, 44px); text-transform: uppercase; line-height: .95; }
.scelta small { font-size: 10.5px; color: var(--grigio); }
.scelta.rilevato::after {
  content: 'il tuo?'; position: absolute; top: -10px; right: 12px; background: var(--carta); color: var(--rosso);
  border: 2px solid var(--rosso); font-family: var(--display); font-size: 14px; text-transform: uppercase; padding: 2px 8px 0;
}
.logo-safari, .logo-chrome { width: 34px; height: 34px; border-radius: 50%; display: block; margin-bottom: 4px; }
.logo-safari { background: radial-gradient(circle, #fff 0 18%, transparent 19%), conic-gradient(from 45deg, #1e90ff, #5ac8fa, #1e90ff); border: 2px solid #0b0b0b; }
.logo-chrome { background: radial-gradient(circle, #4285f4 0 24%, #fff 25% 33%, transparent 34%), conic-gradient(#ea4335 0 33%, #fbbc05 0 66%, #34a853 0); border: 2px solid #0b0b0b; }
.torna { margin-top: 22px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; text-decoration: underline; text-decoration-color: var(--rosso); text-decoration-thickness: 2px; text-underline-offset: 4px; }

/* Safari recente (iOS 26): barra in basso con indietro, indirizzo e tre puntini */
.ico-puntini { width: 22px; height: 22px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='5' cy='12' r='2' fill='%23111'/%3E%3Ccircle cx='12' cy='12' r='2' fill='%23111'/%3E%3Ccircle cx='19' cy='12' r='2' fill='%23111'/%3E%3C/svg%3E"); }
.safari26 {
  position: absolute; left: 4%; right: 4%; bottom: 3%; height: 9%;
  display: flex; align-items: center; gap: 6px; padding: 0 8px;
  background: rgba(250, 250, 252, .97); border-radius: 999px; box-shadow: 0 2px 12px rgba(0, 0, 0, .22);
  font-size: clamp(6.5px, 1.4svh, 9px); white-space: nowrap;
}
.safari26 .ico-indietro { width: 16px; height: 16px; }
.s26-url { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 999px; padding: 4px 2px; }
.safari26 .ico-puntini.evid-punto::after { width: 26px; height: 26px; margin: -13px 0 0 -13px; }
.menu-s26 {
  position: absolute; right: 5%; bottom: 14%; width: 66%; background: rgba(255, 255, 255, .98); border-radius: 14px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .35); overflow: hidden; font-size: clamp(8px, 1.7svh, 11px); animation: scende .4s .1s both;
}
.menu-s26 .riga { display: flex; align-items: center; justify-content: space-between; padding: 9px 11px; border-bottom: 1px solid #e5e5ea; }
.menu-s26 .riga:last-child { border-bottom: 0; }
.menu-s26 .riga.evid { position: relative; z-index: 1; font-weight: 600; outline-offset: -3px; border-radius: 10px; }
.menu-s26 .ico-condividi { width: 15px; height: 15px; }
.chrome-barra .ico-condividi { margin-left: auto; width: 15px; height: 15px; }
.ci-opzione { display: flex; align-items: center; justify-content: space-between; margin: 10px 10px 0; background: #fff; border-radius: 10px; padding: 9px 10px; }
.interruttore { width: 28px; height: 16px; border-radius: 999px; background: #34c759; position: relative; }
.interruttore::after { content: ''; position: absolute; right: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; }
@media (max-width: 700px) {
  .scelte { grid-template-columns: 1fr; }
}

/* indirizzo nelle barre: si accorcia con i puntini, cosi' le icone a destra restano visibili */
.url { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s26-url { justify-content: flex-start; padding-left: 8px; }
.safari-barra { padding: 0 12px; }
.chrome-barra { align-items: flex-end; }
.chrome-barra .url { padding-bottom: 1px; }
