:root {
  --bg-dark: #02020a;
  --cyan: #00e5ff;
  --magenta: #ff00c8;
  --white: #f5f5f5;
  --muted: #9ea0c7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Helvetica, Arial, sans-serif;
  background: radial-gradient(circle at top, #24184a 0%, #02020a 60%, #000 100%);
  overflow-x: hidden;
  color: var(--white);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Background noise + scanlines --- */

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.25;
  mix-blend-mode: overlay;
  animation: noisePulse 4s ease-in-out infinite alternate;
  z-index: 1;
}

@keyframes noisePulse {
  0% { opacity: 0.15; }
  50% { opacity: 0.50; }
  100% { opacity: 0.20; }
}

.scanline {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.12) 0px,
    rgba(255, 255, 255, 0.12) 2px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0) 6px
  );
  mix-blend-mode: soft-light;
  animation: scanScroll 3s linear infinite;
  z-index: 2;
}

@keyframes scanScroll {
  0% { background-position-y: 0; }
  100% { background-position-y: 12px; }
}

/* --- Layout --- */

.container {
  text-align: center;
  max-width: 800px;
  width: 100%;
  padding: 0 1.5rem;
  position: relative;
  z-index: 10;
  box-sizing: border-box;
}

.eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.8rem;
  margin-bottom: 0.7rem;
  opacity: 0.7;
  padding: 0 0.5rem;
  box-sizing: border-box;
}

/* --- Glitch Title --- */

.glitch-title {
  font-size: clamp(2.8rem, 6vw, 4.5rem);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  position: relative;
  display: inline-block;
  margin-bottom: 1.2rem;
  animation: glitchWobble 2.7s infinite;
  max-width: 100%;
  box-sizing: border-box;
  word-break: break-word;
}

.glitch-title .main {
  background: linear-gradient(135deg, var(--cyan), var(--magenta));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* RGB shifted layers */

.glitch-title::before,
.glitch-title::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  mix-blend-mode: screen;
  pointer-events: none;
  opacity: 0.4;
}

.glitch-title::before {
  color: var(--cyan);
  transform: translate(-2px, 0);
  clip-path: polygon(0 0,100% 0,100% 45%,0 50%);
  animation: glitchSliceTop 1.8s infinite steps(2, end);
}

.glitch-title::after {
  color: var(--magenta);
  transform: translate(2px, 0);
  clip-path: polygon(0 55%,100% 50%,100% 100%,0 100%);
  animation: glitchSliceBottom 2.1s infinite steps(2, end);
}

@keyframes glitchWobble {
  0%, 80%, 100% {
    transform: translate3d(0,0,0);
  }
  82% {
    transform: translate3d(-2px, 1px, 0) skewX(-2deg);
  }
  84% {
    transform: translate3d(3px, -1px, 0) skewX(2deg);
  }
  86% {
    transform: translate3d(-1px, 2px, 0);
  }
  88% {
    transform: translate3d(1px, -2px, 0);
  }
}

@keyframes glitchSliceTop {
  0%, 75%, 100% {
    transform: translate(-2px,0);
  }
  80% {
    transform: translate(-5px,-1px);
  }
  85% {
    transform: translate(3px,1px);
  }
}

@keyframes glitchSliceBottom {
  0%, 75%, 100% {
    transform: translate(2px,0);
  }
  80% {
    transform: translate(4px,1px);
  }
  85% {
    transform: translate(-3px,-1px);
  }
}

.subtext {
  color: var(--muted);
  opacity: 0.9;
  max-width: 460px;
  margin: 0.5rem auto 2rem;
  font-size: 0.95rem;
  line-height: 1.55;
  padding: 0 0.5rem;
  box-sizing: border-box;
}

/* --- Signal Pill --- */

.signal-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.27);
  backdrop-filter: blur(10px);
  background: rgba(10, 10, 30, 0.7);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 2.2rem;
  position: relative;
  overflow: hidden;
  animation: pillFlicker 4.4s infinite;
}

@keyframes pillFlicker {
  0%, 90%, 100% {
    box-shadow: 0 0 14px rgba(0, 229, 255, 0.35),
                0 0 26px rgba(255, 0, 200, 0.3);
    opacity: 1;
  }
  92% {
    box-shadow: 0 0 0 rgba(0, 229, 255, 0),
                0 0 0 rgba(255, 0, 200, 0);
    opacity: 0.45;
  }
  94% {
    opacity: 1;
  }
}

.signal-pill::before {
  content: "";
  position: absolute;
  top: 0;
  left: -30%;
  width: 40%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent,
    rgba(255,255,255,0.4),
    transparent
  );
  transform: translateX(-100%);
  opacity: 0;
}

.signal-pill:hover::before {
  opacity: 1;
  animation: pillSweep 0.7s ease-out;
}

@keyframes pillSweep {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(160%); }
}

/* --- Footer --- */

footer {
  margin-top: 2.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  opacity: 0.8;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.terminal-line {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  font-family: "VT323", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  max-width: 100%;
  word-break: break-word;
}

/* ASCII block trio: slow pulse / faint flicker */
.terminal-ascii {
  letter-spacing: 0.1em;
  margin-right: 0.35rem;
  flex-shrink: 0;
  animation: asciiPulse 5s ease-in-out infinite;
}

/* Footer text: subtle glitch flicker */
.terminal-text {
  white-space: normal;
  animation: textFlicker 7s infinite;
  word-break: break-word;
}

/* Blinking cursor block */
.terminal-cursor {
  flex-shrink: 0;
  animation: cursorBlink 1.1s steps(1, end) infinite;
}

@keyframes asciiPulse {
  0%, 100% {
    opacity: 0.4;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-1px);
  }
  60% {
    opacity: 0.7;
  }
}

@keyframes textFlicker {
  0%, 90%, 100% {
    opacity: 0.8;
    transform: translateX(0);
  }
  92% {
    opacity: 0.4;
    transform: translateX(-1px);
  }
  94% {
    opacity: 1;
    transform: translateX(1px);
  }
  96% {
    opacity: 0.7;
    transform: translateX(0);
  }
}

@keyframes cursorBlink {
  0%, 48% {
    opacity: 1;
  }
  52%, 100% {
    opacity: 0;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 1rem;
  }
  
  .subtext {
    font-size: 0.9rem;
    padding: 0 0.25rem;
  }
  
  .signal-pill {
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    padding: 0.55rem 1.2rem;
    max-width: calc(100% - 2rem);
    word-break: break-word;
  }
  
  .glitch-title {
    padding: 0 0.5rem;
  }
  
  .terminal-line {
    justify-content: center;
    text-align: center;
    font-size: 0.75rem;
  }
  
  .terminal-text {
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  footer {
    padding: 0 0.5rem;
    max-width: 100%;
    overflow: hidden;
  }
}

