/* CORPUS.SYS: The Long Night - Cinematic Interactive Experience */
@import url("https://fonts.googleapis.com/css2?family=Creepster&family=VT323&family=JetBrains+Mono&display=swap");

/* Cinematic Aspect Ratio - 21:9 Letterbox */
:root {
  /* Humanity Path (Default) - Blade Runner Terminal */
  --humanity-bg: linear-gradient(135deg, #0a1428 0%, #1a2639 50%, #2d1b3d 100%);
  --humanity-text: #ffb347;
  --humanity-text-secondary: #87ceeb;
  --humanity-accent: #ff6b35;
  --humanity-shadow: rgba(255, 179, 71, 0.3);
  --humanity-crt-scanline: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 1px,
    rgba(255, 179, 71, 0.03) 1px,
    rgba(255, 179, 71, 0.03) 2px
  );

  /* Power Path - Military Command Center */
  --power-bg: linear-gradient(135deg, #1a0000 0%, #2d0000 50%, #1a1a1a 100%);
  --power-text: #ff4444;
  --power-text-secondary: #ff6666;
  --power-accent: #cc0000;
  --power-shadow: rgba(255, 68, 68, 0.5);
  --power-border: 2px solid #ff4444;
  --power-glow: 0 0 10px rgba(255, 68, 68, 0.5);

  /* Bliss Path - Ethereal Dreamscape */
  --bliss-bg: linear-gradient(135deg, #1a1e3a 0%, #2d2d5a 50%, #3a2e5a 100%);
  --bliss-text: #e6e6ff;
  --bliss-text-secondary: #ccccff;
  --bliss-accent: #9370db;
  --bliss-shadow: rgba(147, 112, 219, 0.4);
  --bliss-flow-gradient: linear-gradient(45deg, #9370db, #dda0dd, #ba55d3);

  /* Common Variables */
  --bg-primary: var(--humanity-bg);
  --bg-secondary: rgba(0, 0, 0, 0.8);
  --text-primary: var(--humanity-text);
  --text-secondary: var(--humanity-text-secondary);
  --accent-primary: var(--humanity-accent);
  --shadow-color: var(--humanity-shadow);
  --border-radius: 8px;

  /* Cinematic Effects */
  --scanline-opacity: 0.03;
  --flicker-intensity: 0.02;
  --crt-curve: 0;
}

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

/* Cinematic Container - 21:9 Aspect Ratio with Letterbox */
.cinematic-container {
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
  z-index: 1;
}

/* Enhanced Letterbox Bars */
.letterbox-top,
.letterbox-bottom {
  position: fixed;
  left: 0;
  right: 0;
  height: calc((100vh - min(100vw * 9 / 21, 100vh)) / 2);
  background: linear-gradient(to bottom, #000 0%, #0a0a0a 50%, #000 100%);
  z-index: 1000;
  pointer-events: none;
}

.letterbox-top {
  top: 0;
  background: linear-gradient(to bottom, #000 0%, #0a0a0a 50%, #000 100%);
}

.letterbox-bottom {
  bottom: 0;
  background: linear-gradient(to top, #000 0%, #0a0a0a 50%, #000 100%);
}

/* Cinematic Screen with Enhanced Frame */
.cinematic-screen {
  width: min(100vw, 100vh * 21 / 9);
  height: min(100vh, 100vw * 9 / 21);
  max-width: 1600px;
  max-height: 720px;
  aspect-ratio: 21/9;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
  transition: all 0.8s ease;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8),
    inset 0 0 0 2px rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

/* Living Background Animations */
.cinematic-screen::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 1;
}

/* Humanity Theme - CRT Scanlines and Digital Noise */
.humanity-path .cinematic-screen::before {
  background-image:
    /* CRT Scanlines */ repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 1px,
    rgba(255, 179, 71, 0.02) 1px,
    rgba(255, 179, 71, 0.02) 2px
  );
  animation: crt-scanlines 0.1s linear infinite;
}

.humanity-path .cinematic-screen::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
      circle at 20% 30%,
      rgba(255, 179, 71, 0.03) 0%,
      transparent 20%
    ),
    radial-gradient(
      circle at 80% 70%,
      rgba(135, 206, 235, 0.02) 0%,
      transparent 20%
    ),
    radial-gradient(
      circle at 40% 80%,
      rgba(255, 107, 53, 0.02) 0%,
      transparent 20%
    );
  pointer-events: none;
  animation: digital-noise 3s ease-in-out infinite;
}

/* Power Theme - Sharp Red Grid */
.power-path .cinematic-screen::before {
  background-image:
    /* Vertical Grid Lines */ repeating-linear-gradient(
      90deg,
      transparent 0px,
      transparent 49px,
      rgba(255, 68, 68, 0.1) 49px,
      rgba(255, 68, 68, 0.1) 51px
    ),
    /* Horizontal Grid Lines */
      repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 49px,
        rgba(255, 68, 68, 0.1) 49px,
        rgba(255, 68, 68, 0.1) 51px
      );
  animation: power-grid 8s linear infinite;
}

.power-path .cinematic-screen::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
      circle at 25% 25%,
      rgba(255, 68, 68, 0.05) 0%,
      transparent 30%
    ),
    radial-gradient(
      circle at 75% 75%,
      rgba(204, 0, 0, 0.05) 0%,
      transparent 30%
    );
  pointer-events: none;
  animation: power-grid-pulse 4s ease-in-out infinite;
}

/* Bliss Theme - Generative Nebula Particles */
.bliss-path .cinematic-screen::before {
  background: radial-gradient(
      circle at 15% 20%,
      rgba(147, 112, 219, 0.15) 0%,
      transparent 25%
    ),
    radial-gradient(
      circle at 85% 80%,
      rgba(221, 160, 221, 0.12) 0%,
      transparent 25%
    ),
    radial-gradient(
      circle at 50% 10%,
      rgba(186, 85, 211, 0.1) 0%,
      transparent 25%
    ),
    radial-gradient(
      circle at 10% 90%,
      rgba(147, 112, 219, 0.08) 0%,
      transparent 25%
    ),
    radial-gradient(
      circle at 90% 30%,
      rgba(221, 160, 221, 0.1) 0%,
      transparent 25%
    );
  animation: bliss-nebula 12s ease-in-out infinite;
}

.bliss-path .cinematic-screen::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
      circle at 60% 40%,
      rgba(147, 112, 219, 0.08) 0%,
      transparent 20%
    ),
    radial-gradient(
      circle at 30% 60%,
      rgba(186, 85, 211, 0.06) 0%,
      transparent 20%
    );
  pointer-events: none;
  animation: bliss-particles 8s linear infinite;
}

/* Responsive adjustments for very wide screens */
@media (min-aspect-ratio: 21/9) {
  .cinematic-screen {
    width: 100vw;
    height: calc(100vw * 9 / 21);
  }
}

/* Responsive adjustments for very tall screens */
@media (max-aspect-ratio: 21/9) {
  .cinematic-screen {
    width: calc(100vh * 21 / 9);
    height: 100vh;
  }

  .letterbox-top,
  .letterbox-bottom {
    height: 0;
  }
}

body {
  font-family: "JetBrains Mono", "VT323", monospace;
  background: #000;
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  overflow: hidden;
  transition: all 0.8s ease;
  position: relative;
}

/* Path-Dependent Aesthetics */
.humanity-path {
  --bg-primary: var(--humanity-bg);
  --text-primary: var(--humanity-text);
  --text-secondary: var(--humanity-text-secondary);
  --accent-primary: var(--humanity-accent);
  --shadow-color: var(--humanity-shadow);
}

.humanity-path .cinematic-screen {
  background: var(--humanity-bg);
  position: relative;
  border: 3px solid #333;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(255, 179, 71, 0.1);
}

.humanity-path .cinematic-screen::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--humanity-crt-scanline);
  pointer-events: none;
  animation: scanlines 0.1s linear infinite;
  opacity: 0.8;
}

.humanity-path .cinematic-screen::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    circle at center,
    transparent 60%,
    rgba(0, 0, 0, 0.1) 100%
  );
  pointer-events: none;
  animation: subtle-flicker 3s ease-in-out infinite alternate;
}

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

.power-path {
  --bg-primary: var(--power-bg);
  --text-primary: var(--power-text);
  --text-secondary: var(--power-text-secondary);
  --accent-primary: var(--power-accent);
  --shadow-color: var(--power-shadow);
}

.power-path .cinematic-screen {
  background: var(--power-bg);
  border: var(--power-border);
  box-shadow: var(--power-glow), inset 0 0 50px rgba(255, 68, 68, 0.2),
    0 0 100px rgba(255, 68, 68, 0.1);
  position: relative;
}

.power-path .cinematic-screen::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(
    45deg,
    transparent,
    var(--power-accent),
    transparent
  );
  border-radius: inherit;
  opacity: 0.5;
  animation: border-pulse 2s ease-in-out infinite;
  z-index: -1;
}

.power-path .cinematic-screen::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
      circle at 20% 30%,
      rgba(255, 68, 68, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(circle at 80% 70%, rgba(204, 0, 0, 0.1) 0%, transparent 50%);
  pointer-events: none;
  animation: power-ambient 4s ease-in-out infinite alternate;
}

