/*
Z-INDEX SYSTEM
--z-ui: 100; // Pulsanti principali (es. Acquista, Info)
--z-overlay: 90; // Box informativi, tutorial
--z-input: 80; // Campi di testo
--z-quadrotto: 70; // Cornice e contenuto quadro
--z-gradient: 10; // Gradiente laterale decorativo
--z-background: 0; // Overlay iniziale, sfondo
*/

/* Variabili CSS per dimensioni consistenti */
:root {
  /* Base size a 1080p (1920x1080) */
  --base-frame-size: 45vh;
  --base-border-width: 2.5vw;
  
  /* Calcolo dinamico basato su viewport */
  --viewport-scale: min(1vw, 1vh);
  
  /* Desktop */
  --frame-size-desktop: min(45vh, 45vw);
  --border-width-desktop: calc(2.5 * var(--viewport-scale));
  
  /* Mobile */
  --frame-size-mobile: min(60vw, 35vh);
  --border-width-mobile: max(10px, calc(3.2 * var(--viewport-scale)));
}

:root {
  --highlight-color: #71CBF4;
  --z-ui: 100;
  --z-overlay: 90;
  --z-input: 80;
  --z-quadrotto: 70;
  --z-gradient: 10;
  --z-background: 0;
  --z-intro: 200;
  --rot: 0;
  --gradient-bg: none;
}

#cursor {
  width: 20px;
  height: 20px;
  border: 3px solid var(--highlight-color);
  border-radius: 50%;
  position: fixed;
  pointer-events: none;
  z-index: 999;
  -webkit-transform: translate(-50%, -50%);
      -ms-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
  background-color: transparent;
}

#narrator {
  position: absolute;
  display: block;
  height: 100vh;
  width: 100vw;
  text-align: center;
  font-size: 1.2vw;
  
  color: var(--highlight-color);
  pointer-events: none;
  z-index: var(--z-intro);
}

#narrator p {
  opacity: 0;
  top: 0;
  width: 100%;
  -webkit-transition: opacity 1s ease;
  -o-transition: opacity 1s ease;
  transition: opacity 1s ease;
  position: absolute;
  
  background: white;
  filter: blur(0px);
  padding: 3vw;
  box-shadow: 0 0 7vw 11vw white;
}

#narrator p.active {
  -webkit-animation: fade-in-out 6s !important;
          animation: fade-in-out 6s !important;
}

@-webkit-keyframes fade-in-out {
  0% { opacity: 0; -webkit-filter: blur(60px); filter: blur(60px);}
  15% { opacity: 1; -webkit-filter: blur(0px); filter: blur(0px);}
  75% { opacity: 1; -webkit-filter: blur(0px); filter: blur(0px);}
  100% { opacity: 0; -webkit-filter: blur(60px); filter: blur(60px);}
}

@keyframes fade-in-out {
  0% { opacity: 0; -webkit-filter: blur(60px); filter: blur(60px);}
  15% { opacity: 1; -webkit-filter: blur(0px); filter: blur(0px);}
  75% { opacity: 1; -webkit-filter: blur(0px); filter: blur(0px);}
  100% { opacity: 0; -webkit-filter: blur(60px); filter: blur(60px);}
}

    
@font-face {
  font-family: 'nesiota-regular';
  -webkit-font-feature-settings: "case" 1;
          font-feature-settings: "case" 1;
  src: url('http://iquadrotti.it/wp-content/themes/salient/fonts/Nesiota-Regular.otf');
  font-weight: normal;
  font-style: normal;
}

*:not(.audio-player *) {
  margin: 0;
  padding: 0;
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
  font-family: nesiota-regular, 'Nesiota' !important;
}
.audio-player * {
    font-family: 'Helvetica', 'Arial', Sans-Serif;
}
.audio-player {
    bottom: unset;
    top: 0 !important;
    opacity: 0.3;
}

