Barbiturates in Anaesthesia MD

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Loading Image
I now have all the content needed for a comprehensive MD-level answer. Let me compile the complete response.

Barbiturates in Anaesthesia

1. Historical Background

Barbiturates were first synthesized in 1903 by Fischer and von Mering. The first barbiturate used for induction of anaesthesia was diethylbarbituric acid (barbital), but it was the introduction of hexobarbital in 1927 that made barbiturate induction popular. Thiopental was synthesized in 1932 by Volwiler and Tabern and first used clinically by John Lundy and Ralph Waters in 1934 — for decades it remained the gold standard intravenous induction agent. Methohexital was introduced clinically in 1957 by V.K. Stoelting.
  • Morgan and Mikhail's Clinical Anesthesiology, 7e
  • Miller's Anesthesia, 10e

2. Chemistry & Formulation

Barbiturates are derivatives of barbituric acid (2,4,6-trioxohexahydropyrimidine), formed by condensation of malonic acid and urea. The nucleus itself is hypnotically inactive; hypnotic activity arises from substitution at position 5 (aryl or alkyl groups) and at positions 1 and 2.
Two major classes:
  • Thiobarbiturates — sulfur at position 2: thiopental, thiamylal
  • Oxybarbiturates — oxygen at position 2: methohexital
Structures of Thiopental, Thiamylal, and Methohexital
Structures of the three IV barbiturates used for anaesthesia induction (Miller's Anesthesia, 10e, Fig. 21.6)
Structure-Activity Relationships:
  • Longer alkyl chain at C5 → increased hypnotic potency but also toxicity
  • Phenyl group at C5 → anticonvulsant activity (phenobarbital)
  • Sulfur at C2 (thiobarbiturates) → increased lipid solubility and faster CNS onset
  • N-methylation at position 1 → increased CNS excitability (methohexital's proconvulsant property)
  • Branching at C5 → increased potency and shorter duration
Formulation:
  • Supplied as sodium salts mixed with 6% anhydrous sodium carbonate, reconstituted in water, 5% dextrose, or normal saline
  • Thiopental: 2.5% solution; thiamylal: 2% solution; methohexital: 1% solution
  • Solution is highly alkaline (pH 10–11)
  • Thiobarbiturates stable for 1 week refrigerated; methohexital stable for 6 weeks after reconstitution
  • Cannot be mixed with acidic solutions (atracurium, vecuronium, rocuronium, suxamethonium, alfentanil, sufentanil, midazolam) — precipitation occurs as the free acid
  • Miller's Anesthesia, 10e, p. 2492–2494
  • Goodman & Gilman's, p. 1127

3. Mechanism of Action

Barbiturates produce anaesthesia through two complementary mechanisms:
  1. Enhancement of inhibitory neurotransmission — potentiate GABA-A receptor–mediated Cl⁻ current (at a site distinct from benzodiazepines; at high concentrations they can directly activate the channel even without GABA)
  2. Inhibition of excitatory neurotransmission — suppress glutamate and acetylcholine receptor activity
They do not possess analgesic properties; some evidence suggests they may even lower the pain threshold (hyperalgesia).
  • Katzung's Basic & Clinical Pharmacology, 16e
  • Miller's Anesthesia, 10e

4. Pharmacokinetics

ParameterThiopentalMethohexital
Protein binding~85%~73%
pKa7.67.9
Onset (IV)15–30 s~30 s
Elimination half-lifeLong (hours–days)Shorter (faster clearance)
Primary eliminationHepatic (oxidation, N-dealkylation, desulfuration)Hepatic (greater plasma clearance)
Recovery mechanism: After a single bolus, recovery depends on redistribution from brain to muscle and fat, not on hepatic metabolism — hence both agents have similar emergence profiles after a single dose.
After repeated bolus or infusion, recovery depends on elimination (metabolism), and thiopental accumulates markedly — its context-sensitive half-time increases substantially. Methohexital accumulates less because of its larger plasma clearance.
A small fraction of thiopental undergoes desulfuration to pentobarbital (a longer-acting hypnotic).
Protein binding: Conditions that reduce serum albumin (hepatic disease, burns, malnutrition, uremia, malignancy) increase free drug concentration and the hypnotic effect of a given dose.
  • Katzung's Basic & Clinical Pharmacology, 16e, p. 710
  • Miller's Anesthesia, 10e

5. Organ System Effects

5.1 Central Nervous System

  • Dose-dependent CNS depression: sedation → hypnosis → general anaesthesia → burst suppression → isoelectric EEG
  • No analgesia (may cause hyperalgesia)
  • Potent cerebral vasoconstrictors → ↓ cerebral blood flow (CBF) → ↓ cerebral blood volume (CBV) → ↓ intracranial pressure (ICP)
  • CMRO₂ (cerebral metabolic rate for O₂) in a dose-dependent manner up to EEG burst suppression
  • Neuroprotection: effective against focal cerebral ischaemia (stroke, retraction, temporary clips during aneurysm surgery); not effective after global ischaemia (cardiac arrest)
  • Anticonvulsant (except methohexital)
  • Methohexital exception: activates epileptic foci → drug of choice for ECT anaesthesia and for identifying epileptic foci intraoperatively

5.2 Cardiovascular System

  • ↓ Systemic blood pressure primarily from peripheral vasodilation (predominantly venodilation)
  • Direct negative inotropic effect on the heart
  • Reflex tachycardia (baroreceptor reflex is partially but less completely blunted compared to propofol)
  • BP decrease is usually smaller than with propofol
  • Thiopental maintains cardiac output better than equipotent doses of propofol
  • Caution in hypovolaemia, haemorrhagic shock, cardiac disease

5.3 Respiratory System

  • Dose-dependent respiratory depression — ↓ tidal volume, ↓ respiratory rate, ↓ hypercapnic and hypoxic ventilatory responses
  • Apnoea is common after induction doses, especially with rapid injection
  • Does NOT cause bronchodilation (unlike propofol and ketamine) — avoid in active bronchospasm

5.4 Hepatic/Renal

  • Porphyria: Barbiturates stimulate aminolevulinic acid (ALA) synthetase → ↑ porphyrin production → can precipitate an acute porphyric crisisabsolute contraindication in acute intermittent porphyria (AIP)
  • Katzung's, pp. 2403–2413
  • Miller's Anesthesia, 10e

6. Clinical Uses

IndicationAgentDose
Induction of GA (adult)Thiopental3–4 mg/kg IV
Induction of GA (adult)Methohexital1–2 mg/kg IV
ECT anaesthesiaMethohexital (preferred)0.5–1 mg/kg IV
Maintenance of GA (infusion)Methohexital50–150 mcg/kg/min
Paediatric premedication (rectal)Methohexital25 mg/kg rectal (10% solution)
ICP reduction / cerebral protectionThiopentalTitrated to burst suppression
Barbiturate coma (refractory ICP)Thiopental/pentobarbitalLoading dose, then infusion
Dose reductions required in: elderly, haemorrhagic shock, low cardiac output, lean body mass extremes, obesity, hypoalbuminaemia, severe anaemia, burns, uremia, malignancy, and with opioid/benzodiazepine premedication.
  • Miller's Anesthesia, 10e, p. 2509–2511

7. Contraindications

ContraindicationReason
Acute intermittent porphyriaStimulates ALA synthetase → porphyric crisis
Known hypersensitivityAnaphylaxis / anaphylactoid reactions
Absence of resuscitation facilitiesApnoea risk
Severe cardiovascular compromiseVasodilation + negative inotropy
No IV accessAdministration requires IV access
  • Miller's Anesthesia, 10e

8. Adverse Effects & Complications

EffectDetails
ApnoeaCommon after induction dose; dose/rate dependent
Cardiovascular depressionHypotension, especially in hypovolaemia
LaryngospasmMore likely with airway stimulation under light barbiturate anaesthesia (compared to propofol)
Pain on injectionMild; less than propofol
Intra-arterial injectionCan cause intense vasospasm, endarteritis, gangrene — requires immediate treatment (dilute, papaverine, sympathetic block)
Subcutaneous extravasationHighly alkaline → tissue necrosis
AnaphylaxisRare; mediated by direct histamine release
Excitatory phenomenaHiccup, tremor, myoclonic movements (esp. methohexital)
Prolonged recoveryAfter infusion/repeated doses due to accumulation
Adrenal suppressionNOT a barbiturate issue (etomidate)

9. Comparison: Thiopental vs. Methohexital vs. Propofol

PropertyThiopentalMethohexitalPropofol
ClassThiobarbiturateOxybarbituratePhenol
Induction dose3–4 mg/kg1–2 mg/kg1.5–2.5 mg/kg
Onset15–30 s~30 s~30 s
AnticonvulsantYesNo (proconvulsant)Yes
ECTNoFirst choiceUsed but shortens seizure
BP effect↓ (moderate)↓ (moderate)↓ (greater)
Recovery after infusionProlongedFasterFastest
Anti-emeticNoNoYes
Pain on injectionMildMildCommon
Availability (US)Limited/discontinuedAvailableWidely available
  • Miller's Anesthesia, 10e
  • Katzung's, p. 2390

10. Current Status

Barbiturates have been largely replaced by propofol as the agent of choice for IV induction of anaesthesia worldwide. This is due to propofol's superior pharmacokinetic profile (faster, more complete recovery), anti-emetic properties, and better recovery characteristics.
Thiopental's availability has been further restricted by legal controversies around its use in lethal injection (US executions), leading to a shortage and withdrawal from the US market.
Methohexital remains in active clinical use primarily for ECT anaesthesia and as a rectal premedication in paediatric patients.
Thiopental retains a role in:
  • Rapid sequence induction where propofol is contraindicated
  • Raised ICP management / barbiturate coma
  • Neuroprotection during temporary vascular occlusion in neurosurgery
  • Status epilepticus refractory to other agents
  • Miller's Anesthesia, 10e; Katzung's Basic & Clinical Pharmacology, 16e; Morgan & Mikhail's Clinical Anesthesiology, 7e; Goodman & Gilman's Pharmacological Basis of Therapeutics

Make a ppt

Reading File
Reading File
Reading File
Running Command

ls -la /home/daytona/workspace/ 2>/dev/null || mkdir -p /home/daytona/workspace

Running Command

mkdir -p /home/daytona/workspace/barbiturates-ppt

Writing File

~/barbiturates-ppt/make_ppt.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.author = "MD Anaesthesia";
pres.title = "Barbiturates in Anaesthesia";

// ─── COLOR PALETTE ──────────────────────────────────────────────────────────
// Deep navy/charcoal dominant + teal accent + warm amber highlight
const BG       = "0D1B2A";   // deep navy
const CARD     = "152232";   // slightly lighter navy for cards
const ACCENT   = "00C9A7";   // vibrant teal
const ACCENT2  = "F4A261";   // warm amber
const WHITE    = "FFFFFF";
const LGRAY    = "B0BEC5";
const MGRAY    = "546E7A";
const DGRAY    = "263238";

// ─── HELPER FUNCTIONS ────────────────────────────────────────────────────────
function addBg(slide) {
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: 10, h: 5.625,
    fill: { color: BG }, line: { color: BG }
  });
}

function addSideBar(slide) {
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: 0.12, h: 5.625,
    fill: { color: ACCENT }, line: { color: ACCENT }
  });
}

function addSlideTitle(slide, title, sub) {
  slide.addText(title, {
    x: 0.3, y: 0.18, w: 9.4, h: 0.55,
    fontSize: 22, bold: true, color: ACCENT,
    fontFace: "Calibri", margin: 0
  });
  if (sub) {
    slide.addShape(pres.shapes.RECTANGLE, {
      x: 0.3, y: 0.76, w: 1.2, h: 0.04,
      fill: { color: ACCENT2 }, line: { color: ACCENT2 }
    });
  }
}

function card(slide, x, y, w, h, opts = {}) {
  slide.addShape(pres.shapes.RECTANGLE, {
    x, y, w, h,
    fill: { color: opts.fill || CARD },
    line: { color: opts.border || ACCENT, pt: opts.borderPt || 1.5 },
    shadow: { type: "outer", color: "000000", blur: 8, offset: 3, angle: 135, opacity: 0.25 }
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE SLIDE
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s);

  // Top accent bar
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: 10, h: 0.08,
    fill: { color: ACCENT }, line: { color: ACCENT }
  });

  // Bottom accent bar
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 5.545, w: 10, h: 0.08,
    fill: { color: ACCENT2 }, line: { color: ACCENT2 }
  });

  // Decorative circle (big, faded)
  s.addShape(pres.shapes.OVAL, {
    x: 6.5, y: -1.5, w: 5, h: 5,
    fill: { color: ACCENT, transparency: 88 },
    line: { color: ACCENT, transparency: 80, pt: 2 }
  });
  s.addShape(pres.shapes.OVAL, {
    x: 7.2, y: -0.8, w: 3.5, h: 3.5,
    fill: { color: ACCENT, transparency: 93 },
    line: { color: ACCENT, transparency: 85, pt: 1.5 }
  });

  // Rx symbol area
  card(s, 0.6, 1.0, 1.4, 1.4, { fill: ACCENT, borderPt: 0, border: ACCENT });
  s.addText("Rx", {
    x: 0.6, y: 1.0, w: 1.4, h: 1.4,
    fontSize: 42, bold: true, color: BG,
    fontFace: "Calibri", align: "center", valign: "middle", margin: 0
  });

  // Main title
  s.addText("BARBITURATES", {
    x: 2.35, y: 1.0, w: 7.3, h: 0.72,
    fontSize: 44, bold: true, color: WHITE,
    fontFace: "Calibri", charSpacing: 6, margin: 0
  });
  s.addText("IN ANAESTHESIA", {
    x: 2.35, y: 1.72, w: 7.3, h: 0.52,
    fontSize: 28, bold: false, color: ACCENT,
    fontFace: "Calibri", charSpacing: 4, margin: 0
  });

  // Horizontal rule
  s.addShape(pres.shapes.RECTANGLE, {
    x: 2.35, y: 2.38, w: 5.0, h: 0.04,
    fill: { color: ACCENT2 }, line: { color: ACCENT2 }
  });

  // Subtitle
  s.addText("Pharmacology · Clinical Use · Organ System Effects", {
    x: 2.35, y: 2.52, w: 7.3, h: 0.4,
    fontSize: 14, color: LGRAY, fontFace: "Calibri", italic: true, margin: 0
  });

  s.addText("MD Anaesthesia", {
    x: 2.35, y: 3.05, w: 7.3, h: 0.32,
    fontSize: 13, color: MGRAY, fontFace: "Calibri", margin: 0
  });

  // Bottom text
  s.addText("Miller's Anesthesia 10e  ·  Morgan & Mikhail 7e  ·  Katzung 16e  ·  Goodman & Gilman", {
    x: 0.3, y: 5.15, w: 9.4, h: 0.3,
    fontSize: 9, color: MGRAY, fontFace: "Calibri", italic: true, align: "center", margin: 0
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 2 — OUTLINE
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s);
  addSideBar(s);
  addSlideTitle(s, "OUTLINE", true);

  const topics = [
    { n: "01", t: "Historical Background" },
    { n: "02", t: "Chemistry & Structure–Activity Relationships" },
    { n: "03", t: "Mechanism of Action" },
    { n: "04", t: "Pharmacokinetics" },
    { n: "05", t: "Organ System Effects" },
    { n: "06", t: "Clinical Uses & Dosing" },
    { n: "07", t: "Contraindications & Adverse Effects" },
    { n: "08", t: "Comparison & Current Status" },
  ];

  const cols = [
    topics.slice(0, 4),
    topics.slice(4, 8)
  ];

  cols.forEach((col, ci) => {
    const startX = 0.4 + ci * 4.85;
    col.forEach((item, i) => {
      const y = 1.0 + i * 1.05;
      // Number chip
      s.addShape(pres.shapes.RECTANGLE, {
        x: startX, y: y, w: 0.55, h: 0.45,
        fill: { color: ACCENT }, line: { color: ACCENT }
      });
      s.addText(item.n, {
        x: startX, y: y, w: 0.55, h: 0.45,
        fontSize: 13, bold: true, color: BG, fontFace: "Calibri",
        align: "center", valign: "middle", margin: 0
      });
      s.addText(item.t, {
        x: startX + 0.65, y: y, w: 4.0, h: 0.45,
        fontSize: 13, color: WHITE, fontFace: "Calibri",
        valign: "middle", margin: 0
      });
      // Thin separator line
      if (i < col.length - 1) {
        s.addShape(pres.shapes.RECTANGLE, {
          x: startX, y: y + 0.48, w: 4.55, h: 0.02,
          fill: { color: MGRAY, transparency: 50 }, line: { color: MGRAY }
        });
      }
    });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 3 — HISTORICAL BACKGROUND
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s);
  addSideBar(s);
  addSlideTitle(s, "HISTORICAL BACKGROUND", true);

  const events = [
    { yr: "1903", ev: "Barbiturates first synthesized — Fischer & von Mering" },
    { yr: "1927", ev: "Hexobarbital introduced → barbiturate induction becomes popular" },
    { yr: "1932", ev: "Thiopental synthesized by Volwiler & Tabern" },
    { yr: "1934", ev: "Thiopental first used clinically — John Lundy & Ralph Waters" },
    { yr: "1957", ev: "Methohexital first used clinically — V.K. Stoelting" },
    { yr: "1986", ev: "Propofol released — gradually replaced barbiturates for induction" },
  ];

  events.forEach((e, i) => {
    const y = 0.95 + i * 0.73;
    // Year pill
    s.addShape(pres.shapes.RECTANGLE, {
      x: 0.3, y: y, w: 0.9, h: 0.42,
      fill: { color: i % 2 === 0 ? ACCENT : ACCENT2 }, line: { color: "000000", pt: 0 }
    });
    s.addText(e.yr, {
      x: 0.3, y: y, w: 0.9, h: 0.42,
      fontSize: 12, bold: true, color: BG, fontFace: "Calibri",
      align: "center", valign: "middle", margin: 0
    });
    // Connector dot
    s.addShape(pres.shapes.OVAL, {
      x: 1.32, y: y + 0.17, w: 0.08, h: 0.08,
      fill: { color: LGRAY }, line: { color: LGRAY }
    });
    // Event text
    s.addText(e.ev, {
      x: 1.52, y: y, w: 8.1, h: 0.42,
      fontSize: 13, color: WHITE, fontFace: "Calibri",
      valign: "middle", margin: 0
    });
    // Thin line separator
    if (i < events.length - 1) {
      s.addShape(pres.shapes.RECTANGLE, {
        x: 0.3, y: y + 0.45, w: 9.35, h: 0.015,
        fill: { color: MGRAY, transparency: 60 }, line: { color: MGRAY }
      });
    }
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 4 — CHEMISTRY
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s);
  addSideBar(s);
  addSlideTitle(s, "CHEMISTRY & STRUCTURE–ACTIVITY RELATIONSHIPS", true);

  // Left column — classes
  card(s, 0.3, 0.95, 4.5, 2.0);
  s.addText("TWO MAJOR CLASSES", {
    x: 0.35, y: 0.97, w: 4.4, h: 0.35,
    fontSize: 12, bold: true, color: ACCENT, fontFace: "Calibri", margin: 0
  });
  const classes = [
    ["Thiobarbiturates", "Sulfur at C2 · High lipid solubility · Fast onset", "Thiopental, Thiamylal"],
    ["Oxybarbiturates", "Oxygen at C2 · Slightly lower lipid solubility", "Methohexital"],
  ];
  classes.forEach((c, i) => {
    const cy = 1.35 + i * 0.75;
    s.addShape(pres.shapes.RECTANGLE, {
      x: 0.35, y: cy, w: 0.06, h: 0.38,
      fill: { color: i === 0 ? ACCENT : ACCENT2 }, line: { color: "000000", pt: 0 }
    });
    s.addText(c[0], {
      x: 0.5, y: cy, w: 4.1, h: 0.22,
      fontSize: 12, bold: true, color: WHITE, fontFace: "Calibri", margin: 0
    });
    s.addText(c[1], {
      x: 0.5, y: cy + 0.22, w: 4.1, h: 0.18,
      fontSize: 10, color: LGRAY, fontFace: "Calibri", margin: 0
    });
  });

  // Right column — SAR
  card(s, 5.1, 0.95, 4.6, 2.0);
  s.addText("STRUCTURE–ACTIVITY RELATIONSHIPS", {
    x: 5.15, y: 0.97, w: 4.5, h: 0.35,
    fontSize: 12, bold: true, color: ACCENT2, fontFace: "Calibri", margin: 0
  });
  const sar = [
    "C5 alkyl/aryl substitution → hypnotic activity",
    "C5 phenyl group → anticonvulsant (phenobarbital)",
    "C2 sulfur → ↑ lipid solubility, faster onset (thiobarbiturates)",
    "N1 methylation → ↑ CNS excitability (methohexital, proconvulsant)",
    "Longer C5 alkyl chain → ↑ potency + toxicity",
    "Branching at C5 → ↑ potency, shorter duration",
  ];
  sar.forEach((t, i) => {
    s.addText([
      { text: "▸ ", options: { color: ACCENT2, bold: true } },
      { text: t, options: { color: WHITE } }
    ], {
      x: 5.15, y: 1.36 + i * 0.24, w: 4.45, h: 0.24,
      fontSize: 10.5, fontFace: "Calibri", margin: 0
    });
  });

  // Formulation box
  card(s, 0.3, 3.15, 9.4, 1.6, { border: ACCENT2 });
  s.addText("FORMULATION", {
    x: 0.4, y: 3.18, w: 2.0, h: 0.28,
    fontSize: 11, bold: true, color: ACCENT2, fontFace: "Calibri", margin: 0
  });
  const fdata = [
    ["Thiopental", "2.5% solution", "pH 10–11", "Stable 1 week (refrigerated)"],
    ["Methohexital", "1% solution", "pH 10–11", "Stable 6 weeks (refrigerated)"],
    ["Thiamylal", "2% solution", "pH 10–11", "Veterinary use only (US)"],
  ];
  const headers = ["Agent", "Concentration", "pH", "Stability"];
  headers.forEach((h, ci) => {
    s.addText(h, {
      x: 0.35 + ci * 2.3, y: 3.52, w: 2.2, h: 0.24,
      fontSize: 10, bold: true, color: ACCENT, fontFace: "Calibri", margin: 0
    });
  });
  fdata.forEach((row, ri) => {
    row.forEach((cell, ci) => {
      s.addText(cell, {
        x: 0.35 + ci * 2.3, y: 3.79 + ri * 0.3, w: 2.2, h: 0.28,
        fontSize: 10, color: ri % 2 === 0 ? WHITE : LGRAY, fontFace: "Calibri", margin: 0
      });
    });
  });

  s.addText("⚠ Cannot be mixed with acidic solutions (precipitates as free acid): vecuronium, rocuronium, suxamethonium, midazolam, alfentanil, atracurium", {
    x: 0.35, y: 4.68, w: 9.3, h: 0.35,
    fontSize: 9.5, color: ACCENT2, fontFace: "Calibri", italic: true, margin: 0
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 5 — MECHANISM OF ACTION
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s);
  addSideBar(s);
  addSlideTitle(s, "MECHANISM OF ACTION", true);

  // Two main mechanisms
  const mechs = [
    {
      title: "↑ Inhibitory Transmission",
      sub: "GABA-A Receptor Potentiation",
      color: ACCENT,
      pts: [
        "Bind to barbiturate site on GABA-A receptor complex",
        "Prolong duration of Cl⁻ channel opening",
        "At high doses: directly activate channel even WITHOUT GABA",
        "Site is distinct from the benzodiazepine binding site",
      ]
    },
    {
      title: "↓ Excitatory Transmission",
      sub: "Glutamate & ACh Receptor Suppression",
      color: ACCENT2,
      pts: [
        "Inhibit AMPA-type glutamate receptors",
        "Suppress nicotinic acetylcholine receptor activity",
        "Mechanism less well understood than GABAergic effect",
        "Contributes to overall CNS depression",
      ]
    }
  ];

  mechs.forEach((m, i) => {
    const x = 0.3 + i * 4.85;
    card(s, x, 0.9, 4.55, 3.5, { border: m.color });
    // Colored top accent
    s.addShape(pres.shapes.RECTANGLE, {
      x, y: 0.9, w: 4.55, h: 0.08,
      fill: { color: m.color }, line: { color: m.color }
    });
    s.addText(m.title, {
      x: x + 0.15, y: 1.05, w: 4.25, h: 0.35,
      fontSize: 14, bold: true, color: m.color, fontFace: "Calibri", margin: 0
    });
    s.addText(m.sub, {
      x: x + 0.15, y: 1.42, w: 4.25, h: 0.28,
      fontSize: 11, color: LGRAY, fontFace: "Calibri", italic: true, margin: 0
    });
    s.addShape(pres.shapes.RECTANGLE, {
      x: x + 0.15, y: 1.73, w: 3.0, h: 0.03,
      fill: { color: m.color, transparency: 50 }, line: { color: m.color }
    });
    m.pts.forEach((p, pi) => {
      s.addText([
        { text: "• ", options: { color: m.color, bold: true } },
        { text: p, options: { color: WHITE } }
      ], {
        x: x + 0.15, y: 1.85 + pi * 0.5, w: 4.25, h: 0.45,
        fontSize: 11.5, fontFace: "Calibri", margin: 0
      });
    });
  });

  // Important note
  card(s, 0.3, 4.5, 9.4, 0.75, { border: ACCENT2, fill: "1a2e40" });
  s.addText([
    { text: "⚠ IMPORTANT: ", options: { color: ACCENT2, bold: true } },
    { text: "Barbiturates have ", options: { color: WHITE } },
    { text: "NO analgesic properties", options: { color: ACCENT2, bold: true } },
    { text: ". Some evidence suggests they may reduce the pain threshold → ", options: { color: WHITE } },
    { text: "HYPERALGESIA", options: { color: ACCENT2, bold: true } },
  ], {
    x: 0.45, y: 4.55, w: 9.1, h: 0.65,
    fontSize: 12, fontFace: "Calibri", valign: "middle", margin: 0
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 6 — PHARMACOKINETICS
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s);
  addSideBar(s);
  addSlideTitle(s, "PHARMACOKINETICS", true);

  // Table header
  const cols2 = ["Parameter", "Thiopental", "Methohexital"];
  const colW  = [3.2, 3.1, 3.1];
  const startX = 0.3;
  const hY = 0.9;

  // Header row
  cols2.forEach((h, ci) => {
    const x = startX + colW.slice(0, ci).reduce((a, b) => a + b, 0);
    s.addShape(pres.shapes.RECTANGLE, {
      x, y: hY, w: colW[ci], h: 0.38,
      fill: { color: ci === 0 ? MGRAY : ACCENT }, line: { color: BG, pt: 1 }
    });
    s.addText(h, {
      x, y: hY, w: colW[ci], h: 0.38,
      fontSize: 12, bold: true, color: ci === 0 ? LGRAY : BG,
      fontFace: "Calibri", align: "center", valign: "middle", margin: 0
    });
  });

  const rows = [
    ["Class",                  "Thiobarbiturate",          "Oxybarbiturate"],
    ["Protein Binding",        "~85%",                     "~73%"],
    ["pKa",                    "7.6",                      "7.9"],
    ["Onset (IV)",             "15–30 seconds",            "~30 seconds"],
    ["Induction Dose",         "3–4 mg/kg",                "1–2 mg/kg"],
    ["Plasma Clearance",       "Low (slower)",             "High (faster)"],
    ["Elimination Half-life",  "Hours–days (prolonged)",   "Shorter"],
    ["Recovery after single dose", "Redistribution-dependent", "Redistribution-dependent"],
    ["Recovery after infusion","Markedly prolonged",       "Faster (less accumulation)"],
  ];

  rows.forEach((row, ri) => {
    const rowY = hY + 0.38 + ri * 0.44;
    const isBg = ri % 2 === 0;
    row.forEach((cell, ci) => {
      const x = startX + colW.slice(0, ci).reduce((a, b) => a + b, 0);
      s.addShape(pres.shapes.RECTANGLE, {
        x, y: rowY, w: colW[ci], h: 0.42,
        fill: { color: isBg ? CARD : DGRAY }, line: { color: MGRAY, pt: 0.5 }
      });
      s.addText(cell, {
        x: x + 0.08, y: rowY, w: colW[ci] - 0.1, h: 0.42,
        fontSize: 10.5, color: ci === 0 ? LGRAY : WHITE,
        fontFace: "Calibri", valign: "middle", margin: 0,
        bold: ci === 0
      });
    });
  });

  // Key concept box
  card(s, 0.3, 5.08, 9.4, 0.45, { border: ACCENT, fill: "0a1929" });
  s.addText([
    { text: "Key: ", options: { color: ACCENT, bold: true } },
    { text: "After a SINGLE BOLUS — recovery depends on ", options: { color: WHITE } },
    { text: "REDISTRIBUTION", options: { color: ACCENT, bold: true } },
    { text: " (brain→muscle→fat), not metabolism. After INFUSION/repeated doses — recovery depends on ", options: { color: WHITE } },
    { text: "ELIMINATION", options: { color: ACCENT2, bold: true } },
    { text: " → thiopental accumulates markedly.", options: { color: WHITE } },
  ], {
    x: 0.45, y: 5.1, w: 9.1, h: 0.4,
    fontSize: 10, fontFace: "Calibri", valign: "middle", margin: 0
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 7 — CNS EFFECTS
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s);
  addSideBar(s);
  addSlideTitle(s, "ORGAN SYSTEM EFFECTS — CNS", true);

  // Dose-response ladder
  card(s, 0.3, 0.9, 4.3, 4.35, { border: ACCENT });
  s.addText("DOSE-DEPENDENT CNS DEPRESSION", {
    x: 0.4, y: 0.93, w: 4.1, h: 0.3,
    fontSize: 11, bold: true, color: ACCENT, fontFace: "Calibri", margin: 0
  });

  const steps = [
    { t: "Sedation", c: "1C3A2E" },
    { t: "Hypnosis", c: "155E4E" },
    { t: "General Anaesthesia", c: "00897B" },
    { t: "Burst Suppression (EEG)", c: "00BFA5" },
    { t: "Isoelectric EEG", c: ACCENT },
  ];
  steps.forEach((st, i) => {
    const w = 1.5 + i * 0.55;
    const x = 0.38 + (4.1 - w) / 2;
    s.addShape(pres.shapes.RECTANGLE, {
      x, y: 1.28 + i * 0.72, w, h: 0.5,
      fill: { color: st.c }, line: { color: "000000", pt: 0 }
    });
    s.addText(st.t, {
      x: 0.38, y: 1.28 + i * 0.72, w: 4.1, h: 0.5,
      fontSize: 11, color: i < 3 ? LGRAY : BG, fontFace: "Calibri",
      align: "center", valign: "middle", bold: i === 4, margin: 0
    });
    if (i < steps.length - 1) {
      s.addText("↓  increasing dose", {
        x: 0.38, y: 1.8 + i * 0.72, w: 4.1, h: 0.22,
        fontSize: 8.5, color: MGRAY, fontFace: "Calibri", align: "center", margin: 0
      });
    }
  });

  // Right — effects
  const effects = [
    { icon: "↓", lbl: "Cerebral Blood Flow (CBF)", sub: "Potent cerebral vasoconstrictor" },
    { icon: "↓", lbl: "ICP", sub: "Due to ↓CBV — useful in space-occupying lesions" },
    { icon: "↓", lbl: "CMRO₂", sub: "Dose-dependent; max effect at burst suppression" },
    { icon: "✓", lbl: "Focal Neuroprotection", sub: "Stroke, surgical retraction, temporary clips" },
    { icon: "✗", lbl: "Global Ischaemia", sub: "NOT effective after cardiac arrest" },
    { icon: "⚡", lbl: "Anticonvulsant (except methohexital)", sub: "Methohexital activates epileptic foci → ECT" },
  ];

  effects.forEach((e, i) => {
    const ex = 4.8;
    const ey = 0.88 + i * 0.76;
    const iconColor = e.icon === "↓" ? ACCENT : e.icon === "✓" ? "4CAF50" : e.icon === "✗" ? "EF5350" : ACCENT2;
    s.addShape(pres.shapes.OVAL, {
      x: ex, y: ey, w: 0.42, h: 0.42,
      fill: { color: iconColor, transparency: 15 }, line: { color: iconColor }
    });
    s.addText(e.icon, {
      x: ex, y: ey, w: 0.42, h: 0.42,
      fontSize: 14, bold: true, color: BG, fontFace: "Calibri",
      align: "center", valign: "middle", margin: 0
    });
    s.addText(e.lbl, {
      x: ex + 0.52, y: ey, w: 4.8, h: 0.24,
      fontSize: 12, bold: true, color: WHITE, fontFace: "Calibri", margin: 0
    });
    s.addText(e.sub, {
      x: ex + 0.52, y: ey + 0.24, w: 4.8, h: 0.22,
      fontSize: 10, color: LGRAY, fontFace: "Calibri", margin: 0
    });
    if (i < effects.length - 1) {
      s.addShape(pres.shapes.RECTANGLE, {
        x: ex, y: ey + 0.5, w: 5.25, h: 0.015,
        fill: { color: MGRAY, transparency: 60 }, line: { color: MGRAY }
      });
    }
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 8 — CVS & RESPIRATORY EFFECTS
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s);
  addSideBar(s);
  addSlideTitle(s, "ORGAN SYSTEM EFFECTS — CVS & RESPIRATORY", true);

  // CVS card
  card(s, 0.3, 0.9, 4.55, 4.3, { border: ACCENT2 });
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.3, y: 0.9, w: 4.55, h: 0.08,
    fill: { color: ACCENT2 }, line: { color: ACCENT2 }
  });
  s.addText("CARDIOVASCULAR EFFECTS", {
    x: 0.4, y: 1.02, w: 4.35, h: 0.3,
    fontSize: 12, bold: true, color: ACCENT2, fontFace: "Calibri", margin: 0
  });

  const cvs = [
    ["↓ Blood Pressure", "Primary: peripheral vasodilation (venodilation)"],
    ["Direct negative inotropy", "Decreased cardiac contractility"],
    ["Reflex tachycardia", "Compensatory response to ↓ BP"],
    ["Baroreceptor blunting", "Less pronounced than propofol"],
    ["Maintains CO better", "Than equipotent propofol dose"],
    ["Caution required in", "Hypovolaemia, shock, cardiac disease"],
  ];

  cvs.forEach(([h, d], i) => {
    s.addText(h, {
      x: 0.45, y: 1.37 + i * 0.58, w: 4.25, h: 0.24,
      fontSize: 11.5, bold: true, color: WHITE, fontFace: "Calibri", margin: 0
    });
    s.addText(d, {
      x: 0.45, y: 1.62 + i * 0.58, w: 4.25, h: 0.22,
      fontSize: 10, color: LGRAY, fontFace: "Calibri", margin: 0, italic: true
    });
  });

  // Respiratory card
  card(s, 5.1, 0.9, 4.55, 4.3, { border: ACCENT });
  s.addShape(pres.shapes.RECTANGLE, {
    x: 5.1, y: 0.9, w: 4.55, h: 0.08,
    fill: { color: ACCENT }, line: { color: ACCENT }
  });
  s.addText("RESPIRATORY EFFECTS", {
    x: 5.2, y: 1.02, w: 4.35, h: 0.3,
    fontSize: 12, bold: true, color: ACCENT, fontFace: "Calibri", margin: 0
  });

  const resp = [
    ["Dose-dependent respiratory depression", "↓ Tidal volume, ↓ respiratory rate"],
    ["Apnoea", "Common after induction; rate/dose dependent"],
    ["↓ Hypercapnic drive", "Blunted CO₂ ventilatory response"],
    ["↓ Hypoxic drive", "Peripheral chemoreceptor suppression"],
    ["Laryngospasm risk", "↑ With airway stimulation under light depth"],
    ["NO bronchodilation", "Avoid in reactive airway disease / bronchospasm"],
  ];

  resp.forEach(([h, d], i) => {
    s.addText(h, {
      x: 5.2, y: 1.37 + i * 0.58, w: 4.35, h: 0.24,
      fontSize: 11.5, bold: true, color: WHITE, fontFace: "Calibri", margin: 0
    });
    s.addText(d, {
      x: 5.2, y: 1.62 + i * 0.58, w: 4.35, h: 0.22,
      fontSize: 10, color: LGRAY, fontFace: "Calibri", margin: 0, italic: true
    });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 9 — CLINICAL USES & DOSING
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s);
  addSideBar(s);
  addSlideTitle(s, "CLINICAL USES & DOSING", true);

  // Uses table
  const tdata = [
    { use: "Induction of GA (adult)", agent: "Thiopental", dose: "3–4 mg/kg IV", note: "Prompt onset 15–30 sec" },
    { use: "Induction of GA (adult)", agent: "Methohexital", dose: "1–2 mg/kg IV", note: "ED50 ~1.1 mg/kg" },
    { use: "ECT Anaesthesia", agent: "Methohexital ★", dose: "0.5–1 mg/kg IV", note: "Drug of CHOICE (proconvulsant)" },
    { use: "Maintenance (infusion)", agent: "Methohexital", dose: "50–150 mcg/kg/min", note: "<60 min; comparable to propofol" },
    { use: "Paediatric premedication", agent: "Methohexital", dose: "25 mg/kg RECTAL", note: "10% solution, 7 cm into rectum" },
    { use: "Raised ICP / barbiturate coma", agent: "Thiopental/Pentobarbital", dose: "Titrated to burst suppression", note: "Cerebral protection, focal ischaemia" },
    { use: "Refractory status epilepticus", agent: "Thiopental", dose: "Loading then infusion", note: "Anticonvulsant effect" },
    { use: "Neonatal induction", agent: "Thiopental", dose: "2–4 mg/kg IV", note: "Avoid in congenital HD / hypovolaemia" },
  ];

  const hdr = ["Indication", "Agent", "Dose", "Notes"];
  const cw  = [2.8, 2.0, 2.4, 2.45];
  const sx  = 0.25;
  const hy  = 0.9;

  hdr.forEach((h, ci) => {
    const x = sx + cw.slice(0, ci).reduce((a, b) => a + b, 0);
    s.addShape(pres.shapes.RECTANGLE, {
      x, y: hy, w: cw[ci], h: 0.36,
      fill: { color: ACCENT }, line: { color: BG, pt: 1 }
    });
    s.addText(h, {
      x, y: hy, w: cw[ci], h: 0.36,
      fontSize: 11, bold: true, color: BG, fontFace: "Calibri",
      align: "center", valign: "middle", margin: 0
    });
  });

  tdata.forEach((row, ri) => {
    const ry = hy + 0.36 + ri * 0.53;
    const cells = [row.use, row.agent, row.dose, row.note];
    cells.forEach((cell, ci) => {
      const x = sx + cw.slice(0, ci).reduce((a, b) => a + b, 0);
      s.addShape(pres.shapes.RECTANGLE, {
        x, y: ry, w: cw[ci], h: 0.5,
        fill: { color: ri % 2 === 0 ? CARD : DGRAY },
        line: { color: MGRAY, pt: 0.5 }
      });
      const isECT = row.agent.includes("★");
      s.addText(cell, {
        x: x + 0.06, y: ry, w: cw[ci] - 0.08, h: 0.5,
        fontSize: 9.5, color: isECT && ci === 1 ? ACCENT2 : WHITE,
        fontFace: "Calibri", valign: "middle", margin: 0,
        bold: ci === 1 && isECT
      });
    });
  });

  // Dose reduction note
  s.addText("★ Dose reductions required in: elderly · haemorrhagic shock · ↓ cardiac output · obesity · hypoalbuminaemia · severe anaemia · burns · uraemia · malignancy · opioid/BZD premedication", {
    x: 0.25, y: 5.28, w: 9.5, h: 0.3,
    fontSize: 8.5, color: ACCENT2, fontFace: "Calibri", italic: true, margin: 0
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 10 — CONTRAINDICATIONS & ADVERSE EFFECTS
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s);
  addSideBar(s);
  addSlideTitle(s, "CONTRAINDICATIONS & ADVERSE EFFECTS", true);

  // Contraindications
  card(s, 0.3, 0.88, 4.55, 2.4, { border: "EF5350" });
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.3, y: 0.88, w: 4.55, h: 0.08,
    fill: { color: "EF5350" }, line: { color: "EF5350" }
  });
  s.addText("CONTRAINDICATIONS", {
    x: 0.4, y: 1.0, w: 4.35, h: 0.3,
    fontSize: 12, bold: true, color: "EF5350", fontFace: "Calibri", margin: 0
  });
  const contra = [
    ["Acute Intermittent Porphyria", "ABSOLUTE — stimulates ALA synthetase → porphyric crisis"],
    ["Known Hypersensitivity", "Anaphylaxis / anaphylactoid reactions"],
    ["Severe CVS compromise", "Vasodilation + negative inotropy → severe hypotension"],
    ["No IV access / resuscitation", "Apnoea risk"],
  ];
  contra.forEach(([h, d], i) => {
    s.addText([
      { text: "✕ ", options: { color: "EF5350", bold: true } },
      { text: h, options: { color: WHITE, bold: true } },
    ], {
      x: 0.42, y: 1.36 + i * 0.47, w: 4.3, h: 0.22,
      fontSize: 11, fontFace: "Calibri", margin: 0
    });
    s.addText(d, {
      x: 0.55, y: 1.59 + i * 0.47, w: 4.15, h: 0.18,
      fontSize: 9.5, color: LGRAY, fontFace: "Calibri", italic: true, margin: 0
    });
  });

  // Adverse effects
  card(s, 5.1, 0.88, 4.55, 2.4, { border: ACCENT2 });
  s.addShape(pres.shapes.RECTANGLE, {
    x: 5.1, y: 0.88, w: 4.55, h: 0.08,
    fill: { color: ACCENT2 }, line: { color: ACCENT2 }
  });
  s.addText("ADVERSE EFFECTS", {
    x: 5.2, y: 1.0, w: 4.35, h: 0.3,
    fontSize: 12, bold: true, color: ACCENT2, fontFace: "Calibri", margin: 0
  });
  const adv = [
    ["Apnoea", "Common post-induction; dose/rate dependent"],
    ["Laryngospasm", "Under light depth with airway stimulation"],
    ["Cardiovascular depression", "Hypotension esp. in hypovolaemia"],
    ["Excitatory phenomena", "Hiccup, tremor, myoclonus (methohexital)"],
  ];
  adv.forEach(([h, d], i) => {
    s.addText([
      { text: "⚠ ", options: { color: ACCENT2, bold: true } },
      { text: h, options: { color: WHITE, bold: true } },
    ], {
      x: 5.22, y: 1.36 + i * 0.47, w: 4.3, h: 0.22,
      fontSize: 11, fontFace: "Calibri", margin: 0
    });
    s.addText(d, {
      x: 5.35, y: 1.59 + i * 0.47, w: 4.15, h: 0.18,
      fontSize: 9.5, color: LGRAY, fontFace: "Calibri", italic: true, margin: 0
    });
  });

  // Critical complications box
  card(s, 0.3, 3.42, 9.4, 1.85, { border: "EF5350", fill: "1a1010" });
  s.addText("CRITICAL INJECTION COMPLICATIONS", {
    x: 0.45, y: 3.48, w: 9.0, h: 0.3,
    fontSize: 11, bold: true, color: "EF5350", fontFace: "Calibri", margin: 0
  });
  const inj = [
    {
      h: "Intra-arterial Injection",
      d: "Intense vasospasm → endarteritis → gangrene\nTx: dilute with saline, papaverine injection, sympathetic nerve block"
    },
    {
      h: "Subcutaneous Extravasation",
      d: "Highly alkaline (pH 10–11) → tissue necrosis\nTx: hyaluronidase infiltration, warm soaks"
    },
    {
      h: "Venous Thrombosis",
      d: "High-concentration solutions → endothelial damage\nUse 2.5% thiopental or 1% methohexital only"
    },
  ];
  inj.forEach((item, i) => {
    s.addText(item.h, {
      x: 0.45 + i * 3.15, y: 3.83, w: 3.0, h: 0.26,
      fontSize: 11, bold: true, color: WHITE, fontFace: "Calibri", margin: 0
    });
    s.addText(item.d, {
      x: 0.45 + i * 3.15, y: 4.1, w: 3.05, h: 0.52,
      fontSize: 9.5, color: LGRAY, fontFace: "Calibri", margin: 0
    });
    if (i < 2) {
      s.addShape(pres.shapes.RECTANGLE, {
        x: 3.57 + i * 3.15, y: 3.78, w: 0.03, h: 0.85,
        fill: { color: MGRAY, transparency: 40 }, line: { color: MGRAY }
      });
    }
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 11 — THIOPENTAL vs METHOHEXITAL vs PROPOFOL
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s);
  addSideBar(s);
  addSlideTitle(s, "COMPARISON: THIOPENTAL vs METHOHEXITAL vs PROPOFOL", true);

  const props = [
    "Class",
    "Induction Dose",
    "Onset",
    "Anticonvulsant",
    "ECT Anaesthesia",
    "BP Effect",
    "Recovery (infusion)",
    "Anti-emetic",
    "Pain on injection",
    "Availability"
  ];
  const thio = [
    "Thiobarbiturate",
    "3–4 mg/kg",
    "15–30 sec",
    "Yes ✓",
    "Unsuitable",
    "↓ Moderate",
    "Prolonged ↓",
    "No",
    "Mild",
    "Limited/discontinued (US)"
  ];
  const meths = [
    "Oxybarbiturate",
    "1–2 mg/kg",
    "~30 sec",
    "No — Proconvulsant",
    "FIRST CHOICE ★",
    "↓ Moderate",
    "Faster (less accum.)",
    "No",
    "Mild",
    "Available"
  ];
  const prop = [
    "Alkylphenol",
    "1.5–2.5 mg/kg",
    "~30 sec",
    "Yes ✓",
    "Shortens seizure",
    "↓ Greater",
    "Fastest ✓✓",
    "Yes ✓",
    "Common (pain)",
    "Widely available"
  ];

  const cw2 = [2.55, 2.45, 2.45, 2.45];
  const sx2 = 0.25;
  const hy2 = 0.9;
  const hdrs = ["Property", "Thiopental", "Methohexital", "Propofol"];
  const hColors = [MGRAY, ACCENT, ACCENT2, "7E57C2"];
  const hTxt   = [LGRAY, BG, BG, WHITE];

  hdrs.forEach((h, ci) => {
    const x = sx2 + cw2.slice(0, ci).reduce((a, b) => a + b, 0);
    s.addShape(pres.shapes.RECTANGLE, {
      x, y: hy2, w: cw2[ci], h: 0.36,
      fill: { color: hColors[ci] }, line: { color: BG, pt: 1 }
    });
    s.addText(h, {
      x, y: hy2, w: cw2[ci], h: 0.36,
      fontSize: 11.5, bold: true, color: hTxt[ci], fontFace: "Calibri",
      align: "center", valign: "middle", margin: 0
    });
  });

  const allRows = props.map((p, i) => [p, thio[i], meths[i], prop[i]]);
  const specialRows = { 4: ACCENT2, 7: "4CAF50" }; // ECT, anti-emetic highlights

  allRows.forEach((row, ri) => {
    const ry = hy2 + 0.36 + ri * 0.46;
    row.forEach((cell, ci) => {
      const x = sx2 + cw2.slice(0, ci).reduce((a, b) => a + b, 0);
      const isSpecial = specialRows[ri] && (ci === 2 || ci === 3);
      s.addShape(pres.shapes.RECTANGLE, {
        x, y: ry, w: cw2[ci], h: 0.43,
        fill: { color: ri % 2 === 0 ? CARD : DGRAY },
        line: { color: MGRAY, pt: 0.4 }
      });
      const txtColor = ri === 4 && ci === 2 ? ACCENT2
                     : ri === 4 && ci === 1 ? "EF5350"
                     : ri === 7 && ci === 3 ? "4CAF50"
                     : ci === 0 ? LGRAY : WHITE;
      s.addText(cell, {
        x: x + 0.06, y: ry, w: cw2[ci] - 0.08, h: 0.43,
        fontSize: 9.5, color: txtColor,
        fontFace: "Calibri", valign: "middle", margin: 0,
        bold: (ri === 4 && ci === 2) || (ri === 7 && ci === 3)
      });
    });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 12 — CURRENT STATUS & SUMMARY
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s);
  addSideBar(s);
  addSlideTitle(s, "CURRENT STATUS & SUMMARY", true);

  // Status boxes
  const statuses = [
    {
      title: "Largely Replaced by Propofol",
      body: "For routine IV induction worldwide\nPropofol offers faster/more complete recovery,\nanti-emetic properties, better TIVA profile",
      color: MGRAY
    },
    {
      title: "Thiopental — Restricted Availability",
      body: "US market: discontinued due to lethal injection controversy\nStill used in some countries for RSI, neuro-anaesthesia\nand barbiturate coma",
      color: ACCENT2
    },
    {
      title: "Methohexital — Actively Used",
      body: "First choice for ECT anaesthesia\nPaediatric rectal premedication\nBrief procedures requiring rapid recovery",
      color: ACCENT
    },
  ];

  statuses.forEach((st, i) => {
    card(s, 0.3 + i * 3.2, 0.88, 3.0, 2.1, { border: st.color });
    s.addShape(pres.shapes.RECTANGLE, {
      x: 0.3 + i * 3.2, y: 0.88, w: 3.0, h: 0.08,
      fill: { color: st.color }, line: { color: st.color }
    });
    s.addText(st.title, {
      x: 0.4 + i * 3.2, y: 1.0, w: 2.8, h: 0.42,
      fontSize: 11, bold: true, color: st.color, fontFace: "Calibri", margin: 0
    });
    s.addText(st.body, {
      x: 0.4 + i * 3.2, y: 1.46, w: 2.8, h: 1.38,
      fontSize: 10, color: WHITE, fontFace: "Calibri", margin: 0
    });
  });

  // Remaining indications
  card(s, 0.3, 3.1, 9.4, 1.3, { border: ACCENT });
  s.addText("REMAINING INDICATIONS FOR THIOPENTAL", {
    x: 0.45, y: 3.15, w: 9.0, h: 0.3,
    fontSize: 11, bold: true, color: ACCENT, fontFace: "Calibri", margin: 0
  });
  const indics = [
    "Rapid Sequence Induction (where propofol contraindicated)",
    "Raised ICP management / Barbiturate coma",
    "Focal neuroprotection during neurosurgery (temporary clips)",
    "Refractory status epilepticus",
  ];
  indics.forEach((ind, i) => {
    s.addText([
      { text: "▸ ", options: { color: ACCENT, bold: true } },
      { text: ind, options: { color: WHITE } }
    ], {
      x: 0.45 + (i % 2) * 4.75, y: 3.5 + Math.floor(i / 2) * 0.38, w: 4.6, h: 0.35,
      fontSize: 11, fontFace: "Calibri", margin: 0
    });
  });

  // Key takeaways
  card(s, 0.3, 4.52, 9.4, 0.85, { border: ACCENT2, fill: "0f1e2b" });
  s.addText("Key Takeaways:", {
    x: 0.45, y: 4.57, w: 1.6, h: 0.28,
    fontSize: 11, bold: true, color: ACCENT2, fontFace: "Calibri", margin: 0
  });
  s.addText("Thiopental: fast, elegant induction, cerebral protection, avoid in porphyria & bronchospasm  ·  Methohexital: ECT drug of choice, faster recovery  ·  Both: NO analgesia, No anti-emesis", {
    x: 2.1, y: 4.57, w: 7.45, h: 0.55,
    fontSize: 10, color: WHITE, fontFace: "Calibri", margin: 0
  });
}

// ─── WRITE FILE ──────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/barbiturates-ppt/Barbiturates_in_Anaesthesia.pptx" })
  .then(() => console.log("Done: Barbiturates_in_Anaesthesia.pptx"))
  .catch(err => { console.error(err); process.exit(1); });
Running Command

cd /home/daytona/workspace/barbiturates-ppt && node make_ppt.js 2>&1

Running Command

ls -lh /home/daytona/workspace/barbiturates-ppt/

Your presentation is ready!

Barbiturates in Anaesthesia

Presentation · PPTX


12 slides with a deep navy + teal + amber color scheme:
SlideContent
1Title slide
2Outline
3Historical Background (timeline)
4Chemistry & SAR + Formulation table
5Mechanism of Action (GABA-A + excitatory suppression)
6Pharmacokinetics (comparison table)
7CNS Effects (dose-response ladder + effects)
8CVS & Respiratory Effects
9Clinical Uses & Dosing (full table)
10Contraindications, Adverse Effects & Injection Complications
11Thiopental vs Methohexital vs Propofol comparison
12Current Status & Summary

Viva question in MD practicals on Barbiturates

Here is a comprehensive set of MD Anaesthesia viva questions on Barbiturates, organized by difficulty and theme — exactly as they come up in practical/clinical viva sessions.

MD Anaesthesia Viva — Barbiturates


🔬 CHEMISTRY & PHARMACOLOGY (Basic Science Questions)


Q1. What is the basic nucleus of barbiturates?
Barbituric acid — formed by condensation of malonic acid and urea (2,4,6-trioxohexahydropyrimidine). The nucleus itself is hypnotically inactive.

Q2. What substitutions at which positions confer hypnotic activity?
  • Position 5 — aryl or alkyl substitution → hypnotic/sedative effect
  • Position 2 — oxygen → oxybarbiturate; sulfur → thiobarbiturate (↑ lipid solubility, faster onset)
  • Position 1 (N-methylation) — e.g. methohexital → ↑ CNS excitability, proconvulsant
  • C5 phenyl group → anticonvulsant activity (e.g. phenobarbital)

Q3. How are barbiturates classified? Give anaesthetic examples.
ClassC2 substitutionExamples
ThiobarbituratesSulfurThiopental, Thiamylal
OxybarbituratesOxygenMethohexital, Phenobarbital

Q4. Why are barbiturates formulated as sodium salts? What is the pH of the solution?
Through keto-enol tautomerism, the C2 oxygen/sulfur becomes reactive in enol form, allowing formation of water-soluble sodium salts. Reconstituted in water with 6% anhydrous sodium carbonatepH 10–11 (highly alkaline).

Q5. Why can't you mix thiopental with rocuronium or suxamethonium in the same syringe?
Rocuronium, suxamethonium, midazolam, alfentanil, and atracurium are all acidic solutions. Mixing with highly alkaline thiopental (pH 10–11) causes precipitation of the barbiturate as the free acid → can occlude the IV line, especially critical during RSI.

Q6. What is the shelf life of reconstituted thiopental and methohexital?
  • Thiopental (thiobarbiturate): 1 week refrigerated
  • Methohexital (oxybarbiturate): 6 weeks refrigerated

⚗️ MECHANISM OF ACTION


Q7. What is the mechanism of action of barbiturates?
Two mechanisms:
  1. Enhance inhibitory transmission — potentiate GABA-A receptor Cl⁻ channel (prolong channel opening duration); at high doses directly activate GABA-A even without GABA
  2. Inhibit excitatory transmission — suppress AMPA glutamate receptors and nicotinic ACh receptors
Key point: Barbiturate binding site is distinct from the benzodiazepine site on the GABA-A receptor.

Q8. How does the barbiturate site on GABA-A differ from the benzodiazepine site?
FeatureBarbituratesBenzodiazepines
Binding siteβ subunitα–γ interface
EffectProlong Cl⁻ channel duration↑ frequency of channel opening
Direct activationYes (high dose)No
Reversal agentNoneFlumazenil

Q9. Do barbiturates have analgesic properties?
No. They are purely hypnotic. They may actually lower the pain threshold (hyperalgesia). Additional analgesia from opioids or volatile agents is always required during surgery.

🔄 PHARMACOKINETICS


Q10. Explain the mechanism of termination of action of a single bolus of thiopental.
After a single bolus, recovery is due to redistribution — not hepatic metabolism. Thiopental is highly lipid-soluble and rapidly redistributes from the highly perfused brain → muscle (vessel-rich group) → fat. The brain concentration falls below the threshold for anaesthesia within minutes.
Context: The elimination half-life is hours–days, but this is irrelevant after a single dose. This is why thiopental gives "rapid emergence" from a single induction dose despite slow metabolism.

Q11. Why is thiopental NOT suitable for infusion/TIVA?
After repeated boluses or infusion, the peripheral compartments (especially fat) become saturated. Recovery then depends on elimination (hepatic metabolism) rather than redistribution. The context-sensitive half-time increases markedly → prolonged sedation/hangover. Methohexital and propofol accumulate far less.

Q12. What is context-sensitive half-time? How does it apply to barbiturates?
The time for plasma concentration to fall by 50% after terminating an infusion, as a function of infusion duration. Thiopental's context-sensitive half-time increases dramatically with infusion duration because its large fat reservoir slowly releases drug back into plasma. This makes it unsuitable for maintenance infusions.

Q13. What happens to thiopental in patients with hypoalbuminaemia?
Thiopental is ~85% protein-bound (primarily to albumin). In hypoalbuminaemia (liver disease, burns, malnutrition, nephrotic syndrome), free drug fraction increases → greater CNS effect from the same dose → reduce the induction dose.

Q14. What is the product of thiopental's desulfuration?
Pentobarbital — a longer-acting barbiturate hypnotic. This accounts for a small fraction of thiopental's metabolism but contributes to prolonged sedation after large doses.

🫀 ORGAN SYSTEM EFFECTS


Q15. What are the CNS effects of thiopental in order of increasing dose?
Sedation → Hypnosis → General Anaesthesia → Burst SuppressionIsoelectric EEG
At each level: ↓ CBF, ↓ CBV, ↓ ICP, ↓ CMRO₂ (all dose-dependent)

Q16. How do barbiturates reduce ICP?
  • Potent cerebral vasoconstrictors → ↓ cerebral blood volume (CBV) → ↓ ICP
  • ↓ CMRO₂ → reduced metabolic demand → cerebral vasoconstriction (flow-metabolism coupling)
  • Effect is dose-dependent and maximal at EEG burst suppression

Q17. Do barbiturates protect the brain from ischemia?
  • Focal cerebral ischaemia (stroke, surgical retraction, temporary clips during aneurysm surgery) — YES, barbiturates are neuroprotective
  • Global cerebral ischaemia (cardiac arrest) — NO, barbiturates do not reduce injury
The distinction is because focal ischaemia has penumbral tissue where reducing CMRO₂ helps; global ischaemia has no zone of partial perfusion.

Q18. What are the cardiovascular effects of thiopental?
  1. ↓ BP — primarily from peripheral vasodilation (venodilation)
  2. Direct negative inotropy (↓ cardiac contractility)
  3. Reflex tachycardia (partial baroreceptor blunting)
  4. BP decrease is less than propofol; cardiac output is better maintained than propofol
  5. Caution in hypovolaemia, haemorrhagic shock, cardiac disease

Q19. Why does thiopental cause tachycardia?
Two reasons:
  1. Reflex sympathetic activation in response to hypotension (baroreflex — though partially blunted)
  2. Direct vagolytic effect of thiopental (mild)

Q20. What are the respiratory effects?
  • Dose-dependent ↓ tidal volume and respiratory rate
  • Apnoea common after induction dose (rate- and dose-dependent)
  • ↓ hypercapnic and hypoxic ventilatory drives
  • NO bronchodilation — unlike propofol and ketamine
  • Risk of laryngospasm under light depth with airway stimulation

💊 CLINICAL USE


Q21. What is the induction dose of thiopental? What factors reduce it?
Standard: 3–4 mg/kg IV (ED50 ~2.2–2.7 mg/kg)
Dose is reduced in:
  • Elderly patients
  • Haemorrhagic shock / ↓ cardiac output
  • Hypoalbuminaemia (burns, liver disease, malnutrition, uraemia)
  • Opioid or benzodiazepine premedication
  • Severe anaemia, malignancy, obesity, extremes of lean body mass

Q22. Why is methohexital the drug of choice for ECT?
  • It is a proconvulsant — activates epileptic foci (N-methylation at position 1)
  • Produces longer, better-quality seizures during ECT compared to thiopental or propofol
  • Propofol shortens seizure duration; thiopental is anticonvulsant and reduces seizure quality
  • Faster recovery due to higher plasma clearance
  • Note: propofol can still be used if methohexital is unavailable, but seizure monitoring is important

Q23. What is the rectal dose of methohexital in paediatric patients?
25 mg/kg rectally as a 10% solution through a 14F catheter inserted 7 cm into the rectum. Sleep onset is rapid; mean peak plasma levels occur within 14 minutes.

Q24. What is barbiturate coma? When is it used?
High-dose barbiturate (thiopental or pentobarbital) infusion titrated to EEG burst suppression to maximally reduce CMRO₂ and ICP.
Indications: Refractory raised ICP (severe TBI, subarachnoid haemorrhage) not responding to other measures.
Monitoring: Continuous EEG (aim for burst suppression pattern), haemodynamic monitoring (vasopressors often required).

⚠️ CONTRAINDICATIONS & COMPLICATIONS


Q25. What is the most important absolute contraindication to barbiturates?
Acute Intermittent Porphyria (AIP)
Barbiturates stimulate aminolevulinic acid (ALA) synthetase (the rate-limiting enzyme in haem synthesis) → ↑ porphyrin production → acute porphyric crisis → abdominal pain, neurological manifestations, cardiovascular instability, potentially fatal.
Safe alternatives for induction in porphyria: Propofol or ketamine

Q26. What happens if thiopental is injected intra-arterially?
Mechanism: Crystallisation of thiopental as free acid in the acidic arterial blood → microcrystal embolism → intense vasospasm → endarteritis obliterans → thrombosis → distal gangrene
Management:
  1. Do NOT remove the needle/cannula (use it for treatment)
  2. Dilute with normal saline
  3. Inject papaverine (vasodilator) through the same cannula
  4. Sympathetic block (stellate ganglion block or brachial plexus block) to relieve vasospasm
  5. Systemic anticoagulation (heparin)
  6. Warm soaks, analgesia

Q27. What happens with subcutaneous extravasation of thiopental?
Highly alkaline solution (pH 10–11) → chemical cellulitis and tissue necrosis
Management: Hyaluronidase infiltration (to disperse the drug), warm soaks, elevation, analgesia

Q28. What are the excitatory phenomena seen with methohexital and why?
  • Hiccup, tremor, myoclonic movements
  • Due to N-methylation at position 1 → subcortical excitation (disinhibition of inhibitory circuits)
  • More common with methohexital than thiopental
  • Can be reduced by opioid premedication

🔍 HIGHER-ORDER / TRICKY VIVA QUESTIONS


Q29. Thiopental is highly lipid-soluble — so why does it NOT have a long duration of action after a single bolus?
Because initial recovery is determined by redistribution, not by elimination. High lipid solubility means thiopental rapidly distributes from brain (highly perfused, rapid equilibration) to muscle, then slowly to fat. The brain concentration falls below the anaesthetic threshold within minutes, even though the drug is still present in the body and the elimination half-life is long. This is the "redistribution principle."

Q30. If thiopental has a long half-life and propofol a short one — why does propofol give better recovery from TIVA?
Propofol has a very high plasma clearance (20–30 mL/kg/min, exceeds hepatic blood flow — extrahepatic metabolism). Its context-sensitive half-time remains short even after prolonged infusions. Thiopental, despite hepatic metabolism, has a large volume of distribution and low clearance → prolonged context-sensitive half-time → hangover effect.

Q31. A patient with known porphyria requires emergency anaesthesia — what do you use?
  • Induction: Propofol (safe in porphyria) or ketamine
  • Maintenance: Propofol TIVA or volatile agents (isoflurane, sevoflurane — generally considered safe)
  • Avoid: All barbiturates, etomidate (questionable), some opioids
  • Regional anaesthesia preferred if feasible

Q32. Why does thiopental not cause nausea/vomiting postoperatively?
It has no antiemetic properties (unlike propofol) — but also no direct emetogenic effect. PONV rates are intermediate between propofol (antiemetic) and volatile agents (emetogenic). Thiopental's PONV profile is neutral.

Q33. Compare the EEG effects of thiopental and methohexital.
FeatureThiopentalMethohexital
General EEG effectProgressive suppressionActivates epileptic foci
AnticonvulsantYesNo
Burst suppressionYes (high dose)Yes (but also seizures reported)
Use in epilepsy surgeryAnticonvulsant — may suppress fociCan activate and map epileptic foci intraoperatively
ECTReduces seizure qualityProlongs/improves seizure quality

Q34. What is the awareness risk with thiopental vs propofol?
A review of anaesthetic agents and awareness risk found:
  • Benzodiazepines reduce awareness most effectively
  • Ketamine and etomidate reduce wakefulness compared to thiopental
  • Thiopental has an intermediate awareness profile — not the best for preventing awareness when used as a maintenance agent
  • Propofol TIVA has a lower awareness risk than volatile agent-based techniques

Q35. What is the pKa of thiopental and why is it clinically significant?
pKa = 7.6 — very close to physiological pH (7.4). This means at body pH, a significant fraction exists in the unionised (lipid-soluble) form → rapid CNS penetration → fast onset of action.
In acidosis (↓ pH), more drug is in unionised form → enhanced CNS effect → dose should be reduced in acidotic patients.

📝 RAPID-FIRE VIVA ROUND

QuestionAnswer
First barbiturate synthesizedBarbituric acid (1864, Baeyer); first hypnotic barbiturate for anaesthesia — diethylbarbituric acid (1903, Fischer & von Mering)
First barbiturate used for inductionHexobarbital (1927)
Thiopental first used clinically1934 — John Lundy & Ralph Waters
Thiopental concentration for induction2.5% solution
Methohexital concentration1% solution
Cannot mix thiopental withRocuronium, suxamethonium, midazolam, alfentanil, atracurium (precipitates)
Thiopental pKa7.6
Thiopental protein binding~85%
Why avoid in porphyria↑ ALA synthetase → porphyrin crisis
Drug of choice for ECTMethohexital
Intra-arterial injection treatmentDilute + papaverine + sympathetic block + heparin
Thiopental after cardiac arrest?NOT neuroprotective (global ischaemia)
Thiopental during aneurysm clipping?YES neuroprotective (focal ischaemia)
Neonatal induction dose2–4 mg/kg IV
Rectal methohexital dose (paeds)25 mg/kg (10% solution)
Safe in bronchospasm?NO — no bronchodilation, ↑ laryngospasm risk

Examiner tip: The questions most commonly asked in MD viva on barbiturates are: (1) Why does thiopental have short action despite long half-life? (2) Why is it contraindicated in porphyria? (3) Intra-arterial injection management. (4) Why methohexital for ECT? (5) Mechanism of action vs benzodiazepines.

Generate a quick reference PDF cheat sheet on barbiturates

Reading File
Reading File
Reading File
Writing File

~/barbiturates-ppt/make_cheatsheet.py

"""
Barbiturates in Anaesthesia — Quick Reference Cheat Sheet
A4, 2 pages, ReportLab canvas-based for precise layout control
"""

from reportlab.lib.pagesizes import A4
from reportlab.pdfgen import canvas
from reportlab.lib.colors import HexColor, white, black
from reportlab.lib.units import mm
from reportlab.platypus import Paragraph
from reportlab.lib.styles import ParagraphStyle
from reportlab.lib.enums import TA_LEFT, TA_CENTER

# ─── PALETTE ──────────────────────────────────────────────────────────────────
BG        = HexColor("#0D1B2A")
CARD      = HexColor("#152232")
CARD2     = HexColor("#1A2E40")
ACCENT    = HexColor("#00C9A7")
ACCENT2   = HexColor("#F4A261")
RED       = HexColor("#EF5350")
WHITE     = white
LGRAY     = HexColor("#B0BEC5")
MGRAY     = HexColor("#546E7A")
DGRAY     = HexColor("#263238")
GOLD      = HexColor("#FFD54F")

W, H = A4   # 595.27 x 841.89 pts
M    = 12*mm  # margin

def dark_bg(c, page_h=H):
    c.setFillColor(BG)
    c.rect(0, 0, W, page_h, fill=1, stroke=0)

def hline(c, x, y, w, color=MGRAY, lw=0.5):
    c.setStrokeColor(color)
    c.setLineWidth(lw)
    c.line(x, y, x+w, y)

def vline(c, x, y, h, color=MGRAY, lw=0.5):
    c.setStrokeColor(color)
    c.setLineWidth(lw)
    c.line(x, y, x, y+h)

def filled_rect(c, x, y, w, h, fill_color, stroke_color=None, lw=0):
    c.setFillColor(fill_color)
    if stroke_color:
        c.setStrokeColor(stroke_color)
        c.setLineWidth(lw)
        c.rect(x, y, w, h, fill=1, stroke=1)
    else:
        c.rect(x, y, w, h, fill=1, stroke=0)

def round_rect(c, x, y, w, h, r, fill_color, stroke_color=None, lw=1):
    c.setFillColor(fill_color)
    if stroke_color:
        c.setStrokeColor(stroke_color)
        c.setLineWidth(lw)
        c.roundRect(x, y, w, h, r, fill=1, stroke=1)
    else:
        c.roundRect(x, y, w, h, r, fill=1, stroke=0)

def txt(c, text, x, y, size=8, color=WHITE, bold=False, align="left"):
    c.setFillColor(color)
    face = "Helvetica-Bold" if bold else "Helvetica"
    c.setFont(face, size)
    if align == "center":
        c.drawCentredString(x, y, text)
    elif align == "right":
        c.drawRightString(x, y, text)
    else:
        c.drawString(x, y, text)

def section_header(c, x, y, w, h, title, color=ACCENT):
    filled_rect(c, x, y, w, h, color)
    txt(c, title, x + 4, y + h/2 - 4, size=8, color=BG, bold=True)

def card_box(c, x, y, w, h, title, title_color=ACCENT, border_color=None):
    bc = border_color or title_color
    round_rect(c, x, y, w, h, 3, CARD, bc, lw=0.8)
    filled_rect(c, x, y + h - 14, w, 14, bc)
    # Clip title text
    c.setFillColor(BG)
    c.setFont("Helvetica-Bold", 7)
    c.drawString(x + 4, y + h - 10, title)

def bullet_row(c, x, y, w, label, value, label_color=LGRAY, val_color=WHITE, size=7.2):
    txt(c, label, x + 10, y, size=size, color=label_color, bold=True)
    txt(c, value, x + w*0.42, y, size=size, color=val_color)

def table_row(c, x, y, cols, widths, colors, bg=None, size=7):
    if bg:
        filled_rect(c, x, y - 2, sum(widths), 11, bg)
    cx = x
    for i, (col, w) in enumerate(zip(cols, widths)):
        txt(c, col, cx + 3, y, size=size, color=colors[i] if i < len(colors) else WHITE)
        cx += w

# ══════════════════════════════════════════════════════════════════════════════
# PAGE 1
# ══════════════════════════════════════════════════════════════════════════════
c = canvas.Canvas("/home/daytona/workspace/barbiturates-ppt/Barbiturates_CheatSheet.pdf", pagesize=A4)
dark_bg(c)

# ── TOP HEADER BAR ──
filled_rect(c, 0, H-28, W, 28, ACCENT)
filled_rect(c, 0, H-32, W, 4, ACCENT2)

txt(c, "BARBITURATES IN ANAESTHESIA", W/2, H-20, size=14, color=BG, bold=True, align="center")
txt(c, "Quick Reference Cheat Sheet  |  MD Anaesthesia", W/2, H-28, size=7, color=DGRAY, align="center")

# Page label
txt(c, "PAGE 1 OF 2", W - M, H - 22, size=6.5, color=BG, bold=True, align="right")

# ── ROW 1: CHEMISTRY + MECHANISM ──────────────────────────────────────────────
y1 = H - 40
col1_w = 188
col2_w = 187
col3_w = 186
col1_x = M
col2_x = col1_x + col1_w + 5
col3_x = col2_x + col2_w + 5
box_h = 175

# CARD 1: CHEMISTRY
card_box(c, col1_x, y1 - box_h, col1_w, box_h, "CHEMISTRY & STRUCTURE", ACCENT)
cy = y1 - 28
txt(c, "Barbituric acid nucleus (malonic acid + urea)", col1_x+5, cy, size=7, color=LGRAY)
cy -= 11

# Nucleus label
filled_rect(c, col1_x+5, cy-8, 178, 10, CARD2)
txt(c, "Hypnotically INACTIVE nucleus — activity from C5/C2/N1 substitutions", col1_x+8, cy-5, size=6.5, color=ACCENT2)
cy -= 22

rows_chem = [
    ("Position", "Substitution", "Effect"),
    ("C5", "Alkyl/aryl", "Hypnotic/sedative activity"),
    ("C5", "Phenyl", "Anticonvulsant (phenobarbital)"),
    ("C2", "Sulfur", "Thiobarbiturate — high lipid solubility"),
    ("C2", "Oxygen", "Oxybarbiturate (methohexital)"),
    ("N1", "Methyl", "Excitability — proconvulsant"),
    ("C5", "Longer chain", "Potency + toxicity"),
]
widths_c = [30, 52, 96]
for i, row in enumerate(rows_chem):
    bg_row = DGRAY if i % 2 == 0 else CARD2
    is_hdr = i == 0
    colors_row = [ACCENT, ACCENT, ACCENT] if is_hdr else [ACCENT2, WHITE, LGRAY]
    if is_hdr:
        bg_row = MGRAY
    filled_rect(c, col1_x+5, cy-2, 178, 11, bg_row)
    cx2 = col1_x + 5
    for j, (col, w) in enumerate(zip(row, widths_c)):
        c.setFillColor(colors_row[j])
        c.setFont("Helvetica-Bold" if is_hdr else "Helvetica", 6.5)
        c.drawString(cx2 + 2, cy+1, col)
        cx2 += w
    cy -= 12

# Formulation note
cy -= 4
filled_rect(c, col1_x+5, cy-8, 178, 18, HexColor("#0a1929"))
c.setStrokeColor(ACCENT2)
c.setLineWidth(0.6)
c.rect(col1_x+5, cy-8, 178, 18, stroke=1, fill=0)
txt(c, "Formulation: Na salt + 6% Na2CO3 | pH 10-11", col1_x+8, cy+3, size=6.5, color=ACCENT2)
txt(c, "Thiopental 2.5% | Methohexital 1% | Thiamylal 2%", col1_x+8, cy-4, size=6.5, color=WHITE)

# CARD 2: CLASSES & AGENTS
card_box(c, col2_x, y1 - box_h, col2_w, box_h, "CLASSES & AGENTS", ACCENT2)
cy2 = y1 - 28

agents = [
    ("THIOBARBITURATES", ACCENT, [
        ("Thiopental", "Most used for induction"),
        ("Thiamylal",  "Vet use only (US)"),
    ]),
    ("OXYBARBITURATES", ACCENT2, [
        ("Methohexital", "ECT drug of choice"),
        ("Phenobarbital", "Anticonvulsant (oral/IM)"),
        ("Pentobarbital", "Barbiturate coma"),
    ]),
]
for group, gcol, members in agents:
    filled_rect(c, col2_x+5, cy2-9, col2_w-10, 11, gcol)
    txt(c, group, col2_x + 8, cy2-6, size=7, color=BG, bold=True)
    cy2 -= 12
    for name, desc in members:
        filled_rect(c, col2_x+5, cy2-8, col2_w-10, 10, CARD2)
        txt(c, name, col2_x + 14, cy2-5, size=7, color=WHITE, bold=True)
        txt(c, desc, col2_x + 70, cy2-5, size=6.5, color=LGRAY)
        cy2 -= 12
    cy2 -= 4

# Incompatibilities
cy2 -= 2
filled_rect(c, col2_x+5, cy2-32, col2_w-10, 33, HexColor("#1a1010"))
c.setStrokeColor(RED)
c.setLineWidth(0.7)
c.rect(col2_x+5, cy2-32, col2_w-10, 33, stroke=1, fill=0)
txt(c, "INCOMPATIBLE (precipitates):", col2_x+8, cy2-4, size=6.5, color=RED, bold=True)
incompat = ["Rocuronium", "Vecuronium", "Suxamethonium",
            "Midazolam", "Alfentanil", "Atracurium"]
for i, drug in enumerate(incompat):
    cx_ic = col2_x + 8 + (i % 3) * 57
    cy_ic = cy2 - 14 - (i // 3) * 11
    txt(c, "x " + drug, cx_ic, cy_ic, size=6.5, color=ACCENT2)

# CARD 3: MECHANISM
card_box(c, col3_x, y1 - box_h, col3_w, box_h, "MECHANISM OF ACTION", ACCENT)
cy3 = y1 - 28

filled_rect(c, col3_x+5, cy3-11, col3_w-10, 12, CARD2)
c.setStrokeColor(ACCENT)
c.setLineWidth(0.5)
c.rect(col3_x+5, cy3-11, col3_w-10, 12, stroke=1, fill=0)
txt(c, "1. ENHANCE INHIBITORY TRANSMISSION", col3_x+8, cy3-7, size=7, color=ACCENT, bold=True)
cy3 -= 16

mech1 = [
    "Potentiate GABA-A receptor (Cl- channel)",
    "Prolong duration of Cl- channel OPENING",
    "High dose: directly activate WITHOUT GABA",
    "Site distinct from benzodiazepine site",
]
for pt in mech1:
    txt(c, ">  " + pt, col3_x+8, cy3, size=6.5, color=WHITE)
    cy3 -= 10
cy3 -= 4

filled_rect(c, col3_x+5, cy3-11, col3_w-10, 12, CARD2)
c.setStrokeColor(ACCENT2)
c.setLineWidth(0.5)
c.rect(col3_x+5, cy3-11, col3_w-10, 12, stroke=1, fill=0)
txt(c, "2. INHIBIT EXCITATORY TRANSMISSION", col3_x+8, cy3-7, size=7, color=ACCENT2, bold=True)
cy3 -= 16

mech2 = [
    "Suppress AMPA glutamate receptors",
    "Suppress nicotinic ACh receptors",
]
for pt in mech2:
    txt(c, ">  " + pt, col3_x+8, cy3, size=6.5, color=WHITE)
    cy3 -= 10
cy3 -= 6

# BZD vs Barb
filled_rect(c, col3_x+5, cy3-40, col3_w-10, 41, DGRAY)
txt(c, "vs BENZODIAZEPINES", col3_x+8, cy3-3, size=6.5, color=GOLD, bold=True)
compare = [
    ("Cl- channel", "Duration ↑", "Frequency ↑"),
    ("High-dose", "Activates alone", "Cannot alone"),
    ("Reversal", "NONE", "Flumazenil"),
    ("Analgesic", "NO (hyperalgesic)", "NO"),
]
hh = ["Feature", "Barbiturates", "BZDs"]
tw = [52, 68, 56]
txc = col3_x + 5
filled_rect(c, txc, cy3-15, col3_w-10, 12, MGRAY)
cxh = txc
for h2, w2 in zip(hh, tw):
    txt(c, h2, cxh+2, cy3-11, size=6, color=BG, bold=True)
    cxh += w2
for i2, row in enumerate(compare):
    filled_rect(c, txc, cy3-16-i2*10-(i2*1), col3_w-10, 10, CARD2 if i2%2==0 else DGRAY)
    cxr = txc
    cols_r = [LGRAY, ACCENT, LGRAY]
    for val, w2, cc in zip(row, tw, cols_r):
        txt(c, val, cxr+2, cy3-12-i2*11, size=6, color=cc)
        cxr += w2

# IMPORTANT NOTE
filled_rect(c, col3_x+5, cy3-80, col3_w-10, 14, HexColor("#1a1010"))
c.setStrokeColor(RED)
c.setLineWidth(0.7)
c.rect(col3_x+5, cy3-80, col3_w-10, 14, stroke=1, fill=0)
txt(c, "! NO ANALGESIA — may cause HYPERALGESIA", col3_x+8, cy3-74, size=6.5, color=RED, bold=True)

# ── ROW 2: PHARMACOKINETICS ───────────────────────────────────────────────────
y2 = y1 - box_h - 8
pk_h = 155

card_box(c, M, y2 - pk_h, W - 2*M, pk_h, "PHARMACOKINETICS", ACCENT)

# Left: PK table
pk_y = y2 - 28
pk_table_w = 320
pk_cols = [120, 100, 100]
hdr = ["Parameter", "Thiopental", "Methohexital"]
hcols = [ACCENT, BG, BG]
hbg = [MGRAY, ACCENT, ACCENT2]

# Draw header
cxpk = M + 5
for h2, w2, hb, hc in zip(hdr, pk_cols, hbg, hcols):
    filled_rect(c, cxpk, pk_y-10, w2, 12, HexColor(hbg[list(hdr).index(h2)]))
    txt(c, h2, cxpk+3, pk_y-7, size=7, color=BG if h2!="Parameter" else LGRAY, bold=True)
    cxpk += w2

pk_rows = [
    ("Class",             "Thiobarbiturate",        "Oxybarbiturate"),
    ("Protein binding",   "~85%",                   "~73%"),
    ("pKa",               "7.6",                    "7.9"),
    ("Induction dose",    "3-4 mg/kg IV",           "1-2 mg/kg IV"),
    ("Onset (IV)",        "15-30 seconds",          "~30 seconds"),
    ("ED50",              "2.2-2.7 mg/kg",          "~1.1 mg/kg"),
    ("Plasma clearance",  "Low (slow elim.)",       "High (faster)"),
    ("Elim. half-life",   "Hours to days",          "Shorter"),
    ("After single bolus","Redistribution-limited","Redistribution-limited"),
    ("After infusion",    "Prolonged (accumulates)","Faster recovery"),
]
for i, row in enumerate(pk_rows):
    row_y = pk_y - 12 - i * 12
    rbg = DGRAY if i % 2 == 0 else CARD2
    cx3 = M + 5
    for j, (val, w2) in enumerate(zip(row, pk_cols)):
        filled_rect(c, cx3, row_y-9, w2, 11, rbg)
        col_c = LGRAY if j==0 else (ACCENT if j==1 else ACCENT2)
        txt(c, val, cx3+3, row_y-6, size=6.5, color=col_c if j>0 else LGRAY)
        cx3 += w2

# Right: KEY CONCEPTS box
kc_x = M + 5 + sum(pk_cols) + 10
kc_w = W - 2*M - sum(pk_cols) - 20
kc_y = y2 - 28

filled_rect(c, kc_x, y2 - pk_h + 5, kc_w, pk_h - 18, CARD2)
c.setStrokeColor(ACCENT)
c.setLineWidth(0.7)
c.rect(kc_x, y2 - pk_h + 5, kc_w, pk_h - 18, stroke=1, fill=0)

txt(c, "KEY CONCEPTS", kc_x + 5, kc_y, size=7.5, color=ACCENT, bold=True)
kc_y -= 14

concepts = [
    (ACCENT,  "SINGLE BOLUS RECOVERY",
              "Redistribution: brain -> muscle -> fat",
              "Onset short despite long half-life"),
    (ACCENT2, "INFUSION / REPEATED DOSES",
              "Peripheral compartments saturate",
              "Recovery = elimination dependent"),
    (RED,     "CONTEXT-SENSITIVE HALF-TIME",
              "Thiopental markedly increases with duration",
              "Unsuitable for TIVA/maintenance"),
    (GOLD,    "PROTEIN BINDING EFFECT",
              "Hypoalbuminaemia: more free drug",
              "Reduce dose in burns/liver disease/uraemia"),
]
for dot_col, title, line1, line2 in concepts:
    filled_rect(c, kc_x+4, kc_y-3, 5, 5, dot_col)
    txt(c, title, kc_x+13, kc_y, size=7, color=dot_col, bold=True)
    kc_y -= 11
    txt(c, line1, kc_x+13, kc_y, size=6.5, color=WHITE)
    kc_y -= 10
    txt(c, line2, kc_x+13, kc_y, size=6.5, color=LGRAY)
    kc_y -= 14

# ── ROW 3: CNS EFFECTS ────────────────────────────────────────────────────────
y3 = y2 - pk_h - 8
cns_h = 158
half_w = (W - 2*M - 5) / 2

card_box(c, M, y3 - cns_h, half_w, cns_h, "CNS EFFECTS", ACCENT)
cns_y = y3 - 28

# Dose-response ladder
ladder = [
    ("Sedation",              "1C3A2E"),
    ("Hypnosis",              "155E4E"),
    ("General Anaesthesia",   "00897B"),
    ("Burst Suppression EEG", "00BFA5"),
    ("Isoelectric EEG",       "00C9A7"),
]
ladder_x = M + 5
lw_base = 60
for i, (label, color) in enumerate(ladder):
    bar_w = lw_base + i * 20
    bar_x = ladder_x + (150 - bar_w) / 2
    filled_rect(c, bar_x, cns_y - 10, bar_w, 10, HexColor(color))
    txt(c, label, ladder_x + 5, cns_y - 7, size=6.5,
        color=BG if i == 4 else LGRAY)
    cns_y -= 13

cns_y -= 4

cns_effects = [
    (ACCENT, "CBF / CBV / ICP", "Potent cerebral vasoconstriction"),
    (ACCENT, "CMRO2", "Dose-dependent reduction"),
    ("4CAF50", "Focal neuroprotection", "Stroke, retraction, aneurysm clips"),
    (RED, "Global ischaemia", "NOT effective (cardiac arrest)"),
    (ACCENT2, "Anticonvulsant", "Except methohexital (proconvulsant)"),
    (GOLD, "Methohexital + ECT", "Activates/prolongs seizure"),
]
for sym_col, label, desc in cns_effects:
    filled_rect(c, ladder_x, cns_y-7, 4, 7, HexColor(sym_col) if isinstance(sym_col, str) else sym_col)
    txt(c, label, ladder_x + 7, cns_y-5, size=7, color=WHITE, bold=True)
    txt(c, desc, ladder_x + 80, cns_y-5, size=6.5, color=LGRAY)
    cns_y -= 12

# CVS + RESP EFFECTS
card_box(c, M + half_w + 5, y3 - cns_h, half_w, cns_h, "CVS & RESPIRATORY EFFECTS", ACCENT2)
cvs_y = y3 - 28
cvs_x = M + half_w + 10

txt(c, "CARDIOVASCULAR", cvs_x, cvs_y, size=7, color=ACCENT2, bold=True)
cvs_y -= 11
cvs_pts = [
    ("BP", "Peripheral vasodilation (venodilation, primary)"),
    ("Inotropy", "Direct negative inotropic effect"),
    ("HR", "Reflex tachycardia (partial baroreceptor blunting)"),
    ("vs Propofol", "Less BP drop; better cardiac output maintenance"),
    ("Caution", "Hypovolaemia, shock, cardiac disease"),
]
for lbl, val in cvs_pts:
    filled_rect(c, cvs_x, cvs_y-8, 40, 10, CARD2)
    txt(c, lbl, cvs_x+2, cvs_y-5, size=6.5, color=ACCENT2, bold=True)
    txt(c, val, cvs_x+44, cvs_y-5, size=6.5, color=WHITE)
    hline(c, cvs_x, cvs_y-9, half_w-20, MGRAY, 0.3)
    cvs_y -= 12

cvs_y -= 4
hline(c, cvs_x, cvs_y+2, half_w-20, ACCENT, 0.5)
cvs_y -= 6
txt(c, "RESPIRATORY", cvs_x, cvs_y, size=7, color=ACCENT, bold=True)
cvs_y -= 11

resp_pts = [
    ("Apnoea", "Common post-induction (rate/dose)"),
    ("VT & RR", "Dose-dependent depression"),
    ("CO2/O2 drive", "Blunted hypercapnic & hypoxic response"),
    ("Broncho", "NO bronchodilation (avoid in bronchospasm)"),
    ("Laryngo", "Risk under light depth + airway stimulus"),
]
for lbl, val in resp_pts:
    filled_rect(c, cvs_x, cvs_y-8, 40, 10, CARD2)
    txt(c, lbl, cvs_x+2, cvs_y-5, size=6.5, color=ACCENT, bold=True)
    txt(c, val, cvs_x+44, cvs_y-5, size=6.5, color=WHITE)
    hline(c, cvs_x, cvs_y-9, half_w-20, MGRAY, 0.3)
    cvs_y -= 12

# ── FOOTER PAGE 1 ─────────────────────────────────────────────────────────────
filled_rect(c, 0, 0, W, 14, DGRAY)
txt(c, "Sources: Miller's Anesthesia 10e  |  Morgan & Mikhail 7e  |  Katzung Basic & Clinical Pharmacology 16e  |  Goodman & Gilman",
    W/2, 4, size=6, color=MGRAY, align="center")

c.showPage()

# ══════════════════════════════════════════════════════════════════════════════
# PAGE 2
# ══════════════════════════════════════════════════════════════════════════════
dark_bg(c)

# Header
filled_rect(c, 0, H-28, W, 28, ACCENT)
filled_rect(c, 0, H-32, W, 4, ACCENT2)
txt(c, "BARBITURATES IN ANAESTHESIA", W/2, H-20, size=14, color=BG, bold=True, align="center")
txt(c, "Quick Reference Cheat Sheet  |  Clinical Uses, Dosing, Contraindications & Viva Points", W/2, H-28, size=7, color=DGRAY, align="center")
txt(c, "PAGE 2 OF 2", W - M, H - 22, size=6.5, color=BG, bold=True, align="right")

# ── ROW 1: CLINICAL USES TABLE ────────────────────────────────────────────────
y1p2 = H - 40
uses_h = 172
card_box(c, M, y1p2 - uses_h, W - 2*M, uses_h, "CLINICAL USES & DOSING", ACCENT)

use_y = y1p2 - 28
uc = [90, 95, 100, 95, 85]   # col widths
uh = ["Indication", "Agent", "Dose", "Note", "Reduce dose if..."]
uh_col = [ACCENT]*5

cxu = M + 5
for h2, w2 in zip(uh, uc):
    filled_rect(c, cxu, use_y-10, w2, 12, ACCENT)
    txt(c, h2, cxu+2, use_y-7, size=6.5, color=BG, bold=True)
    cxu += w2

use_data = [
    ("Induction of GA",      "Thiopental",          "3-4 mg/kg IV",              "ED50 2.2-2.7 mg/kg",    "Elderly, shock, obesity"),
    ("Induction of GA",      "Methohexital",         "1-2 mg/kg IV",              "ED50 ~1.1 mg/kg",       "Hypoalbuminaemia"),
    ("ECT Anaesthesia",       "Methohexital (1st)",  "0.5-1 mg/kg IV",            "Proconvulsant -> better seizure", "N/A"),
    ("Maintenance (infusion)","Methohexital",        "50-150 mcg/kg/min",         "<60 min comparable to propofol", "Reduce if prolonged"),
    ("Paed premedication",    "Methohexital",        "25 mg/kg RECTAL",           "10% soln, 7cm into rectum", "N/A"),
    ("Barbiturate coma",      "Thiopental/Pentob.",  "Titrate to burst suppression","Refractory raised ICP","Haemodynamic monitoring"),
    ("Neuroprotection",       "Thiopental",          "Load before ischaemia",     "Focal only (not global)", "N/A"),
    ("Status epilepticus",    "Thiopental",          "Loading then infusion",     "Last resort",           "Continuous EEG monitoring"),
    ("Neonatal induction",    "Thiopental",          "2-4 mg/kg IV",              "Avoid in congenital HD","Volume depletion"),
]
for i, row in enumerate(use_data):
    ry = use_y - 12 - i * 14
    rbg = DGRAY if i % 2 == 0 else CARD2
    cx4 = M + 5
    for j, (val, w2) in enumerate(zip(row, uc)):
        filled_rect(c, cx4, ry-11, w2, 13, rbg)
        is_ect = i == 2
        c_ = ACCENT2 if is_ect and j == 1 else (LGRAY if j == 0 else WHITE)
        txt(c, val, cx4+2, ry-7, size=6.3, color=c_, bold=(is_ect and j==1))
        cx4 += w2

# ── ROW 2: CONTRAINDICATIONS + ADVERSE EFFECTS ───────────────────────────────
y2p2 = y1p2 - uses_h - 8
side_h = 170

card_box(c, M, y2p2 - side_h, 185, side_h, "CONTRAINDICATIONS", RED)
contra_y = y2p2 - 28

contras = [
    ("ABSOLUTE", RED, [
        ("Acute Intermittent Porphyria",
         "Stimulates ALA synthetase",
         "Porphyrin crisis — FATAL"),
        ("Known hypersensitivity",
         "Anaphylaxis / anaphylactoid",
         ""),
    ]),
    ("RELATIVE / CAUTION", ACCENT2, [
        ("Severe CVS compromise",
         "Vasodilation + neg. inotropy",
         "Profound hypotension"),
        ("Hypovolaemia / haemorrhage",
         "Exaggerated hypotension",
         "Reduce dose significantly"),
        ("Active bronchospasm",
         "No bronchodilation",
         "Risk of laryngospasm"),
        ("Raised ICP (without controlled BP)",
         "BP drop -> CPP falls",
         "Use cautiously, maintain MAP"),
    ]),
]

for group_name, gcol, items in contras:
    filled_rect(c, M+5, contra_y-10, 175, 11, gcol)
    txt(c, group_name, M+8, contra_y-7, size=6.5, color=BG, bold=True)
    contra_y -= 13
    for name, mech, note in items:
        filled_rect(c, M+5, contra_y-18, 175, 20, CARD2)
        c.setStrokeColor(gcol)
        c.setLineWidth(2)
        c.line(M+5, contra_y-18, M+5, contra_y+2)
        txt(c, name, M+10, contra_y-3, size=7, color=WHITE, bold=True)
        txt(c, mech, M+10, contra_y-11, size=6.5, color=LGRAY)
        if note:
            txt(c, note, M+10, contra_y-18, size=6, color=gcol)
        contra_y -= 23

# ADVERSE EFFECTS
ae_x = M + 190
card_box(c, ae_x, y2p2 - side_h, W - M - ae_x, side_h, "ADVERSE EFFECTS", ACCENT2)
ae_y = y2p2 - 28

aes = [
    (ACCENT2, "Apnoea",              "Common post-induction; dose & rate dependent"),
    (RED,     "Laryngospasm",        "Light depth + airway stimulation"),
    (ACCENT2, "CVS depression",      "Hypotension — worst in hypovolaemia"),
    (ACCENT,  "Excitatory phenomena","Hiccup/tremor/myoclonus (methohexital)"),
    (MGRAY,   "Prolonged recovery",  "After infusion/repeated doses"),
    (RED,     "Intra-arterial inj.", "Vasospasm -> endarteritis -> gangrene"),
    (ACCENT2, "Extravasation",       "pH 10-11 -> tissue necrosis"),
    (MGRAY,   "Venous thrombosis",   "High concentration -> endothelial damage"),
]
for dot_col, name, desc in aes:
    filled_rect(c, ae_x+5, ae_y-9, 5, 8, dot_col)
    txt(c, name, ae_x+13, ae_y-6, size=7, color=WHITE, bold=True)
    txt(c, desc, ae_x+13, ae_y-14, size=6.5, color=LGRAY)
    hline(c, ae_x+5, ae_y-16, W-M-ae_x-10, MGRAY, 0.3)
    ae_y -= 19

# Intra-arterial management box
ia_y = y2p2 - side_h + 5
ia_x = ae_x + 5
ia_w = W - M - ae_x - 10
filled_rect(c, ia_x, ia_y, ia_w, 55, HexColor("#1a1010"))
c.setStrokeColor(RED)
c.setLineWidth(0.7)
c.rect(ia_x, ia_y, ia_w, 55, stroke=1, fill=0)
txt(c, "INTRA-ARTERIAL INJECTION — MANAGEMENT", ia_x+4, ia_y+48, size=6.5, color=RED, bold=True)
ia_steps = [
    "1. DO NOT remove cannula (use for treatment)",
    "2. Dilute with normal saline through same cannula",
    "3. Inject papaverine (vasodilator) intra-arterially",
    "4. Sympathetic block (stellate / brachial plexus)",
    "5. Systemic anticoagulation (heparin)",
]
for i, step in enumerate(ia_steps):
    txt(c, step, ia_x+4, ia_y+37-i*9, size=6.2, color=WHITE if i<4 else LGRAY)

# ── ROW 3: COMPARISON TABLE + RAPID FIRE ─────────────────────────────────────
y3p2 = y2p2 - side_h - 8
bot_h = H - (y3p2 + 8 + 14)   # to footer
comp_h = bot_h

half2 = (W - 2*M - 5) / 2

# COMPARISON
card_box(c, M, y3p2 - comp_h, half2, comp_h, "THIOPENTAL vs METHOHEXITAL vs PROPOFOL", ACCENT)
comp_y = y3p2 - 28

cmp_cols = [88, 66, 66, 60]
cmp_hdr  = ["Property", "Thiopental", "Methohexital", "Propofol"]
cmp_hcol = [MGRAY, ACCENT, ACCENT2, HexColor("#7E57C2")]

cx5 = M + 5
for h3, w3, hc in zip(cmp_hdr, cmp_cols, cmp_hcol):
    filled_rect(c, cx5, comp_y-10, w3, 12, hc)
    txt(c, h3, cx5+2, comp_y-7, size=6, color=BG if h3!="Property" else LGRAY, bold=True)
    cx5 += w3

cmp_data = [
    ("Class",           "Thiobarbiturate", "Oxybarbiturate",   "Alkylphenol"),
    ("Induction dose",  "3-4 mg/kg",       "1-2 mg/kg",        "1.5-2.5 mg/kg"),
    ("Onset",           "15-30 sec",       "~30 sec",          "~30 sec"),
    ("Anticonvulsant",  "YES",             "NO (proconv.)",    "YES"),
    ("ECT choice",      "No",              "FIRST CHOICE",     "Shortens seizure"),
    ("BP effect",       "Moderate drop",   "Moderate drop",    "Greater drop"),
    ("Recovery infusion","Prolonged",      "Faster",           "Fastest"),
    ("Anti-emetic",     "No",              "No",               "YES"),
    ("Pain injection",  "Mild",            "Mild",             "Common"),
    ("Bronchodilation", "No",              "No",               "YES"),
    ("TIVA suitability","Unsuitable",      "Possible (<60min)","Gold standard"),
    ("Availability",    "Limited/disc.",   "Available",        "Widely available"),
]
for i, row in enumerate(cmp_data):
    ry = comp_y - 12 - i * 12
    rbg = DGRAY if i%2==0 else CARD2
    cx6 = M + 5
    for j, (val, w3) in enumerate(zip(row, cmp_cols)):
        filled_rect(c, cx6, ry-9, w3, 11, rbg)
        is_ect = i==4 and j==2
        is_propofol_pos = i in [6,7,9,10] and j==3
        col_v = (ACCENT2 if is_ect else
                 ("4CAF50" if is_propofol_pos else
                  (LGRAY if j==0 else WHITE)))
        txt(c, val, cx6+2, ry-6, size=6,
            color=HexColor(col_v) if isinstance(col_v, str) else col_v,
            bold=is_ect)
        cx6 += w3

# RAPID FIRE / KEY POINTS
rf_x = M + half2 + 5
card_box(c, rf_x, y3p2 - comp_h, half2, comp_h, "RAPID FIRE VIVA POINTS", GOLD)
rf_y = y3p2 - 28
rf_w = half2 - 15

rf_items = [
    (ACCENT,  "Barbituric acid synthesized",    "1864 (Baeyer)"),
    (ACCENT,  "Barbiturate synthesis for anaes.","1903 Fischer & von Mering"),
    (ACCENT,  "First induction barb.",          "Hexobarbital 1927"),
    (ACCENT,  "Thiopental first clinical use",  "1934 — Lundy & Waters"),
    (ACCENT,  "Methohexital clinical use",       "1957 — V.K. Stoelting"),
    (ACCENT2, "Thiopental concentration",        "2.5% (sodium salt, pH 10-11)"),
    (ACCENT2, "Methohexital concentration",      "1% solution"),
    (ACCENT2, "Thiopental pKa",                 "7.6 (physiological = rapid onset)"),
    (ACCENT2, "Thiopental protein binding",      "~85% albumin"),
    (RED,     "ABS. contraindication",          "Acute Intermittent Porphyria"),
    (RED,     "Porphyria mechanism",            "Stimulates ALA synthetase"),
    (RED,     "Safe induction in AIP",          "Propofol or Ketamine"),
    (GOLD,    "ECT drug of choice",             "Methohexital"),
    (GOLD,    "Rectal premedication (paeds)",   "Methohexital 25 mg/kg rectal"),
    (GOLD,    "Why ECT — methohexital?",        "Proconvulsant, faster recovery"),
    (ACCENT,  "Neuroprotection (FOCAL)",        "YES — aneurysm/retraction"),
    (ACCENT,  "Neuroprotection (GLOBAL)",       "NO — not after cardiac arrest"),
    (ACCENT,  "Desulfuration product",          "Thiopental -> Pentobarbital"),
    (LGRAY,   "Thiopental shelf life",          "1 week refrigerated"),
    (LGRAY,   "Methohexital shelf life",        "6 weeks refrigerated"),
    (RED,     "Intra-art. injection Tx",        "Dilute + Papaverine + Sympathetic block"),
]

for dot_col, q, a in rf_items:
    filled_rect(c, rf_x+5, rf_y-7, 4, 6, dot_col if not isinstance(dot_col, str) else HexColor(dot_col))
    txt(c, q + ":", rf_x+12, rf_y-4, size=6.2, color=LGRAY, bold=True)
    txt(c, a, rf_x+12 + len(q)*3.6 + 4, rf_y-4, size=6.2, color=WHITE)
    rf_y -= 11

# ── FOOTER PAGE 2 ─────────────────────────────────────────────────────────────
filled_rect(c, 0, 0, W, 14, DGRAY)
txt(c, "Sources: Miller's Anesthesia 10e  |  Morgan & Mikhail 7e  |  Katzung Basic & Clinical Pharmacology 16e  |  Goodman & Gilman",
    W/2, 4, size=6, color=MGRAY, align="center")

c.save()
print("Done: Barbiturates_CheatSheet.pdf")
Running Command

cd /home/daytona/workspace/barbiturates-ppt && python make_cheatsheet.py 2>&1

Editing File

~/barbiturates-ppt/make_cheatsheet.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/barbiturates-ppt/make_cheatsheet.py'
Running Command

cd /home/daytona/workspace/barbiturates-ppt && python make_cheatsheet.py 2>&1

Editing File

~/barbiturates-ppt/make_cheatsheet.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/barbiturates-ppt/make_cheatsheet.py'
Running Command

grep -n 'HexColor("[^#]' /home/daytona/workspace/barbiturates-ppt/make_cheatsheet.py | head -30

Running Command

cd /home/daytona/workspace/barbiturates-ppt && python make_cheatsheet.py 2>&1

Your credits are exhausted. Your daily credits reset tomorrow, or you can purchase a top-up for more.

Generate a quick reference PDF cheat sheet on barbiturates

Running Command

mkdir -p /home/daytona/workspace/barbiturates-ppt && ls /home/daytona/workspace/barbiturates-ppt/

Writing File

~/barbiturates-ppt/cheatsheet.py

"""
Barbiturates in Anaesthesia — Quick Reference Cheat Sheet
2-page A4, ReportLab canvas. All HexColor values use '#RRGGBB' format.
"""
from reportlab.lib.pagesizes import A4
from reportlab.pdfgen import canvas as rl_canvas
from reportlab.lib.colors import HexColor, white, black
from reportlab.lib.units import mm

# ── Palette (all hex with # prefix) ──────────────────────────────────────────
BG     = HexColor("#0D1B2A")
CARD   = HexColor("#152232")
CARD2  = HexColor("#1A2E40")
DGRAY  = HexColor("#263238")
MGRAY  = HexColor("#546E7A")
LGRAY  = HexColor("#B0BEC5")
ACCENT = HexColor("#00C9A7")
AMB    = HexColor("#F4A261")
RED    = HexColor("#EF5350")
GREEN  = HexColor("#4CAF50")
GOLD   = HexColor("#FFD54F")
PURPLE = HexColor("#7E57C2")
WHITE  = white

W, H = A4   # 595.27 × 841.89 pt
M    = 10 * mm

# ── Helpers ───────────────────────────────────────────────────────────────────
def bg(cv): cv.setFillColor(BG); cv.rect(0,0,W,H,fill=1,stroke=0)

def frect(cv, x, y, w, h, fc, sc=None, lw=0.7):
    cv.setFillColor(fc)
    if sc:
        cv.setStrokeColor(sc); cv.setLineWidth(lw)
        cv.rect(x,y,w,h,fill=1,stroke=1)
    else:
        cv.rect(x,y,w,h,fill=1,stroke=0)

def rrect(cv, x, y, w, h, r, fc, sc=None, lw=0.7):
    cv.setFillColor(fc)
    if sc:
        cv.setStrokeColor(sc); cv.setLineWidth(lw)
        cv.roundRect(x,y,w,h,r,fill=1,stroke=1)
    else:
        cv.roundRect(x,y,w,h,r,fill=1,stroke=0)

def t(cv, text, x, y, size=7, color=WHITE, bold=False, align="left"):
    cv.setFillColor(color)
    cv.setFont("Helvetica-Bold" if bold else "Helvetica", size)
    if align == "center": cv.drawCentredString(x, y, text)
    elif align == "right": cv.drawRightString(x, y, text)
    else: cv.drawString(x, y, text)

def hline(cv, x, y, w, color=MGRAY, lw=0.4):
    cv.setStrokeColor(color); cv.setLineWidth(lw); cv.line(x,y,x+w,y)

def section_bar(cv, x, y, w, h, label, fc, tc=None):
    frect(cv, x, y, w, h, fc)
    t(cv, label, x+4, y+h/2-3.5, size=7.5, color=tc or BG, bold=True)

def card(cv, x, y, w, h, title, fc=ACCENT):
    rrect(cv, x, y, w, h, 3, CARD, fc, lw=0.8)
    frect(cv, x, y+h-14, w, 14, fc)
    # rounded top corners of header manually
    t(cv, title, x+5, y+h-10, size=7, color=BG, bold=True)

def bullet(cv, x, y, label, val, lc=LGRAY, vc=WHITE, lw_frac=0.38, sz=6.8):
    t(cv, label, x+9, y, size=sz, color=lc, bold=True)
    t(cv, val,   x + (200*lw_frac) + 9, y, size=sz, color=vc)

# ══════════════════════════════════════════════════════════════════════════════
# PAGE 1
# ══════════════════════════════════════════════════════════════════════════════
cv = rl_canvas.Canvas(
    "/home/daytona/workspace/barbiturates-ppt/Barbiturates_CheatSheet.pdf",
    pagesize=A4)
bg(cv)

# ── Header ────────────────────────────────────────────────────────────────────
frect(cv, 0, H-30, W, 30, ACCENT)
frect(cv, 0, H-34, W, 4,  AMB)
t(cv, "BARBITURATES IN ANAESTHESIA — QUICK REFERENCE",
  W/2, H-21, size=13, color=BG, bold=True, align="center")
t(cv, "MD Anaesthesia Cheat Sheet  |  Page 1 of 2",
  W/2, H-30, size=6.5, color=DGRAY, align="center")

# ── Row 1 — Chemistry / Classes / Mechanism  (3 equal columns) ───────────────
R1Y = H - 42
CH  = 178   # column height for row 1
CW  = (W - 2*M - 10) / 3   # ≈ 178 pt each
X1, X2, X3 = M, M+CW+5, M+2*(CW+5)

# ---- COL 1: Chemistry -------------------------------------------------------
card(cv, X1, R1Y-CH, CW, CH, "CHEMISTRY & SAR", ACCENT)
cy = R1Y - 28
t(cv, "Nucleus: Barbituric acid (malonic acid + urea) — INACTIVE",
  X1+5, cy, size=6.5, color=LGRAY); cy -= 10
t(cv, "Activity conferred by substitutions:", X1+5, cy, size=6.5, color=LGRAY); cy -= 11

sar = [
    ("C5 alkyl/aryl", "Hypnotic + sedative"),
    ("C5 phenyl",     "Anticonvulsant (phenobarbital)"),
    ("C2 = Sulfur",   "Thiobarbiturate: high lipid solubility"),
    ("C2 = Oxygen",   "Oxybarbiturate (methohexital)"),
    ("N1 methyl",     "Excitability, proconvulsant"),
    ("Longer C5",     "Potency + toxicity"),
]
cw1, cw2 = 75, int(CW-90)
for i,(k,v) in enumerate(sar):
    rb = DGRAY if i%2==0 else CARD2
    frect(cv, X1+5, cy-9, CW-10, 11, rb)
    t(cv, k, X1+7,      cy-5, size=6.3, color=AMB,   bold=True)
    t(cv, v, X1+7+cw1,  cy-5, size=6.3, color=WHITE)
    cy -= 12

cy -= 4
frect(cv, X1+5, cy-20, CW-10, 21, CARD2)
cv.setStrokeColor(AMB); cv.setLineWidth(0.6)
cv.rect(X1+5, cy-20, CW-10, 21, stroke=1, fill=0)
t(cv, "Formulation: Na salt + 6% Na2CO3  |  pH 10-11",
  X1+8, cy-6,  size=6.3, color=AMB)
t(cv, "Thiopental 2.5%  |  Methohexital 1%  |  Thiamylal 2%",
  X1+8, cy-14, size=6.3, color=WHITE)

# ---- COL 2: Classes & Incompatibilities -------------------------------------
card(cv, X2, R1Y-CH, CW, CH, "CLASSES & INCOMPATIBILITIES", AMB)
cy2 = R1Y - 28

groups = [
    ("THIOBARBITURATES", ACCENT, [
        ("Thiopental",   "IV induction — gold standard"),
        ("Thiamylal",    "Vet use only (US)"),
    ]),
    ("OXYBARBITURATES",  AMB, [
        ("Methohexital", "ECT — drug of choice"),
        ("Phenobarbital","Anticonvulsant (oral/IM)"),
        ("Pentobarbital","Barbiturate coma"),
    ]),
]
for gname, gc, members in groups:
    frect(cv, X2+5, cy2-10, CW-10, 11, gc)
    t(cv, gname, X2+8, cy2-7, size=7, color=BG, bold=True); cy2 -= 13
    for name, desc in members:
        frect(cv, X2+5, cy2-9, CW-10, 10, CARD2)
        cv.setStrokeColor(gc); cv.setLineWidth(1.5)
        cv.line(X2+5, cy2-9, X2+5, cy2+1)
        t(cv, name, X2+10, cy2-6, size=7,   color=WHITE, bold=True)
        t(cv, desc, X2+72, cy2-6, size=6.3, color=LGRAY)
        cy2 -= 12
    cy2 -= 5

frect(cv, X2+5, cy2-38, CW-10, 39, HexColor("#1a1010"))
cv.setStrokeColor(RED); cv.setLineWidth(0.7)
cv.rect(X2+5, cy2-38, CW-10, 39, stroke=1, fill=0)
t(cv, "INCOMPATIBLE (precipitates as free acid):",
  X2+8, cy2-5, size=6.5, color=RED, bold=True)
drugs = ["Rocuronium","Vecuronium","Suxamethonium",
         "Midazolam","Alfentanil","Atracurium"]
for i,d in enumerate(drugs):
    dx = X2+8 + (i%3)*58
    dy = cy2-15 - (i//3)*12
    t(cv, "x "+d, dx, dy, size=6.3, color=AMB)

# ---- COL 3: Mechanism -------------------------------------------------------
card(cv, X3, R1Y-CH, CW, CH, "MECHANISM OF ACTION", ACCENT)
cy3 = R1Y - 28

t(cv, "Two complementary mechanisms:", X3+5, cy3, size=6.5, color=LGRAY); cy3 -= 12

frect(cv, X3+5, cy3-11, CW-10, 12, CARD2)
cv.setStrokeColor(ACCENT); cv.setLineWidth(0.5)
cv.rect(X3+5, cy3-11, CW-10, 12, stroke=1, fill=0)
t(cv, "1. ENHANCE GABA-A INHIBITION", X3+8, cy3-7, size=7, color=ACCENT, bold=True)
cy3 -= 14
pts1 = [
    "Prolong Cl- channel OPEN duration",
    "High dose: activate WITHOUT GABA",
    "Site distinct from benzodiazepine site",
]
for p in pts1:
    t(cv, "> "+p, X3+8, cy3, size=6.3, color=WHITE); cy3 -= 10
cy3 -= 5

frect(cv, X3+5, cy3-11, CW-10, 12, CARD2)
cv.setStrokeColor(AMB); cv.setLineWidth(0.5)
cv.rect(X3+5, cy3-11, CW-10, 12, stroke=1, fill=0)
t(cv, "2. INHIBIT EXCITATORY TRANSMISSION", X3+8, cy3-7, size=7, color=AMB, bold=True)
cy3 -= 14
for p in ["Suppress AMPA glutamate receptors",
          "Suppress nicotinic ACh receptors"]:
    t(cv, "> "+p, X3+8, cy3, size=6.3, color=WHITE); cy3 -= 10
cy3 -= 5

# BZD vs Barb mini-table
frect(cv, X3+5, cy3-50, CW-10, 50, DGRAY)
t(cv, "vs BENZODIAZEPINES", X3+8, cy3-5, size=6.5, color=GOLD, bold=True)
th = ["Feature","Barbiturates","BZDs"]
tw = [52, 62, 48]
ths_colors = [MGRAY, ACCENT, LGRAY]
cx0 = X3+5
frect(cv, cx0, cy3-17, CW-10, 11, MGRAY)
for hh,ww,hc in zip(th,tw,ths_colors):
    t(cv, hh, cx0+2, cy3-13, size=6, color=BG if hh!="Feature" else LGRAY, bold=True)
    cx0 += ww
cmp_rows = [
    ("Cl- channel", "Prolongs duration", "Freq. increase"),
    ("Alone (hi-dose)","Activates GABA-A","Cannot activate"),
    ("Reversal","None","Flumazenil"),
    ("Analgesic","NO (hyperalgesic)","NO"),
]
for i2, row2 in enumerate(cmp_rows):
    ry2 = cy3 - 19 - i2*10
    frect(cv, X3+5, ry2-8, CW-10, 10, CARD2 if i2%2==0 else DGRAY)
    cx0 = X3+5
    rc = [LGRAY, ACCENT, LGRAY]
    for val, ww, rcc in zip(row2, tw, rc):
        t(cv, val, cx0+2, ry2-5, size=5.8, color=rcc); cx0 += ww

cy3 -= 60
frect(cv, X3+5, cy3-12, CW-10, 13, HexColor("#2a0a0a"))
cv.setStrokeColor(RED); cv.setLineWidth(0.7)
cv.rect(X3+5, cy3-12, CW-10, 13, stroke=1, fill=0)
t(cv, "! NO ANALGESIA — may cause HYPERALGESIA",
  X3+8, cy3-8, size=6.3, color=RED, bold=True)

# ── Row 2 — Pharmacokinetics ──────────────────────────────────────────────────
R2Y = R1Y - CH - 8
PKH = 148
card(cv, M, R2Y-PKH, W-2*M, PKH, "PHARMACOKINETICS", ACCENT)

# PK table (left 2/3)
pk_y = R2Y - 28
PKT_W = 325
pk_cols = [120, 100, 105]
pk_hdr  = ["Parameter", "Thiopental", "Methohexital"]
pk_hcol = [MGRAY, ACCENT, AMB]
cx = M+5
for hh, ww, hc in zip(pk_hdr, pk_cols, pk_hcol):
    frect(cv, cx, pk_y-10, ww, 12, hc)
    t(cv, hh, cx+3, pk_y-7, size=7,
      color=BG if hh!="Parameter" else LGRAY, bold=True)
    cx += ww

pk_rows = [
    ("Class",              "Thiobarbiturate",         "Oxybarbiturate"),
    ("Protein binding",    "~85% (albumin)",          "~73%"),
    ("pKa",                "7.6",                     "7.9"),
    ("Induction dose",     "3-4 mg/kg IV",            "1-2 mg/kg IV"),
    ("Onset (IV)",         "15-30 seconds",           "~30 seconds"),
    ("ED50",               "2.2-2.7 mg/kg",           "~1.1 mg/kg"),
    ("Plasma clearance",   "Low (slow elimination)",  "High (faster)"),
    ("Elim. half-life",    "Hours to days",           "Shorter"),
    ("Single bolus Rx",    "REDISTRIBUTION limited",  "REDISTRIBUTION limited"),
    ("Infusion recovery",  "Prolonged (accumulates)", "Faster (less accum.)"),
]
for i, row in enumerate(pk_rows):
    ry = pk_y-12-i*12
    rb = DGRAY if i%2==0 else CARD2
    cx2 = M+5
    for j,(val,ww) in enumerate(zip(row, pk_cols)):
        frect(cv, cx2, ry-9, ww, 11, rb)
        cc = LGRAY if j==0 else (ACCENT if j==1 else AMB)
        t(cv, val, cx2+3, ry-6, size=6.3, color=cc, bold=(j==0))
        cx2 += ww

# Key concepts (right 1/3)
kc_x = M + PKT_W + 15
kc_w = W - 2*M - PKT_W - 20
kc_y = R2Y - 28
frect(cv, kc_x, R2Y-PKH+5, kc_w, PKH-18, CARD2)
cv.setStrokeColor(ACCENT); cv.setLineWidth(0.7)
cv.rect(kc_x, R2Y-PKH+5, kc_w, PKH-18, stroke=1, fill=0)
t(cv, "KEY CONCEPTS", kc_x+5, kc_y, size=8, color=ACCENT, bold=True); kc_y -= 14

kc_items = [
    (ACCENT, "SINGLE BOLUS RECOVERY",
     "Redistribution: brain->muscle->fat",
     "Onset short DESPITE long half-life"),
    (AMB,    "INFUSION / REPEAT DOSES",
     "Fat compartment saturates",
     "Recovery = elimination-dependent"),
    (RED,    "CONTEXT-SENSITIVE t1/2",
     "Thiopental: markedly increases",
     "NOT suitable for TIVA"),
    (GOLD,   "PROTEIN BINDING",
     "Hypoalbuminaemia = more free drug",
     "Reduce dose: burns/liver/uraemia"),
    (GREEN,  "PORPHYRIA MECHANISM",
     "Stimulates ALA synthetase",
     "ABSOLUTE contraindication"),
]
for dc, title, l1, l2 in kc_items:
    frect(cv, kc_x+5, kc_y-3, 5, 6, dc)
    t(cv, title, kc_x+13, kc_y, size=7, color=dc, bold=True); kc_y -= 11
    t(cv, l1,   kc_x+13, kc_y, size=6.3, color=WHITE);       kc_y -= 9
    t(cv, l2,   kc_x+13, kc_y, size=6.3, color=LGRAY);       kc_y -= 13

# ── Row 3 — CNS Effects / CVS+Resp ───────────────────────────────────────────
R3Y = R2Y - PKH - 8
R3H = H - R3Y - 14   # down to footer, leaving 14pt footer
HW  = (W - 2*M - 5) / 2

# -- CNS -----------------------------------------------------------------------
card(cv, M, R3Y-R3H, HW, R3H, "CNS EFFECTS", ACCENT)
cn_y = R3Y - 28

# Dose-response pyramid
ladder_steps = [
    ("Sedation",              "#1C3A2E"),
    ("Hypnosis",              "#155E4E"),
    ("General Anaesthesia",   "#00897B"),
    ("Burst Suppression (EEG)","#00BFA5"),
    ("Isoelectric EEG",       "#00C9A7"),
]
base_w = 55
lad_x  = M + 5
for i,(lbl,col) in enumerate(ladder_steps):
    bw = base_w + i*20
    bx = lad_x + (HW-20-bw)/2
    frect(cv, bx, cn_y-10, bw, 10, HexColor(col))
    t(cv, lbl, lad_x+3, cn_y-7, size=6.3,
      color=BG if i==4 else LGRAY)
    if i < 4:
        t(cv, "v", lad_x + (HW-20)/2, cn_y-12, size=5, color=MGRAY, align="center")
    cn_y -= 15

cn_y -= 3
cns_pts = [
    (ACCENT, "CBF / CBV / ICP",    "Cerebral vasoconstriction (dose-dep.)"),
    (ACCENT, "CMRO2",              "Reduced proportional to EEG suppression"),
    (GREEN,  "Focal neuroprot.",   "Stroke, retraction, aneurysm clips (YES)"),
    (RED,    "Global ischaemia",   "Cardiac arrest — NOT effective (NO)"),
    (AMB,    "Anticonvulsant",     "Thiopental YES / Methohexital NO"),
    (GOLD,   "Methohexital ECT",   "Proconvulsant -> activates epileptic foci"),
]
for dc,lbl,desc in cns_pts:
    frect(cv, lad_x, cn_y-6, 5, 6, dc)
    t(cv, lbl,  lad_x+8, cn_y-3, size=7,   color=WHITE, bold=True)
    t(cv, desc, lad_x+8, cn_y-11, size=6.3, color=LGRAY)
    hline(cv, lad_x, cn_y-13, HW-15, MGRAY, 0.3)
    cn_y -= 17

# -- CVS + Resp ----------------------------------------------------------------
card(cv, M+HW+5, R3Y-R3H, HW, R3H, "CVS & RESPIRATORY EFFECTS", AMB)
cr_y  = R3Y - 28
cr_x  = M + HW + 10

t(cv, "CARDIOVASCULAR", cr_x, cr_y, size=7.5, color=AMB, bold=True); cr_y -= 12
cvs_rows = [
    ("BP decrease",    "Peripheral vasodilation (venodilation)"),
    ("Inotropy",       "Direct negative inotropic effect"),
    ("Heart rate",     "Reflex tachycardia (partial baroreflex blunt)"),
    ("vs Propofol",    "Less BP drop; better cardiac output"),
    ("Caution in",     "Hypovolaemia, shock, cardiac disease"),
]
for lbl,val in cvs_rows:
    frect(cv, cr_x, cr_y-8, 42, 10, CARD2)
    t(cv, lbl, cr_x+2,  cr_y-5, size=6.3, color=AMB,   bold=True)
    t(cv, val, cr_x+44, cr_y-5, size=6.3, color=WHITE)
    hline(cv, cr_x, cr_y-9, HW-20, MGRAY, 0.3)
    cr_y -= 13

cr_y -= 3
hline(cv, cr_x, cr_y+2, HW-20, ACCENT, 0.6)
cr_y -= 7
t(cv, "RESPIRATORY", cr_x, cr_y, size=7.5, color=ACCENT, bold=True); cr_y -= 12
resp_rows = [
    ("Apnoea",       "Common post-induction; rate + dose dependent"),
    ("VT & RR",      "Dose-dependent depression"),
    ("CO2/O2 drive", "Blunted hypercapnic + hypoxic response"),
    ("Broncho-",     "NO bronchodilation — avoid in bronchospasm"),
    ("Laryngospasm", "Risk under light depth + airway stimulation"),
]
for lbl,val in resp_rows:
    frect(cv, cr_x, cr_y-8, 42, 10, CARD2)
    t(cv, lbl, cr_x+2,  cr_y-5, size=6.3, color=ACCENT, bold=True)
    t(cv, val, cr_x+44, cr_y-5, size=6.3, color=WHITE)
    hline(cv, cr_x, cr_y-9, HW-20, MGRAY, 0.3)
    cr_y -= 13

# ── Footer p1 ─────────────────────────────────────────────────────────────────
frect(cv, 0, 0, W, 14, DGRAY)
t(cv, "Miller's Anesthesia 10e  |  Morgan & Mikhail 7e  |  Katzung 16e  |  Goodman & Gilman",
  W/2, 4, size=6, color=MGRAY, align="center")

cv.showPage()

# ══════════════════════════════════════════════════════════════════════════════
# PAGE 2
# ══════════════════════════════════════════════════════════════════════════════
bg(cv)
frect(cv, 0, H-30, W, 30, ACCENT)
frect(cv, 0, H-34, W, 4,  AMB)
t(cv, "BARBITURATES IN ANAESTHESIA — QUICK REFERENCE",
  W/2, H-21, size=13, color=BG, bold=True, align="center")
t(cv, "Clinical Uses | Contraindications | Comparison | Rapid Fire Viva  |  Page 2 of 2",
  W/2, H-30, size=6.5, color=DGRAY, align="center")

# ── Row 1 — Clinical Uses Table ───────────────────────────────────────────────
P2R1Y = H - 42
UTH   = 168
card(cv, M, P2R1Y-UTH, W-2*M, UTH, "CLINICAL USES & DOSING", ACCENT)

uc  = [88, 92, 105, 105, 84]
uhdr = ["Indication","Agent","Dose","Note","Reduce dose if"]
cx = M+5
frect(cv, cx, P2R1Y-27, sum(uc), 13, MGRAY)
for hh,ww in zip(uhdr, uc):
    t(cv, hh, cx+2, P2R1Y-22, size=6.8, color=BG, bold=True); cx += ww

u_data = [
    ("Induction of GA",       "Thiopental",           "3-4 mg/kg IV",                "ED50 2.2-2.7 mg/kg",            "Elderly, shock, obesity"),
    ("Induction of GA",       "Methohexital",         "1-2 mg/kg IV",                "ED50 ~1.1 mg/kg",               "Hypoalbuminaemia"),
    ("ECT Anaesthesia",       "Methohexital (FIRST)", "0.5-1 mg/kg IV",              "Proconvulsant: longer seizure",  "N/A"),
    ("Maintenance infusion",  "Methohexital",         "50-150 mcg/kg/min",           "<60 min ~ propofol recovery",   "Reduce if prolonged"),
    ("Paed premedication",    "Methohexital",         "25 mg/kg RECTAL",             "10% soln, 7 cm into rectum",    "N/A"),
    ("Barbiturate coma",      "Thiopental/Pentob.",   "Titrate to burst suppression","Refractory raised ICP",         "Haemodynamic monitoring req."),
    ("Neuroprotection",       "Thiopental",           "Load before ischaemia",       "FOCAL only — not global",       "N/A"),
    ("Status epilepticus",    "Thiopental",           "Load then infusion",          "Last resort; continuous EEG",   "EEG monitoring"),
    ("Neonatal induction",    "Thiopental",           "2-4 mg/kg IV",                "Avoid congenital HD",           "Volume depletion"),
]
for i,row in enumerate(u_data):
    ry = P2R1Y - 28 - i*14 - 6
    rb = DGRAY if i%2==0 else CARD2
    is_ect = i==2
    cx2 = M+5
    for j,(val,ww) in enumerate(zip(row, uc)):
        frect(cv, cx2, ry-10, ww, 12, rb)
        cc = (AMB if is_ect and j==1 else
              LGRAY if j==0 else WHITE)
        t(cv, val, cx2+2, ry-7, size=6.2, color=cc, bold=(is_ect and j==1))
        cx2 += ww

# ── Row 2 — Contraindications + Adverse Effects ──────────────────────────────
P2R2Y = P2R1Y - UTH - 8
P2R2H = 165
HW2   = (W - 2*M - 5) / 2

# Contraindications
card(cv, M, P2R2Y-P2R2H, HW2, P2R2H, "CONTRAINDICATIONS", RED)
ctra_y = P2R2Y - 28

frect(cv, M+5, ctra_y-11, HW2-10, 12, RED)
t(cv, "ABSOLUTE", M+8, ctra_y-7, size=7, color=BG, bold=True); ctra_y -= 14

abs_c = [
    ("Acute Intermittent Porphyria",
     "Stimulates ALA synthetase -> porphyrin crisis",
     "Safe alternatives: Propofol / Ketamine"),
    ("Known hypersensitivity",
     "Anaphylaxis / anaphylactoid reactions",""),
]
for name,mech,note in abs_c:
    frect(cv, M+5, ctra_y-22, HW2-10, 23, CARD2)
    cv.setStrokeColor(RED); cv.setLineWidth(2)
    cv.line(M+5, ctra_y-22, M+5, ctra_y+1)
    t(cv, name, M+11, ctra_y-5,  size=7,   color=WHITE, bold=True)
    t(cv, mech, M+11, ctra_y-13, size=6.3, color=LGRAY)
    if note: t(cv, note, M+11, ctra_y-20, size=6, color=RED)
    ctra_y -= 26

ctra_y -= 3
frect(cv, M+5, ctra_y-11, HW2-10, 12, AMB)
t(cv, "RELATIVE / CAUTION", M+8, ctra_y-7, size=7, color=BG, bold=True); ctra_y -= 14

rel_c = [
    ("Severe CVS compromise",    "Vasodilation + neg. inotropy -> hypotension"),
    ("Hypovolaemia / haemorrhage","Exaggerated BP drop — reduce dose significantly"),
    ("Active bronchospasm",      "No bronchodilation; laryngospasm risk"),
    ("Raised ICP (uncontrolled)","BP fall -> CPP fall; control MAP before induction"),
]
for name,mech in rel_c:
    frect(cv, M+5, ctra_y-18, HW2-10, 19, CARD2)
    cv.setStrokeColor(AMB); cv.setLineWidth(2)
    cv.line(M+5, ctra_y-18, M+5, ctra_y+1)
    t(cv, name, M+11, ctra_y-4,  size=7,   color=WHITE, bold=True)
    t(cv, mech, M+11, ctra_y-13, size=6.3, color=LGRAY)
    ctra_y -= 22

# Adverse Effects
AE_X = M + HW2 + 5
card(cv, AE_X, P2R2Y-P2R2H, HW2, P2R2H, "ADVERSE EFFECTS", AMB)
ae_y = P2R2Y - 28

aes = [
    (AMB,    "Apnoea",              "Common after induction — dose & rate dependent"),
    (RED,    "Laryngospasm",        "Under light depth + airway stimulation"),
    (AMB,    "CVS depression",      "Hypotension — worst in hypovolaemia"),
    (ACCENT, "Excitatory phenomena","Hiccup, tremor, myoclonus (esp. methohexital)"),
    (MGRAY,  "Prolonged recovery",  "After infusion / repeated doses"),
    (RED,    "Intra-arterial inj.", "Vasospasm -> endarteritis -> gangrene"),
    (AMB,    "Extravasation",       "pH 10-11 -> chemical cellulitis & necrosis"),
    (MGRAY,  "Venous thrombosis",   "High conc. -> endothelial damage"),
]
for dc,name,desc in aes:
    frect(cv, AE_X+5, ae_y-7, 5, 7, dc)
    t(cv, name, AE_X+13, ae_y-3,  size=7,   color=WHITE, bold=True)
    t(cv, desc, AE_X+13, ae_y-12, size=6.3, color=LGRAY)
    hline(cv, AE_X+5, ae_y-14, HW2-15, MGRAY, 0.3)
    ae_y -= 18

# Intra-art box
ia_y = P2R2Y - P2R2H + 5
ia_x = AE_X + 5
ia_w = HW2 - 10
frect(cv, ia_x, ia_y, ia_w, 52, HexColor("#2a0a0a"))
cv.setStrokeColor(RED); cv.setLineWidth(0.7)
cv.rect(ia_x, ia_y, ia_w, 52, stroke=1, fill=0)
t(cv, "INTRA-ARTERIAL INJECTION — MANAGEMENT",
  ia_x+4, ia_y+45, size=6.5, color=RED, bold=True)
ia_steps = [
    "1. Do NOT remove cannula — use it for treatment",
    "2. Dilute immediately with normal saline",
    "3. Inject papaverine (vasodilator) intra-arterially",
    "4. Sympathetic block (stellate / brachial plexus)",
    "5. Systemic anticoagulation (heparin)",
]
for i,s in enumerate(ia_steps):
    t(cv, s, ia_x+4, ia_y+34-i*9, size=6.2, color=WHITE)

# ── Row 3 — Comparison + Rapid Fire ──────────────────────────────────────────
P2R3Y = P2R2Y - P2R2H - 8
P2R3H = H - P2R3Y - 14

# Comparison table
card(cv, M, P2R3Y-P2R3H, HW2, P2R3H, "THIOPENTAL vs METHOHEXITAL vs PROPOFOL", ACCENT)
cm_y = P2R3Y - 28
cc   = [87, 62, 65, 58]
chdr = ["Property","Thiopental","Methohexital","Propofol"]
chcol= [MGRAY, ACCENT, AMB, PURPLE]
cx3  = M+5
for hh,ww,hc in zip(chdr,cc,chcol):
    frect(cv, cx3, cm_y-10, ww, 12, hc)
    t(cv, hh, cx3+2, cm_y-7, size=6,
      color=BG if hh!="Property" else LGRAY, bold=True)
    cx3 += ww

cm_data = [
    ("Class",           "Thiobarbiturate","Oxybarbiturate","Alkylphenol"),
    ("Induction dose",  "3-4 mg/kg","1-2 mg/kg","1.5-2.5 mg/kg"),
    ("Onset",           "15-30 sec","~30 sec","~30 sec"),
    ("Anticonvulsant",  "YES","NO (proconv.)","YES"),
    ("ECT choice",      "No","FIRST CHOICE","Shortens seizure"),
    ("BP effect",       "Moderate","Moderate","Greater drop"),
    ("Infusion recov.", "Prolonged","Faster","Fastest"),
    ("Anti-emetic",     "No","No","YES"),
    ("Pain injection",  "Mild","Mild","Common"),
    ("Bronchodilation", "No","No","YES"),
    ("TIVA suitability","Unsuitable","Possible <60min","Gold standard"),
    ("Availability",    "Limited/disc.","Available","Widely available"),
]
for i2,row in enumerate(cm_data):
    ry2 = cm_y - 12 - i2*12
    rb = DGRAY if i2%2==0 else CARD2
    cx4 = M+5
    for j2,(val,ww) in enumerate(zip(row,cc)):
        frect(cv, cx4, ry2-9, ww, 11, rb)
        is_ect = i2==4 and j2==2
        is_pos = i2 in [6,7,9,10] and j2==3
        cc_v = (AMB if is_ect else
                GREEN if is_pos else
                LGRAY if j2==0 else WHITE)
        t(cv, val, cx4+2, ry2-6, size=6,
          color=cc_v if not isinstance(cc_v,str) else HexColor(cc_v),
          bold=is_ect)
        cx4 += ww

# Rapid fire
RF_X = M + HW2 + 5
card(cv, RF_X, P2R3Y-P2R3H, HW2, P2R3H, "RAPID FIRE VIVA POINTS", GOLD)
rf_y  = P2R3Y - 28
rf_items = [
    (ACCENT, "Barbiturate synthesis:",         "1903 — Fischer & von Mering"),
    (ACCENT, "First induction agent:",         "Hexobarbital (1927)"),
    (ACCENT, "Thiopental first used:",         "1934 — Lundy & Waters"),
    (ACCENT, "Methohexital first used:",       "1957 — V.K. Stoelting"),
    (AMB,    "Thiopental concentration:",      "2.5% solution, pH 10-11"),
    (AMB,    "Methohexital concentration:",    "1% solution"),
    (AMB,    "Thiopental pKa:",                "7.6 (near physiological)"),
    (AMB,    "Protein binding:",               "Thiopental ~85% albumin"),
    (RED,    "ABSOLUTE contraindication:",     "Acute Intermittent Porphyria"),
    (RED,    "Porphyria mechanism:",           "Stimulates ALA synthetase"),
    (RED,    "Safe induction in AIP:",         "Propofol or Ketamine"),
    (GOLD,   "ECT drug of choice:",            "Methohexital"),
    (GOLD,   "Rectal premedication (paeds):",  "Methohexital 25 mg/kg"),
    (GOLD,   "Why methohexital for ECT?",      "Proconvulsant + rapid recovery"),
    (ACCENT, "Focal neuroprotection:",         "YES (aneurysm, retraction)"),
    (ACCENT, "Global ischaemia (arrest):",     "NOT effective"),
    (ACCENT, "Desulfuration product:",         "Thiopental -> Pentobarbital"),
    (LGRAY,  "Thiopental shelf life:",         "1 week (refrigerated)"),
    (LGRAY,  "Methohexital shelf life:",       "6 weeks (refrigerated)"),
    (RED,    "Intra-art. Tx (key steps):",     "Papaverine + Sympathetic block"),
]
for dc,q,a in rf_items:
    frect(cv, RF_X+5, rf_y-7, 5, 6, dc)
    t(cv, q, RF_X+13, rf_y-3, size=6.3, color=LGRAY, bold=True)
    t(cv, a, RF_X+13, rf_y-11,size=6.3, color=WHITE)
    rf_y -= 15

# ── Footer p2 ─────────────────────────────────────────────────────────────────
frect(cv, 0, 0, W, 14, DGRAY)
t(cv, "Miller's Anesthesia 10e  |  Morgan & Mikhail 7e  |  Katzung 16e  |  Goodman & Gilman",
  W/2, 4, size=6, color=MGRAY, align="center")

cv.save()
print("Done.")
Running Command

cd /home/daytona/workspace/barbiturates-ppt && python cheatsheet.py 2>&1

Running Command

ls -lh /home/daytona/workspace/barbiturates-ppt/Barbiturates_CheatSheet.pdf

Your cheat sheet is ready!

Barbiturates CheatSheet

PDF Document · PDF


2-page A4 PDF with a dark navy + teal + amber theme, covering:
PageSections
Page 1Chemistry & SAR · Classes & Incompatibilities · Mechanism of Action · Pharmacokinetics (table + key concepts) · CNS Effects (dose-response ladder) · CVS & Respiratory Effects
Page 2Clinical Uses & Dosing (full table) · Contraindications (absolute + relative) · Adverse Effects (inc. intra-arterial injection management steps) · Thiopental vs Methohexital vs Propofol comparison · 20-point Rapid Fire Viva panel

CSF formation and circulation and anesthetic importance in MD Anaesthesia

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Reading File
Finding Sources
Loading Image
I have all the content needed. Let me now compose a comprehensive, well-structured MD Anaesthesia-level answer.

CSF Formation, Circulation & Anaesthetic Importance


1. Introduction & Overview

Cerebrospinal fluid (CSF) is a clear, colourless, watery liquid that occupies the ventricular system of the brain and the subarachnoid space surrounding the brain and spinal cord. For the anaesthetist, a thorough understanding of CSF is indispensable because:
  • It determines intracranial pressure (ICP)
  • It is the medium through which intrathecal drugs are administered and distributed
  • Its dynamics are directly altered by anaesthetic drugs, ventilation strategy, and patient positioning
  • Its volume, along with blood and brain parenchyma, follows the Monro-Kellie doctrine

2. Anatomy of the CSF Compartments

Ventricles

There are four ventricles, each containing a choroid plexus:
VentricleLocationForamen
Two lateral ventriclesWithin each cerebral hemisphereForamina of Monro → 3rd ventricle
Third ventricleDiencephalon (between thalami)Cerebral aqueduct of Sylvius → 4th
Fourth ventricleBetween pons/medulla and cerebellumForamina of Luschka (×2, lateral) and Foramen of Magendie (median) → subarachnoid space
CSF flows from the fourth ventricle into the subarachnoid space via these three foramina. Distended regions of the subarachnoid space are called subarachnoid cisterns (cisterna magna, pontine cistern, interpeduncular cistern).
CSF Circulation Diagram showing ventricles, choroid plexuses, foramina, and arachnoid granulations
CSF circulation pathway — from choroid plexus through ventricles to subarachnoid space and absorption at arachnoid granulations (Costanzo Physiology, 7e)

3. Formation of CSF

Site of Production

CSF is produced primarily by the choroid plexus in the lateral, third, and fourth ventricles. Small additional contributions come from:
  • Cerebral endothelial cells
  • Fluid produced as a by-product of neuronal metabolic activity

Rate of Production

  • ~450–500 mL/day (some sources: 500 mL/day; Miller's: 450 mL/day)
  • Rate of formation: ~0.35 mL/min (≈ 20 mL/hr)
  • Total CSF volume: ~150 mL (intracranial ~100 mL + spinal ~50 mL)
  • Therefore, CSF turns over approximately 3–4 times per day

Mechanism of Formation

CSF formation is an active secretory process, not simple ultrafiltration. Two phases:
  1. Hydrostatic efflux — fluid moves from choroidal capillaries into the perivascular space by hydrostatic pressure gradient
  2. Active transport — choroid plexus epithelial cells (resembling renal distal tubular cells) actively transport ions and water into the ventricles:
    • Secreted into CSF: Na⁺, Cl⁻, HCO₃⁻, water
    • Reabsorbed from CSF into blood: K⁺
    • Proteins, cholesterol, and large molecules are excluded (large molecular size)

The Blood-CSF Barrier (Choroid Plexus Barrier)

Three layers:
  1. Capillary endothelial cells + basement membrane
  2. Neuroglial membrane
  3. Epithelial cells of the choroid plexus (joined by tight junctions)

Circadian Rhythm

CSF production is under circadian influence — peak production occurs during sleep. This is relevant because the glymphatic system (see below) is also most active during sleep and general anaesthesia.

4. CSF Composition

ComponentCSF vs Plasma
Na⁺Equal to plasma
Cl⁻Equal to plasma
HCO₃⁻Equal to plasma
OsmolarityEqual to plasma
K⁺Lower than plasma
Ca²⁺Lower than plasma
GlucoseLower than plasma (60–80% of plasma)
Amino acidsLower than plasma
ProteinNegligible (~15–45 mg/dL; plasma 6000–8000 mg/dL)
CholesterolNegligible
Mg²⁺Higher than plasma
pHSlightly lower than plasma (7.32–7.34)
Normal CSF pressure: 70–180 mmH₂O (5–15 mmHg) in lateral decubitus.

5. Circulation of CSF

The CSF circulation follows a predictable pathway:
Choroid plexus (lateral ventricles)
        ↓ [Foramina of Monro]
    Third ventricle
        ↓ [Cerebral aqueduct of Sylvius]
    Fourth ventricle
        ↓ [Foramina of Luschka (×2) + Foramen of Magendie (×1)]
    Subarachnoid space (around brain and spinal cord)
        ↓ [Convection/bulk flow upward over cerebral convexities]
    Arachnoid granulations (in dural venous sinuses)
        ↓ [One-way bulk flow]
    Superior sagittal sinus → Venous blood

Additional Drainage Routes (Minor)

  • Along cranial and peripheral nerve sheaths
  • Perivascular (perivenous) routes
  • Along white matter tracts (transependymal flow)
  • Meningeal and cervical lymphatic vessels

Driving Force for Circulation

CSF flows primarily by pulsatile bulk flow driven by:
  • Choroidal arterial pulsations
  • Respiratory pressure variations
  • Cilia on ependymal cells lining the ventricles

6. The Glymphatic System — Anaesthetic Relevance

The glymphatic pathway (discovered ~2013) is a newly understood waste-clearance system of the brain:
Mechanism:
  1. CSF enters periarterial spaces (bounded by vessel walls and astrocyte end-feet)
  2. Aquaporin-4 channels on astrocyte end-feet facilitate water exchange
  3. CSF is transported by convection to brain parenchyma
  4. Accumulates in perivenous space → drains into cervical lymphatics and along cranial nerves
Clinical significance for anaesthetists:
  • The periarterial space increases significantly during sleep AND during general anaesthesia → waste clearance enhanced
  • Among anaesthetic agents:
    • Volatile agents → reduce lymphatic/glymphatic transport
    • Dexmedetomidine → less reduction; better preserves glymphatic transport
    • This may be relevant to the pathogenesis of postoperative cognitive dysfunction (POCD)
  • Miller's Anesthesia, 10e, p. 930

7. Absorption of CSF

Primary Route: Arachnoid Granulations

  • One-way valve-like projections into the dural venous sinuses (mainly superior sagittal sinus)
  • Bulk flow from CSF to venous blood when CSF pressure > venous pressure
  • Open at a threshold pressure of ~68 mmH₂O

Secondary Routes

  • Perivenous and perineural pathways
  • Spinal arachnoid granulations
  • Nasal mucosal lymphatics (via cribriform plate)

8. Monro-Kellie Doctrine & ICP

The cranial vault is a rigid closed box. The three incompressible contents are:
  • Brain parenchyma: ~80%
  • Blood (cerebrovascular): ~12%
  • CSF: ~8% (~100 mL intracranial)
Monro-Kellie Doctrine: The total intracranial volume is constant. An increase in one component must be compensated by a decrease in another.
Compensatory mechanisms for rising ICP:
  1. Displacement of CSF into spinal subarachnoid space (most readily displaced)
  2. Reduction in cerebral venous blood volume
  3. ↓ CSF production
  4. Once compensation is exhausted → exponential rise in ICP (decompensation)
Normal ICP: 5–15 mmHg (70–180 mmH₂O)
Cerebral Perfusion Pressure (CPP):
CPP = MAP − ICP (or MAP − CVP, whichever is higher)
Target: CPP ≥ 60 mmHg (brain-injured patients: ≥ 70 mmHg)

9. Anaesthetic Importance of CSF — Comprehensive


9.1 Spinal (Subarachnoid) Anaesthesia

This is the most direct anaesthetic application of CSF knowledge:
Mechanism: Local anaesthetic injected into the lumbar cistern (L3-4 or L4-5) mixes with CSF and blocks nerve roots in the subarachnoid space.
Baricity and CSF density:
PreparationDensityBehaviourClinical use
Hyperbaric (heavy)> CSF (denser)Sinks with gravityPositioned to desired level; most controllable
Isobaric= CSFMinimal positional spreadMore predictable regardless of position
Hypobaric (light)< CSFRises against gravityHip arthroplasty in lateral position
CSF specific gravity: 1.003–1.008 at 37°C
Hyperbaric bupivacaine (0.5% + 8% glucose) = heavy bupivacaine, most commonly used
Factors affecting level of spinal block:
  • Baricity — most important factor
  • Dose (volume × concentration)
  • Patient position at and immediately after injection
  • Level of injection (L3-4 vs L4-5)
  • Speed of injection
  • CSF volume — reduced in pregnancy (epidural venous engorgement compresses subarachnoid space), obesity, elderly → unpredictable high block risk
PDPH (Post-Dural Puncture Headache):
  • CSF leaks through dural puncture site → ↓ CSF volume and pressure → traction on pain-sensitive intracranial structures
  • Positional: worse sitting/standing, relieved lying flat
  • Prevented by: small-gauge pencil-point needles (Whitacre, Sprotte)
  • Treated by: hydration, caffeine, epidural blood patch (gold standard)

9.2 Epidural Anaesthesia and CSF

  • Epidural space is external to the dura — no direct CSF contact
  • Accidental dural puncture (wet tap) → PDPH (especially with large Tuohy needle, 16–18G)
  • Epidural blood patch: 20 mL autologous blood injected epidurally → seals CSF leak → clot increases epidural pressure temporarily and seals dural puncture → 85–90% success rate
  • Total spinal: accidental intrathecal injection of epidural volume → high/total spinal block

9.3 Anaesthesia in Raised ICP

Anaesthetic goals in raised ICP:
  1. Maintain CPP ≥ 60 mmHg (MAP 80–100 + ICP control)
  2. Reduce ICP by:
    • Reducing cerebral blood volume (CBV)
    • Reducing CSF volume
    • Reducing brain water/oedema
Effect of anaesthetic agents on ICP/CSF:
AgentEffect on ICPMechanism
Thiopental↓↓ ICP↓ CBF, ↓ CMRO₂, ↓ CBV
Propofol↓↓ ICP↓ CBF, ↓ CMRO₂, ↓ CBV
Ketamine↑ ICP↑ CBF, ↑ CMRO₂ — avoid in raised ICP
Etomidate↓ ICP↓ CBF, ↓ CMRO₂
Midazolam/BZDs↓ mild↓ CMRO₂
Volatile agents↑ ICP (dose-dep.)Direct cerebral vasodilation → ↑ CBV
IsofluraneMild ↑ ICP; blunted by hyperventilation
SevofluraneMild ↑ ICP at >1 MACPreserves autoregulation best among volatiles
Desflurane↑ ICP slightly more than sevo/isoAlso ↑ HR and MAP via airway irritation
N₂O↑ ICP↑ CBF, ↑ CMRO₂ — avoid in neurosurgery
CSF production and resorption:
  • Volatile anaesthetics have modest, variable effects on CSF production and resorption — "clinically far less important than their effects on CBF" (Barash, 9e)
  • The dominant mechanism of ICP change with volatiles is through changes in CBV (cerebral blood flow), not through direct effects on CSF

9.4 Hyperventilation and ICP

PaCO₂ is the most potent acute regulator of CBF and ICP:
  • ↓ PaCO₂ → cerebral vasoconstriction → ↓ CBV → ↓ ICP
  • Each 1 mmHg ↓ PaCO₂ → ↓ CBF by ~3%
  • Target PaCO₂: 35 mmHg (routine) or 30–35 mmHg (acute ICP crisis)
  • Prophylactic hyperventilation to PaCO₂ <30 mmHg is not recommended (cerebral ischaemia risk)
  • Effect is temporary — CSF pH normalizes within 6–12 hours (bicarbonate compensates)

9.5 Drugs That Reduce CSF Production

DrugMechanismClinical use
AcetazolamideInhibits carbonic anhydrase in choroid plexus → ↓ HCO₃⁻ secretion → ↓ CSF production by ~50%Raised ICP, idiopathic intracranial hypertension
FurosemideInhibits Cl⁻ transport in choroid plexusAdjunct in ICP management
MannitolOsmotic → ↓ brain water; also ↓ blood viscosity → ↓ CBF reflexlyAcute ICP management; 0.25–1 g/kg IV
Hypertonic salineOsmotic; ↑ serum osmolarity → draws water from brain3–23.4% saline for ICP
Corticosteroids↓ permeability; effective for vasogenic oedema (tumours)Preoperative brain tumour, post-irradiation
BarbituratesBurst suppression → ↓ CMRO₂ → ↓ CBF → ↓ CBV → ↓ ICPBarbiturate coma (refractory ICP)

9.6 CSF Drainage as a Neurosurgical Adjunct

  • Lumbar CSF drain or ventricular drain (EVD): deliberate removal of CSF during surgery to reduce ICP and improve surgical access to deep structures
  • External Ventricular Drain (EVD): catheter in lateral ventricle → continuous ICP monitoring + CSF drainage
  • Used in: subarachnoid haemorrhage (SAH), TBI, post-craniotomy ICP management, hydrocephalus
  • Anaesthetic relevance: sudden rapid CSF drainage → risk of brain herniation (especially with posterior fossa tumours and aqueductal obstruction)

9.7 Lumbar Puncture — Anaesthetic Considerations

Diagnostic LP:
  • Performed at L3-4 or L4-5 (below conus medullaris, which ends at L1-2 in adults)
  • Patient position: lateral decubitus (knees to chest) or sitting flexed
  • Normal opening pressure: 70–180 mmH₂O
  • Contraindications to LP:
    • Raised ICP with papilloedema or mass lesion (risk of transtentorial herniation)
    • Local infection at puncture site
    • Coagulopathy (INR >1.5, platelets <50,000, therapeutic anticoagulation)
    • Anticoagulant therapy — timing per regional anaesthesia guidelines (ASRA/ESRA)
CSF examination in anaesthetic context:
  • Blood-tinged CSF: traumatic tap (clears with successive samples) vs SAH (xanthochromia)
  • CSF glucose: always compare with blood glucose — ratio <0.5 = bacterial meningitis

9.8 CSF and Neuraxial Drug Spread

Intrathecal opioids:
  • Lipophilic (fentanyl, sufentanil): rapid uptake into cord → segmental analgesia, minimal rostral spread, shorter duration
  • Hydrophilic (morphine, diamorphine): slow uptake → rostral spread in CSF → prolonged analgesia + risk of delayed respiratory depression (up to 18–24 hours with morphine)
  • Requires 24-hour respiratory monitoring after intrathecal morphine
Intrathecal adjuvants: clonidine, dexmedetomidine, neostigmine — all act via CSF distribution

9.9 Position and CSF Pressure

PositionEffect on ICP
Head-up 30°↓ ICP (facilitates CSF and venous drainage) — standard for raised ICP
Head-down (Trendelenburg)↑ ICP — use cautiously in neuro patients
Head rotation/flexionCan obstruct jugular venous drainage → ↑ ICP
Lateral decubitusPreferred for LP (opens intervertebral spaces)
Sitting (beach chair)↓ ICP but risk of venous air embolism in posterior fossa surgery

9.10 The Glymphatic System and POCD

Of emerging anaesthetic relevance:
  • General anaesthesia increases glymphatic transport (periarterial space enlarges)
  • Volatile agents reduce glymphatic function relative to sleep
  • Dexmedetomidine (which produces sleep-like state) better preserves glymphatic flow
  • Accumulation of amyloid-β and tau (AD pathology markers) may relate to impaired glymphatic clearance
  • This underlies ongoing research linking choice of anaesthetic agent to long-term cognitive outcomes

10. Summary Table — Anaesthetic Effects on CSF/ICP

InterventionICP EffectMechanism
Propofol↓↓↓ CMRO₂ → ↓ CBF → ↓ CBV
Thiopental↓↓↓ CMRO₂ → ↓ CBF → ↓ CBV; burst suppression
Ketamine↑↑↑ CMRO₂, ↑ CBF, ↑ CBV — avoid in raised ICP
Volatile (>1 MAC)↑ (mild)Direct vasodilation → ↑ CBV
Sevoflurane ≤1 MACMinimalPreserves autoregulation best
Desflurane↑ (most of volatiles)Greatest vasodilation + airway reflex ↑ MAP
N₂O↑ CBF, ↑ CMRO₂
Hyperventilation (PaCO₂ ↓)Cerebral vasoconstriction
Hypoventilation (PaCO₂ ↑)↑↑Cerebral vasodilation
MannitolOsmotic dehydration of brain
Head-up 30°Facilitates venous + CSF drainage
CSF drainage (EVD/LP)Direct volume removal
Acetazolamide↓ CSF production via CA inhibition
Coughing/straining↑↑↑ intrathoracic pressure → ↑ CBV

11. Key Viva Points

QA
Rate of CSF production~450–500 mL/day (0.35 mL/min)
Total CSF volume~150 mL
Turnover rate3–4 times per day
Site of productionChoroid plexus (lateral, 3rd, 4th ventricles)
Site of absorptionArachnoid granulations in superior sagittal sinus
Foramen from 4th ventricleLuschka (×2, lateral) + Magendie (×1, median)
Normal ICP5–15 mmHg (70–180 mmH₂O)
CPP formulaMAP − ICP
Target CPP≥60 mmHg (≥70 in TBI)
Most potent regulator of CBFPaCO₂
Drug that best reduces CSF productionAcetazolamide (CA inhibitor)
Anaesthetic that raises ICP mostKetamine; N₂O
Safest volatile for neuroSevoflurane ≤1 MAC
Why avoid ketamine in ICP?↑ CMRO₂ + ↑ CBF + ↑ CBV
Monro-Kellie doctrineBrain + blood + CSF = constant intracranial volume
Baricity importance in spinalHyperbaric sinks; hypobaric floats; position determines spread
PDPH mechanismCSF leak → ↓ CSF pressure → traction on intracranial structures
Treatment of PDPHEpidural blood patch (gold standard)
Intrathecal morphine riskDelayed respiratory depression (up to 18–24 h)
Glymphatic and dexmedetomidineDex better preserves glymphatic transport than volatiles

Sources: Miller's Anesthesia 10e | Barash Clinical Anesthesia 9e | Costanzo Physiology 7e | Boron & Boulpaep Medical Physiology

Make a ppt and cheat sheet

Writing File

~/csf-anaesthesia/make_ppt.js

const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "CSF Formation, Circulation & Anaesthetic Importance";

// ── Palette ──────────────────────────────────────────────────────────────────
const BG    = "0A1628";
const CARD  = "112035";
const CARD2 = "162840";
const DGRAY = "1E3448";
const MGRAY = "4A6278";
const LGRAY = "8EAABF";
const TEAL  = "00BCD4";
const GREEN = "26A69A";
const AMB   = "FFA726";
const RED   = "EF5350";
const PURP  = "7E57C2";
const WHITE = "FFFFFF";
const GOLD  = "FFD54F";

// ── Helpers ───────────────────────────────────────────────────────────────────
function addBg(s) {
  s.addShape(pres.shapes.RECTANGLE, { x:0,y:0,w:10,h:5.625, fill:{color:BG}, line:{color:BG} });
}
function topBar(s, c=TEAL) {
  s.addShape(pres.shapes.RECTANGLE, { x:0,y:0,w:10,h:0.08, fill:{color:c}, line:{color:c} });
}
function sideBar(s, c=TEAL) {
  s.addShape(pres.shapes.RECTANGLE, { x:0,y:0,w:0.1,h:5.625, fill:{color:c}, line:{color:c} });
}
function slideTitle(s, title, color=TEAL) {
  s.addText(title, { x:0.25,y:0.12,w:9.5,h:0.5, fontSize:20,bold:true,color:color,fontFace:"Calibri",margin:0 });
  s.addShape(pres.shapes.RECTANGLE, { x:0.25,y:0.65,w:1.4,h:0.04, fill:{color:AMB}, line:{color:AMB} });
}
function card(s,x,y,w,h,opts={}) {
  s.addShape(pres.shapes.RECTANGLE, {
    x,y,w,h,
    fill:{color:opts.fill||CARD},
    line:{color:opts.border||TEAL, pt:opts.lw||1.2},
    shadow:{type:"outer",color:"000000",blur:8,offset:3,angle:135,opacity:0.2}
  });
}
function chipText(s,x,y,w,h,label,fc,tc="000000") {
  s.addShape(pres.shapes.RECTANGLE,{x,y,w,h, fill:{color:fc},line:{color:fc}});
  s.addText(label,{x,y,w,h,fontSize:9,bold:true,color:tc,fontFace:"Calibri",align:"center",valign:"middle",margin:0});
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s);
  // Top + bottom bars
  s.addShape(pres.shapes.RECTANGLE,{x:0,y:0,w:10,h:0.1,fill:{color:TEAL},line:{color:TEAL}});
  s.addShape(pres.shapes.RECTANGLE,{x:0,y:5.525,w:10,h:0.1,fill:{color:AMB},line:{color:AMB}});
  // Large decorative circle
  s.addShape(pres.shapes.OVAL,{x:6.2,y:-1.2,w:5,h:5, fill:{color:TEAL,transparency:90},line:{color:TEAL,transparency:85,pt:1.5}});
  s.addShape(pres.shapes.OVAL,{x:7.0,y:-0.5,w:3.2,h:3.2, fill:{color:TEAL,transparency:94},line:{color:TEAL,transparency:88,pt:1}});
  // Accent left box
  card(s,0.55,1.0,1.5,1.5,{fill:TEAL,border:TEAL});
  s.addText("CSF",{x:0.55,y:1.0,w:1.5,h:1.5,fontSize:36,bold:true,color:BG,fontFace:"Calibri",align:"center",valign:"middle",margin:0});
  // Main title
  s.addText("CEREBROSPINAL FLUID",{x:2.35,y:0.95,w:7.3,h:0.65,fontSize:36,bold:true,color:WHITE,fontFace:"Calibri",charSpacing:3,margin:0});
  s.addText("Formation, Circulation & Anaesthetic Importance",{x:2.35,y:1.62,w:7.3,h:0.45,fontSize:20,color:TEAL,fontFace:"Calibri",margin:0});
  s.addShape(pres.shapes.RECTANGLE,{x:2.35,y:2.18,w:5.5,h:0.04,fill:{color:AMB},line:{color:AMB}});
  s.addText("MD Anaesthesia  |  Neuroanatomy · Physiology · Clinical Applications",{x:2.35,y:2.28,w:7.3,h:0.35,fontSize:13,color:LGRAY,fontFace:"Calibri",italic:true,margin:0});
  s.addText("Sources: Miller's Anesthesia 10e  ·  Barash 9e  ·  Costanzo Physiology 7e  ·  Boron & Boulpaep",{x:0.3,y:5.22,w:9.4,h:0.25,fontSize:8,color:MGRAY,fontFace:"Calibri",align:"center",margin:0});
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 2 — OUTLINE
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s); topBar(s); sideBar(s);
  slideTitle(s,"OUTLINE");
  const topics=[
    {n:"01",t:"Anatomy of CSF Compartments"},
    {n:"02",t:"Formation of CSF"},
    {n:"03",t:"CSF Composition & Normal Values"},
    {n:"04",t:"Circulation & Absorption"},
    {n:"05",t:"Monro-Kellie Doctrine & ICP"},
    {n:"06",t:"Anaesthetic Effects on CSF / ICP"},
    {n:"07",t:"Spinal & Epidural Anaesthesia"},
    {n:"08",t:"ICP Management — Anaesthetic Strategies"},
    {n:"09",t:"Glymphatic System"},
    {n:"10",t:"Viva Summary & Key Numbers"},
  ];
  const col=[topics.slice(0,5),topics.slice(5)];
  col.forEach((c,ci)=>{
    const sx=0.3+ci*4.9;
    c.forEach((item,i)=>{
      const y=0.85+i*0.89;
      chipText(s,sx,y,0.55,0.42,item.n,TEAL,BG);
      s.addText(item.t,{x:sx+0.65,y:y,w:4.1,h:0.42,fontSize:13,color:WHITE,fontFace:"Calibri",valign:"middle",margin:0});
      if(i<c.length-1) s.addShape(pres.shapes.RECTANGLE,{x:sx,y:y+0.45,w:4.65,h:0.02,fill:{color:MGRAY,transparency:55},line:{color:MGRAY}});
    });
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 3 — ANATOMY
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s); topBar(s); sideBar(s);
  slideTitle(s,"ANATOMY OF CSF COMPARTMENTS");

  // Ventricle flow card
  card(s,0.2,0.78,5.5,4.6,{border:TEAL});
  s.addText("VENTRICULAR PATHWAY",{x:0.3,y:0.82,w:5.3,h:0.3,fontSize:11,bold:true,color:TEAL,fontFace:"Calibri",margin:0});

  const steps=[
    {label:"Lateral Ventricles (×2)",desc:"Largest; in cerebral hemispheres\nChoroid plexus along inner radius",col:TEAL},
    {label:"Foramina of Monro",desc:"Paired interventricular foramina",col:MGRAY},
    {label:"Third Ventricle",desc:"Between thalami; choroid plexus in roof",col:TEAL},
    {label:"Cerebral Aqueduct of Sylvius",desc:"Narrow channel through midbrain",col:MGRAY},
    {label:"Fourth Ventricle",desc:"Between pons/medulla & cerebellum\nChoroid plexus in roof",col:TEAL},
    {label:"Foramina of Luschka (×2) + Magendie (×1)",desc:"Exit points to subarachnoid space",col:AMB},
    {label:"Subarachnoid Space",desc:"Surrounds brain + spinal cord\nCisterns: magna, pontine, interpeduncular",col:GREEN},
  ];
  steps.forEach((st,i)=>{
    const y=1.2+i*0.5;
    s.addShape(pres.shapes.OVAL,{x:0.28,y:y,w:0.32,h:0.32,fill:{color:st.col},line:{color:st.col}});
    s.addText(st.label,{x:0.7,y:y,w:4.9,h:0.2,fontSize:10.5,bold:true,color:WHITE,fontFace:"Calibri",margin:0});
    s.addText(st.desc,{x:0.7,y:y+0.2,w:4.9,h:0.25,fontSize:9,color:LGRAY,fontFace:"Calibri",margin:0});
    if(i<steps.length-1){
      s.addShape(pres.shapes.RECTANGLE,{x:0.42,y:y+0.35,w:0.03,h:0.15,fill:{color:MGRAY},line:{color:MGRAY}});
    }
  });

  // Right — key facts
  card(s,5.95,0.78,3.8,2.1,{border:AMB});
  s.addText("KEY FACTS",{x:6.05,y:0.82,w:3.6,h:0.28,fontSize:11,bold:true,color:AMB,fontFace:"Calibri",margin:0});
  const facts=[
    ["Total CSF volume","~150 mL"],
    ["Intracranial CSF","~100 mL"],
    ["Spinal CSF","~50 mL"],
    ["Daily production","450–500 mL"],
    ["Turnover","3–4× per day"],
    ["Normal ICP","5–15 mmHg"],
  ];
  facts.forEach(([k,v],i)=>{
    const fy=1.18+i*0.28;
    s.addText(k,{x:6.05,y:fy,w:2.3,h:0.25,fontSize:10.5,color:LGRAY,fontFace:"Calibri",bold:true,margin:0});
    s.addText(v,{x:8.35,y:fy,w:1.3,h:0.25,fontSize:10.5,color:TEAL,fontFace:"Calibri",bold:true,align:"right",margin:0});
  });

  // Conus note
  card(s,5.95,3.05,3.8,1.55,{border:GREEN});
  s.addText("SPINAL LANDMARKS",{x:6.05,y:3.09,w:3.6,h:0.28,fontSize:11,bold:true,color:GREEN,fontFace:"Calibri",margin:0});
  const sp=[
    "Conus medullaris ends at L1-2 (adults)",
    "LP performed at L3-4 or L4-5",
    "Lumbar cistern: largest accessible CSF pool",
    "Dural sac ends at S2",
  ];
  sp.forEach((p,i)=>s.addText("▸ "+p,{x:6.05,y:3.38+i*0.27,w:3.65,h:0.25,fontSize:9.5,color:WHITE,fontFace:"Calibri",margin:0}));

  card(s,5.95,4.72,3.8,0.62,{border:TEAL,fill:DGRAY});
  s.addText("Monro-Kellie: Brain + Blood + CSF = Constant\nCSF most easily displaced of the three",{x:6.05,y:4.76,w:3.65,h:0.54,fontSize:9,color:WHITE,fontFace:"Calibri",margin:0});
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 4 — FORMATION
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s); topBar(s); sideBar(s);
  slideTitle(s,"FORMATION OF CSF");

  // Left — mechanism steps
  card(s,0.2,0.78,4.6,4.6,{border:TEAL});
  s.addText("MECHANISM (2 PHASES)",{x:0.3,y:0.82,w:4.4,h:0.3,fontSize:11,bold:true,color:TEAL,fontFace:"Calibri",margin:0});

  const phases=[
    {n:"1",title:"Hydrostatic Efflux",col:TEAL,pts:[
      "Fluid moves from choroidal capillaries",
      "Into perivascular space",
      "Driven by hydrostatic pressure gradient",
    ]},
    {n:"2",title:"Active Secretion (Primary)",col:GREEN,pts:[
      "Choroid plexus epithelial cells",
      "Secrete: Na+, Cl-, HCO3-, water into CSF",
      "Reabsorb: K+ from CSF into blood",
      "Proteins, cholesterol EXCLUDED (size)",
      "Similar to renal distal tubule cells",
    ]},
  ];
  let py=1.18;
  phases.forEach(ph=>{
    s.addShape(pres.shapes.RECTANGLE,{x:0.28,y:py,w:0.42,h:0.42,fill:{color:ph.col},line:{color:ph.col}});
    s.addText(ph.n,{x:0.28,y:py,w:0.42,h:0.42,fontSize:14,bold:true,color:BG,fontFace:"Calibri",align:"center",valign:"middle",margin:0});
    s.addText(ph.title,{x:0.8,y:py,w:3.9,h:0.42,fontSize:12,bold:true,color:ph.col,fontFace:"Calibri",valign:"middle",margin:0});
    py+=0.46;
    ph.pts.forEach(p=>{
      s.addText([{text:"• ",options:{color:ph.col,bold:true}},{text:p,options:{color:WHITE}}],
        {x:0.82,y:py,w:3.88,h:0.28,fontSize:10.5,fontFace:"Calibri",margin:0});
      py+=0.3;
    });
    py+=0.12;
  });

  // Choroid plexus barrier box
  py+=0.05;
  s.addShape(pres.shapes.RECTANGLE,{x:0.28,y:py,w:4.42,h:0.95,fill:{color:CARD2},line:{color:AMB,pt:0.8}});
  s.addText("CHOROID PLEXUS BARRIER (3 layers):",{x:0.35,y:py+0.05,w:4.3,h:0.25,fontSize:9.5,bold:true,color:AMB,fontFace:"Calibri",margin:0});
  s.addText("1. Capillary endothelial cells + basement membrane\n2. Neuroglial membrane\n3. Choroid plexus epithelial cells (TIGHT JUNCTIONS)",{x:0.35,y:py+0.3,w:4.3,h:0.6,fontSize:9,color:WHITE,fontFace:"Calibri",margin:0});

  // Right — rate + circadian
  card(s,5.05,0.78,4.7,2.18,{border:GREEN});
  s.addText("RATE & VOLUME",{x:5.15,y:0.82,w:4.5,h:0.3,fontSize:11,bold:true,color:GREEN,fontFace:"Calibri",margin:0});
  const rv=[
    ["Rate of formation","0.35 mL/min (21 mL/hr)"],
    ["Daily production","450–500 mL/day"],
    ["Total CSF volume","~150 mL"],
    ["Turnover","3–4× daily"],
  ];
  rv.forEach(([k,v],i)=>{
    const rb=i%2===0?CARD2:DGRAY;
    s.addShape(pres.shapes.RECTANGLE,{x:5.1,y:1.2+i*0.38,w:4.6,h:0.37,fill:{color:rb},line:{color:MGRAY,pt:0.4}});
    s.addText(k,{x:5.18,y:1.2+i*0.38,w:2.5,h:0.37,fontSize:10.5,bold:true,color:LGRAY,fontFace:"Calibri",valign:"middle",margin:0});
    s.addText(v,{x:7.7,y:1.2+i*0.38,w:2.0,h:0.37,fontSize:10.5,color:GREEN,fontFace:"Calibri",valign:"middle",bold:true,margin:0});
  });

  card(s,5.05,3.1,4.7,1.12,{border:PURP});
  s.addText("CIRCADIAN RHYTHM",{x:5.15,y:3.14,w:4.5,h:0.28,fontSize:11,bold:true,color:PURP,fontFace:"Calibri",margin:0});
  s.addText("▸  Peak CSF production during SLEEP\n▸  Glymphatic clearance also peaks during sleep\n▸  General anaesthesia mimics sleep state → ↑ glymphatic transport",
    {x:5.15,y:3.46,w:4.52,h:0.7,fontSize:9.8,color:WHITE,fontFace:"Calibri",margin:0});

  card(s,5.05,4.35,4.7,1.0,{border:AMB});
  s.addText("BLOOD-BRAIN BARRIER (for comparison):",{x:5.15,y:4.39,w:4.5,h:0.26,fontSize:10,bold:true,color:AMB,fontFace:"Calibri",margin:0});
  s.addText("Tight junctions between endothelial cells\nOnly LIPID-SOLUBLE substances cross freely (O2, CO2)\nWater-soluble substances excluded",
    {x:5.15,y:4.67,w:4.52,h:0.62,fontSize:9.5,color:LGRAY,fontFace:"Calibri",margin:0});
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 5 — CSF COMPOSITION + CIRCULATION
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s); topBar(s); sideBar(s);
  slideTitle(s,"CSF COMPOSITION & CIRCULATION");

  // Composition table
  card(s,0.2,0.78,4.55,4.6,{border:TEAL});
  s.addText("COMPOSITION vs PLASMA",{x:0.3,y:0.82,w:4.35,h:0.28,fontSize:11,bold:true,color:TEAL,fontFace:"Calibri",margin:0});

  const hdr=["Component","[CSF] vs Plasma","Value"];
  const hw=[1.5,1.5,1.35];
  let ty=1.16;
  // header
  s.addShape(pres.shapes.RECTANGLE,{x:0.28,y:ty,w:4.38,h:0.3,fill:{color:MGRAY},line:{color:BG,pt:0.5}});
  let cx=0.28; hdr.forEach((h,i)=>{s.addText(h,{x:cx+2,y:ty,w:hw[i],h:0.3,fontSize:9,bold:true,color:BG,fontFace:"Calibri",align:"center",valign:"middle",margin:0});cx+=hw[i];});

  const rows=[
    ["Na+","= Plasma","~140 mEq/L",LGRAY],
    ["Cl-","= Plasma","~120 mEq/L",LGRAY],
    ["HCO3-","= Plasma","~25 mEq/L",LGRAY],
    ["Osmolarity","= Plasma","~295 mOsm",LGRAY],
    ["K+","< Plasma","2.8–3.2 mEq/L",TEAL],
    ["Ca2+","< Plasma","~1.1 mmol/L",TEAL],
    ["Glucose","< Plasma","60–80% plasma",TEAL],
    ["Protein","NEGLIGIBLE","15–45 mg/dL",GREEN],
    ["Cholesterol","NEGLIGIBLE","Trace",GREEN],
    ["Mg2+","> Plasma","~1.2 mmol/L",AMB],
    ["pH","Slightly <","7.32–7.34",AMB],
    ["Pressure","Normal","5–15 mmHg",AMB],
  ];
  rows.forEach((r,i)=>{
    ty+=0.31;
    const rb=i%2===0?CARD2:DGRAY;
    s.addShape(pres.shapes.RECTANGLE,{x:0.28,y:ty,w:4.38,h:0.3,fill:{color:rb},line:{color:MGRAY,pt:0.3}});
    cx=0.28;
    [r[0],r[1],r[2]].forEach((v,j)=>{
      s.addText(v,{x:cx+2,y:ty,w:hw[j],h:0.3,fontSize:9,color:r[3],fontFace:"Calibri",align:"center",valign:"middle",margin:0,bold:j===1});
      cx+=hw[j];
    });
  });

  // Circulation pathway
  card(s,4.98,0.78,4.78,4.6,{border:GREEN});
  s.addText("CIRCULATION PATHWAY",{x:5.08,y:0.82,w:4.58,h:0.28,fontSize:11,bold:true,color:GREEN,fontFace:"Calibri",margin:0});

  const path=[
    {t:"Choroid Plexus (Lateral Ventricles)",c:TEAL},
    {t:"Foramen of Monro",c:MGRAY,arrow:true},
    {t:"Third Ventricle",c:TEAL},
    {t:"Cerebral Aqueduct (of Sylvius)",c:MGRAY,arrow:true},
    {t:"Fourth Ventricle",c:TEAL},
    {t:"Foramina of Luschka (×2) + Magendie (×1)",c:AMB,arrow:true},
    {t:"Subarachnoid Space",c:GREEN},
    {t:"Bulk flow upward over convexities",c:MGRAY,arrow:true},
    {t:"Arachnoid Granulations",c:PURP},
    {t:"Superior Sagittal Sinus → Venous Blood",c:RED,arrow:true},
  ];
  let py=1.18;
  path.forEach(p=>{
    const isArrow=p.arrow;
    if(!isArrow){
      s.addShape(pres.shapes.RECTANGLE,{x:5.08,y:py,w:4.55,h:0.32,fill:{color:p.c,transparency:20},line:{color:p.c,pt:0.6}});
      s.addText(p.t,{x:5.12,y:py,w:4.5,h:0.32,fontSize:9.8,bold:true,color:BG,fontFace:"Calibri",valign:"middle",margin:0});
      py+=0.34;
    } else {
      s.addText("▼  "+p.t,{x:5.3,y:py,w:4.3,h:0.2,fontSize:8.5,color:LGRAY,fontFace:"Calibri",italic:true,margin:0});
      py+=0.22;
    }
  });

  // Additional drainage
  py+=0.05;
  s.addShape(pres.shapes.RECTANGLE,{x:5.08,y:py,w:4.55,h:0.65,fill:{color:CARD2},line:{color:LGRAY,pt:0.5}});
  s.addText("Minor drainage routes:",{x:5.14,y:py+0.04,w:4.4,h:0.2,fontSize:9,bold:true,color:LGRAY,fontFace:"Calibri",margin:0});
  s.addText("Cranial/spinal nerve sheaths  ·  Perivenous routes  ·  Nasal mucosa (via cribriform plate)  ·  Meningeal lymphatics",
    {x:5.14,y:py+0.26,w:4.4,h:0.35,fontSize:8.8,color:LGRAY,fontFace:"Calibri",margin:0});
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 6 — MONRO-KELLIE & ICP
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s); topBar(s); sideBar(s);
  slideTitle(s,"MONRO-KELLIE DOCTRINE & ICP");

  // Monro-Kellie box
  card(s,0.2,0.78,9.6,1.28,{border:AMB,fill:CARD2});
  s.addText("MONRO-KELLIE DOCTRINE",{x:0.3,y:0.82,w:4.5,h:0.3,fontSize:13,bold:true,color:AMB,fontFace:"Calibri",margin:0});
  s.addText("The cranial vault is a RIGID CLOSED BOX. Total intracranial volume is constant.\nAn increase in one component must be compensated by a decrease in another.",
    {x:0.3,y:1.14,w:9.4,h:0.4,fontSize:11,color:WHITE,fontFace:"Calibri",margin:0});

  // 3 components
  const comps=[
    {n:"Brain Parenchyma",pct:"~80%",col:TEAL,note:"Least compressible"},
    {n:"Blood (CBV)",pct:"~12%",col:AMB,note:"Can be reduced by hyperventilation"},
    {n:"CSF",pct:"~8%  (~100 mL)",col:GREEN,note:"MOST easily displaced → to spinal canal"},
  ];
  comps.forEach((c,i)=>{
    const cx=0.2+i*3.25;
    card(s,cx,2.18,3.1,1.35,{border:c.col});
    s.addShape(pres.shapes.RECTANGLE,{x:cx,y:2.18,w:3.1,h:0.08,fill:{color:c.col},line:{color:c.col}});
    s.addText(c.n,{x:cx+0.1,y:2.3,w:2.9,h:0.32,fontSize:12,bold:true,color:c.col,fontFace:"Calibri",margin:0});
    s.addText(c.pct,{x:cx+0.1,y:2.64,w:2.9,h:0.38,fontSize:22,bold:true,color:WHITE,fontFace:"Calibri",margin:0});
    s.addText(c.note,{x:cx+0.1,y:3.05,w:2.9,h:0.42,fontSize:9.5,color:LGRAY,fontFace:"Calibri",margin:0});
  });

  // CPP + compensation
  card(s,0.2,3.68,4.65,1.78,{border:TEAL});
  s.addText("CPP = MAP − ICP",{x:0.3,y:3.72,w:4.45,h:0.38,fontSize:18,bold:true,color:TEAL,fontFace:"Calibri",margin:0});
  s.addText("(or MAP − CVP, whichever is higher)",{x:0.3,y:4.12,w:4.45,h:0.25,fontSize:9.5,color:LGRAY,fontFace:"Calibri",italic:true,margin:0});
  const cpptargets=[
    "Normal CPP: 60–80 mmHg",
    "TBI target: CPP ≥ 70 mmHg",
    "Normal MAP: 80–100 mmHg",
    "Normal ICP: 5–15 mmHg",
  ];
  cpptargets.forEach((t,i)=>s.addText("▸ "+t,{x:0.3,y:4.4+i*0.24,w:4.45,h:0.22,fontSize:10,color:WHITE,fontFace:"Calibri",margin:0}));

  // Compensation
  card(s,5.08,3.68,4.72,1.78,{border:AMB});
  s.addText("COMPENSATORY MECHANISMS",{x:5.18,y:3.72,w:4.52,h:0.3,fontSize:11,bold:true,color:AMB,fontFace:"Calibri",margin:0});
  const comp=[
    ["1st","Displacement of CSF to spinal canal","(most readily)"],
    ["2nd","Reduction in cerebral venous blood volume",""],
    ["3rd","↓ CSF production",""],
    ["4th","DECOMPENSATION — exponential ICP rise","once exhausted"],
  ];
  comp.forEach(([n,text,sub],i)=>{
    s.addShape(pres.shapes.RECTANGLE,{x:5.18,y:4.08+i*0.36,w:0.35,h:0.28,fill:{color:AMB},line:{color:AMB}});
    s.addText(n,{x:5.18,y:4.08+i*0.36,w:0.35,h:0.28,fontSize:8,bold:true,color:BG,fontFace:"Calibri",align:"center",valign:"middle",margin:0});
    s.addText(text,{x:5.6,y:4.08+i*0.36,w:4.12,h:0.19,fontSize:10,color:i===3?RED:WHITE,fontFace:"Calibri",bold:i===3,margin:0});
    if(sub) s.addText(sub,{x:5.6,y:4.27+i*0.36,w:4.12,h:0.16,fontSize:8.5,color:LGRAY,fontFace:"Calibri",italic:true,margin:0});
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 7 — ANAESTHETIC EFFECTS ON ICP/CSF
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s); topBar(s); sideBar(s);
  slideTitle(s,"ANAESTHETIC EFFECTS ON ICP & CSF");

  // Table
  const th=["Agent","ICP Effect","CBF","CMRO2","Notes"];
  const tw=[1.4,0.9,0.7,0.8,5.05];
  const thcol=[MGRAY,TEAL,TEAL,TEAL,MGRAY];

  let tx=0.2;
  th.forEach((h,i)=>{
    s.addShape(pres.shapes.RECTANGLE,{x:tx,y:0.78,w:tw[i],h:0.32,fill:{color:thcol[i]},line:{color:BG,pt:0.5}});
    s.addText(h,{x:tx,y:0.78,w:tw[i],h:0.32,fontSize:9.5,bold:true,color:BG,fontFace:"Calibri",align:"center",valign:"middle",margin:0});
    tx+=tw[i];
  });

  const rows=[
    ["Propofol","↓↓","↓","↓","Gold standard for neuro-TIVA; preferred for raised ICP",TEAL],
    ["Thiopental","↓↓","↓","↓","Burst suppression reduces CMRO2/CBF maximally",TEAL],
    ["Ketamine","↑↑","↑","↑","AVOID in raised ICP (unless controlled ventilation + propofol)",RED],
    ["Etomidate","↓","↓","↓","Preserves BP; but adrenal suppression limits use",GREEN],
    ["Midazolam/BZDs","↓ mild","↓","↓","Limited effect; useful premedication",LGRAY],
    ["Isoflurane >1MAC","↑ mild","↑","↓","Blunted by hyperventilation or barbiturates",AMB],
    ["Sevoflurane ≤1MAC","Minimal","—","↓","Preserves autoregulation best among volatiles",GREEN],
    ["Desflurane","↑ (most)","↑↑","↓","Airway irritation → ↑HR/MAP; greatest ICP rise",RED],
    ["N2O","↑","↑","↑","AVOID in neurosurgery; increases CMR and CBF",RED],
    ["Dexmedetomidine","↓ mild","↓","↓","Sleep-like state; best preserves glymphatic transport",PURP],
  ];
  rows.forEach((r,i)=>{
    const ry=1.12+i*0.44;
    const rb=i%2===0?CARD:CARD2;
    tx=0.2;
    tw.forEach((w,j)=>{
      s.addShape(pres.shapes.RECTANGLE,{x:tx,y:ry,w:w,h:0.42,fill:{color:rb},line:{color:MGRAY,pt:0.3}});
      const cc=j===0?WHITE:j<=3?r[5]:LGRAY;
      const isBold=j===0||j<=3;
      s.addText(r[j],{x:tx+2,y:ry,w:w-2,h:0.42,fontSize:j===4?8.8:9.5,color:cc,fontFace:"Calibri",
        valign:"middle",align:j===4?"left":"center",margin:0,bold:isBold&&j<=3});
      tx+=w;
    });
  });

  // CO2 note
  card(s,0.2,5.12,9.6,0.42,{border:TEAL,fill:CARD2});
  s.addText([
    {text:"PaCO2 KEY: ",options:{color:TEAL,bold:true}},
    {text:"Each 1 mmHg ↓ PaCO2 = ↓ CBF ~3%  |  Target: PaCO2 35 mmHg (routine), 30-35 mmHg (ICP crisis)  |  ",options:{color:WHITE}},
    {text:"Never <30 mmHg ",options:{color:RED,bold:true}},
    {text:"(cerebral ischaemia)",options:{color:LGRAY}},
  ],{x:0.3,y:5.16,w:9.4,h:0.34,fontSize:9.5,fontFace:"Calibri",valign:"middle",margin:0});
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 8 — SPINAL & EPIDURAL ANAESTHESIA
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s); topBar(s); sideBar(s);
  slideTitle(s,"SPINAL & EPIDURAL ANAESTHESIA — CSF RELEVANCE");

  // Baricity card
  card(s,0.2,0.78,5.35,2.75,{border:TEAL});
  s.addText("BARICITY & SPREAD OF SPINAL BLOCK",{x:0.3,y:0.82,w:5.15,h:0.28,fontSize:11,bold:true,color:TEAL,fontFace:"Calibri",margin:0});
  const bar=[
    {t:"HYPERBARIC (Heavy)",c:TEAL,b:["Density > CSF (glucose added)","Sinks with gravity","Most controllable spread","Hyperbaric 0.5% bupivacaine + 8% glucose","Position patient to desired level after injection"]},
    {t:"ISOBARIC",c:GREEN,b:["Density = CSF","Minimal positional spread","More predictable block level"]},
    {t:"HYPOBARIC (Light)",c:AMB,b:["Density < CSF","Rises against gravity","Hip arthroplasty in lateral tilt"]},
  ];
  let by=1.15;
  bar.forEach(b=>{
    s.addShape(pres.shapes.RECTANGLE,{x:0.28,y:by,w:5.15,h:0.24,fill:{color:b.c,transparency:20},line:{color:b.c,pt:0.5}});
    s.addText(b.t,{x:0.32,y:by,w:5.1,h:0.24,fontSize:9.5,bold:true,color:BG,fontFace:"Calibri",valign:"middle",margin:0});
    by+=0.26;
    b.b.forEach(pt=>{
      s.addText("• "+pt,{x:0.35,y:by,w:5.08,h:0.22,fontSize:8.8,color:WHITE,fontFace:"Calibri",margin:0});
      by+=0.23;
    });
    by+=0.06;
  });

  // CSF volume factors
  card(s,5.78,0.78,4.0,2.75,{border:AMB});
  s.addText("FACTORS AFFECTING BLOCK LEVEL",{x:5.88,y:0.82,w:3.8,h:0.28,fontSize:11,bold:true,color:AMB,fontFace:"Calibri",margin:0});
  const fac=[
    ["Baricity","Most important factor"],
    ["Dose","Volume × concentration"],
    ["Patient position","At & immediately after injection"],
    ["Level of injection","L3-4 vs L4-5"],
    ["Speed of injection","Fast → wider spread"],
    ["CSF volume","↓ in pregnancy/obesity/elderly\n→ high block risk"],
  ];
  fac.forEach(([k,v],i)=>{
    const fy=1.16+i*0.38;
    s.addShape(pres.shapes.RECTANGLE,{x:5.88,y:fy,w:3.8,h:0.36,fill:{color:i%2===0?CARD2:DGRAY},line:{color:MGRAY,pt:0.3}});
    s.addText(k,{x:5.95,y:fy,w:1.6,h:0.36,fontSize:9.5,bold:true,color:AMB,fontFace:"Calibri",valign:"middle",margin:0});
    s.addText(v,{x:7.55,y:fy,w:2.15,h:0.36,fontSize:9,color:WHITE,fontFace:"Calibri",valign:"middle",margin:0});
  });

  // PDPH
  card(s,0.2,3.65,5.35,1.82,{border:RED});
  s.addText("POST-DURAL PUNCTURE HEADACHE (PDPH)",{x:0.3,y:3.69,w:5.15,h:0.28,fontSize:11,bold:true,color:RED,fontFace:"Calibri",margin:0});
  const pdph=[
    ["Mechanism","CSF leaks through dura → ↓ CSF pressure → traction on pain-sensitive structures"],
    ["Character","Positional: worse sitting/standing, relieved lying flat; bilateral frontal/occipital"],
    ["Prevention","Small-gauge PENCIL-POINT needles (Whitacre, Sprotte); avoid multiple punctures"],
    ["Treatment","Hydration + caffeine; EPIDURAL BLOOD PATCH (gold standard, 85-90% success)"],
  ];
  pdph.forEach(([k,v],i)=>{
    s.addText(k+":",{x:0.3,y:4.0+i*0.37,w:1.2,h:0.34,fontSize:9,bold:true,color:RED,fontFace:"Calibri",margin:0});
    s.addText(v,{x:1.55,y:4.0+i*0.37,w:3.95,h:0.34,fontSize:9,color:WHITE,fontFace:"Calibri",margin:0});
  });

  // Intrathecal opioids
  card(s,5.78,3.65,4.0,1.82,{border:PURP});
  s.addText("INTRATHECAL OPIOIDS",{x:5.88,y:3.69,w:3.8,h:0.28,fontSize:11,bold:true,color:PURP,fontFace:"Calibri",margin:0});
  const ito=[
    {t:"LIPOPHILIC (Fentanyl, Sufentanil)",c:TEAL,pts:["Rapid cord uptake → segmental","Minimal rostral CSF spread","Shorter duration"]},
    {t:"HYDROPHILIC (Morphine)",c:PURP,pts:["Slow uptake → rostral spread in CSF","Prolonged analgesia 12-24h","DELAYED RESP. DEPRESSION up to 24h","24h respiratory monitoring required"]},
  ];
  let oy=4.02;
  ito.forEach(o=>{
    s.addShape(pres.shapes.RECTANGLE,{x:5.88,y:oy,w:3.8,h:0.22,fill:{color:o.c,transparency:25},line:{color:o.c,pt:0.4}});
    s.addText(o.t,{x:5.92,y:oy,w:3.76,h:0.22,fontSize:8.5,bold:true,color:BG,fontFace:"Calibri",valign:"middle",margin:0});
    oy+=0.24;
    o.pts.forEach(p=>{
      s.addText("• "+p,{x:5.92,y:oy,w:3.76,h:0.22,fontSize:8.5,color:WHITE,fontFace:"Calibri",margin:0});
      oy+=0.22;
    });
    oy+=0.06;
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 9 — ICP MANAGEMENT
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s); topBar(s); sideBar(s);
  slideTitle(s,"ICP MANAGEMENT — ANAESTHETIC STRATEGIES");

  // Goal box
  card(s,0.2,0.78,9.6,0.6,{border:TEAL,fill:CARD2});
  s.addText([
    {text:"GOALS: ",options:{color:TEAL,bold:true}},
    {text:"(1) Maintain CPP ≥ 60-70 mmHg  |  ",options:{color:WHITE}},
    {text:"(2) Reduce ICP by ↓ CBV + ↓ CSF volume + ↓ brain water  |  ",options:{color:WHITE}},
    {text:"(3) Avoid hypoxia, hypercarbia, hypotension",options:{color:AMB,bold:true}},
  ],{x:0.3,y:0.86,w:9.4,h:0.44,fontSize:10.5,fontFace:"Calibri",valign:"middle",margin:0});

  // 3 columns
  const cols3=[
    {title:"VENTILATION & POSITIONING",col:TEAL,items:[
      ["Head-up 30°","↓ ICP, ↑ venous drainage (standard)"],
      ["Normocapnia (35mmHg)","Routine target; avoid hypercarbia"],
      ["Acute hypervent.","PaCO2 30-35 → ICP crisis only"],
      ["No <30 mmHg","↓ CBF → ischaemia risk"],
      ["Avoid head rotation","Can ↑ IJV pressure → ↑ ICP"],
      ["Avoid PEEP excess","↑ intrathoracic P → ↓ venous drainage"],
    ]},
    {title:"PHARMACOLOGICAL",col:AMB,items:[
      ["Mannitol 0.25-1g/kg","Osmotic; ↓ brain water acutely"],
      ["3-23.4% NaCl","Hypertonic saline; sustained effect"],
      ["Acetazolamide","↓ CSF production (CA inhibitor) ~50%"],
      ["Furosemide","Adjunct; ↓ choroid Cl- transport"],
      ["Dexamethasone","Vasogenic oedema (tumours only)"],
      ["Barbiturate coma","Refractory ICP — burst suppression"],
    ]},
    {title:"SURGICAL / CSF DRAINAGE",col:GREEN,items:[
      ["EVD (External Ventricular Drain)","Lateral ventricle catheter"],
      ["CSF drainage","Reduces ICP rapidly + directly"],
      ["Lumbar CSF drain","For spinal/posterior fossa surgery"],
      ["Caution","Rapid drainage → herniation risk"],
      ["ICP monitoring","Target ICP <20 mmHg"],
      ["Decompressive craniotomy","Last resort; refractory ICP"],
    ]},
  ];
  cols3.forEach((col,ci)=>{
    const cx=0.2+ci*3.28;
    card(s,cx,1.5,3.15,3.98,{border:col.col});
    s.addShape(pres.shapes.RECTANGLE,{x:cx,y:1.5,w:3.15,h:0.08,fill:{color:col.col},line:{color:col.col}});
    s.addText(col.title,{x:cx+0.08,y:1.62,w:3.0,h:0.28,fontSize:10,bold:true,color:col.col,fontFace:"Calibri",margin:0});
    col.items.forEach(([k,v],i)=>{
      const iy=1.95+i*0.54;
      s.addShape(pres.shapes.RECTANGLE,{x:cx+0.08,y:iy,w:3.0,h:0.52,fill:{color:i%2===0?CARD2:DGRAY},line:{color:MGRAY,pt:0.3}});
      s.addText(k,{x:cx+0.12,y:iy+0.02,w:2.92,h:0.24,fontSize:9.5,bold:true,color:WHITE,fontFace:"Calibri",margin:0});
      s.addText(v,{x:cx+0.12,y:iy+0.27,w:2.92,h:0.22,fontSize:8.8,color:LGRAY,fontFace:"Calibri",margin:0});
    });
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 10 — GLYMPHATIC SYSTEM
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s); topBar(s,PURP); sideBar(s,PURP);
  slideTitle(s,"THE GLYMPHATIC SYSTEM — ANAESTHETIC RELEVANCE",PURP);

  card(s,0.2,0.78,9.6,1.0,{border:PURP,fill:CARD2});
  s.addText("A recently understood brain waste-clearance system (analogous to lymphatics in systemic circulation). The brain lacks traditional lymphatics except in the meninges.",
    {x:0.3,y:0.85,w:9.4,h:0.85,fontSize:11.5,color:WHITE,fontFace:"Calibri",margin:0});

  // Mechanism steps
  card(s,0.2,1.9,4.7,2.55,{border:PURP});
  s.addText("MECHANISM",{x:0.3,y:1.94,w:4.5,h:0.28,fontSize:11,bold:true,color:PURP,fontFace:"Calibri",margin:0});
  const gsteps=[
    {n:"1",t:"CSF enters PERIARTERIAL SPACES",d:"Bounded by vessel walls + astrocyte end-feet"},
    {n:"2",t:"AQUAPORIN-4 channels (AQP4)",d:"On astrocyte end-feet facilitate water exchange"},
    {n:"3",t:"Convection bulk flow",d:"CSF transported to brain parenchyma"},
    {n:"4",t:"Perivenous space accumulation",d:"Waste products (Aβ, tau, metabolites)"},
    {n:"5",t:"Drainage",d:"Meningeal lymphatics + cervical lymph nodes + cranial nerves"},
  ];
  gsteps.forEach((g,i)=>{
    const gy=2.28+i*0.44;
    chipText(s,0.28,gy,0.35,0.35,g.n,PURP,WHITE);
    s.addText(g.t,{x:0.72,y:gy,w:4.1,h:0.2,fontSize:10,bold:true,color:WHITE,fontFace:"Calibri",margin:0});
    s.addText(g.d,{x:0.72,y:gy+0.2,w:4.1,h:0.2,fontSize:9,color:LGRAY,fontFace:"Calibri",margin:0});
  });

  // Anaesthetic relevance
  card(s,5.12,1.9,4.68,2.55,{border:PURP});
  s.addText("ANAESTHETIC RELEVANCE",{x:5.22,y:1.94,w:4.48,h:0.28,fontSize:11,bold:true,color:PURP,fontFace:"Calibri",margin:0});
  const grel=[
    [TEAL,"↑ during GA","Periarterial space enlarges during general anaesthesia (like sleep) → ↑ waste clearance"],
    [AMB,"Volatile agents","REDUCE glymphatic transport → relative impairment of waste clearance"],
    [GREEN,"Dexmedetomidine","Produces NREM sleep-like state → BEST preserves glymphatic transport"],
    [RED,"POCD link","Impaired clearance of Aβ/tau may underlie post-op cognitive decline"],
    [PURP,"Sleep","Peak glymphatic function during natural sleep"],
  ];
  grel.forEach((r,i)=>{
    const gy=2.28+i*0.44;
    s.addShape(pres.shapes.OVAL,{x:5.22,y:gy+0.04,w:0.3,h:0.3,fill:{color:r[0]},line:{color:r[0]}});
    s.addText(r[1],{x:5.6,y:gy,w:1.4,h:0.22,fontSize:9.5,bold:true,color:r[0],fontFace:"Calibri",margin:0});
    s.addText(r[2],{x:5.6,y:gy+0.22,w:4.1,h:0.2,fontSize:8.8,color:WHITE,fontFace:"Calibri",margin:0});
  });

  // Key message
  card(s,0.2,4.58,9.6,0.88,{border:PURP,fill:CARD2});
  s.addText("CLINICAL TAKEAWAY:",{x:0.3,y:4.62,w:2.2,h:0.28,fontSize:10,bold:true,color:PURP,fontFace:"Calibri",margin:0});
  s.addText("The choice of anaesthetic agent may affect long-term cognitive outcomes via glymphatic modulation. Dexmedetomidine (sleep-like NREM state) preserves glymphatic function better than volatile agents. This is an active area of research in POCD prevention.",
    {x:0.3,y:4.92,w:9.4,h:0.5,fontSize:10,color:WHITE,fontFace:"Calibri",margin:0});
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 11 — VIVA SUMMARY
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBg(s); topBar(s,AMB); sideBar(s,AMB);
  slideTitle(s,"VIVA SUMMARY — KEY NUMBERS & FACTS",AMB);

  const vivaData=[
    {cat:"PRODUCTION",col:TEAL,items:[
      ["Rate","0.35 mL/min = 21 mL/hr = 450-500 mL/day"],
      ["Total volume","~150 mL (intracranial 100 mL + spinal 50 mL)"],
      ["Turnover","3-4× per day"],
      ["Peak production","During sleep (circadian rhythm)"],
    ]},
    {cat:"ANATOMY",col:GREEN,items:[
      ["4th ventricle exits","Luschka ×2 (lateral) + Magendie ×1 (median)"],
      ["Absorption site","Arachnoid granulations → superior sagittal sinus"],
      ["Conus medullaris","L1-2 in adults"],
      ["LP level","L3-4 or L4-5"],
    ]},
    {cat:"PRESSURES",col:AMB,items:[
      ["Normal ICP","5-15 mmHg (70-180 mmH2O)"],
      ["CPP formula","MAP - ICP (target ≥60-70 mmHg)"],
      ["CSF specific gravity","1.003-1.008 at 37°C"],
      ["Opening pressure (LP)","70-180 mmH2O lateral decubitus"],
    ]},
    {cat:"DRUGS & ICP",col:RED,items:[
      ["Best for raised ICP","Propofol or thiopental (↓ CMRO2/CBF)"],
      ["Avoid in raised ICP","Ketamine, N2O (↑ CBF + CMRO2)"],
      ["Best volatile","Sevoflurane ≤1 MAC"],
      ["↓ CSF production","Acetazolamide (↓ ~50% via CA inhibition)"],
    ]},
    {cat:"SPINAL / PDPH",col:PURP,items:[
      ["Hyperbaric","Sinks; position controls level"],
      ["PDPH mechanism","CSF leak → ↓ pressure → traction"],
      ["PDPH treatment","Epidural blood patch (85-90%)"],
      ["Intrathecal morphine","Delayed resp. depression up to 24h"],
    ]},
    {cat:"GLYMPHATIC",col:TEAL,items:[
      ["During GA","Periarterial space enlarges → ↑ clearance"],
      ["Volatiles","Reduce glymphatic transport"],
      ["Dexmedetomidine","Best preserves glymphatic function"],
      ["Relevance","POCD; amyloid-β/tau clearance"],
    ]},
  ];
  const cols2=[vivaData.slice(0,3),vivaData.slice(3)];
  cols2.forEach((col,ci)=>{
    col.forEach((grp,gi)=>{
      const cx=0.2+ci*5.0;
      const cy=0.78+gi*1.55;
      card(s,cx,cy,4.7,1.5,{border:grp.col});
      s.addShape(pres.shapes.RECTANGLE,{x:cx,y:cy,w:4.7,h:0.08,fill:{color:grp.col},line:{color:grp.col}});
      s.addText(grp.cat,{x:cx+0.08,y:cy+0.1,w:4.54,h:0.26,fontSize:10,bold:true,color:grp.col,fontFace:"Calibri",margin:0});
      grp.items.forEach(([k,v],i)=>{
        const iy=cy+0.4+i*0.26;
        s.addText(k+":",{x:cx+0.08,y:iy,w:1.55,h:0.24,fontSize:9,bold:true,color:LGRAY,fontFace:"Calibri",margin:0});
        s.addText(v,{x:cx+1.68,y:iy,w:2.94,h:0.24,fontSize:9,color:WHITE,fontFace:"Calibri",margin:0});
      });
    });
  });
}

pres.writeFile({fileName:"/home/daytona/workspace/csf-anaesthesia/CSF_Anaesthesia.pptx"})
  .then(()=>console.log("PPTX done"))
  .catch(e=>{console.error(e);process.exit(1);});
Writing File

~/csf-anaesthesia/cheatsheet.py

"""
CSF Formation, Circulation & Anaesthetic Importance
2-page A4 Quick Reference Cheat Sheet — ReportLab canvas
"""
from reportlab.lib.pagesizes import A4
from reportlab.pdfgen import canvas as rl_canvas
from reportlab.lib.colors import HexColor, white
from reportlab.lib.units import mm

W, H = A4
M = 9 * mm

# Palette
BG    = HexColor("#0A1628")
CARD  = HexColor("#112035")
CARD2 = HexColor("#162840")
DGRAY = HexColor("#1E3448")
MGRAY = HexColor("#4A6278")
LGRAY = HexColor("#8EAABF")
TEAL  = HexColor("#00BCD4")
GREEN = HexColor("#26A69A")
AMB   = HexColor("#FFA726")
RED   = HexColor("#EF5350")
PURP  = HexColor("#7E57C2")
GOLD  = HexColor("#FFD54F")
WHITE = white

def bg(cv): cv.setFillColor(BG); cv.rect(0,0,W,H,fill=1,stroke=0)

def fr(cv,x,y,w,h,fc,sc=None,lw=0.7):
    cv.setFillColor(fc)
    if sc:
        cv.setStrokeColor(sc); cv.setLineWidth(lw)
        cv.rect(x,y,w,h,fill=1,stroke=1)
    else:
        cv.rect(x,y,w,h,fill=1,stroke=0)

def rr(cv,x,y,w,h,r,fc,sc=None,lw=0.7):
    cv.setFillColor(fc)
    if sc:
        cv.setStrokeColor(sc); cv.setLineWidth(lw)
        cv.roundRect(x,y,w,h,r,fill=1,stroke=1)
    else:
        cv.roundRect(x,y,w,h,r,fill=1,stroke=0)

def t(cv,text,x,y,sz=7,col=WHITE,bold=False,align="left"):
    cv.setFillColor(col)
    cv.setFont("Helvetica-Bold" if bold else "Helvetica",sz)
    if align=="center": cv.drawCentredString(x,y,text)
    elif align=="right": cv.drawRightString(x,y,text)
    else: cv.drawString(x,y,text)

def hl(cv,x,y,w,col=MGRAY,lw=0.4):
    cv.setStrokeColor(col); cv.setLineWidth(lw); cv.line(x,y,x+w,y)

def card(cv,x,y,w,h,tc,sc=None):
    rr(cv,x,y,w,h,3,CARD,sc or tc,0.8)
    fr(cv,x,y+h-13,w,13,tc)

def sec(cv,x,y,w,h,label,tc,txtcol=None):
    fr(cv,x,y,w,h,tc)
    t(cv,label,x+4,y+h/2-3.5,sz=7.5,col=txtcol or BG,bold=True)

def hdr_row(cv,x,y,cols,widths,bg_col,txt_col=None):
    cx=x
    for c,w in zip(cols,widths):
        fr(cv,cx,y,w,12,bg_col)
        t(cv,c,cx+2,y+3,sz=6.5,col=txt_col or BG,bold=True); cx+=w

def data_row(cv,x,y,cols,widths,col_colors,row_bg):
    cx=x
    fr(cv,x,y,sum(widths),11,row_bg)
    for c,w,cc in zip(cols,widths,col_colors):
        t(cv,c,cx+2,y+2,sz=6.2,col=cc); cx+=w

# ══════════════════════════════════════════════════════════════════════════
# PAGE 1
# ══════════════════════════════════════════════════════════════════════════
cv=rl_canvas.Canvas("/home/daytona/workspace/csf-anaesthesia/CSF_CheatSheet.pdf",pagesize=A4)
bg(cv)
fr(cv,0,H-30,W,30,TEAL)
fr(cv,0,H-34,W,4,AMB)
t(cv,"CSF — FORMATION, CIRCULATION & ANAESTHETIC IMPORTANCE",W/2,H-21,sz=12,col=BG,bold=True,align="center")
t(cv,"MD Anaesthesia Quick Reference  |  Page 1 of 2",W/2,H-30,sz=6.5,col=DGRAY,align="center")

# ── Row 1: Anatomy + Formation (2 columns) ────────────────────────────────
R1Y=H-42
CH=195
CW=(W-2*M-5)/2

# COL 1: Anatomy
card(cv,M,R1Y-CH,CW,CH,TEAL)
t(cv,"ANATOMY OF CSF COMPARTMENTS",M+5,R1Y-5,sz=7.5,col=TEAL,bold=True)

pathway=[
    ("Lateral Ventricles (×2)","In cerebral hemispheres; choroid plexus",TEAL),
    ("Foramina of Monro","→ Third ventricle",MGRAY),
    ("Third Ventricle","Between thalami",TEAL),
    ("Cerebral Aqueduct of Sylvius","→ Fourth ventricle",MGRAY),
    ("Fourth Ventricle","Pons/medulla & cerebellum",TEAL),
    ("Luschka (×2) + Magendie (×1)","→ Subarachnoid space",AMB),
    ("Subarachnoid Space","Brain + spinal cord; cisterns",GREEN),
    ("Arachnoid Granulations","→ Superior sagittal sinus → venous blood",PURP),
]
py=R1Y-20
for name,desc,col in pathway:
    fr(cv,M+5,py-9,CW-10,10,CARD2)
    cv.setStrokeColor(col); cv.setLineWidth(1.5); cv.line(M+5,py-9,M+5,py+1)
    t(cv,name,M+10,py-5,sz=7,col=WHITE,bold=True)
    t(cv,desc,M+10,py-13,sz=6.2,col=LGRAY)
    py-=22

py-=3
fr(cv,M+5,py-22,CW-10,23,CARD2)
cv.setStrokeColor(GREEN); cv.setLineWidth(0.7); cv.rect(M+5,py-22,CW-10,23,stroke=1,fill=0)
t(cv,"SPINAL: LP at L3-4/L4-5 (conus at L1-2)  |  Dural sac ends S2",M+8,py-5,sz=6.5,col=GREEN,bold=True)
t(cv,"Total CSF: ~150 mL  |  Intracranial ~100 mL  |  Spinal ~50 mL",M+8,py-14,sz=6.3,col=WHITE)

# COL 2: Formation
X2=M+CW+5
card(cv,X2,R1Y-CH,CW,CH,GREEN)
t(cv,"FORMATION OF CSF",X2+5,R1Y-5,sz=7.5,col=GREEN,bold=True)

t(cv,"Site: Choroid plexus (lateral, 3rd, 4th ventricles)",X2+5,R1Y-20,sz=7,col=WHITE)
t(cv,"Rate: 0.35 mL/min = ~500 mL/day  |  Turnover: 3-4x/day",X2+5,R1Y-30,sz=7,col=TEAL,bold=True)

fr(cv,X2+5,R1Y-44,CW-10,12,CARD2)
cv.setStrokeColor(TEAL); cv.setLineWidth(0.5); cv.rect(X2+5,R1Y-44,CW-10,12,stroke=1,fill=0)
t(cv,"PHASE 1: Hydrostatic efflux — capillary → perivascular space",X2+8,R1Y-40,sz=6.8,col=TEAL,bold=True)

fr(cv,X2+5,R1Y-57,CW-10,12,CARD2)
cv.setStrokeColor(GREEN); cv.setLineWidth(0.5); cv.rect(X2+5,R1Y-57,CW-10,12,stroke=1,fill=0)
t(cv,"PHASE 2: Active secretion (primary mechanism)",X2+8,R1Y-53,sz=6.8,col=GREEN,bold=True)

secreted=[("SECRETED into CSF","Na+, Cl-, HCO3-, water",TEAL),
          ("REABSORBED from CSF","K+",AMB),
          ("EXCLUDED","Proteins, cholesterol (size)",RED)]
sy=R1Y-72
for lbl,val,col in secreted:
    fr(cv,X2+5,sy-8,CW-10,10,DGRAY)
    t(cv,lbl+":",X2+8,sy-4,sz=6.3,col=col,bold=True)
    t(cv,val,X2+80,sy-4,sz=6.3,col=WHITE)
    sy-=12

sy-=4
t(cv,"CHOROID PLEXUS BARRIER (3 layers):",X2+5,sy,sz=6.5,col=AMB,bold=True); sy-=10
for layer in ["1. Capillary endothelium + basement membrane",
              "2. Neuroglial membrane",
              "3. Choroid plexus epithelium (TIGHT JUNCTIONS)"]:
    t(cv,layer,X2+5,sy,sz=6.3,col=WHITE); sy-=10

sy-=4
fr(cv,X2+5,sy-20,CW-10,21,HexColor("#1a2e40"))
cv.setStrokeColor(PURP); cv.setLineWidth(0.7); cv.rect(X2+5,sy-20,CW-10,21,stroke=1,fill=0)
t(cv,"CIRCADIAN: Peak CSF production during SLEEP",X2+8,sy-4,sz=6.5,col=PURP,bold=True)
t(cv,"General anaesthesia mimics sleep → periarterial space enlarges",X2+8,sy-12,sz=6.2,col=WHITE)

sy-=27
t(cv,"BBB vs Choroid Plexus Barrier:",X2+5,sy,sz=6.5,col=GOLD,bold=True); sy-=10
t(cv,"BBB: tight junctions, lipid-soluble only (O2/CO2 cross freely)",X2+5,sy,sz=6.2,col=WHITE); sy-=9
t(cv,"Choroid plexus: active transport — selective secretion/reabsorption",X2+5,sy,sz=6.2,col=LGRAY)

# ── Row 2: Composition Table (left) + Monro-Kellie (right) ────────────────
R2Y=R1Y-CH-6
R2H=125

card(cv,M,R2Y-R2H,CW,R2H,TEAL)
t(cv,"CSF COMPOSITION",M+5,R2Y-5,sz=7.5,col=TEAL,bold=True)

hdr_row(cv,M+5,R2Y-18,[" Component","  CSF vs Plasma","  Value"],[70,70,73],MGRAY,col=LGRAY)
comp_rows=[
    ("Na+","= Plasma","~140 mEq/L",LGRAY,LGRAY,LGRAY),
    ("Cl-","= Plasma","~120 mEq/L",LGRAY,LGRAY,LGRAY),
    ("K+","< Plasma","2.8-3.2 mEq/L",TEAL,TEAL,TEAL),
    ("Glucose","< Plasma","60-80% plasma",TEAL,TEAL,TEAL),
    ("Protein","NEGLIGIBLE","15-45 mg/dL",GREEN,GREEN,GREEN),
    ("Mg2+","> Plasma","~1.2 mmol/L",AMB,AMB,AMB),
    ("pH","< plasma","7.32-7.34",AMB,AMB,AMB),
    ("Pressure","Normal","5-15 mmHg / 70-180 mmH2O",GOLD,GOLD,GOLD),
]
cy2=R2Y-30
for i,row in enumerate(comp_rows):
    bg2=CARD2 if i%2==0 else DGRAY
    data_row(cv,M+5,cy2,[row[0],row[1],row[2]],[70,70,73],[row[3],row[4],row[5]],bg2)
    cy2-=12

# Monro-Kellie right
card(cv,X2,R2Y-R2H,CW,R2H,AMB)
t(cv,"MONRO-KELLIE DOCTRINE",X2+5,R2Y-5,sz=7.5,col=AMB,bold=True)
t(cv,"Rigid closed box: Brain + Blood + CSF = CONSTANT volume",X2+5,R2Y-17,sz=7,col=WHITE,bold=True)

mk=[("Brain","~80%","Least compressible",TEAL),
    ("Blood (CBV)","~12%","Reduced by hyperventilation",AMB),
    ("CSF","~8% (~100mL)","MOST easily displaced",GREEN)]
mky=R2Y-30
for name,pct,note,col in mk:
    fr(cv,X2+5,mky-10,CW-10,11,CARD2)
    cv.setStrokeColor(col); cv.setLineWidth(2); cv.line(X2+5,mky-10,X2+5,mky+1)
    t(cv,name,X2+10,mky-6,sz=7,col=col,bold=True)
    t(cv,pct,X2+55,mky-6,sz=7,col=WHITE,bold=True)
    t(cv,note,X2+90,mky-6,sz=6.3,col=LGRAY)
    mky-=14

mky-=3
fr(cv,X2+5,mky-36,CW-10,37,HexColor("#1a2a00"))
cv.setStrokeColor(GREEN); cv.setLineWidth(0.7); cv.rect(X2+5,mky-36,CW-10,37,stroke=1,fill=0)
t(cv,"CPP = MAP - ICP",X2+8,mky-5,sz=10,col=TEAL,bold=True)
t(cv,"Target CPP: ≥60 mmHg (≥70 in TBI)",X2+8,mky-16,sz=6.8,col=GREEN,bold=True)
t(cv,"Normal MAP: 80-100  |  Normal ICP: 5-15 mmHg",X2+8,mky-26,sz=6.3,col=WHITE)

mky-=40
fr(cv,X2+5,mky-28,CW-10,29,CARD2)
t(cv,"COMPENSATION (in order):",X2+8,mky-4,sz=6.5,col=AMB,bold=True)
for i,s2 in enumerate(["1. CSF displaced to spinal canal","2. Venous blood volume reduced",
                       "3. CSF production reduced","4. DECOMPENSATION (exponential ICP rise)"]):
    t(cv,s2,X2+8,mky-15-i*7,sz=6.2,col=RED if i==3 else WHITE,bold=(i==3))

# ── Row 3: Anaesthetic effects on ICP (full width) ────────────────────────
R3Y=R2Y-R2H-6
R3H=130
card(cv,M,R3Y-R3H,W-2*M,R3H,TEAL)
t(cv,"ANAESTHETIC EFFECTS ON ICP/CSF",M+5,R3Y-5,sz=7.5,col=TEAL,bold=True)
t(cv,"CSF production/resorption modestly affected by volatiles — clinically FAR LESS important than effects on CBF (Barash 9e)",
  M+5,R3Y-17,sz=6.3,col=LGRAY,bold=False)

COLS=[80,62,50,50,165]
hdr2=["Agent","ICP Effect","CBF","CMRO2","Notes"]
hdr_row(cv,M+5,R3Y-30,hdr2,COLS,MGRAY,col=BG)

anesth_rows=[
    ("Propofol","DOWN DOWN","DOWN","DOWN","Gold standard neuro-TIVA; preferred for raised ICP",TEAL),
    ("Thiopental","DOWN DOWN","DOWN","DOWN","Burst suppression — max CMRO2/CBF reduction",TEAL),
    ("Ketamine","UP UP","UP","UP","AVOID raised ICP. Increases CMR+CBF",RED),
    ("Etomidate","DOWN","DOWN","DOWN","Preserves BP; adrenal suppression limits use",GREEN),
    ("Isoflurane >1MAC","UP mild","UP","DOWN","Blunted by hyperventilation",AMB),
    ("Sevoflurane <=1MAC","Minimal","--","DOWN","Best volatile — preserves autoregulation",GREEN),
    ("Desflurane","UP (most)","UP UP","DOWN","Airway irritation; greatest ICP rise among volatiles",RED),
    ("N2O","UP","UP","UP","AVOID in neurosurgery",RED),
    ("Dexmedetomidine","DOWN mild","DOWN","DOWN","Best glymphatic preservation; NREM-like state",PURP),
]
rowy=R3Y-43
for i,row in enumerate(anesth_rows):
    rbg=CARD2 if i%2==0 else DGRAY
    cx3=M+5
    fr(cv,cx3,rowy-9,sum(COLS),11,rbg)
    for j,(val,w3) in enumerate(zip(row[:5],COLS)):
        cc=row[5] if j<=3 else LGRAY
        t(cv,val,cx3+2,rowy-6,sz=6.2,col=cc,bold=(j<=3)); cx3+=w3
    rowy-=12

rowy-=3
fr(cv,M+5,rowy-16,W-2*M-10,17,HexColor("#0a1e10"))
cv.setStrokeColor(TEAL); cv.setLineWidth(0.7); cv.rect(M+5,rowy-16,W-2*M-10,17,stroke=1,fill=0)
t(cv,"PaCO2 RULE: Each 1 mmHg DOWN PaCO2 = DOWN CBF ~3%  |  Target 35 mmHg routine, 30-35 in ICP crisis  |  NEVER <30 mmHg (ischaemia)",
  M+8,rowy-5,sz=6.5,col=TEAL,bold=True)
t(cv,"Effect temporary — CSF pH normalizes in 6-12 hrs (bicarbonate compensation). Hyperventilation is a BRIDGE therapy only.",
  M+8,rowy-12,sz=6.2,col=LGRAY)

# Footer p1
fr(cv,0,0,W,14,DGRAY)
t(cv,"Miller's Anesthesia 10e  |  Barash Clinical Anesthesia 9e  |  Costanzo Physiology 7e  |  Boron & Boulpaep Medical Physiology",
  W/2,4,sz=6,col=MGRAY,align="center")

cv.showPage()

# ══════════════════════════════════════════════════════════════════════════
# PAGE 2
# ══════════════════════════════════════════════════════════════════════════
bg(cv)
fr(cv,0,H-30,W,30,TEAL)
fr(cv,0,H-34,W,4,AMB)
t(cv,"CSF — FORMATION, CIRCULATION & ANAESTHETIC IMPORTANCE",W/2,H-21,sz=12,col=BG,bold=True,align="center")
t(cv,"Spinal Anaesthesia | ICP Management | Glymphatic System | Rapid Fire Viva  |  Page 2 of 2",W/2,H-30,sz=6.5,col=DGRAY,align="center")

# ── Row 1: Spinal block + Drugs reducing ICP ──────────────────────────────
P2R1Y=H-42
P2R1H=165
HW=(W-2*M-5)/2

card(cv,M,P2R1Y-P2R1H,HW,P2R1H,TEAL)
t(cv,"SPINAL ANAESTHESIA & CSF",M+5,P2R1Y-5,sz=7.5,col=TEAL,bold=True)

t(cv,"BARICITY",M+5,P2R1Y-20,sz=7,col=TEAL,bold=True)
brow=[("HYPERBARIC",TEAL,"Density > CSF  |  Sinks with gravity  |  Position-controlled  |  0.5% Bupiv + 8% glucose"),
      ("ISOBARIC",GREEN,"Density = CSF  |  Minimal positional spread  |  Predictable block"),
      ("HYPOBARIC",AMB,"Density < CSF  |  Floats  |  Hip arthroplasty in lateral tilt")]
by2=P2R1Y-30
for lbl,col,desc in brow:
    fr(cv,M+5,by2-10,HW-10,11,CARD2)
    t(cv,lbl,M+8,by2-6,sz=7,col=col,bold=True)
    t(cv,desc,M+62,by2-6,sz=6.2,col=WHITE)
    by2-=13

by2-=4
t(cv,"FACTORS AFFECTING BLOCK LEVEL",M+5,by2,sz=7,col=AMB,bold=True); by2-=11
factors=[("Baricity","Most important factor"),
         ("Dose","Volume x concentration"),
         ("Position","At + after injection"),
         ("Injection site","L3-4 vs L4-5"),
         ("CSF volume","DOWN in pregnancy/obesity/elderly -> high block")]
for k,v in factors:
    fr(cv,M+5,by2-8,HW-10,10,DGRAY)
    t(cv,k,M+8,by2-5,sz=6.5,col=AMB,bold=True)
    t(cv,v,M+48,by2-5,sz=6.3,col=WHITE)
    by2-=12

by2-=4
fr(cv,M+5,by2-38,HW-10,39,HexColor("#2a0a0a"))
cv.setStrokeColor(RED); cv.setLineWidth(0.7); cv.rect(M+5,by2-38,HW-10,39,stroke=1,fill=0)
t(cv,"PDPH — POST-DURAL PUNCTURE HEADACHE",M+8,by2-5,sz=6.5,col=RED,bold=True)
pdph2=[("Mechanism","CSF leak -> DOWN pressure -> traction on structures"),
       ("Character","Positional; worse upright, relieved lying flat"),
       ("Prevention","Pencil-point needles (Whitacre/Sprotte)"),
       ("Treatment","Epidural blood patch (gold std, 85-90% success)")]
for k,v in pdph2:
    by2-=11
    t(cv,k+":",M+8,by2,sz=6.3,col=RED,bold=True)
    t(cv,v,M+55,by2,sz=6.2,col=WHITE)

by2-=13
fr(cv,M+5,by2-28,HW-10,29,CARD2)
cv.setStrokeColor(PURP); cv.setLineWidth(0.7); cv.rect(M+5,by2-28,HW-10,29,stroke=1,fill=0)
t(cv,"INTRATHECAL OPIOIDS",M+8,by2-5,sz=6.5,col=PURP,bold=True)
t(cv,"Lipophilic (fentanyl): rapid uptake, segmental, minimal rostral spread",M+8,by2-14,sz=6.2,col=WHITE)
t(cv,"Hydrophilic (morphine): rostral spread, 12-24h analgesia, delayed resp depression up to 24h",M+8,by2-22,sz=6.2,col=AMB,bold=True)

# Right col — ICP management
P2X2=M+HW+5
card(cv,P2X2,P2R1Y-P2R1H,HW,P2R1H,AMB)
t(cv,"ICP MANAGEMENT STRATEGIES",P2X2+5,P2R1Y-5,sz=7.5,col=AMB,bold=True)

sections2=[
    ("VENTILATION & POSITION",TEAL,[
        ("Head-up 30deg","Standard; facilitates venous + CSF drainage"),
        ("Normocapnia 35 mmHg","Routine; each 1 mmHg down = 3% down CBF"),
        ("Hypervent 30-35","ICP crisis only; bridge therapy"),
        ("Avoid <30 mmHg","Ischaemia risk"),
        ("Avoid head rotation","Obstructs IJV -> UP ICP"),
    ]),
    ("DRUGS",AMB,[
        ("Mannitol 0.25-1g/kg","Osmotic; rapid brain dehydration"),
        ("Hypertonic saline","3-23.4% NaCl; sustained effect"),
        ("Acetazolamide","CA inhibitor; DOWN CSF prod ~50%"),
        ("Dexamethasone","Vasogenic oedema (tumour) only"),
        ("Barbiturate coma","Burst suppression; refractory ICP"),
    ]),
    ("CSF DRAINAGE",GREEN,[
        ("EVD","Lateral ventricle drain; ICP monitor + Rx"),
        ("Lumbar CSF drain","Spinal/posterior fossa surgery"),
        ("Target ICP","<20 mmHg"),
        ("CAUTION","Rapid drainage -> herniation risk"),
    ]),
]
s2y=P2R1Y-20
for grp_name,col2,items in sections2:
    fr(cv,P2X2+5,s2y-10,HW-10,11,col2)
    t(cv,grp_name,P2X2+8,s2y-7,sz=7,col=BG,bold=True); s2y-=13
    for k,v in items:
        fr(cv,P2X2+5,s2y-8,HW-10,10,CARD2)
        cv.setStrokeColor(col2); cv.setLineWidth(1.2)
        cv.line(P2X2+5,s2y-8,P2X2+5,s2y+2)
        t(cv,k,P2X2+10,s2y-5,sz=6.5,col=WHITE,bold=True)
        t(cv,v,P2X2+80,s2y-5,sz=6.2,col=LGRAY)
        s2y-=12
    s2y-=4

# ── Row 2: Glymphatic + Rapid Fire ────────────────────────────────────────
P2R2Y=P2R1Y-P2R1H-6
P2R2H=H-P2R2Y-14

card(cv,M,P2R2Y-P2R2H,HW,P2R2H,PURP)
t(cv,"GLYMPHATIC SYSTEM",M+5,P2R2Y-5,sz=7.5,col=PURP,bold=True)
t(cv,"Brain waste-clearance system; analogous to systemic lymphatics",M+5,P2R2Y-17,sz=6.5,col=WHITE)

gmech=[("1","CSF enters periarterial spaces (vessel + astrocyte end-feet)"),
       ("2","AQP4 channels on astrocyte end-feet facilitate water exchange"),
       ("3","Convection bulk flow to parenchyma"),
       ("4","Perivenous space -> meningeal/cervical lymphatics")]
gy2=P2R2Y-30
for n,desc in gmech:
    fr(cv,M+5,gy2-9,9,10,PURP)
    t(cv,n,M+5,gy2-6,sz=6,col=BG,bold=True,align="center")
    t(cv,desc,M+17,gy2-6,sz=6.5,col=WHITE)
    gy2-=13

gy2-=4
grel2=[
    (TEAL,"During GA","Periarterial space enlarges -> UP glymphatic transport (like sleep)"),
    (AMB,"Volatile agents","REDUCE glymphatic transport"),
    (GREEN,"Dexmedetomidine","BEST preserves glymphatic (NREM sleep-like state)"),
    (RED,"POCD link","Impaired Abeta/tau clearance -> cognitive decline"),
]
for col3,lbl,desc in grel2:
    fr(cv,M+5,gy2-9,4,9,col3)
    t(cv,lbl,M+12,gy2-5,sz=6.8,col=col3,bold=True)
    t(cv,desc,M+12,gy2-14,sz=6.2,col=WHITE)
    gy2-=18

# Rapid fire right
RF_X=M+HW+5
card(cv,RF_X,P2R2Y-P2R2H,HW,P2R2H,GOLD)
t(cv,"RAPID FIRE VIVA — CSF",RF_X+5,P2R2Y-5,sz=7.5,col=GOLD,bold=True)

rf=[
    (TEAL,"CSF rate:","0.35 mL/min = ~500 mL/day"),
    (TEAL,"Total CSF volume:","~150 mL (brain 100 + spine 50)"),
    (TEAL,"Turnover:","3-4 times per day"),
    (TEAL,"Peak production:","During sleep (circadian)"),
    (GREEN,"4th ventricle exits:","Luschka x2 + Magendie x1"),
    (GREEN,"Absorption site:","Arachnoid granulations -> SSS"),
    (GREEN,"LP level:","L3-4 or L4-5 (conus at L1-2)"),
    (AMB,"Normal ICP:","5-15 mmHg (70-180 mmH2O)"),
    (AMB,"CPP formula:","MAP - ICP"),
    (AMB,"Target CPP:","≥60 (≥70 in TBI)"),
    (AMB,"CSF specific gravity:","1.003-1.008 at 37 deg C"),
    (RED,"Avoid in raised ICP:","Ketamine, N2O"),
    (RED,"Best for raised ICP:","Propofol or thiopental"),
    (RED,"Best volatile neuro:","Sevoflurane ≤1 MAC"),
    (TEAL,"DOWN CSF production:","Acetazolamide (CA inhibitor, ~50%)"),
    (PURP,"PDPH treatment:","Epidural blood patch (gold std)"),
    (PURP,"IT morphine risk:","Delayed resp depression up to 24h"),
    (PURP,"Dex + glymphatic:","Best preserves vs volatiles"),
    (GOLD,"Barbiturate coma:","Burst suppression; refractory ICP"),
    (GOLD,"CO2 and CBF:","1 mmHg down PaCO2 = 3% down CBF"),
]
rfy=P2R2Y-20
for col4,q,a in rf:
    fr(cv,RF_X+5,rfy-7,4,6,col4)
    t(cv,q,RF_X+12,rfy-3,sz=6.3,col=LGRAY,bold=True)
    t(cv,a,RF_X+12,rfy-11,sz=6.3,col=WHITE)
    rfy-=16

# Footer p2
fr(cv,0,0,W,14,DGRAY)
t(cv,"Miller's Anesthesia 10e  |  Barash Clinical Anesthesia 9e  |  Costanzo Physiology 7e  |  Boron & Boulpaep Medical Physiology",
  W/2,4,sz=6,col=MGRAY,align="center")

cv.save()
print("Cheatsheet done.")
!

Failed to create session: unauthorized: authentication failed: Bearer token is invalid

We encountered an error while processing your request. Please try again or reach out to us for help.

Make a ppt

Running Command

mkdir -p /home/daytona/workspace/csf-anaesthesia && ls /home/daytona/workspace/csf-anaesthesia/

Writing File

~/csf-anaesthesia/make_ppt.js

const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "CSF Formation, Circulation & Anaesthetic Importance";

const BG="0A1628",CARD="112035",CARD2="162840",DGRAY="1E3448",MGRAY="4A6278",LGRAY="8EAABF";
const TEAL="00BCD4",GREEN="26A69A",AMB="FFA726",RED="EF5350",PURP="7E57C2",WHITE="FFFFFF",GOLD="FFD54F";

function bg(s){s.addShape(pres.shapes.RECTANGLE,{x:0,y:0,w:10,h:5.625,fill:{color:BG},line:{color:BG}});}
function tbar(s,c){s.addShape(pres.shapes.RECTANGLE,{x:0,y:0,w:10,h:0.08,fill:{color:c||TEAL},line:{color:c||TEAL}});}
function sbar(s,c){s.addShape(pres.shapes.RECTANGLE,{x:0,y:0,w:0.1,h:5.625,fill:{color:c||TEAL},line:{color:c||TEAL}});}
function stitle(s,txt,c){
  s.addText(txt,{x:0.25,y:0.12,w:9.5,h:0.5,fontSize:20,bold:true,color:c||TEAL,fontFace:"Calibri",margin:0});
  s.addShape(pres.shapes.RECTANGLE,{x:0.25,y:0.66,w:1.2,h:0.04,fill:{color:AMB},line:{color:AMB}});
}
function card(s,x,y,w,h,bc,fc){
  s.addShape(pres.shapes.RECTANGLE,{x,y,w,h,fill:{color:fc||CARD},line:{color:bc||TEAL,pt:1.2},shadow:{type:"outer",color:"000000",blur:7,offset:3,angle:135,opacity:0.2}});
}
function chip(s,x,y,w,h,lbl,fc,tc){
  s.addShape(pres.shapes.RECTANGLE,{x,y,w,h,fill:{color:fc},line:{color:fc}});
  s.addText(lbl,{x,y,w,h,fontSize:9,bold:true,color:tc||"000000",fontFace:"Calibri",align:"center",valign:"middle",margin:0});
}
function accentBar(s,x,y,w,c){s.addShape(pres.shapes.RECTANGLE,{x,y,w,h:0.07,fill:{color:c},line:{color:c}});}

// ── SLIDE 1: TITLE ──────────────────────────────────────────────────────────
{const s=pres.addSlide();bg(s);
s.addShape(pres.shapes.RECTANGLE,{x:0,y:0,w:10,h:0.1,fill:{color:TEAL},line:{color:TEAL}});
s.addShape(pres.shapes.RECTANGLE,{x:0,y:5.525,w:10,h:0.1,fill:{color:AMB},line:{color:AMB}});
s.addShape(pres.shapes.OVAL,{x:6.5,y:-1.3,w:5.2,h:5.2,fill:{color:TEAL,transparency:90},line:{color:TEAL,transparency:85,pt:1.5}});
s.addShape(pres.shapes.OVAL,{x:7.2,y:-0.6,w:3.3,h:3.3,fill:{color:TEAL,transparency:94},line:{color:TEAL,transparency:88,pt:1}});
s.addShape(pres.shapes.RECTANGLE,{x:0.5,y:0.95,w:1.5,h:1.5,fill:{color:TEAL},line:{color:TEAL}});
s.addText("CSF",{x:0.5,y:0.95,w:1.5,h:1.5,fontSize:40,bold:true,color:BG,fontFace:"Calibri",align:"center",valign:"middle",margin:0});
s.addText("CEREBROSPINAL FLUID",{x:2.3,y:0.92,w:7.4,h:0.68,fontSize:38,bold:true,color:WHITE,fontFace:"Calibri",charSpacing:3,margin:0});
s.addText("Formation · Circulation · Anaesthetic Importance",{x:2.3,y:1.62,w:7.4,h:0.45,fontSize:20,color:TEAL,fontFace:"Calibri",margin:0});
s.addShape(pres.shapes.RECTANGLE,{x:2.3,y:2.18,w:5.5,h:0.04,fill:{color:AMB},line:{color:AMB}});
s.addText("MD Anaesthesia  |  Neurophysiology · Neuroanaesthesia · Regional Techniques",{x:2.3,y:2.28,w:7.4,h:0.35,fontSize:13,color:LGRAY,fontFace:"Calibri",italic:true,margin:0});
s.addText("Sources: Miller's Anesthesia 10e  ·  Barash Clinical Anesthesia 9e  ·  Costanzo Physiology 7e  ·  Boron & Boulpaep Medical Physiology",{x:0.25,y:5.22,w:9.5,h:0.25,fontSize:8,color:MGRAY,fontFace:"Calibri",align:"center",margin:0});}

// ── SLIDE 2: OUTLINE ────────────────────────────────────────────────────────
{const s=pres.addSlide();bg(s);tbar(s);sbar(s);stitle(s,"OUTLINE");
const topics=[{n:"01",t:"Anatomy of CSF Compartments"},{n:"02",t:"Formation of CSF"},{n:"03",t:"CSF Composition & Normal Values"},{n:"04",t:"Circulation & Absorption Pathway"},{n:"05",t:"Monro-Kellie Doctrine & ICP"},{n:"06",t:"Anaesthetic Effects on ICP/CSF"},{n:"07",t:"Spinal & Epidural Anaesthesia"},{n:"08",t:"ICP Management Strategies"},{n:"09",t:"Glymphatic System"},{n:"10",t:"Viva Summary — Key Numbers"}];
[[0,5],[5,10]].forEach(([a,b],ci)=>{const sx=0.3+ci*4.88;topics.slice(a,b).forEach((item,i)=>{const y=0.85+i*0.88;chip(s,sx,y,0.55,0.42,item.n,TEAL,"000000");s.addText(item.t,{x:sx+0.65,y,w:4.1,h:0.42,fontSize:13,color:WHITE,fontFace:"Calibri",valign:"middle",margin:0});if(i<4)s.addShape(pres.shapes.RECTANGLE,{x:sx,y:y+0.45,w:4.65,h:0.02,fill:{color:MGRAY,transparency:55},line:{color:MGRAY}});});});}

// ── SLIDE 3: ANATOMY ────────────────────────────────────────────────────────
{const s=pres.addSlide();bg(s);tbar(s);sbar(s);stitle(s,"ANATOMY OF CSF COMPARTMENTS");
card(s,0.2,0.76,5.5,4.7,TEAL);
s.addText("VENTRICULAR PATHWAY & FLOW",{x:0.3,y:0.8,w:5.3,h:0.28,fontSize:11,bold:true,color:TEAL,fontFace:"Calibri",margin:0});
const steps=[{l:"Lateral Ventricles (×2)",d:"Largest; in cerebral hemispheres\nChoroid plexus along inner radius",c:TEAL},{l:"Foramina of Monro",d:"Paired — connect to third ventricle",c:MGRAY},{l:"Third Ventricle",d:"Between thalami; choroid plexus in roof",c:TEAL},{l:"Cerebral Aqueduct of Sylvius",d:"Narrow channel through midbrain",c:MGRAY},{l:"Fourth Ventricle",d:"Between pons/medulla & cerebellum",c:TEAL},{l:"Luschka ×2 + Magendie ×1",d:"Exit foramina → subarachnoid space",c:AMB},{l:"Subarachnoid Space",d:"Surrounds brain + spinal cord\nCisterns: magna, pontine, interpeduncular",c:GREEN}];
let py=1.18;steps.forEach((st,i)=>{s.addShape(pres.shapes.OVAL,{x:0.28,y:py,w:0.3,h:0.3,fill:{color:st.c},line:{color:st.c}});s.addText(st.l,{x:0.68,y:py,w:4.9,h:0.19,fontSize:10.5,bold:true,color:WHITE,fontFace:"Calibri",margin:0});s.addText(st.d,{x:0.68,y:py+0.19,w:4.9,h:0.24,fontSize:9,color:LGRAY,fontFace:"Calibri",margin:0});if(i<steps.length-1)s.addShape(pres.shapes.RECTANGLE,{x:0.42,y:py+0.35,w:0.02,h:0.14,fill:{color:MGRAY},line:{color:MGRAY}});py+=0.52;});
card(s,5.9,0.76,3.85,2.1,AMB);s.addText("KEY FACTS",{x:6.0,y:0.8,w:3.65,h:0.28,fontSize:11,bold:true,color:AMB,fontFace:"Calibri",margin:0});
[["Total CSF","~150 mL"],["Intracranial","~100 mL"],["Spinal","~50 mL"],["Daily production","450–500 mL"],["Turnover","3–4× per day"],["Normal ICP","5–15 mmHg"]].forEach(([k,v],i)=>{const fy=1.18+i*0.28;s.addText(k,{x:6.0,y:fy,w:2.2,h:0.25,fontSize:10.5,color:LGRAY,bold:true,fontFace:"Calibri",margin:0});s.addText(v,{x:8.2,y:fy,w:1.45,h:0.25,fontSize:10.5,color:TEAL,bold:true,align:"right",fontFace:"Calibri",margin:0});});
card(s,5.9,3.0,3.85,1.62,GREEN);s.addText("SPINAL LANDMARKS",{x:6.0,y:3.04,w:3.65,h:0.28,fontSize:11,bold:true,color:GREEN,fontFace:"Calibri",margin:0});
["Conus medullaris ends: L1–2 (adults)","LP performed at: L3–4 or L4–5","Lumbar cistern: largest accessible CSF pool","Dural sac ends at: S2"].forEach((p,i)=>s.addText("▸ "+p,{x:6.0,y:3.38+i*0.28,w:3.65,h:0.26,fontSize:9.5,color:WHITE,fontFace:"Calibri",margin:0}));
card(s,5.9,4.75,3.85,0.62,TEAL,DGRAY);s.addText("Monro-Kellie: Brain + Blood + CSF = Constant\nCSF most easily displaced of the three components",{x:6.0,y:4.79,w:3.68,h:0.54,fontSize:9,color:WHITE,fontFace:"Calibri",margin:0});}

// ── SLIDE 4: FORMATION ──────────────────────────────────────────────────────
{const s=pres.addSlide();bg(s);tbar(s);sbar(s);stitle(s,"FORMATION OF CSF");
card(s,0.2,0.76,4.6,4.72,TEAL);s.addText("MECHANISM (2 PHASES)",{x:0.3,y:0.8,w:4.4,h:0.28,fontSize:11,bold:true,color:TEAL,fontFace:"Calibri",margin:0});
let py=1.15;
[{n:"1",title:"Hydrostatic Efflux",c:TEAL,pts:["Fluid: choroidal capillaries → perivascular space","Driven by hydrostatic pressure gradient"]},{n:"2",title:"Active Secretion (Primary)",c:GREEN,pts:["Choroid plexus epithelial cells (like renal DCT)","SECRETE into CSF: Na+, Cl-, HCO3-, water","REABSORB from CSF: K+","EXCLUDE: Proteins, cholesterol (large size)"]}].forEach(ph=>{s.addShape(pres.shapes.RECTANGLE,{x:0.28,y:py,w:0.42,h:0.42,fill:{color:ph.c},line:{color:ph.c}});s.addText(ph.n,{x:0.28,y:py,w:0.42,h:0.42,fontSize:14,bold:true,color:BG,fontFace:"Calibri",align:"center",valign:"middle",margin:0});s.addText(ph.title,{x:0.78,y:py,w:3.9,h:0.42,fontSize:12,bold:true,color:ph.c,fontFace:"Calibri",valign:"middle",margin:0});py+=0.46;ph.pts.forEach(p=>{s.addText([{text:"• ",options:{color:ph.c,bold:true}},{text:p,options:{color:WHITE}}],{x:0.8,y:py,w:3.9,h:0.28,fontSize:10.5,fontFace:"Calibri",margin:0});py+=0.3;});py+=0.1;});
s.addShape(pres.shapes.RECTANGLE,{x:0.28,y:py,w:4.42,h:1.0,fill:{color:CARD2},line:{color:AMB,pt:0.8}});s.addText("CHOROID PLEXUS BARRIER (3 layers):",{x:0.35,y:py+0.05,w:4.3,h:0.25,fontSize:9.5,bold:true,color:AMB,fontFace:"Calibri",margin:0});s.addText("1. Capillary endothelial cells + basement membrane\n2. Neuroglial membrane\n3. Choroid plexus epithelial cells (TIGHT JUNCTIONS)",{x:0.35,y:py+0.3,w:4.3,h:0.65,fontSize:9,color:WHITE,fontFace:"Calibri",margin:0});
card(s,5.0,0.76,4.75,2.2,GREEN);s.addText("RATE & VOLUME",{x:5.1,y:0.8,w:4.55,h:0.28,fontSize:11,bold:true,color:GREEN,fontFace:"Calibri",margin:0});
[["Rate of formation","0.35 mL/min (21 mL/hr)"],["Daily production","450–500 mL/day"],["Total CSF volume","~150 mL"],["Turnover","3–4× daily"]].forEach(([k,v],i)=>{const rb=i%2===0?CARD2:DGRAY;s.addShape(pres.shapes.RECTANGLE,{x:5.05,y:1.2+i*0.38,w:4.65,h:0.37,fill:{color:rb},line:{color:MGRAY,pt:0.4}});s.addText(k,{x:5.13,y:1.2+i*0.38,w:2.6,h:0.37,fontSize:10.5,bold:true,color:LGRAY,fontFace:"Calibri",valign:"middle",margin:0});s.addText(v,{x:7.73,y:1.2+i*0.38,w:2.0,h:0.37,fontSize:10.5,color:GREEN,bold:true,fontFace:"Calibri",valign:"middle",margin:0});});
card(s,5.0,3.1,4.75,1.1,PURP);s.addText("CIRCADIAN RHYTHM",{x:5.1,y:3.14,w:4.55,h:0.28,fontSize:11,bold:true,color:PURP,fontFace:"Calibri",margin:0});s.addText("▸  Peak CSF production during SLEEP\n▸  GA mimics sleep → periarterial space enlarges → ↑ glymphatic transport\n▸  Dexmedetomidine best preserves glymphatic function",{x:5.1,y:3.46,w:4.55,h:0.7,fontSize:9.8,color:WHITE,fontFace:"Calibri",margin:0});
card(s,5.0,4.34,4.75,1.1,AMB);s.addText("BLOOD-BRAIN BARRIER (comparison)",{x:5.1,y:4.38,w:4.55,h:0.28,fontSize:10,bold:true,color:AMB,fontFace:"Calibri",margin:0});s.addText("Tight junctions between endothelial cells\nOnly LIPID-SOLUBLE substances cross freely (O2, CO2, anaesthetic vapours)\nWater-soluble/ionised substances excluded",{x:5.1,y:4.68,w:4.55,h:0.65,fontSize:9.5,color:LGRAY,fontFace:"Calibri",margin:0});}

// ── SLIDE 5: COMPOSITION + CIRCULATION ─────────────────────────────────────
{const s=pres.addSlide();bg(s);tbar(s);sbar(s);stitle(s,"CSF COMPOSITION & CIRCULATION");
card(s,0.2,0.76,4.55,4.72,TEAL);s.addText("COMPOSITION vs PLASMA",{x:0.3,y:0.8,w:4.35,h:0.28,fontSize:11,bold:true,color:TEAL,fontFace:"Calibri",margin:0});
const ths=["Component","vs Plasma","Value"],tw=[1.35,1.3,1.75];
let ty=1.14,cx=0.28;s.addShape(pres.shapes.RECTANGLE,{x:0.28,y:ty,w:4.38,h:0.3,fill:{color:MGRAY},line:{color:BG,pt:0.5}});ths.forEach((h,i)=>{s.addText(h,{x:cx+1,y:ty,w:tw[i],h:0.3,fontSize:9,bold:true,color:BG,fontFace:"Calibri",align:"center",valign:"middle",margin:0});cx+=tw[i];});
[["Na+","= Plasma","~140 mEq/L",LGRAY],["K+","< Plasma","2.8–3.2 mEq/L",TEAL],["Cl-","= Plasma","~120 mEq/L",LGRAY],["Ca2+","< Plasma","~1.1 mmol/L",TEAL],["HCO3-","= Plasma","~25 mEq/L",LGRAY],["Glucose","< Plasma","60–80% plasma",TEAL],["Osmolarity","= Plasma","~295 mOsm",LGRAY],["Protein","NEGLIGIBLE","15–45 mg/dL",GREEN],["Cholesterol","NEGLIGIBLE","Trace",GREEN],["Mg2+","> Plasma","~1.2 mmol/L",AMB],["pH","< Plasma","7.32–7.34",AMB],["Pressure","Normal","5–15 mmHg",GOLD]].forEach((r,i)=>{ty+=0.3;const rb=i%2===0?CARD2:DGRAY;s.addShape(pres.shapes.RECTANGLE,{x:0.28,y:ty,w:4.38,h:0.29,fill:{color:rb},line:{color:MGRAY,pt:0.3}});cx=0.28;[r[0],r[1],r[2]].forEach((v,j)=>{s.addText(v,{x:cx+1,y:ty,w:tw[j],h:0.29,fontSize:9,color:r[3],fontFace:"Calibri",align:"center",valign:"middle",margin:0,bold:j===1});cx+=tw[j];});});
card(s,4.95,0.76,4.8,4.72,GREEN);s.addText("CIRCULATION PATHWAY",{x:5.05,y:0.8,w:4.6,h:0.28,fontSize:11,bold:true,color:GREEN,fontFace:"Calibri",margin:0});
const path=[{t:"Choroid Plexus → Lateral Ventricles",c:TEAL,a:false},{t:"Foramina of Monro",c:MGRAY,a:true},{t:"Third Ventricle",c:TEAL,a:false},{t:"Cerebral Aqueduct of Sylvius",c:MGRAY,a:true},{t:"Fourth Ventricle",c:TEAL,a:false},{t:"Luschka (×2) + Magendie (×1)",c:AMB,a:true},{t:"Subarachnoid Space",c:GREEN,a:false},{t:"Bulk flow over cerebral convexities",c:MGRAY,a:true},{t:"Arachnoid Granulations",c:PURP,a:false},{t:"Superior Sagittal Sinus → Venous Blood",c:RED,a:true}];
let pp=1.14;path.forEach(p=>{if(!p.a){s.addShape(pres.shapes.RECTANGLE,{x:5.05,y:pp,w:4.65,h:0.32,fill:{color:p.c,transparency:20},line:{color:p.c,pt:0.6}});s.addText(p.t,{x:5.1,y:pp,w:4.58,h:0.32,fontSize:9.8,bold:true,color:BG,fontFace:"Calibri",valign:"middle",margin:0});pp+=0.34;}else{s.addText("▼  "+p.t,{x:5.28,y:pp,w:4.35,h:0.2,fontSize:8.5,color:LGRAY,fontFace:"Calibri",italic:true,margin:0});pp+=0.22;}});
pp+=0.04;s.addShape(pres.shapes.RECTANGLE,{x:5.05,y:pp,w:4.65,h:0.68,fill:{color:CARD2},line:{color:LGRAY,pt:0.5}});s.addText("Minor drainage routes:",{x:5.12,y:pp+0.04,w:4.5,h:0.2,fontSize:9,bold:true,color:LGRAY,fontFace:"Calibri",margin:0});s.addText("Cranial/spinal nerve sheaths  ·  Perivenous routes\nNasal mucosa (via cribriform plate)  ·  Meningeal lymphatics",{x:5.12,y:pp+0.28,w:4.5,h:0.36,fontSize:8.8,color:LGRAY,fontFace:"Calibri",margin:0});}

// ── SLIDE 6: MONRO-KELLIE + CPP ─────────────────────────────────────────────
{const s=pres.addSlide();bg(s);tbar(s);sbar(s);stitle(s,"MONRO-KELLIE DOCTRINE & ICP");
s.addShape(pres.shapes.RECTANGLE,{x:0.2,y:0.76,w:9.6,h:1.28,fill:{color:CARD2},line:{color:AMB,pt:1.0}});
s.addText("MONRO-KELLIE DOCTRINE",{x:0.3,y:0.8,w:4.5,h:0.32,fontSize:14,bold:true,color:AMB,fontFace:"Calibri",margin:0});
s.addText("The cranial vault is a RIGID CLOSED BOX. Total intracranial volume is CONSTANT.\nAn increase in one component MUST be compensated by a decrease in another.",{x:0.3,y:1.14,w:9.4,h:0.38,fontSize:11,color:WHITE,fontFace:"Calibri",margin:0});
[[0.2,"Brain Parenchyma","~80%","Least compressible",TEAL],[3.43,"Blood (CBV)","~12%","Reduced by hyperventilation",AMB],[6.65,"CSF","~8%  (~100 mL)","MOST easily displaced → spinal canal",GREEN]].forEach(([cx,n,p,note,col])=>{card(s,cx,2.18,3.08,1.35,col);s.addShape(pres.shapes.RECTANGLE,{x:cx,y:2.18,w:3.08,h:0.08,fill:{color:col},line:{color:col}});s.addText(n,{x:cx+0.1,y:2.3,w:2.88,h:0.3,fontSize:12,bold:true,color:col,fontFace:"Calibri",margin:0});s.addText(p,{x:cx+0.1,y:2.62,w:2.88,h:0.38,fontSize:22,bold:true,color:WHITE,fontFace:"Calibri",margin:0});s.addText(note,{x:cx+0.1,y:3.03,w:2.88,h:0.44,fontSize:9.5,color:LGRAY,fontFace:"Calibri",margin:0});});
card(s,0.2,3.68,4.65,1.8,TEAL);s.addText("CPP = MAP − ICP",{x:0.3,y:3.72,w:4.45,h:0.42,fontSize:20,bold:true,color:TEAL,fontFace:"Calibri",margin:0});s.addText("(or MAP − CVP, whichever is higher)",{x:0.3,y:4.16,w:4.45,h:0.25,fontSize:9.5,color:LGRAY,italic:true,fontFace:"Calibri",margin:0});[["Target CPP:","≥ 60 mmHg  (TBI: ≥ 70 mmHg)"],["Normal ICP:","5–15 mmHg  (70–180 mmH2O)"],["Normal MAP:","80–100 mmHg"]].forEach(([k,v],i)=>s.addText(k+" "+v,{x:0.3,y:4.44+i*0.28,w:4.45,h:0.26,fontSize:10,color:WHITE,fontFace:"Calibri",margin:0}));
card(s,5.08,3.68,4.72,1.8,AMB);s.addText("COMPENSATORY MECHANISMS (in order)",{x:5.18,y:3.72,w:4.52,h:0.28,fontSize:11,bold:true,color:AMB,fontFace:"Calibri",margin:0});[["1st","Displacement of CSF to spinal canal","(most readily moved)"],["2nd","Reduction in cerebral venous blood volume",""],["3rd","↓ CSF production",""],["!!","DECOMPENSATION — exponential ICP rise","once capacity exhausted"]].forEach(([n,text,sub],i)=>{chip(s,5.18,4.08+i*0.36,0.35,0.28,n,i<3?AMB:RED,"000000");s.addText(text,{x:5.62,y:4.1+i*0.36,w:4.1,h:0.2,fontSize:10,color:i===3?RED:WHITE,bold:i===3,fontFace:"Calibri",margin:0});if(sub)s.addText(sub,{x:5.62,y:4.3+i*0.36,w:4.1,h:0.15,fontSize:8.5,color:LGRAY,italic:true,fontFace:"Calibri",margin:0});});}

// ── SLIDE 7: ANAESTHETIC EFFECTS ON ICP ─────────────────────────────────────
{const s=pres.addSlide();bg(s);tbar(s);sbar(s);stitle(s,"ANAESTHETIC EFFECTS ON ICP & CSF");
const ths2=["Agent","ICP","CBF","CMRO2","Clinical Notes"],tw2=[1.42,0.88,0.72,0.82,5.0];
let tx=0.2;const hcol=[MGRAY,TEAL,TEAL,TEAL,MGRAY];ths2.forEach((h,i)=>{s.addShape(pres.shapes.RECTANGLE,{x:tx,y:0.78,w:tw2[i],h:0.32,fill:{color:hcol[i]},line:{color:BG,pt:0.5}});s.addText(h,{x:tx,y:0.78,w:tw2[i],h:0.32,fontSize:9.5,bold:true,color:BG,fontFace:"Calibri",align:"center",valign:"middle",margin:0});tx+=tw2[i];});
[["Propofol","↓↓","↓","↓","Gold standard neuro-TIVA; preferred for raised ICP",TEAL],["Thiopental","↓↓","↓","↓","Burst suppression → maximum CMRO2/CBF reduction",TEAL],["Ketamine","↑↑","↑","↑","AVOID raised ICP (↑ CMRO2 + ↑ CBF + ↑ CBV)",RED],["Etomidate","↓","↓","↓","Preserves BP; adrenal suppression limits use",GREEN],["Midazolam/BZDs","↓ mild","↓","↓","Limited ICP effect; useful premedication",LGRAY],["Isoflurane >1MAC","↑ mild","↑","↓","Blunted by hyperventilation or barbiturate co-admin",AMB],["Sevoflurane ≤1MAC","Minimal","—","↓","Best volatile — preserves autoregulation up to ~1 MAC",GREEN],["Desflurane","↑ (most)","↑↑","↓","Greatest volatile ICP rise; airway irritant → ↑HR/MAP",RED],["N2O","↑","↑","↑","AVOID in neurosurgery — increases CMR and CBF",RED],["Dexmedetomidine","↓ mild","↓","↓","NREM sleep-like state; best preserves glymphatic transport",PURP]].forEach((r,i)=>{const ry=1.12+i*0.44;tx=0.2;tw2.forEach((w,j)=>{s.addShape(pres.shapes.RECTANGLE,{x:tx,y:ry,w:w,h:0.42,fill:{color:i%2===0?CARD:CARD2},line:{color:MGRAY,pt:0.3}});s.addText(r[j],{x:tx+1,y:ry,w:w-2,h:0.42,fontSize:j===4?8.8:9.5,color:j<=3?r[5]:LGRAY,fontFace:"Calibri",valign:"middle",align:j===4?"left":"center",margin:0,bold:j<=3});tx+=w;});});
s.addShape(pres.shapes.RECTANGLE,{x:0.2,y:5.12,w:9.6,h:0.42,fill:{color:CARD2},line:{color:TEAL,pt:0.8}});s.addText([{text:"PaCO2: ",options:{color:TEAL,bold:true}},{text:"Each 1 mmHg ↓ PaCO2 = ↓ CBF ~3%  |  Target 35 mmHg routine, 30–35 in crisis  |  ",options:{color:WHITE}},{text:"NEVER <30 mmHg",options:{color:RED,bold:true}},{text:" (cerebral ischaemia)",options:{color:LGRAY}}],{x:0.3,y:5.16,w:9.4,h:0.34,fontSize:9.5,fontFace:"Calibri",valign:"middle",margin:0});}

// ── SLIDE 8: SPINAL ANAESTHESIA ─────────────────────────────────────────────
{const s=pres.addSlide();bg(s);tbar(s);sbar(s);stitle(s,"SPINAL & EPIDURAL ANAESTHESIA — CSF RELEVANCE");
card(s,0.2,0.76,5.35,2.75,TEAL);s.addText("BARICITY OF LOCAL ANAESTHETICS",{x:0.3,y:0.8,w:5.15,h:0.28,fontSize:11,bold:true,color:TEAL,fontFace:"Calibri",margin:0});
let by=1.14;[{t:"HYPERBARIC (Heavy)",c:TEAL,pts:["Density > CSF (glucose added)","Sinks with gravity → position-controlled spread","0.5% bupivacaine + 8% dextrose","Most commonly used; most controllable"]},{t:"ISOBARIC",c:GREEN,pts:["Density = CSF","Minimal positional spread","More predictable block level"]},{t:"HYPOBARIC (Light)",c:AMB,pts:["Density < CSF  (diluted/warmed)","Rises against gravity","Hip arthroplasty in lateral position"]}].forEach(b=>{s.addShape(pres.shapes.RECTANGLE,{x:0.28,y:by,w:5.15,h:0.24,fill:{color:b.c,transparency:18},line:{color:b.c,pt:0.5}});s.addText(b.t,{x:0.32,y:by,w:5.1,h:0.24,fontSize:9.5,bold:true,color:BG,fontFace:"Calibri",valign:"middle",margin:0});by+=0.26;b.pts.forEach(p=>{s.addText("• "+p,{x:0.34,y:by,w:5.1,h:0.22,fontSize:8.8,color:WHITE,fontFace:"Calibri",margin:0});by+=0.23;});by+=0.06;});
card(s,5.78,0.76,4.0,2.75,AMB);s.addText("FACTORS AFFECTING BLOCK LEVEL",{x:5.88,y:0.8,w:3.8,h:0.28,fontSize:11,bold:true,color:AMB,fontFace:"Calibri",margin:0});
[["Baricity","Most important factor"],["Dose","Volume × concentration"],["Position","At and just after injection"],["Injection site","L3–4 vs L4–5"],["Speed of injection","Fast → wider spread"],["CSF volume","↓ in pregnancy/obesity → high block risk"]].forEach(([k,v],i)=>{const fy=1.14+i*0.38;s.addShape(pres.shapes.RECTANGLE,{x:5.88,y:fy,w:3.8,h:0.36,fill:{color:i%2===0?CARD2:DGRAY},line:{color:MGRAY,pt:0.3}});s.addText(k,{x:5.95,y:fy,w:1.5,h:0.36,fontSize:9.5,bold:true,color:AMB,fontFace:"Calibri",valign:"middle",margin:0});s.addText(v,{x:7.45,y:fy,w:2.35,h:0.36,fontSize:9,color:WHITE,fontFace:"Calibri",valign:"middle",margin:0});});
card(s,0.2,3.64,5.35,1.85,RED);s.addText("POST-DURAL PUNCTURE HEADACHE (PDPH)",{x:0.3,y:3.68,w:5.15,h:0.28,fontSize:11,bold:true,color:RED,fontFace:"Calibri",margin:0});[["Mechanism","CSF leaks → ↓ pressure → traction on intracranial structures"],["Character","Positional: worse upright, relieved lying flat"],["Prevention","Pencil-point needles (Whitacre/Sprotte); smallest gauge feasible"],["Treatment","EPIDURAL BLOOD PATCH (gold standard, 85–90% success)"]].forEach(([k,v],i)=>{s.addText(k+":",{x:0.3,y:4.0+i*0.38,w:1.5,h:0.34,fontSize:9,bold:true,color:RED,fontFace:"Calibri",margin:0});s.addText(v,{x:1.85,y:4.0+i*0.38,w:3.62,h:0.34,fontSize:9,color:WHITE,fontFace:"Calibri",margin:0});});
card(s,5.78,3.64,4.0,1.85,PURP);s.addText("INTRATHECAL OPIOIDS",{x:5.88,y:3.68,w:3.8,h:0.28,fontSize:11,bold:true,color:PURP,fontFace:"Calibri",margin:0});[{t:"LIPOPHILIC (Fentanyl, Sufentanil)",c:TEAL,pts:["Rapid cord uptake → segmental analgesia","Minimal rostral CSF spread","Shorter duration"]},{t:"HYDROPHILIC (Morphine)",c:PURP,pts:["Slow uptake → rostral spread in CSF","Prolonged analgesia 12–24h","DELAYED RESP DEPRESSION up to 24h","24h respiratory monitoring required"]}].forEach(o=>{let oy=3.98;s.addShape(pres.shapes.RECTANGLE,{x:5.88,y:oy,w:3.8,h:0.22,fill:{color:o.c,transparency:22},line:{color:o.c,pt:0.4}});s.addText(o.t,{x:5.92,y:oy,w:3.76,h:0.22,fontSize:8.5,bold:true,color:BG,fontFace:"Calibri",valign:"middle",margin:0});oy+=0.24;o.pts.forEach(p=>{s.addText("• "+p,{x:5.92,y:oy,w:3.76,h:0.22,fontSize:8.5,color:WHITE,fontFace:"Calibri",margin:0});oy+=0.22;});});}

// ── SLIDE 9: ICP MANAGEMENT ──────────────────────────────────────────────────
{const s=pres.addSlide();bg(s);tbar(s);sbar(s);stitle(s,"ICP MANAGEMENT — ANAESTHETIC STRATEGIES");
s.addShape(pres.shapes.RECTANGLE,{x:0.2,y:0.76,w:9.6,h:0.62,fill:{color:CARD2},line:{color:TEAL,pt:0.8}});s.addText([{text:"GOALS: ",options:{color:TEAL,bold:true}},{text:"Maintain CPP ≥60–70 mmHg  |  Reduce ICP via ↓CBV + ↓CSF volume + ↓brain water  |  Prevent hypoxia, hypercarbia, hypotension",options:{color:WHITE}}],{x:0.3,y:0.83,w:9.4,h:0.48,fontSize:10.5,fontFace:"Calibri",valign:"middle",margin:0});
[[0.2,"VENTILATION & POSITIONING",TEAL,[["Head-up 30°","↓ICP; facilitates venous + CSF drainage (standard)"],["Normocapnia 35 mmHg","Routine; PaCO2 30–35 only in ICP crisis"],["Avoid <30 mmHg","Cerebral ischaemia risk"],["Avoid head rotation","Can obstruct IJV → ↑ICP"],["Avoid excess PEEP","↑ intrathoracic P → ↓ venous drainage"]]],[3.43,"PHARMACOLOGICAL",AMB,[["Mannitol 0.25–1g/kg","Osmotic dehydration of brain — rapid"],["Hypertonic saline 3–23.4%","Sustained osmotic effect"],["Acetazolamide","↓ CSF production ~50% (CA inhibitor)"],["Dexamethasone","Vasogenic oedema from tumours only"],["Barbiturate coma","Burst suppression — refractory ICP"]]],[6.65,"CSF DRAINAGE",GREEN,[["EVD (External Ventricular Drain)","Lateral ventricle; ICP monitor + drain CSF"],["Lumbar CSF drain","Spinal/posterior fossa surgery"],["Target ICP","< 20 mmHg"],["CAUTION","Rapid drainage → herniation risk"],["Decompressive craniotomy","Last resort — refractory ICP"]]]].forEach(([cx,title,col,items])=>{card(s,cx,1.5,3.08,4.0,col);s.addShape(pres.shapes.RECTANGLE,{x:cx,y:1.5,w:3.08,h:0.08,fill:{color:col},line:{color:col}});s.addText(title,{x:cx+0.08,y:1.62,w:2.92,h:0.28,fontSize:10,bold:true,color:col,fontFace:"Calibri",margin:0});items.forEach(([k,v],i)=>{const iy=1.95+i*0.54;s.addShape(pres.shapes.RECTANGLE,{x:cx+0.08,y:iy,w:2.93,h:0.52,fill:{color:i%2===0?CARD2:DGRAY},line:{color:MGRAY,pt:0.3}});s.addText(k,{x:cx+0.12,y:iy+0.03,w:2.86,h:0.23,fontSize:9.5,bold:true,color:WHITE,fontFace:"Calibri",margin:0});s.addText(v,{x:cx+0.12,y:iy+0.27,w:2.86,h:0.22,fontSize:8.8,color:LGRAY,fontFace:"Calibri",margin:0});});});}

// ── SLIDE 10: GLYMPHATIC SYSTEM ──────────────────────────────────────────────
{const s=pres.addSlide();bg(s);tbar(s,PURP);sbar(s,PURP);stitle(s,"THE GLYMPHATIC SYSTEM — ANAESTHETIC RELEVANCE",PURP);
s.addShape(pres.shapes.RECTANGLE,{x:0.2,y:0.76,w:9.6,h:1.0,fill:{color:CARD2},line:{color:PURP,pt:0.8}});s.addText("A newly understood brain waste-clearance system, functionally analogous to the lymphatic system in systemic circulation. The brain lacks traditional lymphatics — only meningeal lymphatics are present.",{x:0.3,y:0.84,w:9.4,h:0.84,fontSize:11.5,color:WHITE,fontFace:"Calibri",margin:0});
card(s,0.2,1.88,4.72,2.58,PURP);s.addText("MECHANISM",{x:0.3,y:1.92,w:4.52,h:0.28,fontSize:11,bold:true,color:PURP,fontFace:"Calibri",margin:0});[{n:"1",t:"CSF enters periarterial spaces",d:"Bounded by vessel walls + astrocyte end-feet"},{n:"2",t:"Aquaporin-4 (AQP4) channels",d:"On astrocyte end-feet facilitate water exchange"},{n:"3",t:"Convection bulk flow",d:"CSF transported to brain parenchyma"},{n:"4",t:"Perivenous accumulation + drainage",d:"Waste → meningeal/cervical lymphatics + cranial nerves"}].forEach((g,i)=>{const gy=2.26+i*0.54;chip(s,0.28,gy,0.35,0.35,g.n,PURP,WHITE);s.addText(g.t,{x:0.72,y:gy,w:4.1,h:0.22,fontSize:10,bold:true,color:WHITE,fontFace:"Calibri",margin:0});s.addText(g.d,{x:0.72,y:gy+0.22,w:4.1,h:0.22,fontSize:9,color:LGRAY,fontFace:"Calibri",margin:0});});
card(s,5.12,1.88,4.68,2.58,PURP);s.addText("ANAESTHETIC RELEVANCE",{x:5.22,y:1.92,w:4.48,h:0.28,fontSize:11,bold:true,color:PURP,fontFace:"Calibri",margin:0});[[TEAL,"↑ During General Anaesthesia","Periarterial space enlarges; waste clearance increased"],[AMB,"Volatile Agents","REDUCE glymphatic transport"],[GREEN,"Dexmedetomidine","BEST preserves glymphatic (NREM sleep-like state)"],[RED,"POCD Connection","Impaired Aβ/tau clearance → cognitive decline research"],[PURP,"Natural Sleep","Peak glymphatic activity — reference state"]].forEach((r,i)=>{const gy=2.26+i*0.44;s.addShape(pres.shapes.OVAL,{x:5.22,y:gy+0.04,w:0.28,h:0.28,fill:{color:r[0]},line:{color:r[0]}});s.addText(r[1],{x:5.6,y:gy,w:2.0,h:0.22,fontSize:9.5,bold:true,color:r[0],fontFace:"Calibri",margin:0});s.addText(r[2],{x:5.6,y:gy+0.22,w:4.1,h:0.2,fontSize:8.8,color:WHITE,fontFace:"Calibri",margin:0});});
card(s,0.2,4.58,9.6,0.9,PURP,CARD2);s.addText([{text:"CLINICAL TAKEAWAY: ",options:{color:PURP,bold:true}},{text:"Choice of anaesthetic may influence long-term cognitive outcomes via glymphatic modulation. Dexmedetomidine (NREM sleep-like state) preserves glymphatic transport better than volatile agents. This underlies ongoing POCD research and may inform agent selection in high-risk patients.",options:{color:WHITE}}],{x:0.3,y:4.65,w:9.4,h:0.76,fontSize:10,fontFace:"Calibri",margin:0});}

// ── SLIDE 11: VIVA SUMMARY ───────────────────────────────────────────────────
{const s=pres.addSlide();bg(s);tbar(s,AMB);sbar(s,AMB);stitle(s,"VIVA SUMMARY — KEY NUMBERS & RAPID FIRE",AMB);
const grps=[{cat:"PRODUCTION",c:TEAL,items:[["Rate","0.35 mL/min = 21 mL/hr = 450–500 mL/day"],["Total volume","~150 mL (intracranial 100 + spinal 50 mL)"],["Turnover","3–4× per day"],["Peak production","During sleep (circadian rhythm)"]]},{cat:"ANATOMY",c:GREEN,items:[["4th ventricle exits","Luschka ×2 (lateral) + Magendie ×1 (median)"],["Absorption site","Arachnoid granulations → superior sagittal sinus"],["LP level","L3–4 or L4–5 (conus at L1–2)"],["CSF specific gravity","1.003–1.008 at 37°C"]]},{cat:"ICP & CPP",c:AMB,items:[["Normal ICP","5–15 mmHg (70–180 mmH2O)"],["CPP formula","MAP − ICP (target ≥60, TBI ≥70 mmHg)"],["PaCO2 & CBF","1 mmHg ↓ PaCO2 = ↓ CBF ~3%"],["Hyperventilation","30–35 mmHg crisis only; NEVER <30 mmHg"]]},{cat:"DRUGS",c:RED,items:[["Best for raised ICP","Propofol or thiopental"],["Avoid raised ICP","Ketamine (↑CBF/CMRO2), N2O"],["Best volatile neuro","Sevoflurane ≤1 MAC"],["↓ CSF production","Acetazolamide (CA inhibitor, ~50%)"]]},{cat:"SPINAL / PDPH",c:PURP,items:[["Hyperbaric","Sinks; position controls level"],["PDPH mechanism","CSF leak → ↓ pressure → traction on structures"],["PDPH treatment","Epidural blood patch (85–90% success)"],["IT morphine","Delayed resp. depression up to 24h"]]},{cat:"GLYMPHATIC",c:TEAL,items:[["During GA","Periarterial space enlarges → ↑ waste clearance"],["Volatile agents","Reduce glymphatic transport"],["Dexmedetomidine","Best preserves glymphatic function"],["POCD link","Aβ/tau accumulation — active research area"]]}];
[[0,3],[3,6]].forEach(([a,b],ci)=>{grps.slice(a,b).forEach((grp,gi)=>{const cx=0.2+ci*5.0,cy=0.78+gi*1.55;card(s,cx,cy,4.7,1.5,grp.c);s.addShape(pres.shapes.RECTANGLE,{x:cx,y:cy,w:4.7,h:0.08,fill:{color:grp.c},line:{color:grp.c}});s.addText(grp.cat,{x:cx+0.08,y:cy+0.1,w:4.54,h:0.26,fontSize:10,bold:true,color:grp.c,fontFace:"Calibri",margin:0});grp.items.forEach(([k,v],i)=>{const iy=cy+0.4+i*0.26;s.addText(k+":",{x:cx+0.08,y:iy,w:1.6,h:0.24,fontSize:9,bold:true,color:LGRAY,fontFace:"Calibri",margin:0});s.addText(v,{x:cx+1.72,y:iy,w:2.9,h:0.24,fontSize:9,color:WHITE,fontFace:"Calibri",margin:0});});});});}

pres.writeFile({fileName:"/home/daytona/workspace/csf-anaesthesia/CSF_Anaesthesia.pptx"})
  .then(()=>console.log("Done"))
  .catch(e=>{console.error(e);process.exit(1);});
Running Command

cd /home/daytona/workspace/csf-anaesthesia && node make_ppt.js 2>&1

Running Command

ls -lh /home/daytona/workspace/csf-anaesthesia/CSF_Anaesthesia.pptx

Your presentation is ready!

CSF Anaesthesia

Presentation · PPTX


11 slides — deep navy + teal + amber color scheme:
SlideContent
1Title slide
2Outline
3Anatomy of CSF Compartments (ventricular pathway + spinal landmarks)
4Formation of CSF (2 phases, barrier, rate/volume, circadian)
5CSF Composition Table + Circulation pathway diagram
6Monro-Kellie Doctrine, 3 components, CPP formula, compensatory mechanisms
7Anaesthetic effects on ICP/CSF — full comparison table (10 agents)
8Spinal anaesthesia — baricity, block factors, PDPH, intrathecal opioids
9ICP management — ventilation/positioning, pharmacology, CSF drainage
10Glymphatic system — mechanism + anaesthetic relevance
11Viva summary — 6 category rapid-fire reference

Test and types of autoregulation in CNS in Anesthesia

Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Finding Sources
Reading File
Finding Sources
Loading Image
Reading File
Reading File
Reading File
I now have comprehensive content. Let me compose the full MD Anaesthesia-level answer.

Autoregulation in the CNS — Types, Tests & Anaesthetic Importance


1. What is Cerebral Autoregulation?

Autoregulation refers to the intrinsic capacity of the cerebral circulation to maintain a relatively constant cerebral blood flow (CBF) over a wide range of mean arterial pressure (MAP) values, despite changes in perfusion pressure.
The concept originates from the classic review by Lassen (1959), which described CBF being held constant at approximately 50 mL/100 g/min over a MAP range of 50–150 mmHg.
However, the current view in Miller's Anesthesia (10e) emphasizes that the "static, flat plateau" of Lassen is outdated. Autoregulation is now understood as a dynamic, integrative process influenced by multiple interdependent variables — not a simple pressure-passive or pressure-independent switch.
Integrated cerebral autoregulation showing variation in lower limit, plateau, and upper limit, with inputs from neurogenic control, cardiovascular function, myogenic autoregulation, neurovascular coupling, vascular reactivity, anesthetics, and vasoactive agents
Integrated regulation of cerebral vessels — modern view (Miller's Anesthesia, 10e, Fig. 10.10)

2. Regulation of Cerebral Blood Flow — Overview

Normal CBF: 50 mL/100 g/min (grey matter ~80 mL/100 g/min; white matter ~20 mL/100 g/min)
The mechanisms regulating CBF include:
  1. Myogenic (pressure autoregulation)
  2. Metabolic / Chemical (CO₂, O₂, pH)
  3. Neurogenic
  4. Neurovascular coupling (flow-metabolism coupling)
  5. Endothelial (NO, prostaglandins, endothelin)
These are described in Miller's Table 10.1 as chemical, myogenic, and neurogenic factors — and they act in an interdependent, integrated manner.

3. Types of Autoregulation


3.1 Pressure Autoregulation (Myogenic Autoregulation)

Mechanism:
  • The Bayliss myogenic response — smooth muscle in cerebrovascular walls responds to transmural pressure changes
  • ↑ perfusion pressure → active vasoconstriction (prevents overperfusion)
  • ↓ perfusion pressure → active vasodilation (prevents underperfusion)
  • Operates predominantly in pial arteries and arterioles
Classic Lassen Curve:
Pressure RangeCBF Behaviour
MAP < 50 mmHg (below LLA)CBF falls (pressure-passive)
MAP 50–150 mmHg (plateau)CBF maintained ~50 mL/100 g/min
MAP > 150 mmHg (above ULA)CBF rises (breakthrough, forced dilatation)
Modern revision of Lassen:
  • The plateau is not flat — has a gentle upslope
  • The range of pressure-passivity is wider than classically believed
  • Lower and upper limits vary considerably between individuals
  • Measured autoregulatory curves show variation in lower limit, plateau, and upper limit
Static vs Dynamic autoregulation:
ParameterStatic AutoregulationDynamic Autoregulation
Time frameMinutes (~10 min)Seconds to minutes
BP changeSlow, sustainedRapid, transient
MethodPharmacologic MAP manipulationThigh cuff deflation → rapid MAP drop
MeasurementCBF at steady stateMCAfv (TCD) response
PlateauWider, flat-lookingNarrower, more slope
Clinical usePharmacologic testingBedside assessment (PRx, COx)
Static autoregulation allows the measured variables to achieve steady state; dynamic autoregulation uses rapid, transient MAP reductions (e.g., thigh cuff deflation) to assess the buffering capacity of the cerebral circulation.

3.2 Metabolic / Chemical Autoregulation

3.2.1 CO₂ Reactivity (PaCO₂)

The most powerful acute regulator of CBF. CBF varies linearly with PaCO₂ in the range of 20–80 mmHg.
Mechanism:
  • CO₂ freely diffuses across the blood-brain barrier
  • Alters extracellular pH in the perivascular space
  • H⁺-mediated NO release, adenosine, arachidonic acid metabolites, reactive oxygen species → vasodilation
  • Acidosis (↑CO₂) → vasodilation → ↑CBF
  • Alkalosis (↓CO₂) → vasoconstriction → ↓CBF
Quantitative:
  • Each 1 mmHg ↑ PaCO₂ → ↑ CBF ~3% (linear response ~20–80 mmHg)
  • Below PaCO₂ ~25 mmHg: further CBF reduction is limited (vasospasm limit)
  • Above PaCO₂ ~75–80 mmHg: response is attenuated
Effect on autoregulation:
  • Hypercarbia → cerebral vasodilation → attenuates autoregulatory response to hypertension → autoregulation becomes pressure-passive at lower MAP
  • Hypocapnia → vasoconstriction → autoregulation maintained over wider MAP range
Duration:
  • Effect is not sustained — despite maintained arterial pH change, CBF returns toward normal in 6–8 hours as bicarbonate is extruded from CSF (pH normalizes)
Clinical consequence (rebound):
  • After prolonged hyperventilation: acute return to normal PaCO₂ → CSF acidosis → ↑CBF → ↑ICP
  • After prolonged hypoventilation: acute normalization → CSF alkalosis → risk of ischaemia
Relationship to MAP:
  • Moderate hypotension (MAP ↓ <33%): CO₂ responsiveness is significantly attenuated
  • Severe hypotension (MAP ↓ ~66%): CO₂ responsiveness is abolished

3.2.2 Oxygen (PaO₂)

  • PaO₂ 60–300 mmHg: little influence on CBF
  • PaO₂ < 60 mmHg → rapid ↑ CBF (critical threshold corresponding to fall in SpO₂)
  • Relationship between CBF and haemoglobin saturation is inversely linear
  • Mechanism: hypoxia → local adenosine release, ↓pH, NO release → vasodilation
  • Haematic hypoxia (e.g., anaemia): reduction in oxygen content with normal PaO₂ also triggers compensatory ↑CBF
Anaemia and CBF:
  • Haematocrit ↓ → ↓ viscosity + ↓ O₂ content → ↑CBF
  • At low haematocrit, the benefit of ↓ viscosity is outweighed by ↓O₂ carrying capacity
  • Optimal haematocrit for cerebral O₂ delivery: ~30–35% (balance of viscosity and O₂ content)

3.2.3 Metabolic/Flow-Metabolism Coupling (Neurovascular Coupling)

Principle: CBF is tightly coupled to local neuronal metabolic activity (CMRO₂). An area of increased neural activity receives proportionally increased flow.
Mechanism:
  • Neuronal activity → release of K⁺, H⁺, adenosine, CO₂, arachidonic acid metabolites → perivascular vasodilation
  • Astrocytes (glial cells) act as intermediaries → release vasoactive substances (NO, arachidonic acid derivatives)
  • Potassium siphoning by astrocytes also contributes
Anaesthetic relevance:
  • Volatile agents cause uncoupling — they increase CBF despite decreasing CMRO₂ (direct vasodilation exceeds metabolic suppression)
  • IV agents (propofol, thiopental) maintain or improve coupling — they reduce CMRO₂ and CBF in parallel
Dose-response with barbiturates:
  • Progressive reduction in CMRO₂ and CBF with increasing barbiturate dose
  • Maximum effect at isoelectric EEG (electrophysiologic silence)
  • Beyond this point, no further reduction — only basal metabolic activity (cellular homeostasis) persists
  • Additional barbiturate causes no further CMRO₂ or CBF reduction

3.3 Neurogenic Autoregulation

Innervation:
  • Cerebral vessels receive sympathetic, parasympathetic, and sensory innervation
  • Sympathetic: from superior cervical ganglia → travels with cerebral arteries → supplies large + penetrating arteries
  • Parasympathetic: from pterygopalatine ganglion → cholinergic vasodilator input
  • Sensory: trigeminal nerve → peptide-mediated (CGRP, substance P)
Normally limited role:
  • Mild-to-moderate sympathetic stimulation causes little change in CBF — myogenic and metabolic mechanisms override
  • Sympathetic influence becomes important in protecting against acute severe hypertension — prevents high pressure from reaching small vessels and causing haemorrhage (stroke prevention)
Clinical importance:
  • Medications affecting sympathetic tone (β-agonists, α₂-agonists, ACE inhibitors, ARBs, calcium channel blockers) all modulate autoregulation
  • Dexmedetomidine (α₂-agonist): reduces sympathetic outflow → affects cerebrovascular tone

3.4 Endothelial Autoregulation

The vascular endothelium produces and responds to vasoactive mediators:
MediatorEffectStimulus
Nitric oxide (NO)VasodilationShear stress, acetylcholine, hypoxia, CO₂
Prostacyclin (PGI₂)VasodilationShear stress
Endothelin-1VasoconstrictionStretch, angiotensin II, thrombin
Thromboxane A₂VasoconstrictionPlatelet activation
AdenosineVasodilationMetabolic demand, hypoxia

4. Static vs Dynamic Autoregulation — Detailed Comparison

FeatureStaticDynamic
DefinitionCBF maintained constant with slow MAP changesCBF buffering with rapid transient MAP changes
Time frame~10 min per BP stepSeconds to ~2 min
BP change methodPharmacologic (phenylephrine, nitroprusside, tilt)Thigh cuff deflation, sit-to-stand, Valsalva
MeasurementCBF (Xe-133, PET, MRI, TCD)Middle cerebral artery flow velocity (TCD)
Outcome measureAutoregulatory index (plateau slope)Phase shift, gain, transfer function, PRx
Plateau width~50–150 mmHg (Lassen); ~70–150 mmHg (modern)Narrower (rapid changes less buffered)
Clinical usePharmacologic BP managementBedside continuous monitoring (ICP/BP)
Rate-dependenceMinimalCritical — faster changes = less buffering

5. Tests of Cerebral Autoregulation

5.1 Transcranial Doppler (TCD) — Most Used Clinically

Measures: Middle cerebral artery flow velocity (MCAfv) as a surrogate for CBF
Tests:
TestMethodMeasure
Thigh cuff testRapid cuff deflation → transient ↓MAPMCAfv recovery; ARI (Autoregulatory Index)
Transient hyperaemic response test (THRT)Brief carotid compression → releaseHyperaemic overshoot = intact autoregulation
Tilt-table / head-up tiltPostural BP changeMCAfv vs MAP phase relationship
Transfer function analysisSpontaneous BP oscillations (0.07–0.2 Hz)Gain and phase between MAP and MCAfv
Autoregulatory Index (ARI):
  • Scale of 0–9 (Tiecks et al.)
  • 0 = complete pressure-passivity (no autoregulation)
  • 9 = perfect autoregulation
  • ARI ≥ 4 considered normal; ARI < 4 = impaired

5.2 Pressure Reactivity Index (PRx) — ICP-Based

Used in: ICU/neurocritical care, TBI monitoring
Method:
  • Continuous simultaneous recording of ABP and ICP
  • Calculate rolling correlation coefficient between MAP and ICP over 5-minute windows
  • PRx = Pearson correlation coefficient (MAP vs ICP)
Interpretation:
PRx valueMeaning
Negative (−1 to 0)Active autoregulation — ICP inversely reactive to MAP
Near zeroNo relationship — intermediate
Positive (+0.3 to +1)Impaired autoregulation — pressure-passive CBF
Optimal CPP (CPPopt):
  • U-shaped relationship between PRx and CPP
  • The MAP at the nadir (lowest PRx) = optimal CPP where autoregulation is most effective
  • Managing TBI patients to CPPopt is associated with better outcomes

5.3 Cerebral Oximetry Index (COx / TOx)

Method:
  • Correlation between MAP and regional cerebral oxygen saturation (rSO₂) measured by Near-Infrared Spectroscopy (NIRS)
  • COx = correlation coefficient between MAP and rSO₂
Interpretation:
  • COx near 0 or negative = intact autoregulation (rSO₂ buffered from MAP changes)
  • COx > 0.3–0.4 = impaired autoregulation
  • Used in cardiac surgery, TBI — can derive optimal MAP from U-shaped COx-MAP curve

5.4 Laser Doppler Flowmetry

  • Continuous cortical CBF measurement
  • Invasive (intraoperative) or perioperative
  • Provides real-time CBF data for autoregulation assessment
  • Used in experimental and intraoperative neurosurgical settings

5.5 Xe-133 Clearance / PET / MRI

  • Gold standard measurement of absolute CBF
  • Used in research and select clinical settings
  • Static autoregulation curves derived from multiple BP levels

5.6 Near-Infrared Spectroscopy (NIRS) — Non-Invasive Bedside

Hemoglobin Reactivity Index (HVRx or HbD reactivity index):
  • Non-invasive; measures oxygenated vs deoxygenated Hb changes with BP fluctuations
  • Used in neonates, cardiac surgery, TBI
  • Optimal MAP for cardiac surgery derived from NIRS-based autoregulation monitoring

6. Conditions Affecting Autoregulation

6.1 Physiological Shifts

ConditionEffect on Autoregulation
Hypercarbia (↑PaCO₂)Attenuates; narrows plateau; LLA rises
Hypocapnia (↓PaCO₂)Enhances; widens plateau
Hypoxia (PaO₂ <60 mmHg)Impairs
Chronic hypertensionShifts entire curve to RIGHT (higher MAP range)
Acute severe hypotensionCO₂ reactivity abolished

6.2 Disease States

ConditionEffect
Traumatic brain injury (TBI)Commonly impaired; pressure-passive CBF
Subarachnoid haemorrhageImpaired especially in vasospasm period
Stroke / acute ischaemiaAbolished in penumbral tissue
PreeclampsiaImpaired → pressure-dependent CBF → oedema, seizures
SepsisImpaired in severe cases
Prematurity (neonates)Poorly developed; pressure-passive
Chronic hypertensionShifted right; vulnerable to rapid BP reduction
Atherosclerosis, old ageImpaired
HypoglycaemiaCan impair

7. Anaesthetic Agents and Autoregulation

7.1 Intravenous Agents

AgentEffect on AutoregulationMechanism
PropofolPRESERVED↓ CMRO₂ → ↓ CBF proportionally; vasoconstriction coupled to metabolism
ThiopentalPRESERVED (at anaesthetic doses)↓ CMRO₂ → ↓ CBF; cerebrovascular tone maintained
EtomidatePRESERVED↓ CMRO₂ → ↓ CBF
KetamineIMPAIRED↑ CMRO₂ → ↑ CBF; direct vasodilation; uncoupling
MidazolamLargely PRESERVEDMild CMRO₂ reduction
DexmedetomidinePRESERVEDα₂ agonist; coupled reduction in CBF and CMRO₂; reduces sympathetic tone
OpioidsPRESERVEDMinimal direct effect; ↓ CMRO₂

7.2 Volatile Agents

All volatile agents impair autoregulation in a dose-dependent manner:
  • Mechanism: Direct cerebral vasodilation → pressure-passive CBF at high doses
  • Net effect = sum of indirect vasoconstriction (via ↓CMRO₂) and direct vasodilation
AgentAutoregulationVasodilation potencyNotes
SevofluraneBest preserved (~1 MAC)LeastPreserves up to ~1 MAC; dynamic ARi better than isoflurane at 1.5 MAC
IsofluraneImpaired dose-dependentlyModerateHyperventilation blunts increase in ICP
DesfluraneImpairedMostAirway irritation → ↑MAP → ↑ICP; avoid in raised ICP
HalothaneMost impairedMaximumVasodilates even at low concentrations (0.5 MAC); no longer used
N₂OImpairedModerate↑ CMRO₂ and CBF; avoid in raised ICP
At high anaesthetic doses (>1.5–2 MAC), CBF becomes essentially pressure-passive with all volatile agents.

8. The Flow-Metabolism Uncoupling with Volatiles

  • Volatile agents decrease CMRO₂ but simultaneously cause direct vasodilation
  • This is called "functional uncoupling" — CBF ↑ or → unchanged despite CMRO₂ ↓
  • From a mechanistic standpoint, true uncoupling may not occur: there is still a coupled CMRO₂-driven vasoconstriction, opposed by a direct vasodilatory effect
  • Net result depends on which effect dominates at a given MAC

9. Factors Modulating Autoregulation — Summary

FactorEffect
↑ PaCO₂Impairs (vasodilation → pressure-passive)
↓ PaCO₂Enhances (widens autoregulatory range)
Hypoxia (PaO₂ <60)Impairs
Severe hypotensionAbolishes CO₂ reactivity
Volatile anaestheticsDose-dependent impairment
IV agents (propofol, thiopental)Preserved or enhanced
SympathomimeticsModulate (α₁ agents: ↑ SVR, may ↓ CO)
Nitrates, Ca²⁺ channel blockersImpair (vasodilators)
ACE inhibitors, ARBsModulate
β-agonistsModulate via CO effect
Chronic hypertensionRightward shift of curve
TBI, stroke, SAHImpaired/abolished
Age, atherosclerosisImpaired

10. Clinical Applications of Autoregulation in Anaesthesia

10.1 Blood Pressure Management Intraoperatively

  • Within autoregulatory range: BP changes have minimal CBF effect
  • Outside autoregulatory range (pressure-passive): every MAP change directly changes CBF and ICP
  • Vasopressor choice matters:
    • Phenylephrine (α₁-agonist): ↑ SVR → may ↓ CO → compromised CBF (especially with bolus)
    • Ephedrine (α+β): maintains or ↑ CO + MAP → better CBF maintenance
    • After volume optimization, prefer agents that maintain/increase both CO and MAP

10.2 Anaesthetic Agent Selection for Neurosurgery

  • Prefer TIVA (propofol + opioid) for raised ICP → preserved autoregulation, ↓ CBV
  • If volatile required: sevoflurane ≤ 1 MAC + normocapnia → autoregulation maintained
  • Avoid desflurane in patients with raised ICP
  • Ketamine: avoid in raised ICP (uncoupling, ↑ CBF, ↑ CMRO₂)

10.3 Targeted MAP Management — CPPopt

  • In TBI patients: use PRx monitoring to identify CPPopt
  • Manage MAP to keep CPP within optimal range where PRx is most negative
  • Prevents both: ischaemia (CPP too low) and hyperaemia/oedema (CPP too high)

10.4 CO₂ Management

  • Normocapnia (PaCO₂ 35–40 mmHg): standard
  • Hyperventilation (PaCO₂ 30–35 mmHg): for acute ICP crisis only — bridge therapy
  • PaCO₂ < 30 mmHg: risk of ischaemia (vasoconstriction beyond safety threshold)
  • Chronic hyperventilation not sustained — pH normalizes in 6–8 hours

10.5 Cardiac Surgery

  • Prolonged CPB → potential impairment of autoregulation
  • NIRS-based autoregulation monitoring (COx/HVRx) allows determination of individual optimal MAP
  • Above the ULA: risk of cerebral hyperaemia, oedema, intracerebral haemorrhage
  • Below the LLA: risk of ischaemia, cognitive dysfunction, stroke

11. Key Viva Questions

QA
Define autoregulationIntrinsic capacity of cerebral circulation to maintain constant CBF over MAP 50–150 mmHg
Classic LLA and ULALLA ~50 mmHg, ULA ~150 mmHg (Lassen); modern view: variation exists
Normal CBF~50 mL/100 g/min
Types of autoregulationPressure (myogenic), metabolic (CO₂, O₂, pH), neurogenic, endothelial, neurovascular coupling
Static vs dynamic autoregulationStatic = slow BP changes over ~10 min; Dynamic = rapid transient BP changes (thigh cuff)
Best test of autoregulation at bedsidePRx (ICP-based) or COx/NIRS (non-invasive)
PRx > +0.3 means?Impaired autoregulation — pressure-passive CBF
CPPopt definitionMAP at nadir of U-shaped PRx curve — where autoregulation most effective
Each 1 mmHg ↑ PaCO₂↑ CBF ~3%
Why does CBF not decrease below PaCO₂ 25 mmHg?Further vasoconstriction limited — ischaemia threshold reached
Effect of hypercarbia on autoregulationAttenuates; narrows autoregulatory plateau; LLA rises
Effect of hypocapniaEnhances; widens autoregulatory range
Why CO₂ reactivity is abolished in severe hypotensionMAP reduction ~66% → cerebral vasculature already maximally dilated
Best volatile for neuroanaesthesiaSevoflurane ≤ 1 MAC — best preserves autoregulation
Why ketamine contraindicated in raised ICPUncouples flow-metabolism → ↑ CBF + ↑ CMRO₂ + direct vasodilation
Shift of autoregulation curve in hypertensionRightward — higher MAP range needed for adequate perfusion; rapid BP reduction risks ischaemia
ARI scale0–9: ARI 0 = no autoregulation; ARI 9 = perfect
Bayliss responseMyogenic response — vessel wall contracts in response to increased transmural pressure

Sources: Miller's Anesthesia 10e (Chapter 10) | Barash Clinical Anesthesia 9e | Guyton & Hall Medical Physiology | Boron & Boulpaep Medical Physiology

Make a ppt

Running Command

mkdir -p /home/daytona/workspace/autoregulation-ppt

Writing File

~/autoregulation-ppt/make_ppt.js

const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "CNS Autoregulation in Anaesthesia";

// ── Palette ──
const BG="0A1628",CARD="112035",CARD2="162840",DGRAY="1E3448",MGRAY="4A6278",LGRAY="8EAABF";
const TEAL="00BCD4",GREEN="26A69A",AMB="FFA726",RED="EF5350",PURP="7E57C2",WHITE="FFFFFF",GOLD="FFD54F",PINK="E91E63";

// ── Helpers ──
const bg=s=>s.addShape(pres.shapes.RECTANGLE,{x:0,y:0,w:10,h:5.625,fill:{color:BG},line:{color:BG}});
const tbar=(s,c="00BCD4")=>s.addShape(pres.shapes.RECTANGLE,{x:0,y:0,w:10,h:0.08,fill:{color:c},line:{color:c}});
const sbar=(s,c="00BCD4")=>s.addShape(pres.shapes.RECTANGLE,{x:0,y:0,w:0.1,h:5.625,fill:{color:c},line:{color:c}});
const stitle=(s,txt,c="00BCD4")=>{s.addText(txt,{x:0.25,y:0.12,w:9.5,h:0.5,fontSize:19,bold:true,color:c,fontFace:"Calibri",margin:0});s.addShape(pres.shapes.RECTANGLE,{x:0.25,y:0.65,w:1.2,h:0.04,fill:{color:AMB},line:{color:AMB}});};
const card=(s,x,y,w,h,bc=TEAL,fc=CARD)=>s.addShape(pres.shapes.RECTANGLE,{x,y,w,h,fill:{color:fc},line:{color:bc,pt:1.2},shadow:{type:"outer",color:"000000",blur:7,offset:3,angle:135,opacity:0.18}});
const chip=(s,x,y,w,h,lbl,fc,tc="000000")=>{s.addShape(pres.shapes.RECTANGLE,{x,y,w,h,fill:{color:fc},line:{color:fc}});s.addText(lbl,{x,y,w,h,fontSize:9,bold:true,color:tc,fontFace:"Calibri",align:"center",valign:"middle",margin:0});};
const bar=(s,x,y,w,h,c)=>s.addShape(pres.shapes.RECTANGLE,{x,y,w,h,fill:{color:c},line:{color:c}});

// ══════════════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ══════════════════════════════════════════════════════════════════════════
{const s=pres.addSlide();bg(s);
bar(s,0,0,10,0.1,TEAL);bar(s,0,5.525,10,0.1,AMB);
s.addShape(pres.shapes.OVAL,{x:6.3,y:-1.4,w:5.5,h:5.5,fill:{color:TEAL,transparency:90},line:{color:TEAL,transparency:85,pt:1.5}});
s.addShape(pres.shapes.OVAL,{x:7.1,y:-0.7,w:3.5,h:3.5,fill:{color:TEAL,transparency:94},line:{color:TEAL,transparency:88,pt:1}});
bar(s,0.5,0.92,1.5,1.5,TEAL);
s.addText("AR",{x:0.5,y:0.92,w:1.5,h:1.5,fontSize:40,bold:true,color:BG,fontFace:"Calibri",align:"center",valign:"middle",margin:0});
s.addText("CNS AUTOREGULATION",{x:2.3,y:0.9,w:7.4,h:0.68,fontSize:36,bold:true,color:WHITE,fontFace:"Calibri",charSpacing:3,margin:0});
s.addText("Types · Tests · Mechanisms · Anaesthetic Importance",{x:2.3,y:1.62,w:7.4,h:0.44,fontSize:20,color:TEAL,fontFace:"Calibri",margin:0});
bar(s,2.3,2.16,5.5,0.04,AMB);
s.addText("MD Anaesthesia  |  Neuroanaesthesia · Neurophysiology · Critical Care",{x:2.3,y:2.26,w:7.4,h:0.34,fontSize:13,color:LGRAY,fontFace:"Calibri",italic:true,margin:0});
s.addText("Miller's Anesthesia 10e  ·  Barash 9e  ·  Guyton & Hall  ·  Boron & Boulpaep",{x:0.3,y:5.22,w:9.4,h:0.25,fontSize:8,color:MGRAY,fontFace:"Calibri",align:"center",margin:0});}

// ══════════════════════════════════════════════════════════════════════════
// SLIDE 2 — OUTLINE
// ══════════════════════════════════════════════════════════════════════════
{const s=pres.addSlide();bg(s);tbar(s);sbar(s);stitle(s,"OUTLINE");
const T=[{n:"01",t:"Definition & Classical Lassen Curve"},{n:"02",t:"Modern Integrated View"},{n:"03",t:"Types of Autoregulation"},{n:"04",t:"CO₂ & O₂ Reactivity"},{n:"05",t:"Neurovascular / Flow-Metabolism Coupling"},{n:"06",t:"Static vs Dynamic Autoregulation"},{n:"07",t:"Tests of Autoregulation (PRx, TCD, NIRS)"},{n:"08",t:"Anaesthetic Agents & Autoregulation"},{n:"09",t:"Conditions Affecting Autoregulation"},{n:"10",t:"Clinical Applications & Viva Summary"}];
[[0,5],[5,10]].forEach(([a,b],ci)=>{T.slice(a,b).forEach((item,i)=>{const sx=0.3+ci*4.88,y=0.85+i*0.88;chip(s,sx,y,0.55,0.42,item.n,TEAL,"000000");s.addText(item.t,{x:sx+0.65,y,w:4.1,h:0.42,fontSize:13,color:WHITE,fontFace:"Calibri",valign:"middle",margin:0});if(i<4)bar(s,sx,y+0.45,4.65,0.02,MGRAY);});});}

// ══════════════════════════════════════════════════════════════════════════
// SLIDE 3 — DEFINITION + LASSEN CURVE
// ══════════════════════════════════════════════════════════════════════════
{const s=pres.addSlide();bg(s);tbar(s);sbar(s);stitle(s,"DEFINITION & THE CLASSICAL LASSEN CURVE");
// Definition card
card(s,0.2,0.76,9.6,1.08,TEAL);
s.addText("DEFINITION",{x:0.3,y:0.8,w:2,h:0.28,fontSize:11,bold:true,color:TEAL,fontFace:"Calibri",margin:0});
s.addText("The intrinsic capacity of the cerebral circulation to maintain a relatively CONSTANT CBF over a wide range of mean arterial pressure (MAP) values, despite changes in perfusion pressure.",{x:0.3,y:1.08,w:9.4,h:0.7,fontSize:12,color:WHITE,fontFace:"Calibri",margin:0});
// Graph (manual drawing)
card(s,0.2,2.0,5.5,3.42,TEAL,CARD2);
s.addText("LASSEN CURVE — CBF vs MAP",{x:0.3,y:2.04,w:5.3,h:0.28,fontSize:11,bold:true,color:TEAL,fontFace:"Calibri",margin:0});
// Axes
bar(s,0.6,2.4,0.04,2.7,LGRAY);bar(s,0.62,5.08,4.7,0.04,LGRAY);
// Labels
s.addText("CBF",{x:0.18,y:3.5,w:0.5,h:0.3,fontSize:8.5,color:LGRAY,fontFace:"Calibri",margin:0,bold:true});
s.addText("(mL/100g/min)",{x:0.12,y:3.8,w:0.55,h:0.25,fontSize:7,color:MGRAY,fontFace:"Calibri",margin:0});
s.addText("MAP (mmHg)",{x:2.5,y:5.12,w:2.0,h:0.25,fontSize:8.5,color:LGRAY,fontFace:"Calibri",margin:0,bold:true});
// X axis markers
["0","50","100","150"].forEach((v,i)=>{const x=0.62+i*1.15;s.addText(v,{x:x-0.1,y:5.14,w:0.4,h:0.2,fontSize:7.5,color:LGRAY,fontFace:"Calibri",margin:0,align:"center"});});
// Y axis marker
s.addText("50",{x:0.28,y:3.68,w:0.3,h:0.2,fontSize:7.5,color:LGRAY,fontFace:"Calibri",margin:0});
// Pressure-passive low (left)
bar(s,0.62,4.5,1.15,0.04,RED);// rising line low MAP
// Plateau
bar(s,1.77,3.72,2.3,0.04,TEAL);
// Pressure-passive high (right)
bar(s,4.07,3.72,0.04,0.76,RED);
// "Flat plateau" arrow spans
s.addText("←  LLA  →",{x:0.7,y:4.58,w:1.1,h:0.25,fontSize:8,color:RED,fontFace:"Calibri",margin:0,bold:true,align:"center"});
s.addText("←    PLATEAU    →",{x:1.85,y:3.34,w:2.1,h:0.3,fontSize:9,color:TEAL,fontFace:"Calibri",margin:0,bold:true,align:"center"});
s.addText("←  ULA  →",{x:4.0,y:3.34,w:1.0,h:0.25,fontSize:8,color:RED,fontFace:"Calibri",margin:0,bold:true,align:"center"});
s.addText("MAP: 50 mmHg",{x:1.72,y:4.72,w:1.0,h:0.25,fontSize:7.5,color:AMB,fontFace:"Calibri",margin:0,bold:true});
s.addText("MAP: 150 mmHg",{x:3.88,y:4.72,w:1.1,h:0.25,fontSize:7.5,color:AMB,fontFace:"Calibri",margin:0,bold:true});
s.addText("CBF ~50 mL/100g/min",{x:1.9,y:3.54,w:2.0,h:0.2,fontSize:8,color:TEAL,fontFace:"Calibri",margin:0,align:"center"});
// Right — Lassen details + modern revision
card(s,5.9,2.0,4.05,3.42,AMB);
s.addText("LASSEN (1959) — CLASSICAL",{x:6.0,y:2.04,w:3.85,h:0.28,fontSize:11,bold:true,color:AMB,fontFace:"Calibri",margin:0});
[["CBF held constant","~50 mL/100 g/min"],["MAP plateau","50–150 mmHg"],["Below LLA","CBF pressure-passive ↓"],["Above ULA","Forced dilatation, hyperaemia"],["Lassen's data","Heterogeneous sample, 7 studies"]].forEach(([k,v],i)=>{const fy=2.38+i*0.38;s.addShape(pres.shapes.RECTANGLE,{x:6.0,y:fy,w:3.85,h:0.36,fill:{color:i%2===0?CARD2:DGRAY},line:{color:MGRAY,pt:0.3}});s.addText(k,{x:6.06,y:fy,w:2.0,h:0.36,fontSize:9.5,bold:true,color:AMB,fontFace:"Calibri",valign:"middle",margin:0});s.addText(v,{x:8.06,y:fy,w:1.75,h:0.36,fontSize:9,color:WHITE,fontFace:"Calibri",valign:"middle",margin:0});});
bar(s,6.0,4.32,3.85,0.04,RED);
s.addText("MODERN REVISION",{x:6.0,y:4.38,w:3.85,h:0.24,fontSize:10,bold:true,color:RED,fontFace:"Calibri",margin:0});
["Plateau has gentle UPSLOPE (not flat)","Range of pressure-passivity is WIDER","LLA and ULA vary between individuals","Autoregulation is DYNAMIC, not static"].forEach((p,i)=>s.addText("▸ "+p,{x:6.0,y:4.66+i*0.24,w:3.85,h:0.22,fontSize:9,color:WHITE,fontFace:"Calibri",margin:0}));}

// ══════════════════════════════════════════════════════════════════════════
// SLIDE 4 — TYPES OF AUTOREGULATION
// ══════════════════════════════════════════════════════════════════════════
{const s=pres.addSlide();bg(s);tbar(s);sbar(s);stitle(s,"TYPES OF AUTOREGULATION");
const types=[
  {title:"MYOGENIC (Pressure)",col:TEAL,x:0.2,y:0.76,pts:["Bayliss myogenic response","↑ perfusion pressure → vasoconstriction","↓ perfusion pressure → vasodilation","Operates in pial arteries & arterioles","Most classical type — forms the plateau","Intrinsic smooth muscle response to wall stretch"]},
  {title:"METABOLIC / CHEMICAL",col:GREEN,x:3.42,y:0.76,pts:["PaCO₂: most powerful acute regulator","1 mmHg ↑ CO₂ → ↑ CBF ~3%","O₂: PaO₂ <60 mmHg → rapid ↑ CBF","pH: acidosis → vasodilation","Adenosine, K⁺, arachidonic metabolites","Acts via extracellular pH changes in brain"]},
  {title:"NEUROGENIC",col:AMB,x:6.63,y:0.76,pts:["Sympathetic: superior cervical ganglia","Parasympathetic: pterygopalatine ganglion","Sensory: trigeminal (CGRP, substance P)","Normally OVERRIDDEN by myogenic/metabolic","Important in ACUTE HYPERTENSION — stroke prevention","Modulated by dex, β-agonists, ACE-i, ARBs"]},
  {title:"NEUROVASCULAR COUPLING",col:PURP,x:0.2,y:3.02,pts:["CBF tightly coupled to local CMRO₂","Neuronal activity → local vasodilation","Astrocytes act as key intermediaries","Release NO, arachidonic acid derivatives","K⁺ siphoning by astrocytes","Basis of fMRI (BOLD signal)"]},
  {title:"ENDOTHELIAL",col:PINK,x:3.42,y:3.02,pts:["NO (nitric oxide): vasodilation","Prostacyclin (PGI₂): vasodilation","Endothelin-1: vasoconstriction","Thromboxane A₂: vasoconstriction","Adenosine: vasodilation","Triggered by shear stress, hypoxia, metabolites"]},
  {title:"FLOW-METABOLISM COUPLING",col:RED,x:6.63,y:3.02,pts:["CBF ∝ CMRO₂ (normal coupling)","IV agents: preserve coupling (propofol, thiop.)","Volatile agents: UNCOUPLE — vasodilate despite ↓ CMRO₂","Barbiturates: max coupling preserved to EEG silence","Beyond isoelectric EEG: no further ↓ CMRO₂/CBF","KETAMINE: worst uncoupling — avoid in raised ICP"]},
];
types.forEach(tp=>{
  card(s,tp.x,tp.y,3.1,2.46,tp.col);
  bar(s,tp.x,tp.y,3.1,0.08,tp.col);
  s.addText(tp.title,{x:tp.x+0.08,y:tp.y+0.1,w:2.94,h:0.28,fontSize:10,bold:true,color:tp.col,fontFace:"Calibri",margin:0});
  tp.pts.forEach((p,i)=>s.addText([{text:"• ",options:{color:tp.col,bold:true}},{text:p,options:{color:WHITE}}],{x:tp.x+0.08,y:tp.y+0.44+i*0.33,w:2.94,h:0.3,fontSize:9.5,fontFace:"Calibri",margin:0}));
});}

// ══════════════════════════════════════════════════════════════════════════
// SLIDE 5 — CO₂ & O₂ REACTIVITY
// ══════════════════════════════════════════════════════════════════════════
{const s=pres.addSlide();bg(s);tbar(s,GREEN);sbar(s,GREEN);stitle(s,"CO₂ & O₂ REACTIVITY",GREEN);
// CO2 card
card(s,0.2,0.76,5.5,4.72,GREEN);
s.addText("CO₂ REACTIVITY (PaCO₂)",{x:0.3,y:0.8,w:5.3,h:0.28,fontSize:12,bold:true,color:GREEN,fontFace:"Calibri",margin:0});
s.addText("Most powerful ACUTE regulator of CBF",{x:0.3,y:1.1,w:5.3,h:0.26,fontSize:11,color:AMB,fontFace:"Calibri",italic:true,bold:true,margin:0});
const co2rows=[["Mechanism","CO₂ diffuses freely across BBB → ↓ pH → NO, adenosine, ROS → vasodilation"],["Quantitative","1 mmHg ↑ PaCO₂ = ↑ CBF ~3% (linear 20–80 mmHg)"],["Lower limit","Below 25 mmHg: further CBF ↓ is limited (vasospasm threshold)"],["Upper limit","Above 75–80 mmHg: response attenuated"],["Sustained hyper-vent","Effect NOT sustained — pH normalises in 6–8 hrs via HCO₃⁻ extrusion"],["Rebound hypercarbia","CSF acidosis → ↑ CBF → ↑ ICP on restoring PaCO₂"],["Moderate hypotension","CO₂ reactivity significantly attenuated (MAP ↓ <33%)"],["Severe hypotension","CO₂ reactivity ABOLISHED (MAP ↓ ~66%)"]];
co2rows.forEach(([k,v],i)=>{const ry=1.42+i*0.42;s.addShape(pres.shapes.RECTANGLE,{x:0.28,y:ry,w:5.35,h:0.4,fill:{color:i%2===0?CARD2:DGRAY},line:{color:MGRAY,pt:0.3}});s.addText(k,{x:0.35,y:ry,w:1.55,h:0.4,fontSize:9.5,bold:true,color:GREEN,fontFace:"Calibri",valign:"middle",margin:0});s.addText(v,{x:1.9,y:ry,w:3.65,h:0.4,fontSize:9,color:WHITE,fontFace:"Calibri",valign:"middle",margin:0});});
// CO2 effect on autoregulation
s.addShape(pres.shapes.RECTANGLE,{x:0.28,y:4.8,w:5.35,h:0.6,fill:{color:CARD2},line:{color:GREEN,pt:0.7}});
s.addText([{text:"CO₂ + Autoregulation: ",options:{color:GREEN,bold:true}},{text:"Hypercarbia → IMPAIRS (narrows plateau, LLA rises)  |  Hypocapnia → ENHANCES (widens MAP range of autoregulation)",options:{color:WHITE}}],{x:0.35,y:4.84,w:5.22,h:0.52,fontSize:9.5,fontFace:"Calibri",valign:"middle",margin:0});
// O2 card
card(s,5.9,0.76,3.85,4.72,TEAL);
s.addText("O₂ REACTIVITY (PaO₂)",{x:6.0,y:0.8,w:3.65,h:0.28,fontSize:12,bold:true,color:TEAL,fontFace:"Calibri",margin:0});
[["PaO₂ 60–300 mmHg","Little influence on CBF"],["PaO₂ < 60 mmHg","RAPID ↑ CBF (critical threshold)"],["Below 60 mmHg","Corresponds to fall in SpO₂ on oximeter"],["CBF vs SpO₂","Inversely LINEAR relationship"],["Mechanism","Adenosine, ↓ pH, NO release → vasodilation"],["Haematic hypoxia","↓ Hb content (anaemia) also triggers ↑ CBF"]].forEach(([k,v],i)=>{const ry=1.14+i*0.5;s.addShape(pres.shapes.RECTANGLE,{x:6.0,y:ry,w:3.65,h:0.48,fill:{color:i%2===0?CARD2:DGRAY},line:{color:MGRAY,pt:0.3}});s.addText(k,{x:6.06,y:ry,w:1.55,h:0.48,fontSize:9.5,bold:true,color:TEAL,fontFace:"Calibri",valign:"middle",margin:0});s.addText(v,{x:7.61,y:ry,w:2.0,h:0.48,fontSize:9,color:WHITE,fontFace:"Calibri",valign:"middle",margin:0});});
// Anaemia box
s.addShape(pres.shapes.RECTANGLE,{x:6.0,y:4.24,w:3.65,h:1.24,fill:{color:CARD2},line:{color:AMB,pt:0.8}});
s.addText("ANAEMIA & CBF",{x:6.06,y:4.28,w:3.53,h:0.26,fontSize:10,bold:true,color:AMB,fontFace:"Calibri",margin:0});
["↓ Haematocrit → ↓ viscosity + ↓ O₂ content → ↑ CBF","Optimal haematocrit for cerebral O₂ delivery: ~30–35%","Low Hct: ↓ viscosity benefit outweighed by ↓ O₂ capacity"].forEach((p,i)=>s.addText("▸ "+p,{x:6.06,y:4.58+i*0.25,w:3.53,h:0.24,fontSize:9,color:WHITE,fontFace:"Calibri",margin:0}));}

// ══════════════════════════════════════════════════════════════════════════
// SLIDE 6 — STATIC vs DYNAMIC AUTOREGULATION
// ══════════════════════════════════════════════════════════════════════════
{const s=pres.addSlide();bg(s);tbar(s);sbar(s);stitle(s,"STATIC vs DYNAMIC AUTOREGULATION");
// Comparison table
const th=["Feature","STATIC Autoregulation","DYNAMIC Autoregulation"],tw=[2.4,3.35,3.35];
let tx=0.2;s.addShape(pres.shapes.RECTANGLE,{x:0.2,y:0.78,w:9.1,h:0.34,fill:{color:MGRAY},line:{color:BG,pt:0.5}});th.forEach((h,i)=>{s.addText(h,{x:tx,y:0.78,w:tw[i],h:0.34,fontSize:10,bold:true,color:i===0?LGRAY:i===1?TEAL:AMB,fontFace:"Calibri",align:"center",valign:"middle",margin:0});tx+=tw[i];});
[["Definition","CBF maintained at slow MAP changes","CBF buffering with rapid transient MAP changes"],["Time frame","~10 minutes per BP step","Seconds to ~2 minutes"],["BP change method","Pharmacologic: phenylephrine, nitroprusside, tilt","Thigh cuff deflation, sit-to-stand, Valsalva"],["Measurement","CBF: Xe-133, PET, MRI, TCD","MCAfv via TCD; PRx, COx"],["Plateau width","~50–150 mmHg (Lassen); modern = narrower","Narrower — rapid changes less buffered"],["Rate dependence","Minimal — time to equilibrate","CRITICAL — faster = less buffering"],["Outcome measure","Autoregulatory index (slope)","Phase shift, gain, transfer function, PRx"],["Clinical use","Pharmacologic BP management","Bedside continuous ICP/TCD/NIRS monitoring"]].forEach((row,i)=>{const ry=1.14+i*0.54;tx=0.2;tw.forEach((w,j)=>{s.addShape(pres.shapes.RECTANGLE,{x:tx,y:ry,w:w,h:0.52,fill:{color:i%2===0?CARD:CARD2},line:{color:MGRAY,pt:0.3}});s.addText(row[j],{x:tx+0.06,y:ry,w:w-0.08,h:0.52,fontSize:j===0?9.5:9,color:j===0?LGRAY:j===1?TEAL:AMB,fontFace:"Calibri",valign:"middle",bold:j===0,margin:0});tx+=w;});});
// Key insight
s.addShape(pres.shapes.RECTANGLE,{x:0.2,y:5.1,w:9.1,h:0.42,fill:{color:CARD2},line:{color:TEAL,pt:0.8}});
s.addText([{text:"Key: ",options:{color:TEAL,bold:true}},{text:"With RAPID BP changes, buffering capacity is significantly REDUCED — blood pressure changes are directly reflected in CBF changes. Slower changes allow more autoregulatory buffering.",options:{color:WHITE}}],{x:0.3,y:5.14,w:8.9,h:0.34,fontSize:9.5,fontFace:"Calibri",valign:"middle",margin:0});}

// ══════════════════════════════════════════════════════════════════════════
// SLIDE 7 — TESTS OF AUTOREGULATION
// ══════════════════════════════════════════════════════════════════════════
{const s=pres.addSlide();bg(s);tbar(s,AMB);sbar(s,AMB);stitle(s,"TESTS OF CEREBRAL AUTOREGULATION",AMB);
const tests=[
  {title:"TCD — TRANSCRANIAL DOPPLER",col:TEAL,x:0.2,y:0.78,w:3.08,h:4.68,pts:["Measures MCAfv (middle cerebral artery flow velocity)","Surrogate for CBF","NON-INVASIVE","THIGH CUFF TEST: rapid cuff deflation → ↓ MAP → MCAfv recovery","TRANSIENT HYPERAEMIC RESPONSE TEST (THRT): carotid compression/release","Autoregulatory Index (ARI) 0–9","ARI 0 = no autoregulation; ARI ≥4 = normal","Transfer function: gain, phase between MAP & MCAfv"]},
  {title:"PRx — PRESSURE REACTIVITY INDEX",col:GREEN,x:3.43,y:0.78,w:3.08,h:4.68,pts:["Continuous ABP + ICP monitoring (ICU/TBI)","Rolling Pearson correlation: MAP vs ICP","PRx NEGATIVE (−1 to 0): INTACT autoregulation","PRx near ZERO: borderline","PRx POSITIVE (>+0.3): IMPAIRED (pressure-passive)","Derived CPPopt: MAP at nadir of PRx-CPP U-curve","CPPopt = optimal where autoregulation most effective","Better TBI outcomes when managing to CPPopt"]},
  {title:"NIRS / COx — CEREBRAL OXIMETRY",col:PURP,x:6.63,y:0.78,w:3.08,h:4.68,pts:["NEAR-INFRARED SPECTROSCOPY (non-invasive)","Measures regional cerebral O₂ sat (rSO₂)","COx = correlation: MAP vs rSO₂","COx near 0 / negative: INTACT autoregulation","COx > 0.3–0.4: IMPAIRED","Optimal MAP from U-shaped COx-MAP curve","Used in: cardiac surgery, TBI, neonates, carotid surgery","HVRx = haemoglobin reactivity index (variant)"]},
];
tests.forEach(tp=>{card(s,tp.x,tp.y,tp.w,tp.h,tp.col);bar(s,tp.x,tp.y,tp.w,0.08,tp.col);s.addText(tp.title,{x:tp.x+0.08,y:tp.y+0.1,w:tp.w-0.16,h:0.28,fontSize:9.5,bold:true,color:tp.col,fontFace:"Calibri",margin:0});tp.pts.forEach((p,i)=>{s.addShape(pres.shapes.RECTANGLE,{x:tp.x+0.08,y:tp.y+0.44+i*0.52,w:tp.w-0.16,h:0.5,fill:{color:i%2===0?CARD2:DGRAY},line:{color:MGRAY,pt:0.3}});s.addText(p,{x:tp.x+0.13,y:tp.y+0.44+i*0.52,w:tp.w-0.22,h:0.5,fontSize:9,color:WHITE,fontFace:"Calibri",valign:"middle",margin:0});});});
// ARI footnote
s.addShape(pres.shapes.RECTANGLE,{x:0.2,y:5.52,w:9.55,h:0,fill:{color:BG},line:{color:BG}});}

// ══════════════════════════════════════════════════════════════════════════
// SLIDE 8 — ANAESTHETIC AGENTS
// ══════════════════════════════════════════════════════════════════════════
{const s=pres.addSlide();bg(s);tbar(s);sbar(s);stitle(s,"ANAESTHETIC AGENTS & AUTOREGULATION");
// IV agents
card(s,0.2,0.76,4.65,4.7,TEAL);
s.addText("INTRAVENOUS AGENTS",{x:0.3,y:0.8,w:4.45,h:0.28,fontSize:11,bold:true,color:TEAL,fontFace:"Calibri",margin:0});
const iv=[["Propofol","PRESERVED","↓ CMRO₂ → ↓ CBF coupled","Gold standard neuro-TIVA",TEAL],["Thiopental","PRESERVED","Burst suppression → max effect","Ideal for ICP crises",TEAL],["Etomidate","PRESERVED","↓ CMRO₂ → ↓ CBF","Preserves BP; adrenal issue",GREEN],["Midazolam/BZDs","PRESERVED","Mild CMRO₂ reduction","Useful premedication",GREEN],["Dexmedetomidine","PRESERVED","α₂ agonist; coupled reduction","Best preserves glymphatic",PURP],["Ketamine","IMPAIRED","↑ CMRO₂ + ↑ CBF → uncoupling","AVOID in raised ICP",RED],["Opioids","PRESERVED","Minimal direct effect","Useful adjuncts",LGRAY]];
iv.forEach(([agent,status,mech,note,col],i)=>{const ry=1.14+i*0.5;s.addShape(pres.shapes.RECTANGLE,{x:0.28,y:ry,w:4.48,h:0.48,fill:{color:i%2===0?CARD2:DGRAY},line:{color:MGRAY,pt:0.3}});s.addShape(pres.shapes.RECTANGLE,{x:0.28,y:ry,w:0.06,h:0.48,fill:{color:col},line:{color:col}});s.addText(agent,{x:0.42,y:ry,w:1.35,h:0.24,fontSize:9.5,bold:true,color:WHITE,fontFace:"Calibri",margin:0});s.addText(status,{x:0.42,y:ry+0.24,w:1.35,h:0.22,fontSize:8.5,bold:true,color:status==="PRESERVED"?TEAL:RED,fontFace:"Calibri",margin:0});s.addText(mech,{x:1.78,y:ry+0.02,w:1.7,h:0.22,fontSize:8.5,color:LGRAY,fontFace:"Calibri",margin:0});s.addText(note,{x:1.78,y:ry+0.25,w:1.7,h:0.22,fontSize:8.5,color:WHITE,fontFace:"Calibri",margin:0});});
// Volatile agents
card(s,5.08,0.76,4.67,4.7,AMB);
s.addText("VOLATILE AGENTS",{x:5.18,y:0.8,w:4.47,h:0.28,fontSize:11,bold:true,color:AMB,fontFace:"Calibri",margin:0});
s.addText("ALL VOLATILE AGENTS IMPAIR AUTOREGULATION IN A DOSE-DEPENDENT MANNER",{x:5.18,y:1.1,w:4.47,h:0.42,fontSize:9.5,bold:true,color:RED,fontFace:"Calibri",margin:0});
s.addText("Mechanism: Direct cerebral vasodilation → pressure-passive CBF at high doses\nNet effect = indirect vasoconstriction (via ↓CMRO₂) vs direct vasodilation — vasodilation dominates at high MAC",{x:5.18,y:1.54,w:4.47,h:0.54,fontSize:9,color:LGRAY,fontFace:"Calibri",margin:0});
const vols=[["Sevoflurane","BEST PRESERVED","Maintains up to ~1 MAC","Least vasodilation; better dynamic ARi vs iso at 1.5 MAC",GREEN],["Isoflurane","IMPAIRED (dose)","Moderate vasodilation","Hyperventilation blunts ICP rise",AMB],["Desflurane","MOST IMPAIRED","Greatest vasodilation","Airway irritant: ↑HR/MAP → ↑ICP; avoid raised ICP",RED],["Halothane","MOST IMPAIRED","Vasodilates even at 0.5 MAC","Obsolete; historical reference",RED],["N₂O","IMPAIRED","↑ CMRO₂ + ↑ CBF","Avoid in neurosurgery",RED]];
vols.forEach(([agent,status,mech,note,col],i)=>{const ry=2.14+i*0.5;s.addShape(pres.shapes.RECTANGLE,{x:5.15,y:ry,w:4.52,h:0.48,fill:{color:i%2===0?CARD2:DGRAY},line:{color:MGRAY,pt:0.3}});s.addShape(pres.shapes.RECTANGLE,{x:5.15,y:ry,w:0.06,h:0.48,fill:{color:col},line:{color:col}});s.addText(agent,{x:5.28,y:ry,w:1.3,h:0.24,fontSize:9.5,bold:true,color:WHITE,fontFace:"Calibri",margin:0});s.addText(status,{x:5.28,y:ry+0.24,w:1.3,h:0.22,fontSize:8.5,bold:true,color:col,fontFace:"Calibri",margin:0});s.addText(mech,{x:6.58,y:ry+0.02,w:1.55,h:0.22,fontSize:8.5,color:LGRAY,fontFace:"Calibri",margin:0});s.addText(note,{x:6.58,y:ry+0.25,w:2.95,h:0.22,fontSize:8.5,color:WHITE,fontFace:"Calibri",margin:0});});
// Uncoupling box
s.addShape(pres.shapes.RECTANGLE,{x:5.15,y:4.72,w:4.52,h:0.7,fill:{color:CARD2},line:{color:RED,pt:0.8}});
s.addText("FLOW-METABOLISM UNCOUPLING WITH VOLATILES:",{x:5.22,y:4.76,w:4.38,h:0.24,fontSize:9.5,bold:true,color:RED,fontFace:"Calibri",margin:0});
s.addText("Volatiles ↓ CMRO₂ but cause direct vasodilation → CBF ↑ or unchanged despite ↓ CMRO₂.\nAt >1.5–2 MAC: CBF becomes essentially PRESSURE-PASSIVE.",{x:5.22,y:5.0,w:4.38,h:0.38,fontSize:8.8,color:WHITE,fontFace:"Calibri",margin:0});}

// ══════════════════════════════════════════════════════════════════════════
// SLIDE 9 — CONDITIONS AFFECTING AUTOREGULATION
// ══════════════════════════════════════════════════════════════════════════
{const s=pres.addSlide();bg(s);tbar(s,RED);sbar(s,RED);stitle(s,"CONDITIONS AFFECTING AUTOREGULATION",RED);
// Physiological
card(s,0.2,0.76,4.65,2.5,TEAL);
s.addText("PHYSIOLOGICAL FACTORS",{x:0.3,y:0.8,w:4.45,h:0.28,fontSize:11,bold:true,color:TEAL,fontFace:"Calibri",margin:0});
[["↑ PaCO₂ (Hypercarbia)","IMPAIRS — narrows plateau, LLA rises",RED],["↓ PaCO₂ (Hypocapnia)","ENHANCES — widens MAP autoregulatory range",TEAL],["Hypoxia (PaO₂ <60 mmHg)","IMPAIRS — vasodilation overrides",RED],["Moderate hypotension","CO₂ reactivity significantly ATTENUATED",AMB],["Severe hypotension","CO₂ reactivity ABOLISHED",RED],["Age / atherosclerosis","IMPAIRED — stiff vessel walls",AMB]].forEach(([c,e,col],i)=>{const ry=1.14+i*0.36;s.addShape(pres.shapes.RECTANGLE,{x:0.28,y:ry,w:4.48,h:0.34,fill:{color:i%2===0?CARD2:DGRAY},line:{color:MGRAY,pt:0.3}});s.addText(c,{x:0.35,y:ry,w:2.5,h:0.34,fontSize:9,bold:true,color:LGRAY,fontFace:"Calibri",valign:"middle",margin:0});s.addText(e,{x:2.85,y:ry,w:1.85,h:0.34,fontSize:9,color:col,fontFace:"Calibri",valign:"middle",bold:true,margin:0});});
// Hypertension shift
card(s,5.08,0.76,4.67,2.5,AMB);
s.addText("CHRONIC HYPERTENSION",{x:5.18,y:0.8,w:4.47,h:0.28,fontSize:11,bold:true,color:AMB,fontFace:"Calibri",margin:0});
["Autoregulatory curve shifts RIGHTWARD","Higher MAP range required for adequate perfusion","Hypertrophic remodelling of cerebral vessels","Partially protects from hypertensive damage","RISK: rapid BP reduction → ischaemia below shifted LLA","Target: 10–15% reduction per hour in hypertensive emergency"].forEach((p,i)=>s.addText([{text:i<3?"▸ ":"⚠ ",options:{color:i<3?AMB:RED,bold:true}},{text:p,options:{color:WHITE}}],{x:5.18,y:1.14+i*0.36,w:4.47,h:0.34,fontSize:9.5,fontFace:"Calibri",margin:0}));
// Disease states
card(s,0.2,3.38,9.55,2.12,RED);
s.addText("DISEASE STATES — IMPAIRED AUTOREGULATION",{x:0.3,y:3.42,w:9.35,h:0.28,fontSize:11,bold:true,color:RED,fontFace:"Calibri",margin:0});
const diseases=[["TBI","Commonly impaired; pressure-passive CBF → secondary injury risk",RED],["SAH","Impaired esp. vasospasm period; worse outcomes",RED],["Acute Stroke","Abolished in penumbral tissue; global ischaemia",RED],["Preeclampsia","Impaired → pressure-dependent CBF → oedema, seizures",PINK],["Sepsis","Impaired in severe sepsis; microvascular dysfunction",AMB],["Prematurity","Poorly developed; pressure-passive brain",AMB],["Cardiac Surgery","CPB can impair; NIRS monitoring used",PURP],["Hypoglycaemia","Can impair — metabolic substrate failure",GREEN]];
diseases.forEach(([d,e,c],i)=>{const cx=0.28+(i%4)*2.4,cy=3.76+Math.floor(i/4)*0.52;s.addShape(pres.shapes.RECTANGLE,{x:cx,y:cy,w:2.35,h:0.5,fill:{color:CARD2},line:{color:c,pt:0.6}});s.addText(d,{x:cx+0.06,y:cy+0.02,w:2.24,h:0.22,fontSize:9,bold:true,color:c,fontFace:"Calibri",margin:0});s.addText(e,{x:cx+0.06,y:cy+0.24,w:2.24,h:0.22,fontSize:7.8,color:LGRAY,fontFace:"Calibri",margin:0});});}

// ══════════════════════════════════════════════════════════════════════════
// SLIDE 10 — CLINICAL APPLICATIONS
// ══════════════════════════════════════════════════════════════════════════
{const s=pres.addSlide();bg(s);tbar(s,PURP);sbar(s,PURP);stitle(s,"CLINICAL APPLICATIONS IN ANAESTHESIA",PURP);
const apps=[
  {title:"BP MANAGEMENT",col:TEAL,x:0.2,y:0.76,w:3.08,h:4.7,pts:["Within AR range: BP changes have minimal CBF effect","Outside AR range: every MAP change = direct CBF change","VASOPRESSOR CHOICE MATTERS:","Phenylephrine (α1): ↑SVR → may ↓CO → ↓CBF (esp. bolus)","Ephedrine (α+β): maintains/↑ CO + MAP → better CBF","After volume optimisation: prefer agents maintaining CO+MAP","Phenylephrine infusion preferred over bolus"]},
  {title:"NEUROANAESTHESIA",col:GREEN,x:3.43,y:0.76,w:3.08,h:4.7,pts:["TIVA (propofol + opioid) preferred for raised ICP","If volatile needed: sevoflurane ≤ 1 MAC","Add normocapnia (PaCO₂ 35 mmHg) — preserves AR","Avoid desflurane in raised ICP","Avoid ketamine in raised ICP (worst uncoupling)","Hyperventilation to 30–35 mmHg: crisis only (bridge)","NEVER PaCO₂ <30 (ischaemia)","Head-up 30°: ↓ ICP, ↑ venous drainage"]},
  {title:"CPPopt & TBI MANAGEMENT",col:PURP,x:6.63,y:0.76,w:3.08,h:4.7,pts:["PRx monitoring → continuous AR assessment","U-shaped PRx-CPP curve → find CPPopt (nadir)","Manage MAP to maintain CPP at CPPopt","Prevents ischaemia (CPP too low) AND hyperaemia (too high)","Normal CPP target: ≥ 60 mmHg","TBI target: ≥ 70 mmHg","ICP target: < 20 mmHg","PRx > +0.3: AR impaired; increase vigilance"]},
];
apps.forEach(tp=>{card(s,tp.x,tp.y,tp.w,tp.h,tp.col);bar(s,tp.x,tp.y,tp.w,0.08,tp.col);s.addText(tp.title,{x:tp.x+0.08,y:tp.y+0.1,w:tp.w-0.16,h:0.28,fontSize:10,bold:true,color:tp.col,fontFace:"Calibri",margin:0});tp.pts.forEach((p,i)=>{s.addShape(pres.shapes.RECTANGLE,{x:tp.x+0.08,y:tp.y+0.44+i*0.52,w:tp.w-0.16,h:0.5,fill:{color:i%2===0?CARD2:DGRAY},line:{color:MGRAY,pt:0.3}});s.addText(p,{x:tp.x+0.12,y:tp.y+0.44+i*0.52,w:tp.w-0.2,h:0.5,fontSize:8.8,color:WHITE,fontFace:"Calibri",valign:"middle",margin:0});});});}

// ══════════════════════════════════════════════════════════════════════════
// SLIDE 11 — VIVA SUMMARY
// ══════════════════════════════════════════════════════════════════════════
{const s=pres.addSlide();bg(s);tbar(s,GOLD);sbar(s,GOLD);stitle(s,"VIVA SUMMARY — KEY NUMBERS & FACTS",GOLD);
const grps=[
  {cat:"DEFINITION",c:TEAL,items:[["Normal CBF","~50 mL/100g/min (grey ~80, white ~20)"],["Classic AR range","MAP 50–150 mmHg (Lassen)"],["LLA","~50 mmHg (classic); variable in modern view"],["Autoregulation type","Dynamic, integrative — not static flat plateau"]]},
  {cat:"CO₂ REACTIVITY",c:GREEN,items:[["Each 1 mmHg ↑ PaCO₂","↑ CBF ~3%"],["Lower limit CO₂","Below 25 mmHg — further ↓ CBF limited"],["Sustained duration","Effect gone in 6–8 hrs (HCO₃⁻ compensation)"],["Severe hypotension","CO₂ reactivity abolished (MAP ↓ ~66%)"]]},
  {cat:"TESTS",c:AMB,items:[["PRx","Pearson corr(MAP, ICP); >+0.3 = impaired"],["ARI (TCD)","0–9 scale; ≥4 normal"],["COx (NIRS)","Corr(MAP, rSO₂); >0.3 = impaired"],["CPPopt","MAP at nadir of PRx-CPP U-curve"]]},
  {cat:"ANAESTHETICS",c:RED,items:[["BEST for raised ICP","Propofol, thiopental (preserve AR)"],["WORST for raised ICP","Ketamine (↑ CBF/CMRO₂ uncoupling), N₂O"],["Best volatile","Sevoflurane ≤ 1 MAC"],["All volatiles","Dose-dependent AR impairment"]]},
  {cat:"STATIC vs DYNAMIC",c:PURP,items:[["Static","Slow ~10min BP changes; pharmacologic"],["Dynamic","Rapid transient; thigh cuff deflation"],["Faster BP change","Less buffering capacity"],["Thigh cuff test","Rapid MAP ↓ → MCAfv recovery = AR intact"]]},
  {cat:"DISEASE / SHIFTS",c:LGRAY,items:[["Chronic hypertension","AR curve shifts RIGHT — higher MAP range"],["TBI / SAH","AR commonly impaired / abolished"],["Preeclampsia","AR impaired → pressure-dependent cerebral oedema"],["Hypercarbia","Narrows plateau; LLA rises; AR impaired"]]},
];
[[0,3],[3,6]].forEach(([a,b],ci)=>{grps.slice(a,b).forEach((grp,gi)=>{const cx=0.2+ci*5.0,cy=0.78+gi*1.55;card(s,cx,cy,4.7,1.5,grp.c);bar(s,cx,cy,4.7,0.08,grp.c);s.addText(grp.cat,{x:cx+0.08,y:cy+0.1,w:4.54,h:0.26,fontSize:10,bold:true,color:grp.c,fontFace:"Calibri",margin:0});grp.items.forEach(([k,v],i)=>{const iy=cy+0.4+i*0.26;s.addText(k+":",{x:cx+0.08,y:iy,w:1.7,h:0.24,fontSize:9,bold:true,color:LGRAY,fontFace:"Calibri",margin:0});s.addText(v,{x:cx+1.82,y:iy,w:2.8,h:0.24,fontSize:9,color:WHITE,fontFace:"Calibri",margin:0});});});});}

pres.writeFile({fileName:"/home/daytona/workspace/autoregulation-ppt/CNS_Autoregulation.pptx"})
  .then(()=>console.log("Done"))
  .catch(e=>{console.error(e);process.exit(1);});
Running Command

cd /home/daytona/workspace/autoregulation-ppt && node make_ppt.js 2>&1

Running Command

ls -lh /home/daytona/workspace/autoregulation-ppt/CNS_Autoregulation.pptx

Your presentation is ready!

CNS Autoregulation

Presentation · PPTX


11 slides — deep navy + teal/green/amber accent scheme:
SlideContent
1Title slide
2Outline
3Definition & Classical Lassen Curve (with graph + modern revision)
46 Types of Autoregulation (myogenic, metabolic, neurogenic, neurovascular, endothelial, flow-metabolism coupling)
5CO₂ & O₂ Reactivity (detailed tables, anaemia, CO₂-AR interaction)
6Static vs Dynamic Autoregulation (comparison table)
7Tests — TCD/ARI, PRx, NIRS/COx (3-column detail)
8Anaesthetic Agents — IV agents + Volatile agents comparison tables
9Conditions affecting autoregulation (physiological + diseases + hypertension shift)
10Clinical Applications (BP management, neuroanaesthesia, CPPopt/TBI)
11Viva Summary — 6-category rapid-fire reference
This is a shared conversation. Sign in to Orris to start your own chat.