:root {
  --bg-color: #f8fafc;
  --panel-bg: #ffffff;
  --primary-color: #0B1329;
  --primary-hover: #1A2647;
  --primary-light: #EEF2F8;
  --primary-border: #C9D2E3;
  --secondary-color: #475569;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --navy: #0B1329;
  --navy-surface: #131D3B;
  --navy-border: #1A2647;
  --amber: #F5A524;
  --amber-gold: #FFD27A;
  --sky: #38bdf8;
  --emerald: #10b981;
  --rose: #f43f5e;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --font-display: 'Space Grotesk', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

*:not(mjx-container):not(mjx-container *) {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  padding: 1.25rem 1rem 3rem;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.container {
  max-width: 1200px;
  width: 100%;
}

/* ==================== STANDARD 11: MATHJAX DUAL-RULE CSS ==================== */
.math-display mjx-container,
mjx-container[display="true"] {
  display: block !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  margin: 0.4rem auto !important;
  text-align: center;
}

mjx-container:not([display="true"]) {
  display: inline-block !important;
  max-width: 100% !important;
  overflow: visible !important;
  margin: 0 0.12em !important;
  vertical-align: -0.15em !important;
  line-height: 0;
}

mjx-container svg {
  max-width: 100% !important;
  height: auto !important;
  display: inline-block;
  vertical-align: middle;
}

/* ==================== STANDARD 4.1 TOP NAVIGATION BAR ==================== */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1.15rem;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.nav-home-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #0284c7;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 0.15s ease;
}

.nav-home-btn:hover {
  color: #0369a1;
}

.brand-physics {
  color: #0284c7;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.nav-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-pill-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.nav-dept-tag {
  font-size: 0.82rem;
  color: #64748b;
  font-weight: 500;
}

/* ==================== STANDARD 22 CLEAN HEADER ARCHITECTURE ==================== */
.sim-header {
  text-align: left;
  margin-bottom: 1.5rem;
  padding: 0.25rem 0;
}

.sim-title {
  font-family: var(--font-display);
  font-size: 2.1rem;
  color: var(--primary-color);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
  line-height: 1.25;
}

.sim-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.55;
  max-width: 960px;
}

/* ==================== 2-COLUMN WORKSPACE GRID (c-layout) ==================== */
.lab-grid.c-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
  align-items: start;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.c-primary {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}

.c-side {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}

.panel {
  background: var(--panel-bg);
  border-radius: 16px;
  padding: 1.25rem;
  border: 1px solid #E2E6EE;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
}

.panel h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}

.panel h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.6rem;
}

/* ==================== INTERACTIVE STAGE (.c-stage) ==================== */
.c-stage.panel {
  padding: 0;
  background: var(--navy);
  border: 1px solid var(--navy);
  border-radius: 18px;
  overflow: hidden;
  color: #fff;
  box-shadow: 0 4px 16px rgba(11, 19, 41, 0.12);
}

/* Mode Switcher Tabs */
.c-mode-switcher {
  display: flex;
  background: #070c1a;
  border-bottom: 1px solid var(--navy-border);
  padding: 6px;
  gap: 6px;
}

.c-mode-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.88rem;
  transition: all 0.15s ease;
}

.c-mode-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
}

.c-mode-btn.active {
  background: var(--navy-surface);
  border-color: #22305A;
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Stage Bar (Controls & Telemetry) */
.c-stage-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.75rem 1rem;
  background: var(--navy);
  border-bottom: 1px solid var(--navy-border);
}

.c-stage-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.c-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 38px;
  padding: 0 0.95rem;
  border-radius: 10px;
  font: 700 0.88rem/1 var(--font-sans);
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.15s ease;
}

.c-btn-amber {
  border: 0;
  background: var(--amber);
  color: var(--navy);
  font-weight: 700;
}

.c-btn-amber:hover {
  filter: brightness(1.08);
}

.c-btn-ghost {
  border: 1px solid #33405F;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-weight: 600;
}

.c-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #4b5563;
}