/* reset & disable selection */
html, body {
  margin: 0; padding: 0;
  width: 100vw; height: 100vh;
  overflow: hidden;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
  cursor: none;
}
body {
  background: -o-radial-gradient(top center,
                              ellipse,
                              #fff 0%,
                              #ddd 100%) !important;
  background: radial-gradient(ellipse at top center,
                              #fff 0%,
                              #ddd 100%) !important;
  transition: background 1s ease-in-out;
}
img {
  -webkit-user-drag: none; user-drag: none;
}

.vibrate {
  -webkit-animation: vibrate-quadrotto 2s infinite;
          animation: vibrate-quadrotto 2s infinite;
}

#iframe-form {
    width: 75vw;
    height: 75vh;
    position: absolute;
    top: 12.5vh;
    left: 12.5vw;
    z-index: var(--z-intro);
    transition: opacity 2s;
    border-radius: 2vw;
    overflow: hidden;
    border: 6px solid var(--highlight-color);
}

@-webkit-keyframes vibrate-quadrotto {
  0% { -webkit-transform: translate(-50%, -50%) rotate(calc(var(--rot) - 1.2deg)); transform: translate(-50%, -50%) rotate(calc(var(--rot) - 1.2deg)); }
  10% { -webkit-transform: translate(-50%, -50%) rotate(calc(var(--rot) + 2.5deg)); transform: translate(-50%, -50%) rotate(calc(var(--rot) + 2.5deg)); }
  20% { -webkit-transform: translate(-50%, -50%) rotate(calc(var(--rot) - 0.5deg)); transform: translate(-50%, -50%) rotate(calc(var(--rot) - 0.5deg)); }
  35% { -webkit-transform: translate(-50%, -50%) rotate(calc(var(--rot) + 0.7deg)); transform: translate(-50%, -50%) rotate(calc(var(--rot) + 0.7deg)); }
  50% { -webkit-transform: translate(-50%, -50%) rotate(calc(var(--rot) - 1.2deg)); transform: translate(-50%, -50%) rotate(calc(var(--rot) - 1.2deg)); }
  95% { -webkit-transform: translate(-50%, -50%) rotate(calc(var(--rot) + 0deg)); transform: translate(-50%, -50%) rotate(calc(var(--rot) + 0deg)); }
  100% { -webkit-transform: translate(-50%, -50%) rotate(calc(var(--rot) - 1.2deg)); transform: translate(-50%, -50%) rotate(calc(var(--rot) - 1.2deg)); }
}

@keyframes vibrate-quadrotto {
  0% { -webkit-transform: translate(-50%, -50%) rotate(calc(var(--rot) - 1.2deg)); transform: translate(-50%, -50%) rotate(calc(var(--rot) - 1.2deg)); }
  10% { -webkit-transform: translate(-50%, -50%) rotate(calc(var(--rot) + 2.5deg)); transform: translate(-50%, -50%) rotate(calc(var(--rot) + 2.5deg)); }
  20% { -webkit-transform: translate(-50%, -50%) rotate(calc(var(--rot) - 0.5deg)); transform: translate(-50%, -50%) rotate(calc(var(--rot) - 0.5deg)); }
  35% { -webkit-transform: translate(-50%, -50%) rotate(calc(var(--rot) + 0.7deg)); transform: translate(-50%, -50%) rotate(calc(var(--rot) + 0.7deg)); }
  50% { -webkit-transform: translate(-50%, -50%) rotate(calc(var(--rot) - 1.2deg)); transform: translate(-50%, -50%) rotate(calc(var(--rot) - 1.2deg)); }
  95% { -webkit-transform: translate(-50%, -50%) rotate(calc(var(--rot) + 0deg)); transform: translate(-50%, -50%) rotate(calc(var(--rot) + 0deg)); }
  100% { -webkit-transform: translate(-50%, -50%) rotate(calc(var(--rot) - 1.2deg)); transform: translate(-50%, -50%) rotate(calc(var(--rot) - 1.2deg)); }
}


.stage {
  position: relative;
  width: 100%; height: 100%;
}

/* wrapper centrato e ruotabile */
.frame-wrapper {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) rotate(0deg);
  z-index: var(--z-quadrotto);
  transition: opacity 0.3s;
  
  /* Hardware acceleration */
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: transform;
}

/* Ombra con pseudo-elemento per iOS */
.frame-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  box-shadow: 0 3vw 1.5vw rgba(0,0,0,0.4);
  border-radius: inherit;
  pointer-events: none;
  z-index: -1;
  transform: translateZ(-1px);
}

/* Drop-shadow solo per browser che lo supportano bene */
@supports (filter: drop-shadow(0 0 0 black)) and (not (-webkit-touch-callout: none)) {
  .frame-wrapper {
    filter: drop-shadow(0vw 3vw 1.5vw rgba(0,0,0,0.4));
  }
  .frame-wrapper::before {
    display: none;
  }
}

.frame-wrapper {
  /*touch-action: none;*/            /* disabilita lo scrolling nativo e garantisce che tutti i touch arrivino a JS */
  /*-ms-touch-action: none;*/
  -webkit-user-select: none;     /* già presente, ma utile */
}
/*.frame-wrapper.grabbing { cursor: grabbing; }*/

.frame {
  position: relative;
  aspect-ratio: 1/1;
  width: var(--frame-size-desktop);
  height: var(--frame-size-desktop);
  background: #eee;
  border: var(--border-width-desktop) solid #0f0f0f;
  box-sizing: border-box;
  overflow: hidden;
}

