/* 🎯 MATRIX EXPERIENCE - UNIFIED DESIGN SYSTEM */

:root {
  /* === FARB-PALETTE === */
  --matrix-green: #00ff00;  /* Echtes Matrix Grün */
  --ai-cyan: #00faff;
  --pa-gold: #ffc300;
  --neural-bg: #000000;
  --system-light: #f5f5dc;
  --system-white: #ffffff;

  /* === TRANSPARENZEN === */
  --alpha-light: 0.7;
  --alpha-medium: 0.5;
  --alpha-heavy: 0.3;

  /* === TYPOGRAPHY SCALE === */
  --font-nav-help: 10px;      /* Navigation Help */
  --font-part-title: 16px;    /* Part Title */
  --font-progress: 14px;      /* Progress Indicator */
  --font-cursor: 18px;        /* Cursor Blink */
  --font-body: 24px;          /* HAUPTTEXT - EINHEITLICH */
  --font-title: 28px;         /* Überschriften */
  --font-hero: 32px;          /* Hervorgehobene Texte */

  /* === STANDARDISIERTE TIMINGS === */
  --timing-typewriter: 120ms;    /* Typewriter-Effekt */
  --timing-blink: 500ms;         /* Cursor Blink */
  --timing-pause-short: 600ms;   /* Kurze Pausen */
  --timing-pause-medium: 1000ms; /* Mittlere Pausen */
  --timing-pause-long: 1500ms;   /* Lange Pausen */

  /* === TRANSITIONS === */
  --transition-standard: 0.5s ease;
  --transition-fast: 0.3s ease;
  --transition-slow: 1s ease;

  /* === LAYOUT === */
  --spacing-small: 10px;
  --spacing-medium: 20px;
  --spacing-large: 40px;

  /* === Z-INDEX SYSTEM === */
  --z-background: 1;
  --z-effects: 50;
  --z-navigation: 1001;
  --z-overlay: 1000;
  --z-modal: 2000;
}

/* === STANDARDISIERTE KLASSEN === */

/* Navigation Elements */
.nav-progress {
  position: fixed;
  top: 20px;
  right: 20px;
  color: currentColor;
  font-size: var(--font-progress);
  font-family: 'Courier New', monospace;
  z-index: var(--z-navigation);
  text-shadow: 0 0 10px currentColor;
  user-select: none;
}

.nav-part-title {
  position: fixed;
  bottom: 20px;
  left: 20px;
  color: currentColor;
  font-size: var(--font-part-title);
  font-family: 'Courier New', monospace;
  z-index: var(--z-navigation);
  text-shadow: 0 0 8px currentColor;
  user-select: none;
  opacity: var(--alpha-light);
}

.nav-help {
  position: fixed;
  bottom: 20px;
  right: 20px;
  color: currentColor;
  font-size: var(--font-nav-help);
  font-family: 'Courier New', monospace;
  z-index: var(--z-navigation);
  text-shadow: 0 0 5px currentColor;
  user-select: none;
  opacity: var(--alpha-medium);
}

/* Story Text Elements */
.story-text {
  font-size: var(--font-body);
  font-weight: bold;
  text-shadow: 0 0 20px currentColor;
  line-height: 1.6;
  transition: var(--transition-standard);
}

.story-title {
  font-size: var(--font-title);
  font-weight: bold;
  text-shadow: 0 0 25px currentColor;
}

.story-hero {
  font-size: var(--font-hero);
  font-weight: bold;
  text-shadow: 0 0 30px currentColor;
}

/* Cursor Elements */
.cursor-block {
  font-size: var(--font-body);
  margin-left: 3px;
  color: currentColor;
  font-weight: bold;
  text-shadow: 0 0 20px currentColor;
}

.cursor-blink {
  animation: unified-blink calc(var(--timing-blink) * 2) infinite;
  font-size: var(--font-cursor);
}

/* Central Display */
.central-display {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: var(--z-overlay);
  color: currentColor;
  font-size: var(--font-body);
  font-weight: bold;
  text-align: center;
  opacity: 0;
  transition: var(--transition-standard);
  user-select: none;
  text-shadow: 0 0 20px currentColor;
  max-width: 80%;
  line-height: 1.4;
}

.central-display.show {
  opacity: 1;
}

.central-display.clickable {
  animation: central-glow 3s ease-in-out infinite;
  cursor: pointer;
}

/* Input Elements */
.unified-input {
  background: transparent;
  border: none;
  color: currentColor;
  font-family: 'Courier New', monospace;
  font-size: var(--font-body);
  font-weight: bold;
  outline: none;
  text-shadow: 0 0 20px currentColor;
}

/* Canvas */
.matrix-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-background);
  opacity: 0;
  transition: opacity var(--transition-slow);
}

