:root {
  --bg-deep: #070714;
  --bg-panel: #0d0d24;
  --bg-card: #12123a;
  --neon-blue: #00d4ff;
  --neon-pink: #ff006e;
  --neon-green: #39ff14;
  --neon-yellow: #ffe600;
  --neon-purple: #b24dff;
  --text-primary: #e0e0f0;
  --text-muted: #7878a0;
  --glass-border: rgba(0, 212, 255, 0.15);
  --glass-bg: rgba(13, 13, 36, 0.7);
}

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

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: 'Space Grotesk', 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(0, 212, 255, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(255, 0, 110, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 50%, rgba(57, 255, 20, 0.02) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

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

.neon-title {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  background: linear-gradient(135deg, var(--neon-blue), var(--neon-pink), var(--neon-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.3));
  animation: titlePulse 3s ease-in-out infinite;
}

@keyframes titlePulse {
  0%, 100% { filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.3)); }
  50% { filter: drop-shadow(0 0 40px rgba(0, 212, 255, 0.5)); }
}

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

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

.tab-btn {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
}

.tab-btn:hover { color: var(--text-primary); background: rgba(0, 212, 255, 0.05); }

.tab-btn.active {
  color: var(--neon-blue);
  background: rgba(0, 212, 255, 0.1);
  border-color: rgba(0, 212, 255, 0.3);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
}

.neon-btn {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: 12px;
  border: 1px solid var(--neon-blue);
  background: rgba(0, 212, 255, 0.1);
  color: var(--neon-blue);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 15px;
  position: relative;
  overflow: hidden;
}

.neon-btn:hover {
  background: rgba(0, 212, 255, 0.2);
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.2), inset 0 0 30px rgba(0, 212, 255, 0.05);
  transform: translateY(-1px);
}

.neon-btn:active { transform: translateY(0px); }

.neon-btn.pink { border-color: var(--neon-pink); background: rgba(255, 0, 110, 0.1); color: var(--neon-pink); }
.neon-btn.pink:hover { background: rgba(255, 0, 110, 0.2); box-shadow: 0 0 30px rgba(255, 0, 110, 0.2); }

.neon-btn.green { border-color: var(--neon-green); background: rgba(57, 255, 20, 0.1); color: var(--neon-green); }
.neon-btn.green:hover { background: rgba(57, 255, 20, 0.2); box-shadow: 0 0 30px rgba(57, 255, 20, 0.2); }

.neon-btn.purple { border-color: var(--neon-purple); background: rgba(178, 77, 255, 0.1); color: var(--neon-purple); }
.neon-btn.purple:hover { background: rgba(178, 77, 255, 0.2); box-shadow: 0 0 30px rgba(178, 77, 255, 0.2); }

.neon-btn.large { padding: 16px 40px; font-size: 18px; border-radius: 16px; }

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

textarea.neon-input, input.neon-input {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  background: rgba(7, 7, 20, 0.8);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 12px;
  color: var(--text-primary);
  padding: 14px 18px;
  width: 100%;
  outline: none;
  transition: all 0.3s ease;
  resize: vertical;
}

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

input.neon-input { resize: none; }

.snippet-card {
  background: rgba(18, 18, 58, 0.5);
  border: 1px solid rgba(0, 212, 255, 0.08);
  border-radius: 12px;
  padding: 14px 18px;
  transition: all 0.3s ease;
  animation: slideIn 0.3s ease;
}

.snippet-card:hover { border-color: rgba(0, 212, 255, 0.2); }

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

@keyframes addPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.add-pulse { animation: addPulse 0.3s ease; }

.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
}

.preset-btn {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 230, 0, 0.3);
  background: rgba(255, 230, 0, 0.05);
  color: var(--neon-yellow);
  cursor: pointer;
  transition: all 0.3s ease;
}

.preset-btn:hover {
  background: rgba(255, 230, 0, 0.15);
  box-shadow: 0 0 15px rgba(255, 230, 0, 0.1);
}

.slider-container input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(0, 212, 255, 0.15);
  outline: none;
  transition: all 0.3s ease;
}

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

.slider-container input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.6);
  transform: scale(1.1);
}

.brain-pulse {
  animation: brainBounce 0.6s ease-in-out infinite;
  display: inline-block;
  font-size: 64px;
}

@keyframes brainBounce {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.1) rotate(-5deg); }
  50% { transform: scale(1.2) rotate(0deg); }
  75% { transform: scale(1.1) rotate(5deg); }
}

.training-ring {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--neon-blue);
  border-right-color: var(--neon-pink);
  animation: spinRing 1s linear infinite;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

@keyframes spinRing { to { transform: rotate(360deg); } }

.ngram-chip {
  display: inline-flex;
  padding: 5px 12px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid;
  transition: all 0.3s ease;
}

.typewriter-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}

.cursor-blink::after {
  content: '▊';
  animation: cursorBlink 0.8s ease-in-out infinite;
  color: var(--neon-blue);
}

@keyframes cursorBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.2);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}

.suggestion-chip:hover {
  background: rgba(0, 212, 255, 0.15);
  border-color: rgba(0, 212, 255, 0.4);
  transform: translateY(-1px);
}

.prob-bar {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--neon-blue), var(--neon-green));
  transition: width 0.3s ease;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

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

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.3s;
}

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

.token-chip {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  margin: 1px;
  border: 1px solid;
  transition: all 0.2s ease;
}

.token-chip:hover {
  transform: scale(1.05);
}

.token-chip-unk {
  background: rgba(255, 0, 110, 0.15) !important;
  border-color: rgba(255, 0, 110, 0.4) !important;
  color: var(--neon-pink) !important;
}

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--bg-panel);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 640px) {
  .tab-btn { padding: 8px 14px; font-size: 13px; }
  .neon-btn.large { padding: 14px 28px; font-size: 16px; }
}