/* immagini in slide */
.slide-img {
  position: absolute;
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
  opacity: 1;
  -webkit-transition: opacity 0.5s ease;
  -o-transition: opacity 0.5s ease;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

/* container menu voci */
.angle-menu-container {
  position: absolute;
  right: 7vw; top: 50%;
  -webkit-transform: translateY(-50%);
      -ms-transform: translateY(-50%);
          transform: translateY(-50%);
  z-index: var(--z-ui);
}
.angle-menu {
  position: absolute;
  right: -7vw;

  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;

  height: 2vw;
  line-height: 0;
  padding: 4px 3vw 0px 3vw;

  font-size: 1.2vw;
  text-transform: uppercase;
  background: none;
  border-radius: 1000px;
  border: none;

  -webkit-box-shadow: 0 0 0 0.1vw black;
          box-shadow: 0 0 0 0.1vw black;
  color: black;

  opacity: 0;
  pointer-events: none;

  -webkit-transition: all 0.3s ease, right 0.5s ease;
  -o-transition: all 0.3s ease, right 0.5s ease;
  transition: all 0.3s ease, right 0.5s ease;
}
.angle-menu.show {
  right: 2vw;
  opacity: 0.3;
  pointer-events: auto;
  -webkit-transition: all 0.3s ease, right 0.5s ease;
  -o-transition: all 0.3s ease, right 0.5s ease;
  transition: all 0.3s ease, right 0.5s ease;
}
.angle-menu.deactive {
    background: black !important;
    color: white !important;
    pointer-events: none;
}
.angle-menu.deactive.show {
    opacity: 0.05;
} 
.angle-menu:hover {
  opacity: 1;
  background: var(--highlight-color);
  color: white !important;
  -webkit-box-shadow: none;
          box-shadow: none;
  -webkit-transition: all 0.3s ease, right 0.5s ease;
  -o-transition: all 0.3s ease, right 0.5s ease;
  transition: all 0.3s ease, right 0.5s ease;
  cursor: none !important;
}

#legal-section {
    position: absolute;
    display: inline-block;
    width: 80vw;
    left: 10vw;
    top: 50%;
    transform: translateY(-50%);
    z-index: var(--z-ui);
    opacity: 1;
    transition: opacity 0.3s ease;
}
#legal-section ul.legal-grid {
    list-style: none;
    position: relative;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-around;
    align-items: center;
    align-content: center;
    gap: 1vw;
}
#legal-section li.button {
  width: 25vw;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;

  height: 2vw;
  line-height: 0;
  padding: 4px 3vw 0px 3vw;

  font-size: 1.2vw;
  text-transform: uppercase;
  background: none;
  border-radius: 1000px;
  border: none;
  opacity: 0.5;

  -webkit-box-shadow: 0 0 0 0.1vw black;
          box-shadow: 0 0 0 0.1vw black;
  color: black;

  -webkit-transition: all 0.3s ease, right 0.5s ease;
  -o-transition: all 0.3s ease, right 0.5s ease;
  transition: all 0.3s ease, right 0.5s ease;
}
#legal-section li.button:hover {
  background: var(--highlight-color);
  color: white !important;
  -webkit-box-shadow: none;
          box-shadow: none;
  -webkit-transition: all 0.3s ease, right 0.5s ease;
  -o-transition: all 0.3s ease, right 0.5s ease;
  transition: all 0.3s ease, right 0.5s ease;
  cursor: none !important;
  opacity: 1;
}

#credits-section {
    color: white !important;
    font-family: helvetica;
    font-size: 2vw;
    position: absolute;
    display: inline;
    top: 0;
    left: 0;
    width: 100vw;
    height: fit-content;
}
#credits-scroll-wrapper {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.credits-scroll {
    position: relative;
    width: fit-content;
    text-align: center;
    margin: 0 auto;
}
.credits-scroll * {
    font-family: 'Helvetica', 'Arial', Sans-Serif !important; 
}
.credits-scroll-anim {
    animation: scroll 60s linear forwards;
}
.credits-scroll h5 {
    font-size: 1.5vh;
    margin-top: 1vh;
    margin-bottom: 1vh;
}
.credits-scroll h4 {
    font-size: 2.5vh;
    margin-top: 0;
    margin-bottom: 10vh;
}
.credits-scroll h3 {
    margin-top: 12vh;
    margin-bottom: 12vh;
}
.credits-scroll img {
    position: relative;
    display: block;
    width: 70%;
    align-items: center;
    text-align: center;
    left: 15%;
}
.credits-scroll .azienda {
    color: var(--highlight-color) !important;
}

@keyframes scroll {
    0% {
        -webkit-transform: translateY(100vh);
        transform: translateY(100vh);
    }
    100% {
        -webkit-transform: translateY(-105%);
        transform: translateY(-105%);
    }
}

.credits-scroll-anim {
    -webkit-animation: scroll 60s linear forwards;
    animation: scroll 60s linear forwards;
    /* Force hardware acceleration */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
}

#origins-section {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: var(--z-ui);
}
.origin-text {
    position: absolute;
    width: 80vw;
    height: fit-content;
    font-size: 2.5vw;
    line-height: 1;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    transition: all 1s !important;
}

