:root {
  --bg-primary: #0a0a12;
  --bg-panel: rgba(10, 15, 30, 0.85);
  --cyan: #00f0ff;
  --red: #ff2244;
  --violet: #8b00ff;
  --gold: #ffd700;
  --green: #00ff88;
  --magenta: #ff00ff;
  --text-body: #c0f0ff;
  --text-dim: #4a5568;
  --border-cyan: rgba(0, 240, 255, 0.3);
  --border-red: rgba(255, 34, 68, 0.3);
}

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

body {
  background: var(--bg-primary);
  color: var(--text-body);
  font-family: 'JetBrains Mono', monospace;
  overflow-x: hidden;
  cursor: crosshair;
  min-height: 100vh;
}

/* CRT Scanline Overlay */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 240, 255, 0.015) 2px,
    rgba(0, 240, 255, 0.015) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* Screen Flicker */
@keyframes screenFlicker {
  0%, 95%, 100% { opacity: 1; }
  96% { opacity: 0.85; }
  97% { opacity: 0.95; }
  98% { opacity: 0.8; }
}

#root {
  animation: screenFlicker 12s infinite;
}

/* Glitch Text */
@keyframes glitch1 {
  0%, 90%, 100% { transform: translate(0); }
  91% { transform: translate(-2px, 1px); filter: hue-rotate(90deg); }
  92% { transform: translate(2px, -1px); }
  93% { transform: translate(-1px, -1px); filter: hue-rotate(0deg); }
}

@keyframes glitch2 {
  0%, 85%, 100% { clip-path: inset(0 0 0 0); }
  86% { clip-path: inset(20% 0 60% 0); transform: translate(3px); }
  87% { clip-path: inset(60% 0 10% 0); transform: translate(-3px); }
  88% { clip-path: inset(40% 0 30% 0); transform: translate(2px); }
}

.glitch-text {
  animation: glitch1 8s infinite;
  position: relative;
}

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

.glitch-text::before {
  color: var(--cyan);
  animation: glitch2 6s infinite;
  opacity: 0.5;
}

.glitch-text::after {
  color: var(--red);
  animation: glitch2 8s infinite reverse;
  opacity: 0.3;
}

/* Glow Effects */
.glow-cyan { text-shadow: 0 0 10px rgba(0, 240, 255, 0.5), 0 0 20px rgba(0, 240, 255, 0.3); }
.glow-red { text-shadow: 0 0 10px rgba(255, 34, 68, 0.5), 0 0 20px rgba(255, 34, 68, 0.3); }
.glow-gold { text-shadow: 0 0 10px rgba(255, 215, 0, 0.5), 0 0 20px rgba(255, 215, 0, 0.3); }
.glow-violet { text-shadow: 0 0 10px rgba(139, 0, 255, 0.5), 0 0 20px rgba(139, 0, 255, 0.3); }

.border-glow-cyan {
  border: 1px solid var(--border-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.1), inset 0 0 10px rgba(0, 240, 255, 0.05);
}

.border-glow-red {
  border: 1px solid var(--border-red);
  box-shadow: 0 0 10px rgba(255, 34, 68, 0.1), inset 0 0 10px rgba(255, 34, 68, 0.05);
}

/* Pulse Animation */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(0, 240, 255, 0.2); }
  50% { box-shadow: 0 0 20px rgba(0, 240, 255, 0.4), 0 0 40px rgba(0, 240, 255, 0.1); }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.pulse-dot {
  animation: pulse-dot 1.5s ease-in-out infinite;
}

/* Grid Background */
@keyframes gridScroll {
  0% { transform: translateY(0); }
  100% { transform: translateY(40px); }
}

.grid-bg::before {
  content: '';
  position: fixed;
  top: -40px; left: 0; right: 0; bottom: 0;
  background-image: 
    linear-gradient(rgba(0, 240, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: gridScroll 8s linear infinite;
  pointer-events: none;
  z-index: -1;
}

/* Boot Sequence */
@keyframes bootFade {
  0% { opacity: 1; }
  100% { opacity: 0; pointer-events: none; }
}

@keyframes typewriter {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink-caret {
  0%, 100% { border-color: var(--cyan); }
  50% { border-color: transparent; }
}

.boot-line {
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--cyan);
  animation: blink-caret 0.75s step-end infinite;
  width: fit-content;
  max-width: 100%;
}

/* Tab Underline */
@keyframes tabGlow {
  0%, 100% { box-shadow: 0 2px 0 var(--cyan), 0 4px 10px rgba(0, 240, 255, 0.3); }
  50% { box-shadow: 0 2px 0 var(--cyan), 0 4px 20px rgba(0, 240, 255, 0.5); }
}

/* Status Bar Gradient */
@keyframes statusGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.status-gradient-border {
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--red), var(--cyan));
  background-size: 300% 100%;
  animation: statusGradient 6s ease infinite;
  height: 2px;
}

