* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { overflow: hidden; }

:root{
  --ui-scale: 1;
}

/* Schermo pieno con background */
.home{
  position: relative;
  width: 100%;
  height: 100svh;
  background: url("../assets/img/home-background.webp") center / cover no-repeat;

  --ui-scale: 1;

  /* nuove variabili spazi */
  --gap-title-levels: 5.2vh;  /* spazio tra titolo e colonna bottoni */
  --gap-levels-bottom: 5.8vh; /* spazio tra colonna bottoni e blocco sotto */

  --gap-title-to-levels: 40px;
  --gap-levels-to-bottom: 40px;
}



/* Overlay UI sopra al background */
.home__ui{
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: scale(var(--ui-scale, 1));
  transform-origin: top center;
}


/* Titolo: alto, centrato */
.home__title{
  width: min(82vw, 480px);
  margin-top: 7vh;
  margin-bottom: var(--gap-title-to-levels);
}

/* Colonna livelli: centrata verticalmente come nel mockup */
.home__levels{
  width: min(78vw, 400px);
  margin-top: 0;
  margin-bottom: var(--gap-levels-to-bottom);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2vh;
}

/* Se vuoi che il GURU sia un filo più largo/“pesante” */
.imgbtn--guru{
  width: 100%;
}

/* Blocco basso (timer +5 + start) */
.home__bottom{
  margin-top: 0;
  width: min(78vw, 400px);
  padding-bottom: calc(env(safe-area-inset-bottom) + 2.8vh);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4vh;
}


/* Riga timer */
.home__timerRow{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5vw;
}

.home__seconds{
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: clamp(200px, 200vw, 200px);
  line-height: 1;
  color: #2b2b2b;
  min-width: 64px;
  text-align: center;
  user-select: none;
}

#seconds{
  font-family: "Chelsea Market", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 400;
  font-size: clamp(100px, 100vw, 100px);
}