/* gradiente radiale da destra a sinistra, raggio ≈50% */
.side-gradient {
  position: absolute;
  right: 0; top: 0;
  width: 50vw; height: 100%;
  pointer-events: none;
  background: -o-radial-gradient(100% 50%, circle, rgba(255,255,255,0.3) 0%, transparent 50%);
  background: radial-gradient(circle at 100% 50%, rgba(255,255,255,0.3) 0%, transparent 50%);
  z-index: var(--z-gradient);
  -webkit-transition: all 0.5s !important;
  -o-transition: all 0.5s !important;
  opacity: 0;
  -webkit-transition: all 0.5s, opacity 2s !important;
  -o-transition: all 0.5s, opacity 2s !important;
  transition: all 0.5s, opacity 2s !important;
}
.side-gradient.gradient {
  opacity: 1;
  background: var(--gradient-bg, transparent);
  -webkit-transition: background 1s, opacity 2s !important;
  -o-transition: background 1s, opacity 2s !important;
  transition: background 1s, opacity 2s !important;
}


/* PLAYER TEST */
.jp-audio, .jp-audio-stream, .jp-video {
  background: rgba(0, 0, 0, 0) !important;
}
/*.jp-interface .jp-controls .jp-play {
  opacity: 0.3;
}*/
.jp-gui.jp-interface.flex-wrap * {
  color: #888 !important;
  opacity: 1;
  font-size: 1vw;
}
.jp-progress-container, .jp-volume-bar-container {
  width: 10%;
  height: 30px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  padding: 0 10px; 
  -ms-flex-wrap: nowrap; 
      flex-wrap: nowrap;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
      -ms-flex-direction: row;
          flex-direction: row;
  -ms-flex-line-pack: center;
      align-content: center;
  -webkit-box-pack: end;
      -ms-flex-pack: end;
          justify-content: flex-end;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
} 
.jp-time-holder {
  display: block;
  position: relative;
  height: -webkit-fit-content;
  height: -moz-fit-content;
  height: fit-content;
  color: #979797;
  font-size: 12px;
}
.jp-time-holder .jp-current-time {
  position: relative !important;
  right: unset !important;
  top: unset !important;
}
.jp-interface .jp-controls .jp-play {
  color: #888 !important;
  border: 3px solid #888 !important;
}
.jp-controls.flex-item {
    -ms-flex-preferred-size: 0 !important;
        flex-basis: 0 !important;
}

/* Tutorial Button */
.tutorial-btn {
  position: fixed;
  bottom: 2vh;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 40px;
  background: none;
  border: 2px solid var(--highlight-color);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-overlay);
  transition: all 0.5s ease;
  opacity: 0;
  pointer-events: none;
}

.tutorial-btn:not(.hideCSTM) {
  opacity: 1;
  pointer-events: auto;
}

.tutorial-btn:hover {
  background: var(--highlight-color);
  color: white;
  cursor: none;
}
.tutorial-btn:hover::after {
    color: white;
    border-bottom-color: white;
}
.tutorial-btn.moved-right:hover::after {
    color: white;
    border-top-color: white;
}

/* Triangolo nel pulsante - inizialmente verso l'alto */
.tutorial-btn::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 10px solid var(--highlight-color);
  transition: transform 0.3s ease;
}

/* Quando il tutorial è nascosto, il pulsante si sposta a destra e il triangolo punta in basso */
.tutorial-btn.moved-right {
  left: calc(100% - 60px);
  transform: translateX(0);
}

.tutorial-btn.moved-right::after {
  border-bottom: none;
  border-top: 10px solid var(--highlight-color);
}

.tutorial-overlay {
  position: absolute;
  top: 87vh;
  left: 50%;
  opacity: 1;
  -webkit-transform: translateX(-50%);
      -ms-transform: translateX(-50%);
          transform: translateX(-50%);
  z-index: var(--z-overlay);
  /*-webkit-animation: fadeOut 3s ease 10s forwards;*/
          /*animation: fadeOut 3s ease 10s forwards;*/

  display: -webkit-box;

  display: -ms-flexbox;

  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
  -ms-flex-wrap: nowrap;
      flex-wrap: nowrap;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;

  -webkit-transition: all 0.5s, opacity 2s;
  -o-transition: all 0.5s, opacity 2s;
  transition: all 0.5s, opacity 2s;
}
.tutorial-overlay:hover {
  -webkit-transform: translateX(-50%) scale(1.1) !important;
      -ms-transform: translateX(-50%) scale(1.1) !important;
          transform: translateX(-50%) scale(1.1) !important;
  opacity: 1 !important;
  bottom: 3vh !important;
  -webkit-transition: all 0.5s;
  -o-transition: all 0.5s;
  transition: all 0.5s;
}
.tutorial-instructions {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
      -ms-flex-direction: row;
          flex-direction: row;
  -ms-flex-wrap: nowrap;
      flex-wrap: nowrap;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;

  max-width: 100vw;
  gap: 0.2vw;
  font-size: 0.55vw;
}
.tutorial-instructions img {
  aspect-ratio: 1/1;
  width: 3vw;
}

.tutorial-overlay h6.tutorial-label {
  padding: 0;
  margin: 0;
  margin-bottom: 0.3vw;
  font-size: 1.5vw;
  text-align: center;
}


/*.blinkAnimation {*/
/*    -webkit-animation: blink 4s 2 forwards;*/
/*            animation: blink 4s 2 forwards;*/
/*}*/