.bliss-path {
  --bg-primary: var(--bliss-bg);
  --text-primary: var(--bliss-text);
  --text-secondary: var(--bliss-text-secondary);
  --accent-primary: var(--bliss-accent);
  --shadow-color: var(--bliss-shadow);
}

.bliss-path .cinematic-screen {
  background: var(--bliss-bg);
  border-radius: 20px;
  box-shadow: 0 0 50px var(--bliss-shadow),
    inset 0 0 50px rgba(147, 112, 219, 0.2), 0 0 100px rgba(147, 112, 219, 0.1);
  position: relative;
  overflow: hidden;
}

.bliss-path .cinematic-screen::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: var(--bliss-flow-gradient);
  opacity: 0.1;
  animation: bliss-flow 8s linear infinite;
  border-radius: 50%;
}

.bliss-path .cinematic-screen::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
      circle at 30% 20%,
      rgba(147, 112, 219, 0.2) 0%,
      transparent 40%
    ),
    radial-gradient(
      circle at 70% 80%,
      rgba(221, 160, 221, 0.2) 0%,
      transparent 40%
    ),
    radial-gradient(
      circle at 50% 50%,
      rgba(186, 85, 211, 0.1) 0%,
      transparent 60%
    );
  pointer-events: none;
  animation: bliss-pulse 6s ease-in-out infinite;
}

/* CRT Screen Effects */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 255, 0, 0.03) 2px,
    rgba(0, 255, 0, 0.03) 4px
  );
  pointer-events: none;
  z-index: 999;
  animation: scanlines 0.1s linear infinite;
}

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

/* Subtle screen flicker */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 255, 0, 0.02);
  pointer-events: none;
  z-index: 998;
  animation: flicker 4s ease-in-out infinite alternate;
}

@keyframes flicker {
  0%,
  100% {
    opacity: 0.02;
  }
  50% {
    opacity: 0.05;
  }
}

body:not(.collapse) {
  background: radial-gradient(
    circle at center,
    var(--bg-secondary) 0%,
    var(--bg-primary) 100%
  );
}

/* Procedural Canvas Styles */
.canvas {
  padding: 2rem;
  border: 2px solid var(--accent-color);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.8);
  box-shadow: 0 0 20px var(--accent-color),
    inset 0 0 20px var(--accent-color, 0.1);
  max-width: 800px;
  transition: all 0.3s ease;
  min-height: 400px;
}

/* Layout Classes for Procedural Generation */
.layout-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.layout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  align-items: start;
}

.layout-flex-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  align-items: center;
}

.layout-scattered {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: space-around;
  align-items: flex-start;
}

/* Procedural Element Styles */
.procedural-heading {
  font-size: 2rem;
  color: var(--accent-color);
  text-shadow: 0 0 10px var(--accent-color);
  margin: 0;
  text-align: center;
}

.procedural-text {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin: 0;
  text-align: center;
  max-width: 400px;
}

.procedural-choice,
.back-btn {
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid var(--accent-color);
  color: var(--accent-color);
  padding: 0.8rem 1.5rem;
  font-family: "VT323", monospace;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  min-width: 150px;
}

.procedural-choice:hover,
.back-btn:hover {
  background: var(--accent-color);
  color: var(--bg-primary);
  box-shadow: 0 0 15px var(--accent-color);
  transform: scale(1.05);
}

.back-btn {
  border-color: var(--secondary-color);
  color: var(--secondary-color);
}

.back-btn:hover {
  background: var(--secondary-color);
  box-shadow: 0 0 15px var(--secondary-color);
}

.decorative-element {
  font-family: "Creepster", cursive;
  color: var(--accent-color);
  font-size: 1.5rem;
  opacity: 0.7;
  text-shadow: 0 0 5px var(--accent-color);
  user-select: none;
  pointer-events: none;
}

/* Analyzing Overlay for Suspense Delays */
.analyzing-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.5s ease;
  backdrop-filter: blur(4px);
}

.analyzing-overlay.visible {
  opacity: 1;
}

.analyzing-content {
  text-align: center;
  color: var(--text-primary);
  font-family: "JetBrains Mono", monospace;
}

.analyzing-text {
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 1rem;
  letter-spacing: 2px;
  text-shadow: 0 0 10px var(--accent-primary);
  animation: text-pulse 1.5s ease-in-out infinite;
}

.analyzing-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.analyzing-dots span {
  font-size: 3rem;
  opacity: 0.3;
  transition: opacity 0.3s ease;
  animation: dot-bounce 1.5s ease-in-out infinite;
}

.analyzing-dots span:nth-child(1) {
  animation-delay: 0s;
}
.analyzing-dots span:nth-child(2) {
  animation-delay: 0.3s;
}
.analyzing-dots span:nth-child(3) {
  animation-delay: 0.6s;
}

.analyzing-progress {
  width: 300px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 auto;
}

.analyzing-progress::after {
  content: "";
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(
    90deg,
    var(--accent-primary),
    var(--text-primary)
  );
  border-radius: 2px;
  animation: progress-fill 3s ease-out;
}

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

@keyframes dot-bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes progress-fill {
  0% {
    width: 0%;
  }
  100% {
    width: 100%;
  }
}

/* Path-Dependent Interactive Button Styles */
.primary-button,
.choice-btn,
button[type="submit"],
button[type="button"] {
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid var(--accent-primary);
  color: var(--text-primary);
  padding: 0.8rem 1.5rem;
  font-family: "JetBrains Mono", "VT323", monospace;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  min-width: 150px;
  position: relative;
  overflow: hidden;
  border-radius: var(--border-radius);
}

/* Humanity Path Button Interactions */
.humanity-path .primary-button,
.humanity-path .choice-btn,
.humanity-path button[type="submit"],
.humanity-path button[type="button"] {
  border-color: var(--humanity-accent);
  color: var(--humanity-text);
  box-shadow: 0 0 10px rgba(255, 179, 71, 0.2);
}

.humanity-path .primary-button:hover,
.humanity-path .choice-btn:hover,
.humanity-path button[type="submit"]:hover,
.humanity-path button[type="button"]:hover {
  background: var(--humanity-accent);
  color: var(--humanity-bg);
  box-shadow: 0 0 20px rgba(255, 179, 71, 0.5);
  transform: translateY(-2px) scale(1.02);
  border-color: var(--humanity-text);
}

.humanity-path .primary-button:active,
.humanity-path .choice-btn:active,
.humanity-path button[type="submit"]:active,
.humanity-path button[type="button"]:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 0 15px rgba(255, 179, 71, 0.3);
  animation: button-click-mechanical 0.2s ease-out;
}

/* Power Path Button Interactions */
.power-path .primary-button,
.power-path .choice-btn,
.power-path button[type="submit"],
.power-path button[type="button"] {
  border-color: var(--power-accent);
  color: var(--power-text);
  box-shadow: 0 0 10px rgba(255, 68, 68, 0.3);
  border-width: 3px;
}

.power-path .primary-button:hover,
.power-path .choice-btn:hover,
.power-path button[type="submit"]:hover,
.power-path button[type="button"]:hover {
  background: var(--power-accent);
  color: #000;
  box-shadow: 0 0 25px rgba(255, 68, 68, 0.8), 0 0 50px rgba(255, 68, 68, 0.4);
  transform: translateY(-3px) scale(1.05);
  border-color: var(--power-text);
  animation: button-aggressive-glow 0.5s ease-in-out infinite alternate;
}

.power-path .primary-button:active,
.power-path .choice-btn:active,
.power-path button[type="submit"]:active,
.power-path button[type="button"]:active {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 0 30px rgba(255, 68, 68, 1);
  animation: button-impact-flash 0.3s ease-out;
}

/* Bliss Path Button Interactions */
.bliss-path .primary-button,
.bliss-path .choice-btn,
.bliss-path button[type="submit"],
.bliss-path button[type="button"] {
  border-color: var(--bliss-accent);
  color: var(--bliss-text);
  box-shadow: 0 0 15px rgba(147, 112, 219, 0.3);
  border-radius: 15px;
}

.bliss-path .primary-button:hover,
.bliss-path .choice-btn:hover,
.bliss-path button[type="submit"]:hover,
.bliss-path button[type="button"]:hover {
  background: var(--bliss-accent);
  color: var(--bliss-bg);
  box-shadow: 0 0 30px rgba(147, 112, 219, 0.6),
    0 0 60px rgba(147, 112, 219, 0.3);
  transform: translateY(-2px) scale(1.03);
  border-color: var(--bliss-text);
  animation: button-soft-pulse 1.5s ease-in-out infinite;
}

.bliss-path .primary-button:active,
.bliss-path .choice-btn:active,
.bliss-path button[type="submit"]:active,
.bliss-path button[type="button"]:active {
  transform: translateY(0) scale(1.01);
  box-shadow: 0 0 40px rgba(147, 112, 219, 0.8);
  animation: button-chime-glow 0.4s ease-out;
}

/* Button Click Animations */
@keyframes button-click-mechanical {
  0% {
    transform: translateY(0) scale(0.98);
  }
  50% {
    transform: translateY(-1px) scale(1.02);
  }
  100% {
    transform: translateY(0) scale(0.98);
  }
}

