:root {
  --screen: #fef9e8;      /* colore dello schermo del monitor nel video */
  --ink: #2a2238;
  --ink-soft: #5d5470;
  --orange: #f26b1d;      /* plastilina dei titoli dei livelli */
  --orange-deep: #c94f0c;
  --mint: #a9d9c3;        /* la Vespa */
  --navy: #1f2a55;
  --glow: #ffd66b;
  --font-display: "Fredoka", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--screen);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body { overflow: hidden; }

button { font: inherit; color: inherit; }

[hidden] { display: none !important; }

/* i titoli ricevono il focus dopo una transizione solo per i lettori di schermo */
[tabindex="-1"]:focus { outline: none; }

/* ---------- La cameretta ---------- */

.room {
  position: fixed;
  inset: 0;
  /* clip e non solo hidden: la scena ingrandita sborda e con hidden il browser potrebbe
     comunque scorrerla (focus, clic), disallineando il sito dal monitor */
  overflow: hidden;
  overflow: clip;
  background: #2b1d14;
}

.room::before {
  content: "";
  position: absolute;
  inset: -60px;
  background: url("media/home-still.jpg") center / cover;
  filter: blur(26px) brightness(.7);
}

.scene {
  position: absolute;
  transform-origin: 0 0;
  will-change: transform;
}

.scene-still,
.scene-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* zoom a schermo intero (telefono): si usa solo il fotogramma 2K */
.scene.is-zooming:not(.is-focused) .scene-video { opacity: 0; }

/* zoom sul monitor: tutta la stanza (il video) si sfoca e sopra resta nitido solo il monitor.
   Il ritaglio segue la cornice misurata sul fotogramma 2688x1520 (esterno: x 991–2045,
   alto 352→344, basso 990→1025), 7 px più all'interno e con gli angoli smussati:
   così il passaggio nitido/sfocato cade dentro la cornice scura e non si vede */
.scene-video { transition: filter 1.3s ease; }

.scene.is-focused .scene-video { filter: blur(3.5px) brightness(.82) saturate(.9); }

.scene-sharp {
  position: absolute;
  inset: 0;
  background: url("media/home-still.jpg") 0 0 / 100% 100% no-repeat;
  clip-path: polygon(
    37.426% 23.618%, 75.521% 23.092%, 75.818% 23.618%, 75.818% 66.447%,
    75.521% 66.974%, 37.426% 64.671%, 37.128% 64.145%, 37.128% 24.145%);
  opacity: 0;
  transition: opacity 1.3s ease;
  pointer-events: none;
}

.scene.is-focused .scene-sharp { opacity: 1; }

.scene.is-focused .screen { pointer-events: none; }

/* Lo schermo del monitor: misurato sul fotogramma (2688x1520) e sul video (1276x720) */
.screen {
  position: absolute;
  left: 38.24%;
  top: 25.2%;
  width: 36.18%;
  height: 38.9%;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 95.1%);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  container-type: size;
  transition: box-shadow .35s ease, background-color .35s ease, filter .35s ease;
}

.screen::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 0 rgba(242, 107, 29, 0);
  transition: box-shadow .35s ease;
  pointer-events: none;
}

.screen:focus-visible {
  background-color: rgba(255, 255, 255, .55);
  filter: drop-shadow(0 0 2.2cqw rgba(255, 214, 107, .9));
  outline: none;
}
@media (hover: hover) {
  .screen:hover {
  background-color: rgba(255, 255, 255, .55);
  filter: drop-shadow(0 0 2.2cqw rgba(255, 214, 107, .9));
  outline: none;
}
}

.screen:focus-visible::after {
  box-shadow: inset 0 0 0 .7cqw rgba(242, 107, 29, .85), inset 0 0 6cqw rgba(255, 214, 107, .7);
}
@media (hover: hover) {
  .screen:hover::after {
  box-shadow: inset 0 0 0 .7cqw rgba(242, 107, 29, .85), inset 0 0 6cqw rgba(255, 214, 107, .7);
}
}

.screen-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3cqh;
  transition: opacity .3s ease;
}

.scene.is-zooming .screen-inner { opacity: 0; }

