/*
  Liquid Glass UI Design System - Shared Library
  Version: 1.0
  Author: Dr. Gerard Joseph Lim
  Shared components for high-contrast dark-mode scientific simulations.
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  color-scheme: dark;
  /* Colors - Dark Mode (Default) */
  --bg-color: #030712;
  --bg-secondary: #0a0a0a;
  
  --text-main: #ffffff;
  --text-muted: #cbd5e1;
  --text-subtle: #94a3b8;
  
  --primary: #38bdf8;
  --primary-dark: #0284c7;
  --primary-light: #7dd3fc;
  
  --positive: #ff4d4d;
  --negative: #4d94ff;
  --neutral: #9ca3af;
  --warning: #fbbf24;
  --error: #ef4444;
  
  /* Solid Card / Panel Tokens */
  --card-bg: #0d1322;
  --card-border: #1e293b;
  --card-border-light: #334155;
  --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  --card-radius: 5px;

  /* Inputs & Buttons */
  --input-bg: #0a0f1d;
  --input-border: rgba(255, 255, 255, 0.14);
  --btn-bg: #172033;
  --btn-border: rgba(255, 255, 255, 0.14);
  --btn-hover-bg: rgba(255, 255, 255, 0.15);
  
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Layout & Window Spacing Design Rules */
  --header-height: 52px;
  --spacing-header-gap: 16px;
  --spacing-footer-gap: 16px;
  --spacing-viewport-edge: 20px;
  --spacing-card-gap: 16px;
  --footer-height-approx: 96px;
}

[data-theme="light"] {
  color-scheme: light;
  /* Classic PC Beige Lab Workstation Mode */
  --bg-color: #f5f0e8;
  --bg-secondary: #ede7dc;
  
  --text-main: #000000;
  --text-muted: #1e293b;
  --text-subtle: #334155;
  
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --primary-light: #0ea5e9;
  
  --positive: #dc2626;
  --negative: #2563eb;
  --neutral: #475569;
  --warning: #d97706;
  --error: #b91c1c;
  
  /* Solid PC Beige Chassis Cards */
  --card-bg: #e8e2d5;
  --card-border: rgba(70, 60, 50, 0.25);
  --card-border-light: rgba(70, 60, 50, 0.4);
  --card-shadow: 0 4px 20px rgba(255, 255, 255, 0.95), 0 1px 4px rgba(255, 255, 255, 0.85);
  
  /* Inputs & Buttons */
  --input-bg: #fcfbf7;
  --input-border: rgba(70, 60, 50, 0.32);
  --btn-bg: #dfd8cb;
  --btn-border: rgba(70, 60, 50, 0.28);
  --btn-hover-bg: #d4ccbe;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* Global Reset Utilities (optional, applied to bodies using layout) */
.glass-simulation-body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-family);
  margin: 0;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Solid Panel Container (No Glass / No Transparency, 5px Corner Radius) */
.liquid-glass {
  background: var(--card-bg, #0d1322);
  border: 1px solid var(--card-border, #1e293b);
  box-shadow: var(--card-shadow, 0 4px 16px rgba(0, 0, 0, 0.6));
  border-radius: 5px;
  position: relative;
  overflow: hidden;
  transition: none;
}

/* Reflection line removed for clean solid appearance */
.liquid-glass::before {
  display: none;
}

/* Typography elements */
.gradient-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

/* Standard Buttons - Crisp and Clean (No Glow Effects) */
.btn {
  background: var(--btn-bg, #172033);
  border: 1px solid var(--btn-border, rgba(255, 255, 255, 0.14));
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: 5px;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  background: var(--btn-hover-bg, rgba(255, 255, 255, 0.15));
  transform: translateY(-1px);
}

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

.btn-primary {
  background: #0284c7;
  border-color: #0369a1;
  color: #fff;
  font-weight: 600;
}

.btn-primary:hover {
  background: #0369a1;
  border-color: #075985;
}

.btn-success {
  background: #16a34a;
  color: #fff;
  border-color: #15803d;
}

.btn-success:hover {
  background: #15803d;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
  border-color: #b91c1c;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-warning {
  background: #d97706;
  color: #fff;
  border-color: #b45309;
}

.btn-warning:hover {
  background: #b45309;
}

/* Glass Toggle Slider */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #0a0f1d;
  transition: .3s;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: #e2e8f0;
  transition: .3s;
  border-radius: 3px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

input:checked + .slider {
  background-color: rgba(56, 189, 248, 0.25);
  border-color: rgba(56, 189, 248, 0.5);
}

input:checked + .slider:before {
  transform: translateX(20px);
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
}

/* Standard Range inputs */
input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(0, 0, 0, 0.4);
  height: 6px;
  border-radius: 3px;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: radial-gradient(circle at 30% 30%, #fff, #ccc);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
  transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  box-shadow: 0 0 10px #fff;
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: radial-gradient(circle at 30% 30%, #fff, #ccc);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
  transition: transform 0.1s;
}

input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.25);
  box-shadow: 0 0 10px #fff;
}

/* Input Fields (Text, Number, Dropdowns) */
input[type="text"]:not(.assistant-input),
input[type="number"],
select {
  background: #0a0f1d;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="number"] {
  color-scheme: dark;
}

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

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
}

/* Splash Overlay Modal */
.splash-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.splash-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-modal {
  width: 520px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--card-bg, #0d1322);
  border: 1px solid var(--card-border, #1e293b);
  border-radius: var(--card-radius, 5px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.65);
  animation: none;
}

[data-theme="light"] .splash-modal {
  box-shadow: 0 4px 20px rgba(70, 60, 50, 0.18);
}

.splash-header {
  text-align: center;
}

.splash-header h1,
.splash-header h2 {
  margin: 0 0 4px 0;
  font-family: var(--font-family, 'Inter', system-ui, -apple-system, sans-serif);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
  line-height: 1.25;
}

.splash-header .author {
  margin: 0;
  font-family: var(--font-family, 'Inter', system-ui, -apple-system, sans-serif);
  font-size: 0.80rem;
  font-weight: 500;
  color: var(--primary);
  line-height: 1.3;
}

.splash-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.splash-body h3 {
  margin: 0 0 4px 0;
  font-family: var(--font-family, 'Inter', system-ui, -apple-system, sans-serif);
  font-size: 0.88rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
}

.splash-body ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  margin: 0;
}

.splash-body li {
  font-family: var(--font-family, 'Inter', system-ui, -apple-system, sans-serif);
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  position: relative;
  padding-left: 18px;
}

.splash-body li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-size: 0.85rem;
  line-height: 1.5;
}

.splash-body strong {
  color: var(--text-main);
  font-weight: 600;
}

.splash-footer {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}

#splash-ok-btn {
  width: 100%;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #ffffff;
  border: 1px solid var(--primary-dark);
  border-radius: var(--card-radius, 5px);
  font-family: var(--font-family, 'Inter', system-ui, -apple-system, sans-serif);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
  text-decoration: none;
}

#splash-ok-btn:hover {
  background: var(--primary-dark);
}

.splash-footer {
  display: flex;
  justify-content: center;
}

/* Header Actions & Theme Toggle Button (Square 34x34, 5px radius) */
.theme-btn,
.help-btn,
.assistant-btn {
  pointer-events: auto;
  position: static;
  width: 34px;
  height: 34px;
  border-radius: 5px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 210;
  background: var(--btn-bg, #172033);
  border: 1px solid var(--btn-border, rgba(255, 255, 255, 0.14));
  color: var(--text-main, #fff);
  box-shadow: var(--card-shadow, 0 2px 6px rgba(0, 0, 0, 0.4));
  padding: 0;
  flex-shrink: 0;
}

.theme-btn:hover,
.help-btn:hover,
.assistant-btn:hover {
  transform: scale(1.05);
  background: var(--btn-hover-bg, rgba(255, 255, 255, 0.15));
  border-color: var(--card-border-light, rgba(255, 255, 255, 0.25));
}

.assistant-btn.active {
  background: #1e40af;
  color: #ffffff;
  border-color: #3b82f6;
}

[data-theme="light"] .assistant-btn.active {
  background: #3b82f6;
  color: #ffffff;
  border-color: #1d4ed8;
}

.help-btn {
  font-size: 1.1rem;
  font-weight: 700;
}

.theme-icon-svg {
  display: block;
  color: var(--text-main);
  pointer-events: none;
}

/* Close button for Property panels */
.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.5rem;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
}

.close-btn:hover {
  color: var(--text-main, #fff);
}

/* Data Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-align: left;
}

.data-table thead {
  border-bottom: 1px solid var(--glass-border);
}

.data-table th {
  padding: 8px 6px;
  color: var(--text-muted);
  font-weight: 600;
}

.data-table td {
  padding: 8px 6px;
  color: var(--text-main);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Shared Keyframe Animations */
@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translate(30px, -50%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate(0, -50%) scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
/* Electric Fields and Forces Advanced - Simulation Specific Styles */

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

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-family);
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

#simulation-container {
  position: relative;
  width: 100%;
  height: 100%;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* ========================================================================== */
/* FULL-WIDTH DOCKED HEADER & FOOTER WORKSTATION LAYOUT                       */
/* ========================================================================== */

/* Top Full-Width Header Bar */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 52px;
  background: var(--card-bg, #0d1322);
  border-bottom: 1px solid var(--card-border, #1e293b);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 var(--spacing-viewport-edge, 20px);
  z-index: 200;
  user-select: none;
  box-sizing: border-box;
}

.header-brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.brand-mark:hover {
  opacity: 0.85;
  transform: scale(1.04);
  background: transparent;
  border: none;
}

.brand-logo-svg {
  display: block;
}

.brand-path-top {
  fill: #ffffff;
}

[data-theme="light"] .brand-path-top {
  fill: #1E3A8A;
}

.brand-path-bottom {
  fill: #14B8A6;
}

.assistant-logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 3px;
  transition: transform 0.2s ease;
}

.assistant-logo-icon:hover {
  transform: scale(1.08);
}

.header-title-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.header-title-block h1 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.01em;
}

.header-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
}

.meta-sep {
  opacity: 0.45;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Bottom Full-Width Footer Space */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--card-bg, #0d1322);
  border-top: 1px solid var(--card-border, #1e293b);
  box-shadow: 0 -2px 14px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 24px 12px 24px;
  z-index: 200;
  user-select: none;
  box-sizing: border-box;
  gap: 10px;
}

.footer-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 100%;
}

.control-group-box {
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-divider {
  width: 1px;
  height: 22px;
  background: var(--card-border, rgba(255, 255, 255, 0.15));
  margin: 0 4px;
}

.footer-attribution {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 4px;
  padding-bottom: 2px;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 4px 14px;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
}

.footer-link:hover {
  color: var(--primary);
  background: var(--btn-hover-bg, rgba(255, 255, 255, 0.08));
}

.footer-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Compact Control Styles */
.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
  height: 30px;
  gap: 5px;
  border-radius: 5px;
}

