@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap');

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

:root {
  --neon-cyan: #88ffe6;
  --neon-lime: #d6ff66;
  --neon-purple: #c9a2ff;
  --neon-pink: #ff00de;
  --neon-blue: #00fff9;
}

body {
  font-family: 'Space Mono', monospace;
  background: #000;
  color: #fff;
  overflow: hidden;
  height: 100vh;
  position: relative;
}

.vhs-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.03) 2px,
    rgba(255, 255, 255, 0.03) 4px
  );
  pointer-events: none;
  z-index: 1000;
  animation: scanlines 0.1s linear infinite;
}

@keyframes scanlines {
  0% { transform: translateY(0); }
  100% { transform: translateY(4px); }
}

.vhs-overlay::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(136, 255, 230, 0.1);
  box-shadow: 0 0 20px rgba(136, 255, 230, 0.5);
  animation: scan 4s linear infinite;
}

@keyframes scan {
  0% { transform: translateY(0); }
  100% { transform: translateY(100vh); }
}

.noise-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    repeating-conic-gradient(#000 0% 0.0002%, #fff 0% 0.0005%, #000 0% 0.001%),
    repeating-conic-gradient(#fff 0% 0.0001%, #000 0% 0.0004%);
  background-blend-mode: difference;
  opacity: 0.03;
  pointer-events: none;
  z-index: 999;
  animation: noise 0.15s infinite;
}

@keyframes noise {
  0%, 100% { background-position: 0 0, 100% 100%; }
  10% { background-position: -5% 10%, 95% 90%; }
  20% { background-position: 10% -5%, 80% 105%; }
  30% { background-position: -10% 5%, 110% 95%; }
  40% { background-position: 5% -10%, 90% 110%; }
  50% { background-position: -15% 15%, 115% 85%; }
  60% { background-position: 15% -15%, 75% 115%; }
  70% { background-position: -20% 20%, 120% 80%; }
  80% { background-position: 20% -20%, 70% 120%; }
  90% { background-position: -10% 10%, 110% 90%; }
}

.portal-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1000px;
}

.kaleidoscope-wrapper {
  position: absolute;
  width: 100vw;
  height: 100vh;
  transition: transform 0.2s ease-out;
}

.mirror-segment {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50vw;
  height: 50vh;
  transform-origin: center center;
  opacity: 0.4;
  mix-blend-mode: screen;
  filter: blur(2px) hue-rotate(0deg);
  animation: mirror-pulse 3s ease-in-out infinite;
}

.mirror-segment video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.6;
}

.segment-1 {
  transform: translate(-100%, -100%) scaleX(-1);
  animation-delay: 0s;
  filter: blur(2px) hue-rotate(0deg);
}

.segment-2 {
  transform: translate(0%, -100%) scaleY(-1);
  animation-delay: 0.75s;
  filter: blur(2px) hue-rotate(90deg);
}

.segment-3 {
  transform: translate(-100%, 0%) scaleY(-1);
  animation-delay: 1.5s;
  filter: blur(2px) hue-rotate(180deg);
}

.segment-4 {
  transform: translate(0%, 0%) scale(-1, -1);
  animation-delay: 2.25s;
  filter: blur(2px) hue-rotate(270deg);
}

@keyframes mirror-pulse {
  0%, 100% {
    opacity: 0.3;
    filter: blur(2px) saturate(1);
  }
  50% {
    opacity: 0.6;
    filter: blur(3px) saturate(1.5);
  }
}

.central-sigil {
  position: relative;
  width: 400px;
  height: 711px;
  z-index: 10;
  filter: drop-shadow(0 0 50px var(--neon-cyan));
}

.main-sigil-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 20px;
  border: 3px solid var(--neon-cyan);
  box-shadow: 
    0 0 30px rgba(136, 255, 230, 0.6),
    0 0 60px rgba(201, 162, 255, 0.4),
    inset 0 0 50px rgba(136, 255, 230, 0.1);
  position: relative;
  z-index: 2;
  will-change: transform, filter;
}

.funhouse-mirror {
  animation: funhouse-wave 4s ease-in-out infinite;
  filter: contrast(1.1) brightness(1.05);
}

@keyframes funhouse-wave {
  0%, 100% {
    border-radius: 20px;
  }
  25% {
    border-radius: 25px 15px 25px 15px;
  }
  50% {
    border-radius: 15px 25px 15px 25px;
  }
  75% {
    border-radius: 20px 20px 15px 25px;
  }
}

.unmute-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 15;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.tap-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--neon-cyan);
  text-shadow: 0 0 20px var(--neon-cyan);
  letter-spacing: 0.3em;
  z-index: 20;
  pointer-events: none;
  opacity: 0.8;
  animation: tap-pulse 2s ease-in-out infinite;
  transition: opacity 0.3s ease;
}

@keyframes tap-pulse {
  0%, 100% {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
  }
}

.glow-ring {
  position: absolute;
  top: -20px;
  left: -20px;
  right: -20px;
  bottom: -20px;
  border: 2px solid var(--neon-purple);
  border-radius: 25px;
  box-shadow: 
    0 0 40px var(--neon-purple),
    inset 0 0 40px var(--neon-purple);
  opacity: 0.6;
  z-index: 1;
  animation: ring-rotate 10s linear infinite;
}

.pulse-ring {
  position: absolute;
  top: -40px;
  left: -40px;
  right: -40px;
  bottom: -40px;
  border: 1px solid var(--neon-lime);
  border-radius: 30px;
  box-shadow: 
    0 0 60px var(--neon-lime);
  opacity: 0.3;
  z-index: 0;
  animation: ring-rotate 15s linear infinite reverse;
}