/* Bottoni immagine: niente stile browser */
.imgbtn{
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.imgbtn img{
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
}

/* Dimensioni bottoni livelli */
.imgbtn--level{
  width: 80%;      /* prova 92% (più piccoli). Se vuoi ancora: 88% */
  max-width: 380px; /* limite per non “esplodere” su desktop */
}

/* +5 e start dimensionati come nel mockup */
.imgbtn--plus{
  width: min(26vw, 140px);
}

.imgbtn--start{
  width: min(72vw, 360px);
}

.imgbtn:active{ transform: scale(0.99); }

/* Schermi bassi: stringe ancora un po’ */
@media (max-height: 760px) {
  .home { --ui-scale: 0.88; }
  .home__title { margin-top: 6vh; }
  .home__levels { gap: 1.0vh; }
  .home__bottom { padding-bottom: calc(env(safe-area-inset-bottom) + 2.2vh); }
}

@media (max-height: 680px) {
  .home { --ui-scale: 0.84; }
  .home__title { margin-top: 5vh; }
}

@media (max-width: 420px){
  :root{
    --ui-scale: 0.85;
  }
  .home{
    --gap-title-levels: calc(var(--gap-title-levels) * 0.85);
    --gap-levels-bottom: calc(var(--gap-levels-bottom) * 0.85);
  }
}

@media (max-width: 480px){
  .home{
    --ui-scale: 0.70;
    --gap-title-levels: calc(var(--gap-title-levels) * 0.85);
    --gap-levels-bottom: calc(var(--gap-levels-bottom) * 0.85);
  }
}

.imgbtn:disabled { opacity: 0.5; cursor: default; }

@keyframes pop {
  0%   { transform: scale(1); }
  55%  { transform: scale(1.06); }
  85%  { transform: scale(0.985); }
  100% { transform: scale(1.02); }
}

.imgbtn--level{
  transition: transform 180ms cubic-bezier(.2, .9, .2, 1),
              filter 180ms ease,
              opacity 180ms ease;
  will-change: transform, filter, opacity;
}

.imgbtn--level.is-selected{
  transform: scale(1.02);
  filter: drop-shadow(0 10px 18px rgba(0,0,0,.25)) drop-shadow(0 0 10px rgba(255,255,255,.22));
}

.home__levels.has-selection .imgbtn--level:not(.is-selected){
  opacity: 0.62;
  filter: saturate(0.85);
}

.imgbtn--level.is-bouncing{
  animation: pop 220ms cubic-bezier(.2, 1.4, .2, 1);
}

.imgbtn:disabled{
  opacity: 0.45;
  cursor: default;
  transform: none;
  filter: grayscale(1) saturate(0.2);
}

.imgbtn:disabled img{
  filter: grayscale(1) saturate(0.2);
}

.imgbtn.is-disabled{
  opacity: 0.45;
  cursor: default;
  transform: none !important;
  filter: grayscale(1) saturate(0.2);
  pointer-events: none;
}

.imgbtn.is-disabled img{
  filter: grayscale(1) saturate(0.2);
}

.screen2{ height: 100svh; display:flex; flex-direction:column; overflow:hidden; --streaming-top: 72%; --word-top: 77%; --word-left: 50%; --word-size: clamp(32px, 4vw, 40px); --word-maxw: min(92vw, 760px); }
.screen2__header, .screen2__footer{ width:100%; height:auto; display:block; }
.screen2__headerWrap{
  position: relative;   /* fondamentale per l’overlay della parola */
  width: 100%;
}
.screen2__mid{ position:relative; flex:1; width:100%; overflow:hidden; }
.screen2__midImg{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; z-index:1; }
.screen2__streaming{
  position: absolute;
  left: 50%;
  top: var(--streaming-top);
  transform: translate(-50%, -50%);
  width: min(92vw, 680px);
  height: auto;
  z-index: 2;
  pointer-events: none;
  user-select: none;
}
.screen2__word{
  position: absolute;
  left: var(--word-left);
  top: var(--word-top);
  transform: translate(-50%, -50%);
  z-index: 10;
  width: var(--word-maxw);
  text-align: center;

  font-family: "Chelsea Market", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 400;
  font-size: var(--word-size);
  line-height: 1.1;
  white-space: normal;
  overflow-wrap: break-word;
  color: rgba(255,255,255,0.95);
  text-shadow: 0 10px 26px rgba(0,0,0,0.55);
  user-select: none;
  pointer-events: none;
}
.screen2__countdown{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  z-index: 4;

  font-family: "Chelsea Market", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 400;
  letter-spacing: 0.5px;

  font-size: clamp(88px, 18vw, 150px);
  line-height: 1;

  color: #fff;
  -webkit-text-stroke: 0 transparent;
  text-shadow: 0 10px 26px rgba(0,0,0,0.55);

  user-select:none;
  pointer-events:none;
}
.screen2__countdown.is-pulsing{
  animation: tiktokPulse 260ms cubic-bezier(.2, 1.4, .2, 1);
}
@keyframes tiktokPulse {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.10); }
  75%  { transform: scale(0.98); }
  100% { transform: scale(1.02); }
}
.screen2__skip{
  position:absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));          /* <-- distanza dal fondo dell’area centrale */
  border:0;
  background:transparent;
  padding:0;
  cursor:pointer;
  z-index:6;
  -webkit-tap-highlight-color:transparent;
}
.screen2__skip img{ width:min(30vw,184px); height:auto; display:block; }

.screen3{
  height: 100svh;
  position: relative;
  overflow: hidden;
  background: #000;
}