.matrix-canvas.show {
  opacity: 1;
}

/* RealityBend-Variablen entfernt */

/* === STANDARDISIERTE ANIMATIONEN === */

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

@keyframes central-glow {
  0%, 100% { text-shadow: 0 0 20px currentColor; }
  50% { text-shadow: 0 0 40px currentColor, 0 0 60px currentColor; }
}

@keyframes reality-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.2); }
}

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

@keyframes intense-pulsing {
  0%, 100% {
    text-shadow: 0 0 20px currentColor;
    transform: scale(1);
  }
  50% {
    text-shadow: 0 0 40px currentColor, 0 0 60px currentColor, 0 0 80px currentColor;
    transform: scale(1.1);
  }
}

/* === UNIFIED GLITCH EFFECTS === */
.text-glitch {
  animation: textGlitch 0.3s ease-in-out;
}

@keyframes textGlitch {
  0% { opacity: 1; filter: brightness(1); }
  20% { opacity: 0.9; filter: brightness(1.2); }
  40% { opacity: 0.8; filter: brightness(0.8); }
  60% { opacity: 0.95; filter: brightness(1.1); }
  80% { opacity: 0.85; filter: brightness(0.9); }
  100% { opacity: 1; filter: brightness(1); }
}

.rgb-glitch {
  animation: rgbGlitch 0.4s ease-in-out;
}

@keyframes rgbGlitch {
  0% { transform: translate(0); filter: hue-rotate(0deg); }
  25% { transform: translate(2px, 0); filter: hue-rotate(90deg); }
  50% { transform: translate(-2px, 0); filter: hue-rotate(180deg); }
  75% { transform: translate(0, 2px); filter: hue-rotate(270deg); }
  100% { transform: translate(0); filter: hue-rotate(360deg); }
}

.flicker-glitch {
  animation: flickerGlitch 0.5s ease-in-out;
}

@keyframes flickerGlitch {
  0%, 100% { opacity: 1; }
  10% { opacity: 0.1; }
  20% { opacity: 1; }
  30% { opacity: 0.3; }
  40% { opacity: 1; }
  50% { opacity: 0.7; }
  60% { opacity: 1; }
  70% { opacity: 0.2; }
  80% { opacity: 1; }
  90% { opacity: 0.5; }
}

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

@keyframes matrixGlitch {
  0% {
    color: var(--ai-cyan);
    text-shadow: 0 0 20px var(--ai-cyan);
  }
  25% {
    color: var(--ai-cyan);
    text-shadow: 0 0 20px var(--ai-cyan);
  }
  50% {
    color: var(--pa-gold);
    text-shadow: 0 0 20px var(--pa-gold);
  }
  75% {
    color: var(--ai-cyan);
    text-shadow: 0 0 20px var(--ai-cyan);
  }
  100% {
    color: var(--ai-cyan);
    text-shadow: 0 0 20px var(--ai-cyan);
  }
}

.digital-noise {
  animation: digitalNoise 0.6s ease-in-out;
}

@keyframes digitalNoise {
  0% { filter: contrast(1) brightness(1); }
  10% { filter: contrast(1.5) brightness(0.8) saturate(1.2); }
  20% { filter: contrast(0.8) brightness(1.2) saturate(0.8); }
  30% { filter: contrast(1.2) brightness(0.9) saturate(1.1); }
  40% { filter: contrast(0.9) brightness(1.1) saturate(0.9); }
  50% { filter: contrast(1.3) brightness(0.7) saturate(1.3); }
  60% { filter: contrast(0.7) brightness(1.3) saturate(0.7); }
  70% { filter: contrast(1.1) brightness(0.95) saturate(1.05); }
  80% { filter: contrast(0.95) brightness(1.05) saturate(0.95); }
  90% { filter: contrast(1.05) brightness(0.98) saturate(1.02); }
  100% { filter: contrast(1) brightness(1) saturate(1); }
}

/* Dramatic Fade-Out für spezielle Übergänge */
@keyframes dramatic-fade-out {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotateX(0deg);
    filter: blur(0px);
  }
  25% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1.1) rotateX(15deg);
    filter: blur(2px);
  }
  50% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(1.3) rotateX(45deg);
    filter: blur(8px);
  }
  75% {
    opacity: 0.2;
    transform: translate(-50%, -50%) scale(1.6) rotateX(75deg);
    filter: blur(15px);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(2) rotateX(90deg);
    filter: blur(25px);
  }
}

/* === TRANSITION TEXT SYSTEM === */
.transition-text {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: var(--z-overlay);
  color: currentColor;
  font-size: var(--font-body);
  font-weight: bold;
  text-align: center;
  opacity: 0;
  transition: var(--transition-standard);
  user-select: none;
  text-shadow: 0 0 20px currentColor;
  max-width: 80%;
  line-height: 1.4;
  white-space: nowrap;
}