@keyframes ring-rotate {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.05); }
  100% { transform: rotate(360deg) scale(1); }
}

.shimmer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(136, 255, 230, 0.1) 50%,
    transparent 70%
  );
  background-size: 200% 200%;
  animation: shimmer 3s ease-in-out infinite;
  pointer-events: none;
  z-index: 3;
  border-radius: 20px;
}

@keyframes shimmer {
  0% { background-position: 0% 0%; }
  50% { background-position: 100% 100%; }
  100% { background-position: 0% 0%; }
}

.radial-lines {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200vw;
  height: 200vh;
  background: repeating-conic-gradient(
    from 0deg at 50% 50%,
    transparent 0deg,
    rgba(136, 255, 230, 0.02) 0.5deg,
    transparent 1deg
  );
  animation: radial-spin 30s linear infinite;
  pointer-events: none;
  z-index: 5;
}

@keyframes radial-spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.portal-text {
  position: absolute;
  bottom: 15%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 20;
}

.glitch-title {
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #fff;
  position: relative;
  text-shadow: 
    0.05em 0 0 var(--neon-blue), 
    -0.03em -0.04em 0 var(--neon-pink), 
    0.025em 0.04em 0 var(--neon-lime);
  animation: glitch-skew 1.5s infinite;
}

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

.glitch-title::before {
  left: 2px;
  text-shadow: -2px 0 var(--neon-pink);
  clip: rect(24px, 550px, 90px, 0);
  animation: glitch-anim 3s infinite linear alternate-reverse;
}

.glitch-title::after {
  left: -2px;
  text-shadow: 2px 2px var(--neon-blue);
  clip: rect(85px, 550px, 140px, 0);
  animation: glitch-anim2 2s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
  0% { clip: rect(31px, 9999px, 94px, 0); }
  20% { clip: rect(60px, 9999px, 11px, 0); }
  40% { clip: rect(85px, 9999px, 40px, 0); }
  60% { clip: rect(12px, 9999px, 76px, 0); }
  80% { clip: rect(45px, 9999px, 23px, 0); }
  100% { clip: rect(71px, 9999px, 8px, 0); }
}

@keyframes glitch-anim2 {
  0% { clip: rect(65px, 9999px, 119px, 0); }
  20% { clip: rect(21px, 9999px, 84px, 0); }
  40% { clip: rect(3px, 9999px, 53px, 0); }
  60% { clip: rect(98px, 9999px, 27px, 0); }
  80% { clip: rect(36px, 9999px, 72px, 0); }
  100% { clip: rect(89px, 9999px, 15px, 0); }
}

@keyframes glitch-skew {
  0% { transform: skew(0deg); }
  10% { transform: skew(-2deg); }
  20% { transform: skew(2deg); }
  30% { transform: skew(0deg); }
  100% { transform: skew(0deg); }
}

.glitch-subtitle {
  font-size: clamp(1rem, 3vw, 1.5rem);
  letter-spacing: 0.3em;
  color: var(--neon-cyan);
  text-shadow: 0 0 20px var(--neon-cyan);
  margin-top: 1rem;
  position: relative;
  animation: pulse-glow 2s ease-in-out infinite;
}

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

.glitch-subtitle::before {
  left: 1px;
  text-shadow: -1px 0 var(--neon-pink);
  opacity: 0.7;
  animation: glitch-sub 4s infinite;
}

.glitch-subtitle::after {
  left: -1px;
  text-shadow: 1px 0 var(--neon-lime);
  opacity: 0.7;
  animation: glitch-sub 3s infinite reverse;
}

@keyframes glitch-sub {
  0%, 90%, 100% { opacity: 0; }
  93%, 97% { opacity: 0.7; }
}

@keyframes pulse-glow {
  0%, 100% { text-shadow: 0 0 20px var(--neon-cyan); }
  50% { text-shadow: 0 0 40px var(--neon-cyan), 0 0 60px var(--neon-purple); }
}

.portal-nav {
  position: fixed;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2rem;
  z-index: 100;
}

.nav-link {
  font-family: 'Space Mono', monospace;
  font-size: 0.9rem;
  color: var(--neon-cyan);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  padding: 0.8rem 1.5rem;
  border: 2px solid var(--neon-cyan);
  background: rgba(0, 0, 0, 0.8);
  position: relative;
  transition: all 0.3s ease;
}

.nav-link:hover {
  background: var(--neon-cyan);
  color: #000;
  box-shadow: 0 0 30px var(--neon-cyan);
  transform: translateY(-2px);
}

.glitch-link::before {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.5rem;
  opacity: 0;
}

.glitch-link:hover::before {
  opacity: 1;
  text-shadow: -2px 0 var(--neon-pink);
  animation: glitch-nav 0.3s infinite;
}

@keyframes glitch-nav {
  0%, 100% { transform: translate(0); }
  25% { transform: translate(-2px, 2px); }
  50% { transform: translate(2px, -2px); }
  75% { transform: translate(-2px, -2px); }
}

@media (max-width: 768px) {
  .central-sigil {
    width: 300px;
    height: 533px;
  }
  
  .mirror-segment {
    width: 60vw;
    height: 60vh;
  }
  
  .portal-nav {
    flex-direction: column;
    gap: 1rem;
    top: 1rem;
  }
  
  .nav-link {
    font-size: 0.7rem;
    padding: 0.6rem 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