.screen3__video{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.screen3__timer{
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  z-index: 5;
  font-family: "Chelsea Market", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 400;
  font-size: clamp(54px, 12vw, 110px);
  line-height: 1;
  color: rgba(0,0,0,0.85);
  text-shadow: 0 10px 26px rgba(0,0,0,0.35);
  -webkit-text-stroke: 2px rgba(255,255,255,0.25);
  user-select: none;
  pointer-events: none;
}

/* restart in basso al centro */
.screen3__restart{
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 6;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.screen3__restart img{
  width: min(62vw, 340px);
  height: auto;
  display: block;
}

.is-hidden{ display:none; }

.menu__btn{
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 999;
  width: 46px;
  height: 46px;
  border: 0;
  background: rgba(255,255,255,0.65);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.menu__icon{
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 2px;
  background: rgba(0,0,0,0.8);
  transform: translate(-50%,-50%);
  border-radius: 2px;
}
.menu__icon::before,
.menu__icon::after{
  content:"";
  position:absolute;
  left:0;
  width: 22px;
  height: 2px;
  background: rgba(0,0,0,0.8);
  border-radius: 2px;
}
.menu__icon::before{ top: -7px; }
.menu__icon::after{ top: 7px; }

.menu__panel{
  position: fixed;
  top: 66px;
  right: 14px;
  z-index: 998;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  width: min(78vw, 280px);
  background: rgba(255,255,255,0.78);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 18px 40px rgba(0,0,0,0.18);
}

.menu__panel.is-hidden{
  display: none !important;
}

.menu__item{
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  color: rgba(0,0,0,0.86);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.6);
}
.menu__item:active{
  transform: scale(0.98);
}

.menu__btn.is-disabled{
  opacity: 0.35;
  pointer-events: none;
  filter: grayscale(1);
}

.banner{
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.banner.is-hidden{ display:none; }

.banner__card{
  position: relative;
  width: min(92vw, 520px);
  transform: translateX(-120%);
  opacity: 0;
  transition: transform 220ms ease-out, opacity 220ms ease-out;
  will-change: transform, opacity;
}

.banner.is-open .banner__card{
  transform: translateX(0);
  opacity: 1;
}

.banner.is-closing .banner__card{
  transform: translateX(-120%);
  opacity: 0;
}

.banner__img{
  display:block;
  width: 100%;
  height: auto;
  border-radius: 16px;
  box-shadow: 0 18px 46px rgba(0,0,0,0.25);
  user-select: none;
  -webkit-user-drag: none;
}

.banner__close{
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: rgba(255,255,255,0.78);
  cursor: pointer;
  font-size: 26px;
  line-height: 38px;
  text-align: center;
  color: rgba(0,0,0,0.85);
  -webkit-tap-highlight-color: transparent;
}

/* A2HS demo banner (bottom) */
.a2hs{
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 14px 34px rgba(0,0,0,0.22);

  transform: translateY(160%);
  opacity: 0;
  pointer-events: none;
}

.a2hs.is-visible{
  pointer-events: auto;
  opacity: 1;
  animation: a2hs-spring 650ms cubic-bezier(.2,.9,.2,1) both;
}

/* Entrata "molla" tipo Dock */
@keyframes a2hs-spring{
  0%   { transform: translateY(160%) scale(0.985); }
  60%  { transform: translateY(-8px)  scale(1.01); }
  80%  { transform: translateY(3px)   scale(0.999); }
  100% { transform: translateY(0)     scale(1); }
}

.a2hs__close{
  appearance: none;
  border: 0;
  background: transparent;
  font-size: 26px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  opacity: 0.65;
}
.a2hs__close:active{ transform: scale(0.96); opacity: 0.85; }

.a2hs__icon{
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #111;
  color: #fff;
  flex: 0 0 auto;
  position: relative;
  overflow: hidden;
}

/* Micro-bounce interno (solo icona) */
.a2hs__iconGlyph{
  display: inline-block;
  font-size: 18px;
  transform: translateY(0);
  animation: a2hs-bob 1.35s ease-in-out infinite;
}
@keyframes a2hs-bob{
  0%,100% { transform: translateY(2px); }
  50%     { transform: translateY(-5px); }
}

.a2hs__text{ min-width: 0; }
.a2hs__title{
  font: 650 15px/1.1 system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: #111;
  margin-bottom: 4px;
}
.a2hs__subtitle{
  font: 400 13px/1.25 system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: rgba(0,0,0,0.62);
}

.a2hs__cta{
  margin-left: auto;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0,0,0,0.06);
  color: rgba(0,0,0,0.78);
  font: 650 13px/1 system-ui, -apple-system, Segoe UI, Roboto, Arial;
  flex: 0 0 auto;
}

/* Safe area iPhone */
@supports (padding: max(0px)){
  .a2hs{
    bottom: max(12px, env(safe-area-inset-bottom));
  }
}

/* Accessibilità: riduci movimento */
@media (prefers-reduced-motion: reduce){
  .a2hs.is-visible{ animation: none; transform: translateY(0); opacity: 1; }
  .a2hs__iconGlyph{ animation: none; }
}

.screen3{
  --game-word-top: 18%;
  --game-word-size: 24px;
  --game-word-maxw: min(86vw, 720px);
}

.screen3__word{
  position: absolute;
  left: 50%;
  top: var(--game-word-top);
  transform: translate(-50%, -50%);
  z-index: 6;

  width: var(--game-word-maxw);
  text-align: center;

  font-family: "Chelsea Market", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 400;
  font-size: var(--game-word-size);
  line-height: 1.2;

  color: rgba(0, 0, 0, 0.95);
  text-shadow: 0 10px 26px rgba(0,0,0,0.55);

  pointer-events: none;
  user-select: none;
}