@keyframes button-aggressive-glow {
  0% {
    box-shadow: 0 0 25px rgba(255, 68, 68, 0.8), 0 0 50px rgba(255, 68, 68, 0.4);
  }
  100% {
    box-shadow: 0 0 35px rgba(255, 68, 68, 1), 0 0 70px rgba(255, 68, 68, 0.6);
  }
}

@keyframes button-impact-flash {
  0% {
    box-shadow: 0 0 30px rgba(255, 68, 68, 1);
    transform: translateY(-1px) scale(1.02);
  }
  50% {
    box-shadow: 0 0 50px rgba(255, 68, 68, 1.2);
    transform: translateY(-2px) scale(1.03);
  }
  100% {
    box-shadow: 0 0 30px rgba(255, 68, 68, 1);
    transform: translateY(-1px) scale(1.02);
  }
}

@keyframes button-soft-pulse {
  0%,
  100% {
    box-shadow: 0 0 30px rgba(147, 112, 219, 0.6),
      0 0 60px rgba(147, 112, 219, 0.3);
    transform: translateY(-2px) scale(1.03);
  }
  50% {
    box-shadow: 0 0 40px rgba(147, 112, 219, 0.8),
      0 0 80px rgba(147, 112, 219, 0.5);
    transform: translateY(-3px) scale(1.04);
  }
}

@keyframes button-chime-glow {
  0% {
    box-shadow: 0 0 40px rgba(147, 112, 219, 0.8);
    transform: translateY(0) scale(1.01);
  }
  50% {
    box-shadow: 0 0 60px rgba(147, 112, 219, 1),
      0 0 90px rgba(147, 112, 219, 0.6);
    transform: translateY(-1px) scale(1.02);
  }
  100% {
    box-shadow: 0 0 40px rgba(147, 112, 219, 0.8);
    transform: translateY(0) scale(1.01);
  }
}

/* Terminal Interface Styles */
.terminal-container {
  width: 100%;
  height: 100%;
  max-width: 100%;
  background: #0a0a0a;
  border: 2px solid #333;
  font-family: "JetBrains Mono", "Courier New", monospace;
  color: #00ff00;
  position: relative;
  overflow: hidden;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.terminal-header {
  background: #1a1a1a;
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #333;
}

.terminal-title {
  color: #00ff00;
  font-size: 0.9rem;
  font-weight: bold;
}

.terminal-controls {
  display: flex;
  gap: 0.5rem;
}

.control-btn {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  cursor: pointer;
  user-select: none;
}

.control-btn.minimize {
  background: #ffa500;
}
.control-btn.maximize {
  background: #00ff00;
}
.control-btn.close {
  background: #ff0000;
}

.terminal-body {
  padding: 0.35rem;
  height: calc(100% - 30px);
  overflow-y: auto;
  background: linear-gradient(180deg, #0a0a0a 0%, #000 100%);
  font-size: 0.7rem;
  line-height: 1.05;
}

.terminal-prompt {
  display: flex;
  align-items: center;
  margin-bottom: 0.55rem;
  font-size: 0.75rem;
}

.blinking-cursor {
  animation: blink 1s infinite;
  font-size: 1rem;
  margin-left: 0.2rem;
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0;
  }
}

.boot-sequence {
  margin-bottom: 0.65rem;
  font-size: 0.7rem;
}

.boot-line {
  margin: 0.12rem 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.timestamp {
  color: #666;
  font-size: 0.8rem;
  min-width: 80px;
}

.boot-text {
  color: #ccc;
}

.boot-line.warning .boot-text {
  color: #ffa500;
}

.boot-line.error .boot-text {
  color: #ff4444;
}

.boot-line.success .boot-text {
  color: #00ff00;
}

.system-status {
  margin-bottom: 0.65rem;
  border: 1px solid #333;
  background: rgba(0, 255, 0, 0.05);
  font-size: 0.7rem;
}

.status-line {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  gap: 1rem;
}

.status-line:last-child {
  border-bottom: none;
}

.status-label {
  min-width: 120px;
  color: #ccc;
}

.status-value.online {
  color: #00ff00;
}

.status-value.critical {
  color: #ff4444;
}

.status-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00ff00, #00cc00);
  transition: width 1s ease;
}

.progress-fill.critical {
  background: linear-gradient(90deg, #ff4444, #cc0000);
}

.incident-report {
  margin-bottom: 2rem;
  border: 1px solid #ff4444;
  background: rgba(255, 68, 68, 0.05);
}

.report-header {
  background: #ff4444;
  color: white;
  padding: 0.5rem 1rem;
  font-weight: bold;
}

.report-content {
  padding: 1rem;
  color: #ccc;
}

.report-content p {
  margin: 0.3rem 0;
}

.user-interface {
  margin-top: 0.65rem;
}

.interface-prompt {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 1rem;
}

.mission-brief {
  margin-bottom: 0.65rem;
  color: #ccc;
  line-height: 1.05;
}

.start-command {
  margin-bottom: 1rem;
}

.terminal-button {
  background: transparent;
  border: 2px solid #00ff00;
  color: #00ff00;
  padding: 0.8rem 1.5rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: none;
  letter-spacing: 0;
  min-width: auto;
  position: relative;
  overflow: visible;
  border-radius: 0;
}

.terminal-button:hover {
  background: #00ff00;
  color: #000;
  box-shadow: 0 0 15px #00ff00;
}

.terminal-button:active {
  transform: translateY(1px);
}

.path-indicator {
  margin-top: 1rem;
  font-size: 0.9rem;
}

.path-label {
  color: #666;
}

.path-value {
  color: #00ff00;
  font-weight: bold;
}

/* Game Container Styles */
#game-container {
  font-family: "JetBrains Mono", monospace;
  color: #00ff00;
  overflow-y: auto;
  display: none;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 2rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.8s ease;
  position: relative;
  z-index: 10;
}

#game-container.visible {
  display: block !important;
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* Task Interface Styles */

/* Task element styles consolidated above */

/* Choice button hover styles consolidated below */

/* Task-specific interface styles */
.quarantine-interface {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid #666;
  padding: 1rem;
  margin-bottom: 2rem;
}

.system-logs {
  margin-bottom: 2rem;
}

.log-entries {
  background: #000;
  border: 1px solid #333;
  padding: 1rem;
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.9rem;
}

.log-entry {
  margin: 0.3rem 0;
  padding: 0.2rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.log-entry:last-child {
  border-bottom: none;
}

.console-section {
  background: #000;
  border: 1px solid #00ff00;
  padding: 1rem;
}

.console-output {
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.console-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.console-cursor {
  color: #00ff00;
  animation: blink 1s infinite;
}

.console-input-area {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.console-input-area input {
  flex: 1;
  background: transparent;
  border: 1px solid #666;
  color: #00ff00;
  padding: 0.5rem;
  font-family: "JetBrains Mono", monospace;
}

.console-input-area input:focus {
  outline: none;
  border-color: #00ff00;
}

.power-choice {
  border-color: #ff4444 !important;
  color: #ff4444 !important;
}

.power-choice:hover {
  background: #ff4444 !important;
  color: #000 !important;
  box-shadow: 0 0 15px #ff4444 !important;
}

.humanity-choice {
  border-color: #00ff00 !important;
  color: #00ff00 !important;
}

.humanity-choice:hover {
  background: #00ff00 !important;
  color: #000 !important;
  box-shadow: 0 0 15px #00ff00 !important;
}

/* Enhanced Image Elements */
.image-container {
  margin: 1rem 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.procedural-image {
  max-width: 100%;
  height: auto;
  border: 2px solid var(--accent-color);
  border-radius: 5px;
  filter: contrast(0.8) brightness(0.7) saturate(0.5);
  opacity: 0.8;
  transition: all 0.3s ease;
  box-shadow: 0 0 10px var(--accent-color);
}

.procedural-image:hover {
  filter: contrast(1.2) brightness(1.1) saturate(0.8);
  opacity: 1;
  transform: scale(1.02);
}

/* Decorative CSS Shapes */
.decorative-shape {
  margin: 1rem auto;
  pointer-events: none;
  user-select: none;
}

.cube {
  width: 40px;
  height: 40px;
  background: linear-gradient(
    45deg,
    var(--accent-color),
    var(--secondary-color)
  );
  border: 2px solid var(--accent-color);
  animation: spin-cube 3s ease-in-out infinite;
  position: relative;
}

.cube::before {
  content: "";
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  background: linear-gradient(
    45deg,
    transparent,
    var(--accent-color),
    transparent,
    var(--secondary-color)
  );
  z-index: -1;
  animation: spin-cube-reverse 2s ease-in-out infinite;
}

.glitch-line {
  width: 200px;
  height: 3px;
  background: var(--accent-color);
  position: relative;
  animation: glitch-line-move 4s ease-in-out infinite;
  box-shadow: 0 0 5px var(--accent-color);
}

.glitch-line::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--secondary-color);
  animation: glitch-line-flicker 0.5s ease-in-out infinite alternate;
  opacity: 0.7;
}

.pulse-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    var(--accent-color),
    var(--secondary-color)
  );
  animation: pulse-circle-beat 2s ease-in-out infinite;
  box-shadow: 0 0 15px var(--accent-color);
}

.corrupt-square {
  width: 35px;
  height: 35px;
  background: var(--accent-color);
  border: 2px solid var(--secondary-color);
  animation: corrupt-square-glitch 1.5s ease-in-out infinite;
  position: relative;
}

.corrupt-square::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  bottom: 2px;
  background: var(--bg-primary);
  animation: corrupt-square-inner 1.5s ease-in-out infinite alternate;
}

