:root {
  --bg-page: #f1f5f9;
  --bg-card: #ffffff;
  --bg-subtle: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-soft: #64748b;

  --coral: #ea580c;
  --coral-dark: #c2410c;
  --coral-soft: #ffedd5;
  --amber: #d97706;
  --amber-dark: #b45309;
  --amber-soft: #fef3c7;
  --indigo: #2563eb;
  --indigo-dark: #1d4ed8;
  --indigo-soft: #dbeafe;
  --sky: #0284c7;
  --sky-dark: #0369a1;
  --sky-soft: #e0f2fe;
  --emerald: #059669;
  --emerald-dark: #047857;
  --emerald-soft: #d1fae5;
  --violet: #7c3aed;
  --violet-dark: #6d28d9;
  --violet-soft: #ede9fe;
  --rose: #dc2626;
  --rose-dark: #b91c1c;
  --rose-soft: #fee2e2;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 10px 28px rgba(15, 23, 42, 0.08);
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at 8% 6%, rgba(234, 88, 12, 0.13), transparent 36%),
    radial-gradient(circle at 92% 8%, rgba(37, 99, 235, 0.12), transparent 36%),
    radial-gradient(circle at 50% 96%, rgba(5, 150, 105, 0.09), transparent 40%),
    var(--bg-page);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

.app-shell {
  max-width: 1340px;
  margin: 0 auto;
  padding: 16px 20px 36px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ===========================
   HEADER
   =========================== */
.app-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-back-portal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 700;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.btn-back-portal:hover {
  background: var(--coral-soft);
  border-color: var(--coral);
  color: var(--coral-dark);
}

.btn-back-portal svg {
  width: 16px;
  height: 16px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.brand-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

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

.brand h1 {
  margin: 0;
  font-size: 1.24rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.meb-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--coral-soft);
  color: var(--coral-dark);
  border: 1px solid #fdba74;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 2px 0 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}

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

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 0.83rem;
  color: var(--text-muted);
}

.stat-pill strong {
  color: var(--text-main);
  font-size: 0.93rem;
}

.stat-discover strong {
  color: var(--coral-dark);
}

.stat-score strong {
  color: var(--indigo-dark);
}

.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.22);
}

/* ===========================
   BUTTONS
   =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 9px 15px;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.14s ease, background 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

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

.btn-sm {
  padding: 6px 11px;
  font-size: 0.8rem;
}

.btn-coral {
  background: linear-gradient(135deg, #ea580c, #d97706);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.26);
}

.btn-coral:hover:not(:disabled) {
  background: linear-gradient(135deg, #c2410c, #b45309);
  box-shadow: 0 6px 16px rgba(234, 88, 12, 0.34);
}

.btn-coral.is-paused {
  background: linear-gradient(135deg, #2563eb, #0284c7);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.26);
}

.btn-ghost {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.btn-ghost:hover:not(:disabled) {
  background: #e2e8f0;
}

/* ===========================
   MODE NAV (TABS)
   =========================== */
.mode-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.mode-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font-family: inherit;
  color: var(--text-main);
  transition: transform 0.14s ease, border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.mode-tab:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.mode-tab.is-active {
  border-color: var(--coral);
  background: linear-gradient(180deg, #ffffff 0%, #fff7ed 100%);
  box-shadow: 0 6px 18px rgba(234, 88, 12, 0.14);
}

.mode-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.86rem;
  flex-shrink: 0;
}

.mode-badge--coral {
  background: var(--coral-soft);
  color: var(--coral-dark);
}

.mode-badge--indigo {
  background: var(--indigo-soft);
  color: var(--indigo-dark);
}

.mode-badge--emerald {
  background: var(--emerald-soft);
  color: var(--emerald-dark);
}

.mode-badge--violet {
  background: var(--violet-soft);
  color: var(--violet-dark);
}

.mode-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mode-copy strong {
  font-size: 0.92rem;
  font-weight: 800;
}

.mode-copy small {
  font-size: 0.77rem;
  color: var(--text-muted);
}

/* ===========================
   CARDS & PANELS
   =========================== */