.compact-select {
  padding: 3px 8px;
  font-size: 0.76rem;
  height: 30px;
  border-radius: 5px;
  background: var(--input-bg, #0a0f1d);
  border: 1px solid var(--input-border, rgba(255, 255, 255, 0.14));
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  font-family: var(--font-family);
  box-sizing: border-box;
}

.compact-select:focus {
  border-color: var(--primary);
}

.compact-label {
  font-size: 0.73rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.compact-select-wrap,
.slider-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.compact-range {
  width: 70px;
  height: 4px;
  cursor: pointer;
}

.switch-sm {
  width: 32px;
  height: 18px;
}

.switch-sm .slider:before {
  height: 12px;
  width: 12px;
  left: 2px;
  bottom: 2px;
}

.switch-sm input:checked + .slider:before {
  transform: translateX(14px);
}

.toggle-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toggle-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.btn-conductor {
  background: rgba(245, 158, 11, 0.22);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fef3c7;
}

.btn-conductor:hover {
  background: rgba(245, 158, 11, 0.35);
}

.btn-gaussian {
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #ffffff;
}

.btn-gaussian:hover {
  background: rgba(56, 189, 248, 0.35);
}

.btn-view3d {
  background: rgba(168, 85, 247, 0.22);
  border: 1px solid rgba(168, 85, 247, 0.45);
  color: #f3e8ff;
}

.btn-view3d:hover {
  background: rgba(168, 85, 247, 0.35);
}

/* Specific Trash Bin Component (Bottom-Left in 2D space above footer) */
.trash-bin {
  pointer-events: none;
  position: absolute;
  top: auto;
  bottom: 108px;
  left: var(--spacing-viewport-edge, 20px);
  right: auto;
  width: 64px;
  height: 64px;
  background: #190b0e;
  border: 1px solid rgba(239, 68, 68, 0.45);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  border-radius: 5px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: rgba(255, 255, 255, 0.9);
  font-size: 2rem;
  opacity: 0;
  transition: transform 0.2s ease;
  z-index: 120;
  flex-direction: column;
}

.trash-bin.visible {
  opacity: 1;
  pointer-events: auto;
}

.trash-hint {
  position: absolute;
  left: 100%;
  right: auto;
  top: 50%;
  transform: translateY(-50%) translateX(12px);
  background: #0d1322;
  color: #fff;
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.trash-bin:hover .trash-hint,
.trash-bin.drag-over .trash-hint {
  opacity: 1;
  transform: translateY(-50%) translateX(20px);
}

.trash-bin.drag-over {
  background: rgba(239, 68, 68, 0.55);
  border-color: #ffaaaa;
  transform: scale(1.15) rotate(-5deg);
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.7);
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

/* Left Sidebar & Stacked Cards (Distance Table & Field Probe) */
#left-sidebar,
.left-sidebar {
  position: absolute;
  left: var(--spacing-viewport-edge, 20px);
  top: calc(var(--header-height, 52px) + var(--spacing-header-gap, 16px));
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-card-gap, 16px);
  pointer-events: none;
  z-index: 100;
  max-height: calc(100vh - var(--header-height, 52px) - var(--spacing-header-gap, 16px) - var(--footer-height-approx, 96px) - var(--spacing-footer-gap, 16px));
  overflow-y: auto;
}

.left-card {
  pointer-events: auto;
  position: relative;
  width: 100%;
  padding: 18px 20px;
  border-radius: 5px;
  background: var(--card-bg, #0d1322);
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.12));
  box-shadow: var(--card-shadow, 0 4px 16px rgba(0, 0, 0, 0.6));
  display: none;
  animation: none;
  box-sizing: border-box;
}

/* Component Distances Data Table */
.distance-table {
  width: 100%;
  color: var(--text-main);
  font-size: 0.9em;
  text-align: left;
  border-collapse: collapse;
}

.distance-table th {
  padding: 4px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--card-border, rgba(255, 255, 255, 0.2));
}

.distance-table td {
  padding: 4px;
  color: var(--text-main);
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.divider {
  width: 1px;
  height: 32px;
  background: var(--card-border, rgba(255, 255, 255, 0.1));
}

/* Charge Property Panel */
.charge-panel {
  pointer-events: auto;
  position: absolute;
  top: calc(var(--header-height, 52px) + var(--spacing-header-gap, 16px));
  right: var(--spacing-viewport-edge, 20px);
  transform: none;
  width: 320px;
  display: none;
  flex-direction: column;
  gap: 20px;
  animation: none;
  padding: 24px;
  cursor: grab;
  z-index: 100;
  border-radius: 5px;
  background: var(--card-bg, #0d1322);
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.12));
  box-shadow: var(--card-shadow, 0 4px 16px rgba(0, 0, 0, 0.6));
  max-height: calc(100vh - var(--header-height, 52px) - var(--spacing-header-gap, 16px) - var(--footer-height-approx, 96px) - var(--spacing-footer-gap, 16px));
  overflow-y: auto;
}

.charge-panel:active {
  cursor: grabbing;
}

.charge-panel.active {
  display: flex;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 12px;
  margin-bottom: 4px;
}

