/* ══════════════════════════════════════════════════════════════════════════
   VENTILATOR PAGE  —  clinical dark-monitor aesthetic
   ══════════════════════════════════════════════════════════════════════════ */

/* Always reserve scrollbar gutter on the viewport so appearing/disappearing
   scrollbars never cause a layout reflow that resizes grid columns */
html { scrollbar-gutter: stable; }

/* ── Page shell ──────────────────────────────────────────────────────────── */
.vent-page {
  background: #06090f;
  min-height: 100vh;
  color: #d4e0f0;
}
.vent-page .site-nav {
  background: rgba(8, 12, 22, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(40, 109, 192, 0.18);
}
.vent-page .site-nav__brand { color: #8ba8cc; }
.vent-page .site-nav__tab {
  color: #6888aa;
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: var(--transition);
  cursor: pointer;
}
.vent-page .site-nav__tab:hover {
  color: #c0d8f0;
  background: rgba(40, 109, 192, 0.08);
}
.vent-page .site-nav__tab--active {
  background: rgba(40, 109, 192, 0.14);
  border-color: rgba(40, 109, 192, 0.30);
  color: #7fb8ff;
  font-weight: 600;
}

/* ── Workstation container ───────────────────────────────────────────────── */
.vent-workstation {
  max-width: 1380px;
  width: 100%;
  box-sizing: border-box; /* max-width includes padding, prevents overflow > viewport */
  min-width: 0;           /* prevents flex-child min-content expansion */
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2rem;
  overflow-x: hidden;     /* clip any residual horizontal overflow without scroll */
}

/* ── Alarm banner ────────────────────────────────────────────────────────── */
.vent-alarm-banner {
  margin-bottom: 0.6rem;
  min-height: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  max-width: 1055px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Workstation grid: vitals | BIS+vent | controls ─────────────────────── */
/* All three columns are fixed-width so no column can ever recompute its size
   in response to content changes, scrollbar presence, or page state changes.
   width: max-content shrinks the grid to exactly its columns; margin: 0 auto centers it. */
.workstation-grid {
  display: grid;
  grid-template-columns: 420px 345px 270px;
  gap: 10px;
  align-items: stretch;
  width: max-content;
  margin: 0 auto 10px;
}

/* ── Monitor shell (shared) ──────────────────────────────────────────────── */
.mon-shell {
  border-radius: 14px;
  background: #111827;
  border: 1.5px solid #1e2d45;
  box-shadow:
    0 0 0 3px #080d18,
    0 10px 36px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}
.mon-bezel {
  padding: 8px;
  background: #0d1422;
}
.mon-brand {
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #374f6a;
  margin-bottom: 5px;
  padding-left: 2px;
}
.mon-screen {
  background: #03060e;
  border-radius: 6px;
  border: 1px solid #0c1428;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════════════════
   VITALS MONITOR
   ══════════════════════════════════════════════════════════════════════════ */

/* Stretch vitals to match mid-col height */
.mon-shell--vitals { display: flex; flex-direction: column; }
.mon-shell--vitals .mon-bezel { flex: 1; display: flex; flex-direction: column; }
.mon-shell--vitals .mon-screen { flex: 1; display: flex; flex-direction: column; padding-top: 4px; }
/* Wave rows stay fixed height; vitals-bar grows to fill any remaining space */
.mon-shell--vitals .vitals-bar { flex: 1; }

/* Waveform row */
.wave-row {
  display: flex;
  align-items: stretch;
  height: 96px;
  border-bottom: 1px solid #0b1325;
}
.wave-tag {
  width: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.wave-canvas {
  flex: 1;
  display: block;
  min-width: 0;
  height: 96px;
}
.wave-num {
  width: 94px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding: 4px 6px 4px 2px;
  gap: 1px;
}
.wn-big {
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.wn-sub {
  font-size: 12.5px;
  font-weight: 500;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
}
.wn-unit {
  font-size: 8.5px;
  opacity: 0.45;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 1px;
}
.wn-rr {
  font-size: 11px;
  opacity: 0.65;
  margin-top: 3px;
}
.wn-st {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
  margin-top: 2px;
}
.wn-st span {
  font-size: 8.5px;
  opacity: 0.5;
  font-variant-numeric: tabular-nums;
}

/* Vitals bottom bar */
.vitals-bar {
  display: flex;
  gap: 5px;
  padding: 5px 6px 6px;
  background: #03060e;
}
.vb-cell {
  flex: 1;
  padding: 4px 7px;
  background: #070d1c;
  border: 1px solid #0f1c30;
  border-radius: 5px;
}
.vb-cell--gas { flex: 1.5; }
.vb-label {
  font-size: 8px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #374f6a;
  margin-bottom: 2px;
}
.vb-val {
  font-size: 17px;
  font-weight: 700;
  color: #d4e0f0;
  font-variant-numeric: tabular-nums;
}
.vb-val--red { color: #ff7070; }
.vb-map { font-size: 11px; color: #ff7070; opacity: 0.8; }
.vb-unit { font-size: 8px; color: #374f6a; margin-top: 1px; }
.vb-gas-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  line-height: 1.5;
}
.vbg-k { color: #4a6885; }
.vbg-v { color: #a8c8e8; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Middle column (BIS + Vent stacked) ─────────────────────────────────── */
.mid-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Controls column (right) ─────────────────────────────────────────────── */
.ctrl-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ══════════════════════════════════════════════════════════════════════════
   BIS MONITOR
   ══════════════════════════════════════════════════════════════════════════ */
.mon-shell--bis .mon-screen { padding: 7px 8px 5px; }

.bis-top {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 6px;
}
.bis-left { flex-shrink: 0; }
.bis-num {
  font-size: 54px;
  font-weight: 700;
  color: #00e676;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(0, 230, 118, 0.35);
}
.bis-label {
  font-size: 9px;
  letter-spacing: 0.18em;
  color: #00e676;
  opacity: 0.65;
  text-transform: uppercase;
}
.bis-meta { font-size: 8.5px; color: #374f6a; margin-top: 2px; }
.bis-right { flex: 1; min-width: 0; }
.bis-eeg-tag {
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #374f6a;
  margin-bottom: 2px;
}
#canvas-eeg { display: block; width: 100%; }

.bis-spectral-wrap { position: relative; }
#canvas-spectral { display: block; width: 100%; }
.spectral-axis {
  display: flex;
  justify-content: space-around;
  font-size: 8.5px;
  color: #374f6a;
  margin-top: 2px;
  letter-spacing: 0.04em;
}

/* ══════════════════════════════════════════════════════════════════════════
   VENTILATOR MONITOR
   ══════════════════════════════════════════════════════════════════════════ */
.mon-shell--vent .mon-screen { padding: 6px 6px 0; }

.vent-top { display: flex; gap: 6px; }

/* Vent waveforms */
.vent-waves { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.vent-wave-row { display: flex; align-items: center; gap: 4px; }
.vent-wave-lbl {
  width: 38px;
  flex-shrink: 0;
  font-size: 8px;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
}
.vent-wave-lbl small { font-size: 7px; opacity: 0.7; font-weight: 500; }
#canvas-pressure, #canvas-flow, #canvas-volume {
  flex: 1;
  display: block;
  min-width: 0;
}

/* Vent numerics */
.vent-nums {
  width: 88px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.vn-pair { display: flex; gap: 2px; }
.vn-cell {
  flex: 1;
  background: #070d1c;
  border: 1px solid #0f1c30;
  border-radius: 3px;
  padding: 2px 3px;
  text-align: center;
}
.vn-lbl { font-size: 6.5px; color: #374f6a; letter-spacing: 0.08em; text-transform: uppercase; }
.vn-val { font-size: 13px; font-weight: 700; color: #a8c8e8; font-variant-numeric: tabular-nums; line-height: 1.1; }
.vn-val--warn { color: #ffcc00; }
.vn-unit { font-size: 6px; color: #2a3f58; }

/* ── P-V Loop row ────────────────────────────────────────────────────────── */
.vent-pv-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 5px 6px 4px;
  border-top: 1px solid #0c1428;
  padding-top: 5px;
}
.vent-pv-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 38px;
  flex-shrink: 0;
  font-size: 8px;
  font-weight: 700;
  color: #a0c8ff;
  line-height: 1.2;
}
.vent-pv-sublabel { font-size: 7px; font-weight: 500; opacity: 0.6; }
#canvas-pv { flex: 1; display: block; min-width: 0; }
.pv-legend {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}
.pv-leg-item { font-size: 8px; font-weight: 600; }

.vent-mode-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  padding: 4px 6px;
  background: #060b18;
  border-top: 1px solid #0c1428;
}
.mode-chip {
  background: #286dc0;
  color: #fff;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
}
.mode-detail { font-size: 8.5px; color: #374f6a; font-variant-numeric: tabular-nums; }

/* ══════════════════════════════════════════════════════════════════════════
   CONTROLS
   ══════════════════════════════════════════════════════════════════════════ */
/* ── Intro card ──────────────────────────────────────────────────────────── */
.vent-intro-card {
  max-width: 680px;
  margin: 0 auto 10px;
  box-sizing: border-box;
  background: linear-gradient(135deg, #0d1830 0%, #101e38 100%);
  border: 1px solid #1e3050;
  border-radius: 14px;
  padding: 1.5rem 2.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  text-align: center;
}
.vent-intro-card h1 {
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  font-weight: 700;
  color: #c8ddf4;
  margin: 0;
  letter-spacing: -0.02em;
}
.vent-intro-card p {
  font-size: 0.9375rem;
  color: #7090b0;
  line-height: 1.55;
  margin: 0.55rem auto 0;
  max-width: 860px;
}

/* ── Floating AI button ─────────────────────────────────────────────────── */
.vent-ai-btn {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #1a4b8a 0%, #286dc0 100%);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: none;
  border-radius: 22px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(40, 109, 192, 0.5), 0 2px 6px rgba(0,0,0,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  z-index: 200;
}
.vent-ai-btn:hover { transform: scale(1.04); box-shadow: 0 6px 28px rgba(40,109,192,0.65); }
.vent-ai-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
  box-shadow: 0 0 6px #4ade80;
}
.ctrl-card {
  background: #0d1422;
  border: 1px solid #1a2a40;
  border-radius: 11px;
  padding: 12px 14px;
  min-width: 0;     /* prevent grid blowout from long label text */
  overflow: hidden;
}
.ctrl-card--alarms { }
.ctrl-card__title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6888aa;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #162035;
}

/* Mode toggle */
.mode-toggle { display: flex; gap: 6px; margin-bottom: 10px; }
.mode-btn {
  flex: 1;
  padding: 5px 8px;
  border: 1.5px solid #1e3050;
  border-radius: 6px;
  background: transparent;
  color: #4a6885;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: var(--transition);
}
.mode-btn:hover { border-color: #286dc0; color: #7fb8ff; }
.mode-btn--on {
  background: #286dc0;
  border-color: #286dc0;
  color: #fff;
}

/* Sliders */
.ctrl-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.ctrl-lbl { font-size: 10px; color: #5878a0; flex: 1; min-width: 0; word-break: break-word; }
.ctrl-range {
  width: 96px;
  flex-shrink: 0;
  accent-color: #286dc0;
  cursor: pointer;
}
.ctrl-val {
  font-size: 11px;
  font-weight: 700;
  color: #a8c8e8;
  width: 34px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Alarm list */
.alarm-list { display: flex; flex-direction: column; gap: 4px; }
.alarm-none { font-size: 10px; color: #2e4460; text-align: center; padding: 12px 0; }
.alarm-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.3;
  animation: alarm-flash 1.8s ease infinite;
}
.alarm-item--high {
  background: rgba(255, 55, 55, 0.12);
  color: #ff6060;
  border-left: 3px solid #ff3333;
  animation-duration: 0.9s;
}
.alarm-item--medium {
  background: rgba(255, 165, 0, 0.10);
  color: #ffaa44;
  border-left: 3px solid #ff8800;
}
.alarm-item--low {
  background: rgba(0, 160, 255, 0.10);
  color: #44aaff;
  border-left: 3px solid #0088ff;
}
@keyframes alarm-flash {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.65; }
}

/* ══════════════════════════════════════════════════════════════════════════
   CLINICAL SCENARIOS
   ══════════════════════════════════════════════════════════════════════════ */

.scenario-trigger-row {
  margin-top: 12px;
  max-width: 1055px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  justify-content: center;
}
.scenario-trigger-btn {
  background: linear-gradient(135deg, #1a2a44 0%, #1e3456 100%);
  border: 1.5px solid #2a4870;
  color: #7fb8ff;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 28px;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: var(--transition);
}
.scenario-trigger-btn:hover {
  background: linear-gradient(135deg, #1e3456 0%, #244070 100%);
  border-color: #4080c8;
  color: #a8d0ff;
  box-shadow: 0 4px 18px rgba(40, 109, 192, 0.25);
}

/* Scenario panel */
.scenario-panel {
  max-width: 1055px;
  margin: 12px auto 0;
  background: #0d1422;
  border: 1px solid #1a2a40;
  border-radius: 14px;
  overflow: hidden;
  animation: scen-slide-in 0.25s ease;
}
@keyframes scen-slide-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Scenario selector */
#scen-select { padding: 18px 20px 16px; }
.scen-select__header {
  position: relative;
  margin-bottom: 16px;
  text-align: center;
}
.scen-select__header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #c8ddf4;
  margin: 0 0 5px;
}
.scen-select__header p {
  font-size: 0.8rem;
  color: #5878a0;
  margin: 0 auto;    /* center the block so text-align: center works as expected */
  max-width: 700px;
}
.scen-close-btn {
  position: absolute;
  top: 0;
  right: 0;
  background: transparent;
  border: 1px solid #2a3a58;
  color: #5878a0;
  font-size: 13px;
  border-radius: 5px;
  padding: 3px 8px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: var(--transition);
}
.scen-close-btn:hover { color: #a8c8e8; border-color: #4a6885; }

.scen-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.scen-card {
  min-width: 0;
  background: #10182a;
  border: 1.5px solid #1e3050;
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: var(--transition);
}
.scen-card:hover {
  border-color: #4080c8;
  background: #13203c;
  box-shadow: 0 4px 20px rgba(40, 109, 192, 0.2);
  transform: translateY(-2px);
}
.scen-card__badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  display: inline-block;
  margin-bottom: 8px;
}
.scen-card__title {
  font-size: 13px;
  font-weight: 700;
  color: #c8ddf4;
  margin-bottom: 6px;
  line-height: 1.3;
}
.scen-card__summary {
  font-size: 10.5px;
  color: #5878a0;
  line-height: 1.55;
}
.scen-card__cta {
  margin-top: 10px;
  font-size: 10px;
  color: #4080c8;
  font-weight: 600;
}

/* Active scenario */
#scen-active { padding: 14px 20px 16px; }
.scen-active__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #162035;
}
.scen-active__left { display: flex; align-items: center; gap: 10px; }
.scen-active__right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.scen-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
}
.scen-title { font-size: 14px; font-weight: 700; color: #c8ddf4; }
.scen-step-label { font-size: 10px; color: #5878a0; }

/* Phase badge — visual state indicator for the current scenario step */
.scen-phase {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}
.scen-phase--deterioration {
  background: rgba(255,70,70,0.14);
  color: #ff7070;
  border: 1px solid rgba(255,70,70,0.30);
}
.scen-phase--intervention {
  background: rgba(80,180,255,0.14);
  color: #64c8ff;
  border: 1px solid rgba(80,180,255,0.30);
}
.scen-phase--stabilization {
  background: rgba(60,220,110,0.14);
  color: #50dc78;
  border: 1px solid rgba(60,220,110,0.30);
}
.scen-phase--active {
  background: rgba(180,140,255,0.14);
  color: #c8a0ff;
  border: 1px solid rgba(180,140,255,0.30);
}

/* Monitor clue box — highlights key diagnostic pattern for the student */
.scen-monitor-clue {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(80,170,255,0.06);
  border: 1px solid rgba(80,170,255,0.18);
  border-radius: 8px;
  padding: 9px 13px;
  font-size: 11px;
  color: #90c8ef;
  line-height: 1.6;
}
.scen-clue-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
  color: #64c8ff;
  margin-top: 1px;
}
.scen-exit-btn {
  background: transparent;
  border: 1px solid #2a3a58;
  color: #5878a0;
  font-size: 11px;
  border-radius: 5px;
  padding: 4px 10px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: var(--transition);
}
.scen-exit-btn:hover { color: #ff8888; border-color: #884444; }

.scen-active__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  grid-template-rows: auto auto;
  gap: 12px 16px;
  align-items: start;
}
/* Context: left column, top row
   Clue:    left column, bottom row
   QA:      right column, spans both rows */
.scen-context      { grid-column: 1; grid-row: 1; }
.scen-monitor-clue { grid-column: 1; grid-row: 2; }
.scen-qa           { grid-column: 2; grid-row: 1 / span 2; }

.scen-context {
  background: #080f1e;
  border: 1px solid #0f1c30;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 11px;
  color: #7090b0;
  line-height: 1.65;
}
.scen-context strong { color: #a8c8e8; }

/* Question + choices */
.scen-qa { }
.scen-question {
  font-size: 12px;
  font-weight: 600;
  color: #c8ddf4;
  line-height: 1.55;
  margin-bottom: 12px;
}
.scen-choices { display: flex; flex-direction: column; gap: 6px; }
.scen-choice {
  background: #10182a;
  border: 1.5px solid #1e3050;
  border-radius: 7px;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 11px;
  color: #8098b8;
  text-align: left;
  font-family: var(--font-sans);
  line-height: 1.45;
  transition: var(--transition);
  width: 100%;
}
.scen-choice:hover:not(:disabled) {
  border-color: #4080c8;
  color: #c8ddf4;
  background: #13203c;
}
.scen-choice--correct {
  border-color: #00c870 !important;
  background: rgba(0, 200, 112, 0.10) !important;
  color: #00e676 !important;
}
.scen-choice--wrong {
  border-color: #883333 !important;
  background: rgba(255, 60, 60, 0.08) !important;
  color: #ff7070 !important;
}
.scen-choice:disabled { cursor: default; }

/* Feedback card */
.scen-feedback {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.65;
}
.scen-feedback--correct {
  background: rgba(0, 200, 112, 0.08);
  border-left: 3px solid #00c870;
  color: #8addb8;
}
.scen-feedback--wrong {
  background: rgba(255, 80, 80, 0.08);
  border-left: 3px solid #ff4444;
  color: #ff9090;
}
.scen-next-btn {
  margin-top: 12px;
  padding: 8px 20px;
  background: #286dc0;
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: var(--transition);
}
.scen-next-btn:hover { background: #3080d8; }

/* Resolution screen */
#scen-resolution {
  padding: 32px 20px;
  text-align: center;
}
.scen-resolution__icon {
  font-size: 40px;
  color: #00e676;
  margin-bottom: 12px;
}
#scen-resolution h3 { font-size: 1rem; color: #c8ddf4; margin: 0 0 10px; }
#scen-resolution p { font-size: 11px; color: #7090b0; line-height: 1.7; max-width: 700px; margin: 0 auto 20px; }

/* ══════════════════════════════════════════════════════════════════════════
   TRAIN-OF-FOUR — MINI CARD (ctrl-col)
   ══════════════════════════════════════════════════════════════════════════ */

.ctrl-card--tof {
  cursor: pointer;
  user-select: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.ctrl-card--tof:hover,
.ctrl-card--tof:focus {
  border-color: #3060a8;
  box-shadow: 0 0 10px rgba(48, 96, 168, 0.25);
  outline: none;
}
.tof-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tof-mini-badge {
  font-size: 9px;
  font-weight: 700;
  background: rgba(255,255,255,0.07);
  border-radius: 6px;
  padding: 1px 7px;
  color: #6090c8;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.tof-mini-canvas {
  display: block;
  width: 100%;
  background: #030810;
  border-radius: 4px;
  margin: 6px 0 5px;
}
.tof-mini-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tof-mini-hint {
  font-size: 9px;
  color: #304870;
  letter-spacing: 0.03em;
}
.tof-mini-depth {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* Shared depth color classes (used in both mini card and modal) */
.tof-depth--ok       { color: #00e676; }
.tof-depth--mild     { color: #80e080; }
.tof-depth--moderate { color: #ffcc00; }
.tof-depth--deep     { color: #ff8040; }
.tof-depth--profound { color: #ff4444; }

/* ══════════════════════════════════════════════════════════════════════════
   TRAIN-OF-FOUR — FULL MODAL
   ══════════════════════════════════════════════════════════════════════════ */

.tof-modal {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 100vw;
  max-height: 100vh;
  overflow: visible;
}
.tof-modal::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}
.tof-modal-inner {
  background: #0a1424;
  border: 1px solid #1e3050;
  border-radius: 12px;
  width: 740px;
  max-width: 96vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 0 70px rgba(0, 0, 0, 0.85), 0 0 30px rgba(32, 80, 160, 0.15);
  font-family: var(--font-sans);
}
.tof-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px 12px;
  border-bottom: 1px solid #10203a;
}
.tof-device-brand {
  font-size: 11px;
  font-weight: 700;
  color: #4080c8;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: block;
}
.tof-device-sub {
  font-size: 9px;
  color: #2a4060;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 2px;
  display: block;
}
.tof-close-btn {
  background: transparent;
  border: 1px solid #1e3050;
  color: #4a6888;
  border-radius: 5px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-sans);
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}
.tof-close-btn:hover { color: #ff8080; border-color: #882233; }

.tof-modal-body {
  display: grid;
  grid-template-columns: 1fr 258px;
  min-height: 0;
}

/* ── Left panel ──────────────────────────────────────────────────────────── */
.tof-left {
  padding: 14px 16px;
  border-right: 1px solid #10203a;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tof-screen {
  background: #030810;
  border: 1px solid #0c1428;
  border-radius: 6px;
  overflow: hidden;
}
.tof-screen canvas {
  display: block;
  width: 100%;
}
.tof-numerics {
  display: grid;
  grid-template-columns: 1fr 1fr 1.25fr;
  gap: 8px;
}
.tof-num-cell {
  background: #060f1c;
  border: 1px solid #0f1e30;
  border-radius: 6px;
  padding: 8px 10px;
  text-align: center;
}
.tof-num-label {
  font-size: 8px;
  color: #3a5878;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 4px;
}
.tof-num-value {
  font-size: 30px;
  font-weight: 700;
  color: #b8d4f0;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.tof-num-cell--depth {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.tof-depth-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 5px;
  display: inline-block;
  white-space: nowrap;
}
.tof-depth-badge.tof-depth--ok       { background: rgba(0,230,118,0.12); }
.tof-depth-badge.tof-depth--mild     { background: rgba(128,224,128,0.12); }
.tof-depth-badge.tof-depth--moderate { background: rgba(255,204,0,0.12); }
.tof-depth-badge.tof-depth--deep     { background: rgba(255,128,64,0.12); }
.tof-depth-badge.tof-depth--profound { background: rgba(255,68,68,0.12); }

.tof-interp {
  background: #060f1c;
  border: 1px solid #0f1e30;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 11px;
  color: #6888a8;
  line-height: 1.7;
  flex: 1;
  min-height: 54px;
}

/* ── Right panel ─────────────────────────────────────────────────────────── */
.tof-right {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}
.tof-controls-section { display: flex; flex-direction: column; gap: 5px; }
.tof-section-title {
  font-size: 9px;
  font-weight: 700;
  color: #2e4868;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.tof-btns {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tof-btn {
  background: #0b1828;
  border: 1.5px solid #182840;
  border-radius: 6px;
  color: #5878a0;
  font-size: 10px;
  padding: 6px 9px;
  cursor: pointer;
  font-family: var(--font-sans);
  text-align: left;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.tof-btn:hover {
  border-color: var(--tof-btn-color, #3060a8);
  color: #90b8e8;
  background: rgba(48,96,168,0.07);
}
.tof-btn--active {
  border-color: var(--tof-btn-color, #3060a8) !important;
  color: var(--tof-btn-color, #60a8e8) !important;
  background: rgba(48,96,168,0.10) !important;
}

.tof-explainer {
  background: #060f1c;
  border: 1px solid #0f1e30;
  border-radius: 6px;
  padding: 10px 12px;
  flex-shrink: 0;
}
.tof-explainer-title {
  font-size: 9px;
  font-weight: 700;
  color: #2e4868;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 5px;
}
.tof-explainer-text {
  font-size: 10px;
  color: #486888;
  line-height: 1.7;
}
.tof-explainer-text strong { color: #6888a8; }

/* ── Quiz ────────────────────────────────────────────────────────────────── */
.tof-quiz-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.tof-quiz { display: flex; flex-direction: column; gap: 4px; }
.tof-quiz-header {
  font-size: 9px;
  font-weight: 700;
  color: #2e4868;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 4px;
}
.tof-quiz-q {
  font-size: 10.5px;
  color: #90b8e0;
  font-weight: 600;
  line-height: 1.55;
  margin-bottom: 4px;
}
.tof-quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tof-qchoice {
  background: #0b1828;
  border: 1.5px solid #182840;
  border-radius: 5px;
  color: #5070a0;
  font-size: 10px;
  padding: 5px 9px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  transition: border-color 0.13s, color 0.13s;
}
.tof-qchoice:hover:not(:disabled) { border-color: #304878; color: #80a8d8; }
.tof-qchoice--correct { border-color: #00c870 !important; color: #00e676 !important; background: rgba(0,200,112,0.07) !important; }
.tof-qchoice--wrong   { border-color: #883333 !important; color: #ff7070 !important; background: rgba(255,60,60,0.06) !important; }
.tof-qchoice:disabled { cursor: default; }
.tof-quiz-fb {
  margin-top: 5px;
  font-size: 10px;
  line-height: 1.6;
  padding: 7px 10px;
  border-radius: 5px;
}
.tof-quiz-fb--correct { background: rgba(0,200,112,0.07); border-left: 3px solid #00c870; color: #60b880; }
.tof-quiz-fb--wrong   { background: rgba(255,80,80,0.07); border-left: 3px solid #ff4444; color: #ff9090; }
.tof-quiz-next {
  margin-top: 5px;
  background: #0b1828;
  border: 1px solid #1e3458;
  border-radius: 5px;
  color: #406098;
  font-size: 10px;
  padding: 5px 10px;
  cursor: pointer;
  font-family: var(--font-sans);
  width: 100%;
  transition: color 0.13s, border-color 0.13s;
}
.tof-quiz-next:hover { color: #80b0e0; border-color: #305080; }
.tof-quiz-done {
  font-size: 10.5px;
  color: #00e676;
  padding: 8px;
  text-align: center;
}

/* ══════════════════════════════════════════════════════════════════════════
   MONITOR TUTORIAL MODALS
   ══════════════════════════════════════════════════════════════════════════ */

/* Clickable wave-num trigger */
.wave-num--trig {
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 2px 4px;
  border-radius: 6px;
  transition: background 0.18s;
}
.wave-num--trig:hover { background: rgba(255,255,255,0.07); }
.wn-trig-hint {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.06em;
  opacity: 0;
  color: rgba(255,255,255,0.5);
  transition: opacity 0.18s;
  margin-top: 2px;
}
.wave-num--trig:hover .wn-trig-hint { opacity: 1; }

/* ── Dialog shell ─────────────────────────────────────────────────────────── */
.mon-tut {
  background: #070f1e;
  border: 1px solid #1e3050;
  border-radius: 14px;
  box-shadow: 0 12px 60px rgba(0,0,0,0.75), 0 0 0 1px rgba(40,109,192,0.18);
  padding: 0;
  width: min(720px, 96vw);
  max-height: 92vh;
  overflow: hidden;
  color: #c8ddf4;
}
.mon-tut--wide { width: min(940px, 96vw); }
.mon-tut::backdrop { background: rgba(0,0,0,0.75); }

.mon-tut__inner {
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  overflow-y: auto;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.mon-tut__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid #1e3050;
  background: linear-gradient(180deg, #0d1830 0%, #080f1d 100%);
  flex-shrink: 0;
}
.mon-tut__eyebrow {
  margin: 0 0 2px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #3a6a9e;
}
.mon-tut__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #c8ddf4;
  letter-spacing: -0.01em;
}
.mon-tut__close {
  appearance: none;
  background: rgba(255,255,255,0.05);
  border: 1px solid #1e3050;
  border-radius: 6px;
  color: #6080a0;
  cursor: pointer;
  font-size: 1.1rem;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.mon-tut__close:hover { background: rgba(255,255,255,0.12); color: #c8ddf4; }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.mon-tut__tabs {
  display: flex;
  border-bottom: 1px solid #1e3050;
  background: #050c18;
  flex-shrink: 0;
}
.mon-tut__tab {
  appearance: none; background: none; border: none;
  border-bottom: 2px solid transparent;
  padding: 9px 18px;
  font-size: 0.74rem; font-weight: 600;
  color: #3a6a9e; cursor: pointer;
  letter-spacing: 0.03em;
  transition: color 0.15s, border-color 0.15s;
}
.mon-tut__tab:hover { color: #90b8d8; }
.mon-tut__tab--active { color: #c8ddf4; border-bottom-color: #286dc0; }

/* ── Waveform section ────────────────────────────────────────────────────── */
.mon-tut__wave-section {
  background: #050c18;
  border-bottom: 1px solid #1a2a3e;
  padding: 0;
  flex-shrink: 0;
}
.mon-tut__canvas {
  display: block;
  width: 100%;
  height: 160px;
  border-radius: 0;
}
.mon-tut--wide .mon-tut__canvas { height: 155px; }

/* ── Stats row (numerics + interp) ──────────────────────────────────────── */
.mon-tut__stats-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 18px;
  border-bottom: 1px solid #1a2a3e;
  background: rgba(5,12,24,0.6);
}
.mon-tut__nums {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
  min-width: 130px;
}
.tut-nrow {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.78rem;
}
.tut-nk { color: #3a6a9e; font-size: 0.68rem; min-width: 48px; }
.tut-nv { font-size: 1.1rem; font-weight: 700; }
.tut-nu { color: #3a6a9e; font-size: 0.62rem; }

.mon-tut__interp {
  flex: 1;
  font-size: 0.8rem;
  line-height: 1.6;
  color: #90b0cc;
  background: rgba(40,109,192,0.07);
  border-left: 3px solid #286dc0;
  border-radius: 0 6px 6px 0;
  padding: 8px 12px;
  align-self: stretch;
  display: flex;
  align-items: center;
}

/* Capno phase chips (basics tab) */
.mon-tut__capno-phases {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.cphs {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}
.cphs--i   { background: rgba(40,109,192,0.15); color: #6090c0; border: 1px solid #1e3868; }
.cphs--ii  { background: rgba(255,200,50,0.12); color: #c8a840; border: 1px solid rgba(255,200,50,0.25); }
.cphs--iii { background: rgba(255,238,0,0.12);  color: #c8c030; border: 1px solid rgba(255,238,0,0.25); }
.cphs--down{ background: rgba(100,180,100,0.12);color: #70b070; border: 1px solid rgba(100,180,100,0.25); }

/* ── Selector row ────────────────────────────────────────────────────────── */
.mon-tut__selector-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid #1a2a3e;
  background: rgba(5,12,24,0.4);
}
.mon-tut__select-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #3a6a9e;
  flex-shrink: 0;
  white-space: nowrap;
}
.mon-tut__select {
  flex: 1;
  appearance: none;
  background: rgba(40,109,192,0.10);
  border: 1px solid #284868;
  border-radius: 7px;
  color: #c8ddf4;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 32px 7px 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%234a7ab0'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.15s, background-color 0.15s;
  max-width: 480px;
}
.mon-tut__select:hover { border-color: #286dc0; background-color: rgba(40,109,192,0.18); }
.mon-tut__select:focus { outline: none; border-color: #286dc0; box-shadow: 0 0 0 2px rgba(40,109,192,0.2); }
.mon-tut__select option { background: #0d1830; color: #c8ddf4; }

/* ── Teaching section ────────────────────────────────────────────────────── */
.mon-tut__teach-section {
  padding: 12px 18px 14px;
  border-bottom: 1px solid #1a2a3e;
}
.mon-tut__section-title {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #3a6a9e;
  margin: 0 0 8px;
}
.mon-tut__teach-list {
  margin: 0;
  padding-left: 1.1em;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #7898b8;
}
.mon-tut__teach-list strong { color: #b8d4f0; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.mon-tut__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 18px;
  background: #050c18;
  flex-shrink: 0;
}
.mon-tut__foot-btn {
  appearance: none;
  background: rgba(255,255,255,0.04);
  border: 1px solid #1e3050;
  border-radius: 7px;
  color: #6080a0;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 16px;
  transition: background 0.15s, color 0.15s;
}
.mon-tut__foot-btn:hover { background: rgba(255,255,255,0.1); color: #c8ddf4; }
.mon-tut__foot-btn--primary {
  background: rgba(40,109,192,0.22);
  border-color: #286dc0;
  color: #c8ddf4;
}
.mon-tut__foot-btn--primary:hover { background: rgba(40,109,192,0.38); }

/* ── Gas monitoring tab ──────────────────────────────────────────────────── */
.mon-tut__tab-panel { flex: 1; }

.mon-tut__gas-panel {
  display: flex;
  gap: 0;
}
.mon-tut__gas-traces {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #1a2a3e;
}
.mon-tut__gas-row {
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid #1a2a3e;
  padding: 6px 10px 6px 0;
}
.mon-tut__gas-row:last-child { border-bottom: none; }
.mon-tut__gas-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  width: 44px;
  flex-shrink: 0;
  text-align: right;
  padding-right: 8px;
}
.mon-tut__gas-canvas {
  flex: 1;
  display: block;
  border-radius: 4px;
  height: 72px;
}
.mon-tut__gas-vals {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 115px;
  padding-left: 12px;
}
.mon-tut__gas-teach {
  width: 230px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}

/* ── Volatile & O2 cards ─────────────────────────────────────────────────── */
.mon-tut__vol-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 14px 18px;
}
.mon-tut__vol-card {
  background: rgba(40,109,192,0.06);
  border: 1px solid #1e3050;
  border-radius: 10px;
  padding: 14px;
}
.mon-tut__vol-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 8px;
}
.mon-tut__vol-card p {
  font-size: 0.78rem;
  line-height: 1.55;
  color: #7898b8;
  margin: 0 0 6px;
}
.mon-tut__vol-card p:last-child { margin-bottom: 0; }
.mon-tut__vol-card strong { color: #b8d4f0; }