.c-stage-telemetry {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.c-readout {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  background: var(--navy-surface);
  border: 1px solid #22305A;
}

.c-readout-label {
  font-size: 0.68rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.c-readout-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--amber-gold);
}

.c-speed-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  background: var(--navy-surface);
  border: 1px solid #22305A;
  font-size: 0.8rem;
  color: #cbd5e1;
}

.c-speed-pill input[type="range"] {
  width: 70px;
  accent-color: var(--amber);
  cursor: pointer;
  min-height: unset;
}

.c-speed-badge {
  font-weight: 700;
  color: var(--sky);
}

.lab-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: #cbd5e1;
  cursor: pointer;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  background: var(--navy-surface);
  border: 1px solid #22305A;
}

.lab-toggle input[type="checkbox"] {
  accent-color: var(--amber);
  cursor: pointer;
}

/* Canvas Box */
.c-stage .canvas-container {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #060913;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 480px;
}

.c-stage .canvas-container canvas {
  width: 100%;
  height: 480px;
  display: block;
  touch-action: none;
}

/* Stage Foot */
.c-stage-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1.15rem;
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--navy-border);
  background: #070c1a;
  font-size: 0.8rem;
  color: #94a3b8;
}

.c-key {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.c-key-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  flex-shrink: 0;
}

.c-tip {
  margin-left: auto;
  color: #fde047;
  font-weight: 600;
  font-size: 0.78rem;
}

/* ==================== 3-MINUTE INVESTIGATION CARD (.c-mission-card) ==================== */
.c-mission-card {
  background: #ffffff;
  border: 1.5px solid #0284c7;
  border-radius: 16px;
  padding: 1rem 1.15rem;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.c-mission-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #0284c7 0%, #38bdf8 50%, #f59e0b 100%);
}

.c-mission-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.c-mission-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.c-mission-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.c-mission-head h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-color);
  margin: 0;
}

.c-mission-step-counter {
  font-size: 0.7rem;
  font-weight: 700;
  color: #0284c7;
  background: #e0f2fe;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #bae6fd;
}

.c-mission-toggle-btn {
  background: transparent;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.c-mission-toggle-btn:hover {
  background: #f1f5f9;
  color: var(--primary-color);
}

.c-mission-chevron {
  transition: transform 0.2s ease;
}

.c-mission-card.collapsed .c-mission-chevron {
  transform: rotate(180deg);
}

.c-mission-collapsed-summary {
  display: none;
  font-size: 0.82rem;
  color: #475569;
  cursor: pointer;
  padding: 0.2rem 0;
}

.c-mission-card.collapsed .c-mission-collapsed-summary {
  display: block;
}

.c-mission-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.c-mission-card.collapsed .c-mission-body {
  display: none;
}

/* Step switcher pills */
.c-mission-steps-nav {
  display: flex;
  gap: 0.4rem;
  width: 100%;
}

.c-mission-step-btn {
  flex: 1;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 4px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.c-mission-step-btn:hover {
  background: #f1f5f9;
  color: var(--primary-color);
  border-color: #cbd5e1;
}

.c-mission-step-btn.active {
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
  box-shadow: 0 2px 4px rgba(11, 19, 41, 0.15);
}

.c-mission-step-btn.done {
  background: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
}

.c-mission-step-btn.done.active {
  background: #166534;
  color: #ffffff;
  border-color: #166534;
}

.c-step-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  font-size: 0.68rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.c-mission-step-btn.active .c-step-dot {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Active Step Content Box */
.c-mission-content-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.85rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.c-mission-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.c-mission-type-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #0284c7;
}

.c-mission-mode-link {
  font-size: 0.72rem;
  font-weight: 600;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fde68a;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.c-mission-mode-link:hover {
  background: #fde68a;
}

.c-mission-instruction,
.c-mission-observe {
  font-size: 0.84rem;
  line-height: 1.45;
  color: #1e293b;
}

.c-mission-instruction strong {
  color: #0369a1;
}

.c-mission-observe strong {
  color: #047857;
}

/* Action Footer */
.c-mission-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.c-btn-mission-done {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #0284c7;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.25);
}

.c-btn-mission-done:hover {
  background: #0369a1;
  transform: translateY(-1px);
}

.c-btn-mission-done:active {
  transform: translateY(0);
}

.c-mission-congrats {
  display: none;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  text-align: center;
  flex-direction: column;
  gap: 0.5rem;
}

.c-mission-congrats h4 {
  font-size: 0.95rem;
  color: #065f46;
  font-weight: 700;
  margin: 0;
}

.c-mission-congrats p {
  font-size: 0.82rem;
  color: #047857;
  line-height: 1.4;
  margin: 0;
}

.c-btn-mission-restart {
  background: #ffffff;
  border: 1px solid #a7f3d0;
  color: #065f46;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  align-self: center;
  margin-top: 0.3rem;
  transition: all 0.15s ease;
}

.c-btn-mission-restart:hover {
  background: #f0fdf4;
}

/* ==================== THE KEY RELATION CARD (.c-relation) ==================== */
.c-relation {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.25rem;
  border-radius: 18px;
  background: var(--navy);
  color: #fff;
  border: 1px solid var(--navy-border);
}

.c-relation-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.c-relation-head h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.c-relation-head span {
  font-size: 0.75rem;
  color: #94a3b8;
}

.c-formula {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--amber-gold);
}

.c-subst {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  background: var(--navy-surface);
  border: 1px solid #22305A;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #cbd5e1;
}

.c-subst strong {
  color: #fff;
  font-weight: 700;
}

.c-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.c-rel-val {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--sky);
}

/* ==================== CONTROLS PANELS & SLIDERS ==================== */
.controls-panel {
  gap: 1.1rem;
}

.panel-section {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid #EEF1F5;
}

.panel-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.panel-section .subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Preset Pills */
.preset-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.preset-pill {
  padding: 0.4rem 0.75rem;
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid #D5DAE3;
  color: var(--primary-color);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-pill:hover {
  background: #EEF2F8;
  border-color: var(--primary-color);
}

.preset-pill.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}

/* Slider Stepper Groups */
.c-slider {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.c-slider-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.c-slider-head label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary-color);
}

