:root {
  --p-900: #041b1a;
  --p-800: #072a29;
  --p-700: #0b3b39;
  --p-600: #0f4f4c;
  --tungsteno: #ff8a3d;
  --tungsteno-ombra: #d9602a;
  --tungsteno-chiaro: #ffb27a;
  --menta: #86cfc4;
  --pesca: #ffc896;
  --bianco: #f6f7f3;
  --inchiostro: #07201f;
  --linea: rgba(134, 207, 196, 0.26);
  --linea-forte: rgba(246, 247, 243, 0.32);
  --e-elastico: cubic-bezier(0.34, 1.9, 0.45, 1);
  --e-uscita: cubic-bezier(0.23, 1, 0.32, 1);
  /* le misure le scrive script.js a ogni resize */
  --cw: 300px;
  --ch: 420px;
  --lw: 300px;
  --th: 48px;
  --cs: 48px;
  --spazio: 12px;
  --bordo: 14px;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  height: 100%;
}

body {
  width: 100vw;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: var(--p-800);
  color: var(--bianco);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.nascosto {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

button {
  font: inherit;
  color: inherit;
}

/* ------------------------------------------------------------------ the frame: header, maze, arrows */
.gioco {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spazio);
  padding: var(--bordo);
}

.testa {
  width: var(--lw);
  height: var(--th);
  flex: none;
  display: flex;
  align-items: center;
  gap: calc(var(--th) * 0.42);
  padding: 0 2px;
}
.conto {
  display: grid;
  gap: 1px;
  line-height: 1;
}
.conto__nome {
  font-size: clamp(10px, calc(var(--th) * 0.22), 13px);
  font-weight: 560;
  font-stretch: 112%;
  color: var(--menta);
}
.conto__valore {
  font-size: calc(var(--th) * 0.46);
  font-weight: 700;
  font-stretch: calc(var(--w, 112) * 1%);
  letter-spacing: -0.03em;
  display: inline-block;
  transform-origin: 0 70%;
}
.conto--record .conto__valore {
  color: var(--pesca);
}
.vite {
  margin-left: auto;
  display: flex;
  gap: calc(var(--th) * 0.08);
}
.vita {
  width: calc(var(--th) * 0.4);
  height: calc(var(--th) * 0.4);
  display: block;
}
.vita.persa {
  opacity: 0.18;
  filter: grayscale(1);
}
.tasti {
  display: flex;
  gap: 6px;
}
.tondo {
  position: relative;
  width: calc(var(--th) * 0.78);
  height: calc(var(--th) * 0.78);
  max-width: 44px;
  max-height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--bianco);
  cursor: pointer;
  isolation: isolate;
}
.tondo::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--linea-forte);
  transition: inset 0.6s var(--e-elastico), transform 0.16s var(--e-uscita), background-color 0.3s ease;
}
.tondo svg {
  width: 46%;
  height: 46%;
  grid-area: 1 / 1;
  transition: transform 0.6s var(--e-elastico);
}
.tondo__spento,
.tondo__via { display: none; }
.tondo[data-spento] .tondo__acceso { display: none; }
.tondo[data-spento] .tondo__spento { display: block; }
.tondo[data-fermo] .tondo__pausa { display: none; }
.tondo[data-fermo] .tondo__via { display: block; }
.tondo:active::before { transform: scale(0.9); }
.tondo:focus-visible {
  outline: 2px solid var(--tungsteno-chiaro);
  outline-offset: 2px;
}
@media (hover: hover) and (pointer: fine) {
  .tondo:hover::before {
    inset: -3px;
    background: rgba(246, 247, 243, 0.08);
  }
  .tondo:hover svg { transform: rotate(-10deg); }
}