/* Decryption Animation */
@keyframes decrypt {
  0% { filter: blur(4px) brightness(2); transform: scale(1.02); }
  50% { filter: blur(2px) brightness(1.5); }
  100% { filter: blur(0) brightness(1); transform: scale(1); }
}

.decrypting {
  animation: decrypt 2s ease-out;
}

/* Static Noise for Encrypted Cards */
@keyframes noise {
  0%, 100% { background-position: 0 0; }
  10% { background-position: -5% -10%; }
  20% { background-position: -15% 5%; }
  30% { background-position: 7% -25%; }
  40% { background-position: 20% 25%; }
  50% { background-position: -25% 10%; }
  60% { background-position: 15% 5%; }
  70% { background-position: 0% 15%; }
  80% { background-position: 25% 35%; }
  90% { background-position: -10% 10%; }
}

/* Hallucination Effect */
@keyframes hallucinate {
  0% { filter: hue-rotate(0deg); }
  25% { filter: hue-rotate(90deg) saturate(2); }
  50% { filter: hue-rotate(180deg) contrast(1.5); }
  75% { filter: hue-rotate(270deg) saturate(2); }
  100% { filter: hue-rotate(360deg); }
}

.hallucinating {
  animation: hallucinate 0.5s ease;
}

/* Vignette for High Trauma */
.trauma-vignette::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  box-shadow: inset 0 0 150px rgba(255, 0, 0, 0.3);
  pointer-events: none;
  z-index: 9998;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(10, 10, 18, 0.5); }
::-webkit-scrollbar-thumb { background: rgba(0, 240, 255, 0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 240, 255, 0.5); }

/* Rotating Icon */
@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spin-slow {
  animation: spin-slow 10s linear infinite;
}

/* Panel Transition */
@keyframes panelEnter {
  0% { opacity: 0; transform: translateY(10px); filter: blur(2px); }
  100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.panel-enter {
  animation: panelEnter 0.4s ease-out;
}

/* Full screen glitch event */
@keyframes fullGlitch {
  0% { transform: translate(0); filter: none; }
  10% { transform: translate(-5px, 3px); filter: hue-rotate(90deg); }
  20% { transform: translate(5px, -3px); filter: hue-rotate(180deg) saturate(3); }
  30% { transform: translate(-3px, -5px); filter: hue-rotate(270deg); }
  40% { transform: translate(3px, 5px); filter: invert(1); }
  50% { transform: translate(-5px, -3px); filter: hue-rotate(90deg) contrast(2); }
  60% { transform: translate(5px, 3px); filter: hue-rotate(180deg); }
  70% { transform: translate(-3px, 5px); filter: saturate(3); }
  80% { transform: translate(3px, -5px); filter: hue-rotate(270deg) invert(0.5); }
  90% { transform: translate(-5px, 3px); filter: hue-rotate(360deg); }
  100% { transform: translate(0); filter: none; }
}

.full-glitch {
  animation: fullGlitch 0.8s ease;
}

/* Responsive */
@media (max-width: 768px) {
  body::after {
    background: repeating-linear-gradient(
      0deg,
      transparent,
      transparent 3px,
      rgba(0, 240, 255, 0.01) 3px,
      rgba(0, 240, 255, 0.01) 6px
    );
  }
  .grid-bg::before {
    display: none;
  }
}

/* Tooltip */
.tooltip-container {
  position: relative;
}

/* Canvas hover styles */
canvas { cursor: crosshair; }

/* Input Styles */
input, textarea, select {
  font-family: 'JetBrains Mono', monospace;
  cursor: crosshair;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
  border-color: var(--cyan) !important;
}

/* WHO AM I easter egg overlay */
@keyframes easterEggFlash {
  0% { opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { opacity: 0; }
}