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

:root {
  --black: #000000;
  --dark: #0a0a0a;
  --card: #111111;
  --border: #222222;
  --white: #ffffff;
  --gray: #aaaaaa;
  --dim: #555555;
  --purple: #7B2FBE;
  --cyan: #00FFD0;
  --amber: #FFB800;
  --deep-blue: #1a3a6a;
  --violet: #8B5CF6;
}

body {
  background: var(--black);
  color: var(--white);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

.font-mono {
  font-family: 'IBM Plex Mono', monospace !important;
}

.font-sans {
  font-family: 'IBM Plex Sans', system-ui, sans-serif !important;
}

/* Starfield */
.starfield {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.star {
  position: absolute;
  background: white;
  border-radius: 50%;
  animation: twinkle var(--duration) ease-in-out infinite;
  animation-delay: var(--delay);
}

@keyframes twinkle {
  0%, 100% { opacity: 0.1; }
  50% { opacity: var(--max-opacity); }
}

/* Upload zone */
.upload-zone {
  border: 2px dashed rgba(255,255,255,0.3);
  transition: all 0.3s ease;
  animation: borderPulse 3s ease-in-out infinite;
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.03);
}

@keyframes borderPulse {
  0%, 100% { border-color: rgba(255,255,255,0.2); }
  50% { border-color: rgba(255,255,255,0.45); }
}

/* Portal glyph */
.portal-glyph {
  width: 80px;
  height: 80px;
  position: relative;
}

.portal-ring {
  position: absolute;
  border: 1.5px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  animation: portalSpin 8s linear infinite;
}

.portal-ring:nth-child(1) {
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}

.portal-ring:nth-child(2) {
  width: 70%;
  height: 70%;
  top: 15%;
  left: 15%;
  animation-direction: reverse;
  animation-duration: 6s;
  border-color: rgba(123,47,190,0.4);
}

.portal-ring:nth-child(3) {
  width: 40%;
  height: 40%;
  top: 30%;
  left: 30%;
  animation-duration: 4s;
  border-color: rgba(0,255,208,0.3);
}

.portal-eye {
  position: absolute;
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(255,255,255,0.5);
}

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

/* Toggle */
.fringe-toggle {
  position: relative;
  width: 48px;
  height: 24px;
  border-radius: 12px;
  background: #333;
  cursor: pointer;
  transition: all 0.3s ease;
}

.fringe-toggle.active {
  background: var(--purple);
  box-shadow: 0 0 12px rgba(123,47,190,0.5);
}

.fringe-toggle .knob {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  transition: transform 0.3s ease;
}

.fringe-toggle.active .knob {
  transform: translateX(24px);
}

/* Progress bar */
.progress-bar-container {
  height: 6px;
  background: #1a1a1a;
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease, background-color 0.5s ease;
}

/* Terminal log */
.terminal-log {
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--cyan);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #333 #0a0a0a;
}

.terminal-log::-webkit-scrollbar {
  width: 4px;
}

.terminal-log::-webkit-scrollbar-track {
  background: #0a0a0a;
}

.terminal-log::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 2px;
}

/* Gallery card */
.gallery-card {
  background: var(--card);
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  cursor: pointer;
}

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

.gallery-card.fringe-mode:hover {
  border-color: rgba(123,47,190,0.5);
  box-shadow: 0 0 20px rgba(123,47,190,0.1);
}

.gallery-card.void-echo {
  border-color: rgba(255,255,255,0.1);
}

/* Divergence bar */
.divergence-bar {
  height: 3px;
  border-radius: 1.5px;
  background: #1a1a1a;
}

/* Modal overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.95);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

/* Comparator */
.comparator-container {
  position: relative;
  overflow: hidden;
  cursor: ew-resize;
  user-select: none;
  -webkit-user-select: none;
}

.comparator-divider {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  background: var(--cyan);
  z-index: 10;
  pointer-events: none;
}

.comparator-handle {
  position: absolute;
  top: 50%;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--cyan);
  border: 2px solid white;
  transform: translate(-50%, -50%);
  z-index: 11;
  cursor: ew-resize;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

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

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

.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

.fade-in-up {
  animation: fadeInUp 0.6s ease forwards;
  opacity: 0;
}

.slide-in {
  animation: slideIn 0.4s ease forwards;
  opacity: 0;
}

/* Sound toggle */
.sound-toggle {
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.3s ease;
}

.sound-toggle:hover {
  opacity: 0.8;
}

.sound-toggle.active {
  opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
  .upload-zone {
    margin: 0 16px;
  }
}

/* Spectral chart */
.spectral-chart canvas {
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  border-radius: 4px;
}