.mode-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.section-head h2,
.section-head h3 {
  margin: 0;
  font-size: 1.07rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.card-sub {
  margin: 3px 0 0;
  font-size: 0.83rem;
  color: var(--text-muted);
}

.pill-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.pill-tag--coral {
  background: var(--coral-soft);
  color: var(--coral-dark);
}

.pill-tag--amber {
  background: var(--amber-soft);
  color: var(--amber-dark);
}

.pill-tag--indigo {
  background: var(--indigo-soft);
  color: var(--indigo-dark);
}

.pill-tag--emerald {
  background: var(--emerald-soft);
  color: var(--emerald-dark);
}

.pill-tag--violet {
  background: var(--violet-soft);
  color: var(--violet-dark);
}

/* ===========================
   CONTROLS & SEGMENTED BUTTONS
   =========================== */
.controls-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 18px;
}

.controls-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.controls-row--focus {
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

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

.control-group--full {
  flex: 1 1 auto;
}

.control-label {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}

.segmented-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 4px;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.81rem;
  font-weight: 700;
  padding: 7px 11px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

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

.segmented-group--coral .seg-btn.is-active {
  background: var(--coral);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.28);
}

.segmented-group--indigo .seg-btn.is-active {
  background: var(--indigo);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}

.segmented-group--emerald .seg-btn.is-active {
  background: var(--emerald);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.26);
}

.segmented-group--violet .seg-btn.is-active {
  background: var(--violet);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.28);
}

/* Status Banner */
.live-status-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid #fdba74;
  background: #fff7ed;
  font-size: 0.86rem;
  color: #9a3412;
}

.live-status-banner p {
  margin: 0;
}

.live-status-banner.is-no-o2 {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}

.live-status-banner.is-anaerobic {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1e40af;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--coral);
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(234, 88, 12, 0.22);
}

.live-status-banner.is-no-o2 .status-dot {
  background: var(--rose);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.22);
}

.live-status-banner.is-anaerobic .status-dot {
  background: var(--indigo);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.22);
}

/* ===========================
   TAB 1: MAIN GRID & CANVAS
   =========================== */
.main-sim-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.88fr) minmax(300px, 1fr);
  gap: 14px;
  align-items: stretch;
}

.canvas-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}

.canvas-stage-wrap {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #f8fafc;
}

.canvas-stage-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
}

/* 5-tile Telemetry Strip */
.telemetry-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.tele-card {
  border-radius: 11px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.2s ease;
}

.tele-card.is-dimmed {
  opacity: 0.45;
  filter: grayscale(0.5);
}

.tele-card.is-highlighted {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.tele-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-soft);
}

.tele-card strong {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-main);
}

.tele-card--indigo {
  border-color: #bfdbfe;
  background: #eff6ff;
}
.tele-card--indigo strong { color: var(--indigo-dark); }

.tele-card--amber {
  border-color: #fde68a;
  background: #fffbeb;
}
.tele-card--amber strong { color: var(--amber-dark); }

.tele-card--emerald {
  border-color: #a7f3d0;
  background: #ecfdf5;
}
.tele-card--emerald strong { color: var(--emerald-dark); }

.tele-card--violet {
  border-color: #ddd6fe;
  background: #f5f3ff;
}
.tele-card--violet strong { color: var(--violet-dark); }

.tele-card--coral {
  border-color: #fdba74;
  background: #fff7ed;
}
.tele-card--coral strong { color: var(--coral-dark); }

/* Right Stage Detail Card */
.focus-detail-card {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.focus-card-header h2 {
  margin: 6px 0 0;
  font-size: 1.06rem;
  font-weight: 800;
  line-height: 1.3;
}

.stage-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--indigo-soft);
  color: var(--indigo-dark);
  font-size: 0.76rem;
  font-weight: 700;
}

.meta-chip--amber {
  background: var(--amber-soft);
  color: var(--amber-dark);
}

.focus-desc {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.focus-points {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.84rem;
  color: var(--text-main);
}

.focus-points li {
  line-height: 1.45;
}

.exam-tip-box {
  margin-top: auto;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f5f3ff, #eff6ff);
  border: 1px solid #ddd6fe;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.exam-tip-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tip-chip {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--violet);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
}

.exam-tip-head strong {
  font-size: 0.84rem;
  color: var(--violet-dark);
}

.exam-tip-box p {
  margin: 0;
  font-size: 0.82rem;
  color: #334155;
}

/* Summary Table */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.bio-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  min-width: 780px;
}