.boot-line {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 9cqw;
  letter-spacing: -.01em;
  color: var(--ink);
  white-space: nowrap;
}

.caret {
  display: inline-block;
  width: .08em;
  height: .95em;
  margin-left: .06em;
  vertical-align: -.1em;
  background: var(--orange);
  animation: blink 1s steps(1) infinite;
}

.hint {
  font-family: var(--font-mono);
  font-size: 3.4cqw;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--orange-deep);
  opacity: 0;
  transition: opacity .6s ease;
}

.hint.is-on { opacity: 1; animation: pulse 1.8s ease-in-out infinite; }

@keyframes blink { 50% { opacity: 0; } }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- Viste (desktop e sezioni) ---------- */

.view {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  background: var(--screen);
  container-type: inline-size;
}

/* con lo zoom sul monitor le viste stanno dentro lo schermo (posizione calcolata in main.js) */
body.is-framed .view {
  inset: auto;
  left: var(--mx);
  top: var(--my);
  width: var(--mw);
  height: var(--mh);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 95.1%);
  box-shadow: inset 0 0 40px rgba(60, 40, 20, .1);
  scrollbar-width: thin;
}

.desktop {
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity .45s ease;
}

.desktop.is-visible { opacity: 1; }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4cqi, 40px);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
}

.link-btn {
  border: 0;
  background: none;
  padding: 6px 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
}

.link-btn:focus-visible { color: var(--orange-deep); outline: none; text-decoration: underline; }
@media (hover: hover) {
  .link-btn:hover { color: var(--orange-deep); outline: none; text-decoration: underline; }
}

.desktop-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(880px, 100%);
  margin: 0 auto;
  padding: 0 clamp(16px, 4cqi, 40px) 8vh;
}

.kicker {
  margin: 0;
  font-family: var(--font-mono);
  color: var(--orange-deep);
  letter-spacing: .08em;
}

.title {
  margin: .1em 0 .2em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(34px, 8cqi, 92px);
  line-height: 1;
  letter-spacing: -.02em;
}

.lede,
.panel-lede {
  max-width: 34em;
  margin: 0 0 32px;
  font-size: clamp(15px, 1.8cqi, 19px);
  line-height: 1.55;
  color: var(--ink-soft);
}

/* I pulsanti sono "livelli" di plastilina arancione, come i titoli nel film */
.levels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.level {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  border: 0;
  border-radius: 22px;
  background: var(--orange);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  box-shadow:
    inset 0 -6px 0 var(--orange-deep),
    inset 0 3px 0 rgba(255, 255, 255, .35),
    0 10px 24px -12px rgba(201, 79, 12, .7);
  transition: transform .15s ease, box-shadow .15s ease;
}

.level:focus-visible {
  transform: translateY(-3px) rotate(-.6deg);
  outline: none;
  box-shadow:
    inset 0 -6px 0 var(--orange-deep),
    inset 0 3px 0 rgba(255, 255, 255, .35),
    0 16px 28px -12px rgba(201, 79, 12, .8),
    0 0 0 4px var(--glow);
}
@media (hover: hover) {
  .level:hover {
  transform: translateY(-3px) rotate(-.6deg);
  outline: none;
  box-shadow:
    inset 0 -6px 0 var(--orange-deep),
    inset 0 3px 0 rgba(255, 255, 255, .35),
    0 16px 28px -12px rgba(201, 79, 12, .8),
    0 0 0 4px var(--glow);
}
}

.level:active { transform: translateY(1px) scale(.98); }

.level-num {
  flex: none;
  min-width: 44px;
  padding: 4px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .22);
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: center;
}

.level-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(18px, 2.4cqi, 26px);
}

/* ---------- Sezioni ---------- */

.panel-body {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 2vh clamp(16px, 4cqi, 40px) 10vh;
}

.panel-body.wide { width: min(1080px, 100%); }

.panel-title {
  margin: 0 0 .3em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(32px, 6cqi, 64px);
  letter-spacing: -.02em;
  color: var(--orange);
  text-shadow: 0 3px 0 var(--orange-deep);
}

.film {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 20px 50px -24px rgba(42, 34, 56, .6);
}

