#matrix {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.5;
}

/*404 Glitch Effect*/
.glitch-wrapper {
  position: relative;
  text-align: center;
}

.glitch {
  font-size: 8rem;
  font-weight: 800;
  position: relative;
  color: white;
  letter-spacing: 3px;
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.3),
    0 0 20px rgba(255, 255, 255, 0.2);
  animation: glitch-skew 1.5s infinite linear alternate-reverse;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.glitch::before {
  left: 2px;
  text-shadow: -2px 0 #ff006a;
  animation: glitch-1 2s infinite linear alternate-reverse;
}

.glitch::after {
  left: -2px;
  text-shadow: -2px 0 #00f0ff;
  animation: glitch-2 1.8s infinite linear alternate-reverse;
}

@keyframes glitch-1 {
  0% {
    clip-path: inset(0 0 80% 0);
  }
  10% {
    clip-path: inset(10% 0 60% 0);
  }
  20% {
    clip-path: inset(20% 0 40% 0);
  }
  30% {
    clip-path: inset(40% 0 20% 0);
  }
  40% {
    clip-path: inset(10% 0 60% 0);
  }
  50% {
    clip-path: inset(0 0 80% 0);
  }
  60% {
    clip-path: inset(30% 0 40% 0);
  }
  70% {
    clip-path: inset(20% 0 50% 0);
  }
  80% {
    clip-path: inset(10% 0 70% 0);
  }
  90% {
    clip-path: inset(5% 0 85% 0);
  }
  100% {
    clip-path: inset(0 0 80% 0);
  }
}

@keyframes glitch-2 {
  0% {
    clip-path: inset(80% 0 0 0);
  }
  10% {
    clip-path: inset(60% 0 10% 0);
  }
  20% {
    clip-path: inset(40% 0 20% 0);
  }
  30% {
    clip-path: inset(20% 0 30% 0);
  }
  40% {
    clip-path: inset(60% 0 10% 0);
  }
  50% {
    clip-path: inset(80% 0 0 0);
  }
  60% {
    clip-path: inset(40% 0 20% 0);
  }
  70% {
    clip-path: inset(50% 0 20% 0);
  }
  80% {
    clip-path: inset(70% 0 10% 0);
  }
  90% {
    clip-path: inset(85% 0 5% 0);
  }
  100% {
    clip-path: inset(80% 0 0 0);
  }
}

@keyframes glitch-skew {
  0% {
    transform: skew(0deg);
  }
  20% {
    transform: skew(2deg);
  }
  40% {
    transform: skew(-2deg);
  }
  60% {
    transform: skew(1deg);
  }
  80% {
    transform: skew(-1deg);
  }
  100% {
    transform: skew(0deg);
  }
}

.glitch-sub {
  margin-top: -10px;
  color: #aaa;
  font-size: 1.2rem;
  letter-spacing: 2px;
}

.fade-item {
  opacity: 0;
  transform: translateY(-12px);
  filter: blur(2px);
}

body.page-ready .fade-item {
  animation: glitchLong 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes glitchLong {
  0% {
    opacity: 0;
    transform: translateY(-15px);
    filter: blur(3px) hue-rotate(20deg);
  }

  /* ▒▒ RGB split + małe trzaski ▒▒ */
  10% {
    opacity: 0.2;
    transform: translateY(-10px) translateX(-3px);
    filter: blur(2px) contrast(120%) drop-shadow(2px 0 red);
    clip-path: inset(0 0 65% 0);
  }

  18% {
    transform: translateY(-12px) translateX(3px);
    clip-path: inset(30% 0 25% 0);
    filter: blur(1px) drop-shadow(-2px 0 cyan);
  }

  /* ▒▒ Zacięcia sygnału ▒▒ */
  28% {
    opacity: 0.35;
    transform: translateY(-6px) translateX(-1px);
    clip-path: inset(10% 0 50% 0);
  }

  38% {
    transform: translateY(-8px) translateX(2px);
    clip-path: inset(0 0 30% 0);
  }

  48% {
    opacity: 0.45;
    clip-path: inset(40% 0 0 0);
    filter: hue-rotate(-20deg);
  }

  /* ▒▒ Szybkie mikro-teleporty ▒▒ */
  58% {
    opacity: 0.55;
    transform: translateY(-4px) translateX(-4px);
    filter: blur(1px);
    clip-path: none;
  }

  62% {
    transform: translateY(-2px) translateX(3px);
  }

  66% {
    transform: translateY(-3px) translateX(-2px);
  }

  /* ▒▒ Wejście w fokus ▒▒ */
  76% {
    opacity: 0.8;
    transform: translateY(-1px);
    filter: blur(0.5px);
  }

  /* ▒▒ Finalny smooth fade-in ▒▒ */
  90% {
    opacity: 1;
    transform: translateY(0);
    filter: none;
  }

  100% {
    opacity: 1;
    transform: translateY(0);
    filter: none;
    clip-path: none;
  }
}

/* marlock */
.mode-btn {
  padding: 10px 15px;
  border-radius: 12px;
}

.input-box {
  width: 100%;
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid rgba(37, 99, 235, 0.4);
  padding: 12px;
}

.action-btn {
  padding: 10px 15px;
  border-radius: 12px;
}

.anim {
  overflow: hidden;
  transition:
    max-height 500ms cubic-bezier(0.4, 0, 0.2, 1),
    opacity 500ms ease;
}

.anim-hidden {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.anim-show {
  opacity: 1;
  pointer-events: auto;
}