.title {
  font-family: "Creepster", cursive;
  font-size: 3rem;
  margin-bottom: 1rem;
  text-shadow: 0 0 10px var(--accent-toxic), 0 0 20px var(--accent-toxic),
    0 0 40px var(--accent-toxic);
  animation: pulse 2s ease-in-out infinite alternate;
}

.subtitle {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  color: var(--text-secondary);
  text-shadow: 0 0 5px var(--accent-glow);
}

.start-btn,
.nav-link {
  background: transparent;
  border: 2px solid var(--accent-blood);
  color: var(--text-primary);
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-family: "VT323", monospace;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 2px;
  position: relative;
  overflow: hidden;
  animation: pulse-glow 2s ease-in-out infinite alternate;
}

.start-btn:hover,
.nav-link:hover {
  background: var(--accent-blood);
  box-shadow: 0 0 15px var(--accent-blood), 0 0 30px var(--accent-blood);
  transform: scale(1.05);
}

.start-btn::before,
.nav-link::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.start-btn:hover::before,
.nav-link:hover::before {
  left: 100%;
}

/* Collapse state */
body.collapse {
  filter: blur(3px) grayscale(60%) contrast(1.5);
  pointer-events: none;
  animation: screen-flicker 0.1s ease-in-out infinite alternate;
}

body.collapse .main-container {
  animation: fall-apart 2s ease-in-out infinite, glitch 3s ease-in-out infinite;
  filter: blur(5px) grayscale(80%) hue-rotate(90deg);
  transform-origin: center;
}

body.collapse .title {
  animation: text-dissolve 1s ease-in-out infinite alternate,
    glitch-text 2s ease-in-out infinite;
  color: var(--accent-blood);
  text-shadow: 0 0 10px var(--accent-blood), 0 0 20px var(--accent-blood),
    2px 0 var(--accent-toxic), -2px 0 var(--accent-glow);
}

body.collapse .subtitle {
  animation: text-scramble 0.5s ease-in-out infinite;
  opacity: 0.3;
}

body.collapse .nav-link {
  animation: button-melt 1.5s ease-in-out infinite,
    button-flicker 0.3s ease-in-out infinite alternate;
  background: var(--accent-blood);
  border-color: var(--accent-toxic);
  transform: scale(0.9) rotate(2deg);
  position: relative;
}

body.collapse .nav-link::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 70%
  );
  animation: button-scan 2s ease-in-out infinite;
}

@keyframes pulse {
  from {
    transform: scale(1);
    opacity: 0.8;
  }
  to {
    transform: scale(1.05);
    opacity: 1;
  }
}

@keyframes fall-apart {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-10px) rotate(-1deg);
  }
  50% {
    transform: translateY(0) rotate(0deg);
  }
  75% {
    transform: translateY(10px) rotate(1deg);
  }
}

@keyframes glitch {
  0%,
  100% {
    transform: translateX(0);
    filter: hue-rotate(0deg);
  }
  10% {
    transform: translateX(-2px) translateY(1px);
    filter: hue-rotate(30deg);
  }
  20% {
    transform: translateX(2px) translateY(-1px);
    filter: hue-rotate(-30deg);
  }
  30% {
    transform: translateX(-1px) translateY(2px);
    filter: hue-rotate(60deg);
  }
  40% {
    transform: translateX(1px) translateY(-2px);
    filter: hue-rotate(-60deg);
  }
  50% {
    transform: translateX(0);
    filter: hue-rotate(0deg);
  }
  60% {
    transform: translateX(3px) translateY(1px);
    filter: hue-rotate(45deg);
  }
  70% {
    transform: translateX(-3px) translateY(-1px);
    filter: hue-rotate(-45deg);
  }
  80% {
    transform: translateX(1px) translateY(3px);
    filter: hue-rotate(90deg);
  }
  90% {
    transform: translateX(-1px) translateY(-3px);
    filter: hue-rotate(-90deg);
  }
}

@keyframes glitch-text {
  0%,
  100% {
    text-shadow: 0 0 10px var(--accent-blood), 0 0 20px var(--accent-blood),
      2px 0 var(--accent-toxic), -2px 0 var(--accent-glow);
  }
  10% {
    text-shadow: 0 0 5px var(--accent-toxic), 0 0 15px var(--accent-toxic),
      -1px 0 var(--accent-blood), 1px 0 var(--accent-glow);
  }
  20% {
    text-shadow: 0 0 8px var(--accent-glow), 0 0 25px var(--accent-glow),
      3px 0 var(--accent-blood), -3px 0 var(--accent-toxic);
  }
  30% {
    text-shadow: 0 0 12px var(--accent-blood), 0 0 18px var(--accent-blood),
      0 2px var(--accent-toxic), 0 -2px var(--accent-glow);
  }
  40% {
    text-shadow: 0 0 6px var(--accent-toxic), 0 0 22px var(--accent-toxic),
      4px 0 var(--accent-glow), -4px 0 var(--accent-blood);
  }
  50% {
    text-shadow: 0 0 15px var(--accent-glow), 0 0 30px var(--accent-glow),
      -2px 1px var(--accent-blood), 2px -1px var(--accent-toxic);
  }
  60% {
    text-shadow: 0 0 9px var(--accent-blood), 0 0 16px var(--accent-blood),
      1px 3px var(--accent-toxic), -1px -3px var(--accent-glow);
  }
  70% {
    text-shadow: 0 0 11px var(--accent-toxic), 0 0 26px var(--accent-toxic),
      -3px 2px var(--accent-blood), 3px -2px var(--accent-glow);
  }
  80% {
    text-shadow: 0 0 7px var(--accent-glow), 0 0 21px var(--accent-glow),
      2px -1px var(--accent-blood), -2px 1px var(--accent-toxic);
  }
  90% {
    text-shadow: 0 0 13px var(--accent-blood), 0 0 19px var(--accent-blood),
      0 4px var(--accent-toxic), 0 -4px var(--accent-glow);
  }
}

@keyframes text-dissolve {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0.3;
    transform: scale(0.95);
  }
}

@keyframes text-scramble {
  0%,
  100% {
    opacity: 0.3;
    transform: translateX(0);
  }
  25% {
    opacity: 0.1;
    transform: translateX(-5px);
  }
  50% {
    opacity: 0.2;
    transform: translateX(5px);
  }
  75% {
    opacity: 0.1;
    transform: translateX(-3px);
  }
}

@keyframes button-melt {
  0%,
  100% {
    transform: scale(0.9) rotate(2deg);
    border-radius: 5px;
  }
  25% {
    transform: scale(0.85) rotate(-2deg);
    border-radius: 15px 5px 15px 5px;
  }
  50% {
    transform: scale(0.95) rotate(0deg);
    border-radius: 5px 15px 5px 15px;
  }
  75% {
    transform: scale(0.87) rotate(3deg);
    border-radius: 15px 5px 15px 5px;
  }
}

@keyframes screen-flicker {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

@keyframes screen-shake {
  0%,
  100% {
    transform: translateX(0) translateY(0);
  }
  10% {
    transform: translateX(-3px) translateY(-2px);
  }
  20% {
    transform: translateX(3px) translateY(2px);
  }
  30% {
    transform: translateX(-2px) translateY(-3px);
  }
  40% {
    transform: translateX(2px) translateY(3px);
  }
  50% {
    transform: translateX(-3px) translateY(-2px);
  }
  60% {
    transform: translateX(3px) translateY(2px);
  }
  70% {
    transform: translateX(-2px) translateY(-1px);
  }
  80% {
    transform: translateX(2px) translateY(1px);
  }
  90% {
    transform: translateX(-1px) translateY(-2px);
  }
}

/* Unstable Interface Effects */
@keyframes screen-flicker-aggressive {
  0%,
  100% {
    opacity: 1;
    filter: brightness(1);
  }
  25% {
    opacity: 0.3;
    filter: brightness(0.5);
  }
  50% {
    opacity: 0.1;
    filter: brightness(0.2);
  }
  75% {
    opacity: 0.4;
    filter: brightness(0.6);
  }
}

@keyframes screen-flicker-subtle {
  0%,
  100% {
    opacity: 1;
    filter: brightness(1);
  }
  50% {
    opacity: 0.7;
    filter: brightness(0.8);
  }
}

@keyframes screen-flicker-realistic {
  0%,
  100% {
    opacity: 1;
    filter: brightness(1);
  }
  30% {
    opacity: 0.6;
    filter: brightness(0.7);
  }
  70% {
    opacity: 0.8;
    filter: brightness(0.9);
  }
}

@keyframes data-glitch {
  0%,
  100% {
    transform: translateX(0);
    filter: hue-rotate(0deg);
  }
  10% {
    transform: translateX(-2px);
    filter: hue-rotate(5deg);
  }
  20% {
    transform: translateX(2px);
    filter: hue-rotate(-5deg);
  }
  30% {
    transform: translateX(-1px);
    filter: hue-rotate(3deg);
  }
  40% {
    transform: translateX(1px);
    filter: hue-rotate(-3deg);
  }
  50% {
    transform: translateX(-3px);
    filter: hue-rotate(8deg);
  }
  60% {
    transform: translateX(3px);
    filter: hue-rotate(-8deg);
  }
  70% {
    transform: translateX(-1px);
    filter: hue-rotate(2deg);
  }
  80% {
    transform: translateX(1px);
    filter: hue-rotate(-2deg);
  }
  90% {
    transform: translateX(0);
    filter: hue-rotate(0deg);
  }
}

/* Apply unstable effects to appropriate elements */
.screen-flicker-aggressive {
  animation: screen-flicker-aggressive 0.8s ease-in-out;
}

.screen-flicker-subtle {
  animation: screen-flicker-subtle 0.4s ease-in-out;
}

.screen-flicker-realistic {
  animation: screen-flicker-realistic 0.6s ease-in-out;
}

.data-glitch {
  animation: data-glitch 0.8s ease-in-out;
}

@keyframes bliss-float {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }
  25% {
    transform: translateY(-5px) rotate(1deg);
  }
  50% {
    transform: translateY(-3px) rotate(-1deg);
  }
  75% {
    transform: translateY(-7px) rotate(0.5deg);
  }
}