.transition-text.show {
  opacity: 1;
}

.transition-container {
  display: inline-block;
  position: relative;
}

.transition-dots {
  display: inline-block;
  width: 30px;
  text-align: left;
}

/* === PART-SPEZIFISCHE FARB-OVERRIDES === */

/* Matrix Part */
.matrix-theme {
  color: var(--ai-cyan);
}

/* RealityBend-Theme entfernt */

/* AI Part */
.ai-theme {
  color: var(--ai-cyan);
}

/* RealityBend-Theme entfernt */

/* PromptArchitekt Part */
.pa-theme {
  color: var(--pa-gold);
}

/* RealityBend-Theme entfernt */

/* === RESPONSIVE ANPASSUNGEN === */

@media (max-width: 768px) {
  :root {
    --font-body: 20px;
    --font-title: 24px;
    --font-hero: 28px;
  }

  .central-display {
    max-width: 90%;
    font-size: calc(var(--font-body) * 0.9);
  }

  /* 🎯 MOBILE TOUCH OPTIMIZATION - GLOBAL */
  /* Alle interaktiven Elemente touch-freundlich machen */
  button,
  [role="button"],
  .clickable,
  .ai-button,
  .game-choice-btn,
  .cta,
  [data-choice] {
    min-height: 44px !important; /* Touch-Minimum */
    min-width: 44px !important;
    padding: 12px 16px !important;
    margin: 8px !important;
    border-radius: 8px !important;
    background: rgba(0, 0, 0, 0.8) !important;
    border: 2px solid currentColor !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    line-height: 1.2 !important;
  }

  /* Zentrale Bereiche scrollbar machen */
  .central-update,
  .ai-story,
  .installation-display,
  .matrix-homage,
  .central,
  .central-display {
    max-height: 80vh !important;
    overflow-y: auto !important;
    padding: 20px !important;
    margin: 10px !important;
  }

  /* Navigation-Elemente kompakter */
  #progress-indicator,
  #part-title,
  #navigation-help {
    font-size: 10px !important;
    padding: 5px !important;
    margin: 5px !important;
  }

  #progress-indicator {
    top: 10px !important;
    right: 10px !important;
  }

  #part-title {
    bottom: 10px !important;
    left: 10px !important;
  }

  #navigation-help {
    bottom: 10px !important;
    right: 10px !important;
  }
}

@media (max-width: 480px) {
  :root {
    --font-body: 18px;
    --font-title: 22px;
    --font-hero: 24px;
  }

  .central-update,
  .ai-story,
  .installation-display,
  .matrix-homage,
  .central {
    white-space: normal !important;
    line-height: 1.4 !important;
    max-height: 75vh !important;
    padding: 15px !important;
  }

  #matrixCanvas {
    pointer-events: none;
  }

  /* 🎯 EXTREME MOBILE TOUCH OPTIMIZATION */
  button,
  [role="button"],
  .clickable,
  .ai-button,
  .game-choice-btn,
  .cta,
  [data-choice] {
    min-height: 40px !important;
    min-width: 40px !important;
    padding: 10px 14px !important;
    margin: 6px !important;
    font-size: var(--font-progress) !important;
  }

  /* Zentrale Bereiche noch kompakter */
  .central-update,
  .ai-story,
  .installation-display,
  .matrix-homage,
  .central,
  .central-display {
    max-height: 70vh !important;
    padding: 12px !important;
    margin: 8px !important;
  }

  /* Navigation noch kompakter */
  #progress-indicator,
  #part-title,
  #navigation-help {
    font-size: 9px !important;
    padding: 3px !important;
    margin: 3px !important;
  }
}

/* 🎯 TOUCH DEVICE OPTIMIZATION */
@media (hover: none) and (pointer: coarse) {
  /* Touch-spezifische Optimierungen */
  button,
  [role="button"],
  .clickable,
  .ai-button,
  .game-choice-btn,
  .cta,
  [data-choice] {
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: rgba(0, 255, 65, 0.3) !important;
    transition: all 0.2s ease !important;
  }

  button:active,
  [role="button"]:active,
  .clickable:active,
  .ai-button:active,
  .game-choice-btn:active,
  .cta:active,
  [data-choice]:active {
    transform: scale(0.95) !important;
    background: rgba(0, 255, 65, 0.2) !important;
  }

  /* Scroll-Verbesserungen für Touch */
  .central-update,
  .ai-story,
  .installation-display,
  .matrix-homage,
  .central,
  .central-display {
    -webkit-overflow-scrolling: touch !important;
    scroll-behavior: smooth !important;
  }
}
