/* Un solo dispositivo, tre schermate e un retro per le piroette. */
.phone-slot { width: min(100%, 360px); height: min(640px, 78svh); margin: 0 auto; position: relative; }
.phone-slot--hero { width: min(100%, 330px); height: min(620px, 74svh); }
.phone-slot--story { height: min(640px, 80svh); }
.phone-slot--demo { height: min(560px, 64svh); }
.phone-traveller { --phone-depth: 36px; --phone-half-depth: 18px; position: relative; width: 100%; height: 100%; z-index: 12; pointer-events: none; }
.phone-traveller.is-travelling { position: fixed; top: 0; left: 0; margin: 0; will-change: transform; }
.hero-labels { position: fixed; top: 0; left: 0; z-index: 14; pointer-events: none; }
.phone-handoff { height: 55svh; pointer-events: none; }
body:not(.animazioni-attive) .phone-handoff { display: none; }
.phone-pose { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.phone-body { transform: translateZ(var(--phone-half-depth)); }
.phone-shell { position: absolute; inset: 0; transform-style: preserve-3d; pointer-events: none; }
.phone-edge { position: absolute; display: block; backface-visibility: visible; background: linear-gradient(90deg, #243544, #6a7b88 18%, #354b5c 42%, #263949 65%, #687d8b 86%, #1b2a37); }
.phone-edge--left, .phone-edge--right { top: 50%; width: var(--phone-depth); height: calc(100% - 64px); transform: translate(-50%, -50%) rotateY(90deg); }
.phone-edge--left { left: 0; }
.phone-edge--right { left: 100%; }
.phone-edge--top, .phone-edge--bottom { left: 50%; width: calc(100% - 64px); height: var(--phone-depth); background: linear-gradient(#243544, #6a7b88 18%, #354b5c 42%, #263949 65%, #687d8b 86%, #1b2a37); transform: translate(-50%, -50%) rotateX(90deg); }
.phone-edge--top { top: 0; }
.phone-edge--bottom { top: 100%; }
.phone-edge--corner { height: var(--phone-depth); background: linear-gradient(#243544, #6a7b88 18%, #354b5c 42%, #263949 65%, #687d8b 86%, #1b2a37); }
.phone-key { position: absolute; width: 24px; border: 1px solid #91a4b0; border-radius: 4px; background: linear-gradient(90deg, #344959, #a1afb7, #435b6c); transform: translate(-50%, -50%) rotateY(90deg); }
.phone-key--volume { left: -2px; top: 29%; height: 58px; }
.phone-key--power { left: calc(100% + 2px); top: 31%; height: 66px; }
.phone-back {
  position: absolute; inset: 0; transform: rotateY(180deg) translateZ(var(--phone-half-depth)); backface-visibility: hidden;
  border-radius: 32px; border: 7px solid #1c2733; background: linear-gradient(145deg, #1d3041, #101a25 65%, #1b3348);
  box-shadow: 0 24px 55px rgba(7, 29, 51, .22); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.phone-back > img { width: 82px; height: 82px; object-fit: contain; opacity: .85; }
.phone-back > span { font-size: 16px; letter-spacing: .25em; color: #a6bfce; font-weight: 700; }
.phone-camera { position: absolute; top: 16px; left: 16px; padding: 10px; display: grid; grid-template-columns: repeat(2, 18px); gap: 8px; border-radius: 16px; background: #253441; border: 1px solid #41515e; }
.phone-camera i { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #375a78, #0b1420 45%, #1e2b36 65%, #637382 70%, #162432 80%); }
.phone-body {
  width: 100%; height: 100%; display: flex; flex-direction: column; position: relative;
  background: var(--tg-bg); border: 7px solid #1c2733; border-radius: 32px; overflow: hidden;
  box-shadow: 0 24px 55px rgba(7, 29, 51, .22), 0 0 0 1px rgba(125, 146, 162, .25); backface-visibility: hidden;
}
.phone-traveller.has-webgl .phone-body { border: 0; border-radius: 25px; box-shadow: none; }
.phone-traveller .phone-gl, .phone-traveller .phone-css { position: absolute; inset: -48px; pointer-events: none; }
.phone-traveller .phone-gl { z-index: 0; }
.phone-traveller .phone-css { z-index: 1; }
.phone-traveller[data-scene="demo"] .phone-body { pointer-events: auto; }
.phone-traveller:not([data-scene="demo"]) .phone-body { pointer-events: none !important; }
.phone-status {
  height: 25px; flex: 0 0 25px; padding: 3px 18px 2px; display: flex; align-items: center; justify-content: space-between;
  background: #1c2733; color: #fff; font-size: 10px; font-weight: 600; line-height: 1; position: relative; z-index: 21;
}
.phone-speaker { width: 48px; height: 4px; background: #090f16; border-radius: 6px; position: absolute; left: calc(50% - 24px); top: 9px; }
.phone-home-indicator { background: var(--tg-bubble); height: 13px; flex: 0 0 13px; display: grid; place-items: center; position: relative; z-index: 21; }
.phone-home-indicator i { display: block; height: 4px; width: 32%; background: var(--muted); opacity: .65; border-radius: 6px; }
.phone-pages { position: relative; flex: 1; min-height: 0; }
.phone-panel { position: absolute; inset: 0; display: flex; flex-direction: column; min-height: 0; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .24s ease, visibility .24s; }
.phone-traveller[data-scene="hero"] .phone-hero,
.phone-traveller[data-scene="story"] .phone-story,
.phone-traveller[data-scene="demo"] .phone-demo { opacity: 1; visibility: visible; }
.phone-traveller[data-scene="demo"] .phone-demo { pointer-events: auto; }
.phone-traveller .tg-testa { padding: 9px 14px; min-height: 55px; }
.phone-traveller .tg-avatar { width: 34px; height: 34px; }
.phone-traveller .tg-bolla { font-size: 14px; }
.phone-hero .eroe-chat { font-size: 14px; padding: 12px 10px; }
.phone-hero .eroe-lista { gap: 9px; }
.phone-hero .tg-msg { max-width: 94%; }
.phone-hero .tg-tasto { text-align: center; }
.phone-traveller .tg-fondo { flex: 0 0 auto; }
.phone-traveller .tg-input { min-height: 37px; gap: 8px; }
.phone-traveller .tg-input > span:not(.rt-invia):not(.tg-menu-btn) { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone-traveller .tg-menu-btn { min-height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 6px 12px; }
.phone-hero .rt-comandi { bottom: calc(100% + 4px); }
.phone-story .rt-chat { justify-content: flex-start; overflow: hidden; padding: 12px 10px; }
.phone-story .tg-msg { max-width: 94%; }
.phone-story .tg-tasto { text-align: center; }
.phone-story .v1, .phone-story .rt-scrive, .phone-story .nasc-fine { display: none; }
.phone-story .v2 { display: block; }
.animazioni-attive .phone-story .rs, .animazioni-attive .phone-story .v2 { display: none; }
.animazioni-attive .phone-story .v1, .animazioni-attive .phone-story .nasc-fine { display: block; }
body:not(.animazioni-attive) .phone-story .rt-chat { overflow-y: auto; }
.phone-traveller .tg-notifica { top: 2px; transform: translateY(-180px); opacity: 0; visibility: hidden; }
.phone-demo .tg-suggerimenti { flex-wrap: nowrap; overflow-x: auto; padding: 3px 2px 5px; margin-bottom: 3px; scrollbar-width: none; }
.phone-demo .tg-suggerimenti::-webkit-scrollbar { display: none; }
.phone-demo .tg-sugg { flex: 0 0 auto; max-width: 92%; text-align: left; scroll-snap-align: start; }
.phone-traveller .tg-avviso, .phone-traveller .rt-avviso { padding: 16px; }
.phone-traveller .tg-avviso-box p { font-size: 14px; }
.phone-traveller .tg-comandi { z-index: 8; }
.phone-traveller .tg-tasto { min-height: 35px; }

/* Il dito disegnato ha lo stesso aspetto su desktop e telefono. */
.rt-dito {
  width: 46px; height: 58px; background: url("img/tap-pointer.svg") center / contain no-repeat;
  font-size: 0; filter: drop-shadow(0 4px 4px rgba(0, 34, 67, .3));
  pointer-events: none; right: 6px; bottom: -31px; z-index: 10;
}
.rt-dito::before {
  content: ""; position: absolute; left: 6px; top: -4px; width: 24px; height: 24px;
  border: 2px solid #38a5da; border-radius: 50%; box-shadow: 0 0 0 5px rgba(56, 165, 218, .16);
}
.tg-comando, .tg-menu-btn { overflow: visible; }
.phone-traveller button:focus-visible { outline: 3px solid var(--tu); outline-offset: 3px; }

.rt-colonna { position: relative; }
.eroe-scena { min-width: 0; }
.ricomincia { position: relative; z-index: 13; min-height: 44px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.ricomincia:hover { border-color: var(--brand); color: var(--brand-ink); }
.ricomincia:focus-visible { outline: 3px solid var(--tu); outline-offset: 3px; }
.scene-label { font-size: 12px; letter-spacing: .09em; font-weight: 700; text-transform: uppercase; color: var(--brand); }

@media (min-width: 900px) {
  .racconto-in { grid-template-columns: 1fr 1fr; }
  .rt-colonna { order: 1; }
  .rt-testi { order: 2; }
}
@media (max-width: 899px) {
  .phone-handoff { height: 70svh; }
  .phone-slot--hero { width: min(100%, 360px); height: clamp(440px, 65svh, 580px); }
  .phone-slot--story { width: min(100%, 360px); height: clamp(330px, calc(100svh - 190px), 580px); }
  .phone-slot--demo { width: min(100%, 360px); height: clamp(370px, 64svh, 560px); }
  .phone-traveller .tg-bolla { font-size: 13.5px; }
  .phone-traveller .tg-tasto { font-size: 12.5px; padding: 6px 4px; }
  .phone-traveller .phone-status { height: 22px; flex-basis: 22px; }
  .phone-traveller .phone-home-indicator { height: 10px; flex-basis: 10px; }
  .phone-traveller .tg-testa { min-height: 49px; padding: 6px 12px; }
  .phone-demo .tg-sugg { font-size: 12px; padding: 5px 9px; }
  .racconto { padding-top: 10px; padding-bottom: 10px; }
  .racconto-in { gap: 12px; }
}
@media (max-width: 899px) and (max-height: 650px) {
  .phone-story .rt-chat { padding: 8px; gap: 5px; }
  .phone-story .tg-bolla { font-size: 12px; padding: 6px 8px 4px; line-height: 1.3; }
  .phone-story .tg-tasto { font-size: 11.5px; padding: 4px; min-height: 29px; }
  .phone-traveller[data-scene="story"] .tg-fondo { padding: 5px; }
  .phone-traveller[data-scene="story"] .tg-input { min-height: 30px; }
  .phone-traveller[data-scene="story"] .tg-menu-btn { min-height: 29px; padding: 4px 9px; }
  .racconto.animato .didascalie { min-height: 146px; }
}
@media (prefers-reduced-motion: reduce) {
  .phone-panel { transition: none; }
}

/* Scorrimento nativo su touch, schermi piccoli e con movimento ridotto. */
.mobile-only { display: none; }
.presentation-inline { --ritmo-scroll: 1; }
.presentation-inline .mobile-only { display: revert; }
.presentation-inline .desktop-only { display: none; }
.presentation-inline .cap,
.presentation-inline .racconto { min-height: 0; display: block; padding: 48px 18px; }
.presentation-inline .eroe { min-height: 0; display: block; padding: 36px 18px 48px; }
.presentation-inline .eroe-in { grid-template-columns: 1fr; max-width: 760px; gap: 28px; }
.presentation-inline .eroe-scena { padding: 0; perspective: none; }
.presentation-inline .bolla-luce,
.presentation-inline .fluttua,
.presentation-inline .phone-handoff,
.presentation-inline .rt-colonna,
.presentation-inline .rt-barra,
.presentation-inline .progresso { display: none; }
.presentation-inline .eroe-alone { filter: none; opacity: .3; }
.presentation-inline .lettera { will-change: auto; }
.presentation-inline .phone-slot { width: min(100%, 360px); height: auto; }
.presentation-inline .phone-inline { height: auto; z-index: auto; pointer-events: auto; }
.presentation-inline .phone-inline .phone-body { height: auto; transform: none; pointer-events: auto !important; }
.presentation-inline .phone-pages { flex: none; }
.presentation-inline .phone-inline[data-scene="hero"] .phone-hero,
.presentation-inline .phone-inline[data-scene="demo"] .phone-demo { position: relative; pointer-events: auto; transition: none; }
.presentation-inline .phone-hero .eroe-chat { flex: none; overflow: visible; }
.presentation-inline .phone-demo .tg-chat { flex: none; max-height: 32rem; overscroll-behavior-y: auto; }
.presentation-inline .phone-inline .tg-tasto,
.presentation-inline .phone-inline .tg-menu-btn,
.presentation-inline .phone-inline .tg-sugg,
.presentation-inline .phone-inline .tg-comando,
.presentation-inline .phone-inline .tg-avviso-box button { min-height: 44px; }
.presentation-inline .phone-inline .tg-tasto { padding: 9px 6px; backdrop-filter: none; }
.presentation-inline .phone-inline .tg-sugg { font-size: 13px; line-height: 1.4; }
.presentation-inline .phone-inline .tg-notifica { display: none; }
.presentation-inline .racconto-in { grid-template-columns: 1fr; max-width: 760px; }
.presentation-inline .didascalie { display: grid; gap: 20px; }
.presentation-inline .did { margin: 0; }
.presentation-inline .ricomincia { min-height: 44px; }
.presentation-inline .pl-due .passo { min-height: 0; display: block; padding: 0; }
.presentation-inline .passo .scheda-passo { opacity: 1; transform: none; transition: none; }
.presentation-inline .mobile-action { display: inline-flex; align-items: center; min-height: 44px; margin-top: 8px; color: var(--brand-ink); font-size: 14px; font-weight: 600; text-underline-offset: 3px; }
.presentation-inline :is(#phone-demo-slot, #shot) { scroll-margin-top: 16px; }
.presentation-inline .pl-due { grid-template-columns: 1fr; gap: 24px; margin-top: 28px; }
.presentation-inline .shot-colonna { position: static; order: 0; padding: 0; perspective: none; }
.presentation-inline .shot-strato,
.presentation-inline .shot-strato img,
.presentation-inline .shot-luce { transition: none; will-change: auto; }
.presentation-inline .regole { margin-top: 28px; perspective: none; }
@media (min-width: 700px) {
  .presentation-inline .eroe-in { grid-template-columns: 1fr 1fr; max-width: 980px; }
  .presentation-inline .didascalie { grid-template-columns: 1fr 1fr; gap: 28px; }
}

/* Il racconto animato si controlla con i pulsanti, senza bloccare la pagina. */
.mobile-motion .rt-colonna { display: block; }
.mobile-motion .racconto-in { gap: 24px; }
.mobile-motion .phone-slot--story { height: 460px; }
.mobile-motion #phone-story-inline,
.mobile-motion #phone-story-inline .phone-body { height: 100%; }
.mobile-motion #phone-story-inline .phone-pages { flex: 1; }
.mobile-motion .phone-story { pointer-events: auto; }
.mobile-motion .phone-story .rt-chat { overflow-y: auto; overscroll-behavior-y: auto; }
.mobile-motion .phone-story .tg-bolla { font-size: 13px; line-height: 1.4; }
.mobile-motion .phone-story .tg-tasto { font-size: 12.5px; }
.mobile-motion .didascalie { display: block; min-height: 128px; }
.mobile-motion .did[hidden] { display: none !important; }
.mobile-story-controls { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; max-width: 360px; margin: 14px auto 0; }
.mobile-story-controls button { min-width: 0; min-height: 44px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--brand-soft); color: var(--brand-ink); font-size: 13px; font-weight: 600; cursor: pointer; }
.mobile-story-controls button:disabled { opacity: .4; cursor: default; }
.mobile-story-controls span { font-size: 12px; white-space: nowrap; color: var(--muted); }
.mobile-story-controls button:focus-visible { outline: 3px solid var(--tu); outline-offset: 3px; }
.mobile-motion .shot-strato { transition: transform .45s ease; }
.mobile-motion .shot-strato img { transition: opacity .25s ease; }
.mobile-motion .shot-luce { transition: left .45s ease, top .45s ease, width .45s ease, height .45s ease, opacity .25s ease; }
@media (min-width: 700px) {
  .mobile-motion .racconto-in { grid-template-columns: 1fr 1fr; }
  .mobile-motion .phone-slot--story { height: 420px; }
}
