
/* Glitch overlay */
.glitch-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: glitchFadeIn 0.3s ease forwards;
}

.glitch-overlay.dismiss {
  animation: glitchFadeOut 0.8s ease forwards;
}

@keyframes glitchFadeIn {
  0% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  55% {
    opacity: 0.3;
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 1;
  }
}

@keyframes glitchFadeOut {
  0% {
    opacity: 1;
  }
  30% {
    opacity: 0.6;
  }
  50% {
    opacity: 0.9;
  }
  70% {
    opacity: 0.2;
  }
  100% {
    opacity: 0;
  }
}

/* Scanline effect */
.glitch-overlay::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 255, 65, 0.03) 0px,
    rgba(0, 255, 65, 0.03) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 1;
  animation: scanlineMove 8s linear infinite;
}

@keyframes scanlineMove {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 0 100vh;
  }
}

/* CRT flicker */
.glitch-overlay::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    ellipse at center,
    transparent 50%,
    rgba(0, 0, 0, 0.4) 100%
  );
  pointer-events: none;
  z-index: 2;
}

/* Terminal container */
.glitch-terminal {
  position: relative;
  z-index: 3;
  width: min(700px, 90vw);
  max-height: 70vh;
  padding: 30px;
  font-family: "Courier New", "Lucida Console", monospace;
  font-size: 14px;
  color: #00ff41;
  text-shadow: 0 0 8px rgba(0, 255, 65, 0.6);
  overflow-y: auto;
  scrollbar-width: none;
}

.glitch-terminal::-webkit-scrollbar {
  display: none;
}

/* Terminal header */
.terminal-header {
  color: #00ff41;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 255, 65, 0.2);
  font-size: 11px;
  opacity: 0.6;
  letter-spacing: 2px;
}

/* Terminal lines */
.terminal-line {
  margin-bottom: 4px;
  line-height: 1.7;
  opacity: 0;
  animation: lineAppear 0.05s ease forwards;
  white-space: pre-wrap;
  word-break: break-all;
}

.terminal-line.typing {
  opacity: 1;
}

.terminal-line .prompt {
  color: #ff3e3e;
  text-shadow: 0 0 8px rgba(255, 62, 62, 0.5);
}

.terminal-line .path {
  color: #00aaff;
  text-shadow: 0 0 8px rgba(0, 170, 255, 0.5);
}

.terminal-line .warning {
  color: #ffaa00;
  text-shadow: 0 0 8px rgba(255, 170, 0, 0.5);
}

.terminal-line .success {
  color: #00ff41;
}

.terminal-line .error {
  color: #ff3e3e;
  text-shadow: 0 0 10px rgba(255, 62, 62, 0.6);
}

.terminal-line .highlight {
  color: #ff00ff;
  text-shadow: 0 0 10px rgba(255, 0, 255, 0.5);
}

.terminal-line .dim {
  color: #555;
  text-shadow: none;
}

@keyframes lineAppear {
  from {
    opacity: 0;
    transform: translateX(-5px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Blinking cursor */
.cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: #00ff41;
  animation: blink 0.7s step-end infinite;
  vertical-align: middle;
  margin-left: 2px;
  box-shadow: 0 0 8px rgba(0, 255, 65, 0.8);
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* ASCII art styling */
.ascii-art {
  color: #ff3e3e;
  text-shadow: 0 0 10px rgba(255, 62, 62, 0.4);
  font-size: 10px;
  line-height: 1.2;
  margin: 8px 0;
}

/* Progress bar */
.progress-bar {
  display: inline-block;
  color: #00ff41;
}

/* Error popup */
.error-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10002;
  background: rgba(20, 0, 0, 0.95);
  border: 1px solid #ff3e3e;
  border-radius: 4px;
  padding: 18px 32px;
  font-family: "Courier New", "Lucida Console", monospace;
  font-size: 14px;
  color: #ff3e3e;
  text-shadow: 0 0 8px rgba(255, 62, 62, 0.5);
  box-shadow:
    0 0 30px rgba(255, 62, 62, 0.3),
    0 0 60px rgba(255, 62, 62, 0.1),
    inset 0 0 20px rgba(255, 62, 62, 0.05);
  white-space: nowrap;
  pointer-events: none;
  animation: popupAppear 0.3s ease forwards, popupShake 0.4s ease, popupFade 0.4s ease 1.2s forwards;
}

.error-popup .popup-icon {
  color: #ff3e3e;
  margin-right: 10px;
  font-weight: bold;
}

.error-popup .popup-text {
  color: #ffaa00;
}

@keyframes popupAppear {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes popupShake {
  0%, 100% {
    transform: translate(-50%, -50%);
  }
  15% {
    transform: translate(calc(-50% + 8px), calc(-50% - 3px));
  }
  30% {
    transform: translate(calc(-50% - 6px), calc(-50% + 4px));
  }
  45% {
    transform: translate(calc(-50% + 5px), calc(-50% + 2px));
  }
  60% {
    transform: translate(calc(-50% - 4px), calc(-50% - 3px));
  }
  75% {
    transform: translate(calc(-50% + 3px), calc(-50% + 1px));
  }
}

@keyframes popupFade {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -60%) scale(0.95);
  }
}

/* Dismiss hint */
.dismiss-hint {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001;
  font-family: "Courier New", monospace;
  font-size: 12px;
  color: rgba(0, 255, 65, 0.4);
  letter-spacing: 2px;
  animation: hintPulse 2s ease-in-out infinite;
}

@keyframes hintPulse {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.7;
  }
}

/* Glitch effect on body */
.body-glitch {
  animation: bodyGlitch 0.3s linear;
}

@keyframes bodyGlitch {
  0% {
    filter: none;
    transform: translate(0);
  }
  10% {
    filter: hue-rotate(90deg) saturate(3);
    transform: translate(-3px, 2px);
  }
  20% {
    filter: hue-rotate(180deg) invert(0.2);
    transform: translate(3px, -1px);
  }
  30% {
    filter: hue-rotate(270deg) saturate(2);
    transform: translate(-2px, -2px);
  }
  40% {
    filter: hue-rotate(45deg) brightness(1.5);
    transform: translate(2px, 3px) skewX(2deg);
  }
  50% {
    filter: none;
    transform: translate(0);
  }
  60% {
    filter: hue-rotate(120deg) contrast(1.5);
    transform: translate(-1px, 1px);
  }
  70% {
    filter: invert(0.3) hue-rotate(200deg);
    transform: translate(1px, -3px) skewX(-1deg);
  }
  80% {
    filter: hue-rotate(300deg) saturate(5);
    transform: translate(-3px, 0);
  }
  90% {
    filter: brightness(2) hue-rotate(60deg);
    transform: translate(2px, 2px);
  }
  100% {
    filter: none;
    transform: translate(0);
  }
}
