:root {
  --bg-deep: #06060f;
  --bg-panel: rgba(12, 12, 30, 0.7);
  --bg-card: rgba(18, 18, 45, 0.6);
  --neon-blue: #00d4ff;
  --neon-green: #39ff14;
  --neon-purple: #b388ff;
  --neon-pink: #ff4da6;
  --text-primary: #e8e8f0;
  --text-muted: #6b6b8d;
  --border-glow: rgba(0, 212, 255, 0.15);
}

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

html { font-size: 16px; }

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

/* Animated background neural net */
.neural-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.neural-node {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--neon-blue);
  opacity: 0;
  animation: nodeFlicker 4s infinite;
}

.neural-node::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 80px;
  height: 1px;
  background: linear-gradient(90deg, rgba(0,212,255,0.3), transparent);
  transform-origin: left center;
  animation: lineRotate 8s linear infinite;
}

@keyframes nodeFlicker {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  50% { opacity: 0.6; transform: scale(1.5); }
}

@keyframes lineRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Glow text */
.glow-text {
  text-shadow: 
    0 0 10px rgba(0, 212, 255, 0.5),
    0 0 30px rgba(0, 212, 255, 0.3),
    0 0 60px rgba(0, 212, 255, 0.15);
}

.glow-green {
  text-shadow: 
    0 0 10px rgba(57, 255, 20, 0.5),
    0 0 30px rgba(57, 255, 20, 0.3);
}

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

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 212, 255, 0.08);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.glass-card:hover {
  border-color: rgba(0, 212, 255, 0.2);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.05);
}

/* Custom textarea */
.code-textarea {
  font-family: 'Fira Code', monospace;
  background: rgba(6, 6, 15, 0.8);
  border: 1px solid rgba(0, 212, 255, 0.12);
  border-radius: 12px;
  color: var(--text-primary);
  resize: vertical;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  outline: none;
}

.code-textarea:focus {
  border-color: var(--neon-blue);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
}

.code-textarea::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

/* Buttons */
.btn-neon {
  position: relative;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
}

.btn-neon::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  padding: 1px;
  background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.btn-neon:hover::before { opacity: 1; }

.btn-neon:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-neon:disabled:hover::before { opacity: 0.3; }

.btn-primary {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(179, 136, 255, 0.15));
  color: var(--neon-blue);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.25), rgba(179, 136, 255, 0.25));
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(0, 212, 255, 0.15);
}

.btn-green {
  background: linear-gradient(135deg, rgba(57, 255, 20, 0.12), rgba(0, 212, 255, 0.12));
  color: var(--neon-green);
}

.btn-green::before {
  background: linear-gradient(135deg, var(--neon-green), var(--neon-blue));
}

.btn-green:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(57, 255, 20, 0.22), rgba(0, 212, 255, 0.22));
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(57, 255, 20, 0.12);
}

.btn-danger {
  background: rgba(255, 77, 77, 0.1);
  color: #ff4d4d;
  border: 1px solid rgba(255, 77, 77, 0.15);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: rgba(255, 77, 77, 0.2);
  border-color: rgba(255, 77, 77, 0.35);
}

/* Slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(0, 212, 255, 0.1);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--neon-blue);
  cursor: pointer;
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.4);
  transition: box-shadow 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.7);
}

/* Seed input */
.seed-input {
  font-family: 'Fira Code', monospace;
  background: rgba(6, 6, 15, 0.8);
  border: 1px solid rgba(0, 212, 255, 0.12);
  border-radius: 10px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.seed-input:focus {
  border-color: var(--neon-blue);
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.1);
}

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

/* Typewriter cursor */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--neon-green);
  margin-left: 2px;
  animation: blink 0.8s infinite;
  vertical-align: text-bottom;
}

/* Pulse animation */
@keyframes pulse-ring {
  0% { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(2); opacity: 0; }
}

.pulse-dot {
  position: relative;
}

.pulse-dot::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-green);
  top: 50%;
  right: -16px;
  transform: translateY(-50%);
  animation: pulse-ring 1.5s infinite;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 212, 255, 0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 212, 255, 0.4); }

/* Training animation */
@keyframes trainingPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(179, 136, 255, 0.2); }
  50% { box-shadow: 0 0 30px rgba(179, 136, 255, 0.5), 0 0 60px rgba(0, 212, 255, 0.2); }
}

.training-active {
  animation: trainingPulse 1.5s infinite;
}

/* Entry appear animation */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.entry-appear {
  animation: slideIn 0.35s ease-out;
}

/* Network visualization */
@keyframes neuronFire {
  0% { r: 4; opacity: 0.3; }
  50% { r: 8; opacity: 1; }
  100% { r: 4; opacity: 0.3; }
}

@keyframes connectionPulse {
  0% { stroke-opacity: 0.05; }
  50% { stroke-opacity: 0.4; }
  100% { stroke-opacity: 0.05; }
}

/* Footer */
.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: var(--neon-blue);
}

/* Number input styling */
input[type="number"] {
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  opacity: 0.5;
}

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