/* --- TUTORIAL STYLES --- */
#tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  /* Pokazywane przez JS */
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(
    circle 250px at center,
    rgba(0,0,0,0.8) 0%,
    rgba(0,0,0,0.6) 40%,
    transparent 100%
  );
  /* transition: opacity 0.5s ease; */
  -webkit-mask-image: radial-gradient(circle 250px at center, black 100%, transparent 100%);
  mask-image: radial-gradient(circle 250px at center, black 100%, transparent 100%);
}

.tutorial-container {
  position: relative;
  width: 150px;
  height: 250px;
}

.tut-panel,
.tut-hand {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.5));
}

.tut-panel {
  width: 80px;
}

.tut-hand {
  width: 45px;
  z-index: 1001;
}

/* Kluczowa animacja sterująca */
.animate-tutorial {
  animation: tutorialLoop 10s infinite;
}

@keyframes tutorialLoop {

  /* Faza 1: Pojawienie się (0s - 2s) */
  0% {
    opacity: 0;
    transform: translate(-50%, 100%);
  }

  10% {
    opacity: 1;
    transform: translate(-50%, 80%);
  }

  20% {
    opacity: 1;
    transform: translate(-50%, 80%);
  }

  /* Faza 2: Animacja trzymania (2s - 4s) */
  20% {
    transform: translate(-50%, 80%) scale(1);
  }

  /* Podjazd dłoni do góry */
  25% {
    transform: translate(-50%, -40%) scale(1);
  }

  /* "Wciśnięcie" - powiększenie */
  30% {
    transform: translate(-50%, -40%) scale(1);
  }

  40% {
    transform: translate(-50%, -40%) scale(1); /* 1.05 */
  }

  /* Faza 3: Prawo-Lewo (4s - 9s) */
  /* Prawo */
  45% {
    transform: translate(-20%, -40%) rotate(5deg) scale(1);
  }

  55% {
    transform: translate(-20%, -40%) rotate(5deg) scale(1);
  }

  /* Lewo */
  65% {
    transform: translate(-80%, -40%) rotate(-5deg) scale(1);
  }

  75% {
    transform: translate(-80%, -40%) rotate(-5deg) scale(1); /* 1.05 */
  }

  /* Powrót */
  85% {
    transform: translate(-50%, 80%) rotate(0deg) scale(1);
  }

  /* Koniec pętli - przygotowanie do restartu */
  95% {
    opacity: 1;
    transform: translate(-50%, 80%) rotate(0deg) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, 100%);
  }
}

/* Panel porusza się razem z dłonią w fazie 3 */
.tut-panel.animate-tutorial {
  animation-name: panelLoop;
}

@keyframes panelLoop {

  0%,
  23% {
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
  }

  27%, 40% {
    transform: translate(-50%, -50%) rotate(0deg) scale(1.1);
  }

  45%,
  55% {
    transform: translate(-30%, -50%) rotate(15deg) scale(1.1);
  }

  65%,
  75% {
    transform: translate(-70%, -50%) rotate(-15deg) scale(1.1);
  }

  85%,
  100% {
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
  }
}