.c-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.c-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-color);
  background: #F4F6FA;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
}

.c-slider-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.c-slider-row input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: var(--primary-color);
  cursor: pointer;
  min-height: 36px;
}

.c-step {
  flex: none;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #D5DAE3;
  border-radius: 10px;
  background: #fff;
  color: var(--primary-color);
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.15s ease;
}

.c-step:hover {
  background: #EEF2F8;
  border-color: var(--primary-color);
}

.c-range, .range-marks {
  display: flex;
  justify-content: space-between;
  padding: 0 42px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Checkbox Grid */
.checkbox-grid {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.chk-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  border: 1px solid #E2E6EE;
  background: #fff;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--primary-color);
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.chk-item:hover {
  border-color: #94a3b8;
}

.chk-item input[type="checkbox"] {
  accent-color: var(--primary-color);
  cursor: pointer;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.metrics-grid.mini {
  grid-template-columns: repeat(2, 1fr);
}

.metric-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  background: #F8FAFC;
  border: 1px solid #E2E6EE;
}

.metric-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.metric-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-color);
}

.metric-card.highlight {
  background: #FEF3C7;
  border-color: #FDE68A;
}

.metric-card.highlight .metric-value {
  color: #92400E;
}

/* Energy Conservation Bar */
.energy-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.energy-bar-track {
  height: 18px;
  display: flex;
  width: 100%;
  border-radius: 999px;
  overflow: hidden;
  background: #e2e8f0;
}

.energy-bar-fill.ke {
  background: #10b981;
  transition: width 0.05s linear;
}

.energy-bar-fill.pe {
  background: #f59e0b;
  transition: width 0.05s linear;
}