.film video { display: block; width: 100%; aspect-ratio: 16 / 9; }

/* il film ha la musica: se il browser la blocca, o il video è muto, compare questo pulsante */
.film-sound {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px 11px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--orange);
  color: #fff;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow:
    inset 0 -4px 0 var(--orange-deep),
    inset 0 2px 0 rgba(255, 255, 255, .35),
    0 8px 20px -8px rgba(0, 0, 0, .6);
  animation: sound-nudge 2.4s ease-in-out infinite;
}

.film-sound svg { width: 18px; height: 18px; flex: none; }
.film-sound:focus-visible { outline: 3px solid var(--glow); outline-offset: 3px; }
@media (hover: hover) {
  .film-sound:hover { animation-play-state: paused; transform: translateY(-2px); }
}

@keyframes sound-nudge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* My story: la colonna è larga quanto basta perché titolo, film e capitoli stiano
   tutti nell'altezza della finestra, senza dover scorrere */
#story .panel-body {
  width: min(1080px, 100%, calc((100vh - 385px) * 16 / 9 + 2 * clamp(16px, 4cqi, 40px)));
  width: min(1080px, 100%, calc((100dvh - 385px) * 16 / 9 + 2 * clamp(16px, 4cqi, 40px)));
  padding-bottom: 3vh;
}

#story .panel-lede { margin-bottom: 20px; }

.chapters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.chapters button {
  padding: 8px 14px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.chapters button:focus-visible,
.chapters button.is-active {
  background: var(--ink);
  color: var(--screen);
  outline: none;
}
@media (hover: hover) {
  .chapters button:hover {
  background: var(--ink);
  color: var(--screen);
  outline: none;
}
}

/* ---------- My path: la mappa dei livelli ---------- */

.world {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overflow: clip;
  background: #1d4f9c; /* il mare della mappa, per i bordi quando la mappa non riempie */
}

.world-bar {
  position: relative;
  z-index: 3;
  flex: none;
  color: #fff;
  background: rgba(10, 25, 60, .55);
  padding-top: 10px;
  padding-bottom: 10px;
}

.world-bar .link-btn,
.world-bar .bar-path { color: rgba(255, 255, 255, .85); }
.world-bar .link-btn:focus-visible { color: var(--glow); }
@media (hover: hover) {
  .world-bar .link-btn:hover { color: var(--glow); }
}

.world-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(22px, 3cqi, 34px);
  color: var(--orange);
  text-shadow: 0 2px 0 var(--orange-deep), 0 4px 14px rgba(0, 0, 0, .35);
}

.world-viewport {
  position: relative;
  flex: 1;
  overflow: hidden;
  overflow: clip;
}

.world-viewport::before {
  content: "";
  position: fixed;
  inset: -60px;
  background: url("media/map/map-base.jpg") center / cover;
  filter: blur(30px) brightness(.8);
}

.world-viewport.is-scrollable {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.world.is-zoomed .world-viewport { overflow: hidden; }
.world.is-zoomed .stop-btn { pointer-events: none; }

.world-stage {
  position: absolute;
  transform-origin: 0 0;
  transition: transform 1s cubic-bezier(.65, 0, .25, 1), filter .6s ease;
  will-change: transform;
}

.world-map {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
}

.world.is-zoomed .world-stage { filter: blur(7px) brightness(.7) saturate(.9); transition-delay: 0s, .55s; }

.stop-btn {
  position: absolute;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transform-origin: 50% 100%;
}

/* segnalino da videogioco: una freccia di luce, come i pallini del sentiero, che sale e scende sopra ogni tappa */
.stop-btn:not(.is-rainbow)::after,
.rainbow-ring::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 0;
  height: 0;
  margin-left: -.8vw;
  margin-bottom: .4vw;
  border-left: .8vw solid transparent;
  border-right: .8vw solid transparent;
  border-top: 1.15vw solid #fff1bd;
  filter: drop-shadow(0 0 .18vw #fff) drop-shadow(0 0 .55vw #ffd66b) drop-shadow(0 0 1.1vw rgba(243, 162, 58, .85));
  animation: marker 1.2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes marker {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-.7vw); }
}

.stop-btn:nth-of-type(2)::after { animation-delay: .25s; }
.stop-btn:nth-of-type(3)::after { animation-delay: .5s; }
.stop-btn:nth-of-type(4)::after { animation-delay: .75s; }
.stop-btn:nth-of-type(5)::after { animation-delay: 1s; }

/* mentre l'edificio salta il segnalino si toglie di mezzo */
.stop-btn:focus-visible::after { opacity: 0; }
@media (hover: hover) {
  .stop-btn:hover::after { opacity: 0; }
}

.world.is-zoomed .stop-btn::after,
.world.is-zoomed .rainbow-ring { opacity: 0; animation: none; }

.stop-btn img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  filter: drop-shadow(0 0 0 rgba(255, 214, 107, 0));
}

/* a riposo ogni tappa luccica ogni tanto, sfasata, per far capire che è cliccabile */
.stop-btn:nth-of-type(1) img { animation: glimmer 5s ease-in-out infinite 0s; }
.stop-btn:nth-of-type(2) img { animation: glimmer 5s ease-in-out infinite 1s; }
.stop-btn:nth-of-type(3) img { animation: glimmer 5s ease-in-out infinite 2s; }
.stop-btn:nth-of-type(4) img { animation: glimmer 5s ease-in-out infinite 3s; }
.stop-btn:nth-of-type(5) img { animation: glimmer 5s ease-in-out infinite 4s; }

@keyframes glimmer {
  0%, 82%, 100% { filter: drop-shadow(0 0 0 rgba(255, 214, 107, 0)); }
  90% { filter: drop-shadow(0 0 .5vw rgba(255, 214, 107, .95)); }
}

/* passaggio del mouse (o focus da tastiera): salta sul posto e lampeggia.
   Gli effetti :hover stanno sotto (hover: hover), così sui touch non restano "accesi" dopo un tocco */
.stop-btn:focus-visible { outline: none; z-index: 2; }
@media (hover: hover) {
  .stop-btn:hover { outline: none; z-index: 2; }
}

.stop-btn:focus-visible img {
  animation: hop .7s cubic-bezier(.3, 0, .3, 1) infinite, blink .35s steps(1) infinite;
}
@media (hover: hover) {
  .stop-btn:hover img {
  animation: hop .7s cubic-bezier(.3, 0, .3, 1) infinite, blink .35s steps(1) infinite;
}
}

@keyframes hop {
  0%   { transform: translateY(0) scale(1, 1); }
  15%  { transform: translateY(0) scale(1.08, .9); }
  45%  { transform: translateY(-22%) scale(.95, 1.07); }
  70%  { transform: translateY(0) scale(1.06, .93); }
  85%  { transform: translateY(0) scale(.98, 1.02); }
  100% { transform: translateY(0) scale(1, 1); }
}

@keyframes blink {
  0%  { filter: drop-shadow(0 0 .7vw #ffd66b) drop-shadow(0 0 .2vw #fff) brightness(1.18); }
  50% { filter: drop-shadow(0 0 .25vw rgba(255, 214, 107, .5)) brightness(1); }
}

.stop-btn.is-rainbow { border-radius: 50%; }

/* punto d'appoggio invisibile della freccia, sopra l'arco dell'arcobaleno */
.rainbow-ring {
  position: absolute;
  left: 55%;
  top: 33%;
  width: 0;
  height: 0;
}

.stop-btn.is-rainbow:focus-visible .rainbow-ring::after {
  animation-duration: .5s;
  border-top-color: #fff;
}
@media (hover: hover) {
  .stop-btn.is-rainbow:hover .rainbow-ring::after {
  animation-duration: .5s;
  border-top-color: #fff;
}
}

.world-hint { transition: opacity .3s ease; }
.world.is-zoomed .world-hint { opacity: 0; }

/* scheda in sovraimpressione */
.stop-card-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.stop-card {
  position: relative;
  width: min(620px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 30px 32px 28px;
  border-radius: 26px;
  background: var(--screen);
  color: var(--ink);
  box-shadow: inset 0 -6px 0 #eadfbd, 0 30px 70px -20px rgba(0, 0, 0, .6);
  animation: card-in .55s cubic-bezier(.2, 1.4, .4, 1) both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(26px) scale(.9) rotate(-1.5deg); }
  to   { opacity: 1; transform: none; }
}

.card-level {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--orange-deep);
}

.card-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(28px, 4.2vw, 40px);
  line-height: 1.05;
  color: var(--orange);
  text-shadow: 0 3px 0 var(--orange-deep);
}

