* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #050505;
  --text: #f5f5f5;
  --line: rgba(255, 255, 255, 0.05);
}

html, body {
  width: 100%;
  height: 100%;
}

body {
  overflow: hidden;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.035) 0px,
      rgba(255, 255, 255, 0.035) 2px,
      transparent 2px,
      transparent 10px
    ),
    radial-gradient(circle at center, #111 0%, var(--bg) 58%, #000 100%);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.screen {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(255, 255, 255, 0.02) 50%,
    transparent 100%
  );
  mix-blend-mode: screen;
  opacity: 0.45;
  animation: flicker 6s infinite steps(1);
  pointer-events: none;
}

.glitch {
  position: relative;
  font-size: clamp(4rem, 14vw, 10rem);
  font-weight: 300;
  letter-spacing: 0.24em;
  color: var(--text);
  text-transform: uppercase;
  animation: textFlicker 4s infinite steps(1);
  user-select: none;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.glitch::before {
  text-shadow: -2px 0 rgba(255, 0, 80, 0.9);
  transform: translate(-2px, 0);
  clip-path: inset(0 0 0 0);
  animation: glitchTop 1.8s infinite steps(2, end);
  opacity: 0.8;
}

.glitch::after {
  text-shadow: 2px 0 rgba(0, 220, 255, 0.9);
  transform: translate(2px, 0);
  clip-path: inset(0 0 0 0);
  animation: glitchBottom 2.4s infinite steps(2, end);
  opacity: 0.75;
}

@keyframes glitchTop {
  0%, 100% { clip-path: inset(0 0 0 0); transform: translate(0, 0); }
  10% { clip-path: inset(8% 0 62% 0); transform: translate(-3px, -1px); }
  12% { clip-path: inset(40% 0 30% 0); transform: translate(3px, 1px); }
  14% { clip-path: inset(12% 0 70% 0); transform: translate(-5px, 0); }
  16% { clip-path: inset(0 0 0 0); transform: translate(0, 0); }

  46% { clip-path: inset(55% 0 18% 0); transform: translate(4px, -2px); }
  48% { clip-path: inset(20% 0 50% 0); transform: translate(-4px, 1px); }
  50% { clip-path: inset(70% 0 8% 0); transform: translate(2px, 0); }
  52% { clip-path: inset(0 0 0 0); transform: translate(0, 0); }

  78% { clip-path: inset(25% 0 46% 0); transform: translate(-2px, 1px); }
  80% { clip-path: inset(4% 0 78% 0); transform: translate(5px, -1px); }
  82% { clip-path: inset(0 0 0 0); transform: translate(0, 0); }
}

@keyframes glitchBottom {
  0%, 100% { clip-path: inset(0 0 0 0); transform: translate(0, 0); }
  8% { clip-path: inset(72% 0 6% 0); transform: translate(4px, 1px); }
  10% { clip-path: inset(48% 0 22% 0); transform: translate(-4px, -1px); }
  12% { clip-path: inset(82% 0 2% 0); transform: translate(2px, 0); }
  14% { clip-path: inset(0 0 0 0); transform: translate(0, 0); }

  38% { clip-path: inset(64% 0 14% 0); transform: translate(-3px, 1px); }
  40% { clip-path: inset(34% 0 38% 0); transform: translate(3px, -1px); }
  42% { clip-path: inset(88% 0 1% 0); transform: translate(-5px, 0); }
  44% { clip-path: inset(0 0 0 0); transform: translate(0, 0); }

  70% { clip-path: inset(52% 0 18% 0); transform: translate(2px, -1px); }
  72% { clip-path: inset(18% 0 58% 0); transform: translate(-4px, 2px); }
  74% { clip-path: inset(0 0 0 0); transform: translate(0, 0); }
}

@keyframes flicker {
  0%, 100% { opacity: 0.38; }
  7% { opacity: 0.48; }
  8% { opacity: 0.22; }
  9% { opacity: 0.42; }
  32% { opacity: 0.3; }
  33% { opacity: 0.5; }
  34% { opacity: 0.25; }
  62% { opacity: 0.42; }
  63% { opacity: 0.18; }
  64% { opacity: 0.44; }
}

@keyframes textFlicker {
  0%, 100% { opacity: 0.98; }
  15% { opacity: 0.9; }
  16% { opacity: 0.55; }
  17% { opacity: 0.96; }
  59% { opacity: 0.94; }
  60% { opacity: 0.62; }
  61% { opacity: 0.97; }
}