/*@-webkit-keyframes blink {*/
/*    0% {opacity: 0.2;}*/
/*    25% {opacity: 1;}*/
/*    50% {opacity: 0.2;}*/
/*    75% {opacity: 1;}*/
/*    100% {opacity: 0.2;}*/
/*}*/

/*@keyframes blink {*/
/*    0% {opacity: 0.2;}*/
/*    25% {opacity: 1;}*/
/*    50% {opacity: 0.2;}*/
/*    75% {opacity: 1;}*/
/*    100% {opacity: 0.2;}*/
/*}*/
#btn-back.invert-color-scheme {
    color: white;
    background: none;
    border: 1px solid white;
}

.hideCSTM {
  opacity: 0 !important;
  -webkit-transition: all 1s !important;
  -o-transition: all 1s !important;
  transition: all 1s !important;
  pointer-events: none !important;
}
.hideCSTMLong {
  opacity: 0 !important;
  -webkit-transition: all 1s !important;
  -o-transition: all 4s !important;
  transition: all 4s !important;
}
.longTrans {
    transition: opacity 4s !important;
}

.hideBottom {
    animation: translateToBottom 1s ease forwards;
}
.showBottom {
    animation: translateFromBottom 1s ease forwards;
}
@keyframes translateToBottom {
    to {top: 100vh;}
}
@keyframes translateFromBottom {
    from {top: 100vh;}
    to {top}
}

@-webkit-keyframes fadeOut {
  to {
    opacity: 0.15;
    /*bottom: 3vh;*/
    -webkit-transform: translateX(-50%) scale(0.80);
            transform: translateX(-50%) scale(0.80);
  }
}

@keyframes fadeOut {
  to {
    opacity: 0.15;
    /*bottom: 3vh;*/
    -webkit-transform: translateX(-50%) scale(0.80);
            transform: translateX(-50%) scale(0.80);
  }
}

/* CSS per l'animazione ripple */
.ripple-container {
    position: absolute;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    z-index: var(--z-gradient);
}

.ripple-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, var(--highlight-color) 0%, var(--highlight-color) 100%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: ripple-expand 2s ease-out forwards;
    animation-play-state: paused;
}

.ripple-container::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, white 0%, white 100%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: ripple-clear 2s ease-out forwards;
    animation-delay: 0.3s;
    animation-play-state: paused;
}

.ripple-container::before,
.ripple-container::after {
    animation-play-state: var(--animation-play-state, paused);
}

@keyframes ripple-expand {
    0% {
        width: 0;
        height: 0;
        opacity: 0;
    }
    
    10% {
        opacity: 1;
    }
    
    50% {
        width: 150vw;
        height: 150vw;
        opacity: 0.8;
    }
    
    100% {
        width: 150vw;
        height: 150vw;
        opacity: 0.8;
    }
}

@keyframes ripple-clear {
    0% {
        width: 0;
        height: 0;
        opacity: 0;
    }
    
    10% {
        opacity: 1;
    }
    
    50% {
        width: 150vw;
        height: 150vw;
        opacity: 1;
    }
    
    100% {
        width: 150vw;
        height: 150vw;
        opacity: 1;
    }
}

.site-intro-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: white; /* o #fff */
  opacity: 1;
  pointer-events: none;
  -webkit-animation: introFade 2s ease 2s forwards;
          animation: introFade 2s ease 2s forwards;
}
.site-intro-overlay img {
  position: absolute;
  width: 52vw;
  left: 50%;
  top: 50%;
  -webkit-transform: translate(-50%, -50%);
      -ms-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
}

.frame-selected {
  border: 0.4vw solid var(--highlight-color);
}

