:root {
  --bg-deep: #0d0d1a;
  --bg-mid: #141428;
  --bg-card: #1a1a35;
  --bg-card-hover: #222248;
  --amber: #e8a020;
  --amber-glow: #f0b040;
  --teal: #00b4d8;
  --teal-dim: #0090aa;
  --text-primary: #e8e8f0;
  --text-secondary: #9090b0;
  --text-muted: #606080;
  --border: #2a2a50;
}

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

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: 'Crimson Pro', serif;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

@keyframes helixSpin {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(360deg); }
}

@keyframes pulse-amber {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 160, 32, 0.4); }
  50% { box-shadow: 0 0 12px 4px rgba(232, 160, 32, 0.15); }
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes branchSplit {
  0% { opacity: 0; transform: scale(0.5); }
  50% { transform: scale(1.15); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes nodeGlow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}

.animate-fade-in {
  animation: fadeSlideIn 0.3s ease-out forwards;
}

.animate-branch {
  animation: branchSplit 0.5s ease-out forwards;
}

.node-active {
  animation: nodeGlow 2s ease-in-out infinite;
}

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

.helix-container {
  perspective: 200px;
  display: inline-block;
}

.helix-letter {
  display: inline-block;
  animation: helixSpin 4s linear infinite;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  color: var(--amber);
}

.helix-letter:nth-child(2) { animation-delay: -0.5s; }
.helix-letter:nth-child(3) { animation-delay: -1s; }
.helix-letter:nth-child(4) { animation-delay: -1.5s; }
.helix-letter:nth-child(5) { animation-delay: -2s; }
.helix-letter:nth-child(6) { animation-delay: -2.5s; }

.tree-svg {
  width: 100%;
  min-height: 400px;
}

.tree-node {
  cursor: pointer;
  transition: all 0.2s ease;
}

.tree-node:hover {
  filter: brightness(1.3);
}

.toggle-track {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
}

.toggle-track.active {
  background: var(--teal-dim);
  border-color: var(--teal);
}

.toggle-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-secondary);
  position: absolute;
  top: 2px;
  left: 2px;
  transition: all 0.2s;
}

.toggle-track.active .toggle-thumb {
  left: 20px;
  background: white;
}

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

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--amber);
  cursor: pointer;
  border: 2px solid var(--bg-deep);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--amber);
  cursor: pointer;
  border: 2px solid var(--bg-deep);
}

.bg-gradient-main {
  background: linear-gradient(135deg, var(--bg-deep) 0%, #0f0f25 50%, #121230 100%);
}

.bg-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.language-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.language-badge:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.2);
}

.tooltip {
  position: absolute;
  background: #1a1a40;
  border: 1px solid var(--amber);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  z-index: 100;
  pointer-events: none;
  max-width: 260px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

.btn-primary {
  background: var(--amber);
  color: var(--bg-deep);
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  transition: all 0.15s;
}

.btn-primary:hover {
  background: var(--amber-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--teal);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--teal-dim);
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  transition: all 0.15s;
}

.btn-secondary:hover {
  background: rgba(0, 180, 216, 0.1);
  border-color: var(--teal);
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.15s;
}

.btn-icon:hover {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--bg-card-hover);
}

.seed-input {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 8px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
  letter-spacing: 0.05em;
}

.seed-input:focus {
  border-color: var(--amber);
}

.seed-input::placeholder {
  color: var(--text-muted);
  font-weight: 300;
}

.history-entry {
  padding: 8px 12px;
  border-left: 2px solid var(--border);
  margin-left: 8px;
  font-size: 13px;
  transition: all 0.2s;
}

.history-entry:hover {
  border-left-color: var(--amber);
  background: rgba(232, 160, 32, 0.05);
}

@media (max-width: 768px) {
  .desktop-split {
    flex-direction: column !important;
  }
  .left-panel, .right-panel {
    width: 100% !important;
    min-width: 0 !important;
  }
}