.campo {
  position: relative;
  width: var(--cw);
  height: var(--ch);
  flex: none;
  touch-action: none;
  outline: none;
}
.tela {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ------------------------------------------------------------------ the cards over the maze */
.cartello {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 6%;
  border-radius: clamp(10px, calc(var(--cw) * 0.03), 18px);
  background: rgba(7, 42, 41, 0.84);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  container-type: size;
  text-align: center;
}
.cartello[hidden] { display: none; }
.cartello__dentro {
  display: grid;
  justify-items: center;
  gap: clamp(8px, 3.2cqh, 22px);
  max-width: 100%;
}
.cast {
  display: block;
  width: min(86cqw, 420px);
  height: auto;
  aspect-ratio: 8.6 / 1.5;
}
.titolo {
  margin: 0;
  font-size: min(17cqw, 21cqh);
  font-weight: 720;
  font-stretch: calc(var(--w, 125) * 1%);
  line-height: 0.88;
  letter-spacing: -0.045em;
  color: var(--bianco);
  text-wrap: balance;
}
.titolo--medio { font-size: min(13cqw, 16cqh); }
.titolo .parola {
  display: inline-block;
  overflow: clip;
  padding: 0.04em 0.03em 0.1em;
  margin: -0.04em -0.03em -0.1em;
  vertical-align: top;
}
.titolo .parola > span { display: inline-block; }
.come {
  margin: 0;
  max-width: 30em;
  font-size: clamp(12.5px, 3.4cqw, 17px);
  font-weight: 460;
  line-height: 1.4;
  color: rgba(246, 247, 243, 0.82);
  text-wrap: balance;
}
.tasti-guida {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: clamp(12px, 3cqw, 14px);
  font-weight: 560;
  font-stretch: 110%;
  color: var(--menta);
}
.tasti-guida__o { margin: 0 6px; }
.tasto-grafico {
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  box-shadow: inset 0 0 0 1px var(--linea-forte), inset 0 -2px 0 rgba(246, 247, 243, 0.12);
  color: var(--bianco);
  font-size: 12px;
  font-weight: 640;
  line-height: 1;
}
.tasto-grafico svg {
  width: 14px;
  height: 14px;
}
.tasti-guida--tocco { display: none; max-width: 24em; text-wrap: balance; }
.tocco .tasti-guida--tastiera { display: none; }
.tocco .tasti-guida--tocco { display: block; }

.etichetta {
  margin: 0;
  font-size: clamp(13px, 4cqw, 18px);
  font-weight: 600;
  font-stretch: 115%;
  color: var(--menta);
}
.punteggio {
  margin: 0;
  font-size: min(24cqw, 28cqh);
  font-weight: 740;
  font-stretch: calc(var(--w, 125) * 1%);
  line-height: 0.86;
  letter-spacing: -0.05em;
  color: var(--tungsteno-chiaro);
}
.fine__riga {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: clamp(13px, 3.6cqw, 17px);
  font-weight: 500;
  color: rgba(246, 247, 243, 0.82);
}
.fine__riga strong {
  font-weight: 700;
  font-stretch: 115%;
  color: var(--pesca);
}
.bollino {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--tungsteno);
  color: var(--inchiostro);
  font-size: 12.5px;
  font-weight: 660;
  font-stretch: 110%;
}
.bollino[hidden] { display: none; }

/* ------------------------------------------------------------------ the elastic pill of the site */
.pillola {
  --gonfia: 7px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 30px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--inchiostro);
  font-size: 1rem;
  font-weight: 650;
  font-stretch: 100%;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
  isolation: isolate;
}
.pillola::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--tungsteno);
  transition: inset 0.6s var(--e-elastico), transform 0.16s var(--e-uscita), background-color 0.3s ease;
}
.pillola__testo {
  display: inline-grid;
  text-align: center;
  transition: font-stretch 0.6s var(--e-elastico);
}
/* the label at its widest, invisible and zero high: it keeps the room, so nothing around moves */
.pillola__testo::before {
  content: attr(data-testo);
  grid-area: 1 / 1;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-stretch: 125%;
}
.pillola:focus-visible {
  outline: 2px solid var(--bianco);
  outline-offset: 4px;
}
@media (hover: hover) and (pointer: fine) {
  .pillola:hover::before {
    inset: -2px calc(var(--gonfia) * -1);
    background: var(--tungsteno-chiaro);
  }
  .pillola:hover .pillola__testo { font-stretch: 125%; }
}
.pillola:active::before { transform: scale(1.03, 0.88); }

/* ------------------------------------------------------------------ the arrows for the phone */
.croce {
  display: none;
  flex: none;
  grid-template-columns: repeat(3, var(--cs));
  grid-template-rows: repeat(3, var(--cs));
  gap: 4px;
}
.tocco .croce { display: grid; }
.croce__tasto {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: none;
  color: var(--bianco);
  cursor: pointer;
  touch-action: none;
  isolation: isolate;
}
.croce__tasto::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--p-700);
  box-shadow: inset 0 0 0 1px var(--linea);
  transition: transform 0.45s var(--e-elastico), background-color 0.2s ease;
}
.croce__tasto svg {
  width: 42%;
  height: 42%;
  transition: transform 0.45s var(--e-elastico);
}
.croce__tasto--su { grid-area: 1 / 2; }
.croce__tasto--sinistra { grid-area: 2 / 1; }
.croce__tasto--giu { grid-area: 3 / 2; }
.croce__tasto--destra { grid-area: 2 / 3; }
.croce__tasto--sinistra svg { rotate: -90deg; }
.croce__tasto--giu svg { rotate: 180deg; }
.croce__tasto--destra svg { rotate: 90deg; }
.croce__tasto.premuto::before {
  transform: scale(0.9);
  background: var(--p-600);
}
.croce__tasto.premuto svg { transform: scale(0.86); color: var(--tungsteno-chiaro); }
.croce__tasto:focus-visible {
  outline: 2px solid var(--tungsteno-chiaro);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ the shutter */
.otturatore {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  pointer-events: none;
  visibility: hidden;
}
.otturatore > span {
  flex: var(--f, 1);
  height: 100%;
  background: var(--p-900);
  transform: scaleY(0);
  transform-origin: 50% 0;
  box-shadow: inset 1px 0 0 rgba(246, 247, 243, 0.07);
}

/* ------------------------------------------------------------------ the preview square of the section */
.anteprima .tasti,
.anteprima .croce,
.anteprima .cartello { display: none; }
.anteprima body { cursor: default; }

@media (prefers-reduced-motion: reduce) {
  .pillola::before,
  .pillola__testo,
  .tondo::before,
  .tondo svg,
  .croce__tasto::before,
  .croce__tasto svg {
    transition: background-color 0.2s ease, opacity 0.2s ease;
  }
}