.panel-title {
  font-weight: 600;
  font-size: 1.1rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.control-group label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.hint {
  pointer-events: none;
  position: absolute;
  bottom: 120px;
  width: 100%;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  opacity: 0.8;
  animation: none;
  letter-spacing: 0.05em;
}

/* Custom scrollbar for scrollable panels */
#left-sidebar *::-webkit-scrollbar {
  width: 6px;
}
#left-sidebar *::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 3px;
}
#left-sidebar *::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}
#left-sidebar *::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Gaussian HUD & Preset Controls */
.gaussian-hud {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: #0d1322;
  border-radius: 5px;
  transition: none;
}

/* Gaussian HUD Enclosed Charge & Flux Summary Box */
.gaussian-summary-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  padding: 12px;
  margin-bottom: 14px;
}

.gaussian-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.gaussian-summary-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.gauss-val-qenc {
  font-family: monospace;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fbbf24;
}

.gaussian-counters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.gauss-counter-box {
  border-radius: 5px;
  padding: 7px 10px;
  text-align: center;
  transition: all 0.15s ease;
}

.gauss-counter-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.gauss-counter-num {
  font-size: 1.25rem;
  font-family: monospace;
  font-weight: 700;
  line-height: 1.2;
}

/* Inflow (Red) Box - Dark Mode */
.gauss-counter-inflow {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.gauss-counter-inflow .gauss-counter-label {
  color: #fca5a5;
}

.gauss-counter-inflow .gauss-counter-num {
  color: #ff6b6b;
}

/* Outflow (Blue) Box - Dark Mode */
.gauss-counter-outflow {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.gauss-counter-outflow .gauss-counter-label {
  color: #93c5fd;
}

.gauss-counter-outflow .gauss-counter-num {
  color: #60a5fa;
}

.gaussian-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 0.8rem;
}

.gaussian-stat-row:first-of-type {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
}

.gaussian-stat-label {
  color: var(--text-muted);
}

.gaussian-stat-val {
  font-family: monospace;
  font-weight: 700;
  color: var(--text-main);
}

.gauss-val-expected {
  color: #34d399;
}

.gauss-val-flux {
  color: #38bdf8;
}

/* Conductor HUD */
.conductor-hud {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: #0d1322;
  border-radius: 5px;
  transition: none;
}

.btn-preset {
  background: #172033;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.76rem;
  padding: 6px 4px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  white-space: nowrap;
}

.btn-preset:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.btn-preset.active {
  background: rgba(56, 189, 248, 0.25);
  border-color: rgba(56, 189, 248, 0.6);
  color: #7dd3fc;
  font-weight: 600;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

/* Toast Notifications */
.toast-notification {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 5px;
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.2px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
}

.toast-notification.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-notification.toast-warning {
  border-color: rgba(251, 191, 36, 0.6);
  color: #fef3c7;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(251, 191, 36, 0.3);
}

.toast-notification.toast-success {
  border-color: rgba(52, 211, 153, 0.6);
  color: #d1fae5;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(52, 211, 153, 0.3);
}


.drawing-canvas {
  cursor: crosshair !important;
}

.surface-hover-canvas {
  cursor: move !important;
}

/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* 3D POTENTIAL & EQUIPOTENTIAL FLOATING POPUP CARD                           */
/* -------------------------------------------------------------------------- */
.view3d-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 660px;
  height: 500px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 40px);
  border-radius: 5px;
  overflow: hidden;
  background: var(--card-bg, #0d1322);
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.18));
  box-shadow: var(--card-shadow, 0 16px 40px rgba(0, 0, 0, 0.8));
  display: flex;
  flex-direction: column;
  z-index: 95;
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), height 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.view3d-container.expanded {
  width: min(980px, calc(100vw - 40px));
  height: min(740px, calc(100vh - 40px));
}

.view3d-card-header {
  height: 44px;
  padding: 0 14px;
  background: var(--btn-bg, rgba(255, 255, 255, 0.05));
  border-bottom: 1px solid var(--card-border, rgba(255, 255, 255, 0.12));
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  cursor: grab;
  flex-shrink: 0;
}

.view3d-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.view3d-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.view3d-card-btn {
  background: var(--btn-bg, rgba(255, 255, 255, 0.08));
  border: 1px solid var(--btn-border, rgba(255, 255, 255, 0.18));
  color: var(--text-main, #fff);
  border-radius: 5px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.view3d-card-btn:hover {
  background: var(--btn-hover-bg, rgba(255, 255, 255, 0.18));
  border-color: var(--card-border-light, rgba(255, 255, 255, 0.35));
}

.view3d-close-btn:hover {
  background: rgba(239, 68, 68, 0.35) !important;
  border-color: rgba(239, 68, 68, 0.6) !important;
  color: #fee2e2 !important;
}

.canvas3d-wrapper {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

#fieldCanvas3D {
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
}

/* 3D Floating HUD Overlay (Solid, 5px radius) */
.view3d-hud {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 280px;
  max-height: calc(100% - 24px);
  overflow-y: auto;
  padding: 12px 14px;
  z-index: 100;
  pointer-events: auto;
  user-select: none;
  background: var(--card-bg, #0f172a);
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.15));
  border-radius: 5px;
  box-shadow: var(--card-shadow, 0 8px 24px rgba(0, 0, 0, 0.7));
  display: none;
}

.view3d-hud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border, rgba(255, 255, 255, 0.12));
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.view3d-hud-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.view3d-control-group {
  display: flex;
  flex-direction: column;
}

.view3d-group-title {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  font-weight: 600;
}