.energy-legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ke-dot { color: #047857; font-weight: 600; }
.pe-dot { color: #b45309; font-weight: 600; }

/* Buttons & Selects */
.button-row {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 38px;
  padding: 0 0.95rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

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

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

.btn-accent {
  background: var(--amber);
  color: var(--navy);
  font-weight: 700;
}

.btn-accent:hover {
  filter: brightness(1.08);
}

.btn-secondary {
  background: #fff;
  color: var(--primary-color);
  border-color: #D5DAE3;
}

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

.select-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  border: 1px solid #D5DAE3;
  background: #fff;
  font-size: 0.85rem;
  color: var(--primary-color);
  cursor: pointer;
}

.status-msg {
  font-size: 0.78rem;
  color: #0284c7;
  font-weight: 600;
  min-height: 18px;
  margin-top: 0.25rem;
}

/* Insight Banner */
.insight-banner {
  display: none;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.95rem;
  border-radius: 12px;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: #1E40AF;
  font-size: 0.84rem;
  line-height: 1.45;
}

.insight-banner.active {
  display: flex;
}

.insight-icon {
  font-size: 1.2rem;
}

/* Add Planet Box */
.add-planet-inputs {
  display: flex;
  gap: 0.45rem;
  align-items: flex-end;
}

.add-planet-inputs label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.add-planet-inputs input[type="number"] {
  width: 75px;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid #D5DAE3;
  font-size: 0.85rem;
}

/* Data Tables */
.table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid #E2E6EE;
  margin-top: 0.5rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

.data-table th {
  background: #F8FAFC;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid #E2E6EE;
  white-space: nowrap;
}

.data-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #F1F5F9;
  color: var(--primary-color);
  font-family: var(--font-mono);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.empty-row td {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 1.25rem !important;
}

.swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
}

/* Lab Mode Masking */
body.lab-mode-active .derived-metric strong,
body.lab-mode-active .derived-col {
  color: #0284c7 !important;
  font-style: italic;
}

/* ==================== PROGRESSIVE DISCLOSURE ACCORDIONS (Standard 23) ==================== */
.is-collapsible {
  background: #ffffff;
  border: 1px solid var(--border-color, #E2E6EE);
  border-radius: 16px;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}

.is-collapsible:hover {
  border-color: #CBD5E1;
}

.is-collapsible.is-open {
  box-shadow: 0 4px 14px rgba(11, 19, 41, 0.04);
}

.accordion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.4rem;
  cursor: pointer;
  user-select: none;
  background: #ffffff;
  transition: background 0.15s;
}

.accordion-head:hover {
  background: #F8FAFC;
}

.accordion-head:focus-visible {
  outline: 2px solid var(--accent-color, #2563EB);
  outline-offset: -2px;
}

.accordion-head-left {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.accordion-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex: none;
}

.accordion-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.accordion-head h2,
.accordion-head h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-color, #0B1329);
  margin: 0;
  line-height: 1.25;
}

.accordion-subtext {
  font-size: 0.82rem;
  color: var(--secondary-color, #64748B);
  display: block;
}

.accordion-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  background: #F1F5F9;
  color: #334155;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  flex: none;
  transition: all 0.15s ease;
  pointer-events: none;
}

.accordion-head:hover .accordion-toggle-btn {
  background: #0B1329;
  color: #FFFFFF;
  border-color: #0B1329;
}

.accordion-chevron {
  width: 16px;
  height: 16px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.is-collapsible.is-open .accordion-chevron {
  transform: rotate(180deg);
}

.accordion-content {
  padding: 1.25rem 1.4rem 1.4rem 1.4rem;
  border-top: 1px solid #F1F5F9;
}

.accordion-content[hidden] {
  display: none !important;
}

.concepts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.concept-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
}

.concept-card h3 {
  font-size: 0.95rem;
  color: #1e3a8a;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.concept-card p {
  font-size: 0.85rem;
  color: #475569;
  line-height: 1.55;
  margin-bottom: 0.4rem;
}

/* Specific POE Accordion Card */
.poe-box {
  background: #FFFBEB;
  border-color: #FDE68A;
}

.poe-box .accordion-head {
  background: #FFFBEB;
}

.poe-box .accordion-head:hover {
  background: #FEF3C7;
}

.poe-box .accordion-head h3 {
  color: #92400E;
}

.poe-box .accordion-subtext {
  color: #B45309;
}

.poe-box .accordion-toggle-btn {
  background: #FEF3C7;
  color: #92400E;
  border-color: #FDE68A;
}

.poe-box .accordion-head:hover .accordion-toggle-btn {
  background: #D97706;
  color: #FFFFFF;
  border-color: #D97706;
}

.poe-body {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #1E293B;
}

.poe-body p {
  margin-bottom: 0.75rem;
}

.poe-body p:last-child {
  margin-bottom: 0;
}

@media (max-width: 680px) {
  .accordion-head {
    padding: 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .accordion-toggle-btn {
    width: 100%;
    justify-content: center;
  }
  .accordion-content {
    padding: 1rem;
  }
}

.series-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.35rem 1.5rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.series-card h3 {
  font-size: 1rem;
  color: #1e3a8a;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.series-card p {
  font-size: 0.88rem;
  color: #4b5563;
  line-height: 1.55;
  margin-bottom: 0.5rem;
}

.series-card .series-tagline {
  font-weight: 700;
  color: #111827;
  font-style: italic;
}

.admission-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  border-radius: 16px;
  padding: 1.5rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  border: 2px solid transparent;
}

.attention-flash {
  animation: bannerGlowPulse 3s infinite ease-in-out;
}

@keyframes bannerGlowPulse {
  0% { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); border-color: transparent; }
  50% { box-shadow: 0 0 20px 4px rgba(251, 191, 36, 0.4); border-color: rgba(251, 191, 36, 0.6); }
  100% { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); border-color: transparent; }
}