.card-meta {
  margin: 10px 0 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
}

.stop-card p { line-height: 1.6; }
.stop-card > p:last-of-type { margin-bottom: 0; }

/* segnaposto da riempire: si vedono tratteggiati finché non c'è il testo vero */
.todo {
  padding: 10px 12px;
  border: 2px dashed #e7b48f;
  border-radius: 12px;
  color: #b0866a;
  font-style: italic;
}

.card-go { margin-top: 18px; }

/* abilità sbloccate, come le ricompense di fine livello */
.skills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.skills::before {
  content: "Skills unlocked";
  flex-basis: 100%;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.skills li {
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff1bd;
  box-shadow: inset 0 -2px 0 #f3c56a, 0 0 10px rgba(255, 214, 107, .45);
  font-size: 13px;
  font-weight: 600;
}

.side-quest {
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: 18px;
  background: #fff3df;
  box-shadow: inset 0 0 0 2px #f6d3ae;
}

.side-quest h4 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 21px;
  color: var(--ink);
}

.side-quest p:last-child { margin: 0; }

.card-close {
  position: absolute;
  top: 18px;
  right: clamp(16px, 4cqi, 40px);
  color: rgba(255, 255, 255, .9);
  font-size: 14px;
}

.card-close:focus-visible { color: var(--glow); }
@media (hover: hover) {
  .card-close:hover { color: var(--glow); }
}

/* ---------- Next stop?: il cucchiaio e il gioco ---------- */

.next {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overflow: clip;
  background: #fcfdea; /* lo stesso crema dello sfondo dei fotogrammi del cucchiaio */
}

.next-bar { position: relative; z-index: 3; flex: none; }

.bend {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px 4vh;
  text-align: center;
}

.bend-title { margin: 0; }

/* i fotogrammi sono 3:4: il cucchiaio, anche piegato, ci sta tutto. Si piega tenendo premuto
   il pulsante o il cucchiaio stesso, quindi niente selezione, menu o scorrimento al tocco */
.bend-spoon {
  width: min(100%, 58vh * 3 / 4);
  flex: 0 1 auto;
  min-height: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  /* il cucchiaio dritto dietro i fotogrammi: si vede finché non arrivano */
  background: url("media/game/bend-poster.jpg") center / cover no-repeat;
  /* bordi sfumati nel crema della pagina, così si vede solo il cucchiaio */
  -webkit-mask-image: radial-gradient(ellipse 75% 70% at 50% 50%, #000 60%, transparent 100%);
  mask-image: radial-gradient(ellipse 75% 70% at 50% 50%, #000 60%, transparent 100%);
}

.bend-spoon canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  pointer-events: none;
}

@media (max-aspect-ratio: 1/1) {
  .bend-spoon { width: min(100%, 420px, 56vh * 3 / 4); width: min(100%, 420px, 56dvh * 3 / 4); }
}

.hold-btn {
  position: relative;
  overflow: hidden;
  min-width: 240px;
  justify-content: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.hold-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--glow);
  opacity: .55;
  pointer-events: none;
}

.hold-btn .level-name { position: relative; }
.hold-btn.is-holding { transform: translateY(2px) scale(.98); }

.game {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: url("media/game/sky.jpg") center / cover;
  user-select: none;
  -webkit-user-select: none;
}

.game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.hud {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--ink);
  pointer-events: none;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(254, 249, 232, .9);
  box-shadow: inset 0 -3px 0 #eadfbd, 0 8px 20px -10px rgba(0, 0, 0, .4);
}