.bio-table th {
  text-align: left;
  background: #f8fafc;
  color: var(--text-soft);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 11px 12px;
  border-bottom: 1.5px solid var(--border);
}

.bio-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  vertical-align: middle;
}

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

.bio-table tbody tr.is-row-active {
  background: #fff7ed;
}

.tbl-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}

.tbl-badge--emerald {
  background: var(--emerald-soft);
  color: var(--emerald-dark);
}

.tbl-badge--coral {
  background: var(--coral-soft);
  color: var(--coral-dark);
}

.tbl-badge--slate {
  background: #e2e8f0;
  color: #334155;
}

/* ===========================
   TAB 2: ACCOUNTING & ISOTOPES
   =========================== */
.equation-banner {
  background: linear-gradient(135deg, #fff7ed, #eff6ff);
  border: 1.5px solid #fdba74;
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 16px;
}

.eq-formula {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
  text-align: center;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(234, 88, 12, 0.28);
}

.eq-note {
  margin: 8px 0 0;
  font-size: 0.84rem;
  color: var(--text-muted);
  text-align: center;
}

.accounting-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.atp-bars-panel {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.atp-bars-panel h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
}

.bar-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.bar-row--total {
  padding-top: 10px;
  border-top: 1px dashed var(--border-strong);
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.83rem;
}

.bar-meta strong {
  color: var(--text-main);
  font-weight: 800;
}

.bar-row small {
  font-size: 0.77rem;
  color: var(--text-soft);
}

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

.bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.bar-fill--emerald {
  background: linear-gradient(90deg, #10b981, #059669);
}

.bar-fill--coral {
  background: linear-gradient(90deg, #f97316, #ea580c);
}

.bar-fill--indigo {
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.kpi-grid-6 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kpi-tile {
  border-radius: 13px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kpi-title {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-soft);
}

.kpi-tile strong {
  font-size: 1.02rem;
  font-weight: 800;
}

.kpi-tile small {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.kpi-tile--indigo { background: #eff6ff; border-color: #bfdbfe; }
.kpi-tile--indigo strong { color: var(--indigo-dark); }
.kpi-tile--emerald { background: #ecfdf5; border-color: #a7f3d0; }
.kpi-tile--emerald strong { color: var(--emerald-dark); }
.kpi-tile--sky { background: #f0f9ff; border-color: #bae6fd; }
.kpi-tile--sky strong { color: var(--sky-dark); }
.kpi-tile--violet { background: #f5f3ff; border-color: #ddd6fe; }
.kpi-tile--violet strong { color: var(--violet-dark); }
.kpi-tile--amber { background: #fffbeb; border-color: #fde68a; }
.kpi-tile--amber strong { color: var(--amber-dark); }
.kpi-tile--coral { background: #fff7ed; border-color: #fdba74; }
.kpi-tile--coral strong { color: var(--coral-dark); }

/* Isotope Visual Stage */
.isotope-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 12px;
}

.iso-side {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.iso-molecule {
  min-width: 145px;
  padding: 12px 16px;
  border-radius: 13px;
  background: #ffffff;
  border: 2px solid var(--border-strong);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.iso-mol-label {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
}

.iso-molecule strong {
  font-size: 1.28rem;
  font-weight: 800;
  color: var(--text-main);
}

.iso-molecule.is-marked-violet {
  border-color: var(--violet);
  background: #f5f3ff;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.18);
  transform: scale(1.04);
}
.iso-molecule.is-marked-violet strong { color: var(--violet-dark); }

.iso-molecule.is-marked-coral {
  border-color: var(--coral);
  background: #fff7ed;
  box-shadow: 0 0 0 4px rgba(234, 88, 12, 0.18);
  transform: scale(1.04);
}
.iso-molecule.is-marked-coral strong { color: var(--coral-dark); }

.iso-molecule.is-marked-emerald {
  border-color: var(--emerald);
  background: #ecfdf5;
  box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.18);
  transform: scale(1.04);
}
.iso-molecule.is-marked-emerald strong { color: var(--emerald-dark); }

.iso-op {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-soft);
}

.iso-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--indigo);
  font-size: 0.74rem;
  font-weight: 800;
}

.iso-arrow svg {
  width: 72px;
  height: 18px;
}

.isotope-explain-box {
  padding: 13px 16px;
  border-radius: 12px;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  font-size: 0.87rem;
  color: #334155;
}

.isotope-explain-box strong {
  color: var(--violet-dark);
}

.isotope-explain-box p {
  margin: 4px 0 0;
}

/* Yield Ladder & Compare Cards */
.yield-ladder {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.ladder-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 5px;
  font-size: 0.85rem;
}

.ladder-val {
  font-size: 0.8rem;
  font-weight: 800;
}

.ladder-val--coral { color: var(--coral-dark); }
.ladder-val--indigo { color: var(--indigo-dark); }
.ladder-val--emerald { color: var(--emerald-dark); }

.compare-cards-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.compare-card {
  border-radius: 14px;
  padding: 15px 16px;
  border: 1.5px solid var(--border);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.compare-card--coral { border-top: 4px solid var(--coral); }
.compare-card--indigo { border-top: 4px solid var(--indigo); }
.compare-card--emerald { border-top: 4px solid var(--emerald); }

.compare-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.compare-head h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
}

.compare-card ul {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.83rem;
  color: var(--text-muted);
}

.compare-card ul strong {
  color: var(--text-main);
}

/* ===========================
   TAB 3: NUTRIENTS FUNNEL
   =========================== */
.nutrient-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr);
  gap: 14px;
  align-items: stretch;
}

.nutrient-legend-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 4px 4px 0;
  font-size: 0.79rem;
  font-weight: 700;
  color: var(--text-muted);
}

.n-leg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.n-leg i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}

.n-leg--indigo i { background: var(--indigo); }
.n-leg--amber i { background: var(--amber); }
.n-leg--rose i { background: var(--rose); }

.nutrient-side-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nut-callout-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nut-mini-card {
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: 0.82rem;
}

.nut-mini-card strong {
  display: block;
  margin-bottom: 3px;
  font-size: 0.84rem;
}

.nut-mini-card p {
  margin: 0 0 4px;
  color: var(--text-muted);
}

.nut-mini-card p:last-child {
  margin-bottom: 0;
}

.nut-mini-card--indigo { background: #eff6ff; border-color: #bfdbfe; }
.nut-mini-card--indigo > strong { color: var(--indigo-dark); }
.nut-mini-card--amber { background: #fffbeb; border-color: #fde68a; }
.nut-mini-card--amber > strong { color: var(--amber-dark); }
.nut-mini-card--emerald { background: #ecfdf5; border-color: #a7f3d0; }
.nut-mini-card--emerald > strong { color: var(--emerald-dark); }
.nut-mini-card--rose { background: #fef2f2; border-color: #fecaca; }
.nut-mini-card--rose > strong { color: var(--rose-dark); }

.rank-line {
  color: var(--text-main) !important;
  font-size: 0.84rem;
}

/* ===========================
   TAB 4: VAKA KARTLARI & QUIZ
   =========================== */
.sort-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-feedback-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  margin-bottom: 14px;
  font-size: 0.86rem;
}

.sort-feedback-banner p {
  margin: 0;
}

.sort-feedback-banner.is-ok {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
}

.sort-feedback-banner.is-err {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

.sort-fb-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
}

.case-tray {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.case-card {
  background: #ffffff;
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  padding: 11px 13px;
  cursor: grab;
  font-size: 0.84rem;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  transition: transform 0.14s ease, border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
  user-select: none;
}

.case-card:hover {
  border-color: var(--violet);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(124, 58, 237, 0.12);
}

.case-card.is-selected {
  border-color: var(--violet);
  background: #f5f3ff;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.22);
}

.case-card.is-dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.case-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.case-num {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--violet-dark);
  background: var(--violet-soft);
  padding: 2px 8px;
  border-radius: 999px;
}

.case-hint-drag {
  font-size: 0.71rem;
  color: var(--text-soft);
  font-weight: 700;
}

.case-tray-done {
  grid-column: 1 / -1;
  text-align: center;
  padding: 14px;
  border-radius: 12px;
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  color: #065f46;
  font-weight: 800;
  font-size: 0.92rem;
}

.bins-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stage-bin {
  border-radius: 14px;
  padding: 12px;
  border: 2px dashed var(--border-strong);
  background: var(--bg-subtle);
  min-height: 150px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.14s ease, box-shadow 0.16s ease;
}

.stage-bin:hover,
.stage-bin.is-drag-over {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.stage-bin--indigo { border-color: #93c5fd; background: #eff6ff; }
.stage-bin--amber { border-color: #fcd34d; background: #fffbeb; }
.stage-bin--emerald { border-color: #6ee7b7; background: #ecfdf5; }
.stage-bin--coral { border-color: #fdba74; background: #fff7ed; }

.stage-bin.is-drag-over {
  border-style: solid;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.22);
}

.bin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.bin-head strong {
  font-size: 0.88rem;
  font-weight: 800;
}

.bin-count {
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  font-weight: 800;
}

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

.bin-drop-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.placed-pill {
  background: #ffffff;
  border: 1px solid #a7f3d0;
  border-left: 4px solid var(--emerald);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--text-main);
}

/* Quiz */
.quiz-hud {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.quiz-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin-bottom: 14px;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ea580c, #2563eb);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.quiz-q-meta {
  margin-bottom: 8px;
}

.quiz-question-text {
  margin: 0 0 14px;
  font-size: 1.04rem;
  font-weight: 800;
  line-height: 1.45;
}

.quiz-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quiz-opt-btn {
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border-strong);
  background: #ffffff;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.quiz-opt-btn:hover:not(:disabled) {
  border-color: var(--indigo);
  background: #eff6ff;
  transform: translateY(-1px);
}

.quiz-opt-btn:disabled {
  cursor: default;
}

.opt-letter {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.quiz-opt-btn.is-correct {
  border-color: var(--emerald);
  background: #ecfdf5;
  color: #065f46;
}
.quiz-opt-btn.is-correct .opt-letter {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #ffffff;
}

.quiz-opt-btn.is-wrong {
  border-color: var(--rose);
  background: #fef2f2;
  color: #991b1b;
}
.quiz-opt-btn.is-wrong .opt-letter {
  background: var(--rose);
  border-color: var(--rose);
  color: #ffffff;
}

.quiz-feedback {
  margin-top: 14px;
  padding: 13px 15px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 0.87rem;
}

.quiz-feedback.is-ok {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
}

.quiz-feedback.is-err {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

.quiz-feedback p {
  margin: 5px 0 0;
}

.quiz-nav-row {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.quiz-summary {
  text-align: center;
  padding: 20px 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.quiz-summary-badge {
  font-size: 2.8rem;
  line-height: 1;
}

.quiz-summary h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
}

.quiz-summary p {
  margin: 0;
  color: var(--text-muted);
  max-width: 560px;
}

.quiz-summary-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 10px;
  margin: 8px 0;
  width: 100%;
  max-width: 560px;
}

.qstat-box {
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.qstat-box span {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-soft);
}

.qstat-box strong {
  font-size: 1.15rem;
  font-weight: 800;
}

.qstat-box--emerald strong { color: var(--emerald-dark); }
.qstat-box--rose strong { color: var(--rose-dark); }
.qstat-box--indigo strong { color: var(--indigo-dark); }
.qstat-box--coral strong { color: var(--coral-dark); }

/* Footer */
.app-footer {
  text-align: center;
  font-size: 0.79rem;
  color: var(--text-soft);
  padding: 6px 0 2px;
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 1120px) {
  .main-sim-grid,
  .nutrient-main-grid,
  .accounting-grid {
    grid-template-columns: 1fr;
  }

  .mode-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bins-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compare-cards-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 10px 12px 24px;
  }

  .mode-nav,
  .case-tray,
  .quiz-options {
    grid-template-columns: 1fr;
  }

  .telemetry-grid-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bins-grid-4,
  .kpi-grid-6,
  .quiz-summary-stats {
    grid-template-columns: 1fr 1fr;
  }

  .brand h1 {
    font-size: 1.08rem;
  }
}
