* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: #7b2ff7 #1a1a2e;
}

body {
  background: #0a0a14;
  overflow-x: hidden;
}

@keyframes pulse-glow {
  0%, 100% { text-shadow: 0 0 20px rgba(123, 47, 247, 0.5), 0 0 40px rgba(0, 212, 255, 0.3); }
  50% { text-shadow: 0 0 30px rgba(123, 47, 247, 0.8), 0 0 60px rgba(0, 212, 255, 0.5); }
}

@keyframes brain-bounce {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.15) rotate(-5deg); }
  50% { transform: scale(1.05) rotate(0deg); }
  75% { transform: scale(1.15) rotate(5deg); }
}

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

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

@keyframes scan-line {
  0% { top: -2px; }
  100% { top: 100%; }
}

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

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

@keyframes glow-ring {
  0% { box-shadow: 0 0 5px rgba(123,47,247,0.3), 0 0 10px rgba(0,212,255,0.1); }
  50% { box-shadow: 0 0 15px rgba(123,47,247,0.6), 0 0 30px rgba(0,212,255,0.3); }
  100% { box-shadow: 0 0 5px rgba(123,47,247,0.3), 0 0 10px rgba(0,212,255,0.1); }
}

.glass-card {
  background: rgba(30, 30, 53, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(123, 47, 247, 0.15);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.glass-card:hover {
  border-color: rgba(123, 47, 247, 0.35);
  box-shadow: 0 0 30px rgba(123, 47, 247, 0.08);
}

.terminal-area {
  background: #0d0d1a;
  border: 1px solid #1a1a2e;
  font-family: 'JetBrains Mono', monospace;
  position: relative;
  overflow: hidden;
}

.terminal-area::before {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 170, 0.15), transparent);
  animation: scan-line 4s linear infinite;
  pointer-events: none;
  z-index: 1;
}

.btn-glow {
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
}

.btn-glow::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(45deg, #7b2ff7, #00d4ff, #7b2ff7);
  background-size: 200% 200%;
  animation: gradient-shift 3s ease infinite;
  border-radius: inherit;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s;
}

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

.btn-glow:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(123, 47, 247, 0.4);
}

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

.training-active {
  animation: glow-ring 2s ease-in-out infinite;
}

.training-active .btn-glow::before {
  opacity: 1;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: #1a1a2e;
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #7b2ff7;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(123, 47, 247, 0.6);
  transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #7b2ff7;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 8px rgba(123, 47, 247, 0.6);
}

textarea, input[type="text"], input[type="number"] {
  background: #0d0d1a;
  border: 1px solid rgba(123, 47, 247, 0.2);
  transition: border-color 0.3s, box-shadow 0.3s;
}

textarea:focus, input[type="text"]:focus, input[type="number"]:focus {
  border-color: #7b2ff7;
  box-shadow: 0 0 16px rgba(123, 47, 247, 0.2);
  outline: none;
}

.confidence-bar {
  height: 24px;
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  overflow: hidden;
}

.confidence-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
  animation: gradient-shift 2s ease infinite;
}

.repeated-text {
  color: #ff6b35;
  background: rgba(255, 107, 53, 0.1);
  border-radius: 2px;
  padding: 0 1px;
}

.tooltip-container {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(123, 47, 247, 0.3);
  color: rgba(255,255,255,0.6);
  font-size: 9px;
  cursor: help;
  margin-left: 4px;
  flex-shrink: 0;
}

.tooltip-text {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e1e35;
  border: 1px solid rgba(123,47,247,0.3);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11px;
  color: rgba(255,255,255,0.8);
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
  max-width: 220px;
  white-space: normal;
  text-align: center;
}

.tooltip-container:hover .tooltip-text {
  display: block;
}

.quality-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

.quality-poor { background: rgba(255,51,102,0.2); color: #ff3366; }
.quality-okay { background: rgba(255,170,0,0.2); color: #ffaa00; }
.quality-good { background: rgba(0,255,170,0.2); color: #00ffaa; }
.quality-excellent { background: rgba(0,212,255,0.2); color: #00d4ff; box-shadow: 0 0 12px rgba(0,212,255,0.2); }

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: #0a0a14;
}

::-webkit-scrollbar-thumb {
  background: #7b2ff7;
  border-radius: 3px;
}