@keyframes humanity-crt {
  0% {
    filter: brightness(1) contrast(1.1);
  }
  50% {
    filter: brightness(0.95) contrast(1.05);
  }
  100% {
    filter: brightness(1) contrast(1.1);
  }
}

@keyframes border-pulse {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.8;
  }
}

@keyframes power-ambient {
  0% {
    opacity: 0.5;
  }
  100% {
    opacity: 0.9;
  }
}

@keyframes bliss-flow {
  0% {
    transform: rotate(0deg) scale(1);
  }
  100% {
    transform: rotate(360deg) scale(1.1);
  }
}

@keyframes crt-scanlines {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(2px);
  }
}

@keyframes digital-noise {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.7;
  }
}

@keyframes power-grid {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 100px 100px;
  }
}

@keyframes power-grid-pulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 0.8;
  }
}

@keyframes bliss-nebula {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 0.6;
  }
  33% {
    transform: scale(1.05) rotate(120deg);
    opacity: 0.8;
  }
  66% {
    transform: scale(0.95) rotate(240deg);
    opacity: 0.4;
  }
}

@keyframes bliss-particles {
  0%,
  100% {
    transform: translateY(0px);
    opacity: 0.6;
  }
  25% {
    transform: translateY(-10px);
    opacity: 0.8;
  }
  50% {
    transform: translateY(-5px);
    opacity: 0.4;
  }
  75% {
    transform: translateY(-15px);
    opacity: 0.9;
  }
}

@keyframes button-flicker {
  0% {
    opacity: 0.7;
    filter: brightness(0.8);
  }
  100% {
    opacity: 1;
    filter: brightness(1.2);
  }
}

@keyframes button-scan {
  0% {
    transform: translateX(-100%) skewX(-15deg);
  }
  100% {
    transform: translateX(100%) skewX(-15deg);
  }
}

@keyframes pulse-glow {
  0% {
    box-shadow: 0 0 5px var(--accent-blood), 0 0 10px var(--accent-blood),
      0 0 15px var(--accent-blood);
  }
  100% {
    box-shadow: 0 0 10px var(--accent-blood), 0 0 20px var(--accent-blood),
      0 0 30px var(--accent-blood);
  }
}

/* Fragment styling */
.fragment {
  animation: fragment-appear 0.8s ease-out;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .main-container {
    margin: 1rem;
    padding: 1.5rem;
  }

  .title {
    font-size: 2.5rem;
  }

  .start-btn,
  .nav-link {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
  }

  /* Better touch targets */
  .nav-link {
    min-height: 48px;
    min-width: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --bg-primary: #000000;
    --text-primary: #ffffff;
    --accent-toxic: #00ff00;
    --accent-blood: #ff0000;
  }
}

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

.fragment h2 {
  color: var(--accent-toxic);
  margin-bottom: 1rem;
  animation: text-flicker 3s ease-in-out infinite;
}

.fragment p {
  margin-bottom: 1rem;
  line-height: 1.6;
}

@keyframes fragment-appear {
  0% {
    opacity: 0;
    transform: translateY(50px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes text-flicker {
  0%,
  100% {
    text-shadow: 0 0 5px var(--accent-toxic), 0 0 10px var(--accent-toxic);
  }
  50% {
    text-shadow: 0 0 2px var(--accent-toxic), 0 0 5px var(--accent-toxic);
    opacity: 0.8;
  }
}

/* Procedural Collapse Animations */
@keyframes fall-apart {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 1;
  }
  25% {
    transform: translate(5px, -10px) rotate(2deg);
    opacity: 0.9;
  }
  50% {
    transform: translate(-5px, -20px) rotate(-2deg);
    opacity: 0.7;
  }
  75% {
    transform: translate(3px, -30px) rotate(1deg);
    opacity: 0.4;
  }
  100% {
    transform: translate(0, -50px) rotate(0deg);
    opacity: 0;
  }
}

@keyframes glitch-out {
  0% {
    transform: translate(0);
    filter: hue-rotate(0deg) saturate(1);
  }
  10% {
    transform: translate(-2px, 2px);
    filter: hue-rotate(90deg) saturate(1.5);
  }
  20% {
    transform: translate(2px, -2px);
    filter: hue-rotate(180deg) saturate(0.5);
  }
  30% {
    transform: translate(-1px, 1px);
    filter: hue-rotate(270deg) saturate(2);
  }
  40% {
    transform: translate(1px, -1px);
    filter: hue-rotate(0deg) saturate(0.3);
  }
  50% {
    transform: translate(0);
    filter: hue-rotate(180deg) saturate(3);
  }
  60% {
    transform: translate(-3px, 3px);
    filter: hue-rotate(90deg) saturate(0.1);
  }
  70% {
    transform: translate(3px, -3px);
    filter: hue-rotate(270deg) saturate(2.5);
  }
  80% {
    transform: translate(-2px, 2px);
    filter: hue-rotate(0deg) saturate(0.8);
  }
  90% {
    transform: translate(2px, -2px);
    filter: hue-rotate(180deg) saturate(1.8);
  }
  100% {
    transform: translate(0);
    filter: hue-rotate(90deg) saturate(0);
    opacity: 0;
  }
}

@keyframes pixel-dissolve {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  20% {
    transform: scale(1.02);
  }
  40% {
    transform: scale(0.98);
  }
  60% {
    transform: scale(1.01);
    opacity: 0.8;
  }
  80% {
    transform: scale(0.99);
    opacity: 0.4;
  }
  100% {
    transform: scale(0.95);
    opacity: 0;
  }
}

@keyframes corrupt-fade {
  0% {
    opacity: 1;
    filter: contrast(1) brightness(1);
  }
  25% {
    filter: contrast(1.2) brightness(1.1);
  }
  50% {
    filter: contrast(0.8) brightness(0.9);
    opacity: 0.9;
  }
  75% {
    filter: contrast(1.5) brightness(0.7);
    opacity: 0.6;
  }
  100% {
    filter: contrast(0.3) brightness(0.3);
    opacity: 0;
  }
}

@keyframes data-leak {
  0% {
    opacity: 1;
    transform: translateY(0) scaleY(1);
  }
  30% {
    transform: translateY(-5px) scaleY(1.1);
    opacity: 0.9;
  }
  60% {
    transform: translateY(-15px) scaleY(0.9);
    opacity: 0.7;
  }
  100% {
    transform: translateY(-30px) scaleY(0.1);
    opacity: 0;
  }
}

/* Apply procedural collapse animation */
body.collapse .canvas {
  animation: var(--collapse-animation) 2s ease-in-out infinite;
}

/* Shape Animations */
@keyframes spin-cube {
  0% {
    transform: rotateX(0deg) rotateY(0deg);
  }
  25% {
    transform: rotateX(90deg) rotateY(0deg);
  }
  50% {
    transform: rotateX(90deg) rotateY(90deg);
  }
  75% {
    transform: rotateX(0deg) rotateY(90deg);
  }
  100% {
    transform: rotateX(0deg) rotateY(0deg);
  }
}

@keyframes spin-cube-reverse {
  0% {
    transform: rotateX(0deg) rotateY(0deg) scale(1);
  }
  50% {
    transform: rotateX(180deg) rotateY(180deg) scale(1.2);
  }
  100% {
    transform: rotateX(360deg) rotateY(360deg) scale(1);
  }
}

@keyframes glitch-line-move {
  0%,
  100% {
    transform: translateX(0) skewX(0deg);
  }
  25% {
    transform: translateX(10px) skewX(5deg);
  }
  50% {
    transform: translateX(-10px) skewX(-5deg);
  }
  75% {
    transform: translateX(5px) skewX(2deg);
  }
}

@keyframes glitch-line-flicker {
  0% {
    opacity: 0.3;
    transform: scaleX(0.8);
  }
  100% {
    opacity: 0.8;
    transform: scaleX(1.2);
  }
}

@keyframes pulse-circle-beat {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.3);
    opacity: 1;
  }
}

