/*
  MOSFET Semiconductor Laboratory - Workstation 2.0 Standard
  Author: Dr. Gerard Joseph Lim
  Design Standard: Liquid Glass & Workstation 2.0 (DESIGN_SYSTEM.md)
*/

:root,
[data-theme="dark"] {
  --bg-deep: #030712;
  --bg-primary: #030712;
  --bg-secondary: #0a0a0a;
  --card-bg: #0d1322;
  --card-border: #1e293b;
  --card-border-highlight: #334155;
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  --card-radius: 5px;

  --primary: #38bdf8;
  --primary-dark: #0284c7;
  --primary-light: #7dd3fc;
  --primary-hover: #7dd3fc;
  --primary-cyan: #38bdf8;

  --accent-gold: #fbbf24;
  --accent-rose: #fb7185;
  --accent-emerald: #34d399;

  --text-main: #ffffff;
  --text-primary: #ffffff;
  --text-muted: #cbd5e1;
  --text-dim: rgba(255, 255, 255, 0.45);
  --text-subtle: #94a3b8;

  --btn-bg: #172033;
  --btn-border: rgba(255, 255, 255, 0.14);
  --btn-hover-bg: rgba(255, 255, 255, 0.15);

  --input-bg: #0a0f1d;
  --input-border: rgba(255, 255, 255, 0.14);

  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-main: var(--font-family);
  --font-math: "Cambria Math", "STIX Two Math", "Latin Modern Math", "Cambria", "Times New Roman", serif;

  /* Standard Workstation Spacing Tokens */
  --header-height: 52px;
  --footer-height: 48px;
  --spacing-header-gap: 16px;
  --spacing-footer-gap: 16px;
  --spacing-viewport-edge: 20px;
  --spacing-card-gap: 16px;
}

[data-theme="light"] {
  --bg-deep: #f5f0e8;
  --bg-primary: #f5f0e8;
  --bg-secondary: #ede7dc;
  --card-bg: #e8e2d5;
  --card-border: rgba(70, 60, 50, 0.25);
  --card-border-highlight: rgba(70, 60, 50, 0.4);
  --card-shadow: 0 1px 3px rgba(70, 60, 50, 0.12), 0 1px 2px rgba(70, 60, 50, 0.08);
  --card-radius: 5px;

  --primary: #0284c7;
  --primary-dark: #0369a1;
  --primary-light: #0ea5e9;
  --primary-hover: #0369a1;
  --primary-cyan: #0284c7;

  --accent-gold: #d97706;
  --accent-rose: #dc2626;
  --accent-emerald: #059669;

  --text-main: #000000;
  --text-primary: #000000;
  --text-muted: #1e293b;
  --text-dim: #4a5568;
  --text-subtle: #334155;

  --btn-bg: #dfd8cb;
  --btn-border: rgba(70, 60, 50, 0.28);
  --btn-hover-bg: #d4ccbe;

  --input-bg: #fcfbf7;
  --input-border: rgba(70, 60, 50, 0.32);
}

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

body.glass-simulation-body {
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-family);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* App Shell (Version 2.0 Workstation Full-Viewport Shell) */
.app-shell,
.mosfet-app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  background: var(--bg-deep);
}

/* ========================================================================== */
/* TOP HEADER (Workstation Standard, 52px Full-Width Docked Framing)          */
/* ========================================================================== */

.app-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--header-height);
  min-height: var(--header-height);
  padding: 0 var(--spacing-viewport-edge);
  border-radius: 0;
  background: var(--card-bg);
  border: none;
  border-bottom: 1px solid var(--card-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  margin: 0;
  flex-shrink: 0;
  z-index: 100;
  box-sizing: border-box;
  width: 100%;
}

.header-brand-block,
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark,
.brand-link {
  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,
.brand-link:hover {
  opacity: 0.85;
  transform: scale(1.04);
}

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

.meta-sep {
  opacity: 0.5;
}

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

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

.brand-path-bottom {
  fill: #14B8A6; /* Signature Teal */
}

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

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

.header-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

/* Standardized 34px Utility Action Buttons */
.theme-btn,
.assistant-btn,
.help-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--card-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--text-primary);
  padding: 0;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.theme-btn:hover,
.assistant-btn:hover,
.help-btn:hover {
  background: var(--btn-hover-bg);
  border-color: var(--primary);
  color: var(--primary);
}

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

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

.sun-icon.hidden,
.moon-icon.hidden {
  display: none !important;
}

/* ========================================================================== */
/* WORKSTATION WORKSPACE: Main Layout & Card Spacing                          */
/* ========================================================================== */

