:root {
  --bg-primary: #06060f;
  --bg-secondary: #0c0c1d;
  --bg-card: #10102a;
  --purple: #a855f7;
  --cyan: #06b6d4;
  --pink: #ec4899;
  --green: #10b981;
  --text: #e2e8f0;
  --text-dim: #64748b;
  --border: #1e1e3a;
}

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

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

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(168, 85, 247, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(6, 182, 212, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(236, 72, 153, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

#root { position: relative; z-index: 1; }

@keyframes glow-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

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

@keyframes border-glow {
  0%, 100% { border-color: var(--purple); box-shadow: 0 0 10px rgba(168,85,247,0.3); }
  50% { border-color: var(--cyan); box-shadow: 0 0 10px rgba(6,182,212,0.3); }
}

@keyframes node-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

@keyframes flow-right {
  0% { transform: translateX(-8px); opacity: 0; }
  50% { opacity: 1; }
  100% { transform: translateX(8px); opacity: 0; }
}

.header-border {
  animation: border-glow 3s ease-in-out infinite;
  border-bottom: 2px solid var(--purple);
}

.glow-text-purple {
  text-shadow: 0 0 20px rgba(168,85,247,0.5), 0 0 40px rgba(168,85,247,0.2);
}

.glow-text-cyan {
  text-shadow: 0 0 20px rgba(6,182,212,0.5), 0 0 40px rgba(6,182,212,0.2);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  transition: border-color 0.3s;
}

.card:hover {
  border-color: rgba(168,85,247,0.3);
}

.drop-zone {
  border: 2px dashed rgba(168,85,247,0.4);
  border-radius: 12px;
  transition: all 0.3s;
  cursor: pointer;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--cyan);
  background: rgba(6,182,212,0.05);
  box-shadow: 0 0 20px rgba(6,182,212,0.1);
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple), #7c3aed);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(168,85,247,0.4);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: transparent;
  color: var(--cyan);
  border: 1px solid rgba(6,182,212,0.4);
  padding: 8px 16px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
}

.btn-secondary:hover {
  background: rgba(6,182,212,0.1);
  border-color: var(--cyan);
}

.btn-danger {
  background: transparent;
  color: var(--pink);
  border: 1px solid rgba(236,72,153,0.4);
  padding: 8px 16px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
}

.btn-danger:hover {
  background: rgba(236,72,153,0.1);
}

.slider-container input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--purple);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(168,85,247,0.5);
}

.log-area {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.6;
  overflow-y: auto;
  max-height: 200px;
  padding: 12px;
}

.log-area::-webkit-scrollbar { width: 6px; }
.log-area::-webkit-scrollbar-track { background: transparent; }
.log-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.pixel-canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.training-active .node-g {
  animation: node-pulse 0.5s ease-in-out infinite;
}

.training-active .node-d {
  animation: node-pulse 0.5s ease-in-out infinite 0.25s;
}

.training-active .flow-particle {
  animation: flow-right 0.8s linear infinite;
}

.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 99;
  max-width: 280px;
  white-space: normal;
}

.tooltip:hover::after { opacity: 1; }

.info-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.info-panel.open {
  max-height: 600px;
}

@media (max-width: 768px) {
  .main-grid {
    grid-template-columns: 1fr !important;
  }
}