@keyframes corrupt-square-glitch {
  0% {
    transform: rotate(0deg) scale(1);
    border-radius: 0;
  }
  20% {
    transform: rotate(5deg) scale(1.1);
    border-radius: 10px;
  }
  40% {
    transform: rotate(-5deg) scale(0.9);
    border-radius: 5px;
  }
  60% {
    transform: rotate(3deg) scale(1.05);
    border-radius: 15px;
  }
  80% {
    transform: rotate(-3deg) scale(0.95);
    border-radius: 8px;
  }
  100% {
    transform: rotate(0deg) scale(1);
    border-radius: 0;
  }
}

@keyframes corrupt-square-inner {
  0% {
    transform: scale(0.8) rotate(0deg);
    opacity: 0.5;
  }
  100% {
    transform: scale(1.2) rotate(180deg);
    opacity: 1;
  }
}

/* Enhanced CORPUS.SYS Decorative Shape Animations */
@keyframes chaotic-spin {
  0% {
    transform: rotate(0deg) scale(1);
  }
  25% {
    transform: rotate(90deg) scale(1.2);
  }
  50% {
    transform: rotate(180deg) scale(0.8);
  }
  75% {
    transform: rotate(270deg) scale(1.1);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

@keyframes intense-glitch {
  0%,
  100% {
    transform: translateX(0) scaleX(1);
    opacity: 1;
  }
  10% {
    transform: translateX(-2px) scaleX(0.9);
    opacity: 0.8;
  }
  20% {
    transform: translateX(2px) scaleX(1.1);
    opacity: 0.9;
  }
  30% {
    transform: translateX(-1px) scaleX(0.95);
    opacity: 0.7;
  }
  40% {
    transform: translateX(1px) scaleX(1.05);
    opacity: 0.85;
  }
  50% {
    transform: translateX(-3px) scaleX(0.85);
    opacity: 0.6;
  }
  60% {
    transform: translateX(3px) scaleX(1.15);
    opacity: 0.75;
  }
  70% {
    transform: translateX(-2px) scaleX(0.9);
    opacity: 0.65;
  }
  80% {
    transform: translateX(2px) scaleX(1.1);
    opacity: 0.8;
  }
  90% {
    transform: translateX(-1px) scaleX(0.95);
    opacity: 0.9;
  }
}

@keyframes slow-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.4;
  }
}

@keyframes severe-corruption {
  0%,
  100% {
    filter: hue-rotate(0deg) saturate(1) contrast(1);
  }
  25% {
    filter: hue-rotate(90deg) saturate(1.5) contrast(1.2);
  }
  50% {
    filter: hue-rotate(180deg) saturate(0.5) contrast(0.8);
  }
  75% {
    filter: hue-rotate(270deg) saturate(1.2) contrast(1.1);
  }
}

/* CORPUS.SYS v3 - Dashboard and Path-Based Styling */

#intro-page {
  width: 100%;
  max-width: 100%;
  padding: 1.1rem;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 12px;
  border: 1px solid var(--accent-toxic);
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.2);
  opacity: 1;
  transform: translateY(0);
  transition: all 0.8s ease;
  font-size: 0.75rem;
}

#intro-page.hidden {
  opacity: 0;
  transform: translateY(-50px);
}

.system-header {
  text-align: center;
  margin-bottom: 3rem;
}

.system-header h1 {
  font-size: 3rem;
  font-weight: bold;
  color: var(--accent-toxic);
  text-shadow: 0 0 10px var(--accent-toxic);
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  opacity: 0.8;
}

.dashboard-container {
  display: grid;
  gap: 2rem;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.status-card {
  background: rgba(26, 26, 26, 0.9);
  border: 1px solid #333;
  border-radius: 8px;
  padding: 1.5rem;
  transition: all 0.3s ease;
}

.status-card:hover {
  border-color: var(--accent-toxic);
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.1);
}

.status-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.status-icon {
  font-size: 0.8rem;
  font-weight: bold;
}

.status-icon.green {
  color: #00ff00;
}

.status-icon.red {
  color: #ff4444;
  animation: pulse 2s infinite;
}

.status-icon.yellow {
  color: #ffaa00;
}

.status-card h3 {
  font-size: 1.1rem;
  color: var(--text-primary);
}

.status-value {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.status-detail {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.status-card.critical {
  border-color: #ff4444;
  background: rgba(255, 68, 68, 0.1);
}

.system-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.info-section h4 {
  color: var(--accent-toxic);
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--accent-toxic);
  padding-bottom: 0.5rem;
}

.info-section p {
  margin-bottom: 0.5rem;
}

.activity-log p {
  margin-bottom: 0.3rem;
  padding: 0.2rem 0;
}

.error-log {
  color: #ff6666 !important;
}

.action-panel {
  text-align: center;
  padding: 2rem;
  background: rgba(26, 26, 26, 0.5);
  border-radius: 8px;
  border: 1px solid #333;
}

.action-panel h4 {
  color: var(--accent-toxic);
  margin-bottom: 1.5rem;
}

.primary-button {
  background: var(--accent-toxic);
  color: var(--bg-primary);
  border: none;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 0 0.5rem;
}

.primary-button:hover {
  background: #00dd00;
  box-shadow: 0 0 15px var(--accent-toxic);
}

.secondary-button {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid #555;
  padding: 1rem 2rem;
  font-size: 1rem;
  border-radius: 6px;
  cursor: not-allowed;
  margin: 0 0.5rem;
}

.secondary-button:not(:disabled) {
  background: rgba(0, 255, 0, 0.1);
  color: var(--accent-toxic);
  border-color: var(--accent-toxic);
  cursor: pointer;
}

.secondary-button:not(:disabled):hover {
  background: rgba(0, 255, 0, 0.2);
}

/* Path-Based Styling Effects */

body.dark-path {
  filter: blur(0.5px);
  animation: screen-flicker 0.5s infinite, dark-tint 3s infinite;
}

@keyframes dark-tint {
  0%,
  100% {
    filter: blur(0.5px) hue-rotate(0deg) saturate(0.8);
  }
  50% {
    filter: blur(0.5px) hue-rotate(20deg) saturate(0.6);
  }
}

@keyframes screen-flicker {
  0%,
  100% {
    opacity: 1;
  }
  98% {
    opacity: 1;
  }
  99% {
    opacity: 0.3;
  }
}

body.good-path {
  background: linear-gradient(135deg, #0d1a0d 0%, #1a2d1a 100%);
}

body.good-path .status-card {
  background: rgba(20, 40, 20, 0.9);
  border-color: #00ff00;
}

body.good-path .primary-button {
  background: linear-gradient(45deg, #00ff00, #00dd00);
}

body.neutral-path {
  background: var(--bg-primary);
}

/* Reward Overlay */
.reward-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: pointer;
}

.reward-content {
  background: rgba(20, 40, 20, 0.95);
  border: 2px solid var(--accent-toxic);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  max-width: 500px;
  box-shadow: 0 0 30px var(--accent-toxic);
}

.reward-content img {
  max-width: 100%;
  height: auto;
  margin-bottom: 1rem;
  border-radius: 8px;
}

.reward-content p {
  font-size: 1.2rem;
  color: var(--accent-toxic);
}

/* Dark Path Events */
.dark-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(50, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.fake-error {
  background: #000;
  border: 2px solid #ff4444;
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  font-family: "Courier New", monospace;
  box-shadow: 0 0 20px #ff4444;
}

.fake-error h2 {
  color: #ff4444;
  margin-bottom: 1rem;
}

.fake-error p {
  color: #fff;
  margin-bottom: 1rem;
}

.fake-progress {
  width: 300px;
  height: 20px;
  background: #333;
  border-radius: 10px;
  overflow: hidden;
  margin: 1rem auto;
}

.fake-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #ff4444, #ff6666);
  width: 0%;
  transition: width 2s ease;
  animation: fake-progress-anim 3s infinite;
}

@keyframes fake-progress-anim {
  0% {
    width: 0%;
  }
  90% {
    width: 99%;
  }
  100% {
    width: 0%;
  }
}

/* Task Container - Consolidated above */

/* Legacy body.task-container styles removed - not used in current implementation */

.task-container {
  background: rgba(0, 0, 0, 0.95);
  border: 1px solid var(--accent-toxic);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s ease;
  position: relative;
  z-index: 20;
  width: 100%;
  height: 100%;
  display: block;
  box-sizing: border-box;
}

.task-container.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.task-container.visible .task-header {
  opacity: 1;
  transform: translateY(0);
}

.task-container.visible .task-content {
  opacity: 1;
  transform: translateY(0);
}

.task-container.visible .task-choices {
  opacity: 1;
  transform: translateY(0);
}

.task-container.visible .choice-btn {
  opacity: 1;
  transform: scale(1);
}

.task-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid #333;
  padding-bottom: 1rem;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.task-title {
  color: var(--accent-toxic);
  font-size: 1.5rem;
  margin-bottom: 1rem;
  text-align: center;
}

.task-description {
  margin-bottom: 2rem;
  line-height: 1.6;
}

.task-content {
  margin-bottom: 2rem;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.task-choices {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.choice-btn {
  padding: 1rem 2rem;
  border: 2px solid var(--accent-toxic);
  background: transparent;
  color: var(--accent-toxic);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.choice-btn:hover {
  background: var(--accent-toxic);
  color: var(--bg-primary);
  box-shadow: 0 0 15px var(--accent-toxic);
}

.choice-btn[data-path="dark"] {
  border-color: #ff4444;
  color: #ff6666;
}

.choice-btn[data-path="dark"]:hover {
  background: #ff4444;
  color: #fff;
  box-shadow: 0 0 15px #ff4444;
}

.choice-btn[data-path="good"] {
  border-color: #00ff00;
  color: #00ff00;
}

.choice-btn[data-path="good"]:hover {
  background: #00ff00;
  color: #000;
  box-shadow: 0 0 15px #00ff00;
}

/* Task-specific styling */
.log-viewer {
  max-height: 400px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #333;
  border-radius: 6px;
  padding: 1rem;
  font-family: "Courier New", monospace;
}

.log-header {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--accent-toxic);
}

.log-header h4 {
  color: var(--accent-toxic);
  margin-bottom: 0.5rem;
}

.log-entries {
  line-height: 1.4;
}

.log-entry {
  padding: 0.2rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.log-time {
  color: #888;
  margin-right: 1rem;
  font-size: 0.8rem;
}

.log-message {
  color: var(--text-primary);
}

.hidden-anomaly {
  color: #ff6666;
  background: rgba(255, 102, 102, 0.1);
}

.code-editor {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  overflow: hidden;
}

.editor-header {
  background: #2a2a2a;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #333;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.editor-header h4 {
  color: var(--accent-toxic);
}

.line-count {
  color: #888;
  font-size: 0.8rem;
}

.code-content {
  padding: 1rem;
}

.code-content code {
  color: #e6e6e6;
  line-height: 1.4;
}

.text-input-container {
  max-width: 600px;
  margin: 0 auto;
}

.query-display {
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--accent-toxic);
  border-radius: 6px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  text-align: center;
}

.query-text {
  color: var(--accent-toxic);
  font-size: 1.2rem;
  font-style: italic;
  margin-top: 0.5rem;
}

.input-area {
  display: flex;
  gap: 1rem;
  align-items: center;
}

#user-response {
  flex: 1;
  padding: 0.8rem;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--accent-toxic);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: inherit;
}

#user-response:focus {
  outline: none;
  border-color: #00ff00;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.task-result {
  background: rgba(0, 255, 0, 0.1);
  border: 1px solid var(--accent-toxic);
  border-radius: 6px;
  padding: 1rem;
  margin-top: 1rem;
  text-align: center;
}

/* Ending styles */
.ending {
  text-align: center;
  padding: 3rem;
}

.dark-ending {
  background: rgba(50, 0, 0, 0.8);
  border: 2px solid #ff4444;
  color: #ff6666;
}

.good-ending {
  background: rgba(0, 50, 0, 0.8);
  border: 2px solid #00ff00;
  color: #00ff00;
}

.neutral-ending {
  background: rgba(50, 50, 50, 0.8);
  border: 2px solid var(--accent-toxic);
  color: var(--accent-toxic);
}

.ending h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  text-shadow: 0 0 20px currentColor;
}