.view3d-pill-group {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.35);
  padding: 3px;
  border-radius: 5px;
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.08));
}

.view3d-pill-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: var(--font-family);
  font-weight: 500;
  padding: 6px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.view3d-pill-btn:hover {
  color: var(--text-main, #fff);
  background: var(--btn-hover-bg, rgba(255, 255, 255, 0.05));
}

.view3d-pill-btn.active {
  background: rgba(168, 85, 247, 0.3);
  color: #f3e8ff;
  border: 1px solid rgba(168, 85, 247, 0.5);
  font-weight: 600;
}

.view3d-select {
  background: var(--input-bg, rgba(255, 255, 255, 0.08));
  border: 1px solid var(--input-border, rgba(255, 255, 255, 0.18));
  color: var(--text-main, #fff);
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-family: var(--font-family);
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.view3d-select:focus {
  border-color: #a855f7;
}

.view3d-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--card-border, rgba(255, 255, 255, 0.1));
}

.view3d-hud-footer {
  margin-top: 10px;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
  letter-spacing: 0.02em;
}

/* 2D Pan & Zoom Floating Controls (Solid, 5px radius) */
.zoom-controls {
  position: fixed;
  bottom: 108px;
  right: var(--spacing-viewport-edge, 20px);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 5px;
  background: var(--card-bg, #0d1322);
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.12));
  box-shadow: var(--card-shadow, 0 4px 16px rgba(0, 0, 0, 0.6));
  z-index: 150;
  user-select: none;
}

.zoom-btn {
  background: var(--btn-bg, rgba(255, 255, 255, 0.08));
  border: 1px solid var(--btn-border, rgba(255, 255, 255, 0.18));
  color: var(--text-main, #fff);
  border-radius: 5px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.zoom-btn:hover {
  background: var(--btn-hover-bg, rgba(255, 255, 255, 0.22));
  transform: scale(1.05);
}

.zoom-btn.reset-zoom {
  font-size: 1rem;
}

.zoom-level-text {
  font-size: 0.74rem;
  font-family: monospace;
  color: var(--text-muted);
  min-width: 38px;
  text-align: center;
}

/* -------------------------------------------------------------------------- */
/* LIGHT MODE THEME OVERRIDES (Classic PC Beige Aesthetic)                    */
/* -------------------------------------------------------------------------- */
[data-theme="light"] body {
  background-color: var(--bg-color);
  color: var(--text-main);
}

[data-theme="light"] .liquid-glass,
[data-theme="light"] .header,
[data-theme="light"] .controls,
[data-theme="light"] .charge-panel,
[data-theme="light"] .left-card,
[data-theme="light"] .view3d-container,
[data-theme="light"] .view3d-hud,
[data-theme="light"] .gaussian-hud,
[data-theme="light"] .conductor-hud,
[data-theme="light"] .trash-hint {
  background: var(--card-bg) !important;
  border-color: var(--card-border) !important;
  color: var(--text-main) !important;
  box-shadow: var(--card-shadow) !important;
}

[data-theme="light"] .splash-modal {
  background: var(--card-bg) !important;
  border-color: var(--card-border) !important;
  color: var(--text-main) !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

[data-theme="light"] .app-header {
  background: var(--card-bg) !important;
  border-color: var(--card-border) !important;
  color: var(--text-main) !important;
  box-shadow: 0 2px 14px rgba(255, 255, 255, 0.92) !important;
}

[data-theme="light"] .app-footer {
  background: var(--card-bg) !important;
  border-color: var(--card-border) !important;
  color: var(--text-main) !important;
  box-shadow: 0 -2px 14px rgba(255, 255, 255, 0.92) !important;
}

[data-theme="light"] .zoom-controls,
[data-theme="light"] .theme-btn,
[data-theme="light"] .help-btn,
[data-theme="light"] .assistant-btn {
  background: var(--card-bg) !important;
  border-color: var(--card-border) !important;
  color: var(--text-main) !important;
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.9) !important;
}

[data-theme="light"] .header-title-block h1,
[data-theme="light"] .header h1,
[data-theme="light"] .splash-header h1,
[data-theme="light"] .splash-header h2,
[data-theme="light"] .gradient-title,
[data-theme="light"] .panel-title {
  color: var(--text-main) !important;
  text-shadow: none !important;
}

/* Light Mode Card Typography & High-Contrast Black Text */
[data-theme="light"] .panel-title,
[data-theme="light"] .view3d-card-title span,
[data-theme="light"] .view3d-group-title,
[data-theme="light"] .control-group label,
[data-theme="light"] .toggle-label,
[data-theme="light"] .compact-label,
[data-theme="light"] .header-title-block h1,
[data-theme="light"] .splash-header h1,
[data-theme="light"] .splash-header h2,
[data-theme="light"] .splash-body h3,
[data-theme="light"] .splash-body strong,
[data-theme="light"] #distance-panel,
[data-theme="light"] #distance-panel .panel-title,
[data-theme="light"] .distance-table,
[data-theme="light"] .distance-table th,
[data-theme="light"] .distance-table td,
[data-theme="light"] #probe-panel,
[data-theme="light"] #probe-panel label,
[data-theme="light"] #probe-panel div,
[data-theme="light"] #charge-panel,
[data-theme="light"] #charge-panel label,
[data-theme="light"] #charge-panel div,
[data-theme="light"] #charge-panel span,
[data-theme="light"] #gaussian-card,
[data-theme="light"] #gaussian-card div,
[data-theme="light"] #gaussian-card span,
[data-theme="light"] #conductor-card,
[data-theme="light"] #conductor-card div,
[data-theme="light"] #conductor-card span {
  color: #000000;
}

[data-theme="light"] .header-meta,
[data-theme="light"] .footer-link,
[data-theme="light"] .distance-table th,
[data-theme="light"] .splash-body li {
  color: #2d3748 !important;
}

/* Light Mode Sub-panel Containers (Soft tinted insets instead of black translucent) */
[data-theme="light"] div[style*="background: rgba(0, 0, 0"],
[data-theme="light"] div[style*="background: rgba(0,0,0"] {
  background: rgba(0, 0, 0, 0.05) !important;
  border-color: rgba(70, 60, 50, 0.22) !important;
}

/* Light Mode Status Metric Colors (High Contrast AAA) */
[data-theme="light"] #probe-field-x,
[data-theme="light"] #probe-field-y {
  color: #047857 !important; /* Deep Emerald */
}

