:root {
  --bg-deep: #0d0d1a;
  --bg-card: rgba(22, 22, 42, 0.7);
  --bg-card-hover: rgba(30, 30, 55, 0.85);
  --purple: #7c3aed;
  --cyan: #06b6d4;
  --lime: #84cc16;
  --amber: #f59e0b;
  --red: #ef4444;
  --thinking-blue: #3b82f6;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --border: rgba(124, 58, 237, 0.2);
  --terminal-bg: #0d1117;
}

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

body {
  background: var(--bg-deep);
  color: var(--text);
  font-family: 'IBM Plex Sans', sans-serif;
  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% 0%, rgba(124,58,237,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(6,182,212,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 50%, rgba(59,130,246,0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

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

.font-mono { font-family: 'JetBrains Mono', monospace; }

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

.gradient-text {
  background: linear-gradient(135deg, var(--purple), var(--cyan), var(--lime));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.drop-zone {
  border: 2px dashed rgba(124, 58, 237, 0.4);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.drop-zone::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 2px dashed transparent;
  background: linear-gradient(135deg, var(--purple), var(--cyan)) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.drop-zone:hover::before,
.drop-zone.drag-over::before { opacity: 1; }

.drop-zone:hover, .drop-zone.drag-over {
  border-color: transparent;
  background: rgba(124, 58, 237, 0.05);
}

.btn-glow {
  position: relative;
  overflow: hidden;
}

.btn-glow::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--purple), var(--cyan), var(--lime), var(--purple));
  background-size: 300% 300%;
  animation: shimmer 3s ease infinite;
  z-index: -1;
  opacity: 0.8;
}

@keyframes shimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

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

.brain-pulse { animation: pulse-brain 0.8s ease infinite; display: inline-block; }

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

.animate-in { animation: float-in 0.4s ease forwards; }

@keyframes confetti-fall {
  0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  top: 0;
  z-index: 9999;
  pointer-events: none;
  animation: confetti-fall 3s ease-out forwards;
}

@keyframes thinking-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(59,130,246,0.2), 0 0 16px rgba(59,130,246,0.1); }
  50% { box-shadow: 0 0 16px rgba(59,130,246,0.4), 0 0 32px rgba(59,130,246,0.2); }
}

.thinking-glow { animation: thinking-glow 1.5s ease infinite; }

@keyframes thought-bubble {
  0% { opacity: 0; transform: translateY(0) scale(0.5); }
  50% { opacity: 1; transform: translateY(-20px) scale(1); }
  100% { opacity: 0; transform: translateY(-40px) scale(0.8); }
}

.thought-bubble {
  animation: thought-bubble 2s ease infinite;
  position: absolute;
  pointer-events: none;
}

@keyframes typewriter-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.terminal-panel {
  background: var(--terminal-bg);
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  overflow: hidden;
  position: relative;
}

.terminal-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(59,130,246,0.015) 0px,
    rgba(59,130,246,0.015) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 1;
}

.terminal-step {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(59,130,246,0.08);
  position: relative;
  z-index: 2;
}

.terminal-step.active {
  background: rgba(59,130,246,0.05);
}

.terminal-step.completed {
  opacity: 0.85;
}

@keyframes step-pulse {
  0%, 100% { background: rgba(59,130,246,0.05); }
  50% { background: rgba(59,130,246,0.12); }
}

.step-active-pulse { animation: step-pulse 1s ease infinite; }

.chart-canvas { image-rendering: auto; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(124,58,237,0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(124,58,237,0.5); }

input[type="range"] {
  -webkit-appearance: none;
  background: rgba(124,58,237,0.2);
  border-radius: 4px;
  height: 6px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--purple);
  cursor: pointer;
  border: 2px solid var(--cyan);
}

select, input[type="text"] {
  background: rgba(22, 22, 42, 0.8);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 14px;
  font-family: 'IBM Plex Sans', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}
select:focus, input[type="text"]:focus {
  border-color: var(--purple);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  z-index: 10000;
  transition: transform 0.3s ease;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

@keyframes gauge-fill {
  from { stroke-dashoffset: 283; }
}

.verdict-confident { border-left: 3px solid #22c55e; }
.verdict-tentative { border-left: 3px solid #f59e0b; }
.verdict-unknown { border-left: 3px solid #f97316; }
.verdict-stumped { border-left: 3px solid #ef4444; }