.ending p {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.glitch-effect {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 2px,
    rgba(255, 0, 0, 0.1) 2px,
    rgba(255, 0, 0, 0.1) 4px
  );
  animation: severe-corruption 0.1s infinite;
  pointer-events: none;
}

.input-cursor::after {
  content: "_";
  animation: blink 1s infinite;
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0;
  }
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid transparent;
  border-top: 3px solid var(--accent-toxic);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 1rem auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Cinematic Path Animations */
@keyframes border-pulse {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.8;
  }
}

@keyframes power-ambient {
  0% {
    opacity: 0.1;
  }
  100% {
    opacity: 0.3;
  }
}

@keyframes bliss-flow {
  0% {
    transform: rotate(0deg) translateX(0);
  }
  100% {
    transform: rotate(360deg) translateX(20px);
  }
}

@keyframes bliss-pulse {
  0%,
  100% {
    opacity: 0.8;
  }
  50% {
    opacity: 1;
  }
}

@keyframes subtle-flicker {
  0%,
  100% {
    opacity: 0.02;
  }
  50% {
    opacity: 0.05;
  }
}

/* Screen Effect Classes for JavaScript */
.screen-shake {
  animation: screen-shake 0.5s ease-in-out;
}

.bliss-float {
  animation: bliss-float 4s ease-in-out infinite alternate;
}

@keyframes screen-shake {
  0%,
  100% {
    transform: translateX(0) translateY(0);
  }
  10% {
    transform: translateX(-2px) translateY(-1px);
  }
  20% {
    transform: translateX(2px) translateY(1px);
  }
  30% {
    transform: translateX(-1px) translateY(-2px);
  }
  40% {
    transform: translateX(1px) translateY(2px);
  }
  50% {
    transform: translateX(-2px) translateY(1px);
  }
  60% {
    transform: translateX(2px) translateY(-1px);
  }
  70% {
    transform: translateX(-1px) translateY(2px);
  }
  80% {
    transform: translateX(1px) translateY(-2px);
  }
  90% {
    transform: translateX(-2px) translateY(-1px);
  }
}

@keyframes bliss-float {
  0% {
    transform: translateY(0px) rotate(0deg);
  }
  100% {
    transform: translateY(-10px) rotate(1deg);
  }
}

/* File System Navigator */
.file-system-navigator {
  max-width: 600px;
  margin: 0 auto;
}

.navigation-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--accent-toxic);
}

.navigation-header h4 {
  color: var(--accent-toxic);
  margin-bottom: 0.5rem;
}

#current-dir {
  color: #00ff00;
  font-family: "Courier New", monospace;
}

.directory-tree {
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #333;
  border-radius: 6px;
  padding: 1rem;
  font-family: "Courier New", monospace;
}

.dir-item {
  padding: 0.3rem 0;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dir-item:hover {
  background: rgba(0, 255, 0, 0.1);
  color: var(--accent-toxic);
}

.dir-icon {
  font-size: 1rem;
}

.file-item {
  padding: 0.3rem 0 0.3rem 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #ccc;
}

.file-item:hover {
  background: rgba(0, 255, 0, 0.1);
  color: var(--accent-toxic);
}

.file-info {
  margin-top: 2rem;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--accent-toxic);
  border-radius: 6px;
  padding: 1.5rem;
}

.file-info h5 {
  color: var(--accent-toxic);
  margin-bottom: 1rem;
}

#file-contents {
  background: #000;
  padding: 1rem;
  border-radius: 4px;
  color: #0f0;
  white-space: pre-wrap;
  font-family: "Courier New", monospace;
  line-height: 1.4;
}

/* NEW INTERACTIVE TASK STYLES */

/* Act Transitions */
.act-transition {
  text-align: center;
  padding: 3rem;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  border: 2px solid var(--accent-blue);
  border-radius: 15px;
  animation: actTransitionIn 1s ease-out;
}

.act-transition h2 {
  font-size: 2.5rem;
  color: var(--accent-cyan);
  margin-bottom: 1.5rem;
  text-shadow: 0 0 20px var(--accent-cyan);
}

.act-transition p {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.act-progress {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
  border-radius: 2px;
  width: 0%;
  animation: progressFill 2.5s ease-out;
}

@keyframes actTransitionIn {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(50px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes progressFill {
  0% {
    width: 0%;
  }
  100% {
    width: 100%;
  }
}

/* File System Task */
.file-system {
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid var(--accent-toxic);
  border-radius: 8px;
  padding: 1.5rem;
}

.folder-header {
  background: var(--accent-toxic);
  color: #000;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.file-list {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.file-item {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.file-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.file-item.hidden-file {
  opacity: 0.3;
  font-style: italic;
}

.file-icon {
  margin-right: 0.5rem;
}

.file-status {
  margin-left: auto;
  margin-right: 1rem;
  font-size: 0.8rem;
  opacity: 0.7;
}

.danger-button {
  background: var(--accent-red);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

.danger-button:hover {
  background: #ff6666;
  transform: translateY(-2px);
}

.console-area {
  margin-top: 1rem;
  background: #000;
  border: 1px solid var(--accent-toxic);
  border-radius: 4px;
  padding: 0.5rem;
}

.console-prompt {
  color: var(--accent-toxic);
  font-family: "Courier New", monospace;
}

.console-cursor {
  color: #fff;
  background: var(--accent-toxic);
  animation: cursorBlink 1s infinite;
}

@keyframes cursorBlink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0;
  }
}

/* Memory Dump */
.memory-dump {
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid var(--accent-blue);
  border-radius: 8px;
  padding: 1.5rem;
}

.hex-viewer {
  background: #000;
  border: 1px solid var(--accent-blue);
  border-radius: 4px;
  padding: 1rem;
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
  max-height: 400px;
  overflow-y: auto;
}

.hex-row {
  display: flex;
  margin-bottom: 0.25rem;
}

.address {
  color: var(--accent-cyan);
  margin-right: 1rem;
  font-weight: bold;
}

.hex-data {
  color: var(--text-primary);
}

.hex-byte {
  margin-right: 0.5rem;
  transition: color 0.3s ease;
}

.hex-byte:hover {
  color: var(--accent-cyan);
}

/* CAPTCHA Styles */
.captcha-container {
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid var(--accent-purple);
  border-radius: 8px;
  padding: 1.5rem;
}

.captcha-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 1rem 0;
}

.captcha-square {
  aspect-ratio: 1;
  border: 2px solid var(--accent-purple);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
}

.captcha-square:hover {
  border-color: var(--accent-cyan);
  transform: scale(1.05);
}

.captcha-square img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.text-link {
  color: var(--accent-cyan);
  text-decoration: none;
  cursor: pointer;
}

.text-link:hover {
  text-decoration: underline;
}

.alternative-form {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

/* Code Editor */
.code-editor-container {
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid var(--accent-orange);
  border-radius: 8px;
  padding: 1.5rem;
}

.code-editor-content {
  background: #1e1e1e;
  border: 1px solid var(--accent-orange);
  border-radius: 4px;
  padding: 1rem;
  font-family: "Courier New", monospace;
  color: #d4d4d4;
  margin-bottom: 1rem;
  white-space: pre;
  overflow-x: auto;
}

.optimization-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.option-preview {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  padding: 1rem;
}

.option-preview h5 {
  color: var(--accent-cyan);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.dark-preview {
  color: var(--accent-red);
  font-size: 0.8rem;
}

.good-preview {
  color: var(--accent-toxic);
  font-size: 0.8rem;
}

/* Popup Hell */
.popup-hell {
  position: relative;
  height: 500px;
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid var(--accent-red);
  border-radius: 8px;
  overflow: hidden;
}

.popup-overlay {
  position: relative;
  width: 100%;
  height: 100%;
}

.popup-window {
  position: absolute;
  width: 250px;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid var(--accent-red);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  animation: popupFloat 0.5s ease-out;
}

.popup-header {
  background: var(--accent-red);
  color: white;
  padding: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.popup-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.2rem;
}

.popup-content {
  padding: 1rem;
  color: #333;
  font-weight: bold;
}

.calm-button {
  background: var(--accent-blue);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

@keyframes popupFloat {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes popupClose {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.8);
  }
}

/* Ending Stats */
.ending-stats {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 1rem;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.ending-stats p {
  margin: 0.5rem 0;
}

/* Ending Screen Styles */
.ending-active .cinematic-screen {
  animation: screenGlitch 2s ease-in-out infinite alternate;
}

@keyframes screenGlitch {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-2px);
  }
}

.ending-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.ending-header h1 {
  font-size: 3rem;
  margin-bottom: 2rem;
  text-shadow: 0 0 20px currentColor;
  animation: textGlow 2s ease-in-out infinite alternate;
}

@keyframes textGlow {
  0% {
    text-shadow: 0 0 20px currentColor;
  }
  100% {
    text-shadow: 0 0 30px currentColor, 0 0 40px currentColor;
  }
}

.ending-content {
  max-width: 800px;
  line-height: 1.6;
}

.ending-text {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  opacity: 0.9;
}

.corpus-message {
  margin: 2rem 0;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  border: 1px solid currentColor;
}

.beauty-prison {
  margin: 2rem 0;
  opacity: 0.8;
}

.repeating-pattern {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  animation: patternShift 3s ease-in-out infinite;
}

@keyframes patternShift {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }
  50% {
    transform: scale(1.05) rotate(2deg);
  }
}

.beauty-element {
  font-size: 2rem;
  animation: elementPulse 2s ease-in-out infinite;
}

@keyframes elementPulse {
  0%,
  100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

.system-crash {
  margin: 2rem 0;
  height: 200px;
  overflow: hidden;
  background: rgba(255, 0, 0, 0.1);
  border: 1px solid #ff0000;
  position: relative;
}

.error-flood {
  animation: errorScroll 10s linear infinite;
}

@keyframes errorScroll {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-100%);
  }
}

.error-line {
  padding: 5px;
  font-family: monospace;
  color: #ff4444;
  animation: errorFlash 1s ease-in-out infinite;
}

@keyframes errorFlash {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

.connection-terminated {
  margin-top: 2rem;
  padding: 1rem;
  border: 2px solid #ff0000;
  background: rgba(255, 0, 0, 0.2);
  animation: terminatePulse 2s ease-in-out infinite;
}

@keyframes terminatePulse {
  0%,
  100% {
    box-shadow: 0 0 20px #ff0000;
  }
  50% {
    box-shadow: 0 0 40px #ff0000, 0 0 60px #ff0000;
  }
}

.corpus-analysis {
  margin: 2rem 0;
}

.analysis-line {
  margin: 1rem 0;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  border-left: 3px solid currentColor;
  text-align: left;
  min-height: 1.5rem;
}

.exit-option {
  margin-top: 3rem;
}

.exit-btn {
  background: currentColor;
  color: var(--bg-primary);
  border: none;
  padding: 1rem 2rem;
  font-size: 1.2rem;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.exit-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 20px currentColor;
}

/* Chaos Toolkit Elements */
.chaos-element {
  pointer-events: none;
  z-index: 1;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.chaos-element.chaos-cube {
  border-radius: 2px;
  transform: rotate(45deg);
}

.chaos-element.chaos-line {
  border-radius: 0;
  width: 2px !important;
  height: 30px !important;
  transform: rotate(0deg);
}

.chaos-element.chaos-triangle {
  border-radius: 0;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.chaos-element.chaos-hexagon {
  border-radius: 0;
  clip-path: polygon(30% 0%, 70% 0%, 100% 50%, 70% 100%, 30% 100%, 0% 50%);
}

/* Chaos Animations */
.chaos-element.chaos-spin {
  animation: chaos-spin 4s linear infinite;
}

.chaos-element.chaos-pulse {
  animation: chaos-pulse 2s ease-in-out infinite;
}

.chaos-element.chaos-glitch {
  animation: chaos-glitch 0.3s ease-in-out infinite;
}

.chaos-element.chaos-drift {
  animation: chaos-drift 6s ease-in-out infinite;
}

.chaos-element.chaos-flicker {
  animation: chaos-flicker 1s ease-in-out infinite;
}

.chaos-element.chaos-corrupt {
  animation: chaos-corrupt 2s ease-in-out infinite;
}

@keyframes chaos-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes chaos-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.4;
  }
}

@keyframes chaos-glitch {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-2px) translateY(2px);
  }
  40% {
    transform: translateX(-2px) translateY(-2px);
  }
  60% {
    transform: translateX(2px) translateY(2px);
  }
  80% {
    transform: translateX(2px) translateY(-2px);
  }
}

@keyframes chaos-drift {
  0% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(10px, -5px);
  }
  50% {
    transform: translate(-5px, 10px);
  }
  75% {
    transform: translate(-10px, -5px);
  }
  100% {
    transform: translate(0, 0);
  }
}

@keyframes chaos-flicker {
  0%,
  100% {
    opacity: 0.8;
  }
  50% {
    opacity: 0.2;
  }
}

@keyframes chaos-corrupt {
  0%,
  100% {
    filter: hue-rotate(0deg) contrast(1);
    transform: scale(1);
  }
  25% {
    filter: hue-rotate(90deg) contrast(1.5);
    transform: scale(0.95);
  }
  50% {
    filter: hue-rotate(180deg) contrast(0.8);
    transform: scale(1.05);
  }
  75% {
    filter: hue-rotate(270deg) contrast(1.2);
    transform: scale(0.98);
  }
}

/* --- FINAL FIX FOR CINEMATIC REVEAL --- */

/* The task container itself starts invisible and is animated by JS */
.task-container {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

/* When the .visible class is added, it becomes visible */
.task-container.visible {
  opacity: 1;
  transform: translateY(0);
}

/* The children of the container are ALSO initially invisible and transition in */
.task-container .task-header,
.task-container .task-content,
.task-container .task-choices {
  opacity: 0;
  transition: opacity 0.8s ease 0.3s, transform 0.8s ease 0.3s; /* 0.3s delay allows container to appear first */
}

.task-container .task-header {
  transform: translateY(-15px);
}

.task-container .task-content {
  transform: translateY(15px);
}

.task-container .task-choices {
  transform: translateY(25px);
}

/* When the parent .task-container becomes visible, the children animate in */
.task-container.visible .task-header,
.task-container.visible .task-content,
.task-container.visible .task-choices {
  opacity: 1;
  transform: translateY(0);
}

/* Minor fix for result message in overlay */
.result-message {
  margin-top: 1rem;
  font-size: 1rem;
  color: var(--text-secondary);
  font-style: italic;
  opacity: 0.8;
}