[data-theme="light"] #probe-field-mag {
  color: #065f46 !important; /* Dark Forest Green */
}

[data-theme="light"] #probe-potential {
  color: #0369a1 !important; /* Deep Azure */
}

[data-theme="light"] #energy-val {
  color: #b45309 !important; /* Deep Amber */
}

[data-theme="light"] #gauss-qenc {
  color: #b45309 !important; /* Deep Amber */
}

[data-theme="light"] #gauss-calc-flux {
  color: #0369a1 !important; /* Deep Azure */
}

[data-theme="light"] #gauss-expected {
  color: #047857 !important; /* Deep Emerald */
}

/* High Contrast Light Mode Gaussian Surface HUD */
[data-theme="light"] .gaussian-summary-box {
  background: rgba(0, 0, 0, 0.04) !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
}

[data-theme="light"] .gaussian-summary-label,
[data-theme="light"] .gaussian-stat-label {
  color: #334155 !important;
}

[data-theme="light"] .gaussian-counters-grid,
[data-theme="light"] .gaussian-stat-row:first-of-type {
  border-top-color: rgba(0, 0, 0, 0.1) !important;
}

/* Inflow (Red) Box - Light Mode High Contrast */
[data-theme="light"] .gauss-counter-inflow {
  background: rgba(220, 38, 38, 0.14) !important;
  border: 1.5px solid #dc2626 !important;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.15) !important;
}

[data-theme="light"] .gauss-counter-inflow .gauss-counter-label {
  color: #991b1b !important; /* Deep dark crimson, WCAG AAA 7.8:1 contrast */
  font-weight: 800 !important;
}

[data-theme="light"] .gauss-counter-inflow .gauss-counter-num {
  color: #b91c1c !important; /* Bold vivid scarlet red, WCAG AAA 7.2:1 contrast */
  font-weight: 800 !important;
}

/* Outflow (Blue) Box - Light Mode High Contrast */
[data-theme="light"] .gauss-counter-outflow {
  background: rgba(37, 99, 235, 0.14) !important;
  border: 1.5px solid #2563eb !important;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.15) !important;
}

[data-theme="light"] .gauss-counter-outflow .gauss-counter-label {
  color: #1e3a8a !important; /* Deep dark navy blue, WCAG AAA 8.5:1 contrast */
  font-weight: 800 !important;
}

[data-theme="light"] .gauss-counter-outflow .gauss-counter-num {
  color: #1d4ed8 !important; /* Bold vivid royal blue, WCAG AAA 7.5:1 contrast */
  font-weight: 800 !important;
}

[data-theme="light"] .distance-table th {
  border-bottom: 1px solid rgba(70, 60, 50, 0.3) !important;
  color: #000000 !important;
  font-weight: 700 !important;
}

[data-theme="light"] .distance-table td {
  border-bottom: 1px solid rgba(70, 60, 50, 0.15);
  color: #000000 !important;
}

[data-theme="light"] select,
[data-theme="light"] .compact-select,
[data-theme="light"] input[type="text"]:not(.assistant-input),
[data-theme="light"] input[type="number"] {
  background: var(--input-bg) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--input-border) !important;
  box-shadow: inset 0 1px 3px rgba(60, 50, 40, 0.12) !important;
}

[data-theme="light"] input[type="number"] {
  color-scheme: light !important;
}

[data-theme="light"] .footer-divider {
  background: var(--card-border) !important;
}

[data-theme="light"] .footer-link {
  color: var(--text-muted) !important;
}

[data-theme="light"] .footer-link:hover {
  color: var(--primary) !important;
}

[data-theme="light"] .btn-conductor {
  background: #fde68a !important;
  border-color: #d97706 !important;
  color: #78350f !important;
}

[data-theme="light"] .btn-conductor:hover {
  background: #fcd34d !important;
}

[data-theme="light"] .btn-gaussian {
  background: #e0f2fe !important;
  border-color: #0284c7 !important;
  color: #0369a1 !important;
}

[data-theme="light"] .btn-gaussian:hover {
  background: #bae6fd !important;
}

[data-theme="light"] .btn-view3d {
  background: #f3e8ff !important;
  border-color: #7c3aed !important;
  color: #5b21b6 !important;
}

[data-theme="light"] .btn-view3d:hover {
  background: #e9d5ff !important;
}

[data-theme="light"] input[type="range"] {
  background: rgba(70, 60, 50, 0.18) !important;
  border: 1px solid rgba(70, 60, 50, 0.15) !important;
  box-shadow: inset 0 1px 2px rgba(60, 50, 40, 0.2) !important;
}

[data-theme="light"] input[type="range"]::-webkit-slider-thumb {
  background: radial-gradient(circle at 30% 30%, #ffffff, #cfc7b9) !important;
  box-shadow: 0 1px 4px rgba(60, 50, 40, 0.4) !important;
}

[data-theme="light"] .btn-preset {
  background: var(--btn-bg) !important;
  border-color: var(--btn-border) !important;
  color: var(--text-muted) !important;
}

[data-theme="light"] .btn-preset:hover {
  background: var(--btn-hover-bg) !important;
  color: var(--text-main) !important;
  border-color: var(--card-border-light) !important;
}

[data-theme="light"] .btn-preset.active {
  background: #0284c7 !important;
  border-color: #0369a1 !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

[data-theme="light"] .view3d-card-header {
  background: var(--btn-bg) !important;
  border-bottom: 1px solid var(--card-border) !important;
}

[data-theme="light"] .view3d-card-title span {
  color: var(--text-main) !important;
}

[data-theme="light"] .view3d-pill-group {
  background: rgba(70, 60, 50, 0.1) !important;
  border-color: var(--card-border) !important;
}

[data-theme="light"] .view3d-pill-btn {
  color: var(--text-muted) !important;
}

[data-theme="light"] .view3d-pill-btn:hover {
  color: var(--text-main) !important;
  background: var(--btn-hover-bg) !important;
}

[data-theme="light"] .view3d-pill-btn.active {
  background: #7c3aed !important;
  color: #ffffff !important;
  border-color: #6d28d9 !important;
  box-shadow: none !important;
}

[data-theme="light"] .trash-bin {
  background: #f5d0d0 !important;
  border-color: #ef4444 !important;
  color: #991b1b !important;
}

[data-theme="light"] .toast-notification {
  background: #e8e2d5 !important;
  border: 1px solid rgba(70, 60, 50, 0.3) !important;
  color: #1a202c !important;
  box-shadow: 0 10px 25px rgba(60, 50, 40, 0.25) !important;
}

[data-theme="light"] #left-sidebar *::-webkit-scrollbar-track {
  background: rgba(70, 60, 50, 0.08) !important;
}

[data-theme="light"] #left-sidebar *::-webkit-scrollbar-thumb {
  background: rgba(70, 60, 50, 0.28) !important;
}

[data-theme="light"] #left-sidebar *::-webkit-scrollbar-thumb:hover {
  background: rgba(70, 60, 50, 0.45) !important;
}

/* ========================================================================== */
/* LABASSIST QA ASSISTANT MODAL & MATHML (Cambria Math)                       */
/* ========================================================================== */

/* ==========================================================================
   LABASSIST CARD AND DIALOGUE STYLES
   ========================================================================== */

.lab-assistant-card,
.lab-assistant-card button,
.lab-assistant-card input,
.lab-assistant-card select {
  font-family: var(--font-family, 'Inter', system-ui, -apple-system, sans-serif);
}

.lab-assistant-card ::selection,
.assistant-input::selection {
  background: rgba(56, 189, 248, 0.35);
  color: #ffffff;
}

[data-theme="light"] .lab-assistant-card ::selection,
[data-theme="light"] .assistant-input::selection {
  background: rgba(2, 132, 199, 0.25);
  color: #000000;
}

.lab-assistant-card {
  position: fixed;
  top: 60px;
  left: max(20px, calc(50vw - 310px));
  width: 620px;
  max-width: calc(100vw - 40px);
  height: 560px;
  max-height: calc(100vh - 80px);
  min-width: 320px;
  min-height: 280px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
  padding: 14px 16px;
  gap: 10px;
  box-sizing: border-box;
  resize: both;
  overflow: hidden;
}

[data-theme="light"] .lab-assistant-card {
  box-shadow: 0 8px 24px rgba(70, 60, 50, 0.18);
}

.lab-assistant-card.hidden {
  display: none !important;
}

/* Corner Resizer Handle (Bottom-Right, Dual Diagonal Tactile Ridges) */
.lab-assistant-card::-webkit-resizer {
  background: transparent;
}

.lab-assistant-card::after {
  content: '';
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 10px;
  height: 10px;
  pointer-events: none;
  background: linear-gradient(135deg,
      transparent 0%, transparent 40%,
      var(--text-subtle) 40%, var(--text-subtle) 50%,
      transparent 50%, transparent 70%,
      var(--text-subtle) 70%, var(--text-subtle) 80%,
      transparent 80%, transparent 100%);
  opacity: 0.65;
}

.assistant-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--card-border);
  cursor: grab;
  user-select: none;
}

.assistant-header.is-dragging {
  cursor: grabbing;
}

.assistant-header a,
.assistant-header button {
  cursor: pointer;
  user-select: auto;
}

.assistant-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.assistant-logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: 5px;
  flex-shrink: 0;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.assistant-logo-icon:hover {
  background: var(--btn-hover-bg);
  border-color: var(--primary);
}

.assistant-title-block h3,
.assistant-title-row h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Close Button: Square with 5px Rounded Corners */
.hover-card-close-btn,
#close-assistant-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: 5px;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  box-sizing: border-box;
  padding: 0;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.hover-card-close-btn:hover,
#close-assistant-btn:hover {
  color: var(--text-main);
  background: var(--btn-hover-bg);
  border-color: var(--primary);
}

/* Starter Question Chips Ribbon */
.assistant-chips-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
  padding: 4px 0;
}