@-webkit-keyframes introFade {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes introFade {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.desktop {
  display: inherit;
}
.mobile {
  display: none;
}

/*  TEXT PHASE  */
.word-input {
  position: fixed;
  top: 50%;
  -webkit-transform: translateY(-50%);
      -ms-transform: translateY(-50%);
          transform: translateY(-50%);
  width: 20vw;
  font-size: 1.3vw;
  text-align: center;
  background: none;
  border: none;
  border-bottom: 2px solid rgba(0, 0, 0, 0.2);
  display: block;
  -webkit-transition: all 0.3s, opacity 2.5s;
  -o-transition: all 0.3s, opacity 2.5s;
  transition: all 0.3s, opacity 2.5s;
}
.word-input:focus {
  border: inherit;
  border-bottom: 2px solid rgba(0, 0, 0, 0.2);
  outline: none; /* per rimuovere il bordo blu standard del browser */
}

.word-input.left  { left: 5vw; }
.word-input.right { right: 5vw; }

.ui-button {
  border: none;
  position: fixed;
  display: block;
  font-size: 1.2vw;
  
  height: 2vw;
  line-height: 0;
  padding: 4px 3vw 0px 3vw;

  font-size: 1.2vw;
  text-transform: uppercase;
  background: none;
  border-radius: 1000px;
  border: none;
  opacity: 0.3;

  -webkit-box-shadow: 0 0 0 0.1vw black;
          box-shadow: 0 0 0 0.1vw black;
  color: black;
  cursor: none !important;
  border-radius: 999px;
  -webkit-transition: all 0.3s;
  -o-transition: all 0.3s;
  transition: all 0.3s;
}
.ui-button:hover {
  background: var(--highlight-color) !important;
  color: white !important;
  border: none !important;
  opacity: 1;
  -webkit-box-shadow: 0 0 0 0px rgba(0, 0, 0, 0.2);
          box-shadow: 0 0 0 0px rgba(0, 0, 0, 0.2);
  -webkit-transition: all 0.3s;
  -o-transition: all 0.3s;
  transition: all 0.3s;
}
.back-button  { top: 5vh; left: 3vw; }
.info-button  { top: 5vh; right: 3vw; }
.buy-button   { bottom: 5vh; right: 3vw; }

.info-box {
  display: none;
  position: fixed;
  top: 9vh;
  right: 3vw;
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 1em;
  max-width: 300px;
  border-radius: 1em;
  font-size: 0.8vw;
  -webkit-transition: all 0.3s;
  -o-transition: all 0.3s;
  transition: all 0.3s;
}

#buy-info-text {
  opacity: 1;
  -webkit-transition: all 1s;
  -o-transition: all 1s;
  transition: all 1s;
  font-size: 1vw;
  margin-bottom: 3vh;
}
#buy-info-text.hidden {
  opacity: 0;
  -webkit-transition: all 1s;
  -o-transition: all 1s;
  transition: all 1s;
}
.buy-info {
  /*font-family: 'Nesiota', sans-serif;*/
  font-size: 0.9rem;
  text-align: center;
  max-width: 17vw;
  margin: 0 auto 1.2rem auto;
  color: rgba(0, 0, 0, 0.7);
  line-height: 1.4;
  position: absolute;
  bottom: 11vh;
  right: 3.5vw;
  line-height: 1;
  text-align: right;
  z-index: var(--z-ui);
  pointer-events: none;
  -webkit-transition: all 0.3s;
  -o-transition: all 0.3s;
  transition: all 0.3s;
}

.buy-step {
  -webkit-transition: color 0.3s ease, opacity 0.3s ease;
  -o-transition: color 0.3s ease, opacity 0.3s ease;
  transition: color 0.3s ease, opacity 0.3s ease;
  color: rgba(0, 0, 0, 0.6);
  opacity: 0.4;
}

.buy-step.valid {
  color: var(--highlight-color);
  opacity: 1;
}

#btn-buy:disabled {
  opacity: 0.3;
  /*cursor: not-allowed;*/
}
#btn-buy.active {
  opacity: 1 !important;
  background-color: var(--highlight-color);
  color: white;
  -webkit-box-shadow: none;
          box-shadow: none;
  /*cursor: pointer !important;*/
}
#btn-buy.active:hover {
  background: white !important;
  color: var(--highlight-color) !important;
  -webkit-transition: all 0.3s;
  -o-transition: all 0.3s;
  transition: all 0.3s;
}
.word-input.word-ok {
  border-bottom: 5px solid var(--highlight-color);
  -webkit-transition: all 0.3s;
  -o-transition: all 0.3s;
  transition: all 0.3s;
}
/*  TEXT-PHASE  */

/*  NAME PHASE  */
.name-phase {
  position: absolute;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
      -ms-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
  text-align: center;
  z-index: var(--z-ui);
  opacity: 0;
  pointer-events: none;
  -webkit-transition: opacity 1s ease;
  -o-transition: opacity 1s ease;
  transition: opacity 1s ease;
}
.name-phase.show {
  opacity: 1;
  pointer-events: auto;
}
.nome-title {
  /*font-family: 'Nesiota', sans-serif;*/
  font-size: 1.8rem;
  margin-bottom: 1rem;
  opacity: 0;
  -webkit-transform: translateY(-20px);
      -ms-transform: translateY(-20px);
          transform: translateY(-20px);
  -webkit-animation: fadeInDown 1s ease forwards;
          animation: fadeInDown 1s ease forwards;
}
.nome-generato {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    font-size: 3vw;
    width: -webkit-fit-content;
    width: -moz-fit-content;
    width: fit-content;
    text-align: center;
    margin: 0 auto;
    line-height: 0.5;
    background: none;
    border-bottom: 9px solid var(--highlight-color);
    padding: 1vw 6vw;
    /* border-radius: 1000px; */
    color: var(--highlight-color);
    -webkit-animation: fadeIn 1.4s ease forwards;
    animation: fadeIn 1.4s ease forwards;
    -webkit-transition: all 0.4s;
    -o-transition: all 0.4s;
    transition: all 0.4s;
}

