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

:root {
  --bg-deep: #0a0a1a;
  --bg-card: rgba(16, 16, 40, 0.7);
  --border-glow: rgba(0, 200, 255, 0.15);
  --accent-cyan: #00d4ff;
  --accent-magenta: #ff2d8a;
  --accent-purple: #8b5cf6;
  --accent-green: #00ff88;
  --text-primary: #e8eaed;
  --text-secondary: #8892a4;
  --text-dim: #4a5568;
}

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: 'Bricolage Grotesque', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

#bg-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

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

.font-mono { font-family: 'JetBrains Mono', monospace; }
.font-display { font-family: 'Bricolage Grotesque', sans-serif; }

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glow);
  border-radius: 16px;
}

.glow-cyan { box-shadow: 0 0 20px rgba(0, 212, 255, 0.15), inset 0 0 20px rgba(0, 212, 255, 0.05); }
.glow-magenta { box-shadow: 0 0 20px rgba(255, 45, 138, 0.15), inset 0 0 20px rgba(255, 45, 138, 0.05); }
.glow-green { box-shadow: 0 0 20px rgba(0, 255, 136, 0.15), inset 0 0 20px rgba(0, 255, 136, 0.05); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: white;
  border: none;
  border-radius: 12px;
  padding: 12px 28px;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 212, 255, 0.3);
}

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

.btn-danger {
  background: linear-gradient(135deg, var(--accent-magenta), #ff6b35);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 10px 20px;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-secondary {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 10px 20px;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--accent-cyan);
}

.drop-zone {
  border: 2px dashed rgba(0, 212, 255, 0.3);
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  transition: all 0.3s;
  cursor: pointer;
  position: relative;
}

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

.drop-zone.drag-over {
  animation: pulse-border 1s infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: rgba(0, 212, 255, 0.3); }
  50% { border-color: rgba(0, 212, 255, 0.8); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(0, 212, 255, 0.2); }
  50% { box-shadow: 0 0 40px rgba(0, 212, 255, 0.5), 0 0 60px rgba(139, 92, 246, 0.2); }
}

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

@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fade-in 0.5s ease-out forwards; }

.slider-container input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
  outline: none;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 6px;
}

.thumbnail-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
}

.generated-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.generated-grid canvas {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  image-rendering: pixelated;
  background: #111;
}

.loss-chart-container {
  position: relative;
  width: 100%;
  height: 180px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0,0,0,0.3);
}

.loss-chart-container canvas {
  width: 100%;
  height: 100%;
}

.tooltip-trigger {
  position: relative;
  display: inline-block;
  cursor: help;
  color: var(--accent-cyan);
  font-size: 12px;
  margin-left: 6px;
}

.network-viz {
  width: 100%;
  height: 160px;
}

.network-viz canvas {
  width: 100%;
  height: 100%;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.badge-warning {
  background: rgba(255, 200, 0, 0.1);
  color: #ffc800;
  border: 1px solid rgba(255, 200, 0, 0.2);
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-green));
  transition: width 0.3s;
}

.mood-text {
  font-style: italic;
  color: var(--accent-magenta);
  font-size: 13px;
}

.latent-explorer {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  cursor: crosshair;
  background: #0a0a1a;
  border: 1px solid var(--border-glow);
}

.sample-btn {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  transition: all 0.2s;
}

.sample-btn:hover {
  background: rgba(0, 212, 255, 0.1);
  border-color: var(--accent-cyan);
}

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

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }