/* ==========================================================================
   INTERACTIVE NEURAL NETWORK VISUALIZER - CYBER DARK THEME
   Designed for High-Performance Client-Side ML Playground
   ========================================================================== */

:root {
  /* Color Palette - Cyber & Deep Tech */
  --bg-primary: #070a13;
  --bg-secondary: #0d121f;
  --bg-tertiary: #131b2e;
  
  --surface-card: rgba(13, 18, 31, 0.75);
  --surface-card-hover: rgba(19, 27, 46, 0.85);
  --surface-glass: rgba(15, 23, 42, 0.65);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(0, 242, 254, 0.3);
  --border-accent: rgba(139, 92, 246, 0.4);
  
  /* Neon Accents */
  --neon-cyan: #00f2fe;
  --neon-blue: #4facfe;
  --neon-purple: #8b5cf6;
  --neon-pink: #f43f5e;
  --neon-green: #10b981;
  --neon-amber: #f59e0b;
  
  /* Text colors */
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --text-cyan: #38bdf8;
  
  /* Weight gradient definitions for visualizer */
  --weight-pos: #00f2fe;
  --weight-neg: #f43f5e;
  --node-active: #00ff88;
  
  /* Radii & Shadows */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --glow-cyan: 0 0 16px rgba(0, 242, 254, 0.35);
  --glow-purple: 0 0 16px rgba(139, 92, 246, 0.35);
  --glow-green: 0 0 16px rgba(16, 185, 129, 0.35);
  --glow-pink: 0 0 16px rgba(244, 63, 94, 0.35);
  
  --shadow-card: 0 12px 32px -4px rgba(0, 0, 0, 0.6);
  --transition-smooth: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100vh;
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Ambient Cyber Grid Background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(0, 242, 254, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 25%, rgba(139, 92, 246, 0.09) 0%, transparent 45%),
    radial-gradient(circle at 50% 85%, rgba(16, 185, 129, 0.06) 0%, transparent 50%),
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 40px 40px, 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* App Container */
.app-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Navbar */
.cyber-header {
  height: 60px;
  background: rgba(7, 10, 19, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
}

.brand-logo-glow {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--glow-cyan);
  font-size: 1.1rem;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 242, 254, 0.12);
  color: var(--neon-cyan);
  border: 1px solid rgba(0, 242, 254, 0.25);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.1);
  color: var(--neon-green);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--neon-green);
  box-shadow: 0 0 8px var(--neon-green);
  animation: pulseDot 2s infinite ease-in-out;
}

.status-dot.training {
  background-color: var(--neon-cyan);
  box-shadow: 0 0 10px var(--neon-cyan);
  animation: fastPulse 0.8s infinite alternate;
}

@keyframes pulseDot {
  0%, 100% { opacity: 0.6; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

@keyframes fastPulse {
  0% { transform: scale(0.85); opacity: 0.5; }
  100% { transform: scale(1.3); opacity: 1; }
}

.nav-link {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
  transition: var(--transition-smooth);
}

.nav-link:hover {
  color: var(--neon-cyan);
  border-color: var(--border-glow);
  background: rgba(0, 242, 254, 0.08);
}

/* Mobile View Tabs (visible on small screens) */
.mobile-view-tabs {
  display: none;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.4rem 0.75rem;
  gap: 0.5rem;
  position: sticky;
  top: 60px;
  z-index: 90;
}

.mobile-tab-btn {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.mobile-tab-btn.active {
  background: rgba(0, 242, 254, 0.12);
  color: var(--neon-cyan);
  border-color: rgba(0, 242, 254, 0.3);
}

/* Main Two-Column Layout */
.main-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 1.25rem;
  padding: 1.25rem;
  max-width: 1750px;
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 1180px) {
  .main-workspace {
    grid-template-columns: 410px 1fr;
    gap: 1rem;
    padding: 1rem;
  }
}

@media (max-width: 960px) {
  .main-workspace {
    grid-template-columns: 1fr;
  }
  .mobile-view-tabs {
    display: flex;
  }
  .column-left, .column-right {
    display: none;
  }
  .column-left.active-mobile,
  .column-right.active-mobile {
    display: flex;
  }
}

/* Columns */
.column-left, .column-right {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Glassmorphism Cards */
.cyber-card {
  background: var(--surface-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: border-color 0.2s;
  display: flex;
  flex-direction: column;
}

.cyber-card:hover {
  border-color: rgba(255, 255, 255, 0.13);
}

.card-header {
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
}

.card-title {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title .icon {
  font-size: 1.05rem;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.card-body {
  padding: 1.2rem;
}

/* -------------------------------------------------------------
   COMPONENT 1: DRAWING & INPUT CANVAS
   ------------------------------------------------------------- */
.canvas-stage-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.canvas-viewport-container {
  position: relative;
  width: 280px;
  height: 280px;
  border-radius: var(--radius-md);
  background: #04060a;
  border: 2px solid rgba(0, 242, 254, 0.25);
  box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.8), inset 0 0 18px rgba(0, 242, 254, 0.04);
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.canvas-viewport-container:hover,
.canvas-viewport-container.drawing {
  border-color: var(--neon-cyan);
  box-shadow: 0 8px 28px -4px rgba(0, 242, 254, 0.2), inset 0 0 24px rgba(0, 242, 254, 0.08);
}

#drawing-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Grid Overlay */
.grid-overlay {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(to right, rgba(0, 242, 254, 0.12) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 242, 254, 0.12) 1px, transparent 1px);
  background-size: 28px 28px; /* 280 / 10 = 28px */
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.grid-overlay.visible {
  opacity: 1;
}

/* Bounding box visualization */
.bbox-box {
  position: absolute;
  border: 1px dashed rgba(245, 158, 11, 0.7);
  background: rgba(245, 158, 11, 0.05);
  pointer-events: none;
  display: none;
}

/* Canvas Toolbar */
.canvas-controls-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.brush-sizes {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.brush-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.brush-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.brush-btn.active {
  background: rgba(0, 242, 254, 0.15);
  border-color: rgba(0, 242, 254, 0.4);
  color: var(--neon-cyan);
}

.dot-sm { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.dot-md { width: 12px; height: 12px; border-radius: 50%; background: currentColor; }
.dot-lg { width: 18px; height: 18px; border-radius: 50%; background: currentColor; }

/* Action Buttons */
.btn {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: var(--transition-smooth);
  user-select: none;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
  border-color: transparent;
  color: #04060a;
  font-weight: 700;
  box-shadow: var(--glow-cyan);
}

.btn-primary:hover {
  box-shadow: 0 0 22px rgba(0, 242, 254, 0.6);
  color: #000000;
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border-color: transparent;
  box-shadow: var(--glow-green);
}

.btn-success:hover {
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--neon-pink);
  border-color: rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.25);
  border-color: var(--neon-pink);
}

.btn-purple {
  background: linear-gradient(135deg, var(--neon-purple), #6366f1);
  color: #ffffff;
  border-color: transparent;
  box-shadow: var(--glow-purple);
}

.btn-purple:hover {
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.6);
}

.btn-sm {
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
}

/* Downsampled 10x10 Sensor Preview */
.sensor-preview-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.sensor-info {
  display: flex;
  flex-direction: column;
}

.sensor-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sensor-desc {
  font-size: 0.72rem;
  color: var(--text-faint);
  font-family: 'JetBrains Mono', monospace;
}

.mini-grid-container {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  border: 1px solid rgba(0, 242, 254, 0.3);
  overflow: hidden;
  background: #000;
}

#mini-preview-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

/* Label Buttons for Dataset Collection */
.label-collection-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.section-caption {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.label-buttons-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

.label-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.65rem 0.4rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.label-btn .shape-glyph {
  font-size: 1.4rem;
  line-height: 1;
}

.label-btn .shape-name {
  font-size: 0.75rem;
  font-weight: 600;
}

.label-btn .sample-counter {
  font-size: 0.65rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.label-btn:hover {
  background: rgba(0, 242, 254, 0.08);
  border-color: rgba(0, 242, 254, 0.4);
  color: var(--neon-cyan);
  transform: translateY(-2px);
}

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

/* Samples Gallery & Presets */
.dataset-quick-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.3rem;
}

.samples-strip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.4rem 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.samples-strip::-webkit-scrollbar {
  height: 4px;
}
.samples-strip::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.sample-thumbnail {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: #000;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
  cursor: pointer;
}

.sample-thumbnail canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  border-radius: 3px;
}

.sample-thumbnail .delete-tag {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--neon-pink);
  color: #fff;
  font-size: 9px;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.sample-thumbnail:hover .delete-tag {
  display: flex;
}

/* -------------------------------------------------------------
   COMPONENT 3: TRAINING CONTROL PANEL & METRICS
   ------------------------------------------------------------- */
.training-controls-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.control-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text-muted);
}

.control-val {
  font-family: 'JetBrains Mono', monospace;
  color: var(--neon-cyan);
  font-size: 0.775rem;
}

/* Range Slider */
.cyber-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  outline: none;
  transition: background 0.2s;
}

.cyber-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--neon-cyan);
  cursor: pointer;
  box-shadow: 0 0 10px var(--neon-cyan);
  transition: transform 0.15s ease;
}

.cyber-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.cyber-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--neon-cyan);
  cursor: pointer;
  box-shadow: 0 0 10px var(--neon-cyan);
  border: none;
}

/* Architecture Selector Pills */
.arch-pills {
  display: flex;
  gap: 0.45rem;
}

.arch-pill {
  flex: 1;
  padding: 0.35rem;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.arch-pill.active {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.5);
  color: #c4b5fd;
  box-shadow: var(--glow-purple);
}

/* Training Action Buttons Row */
.training-actions-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.training-actions-row .btn {
  flex: 1;
  min-width: 100px;
}

/* Metrics Mini Dashboard */
.metrics-dashboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.metric-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.metric-lbl {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-faint);
  letter-spacing: 0.05em;
}

.metric-num {
  font-size: 1.05rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: #ffffff;
}

.metric-num.loss {
  color: var(--neon-pink);
}

.metric-num.acc {
  color: var(--neon-green);
}

.metric-num.epoch {
  color: var(--neon-cyan);
}

/* Real-Time Loss Curve Chart */
.chart-container {
  width: 100%;
  height: 110px;
  position: relative;
  background: #04060a;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  margin-top: 0.4rem;
}

#loss-chart-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-watermark {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 0.65rem;
  font-family: 'JetBrains Mono', monospace;
  color: rgba(255, 255, 255, 0.2);
  pointer-events: none;
}

/* -------------------------------------------------------------
   COMPONENT 4: INFERENCE / TEST MODE (PROBABILITY BARS)
   ------------------------------------------------------------- */
.inference-section {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.inference-header-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.live-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.775rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.toggle-switch {
  position: relative;
  width: 34px;
  height: 18px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  transition: background 0.2s;
  cursor: pointer;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}

input[type="checkbox"]:checked + .toggle-switch {
  background: var(--neon-cyan);
}

input[type="checkbox"]:checked + .toggle-switch::after {
  transform: translateX(16px);
  background: #04060a;
}

/* Probability Bars List */
.prob-bars-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.prob-bar-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  transition: var(--transition-smooth);
}

.prob-bar-item.winner {
  background: rgba(0, 242, 254, 0.07);
  border-color: rgba(0, 242, 254, 0.4);
  box-shadow: 0 0 14px rgba(0, 242, 254, 0.15);
}

.prob-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
}

.prob-class-name {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.winner-badge {
  display: none;
  font-size: 0.65rem;
  font-family: 'JetBrains Mono', monospace;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  background: var(--neon-cyan);
  color: #04060a;
  font-weight: 800;
  text-transform: uppercase;
}

.prob-bar-item.winner .winner-badge {
  display: inline-block;
}

.prob-percentage {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}

.prob-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.prob-fill {
  height: 100%;
  width: 0%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #4facfe, var(--neon-cyan));
  box-shadow: 0 0 8px rgba(0, 242, 254, 0.4);
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.prob-bar-item:nth-child(2) .prob-fill {
  background: linear-gradient(90deg, #8b5cf6, #c084fc);
}

.prob-bar-item:nth-child(3) .prob-fill {
  background: linear-gradient(90deg, #10b981, #34d399);
}

/* -------------------------------------------------------------
   COMPONENT 2: NEURAL NETWORK ARCHITECTURE VISUALIZER
   ------------------------------------------------------------- */
.visualizer-card {
  flex: 1;
  min-height: 600px;
  display: flex;
  flex-direction: column;
}

.viz-legend-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.legend-items {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-dot.pos { background-color: var(--weight-pos); box-shadow: 0 0 6px var(--weight-pos); }
.legend-dot.neg { background-color: var(--weight-neg); box-shadow: 0 0 6px var(--weight-neg); }
.legend-dot.act { background-color: var(--node-active); box-shadow: 0 0 6px var(--node-active); }

.viz-canvas-wrapper {
  position: relative;
  flex: 1;
  min-height: 480px;
  background: radial-gradient(circle at center, #090e1a 0%, #04060b 100%);
  overflow: hidden;
}

#network-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Floating Hover Tooltip */
.node-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(13, 18, 31, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glow);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
  z-index: 50;
  display: none;
  transform: translate(-50%, -120%);
  white-space: nowrap;
}

.node-tooltip.show {
  display: block;
}

/* Floating Visualization Controls */
.viz-floating-controls {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(13, 18, 31, 0.85);
  backdrop-filter: blur(8px);
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  z-index: 20;
}

/* Modal Overlay for Info / Dataset Inspection */
.cyber-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 200;
}

.cyber-modal-backdrop.active {
  display: flex;
}

.cyber-modal-dialog {
  width: 100%;
  max-width: 620px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), var(--glow-cyan);
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  animation: modalEnter 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

@keyframes modalEnter {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.modal-body h4 {
  color: var(--neon-cyan);
  margin: 0.8rem 0 0.3rem 0;
  font-size: 0.9rem;
}

.modal-body code {
  font-family: 'JetBrains Mono', monospace;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  color: #e2e8f0;
  font-size: 0.8rem;
}

.modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: flex-end;
}

/* Toast Message */
.cyber-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: rgba(13, 18, 31, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--neon-cyan);
  box-shadow: var(--glow-cyan);
  color: #ffffff;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 300;
  pointer-events: none;
}

.cyber-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .cyber-header {
    padding: 0 0.75rem;
  }
  .brand-title {
    font-size: 0.92rem;
  }
  .card-body {
    padding: 0.85rem;
  }
  .visualizer-card {
    min-height: 440px;
  }
}