.assistant-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 9px;
  box-sizing: border-box;
  font-family: var(--font-family, 'Inter', system-ui, -apple-system, sans-serif);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1;
  border-radius: 4px;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.assistant-chip:hover {
  color: var(--text-main);
  background: var(--btn-hover-bg);
  border-color: var(--primary);
}

/* Scrollable Dialogue Log */
.assistant-log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 4px 8px 0;
  font-size: 0.82rem;
  line-height: 1.5;
}

.assistant-welcome {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  padding: 12px 14px;
  color: var(--text-muted);
}

.assistant-welcome p {
  margin: 0 0 6px 0;
}

.assistant-welcome p:last-child {
  margin: 0;
}

/* Message Bubbles */
.assistant-message,
.assistant-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.assistant-message.user,
.assistant-msg-user {
  align-items: flex-end;
}

.user-bubble,
.assistant-msg-user .msg-bubble {
  background: var(--primary-dark);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 5px;
  max-width: 85%;
  font-weight: 500;
  font-size: 0.80rem;
}

[data-theme="light"] .user-bubble,
[data-theme="light"] .assistant-msg-user .msg-bubble {
  background: var(--primary);
}

.assistant-message.assistant,
.assistant-msg-bot {
  align-items: flex-start;
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: 5px;
  padding: 10px 12px;
}

/* Assistant Thinking Indicator with 4 Scrolling / Pulsing Dots */
.assistant-message.assistant-thinking,
.assistant-thinking {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: 5px;
  width: fit-content;
}

.thinking-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 14px;
}

.thinking-dots span,
.thinking-dots .dot,
.thinking-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.3;
  animation: dot-wave 1.4s ease-in-out infinite;
}

.thinking-dots span:nth-child(1),
.thinking-dots .dot:nth-child(1),
.thinking-dot:nth-child(1) { animation-delay: 0.0s; }
.thinking-dots span:nth-child(2),
.thinking-dots .dot:nth-child(2),
.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3),
.thinking-dots .dot:nth-child(3),
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }
.thinking-dots span:nth-child(4),
.thinking-dots .dot:nth-child(4),
.thinking-dot:nth-child(4) { animation-delay: 0.6s; }

@keyframes dot-wave {
  0%, 100% {
    transform: translateY(0) scale(0.85);
    opacity: 0.3;
  }
  30% {
    transform: translateY(-5px) scale(1.15);
    opacity: 1;
  }
  60% {
    transform: translateY(0) scale(0.95);
    opacity: 0.45;
  }
}

.assistant-reply-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 4px;
  width: 100%;
}

.assistant-reply-body,
.assistant-msg-bot .msg-bubble {
  color: var(--text-main);
}

.assistant-reply-body p,
.assistant-msg-bot .msg-bubble p {
  margin: 0 0 6px 0;
}

.assistant-reply-body p:last-child,
.assistant-msg-bot .msg-bubble p:last-child {
  margin: 0;
}

.assistant-reply-body ul,
.assistant-msg-bot .msg-bubble ul {
  margin: 4px 0 6px 0;
  padding-left: 18px;
}

.assistant-reply-body li,
.assistant-msg-bot .msg-bubble li {
  margin-bottom: 3px;
}

.assistant-reply-body code,
.assistant-msg-bot .msg-bubble code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  padding: 1px 4px;
  border-radius: 3px;
}

/* Input Form */
.assistant-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  border-top: 1px solid var(--card-border);
  padding-top: 10px;
}

.prompt-symbol {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--primary);
  font-size: 0.95rem;
}

.assistant-input,
.lab-assistant-card input[type="text"].assistant-input,
.assistant-form .assistant-input {
  flex: 1;
  width: 100%;
  max-width: 100%;
  text-align: left;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--card-radius);
  color: var(--text-main);
  padding: 7px 12px;
  font-size: 0.82rem;
  font-family: var(--font-family, 'Inter', system-ui, -apple-system, sans-serif);
  line-height: 1.4;
  outline: none;
  box-shadow: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.assistant-input:focus,
.lab-assistant-card input[type="text"].assistant-input:focus,
.assistant-form .assistant-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
  outline: none;
}

[data-theme="light"] .assistant-input:focus,
[data-theme="light"] .lab-assistant-card input[type="text"].assistant-input:focus,
[data-theme="light"] .assistant-form .assistant-input:focus {
  border-color: var(--primary-dark);
  box-shadow: 0 0 0 1px var(--primary-dark);
}

.assistant-send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #ffffff;
  border: 1px solid var(--primary-dark);
  border-radius: var(--card-radius);
  padding: 7px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.assistant-send-btn:hover {
  background: var(--primary-dark);
}

/* Authentic OMML / Cambria MathML Typography */
math, .math-omml {
  font-family: "Cambria Math", "STIX Two Math", "Latin Modern Math", "Cambria", "Times New Roman", serif;
  font-size: 1.05em;
  letter-spacing: 0.01em;
  font-style: normal;
  color: var(--text-main);
}

math[display="inline"] {
  display: inline;
  vertical-align: -0.15em;
}

math mi {
  font-style: italic;
  font-family: inherit;
}

math mo, math mn {
  font-style: normal;
  font-family: inherit;
}

math mfrac {
  padding: 0 2px;
}

.math-eq-row {
  display: block;
  margin: 6px 0;
  padding: 4px 6px;
  background: var(--input-bg);
  border-radius: 4px;
  text-align: center;
}