.hud-item img { height: 26px; }
.hud-time { min-width: 64px; justify-content: center; }
.hud-time.is-low { color: var(--orange-deep); }
.hud-lives { color: #e0453a; letter-spacing: .1em; }

.game-panel {
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(560px, calc(100% - 32px));
  height: fit-content;
  max-height: calc(100% - 100px);
  overflow-y: auto;
  padding: 28px 30px;
  border-radius: 26px;
  background: var(--screen);
  text-align: center;
  box-shadow: inset 0 -6px 0 #eadfbd, 0 30px 70px -20px rgba(0, 0, 0, .55);
  animation: card-in .55s cubic-bezier(.2, 1.4, .4, 1) both;
}

.game-panel .card-title { margin-bottom: 14px; }

.game-rules {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.game-rules li { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.game-rules img { height: 70px; }

.game-how {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
}

kbd {
  display: inline-block;
  min-width: 1.8em;
  padding: 1px 6px;
  border-radius: 6px;
  background: #fff;
  box-shadow: inset 0 -2px 0 #d9cfb0;
  font-family: var(--font-mono);
  font-size: 12px;
}

.only-touch { display: none; }
.is-touch .only-touch { display: inline; }
.is-touch .only-keys { display: none; }

.game-panel .level { margin: 0 auto; }

.over-line {
  min-height: 2.8em;
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.4;
  color: #2f7d34;
}

.over-reveal {
  margin: 0 0 22px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.1;
  opacity: 0;
  transform: translateY(12px) scale(.96);
  transition: opacity .8s ease, transform .8s cubic-bezier(.2, 1.4, .4, 1);
}

.over-reveal strong { color: var(--orange); }
.over-reveal.is-on { opacity: 1; transform: none; }

.over-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.over-actions .level { margin: 0; }

.pad-controls {
  position: absolute;
  inset: auto 0 18px;
  display: flex;
  justify-content: space-between;
  padding: 0 18px;
  pointer-events: none;
}

.pad-btn {
  width: 68px;
  height: 68px;
  border: 0;
  border-radius: 50%;
  background: rgba(254, 249, 232, .85);
  box-shadow: inset 0 -4px 0 #eadfbd, 0 8px 20px -10px rgba(0, 0, 0, .4);
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  pointer-events: auto;
  touch-action: none;
}

.pad-btn:active { transform: scale(.94); }

.whisper {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .06em;
  color: rgba(93, 84, 112, .55);
}

.contacts {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: 460px;
}

/* Contact: il personaggio di plastilina saluta accanto ai pulsanti */
.contact-body {
  display: flex;
  align-items: center;
  gap: clamp(24px, 5cqi, 64px);
  width: min(960px, 100%);
  min-height: calc(100% - 70px);
}

.contact-main { flex: 1; min-width: 0; }

.contact-me {
  position: relative;
  flex: none;
  width: clamp(150px, 24cqi, 240px);
  padding-top: 64px;
}

.contact-me img {
  display: block;
  width: 100%;
  height: auto;
  transform-origin: 50% 100%;
  animation: greet 2.6s ease-in-out infinite;
  filter: drop-shadow(0 18px 14px rgba(42, 34, 56, .18));
}

@keyframes greet {
  0%, 100% { transform: translateY(0) rotate(0); }
  20% { transform: translateY(-6%) rotate(-2deg); }
  35% { transform: translateY(0) scale(1.03, .97); }
  50% { transform: translateY(0) rotate(1.5deg); }
}

.bubble {
  position: absolute;
  top: 0;
  left: 58%;
  margin: 0;
  padding: 10px 16px;
  border-radius: 18px;
  background: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  white-space: nowrap;
  color: var(--ink);
  box-shadow: inset 0 -3px 0 #eadfbd, 0 10px 24px -14px rgba(42, 34, 56, .6);
  animation: pop-bubble 2.6s ease-in-out infinite;
}

.bubble::after {
  content: "";
  position: absolute;
  left: 18px;
  bottom: -10px;
  border: 10px solid transparent;
  border-top-color: #fff;
  border-bottom: 0;
}

@keyframes pop-bubble {
  0%, 100% { transform: scale(1); }
  20% { transform: scale(1.08) rotate(-2deg); }
}

.contact-label {
  font-size: clamp(14px, 1.8cqi, 20px);
  overflow-wrap: anywhere;
}

@container (max-width: 640px) {
  .contact-body { flex-direction: column; align-items: stretch; text-align: left; }
  .contact-me { align-self: center; width: 150px; }
}

/* ---------- Nuvole ---------- */

.clouds {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  overflow: hidden;
}

.clouds.is-active { pointer-events: auto; }

.clouds-fill {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 55%, #fff4ea 0%, #ffe3cf 55%, #f8cdb6 100%);
  opacity: 0;
}

.cloud {
  position: absolute;
  left: 0;
  top: 0;
  width: 62vmax;
  height: auto;
  will-change: transform;
  user-select: none;
}

/* ---------- Easter egg ---------- */

.egg {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b0d12;
  color: #fff;
  overflow: hidden;
}

.egg-spoon {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .5;
  animation: bend 3.2s cubic-bezier(.6, 0, .3, 1) both;
}

@keyframes bend {
  0%   { transform: none; filter: saturate(1); }
  35%  { transform: perspective(900px) rotateX(4deg) skewY(-3deg) scaleY(.97); }
  60%  { transform: perspective(900px) rotateX(-6deg) skewY(5deg) scale(1.04); filter: saturate(1.3) hue-rotate(-8deg); }
  100% { transform: perspective(900px) rotateX(0) skewY(0) scale(1.08); filter: saturate(1.1); }
}

.egg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 55% at 50% 50%, rgba(8, 10, 14, .82), rgba(8, 10, 14, .35) 70%, rgba(8, 10, 14, .55));
  z-index: 1;
}

.egg-text,
.egg-close { z-index: 2; }

.egg-text {
  position: relative;
  width: min(900px, 100%);
  padding: 0 24px;
  text-align: center;
}

.egg-line {
  min-height: 2.6em;
  margin: 0 0 28px;
  font-family: var(--font-mono);
  font-size: clamp(18px, 2.6vw, 30px);
  line-height: 1.3;
  color: #9dff9a;
  text-shadow: 0 0 12px rgba(157, 255, 154, .55);
}

.egg-reveal {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(34px, 6vw, 72px);
  line-height: 1.05;
  opacity: 0;
  transform: translateY(16px) scale(.96);
  transition: opacity .8s ease, transform .8s cubic-bezier(.2, 1.4, .4, 1);
}

.egg-reveal strong { color: var(--orange); }
.egg-reveal.is-on { opacity: 1; transform: none; }

.egg-close {
  position: absolute;
  top: 18px;
  right: 24px;
  color: rgba(255, 255, 255, .7);
}

/* Tutta la pagina si "piega" un attimo quando parte l'easter egg */
body.is-bending .view:not([hidden]) { animation: rubber .9s ease-in-out; }

@keyframes rubber {
  30% { transform: skewX(-6deg) scaleY(.96); }
  60% { transform: skewX(4deg) scaleY(1.02); }
}

/* ---------- Telefono e movimento ridotto ---------- */

@container (max-width: 560px) {
  .levels { grid-template-columns: 1fr; }
  .bar { font-size: 12px; }
}

/* scritte dentro il monitor leggibili anche quando il monitor è piccolo (telefono) */
.boot-line { font-size: max(9cqw, 17px); }
.hint { font-size: max(3.4cqw, 11px); }

/* sui touch lo schermo "chiama" il tocco con un bagliore lento */
.screen.is-inviting::after { animation: invite 2.2s ease-in-out infinite; }

@keyframes invite {
  0%, 100% { box-shadow: inset 0 0 0 0 rgba(242, 107, 29, 0); }
  50% { box-shadow: inset 0 0 0 .7cqw rgba(242, 107, 29, .7), inset 0 0 6cqw rgba(255, 214, 107, .6); }
}

/* durante il gioco la barra in alto resta leggibile sopra il cielo */
.next.is-playing .next-bar {
  background: rgba(10, 25, 60, .45);
  color: rgba(255, 255, 255, .85);
}

.next.is-playing .next-bar .link-btn { color: rgba(255, 255, 255, .9); }
.next.is-playing .next-bar .link-btn:focus-visible { color: var(--glow); }
@media (hover: hover) {
  .next.is-playing .next-bar .link-btn:hover { color: var(--glow); }
}

/* My path in verticale: l'Italia intera in larghezza e sotto l'elenco delle tappe */
.stop-list { display: none; }

.world.is-portrait { overflow-y: auto; }
.world.is-portrait .world-viewport { flex: none; }

/* in verticale la barra resta su una riga: l'indicazione non serve, c'è l'elenco */
.world.is-portrait .world-hint { display: none; }
.world.is-portrait .world-title { position: absolute; left: 50%; transform: translateX(-50%); }
.world-bar .link-btn,
.world-title { white-space: nowrap; }

.world.is-portrait .stop-list {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 6px 16px 24px;
  transition: filter .6s ease, opacity .6s ease;
}

.world.is-portrait.is-zoomed .stop-list { filter: blur(7px); opacity: .5; pointer-events: none; }

.stop-list .level {
  min-height: 52px;
  padding: 10px 12px;
  gap: 8px;
  border-radius: 16px;
  text-align: left;
}

.stop-list .level-num { min-width: 30px; padding: 3px 6px; font-size: 11px; }
.stop-list .level-name { font-size: 15px; line-height: 1.15; }

.world.is-portrait .stop-btn:not(.is-rainbow)::after,
.world.is-portrait .rainbow-ring::after {
  margin-left: -7px;
  margin-bottom: 4px;
  border-left-width: 7px;
  border-right-width: 7px;
  border-top-width: 10px;
  animation-name: marker-sm;
}

@keyframes marker-sm {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* sul telefono la scheda parte sotto la barra, così "close" resta sempre visibile */
@media (max-width: 640px) {
  .stop-card-layer { align-items: flex-start; padding: 72px 12px 12px; }
  .stop-card { padding: 22px 20px; max-height: 100%; }
  .stop-card p { font-size: 15px; }
  .card-close { top: 14px; }
  .egg-line { font-size: 15px; }
}

.egg-reveal strong { white-space: nowrap; }

/* dita: aree di tocco più grandi senza cambiare l'aspetto */
@media (pointer: coarse) {
  .link-btn { min-height: 44px; padding: 10px 6px; }
  .stop-btn:not(.is-rainbow)::before,
  .film-sound::before {
    content: "";
    position: absolute;
    inset: -6px;
  }
}

/* schermi bassi (telefono in orizzontale): tutto deve stare senza scorrere */
@media (max-height: 500px) {
  .bar { padding-top: 10px; padding-bottom: 10px; }
  .desktop-body { justify-content: flex-start; padding-bottom: 12px; }
  .title { font-size: min(clamp(34px, 8cqi, 92px), 11vh); }
  .lede { margin-bottom: 14px; }
  .levels { gap: 10px; }
  .levels .level { padding: 10px 18px; }

  .stop-card-layer { align-items: flex-start; padding: 58px 16px 12px; }
  .stop-card { padding: 18px 24px; }

  .bend { gap: 4px; padding-bottom: 8px; }
  .bend-title { font-size: 30px; }
  .bend-spoon { width: min(100%, (100vh - 210px) * 3 / 4); width: min(100%, (100dvh - 210px) * 3 / 4); }

  .hud { top: 52px; font-size: 18px; }
  .game-panel { padding: 14px 20px; max-height: calc(100% - 64px); margin-top: 52px; }
  .game-panel .card-title { font-size: 26px; margin-bottom: 8px; }
  .game-rules { margin-bottom: 8px; }
  .game-rules img { height: 40px; }
  .game-how { margin-bottom: 10px; font-size: 13px; line-height: 1.45; }
  .over-line { min-height: 0; margin-bottom: 6px; font-size: 13px; }
  .over-reveal { margin-bottom: 12px; font-size: 26px; }
  .game-panel .level { padding-top: 10px; padding-bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .caret, .hint.is-on, .egg-spoon, .stop-btn, .stop-btn img, .stop-btn::after, .rainbow-ring::after, .contact-me img, .bubble, .film-sound { animation: none !important; }
  .level, .desktop, .egg-reveal, .world-stage { transition: none; }
  .stop-card { animation: none; }
}