#btn-genera-nome {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
  -ms-flex-wrap: nowrap;
      flex-wrap: nowrap;

  -ms-flex-line-pack: center;
      align-content: center;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;

  text-align: center;
}
.btn-generatore {
  margin-top: 1rem;
  background: none;
  border: none;
  font-size: 1rem;
  color: gray;
  -webkit-animation: fadeIn 0.5s ease forwards;
          animation: fadeIn 0.5s ease forwards;
}
.icon-refresh {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;

  color: white;
  font-size: 2vw;
  line-height: 0;
  background: var(--highlight-color);
  padding: 1.5vw 2vw;
  padding-top: 1.9vw;
  border-radius: 0.3vw;
  cursor: 0;

  -webkit-transition: all 0.3s;
       -o-transition: all 0.3s;
          transition: all 0.3s;

  margin-bottom: 1vw;
}
.icon-refresh:hover {
  color: var(--highlight-color);
  background: white;
  -webkit-transition: all 0.3s;
  -o-transition: all 0.3s;
  transition: all 0.3s;
}
.label-genera {
  position: relative;
  width: 45%;
  line-height: 1;
  font-size: 0.8vw;
}
.audio-player {
    transition: opacity 2s;
}

.hidden {
  display: none !important;
  z-index: var(--z-ui);
}
.no-input {
  pointer-events: none !important;
}
.translucent {
  opacity: 0.2 !important;
  -webkit-transition: all 0.5s;
  -o-transition: all 0.5s;
  transition: all 0.5s;
}

@-webkit-keyframes fadeInDown {
  0% { opacity: 0; -webkit-transform: translateY(-20px); transform: translateY(-20px); }
  100% { opacity: 1; -webkit-transform: translateY(0); transform: translateY(0); }
}

@keyframes fadeInDown {
  0% { opacity: 0; -webkit-transform: translateY(-20px); transform: translateY(-20px); }
  100% { opacity: 1; -webkit-transform: translateY(0); transform: translateY(0); }
}
@-webkit-keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/*  Z-INDEX ELEMENTI  */
.ui-button {
  z-index: var(--z-ui);
}

.info-box,
.tutorial-label {
  z-index: var(--z-overlay) !important;
}

.word-input {
  z-index: var(--z-input) !important;
}

.frame-wrapper {
  z-index: var(--z-quadrotto) !important;
}

.side-gradient {
  z-index: var(--z-gradient) !important;
}

.site-intro-overlay {
  z-index: var(--z-intro) !important;
}

/* Alternativa con box-shadow per Safari se drop-shadow causa problemi */
/*@supports (-webkit-touch-callout: none) {*/
  /* Safari only */
/*  .frame-wrapper {*/
/*    -webkit-filter: none;*/
/*    filter: none;*/
/*    position: relative;*/
/*  }*/
  
/*  .frame-wrapper::after {*/
/*    content: '';*/
/*    position: absolute;*/
/*    top: 0;*/
/*    left: 0;*/
/*    right: 0;*/
/*    bottom: 0;*/
/*    box-shadow: 0vw 3vw 1.5vw rgba(0,0,0,0.4);*/
/*    border-radius: inherit;*/
/*    pointer-events: none;*/
/*    z-index: -1;*/
/*    transform: translateZ(-1px);*/
/*  }*/
/*}*/


@media only screen and (max-width: 768px) {
  .desktop {
    display: none !important;
  }
  .mobile {
    display: unset !important;
  }
  
  .site-intro-overlay img.mobile {
    width: 70vw;
    top: 49%;
  }
    
  html, body {
    width: 100%;
    height: 100%;
    position: fixed;
  }
    
  .audio-player {
    bottom: unset !important;
    top: 0 !important;
  }

  .jp-gui.jp-interface.flex-wrap * {
    font-size: 4vw;
    line-height: 1.1;
  }

  .frame {
    position: relative;
    aspect-ratio: 1 / 1 !important;
    width: clamp(10px, 30vh, 60vw);
    height: auto;
    background: #eee;
    border: clamp(10px, 2vh, 4vw) solid #0f0f0f;
    -webkit-box-sizing: border-box;
            box-sizing: border-box;
    overflow: hidden;
  }
  
  .origin-text {
    width: 80vw;
    font-size: 2.5vh;
  }

  .side-gradient {
    position: absolute;
    right: 0;
    bottom: 0;
    top: unset;
    width: 100vw;
    height: 50%;
    pointer-events: none;
    background: -o-radial-gradient(100% 50%, circle, rgba(255, 255, 255, 0.3) 0%, transparent 50%);
    background: radial-gradient(circle at 100% 50%, rgba(255, 255, 255, 0.3) 0%, transparent 50%);
  }

  .tutorial-overlay {
    gap: 1vw;
    width: 75%;
    top: unset;
    bottom: 1vh;
  }
  @keyframes translateToBottom {
    to {bottom: -50%;}
  }
  @keyframes translateFromBottom {
    from {bottom: -50%;}
    to {bottom: 1vh;}
  }
  .tutorial-overlay h6.tutorial-label {
    font-size: 3vh;
    text-align: center;
  }
  .tutorial-instructions {
    font-size: 1.1vh !important;
    line-height: 1;
    max-width: unset !important;
    gap: 1vw;
    width: 100%;
  }
  .tutorial-instructions img {
    width: 8vw;
  }
  #legal-section ul.legal-grid {
      gap: 2vh !important;
  }
  #legal-section li.button {
      width: 100%;
      height: 18vw;
      max-height: 80px;
      font-size: 5vw;
    }
  .frame-wrapper {
      top: 50%;
  }
  .credits-scroll {
      width: 100%;
  }
  .credits-scroll img {
      width: 80%;
      left: 10%;
  }
}