.workstation-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px var(--spacing-viewport-edge);
  margin: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.workspace-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
  gap: 8px;
  flex: 1;
  min-height: 0;
  margin: 0;
}

.left-pane,
.right-pane {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 8px 12px;
}

.pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.pane-title-group {
  display: flex;
  flex-direction: column;
}

.pane-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.pane-sub {
  font-size: 0.70rem;
  color: var(--text-muted);
}

.toggle-pill-btn {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.toggle-pill-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--primary);
  color: var(--primary);
}

/* Semiconductor Cross-Section Canvas */
.canvas-wrapper {
  flex: 1.25;
  min-height: 120px;
  position: relative;
  background: var(--input-bg);
  border-radius: var(--card-radius);
  border: 1px solid var(--card-border);
  overflow: hidden;
}

#deviceCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Energy Band Diagram Canvas */
.band-diagram-wrapper {
  flex: 1;
  min-height: 120px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  background: var(--input-bg);
  border-radius: var(--card-radius);
  border: 1px solid var(--card-border);
  overflow: hidden;
  padding: 6px 10px;
}

.band-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.band-title {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--accent-gold);
}

.band-telemetry-text {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

#bandCanvas {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: block;
}

/* ========================================================================== */
/* RIGHT PANE: Mathematical Theory HUD & I-V Graph                            */
/* ========================================================================== */

.theory-hud-card {
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.hud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.regime-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.regime-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-gold);
}

.regime-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.hud-condition {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--btn-bg);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--btn-border);
}

.math-display-box {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 6px;
  padding: 4px 8px;
  background: var(--input-bg);
  border-radius: 4px;
  border: 1px solid var(--card-border);
}

.formula-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  line-height: 1.25;
  min-width: 0;
}

.math-label {
  font-weight: 600;
  color: var(--primary);
  width: 76px;
  flex-shrink: 0;
  font-size: 0.70rem;
}

.math-expr {
  font-family: var(--font-math);
  color: var(--text-primary);
  letter-spacing: 0.01em;
  min-width: 0;
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: thin;
}

.telemetry-compact-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.telemetry-cell {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 4px;
  padding: 3px 6px;
  display: flex;
  flex-direction: column;
  cursor: help;
  transition: border-color 0.15s ease;
}

.telemetry-cell:hover {
  border-color: var(--primary);
}

.cell-label {
  font-size: 0.60rem;
  color: var(--text-muted);
  margin-bottom: 1px;
}

.cell-val {
  font-size: 0.80rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.cell-val.highlight {
  color: var(--primary);
}

.cell-val.mono {
  font-family: var(--font-mono);
}

/* I-V Graph Section */
.graph-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  padding: 8px 12px;
}

.graph-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.graph-tab-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.graph-tab {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.graph-tab.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--primary);
  color: var(--primary);
}

.graph-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.graph-canvas-container {
  flex: 1;
  min-height: 0;
  position: relative;
}

#graphCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ========================================================================== */
/* BOTTOM CONTROLLER BAR                                                      */
/* ========================================================================== */

.controls-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  z-index: 10;
  margin: 0;
  box-sizing: border-box;
  padding: 0;
}

.controls {
  pointer-events: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 5px 10px;
  padding: 4px 10px;
  border-radius: var(--card-radius);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  max-width: 100%;
}

.ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ctrl-title {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.segmented-control {
  display: flex;
  background: var(--input-bg);
  border: 1px solid var(--btn-border);
  border-radius: 4px;
  padding: 2px;
  gap: 2px;
}

.segment-btn {
  font-size: 0.70rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 3px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.segment-btn.active {
  background: rgba(56, 189, 248, 0.2);
  color: var(--primary);
  font-weight: 600;
}

.slider-group {
  min-width: 120px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
}

.slider-badge {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--primary);
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  padding: 1px 5px;
  border-radius: 3px;
}

input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--btn-border);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--primary);
  cursor: pointer;
  transition: transform 0.1s;
}

[data-theme="light"] input[type="range"]::-webkit-slider-thumb {
  background: var(--primary);
  border-color: #ffffff;
}

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

.presets-group {
  display: flex;
  flex-direction: column;
}

.presets-row {
  display: flex;
  gap: 3px;
}