.promo-kicker {
  font-size: 0.75rem;
  color: #38bdf8;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.promo-lead {
  font-size: 0.95rem;
  color: #94a3b8;
  font-weight: 600;
}

.promo-headline {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  margin-top: 2px;
}

.program-grid {
  display: flex;
  gap: 1rem;
}

.program-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.program-card strong {
  font-size: 0.95rem;
  color: #fde047;
}

.program-card span {
  font-size: 0.75rem;
  color: #cbd5e1;
}

.program-card small {
  font-size: 0.7rem;
  color: #94a3b8;
}

.promo-actions {
  display: flex;
  gap: 0.75rem;
}

.promo-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.25rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
  transition: all 0.15s ease;
}

.main-cta {
  background: #f59e0b;
  color: #0b0f19;
}

.main-cta:hover {
  filter: brightness(1.1);
}

.sub-cta {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.sub-cta:hover {
  background: rgba(255, 255, 255, 0.18);
}

.feedback-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  margin-bottom: 2rem;
}

.feedback-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.feedback-icon svg {
  stroke: #0284c7;
}

.feedback-text h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-color);
}

.feedback-text p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.feedback-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 1.15rem;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.feedback-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.series-footer {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 1rem 0;
  border-top: 1px solid #E2E6EE;
}

/* ==================== SERIES MODAL ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-window {
  position: relative;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  max-width: 740px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10000;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.35rem;
  border-bottom: 1px solid #e2e8f0;
}

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

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #64748b;
  cursor: pointer;
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ==================== RESPONSIVE RULES (Standards 7 & 17 Option A) ==================== */
@media (max-width: 900px) {
  .lab-grid.c-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.25rem !important;
  }

  .c-primary {
    order: 1 !important;
    width: 100% !important;
  }

  .c-side {
    order: 2 !important;
    width: 100% !important;
  }

  .admission-card {
    flex-direction: column;
    text-align: center;
    gap: 1.25rem;
  }

  .program-grid {
    flex-direction: column;
  }

  .promo-actions {
    width: 100%;
  }

  .feedback-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .feedback-btn {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 680px) {
  body {
    padding: 0.5rem 0.4rem 2rem;
  }

  .sim-title {
    font-size: 1.5rem;
  }

  .top-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .nav-actions {
    width: 100%;
    justify-content: space-between;
  }

  .c-stage .canvas-container {
    min-height: 340px;
  }

  .c-stage .canvas-container canvas {
    height: 340px;
  }

  .c-range, .range-marks {
    padding: 0 10px;
  }
}