@media only screen and (max-width: 768px) {
    #cursor {
        display: none;
    }
  .angle-menu-container {
    bottom: 18vh;
    top: unset;
    right: 48vw;
    -webkit-transform: none;
        -ms-transform: none;
            transform: none;
    -webkit-transform: translateX(25vw) !important;
        -ms-transform: translateX(25vw) !important;
            transform: translateX(25vw) !important;
  }

  .angle-menu {
    font-size: 4vw;
    line-height: 0;
    padding: 3vh 4vw;
    width: 50vw;
    box-shadow: 0 0 0 0.2vh black;
  }

  .ui-button {
    font-size: 2.5vh;
    padding: 2vw 5vw;
    height: 3vh !important;
    box-shadow: 0 0 0 0.2vh black;
  }
  
  .frame-selected {
    border-width: 1.2vw !important;
  }

  .back-button  { top: 5vh; left: 10vw; }
  .info-button  { top: 5vh; right: 10vw; }
  .buy-button   {
    bottom: 5vh;
    right: 50%;
    height: 6vh !important;
    -webkit-transform: translateX(50%);
        -ms-transform: translateX(50%);
            transform: translateX(50%);
    width: 80vw;
  }

  .buy-info {
    font-size: 3vw;
    max-width: 60vw;
    right: 3vw;
    bottom: 16vh;
    text-align: right;
  }

  #buy-info-text {
    font-size: 3vw;
    margin-bottom: 2vh;
    text-align: center;
    right: 50%;
    -webkit-transform: translateX(50%);
        -ms-transform: translateX(50%);
            transform: translateX(50%);
  }

  .word-input {
    width: 80vw;
    font-size: 5vw;
  }

  .word-input.left {
    top: 13.5vh;
    left: 10vw;
    -webkit-transform: none;
        -ms-transform: none;
            transform: none;
    position: fixed;
  }

  .word-input.right {
    top: unset;
    bottom: 13.5vh;
    right: 10vw;
    -webkit-transform: none;
        -ms-transform: none;
            transform: none;
    position: fixed;
  }

  .name-phase .nome-title {
    font-size: 3vh;
    width: 80vw;
  }

  .nome-generato {
    font-size: 15vw;
    padding: 12vw 8vw 9vw 8vw;
    line-height: 0;
    border-bottom: 5px solid;
  }

  .icon-refresh {
    font-size: 8vw;
    padding: 7vw 2vw 6vw 3vw;
    margin-bottom: 2vh;
    border-radius: 1rem;
  }

  .label-genera {
    font-size: 3vw;
  }
  
  .info-box {
    font-size: 4vw;
  }
  #narrator p {
    font-size: 4.5vw;
    line-height: 1;
    max-width: 80vw;
    margin: 0 10vw;
    
    top: 50%;
    transform: translateY(-50%);
  }
  h5.copyright {
      font-size: 2vw;
      text-align: center;
  }
  
  @keyframes ripple-expand {
        0% {
            width: 0;
            height: 0;
            opacity: 0;
        }
        
        10% {
            opacity: 1;
        }
        
        50% {
            width: 150vh;
            height: 150vh;
            opacity: 0.8;
        }
        
        100% {
            width: 150vh;
            height: 150vh;
            opacity: 0.8;
        }
    }
    
    @keyframes ripple-clear {
        0% {
            width: 0;
            height: 0;
            opacity: 0;
        }
        
        10% {
            opacity: 1;
        }
        
        50% {
            width: 150vh;
            height: 150vh;
            opacity: 1;
        }
        
        100% {
            width: 150vh;
            height: 150vh;
            opacity: 1;
        }
    }
}

@media only screen and (max-width: 768px) {
  .frame {
    width: var(--frame-size-mobile);
    height: var(--frame-size-mobile);
    border-width: var(--border-width-mobile);
  }
  
  /* Aggiusta l'ombra proporzionalmente */
  .frame-wrapper {
    -webkit-filter: drop-shadow(0 calc(3 * var(--viewport-scale)) calc(1.5 * var(--viewport-scale)) rgba(0,0,0,0.4));
    filter: drop-shadow(0 calc(3 * var(--viewport-scale)) calc(1.5 * var(--viewport-scale)) rgba(0,0,0,0.4));
  }
  
  /* Fix per frame-selected su mobile */
  .frame-selected {
    border-width: calc(var(--border-width-mobile) * 0.8) !important;
  }
}

@media only screen and (min-width: 769px) and (max-width: 1366px) {
  .frame {
    width: min(40vh, 40vw);
    height: min(40vh, 40vw);
    border-width: calc(2 * var(--viewport-scale));
  }
}