.btn-preset {
  font-size: 0.68rem;
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.divider {
  width: 1px;
  height: 28px;
  background: var(--card-border);
  flex-shrink: 0;
}

@media (max-width: 1240px) {
  .divider {
    display: none;
  }
  .controls {
    gap: 8px 10px;
  }
}

.btn {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: var(--card-radius);
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

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

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-secondary {
  background: var(--btn-bg);
  color: var(--text-muted);
}

/* ========================================================================== */
/* DOCKED WORKSTATION FOOTER (Centered Signature Standard)                    */
/* ========================================================================== */

.app-footer {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  height: var(--footer-height);
  min-height: var(--footer-height);
  padding: 0 var(--spacing-viewport-edge);
  background: var(--card-bg);
  border: none;
  border-top: 1px solid var(--card-border);
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.35);
  border-radius: 0;
  flex-shrink: 0;
  font-size: 0.76rem;
  color: var(--text-muted);
  box-sizing: border-box;
  margin: 0;
  z-index: 100;
  width: 100%;
}

[data-theme="light"] .app-footer {
  box-shadow: 0 -1px 3px rgba(70, 60, 50, 0.10);
}

.footer-center-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  text-align: center;
}

.signature-footer,
a.signature-footer {
  color: var(--text-muted);
  text-decoration: none;
  font-family: var(--font-family);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 4px 14px;
  border-radius: var(--card-radius);
  transition: all 0.2s ease;
}

.signature-footer:hover,
a.signature-footer:hover {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .signature-footer:hover,
[data-theme="light"] a.signature-footer:hover {
  color: var(--primary-dark);
  background: rgba(70, 60, 50, 0.08);
}

/* ========================================================================== */
/* MODALS (Strict 5px Radius Precision Standard)                              */
/* ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-card {
  width: 440px;
  max-width: 90vw;
  padding: 20px;
  border-radius: var(--card-radius);
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--card-border);
}

.modal-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--card-radius);
}

.close-btn:hover {
  color: var(--text-primary);
  background: var(--btn-hover-bg);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.param-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.param-row input[type="number"],
.param-row input[type="text"] {
  width: 90px;
  padding: 4px 8px;
  border-radius: var(--card-radius);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-align: right;
  outline: none;
}

.param-row input[type="number"]:focus {
  border-color: var(--primary);
}

.toggle-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Splash Modal (Launches on First Visit, 5px Radius, Zero Glass/Transparency) */
.splash-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

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

.splash-modal {
  width: 520px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 24px 28px;
  border-radius: var(--card-radius, 5px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  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-primary);
  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 ul li {
  position: relative;
  padding-left: 18px;
  font-family: var(--font-family, 'Inter', system-ui, -apple-system, sans-serif);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-muted);
}

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

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

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

#btn-get-started {
  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;
}

#btn-get-started:hover {
  background: var(--primary-dark);
}

.w-full {
  width: 100%;
}

/* ========================================================================== */
/* LABASSIST MODAL CARD (Draggable, Resizable, Standardized Ridges, 5px Standard) */
/* ========================================================================== */

/* ==========================================================================
   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);
}

/* ========================================================================== */
/* FLOATING DELAYED HOVER TOOLTIP FOR MOSFET TELEMETRY                        */
/* ========================================================================== */

.metric-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  max-width: 340px;
  padding: 11px 15px;
  background: var(--card-bg);
  border: 1px solid var(--primary);
  border-radius: var(--card-radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  color: var(--text-primary);
  font: 500 0.78rem/1.55 var(--font-family);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

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

.metric-tooltip.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transform: translateY(3px);
}

.metric-tooltip-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-tooltip-body {
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.55;
}

.metric-tooltip-body strong {
  color: var(--text-primary);
}

.metric-tooltip-body code {
  font-family: var(--font-mono);
  color: var(--primary);
  background: var(--btn-bg);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.72rem;
}

/* Authentic MathML Core Typography */
math {
  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-primary);
}

math[display="block"] {
  display: block;
  margin: 6px 0;
  padding: 4px 8px;
  text-align: center;
  background: var(--input-bg);
  border-radius: var(--card-radius);
}

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

.math-eq-row {
  margin: 4px 0;
}

/* Responsive Layout */
@media (max-width: 1024px) {
  .workspace-grid {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .controls {
    flex-wrap: wrap;
    justify-content: center;
  }
  .lab-assistant-card {
    top: 56px;
    left: 8px;
    width: calc(100vw - 16px);
    height: 70vh;
  }
}

@media (max-width: 960px) {
  .header-meta,
  .header-subtitle {
    display: none;
  }
}

@media (max-height: 750px) {
  .app-shell,
  .mosfet-app-container {
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
  }
  .workstation-main {
    overflow: visible;
    height: auto;
    min-height: 0;
  }
  .workspace-grid {
    min-height: 460px;
  }
}
