Clinical experiment moter pathway in physiology ppt

Asking for Preferences
Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/motor-pathway-ppt && ls /home/daytona/workspace/motor-pathway-ppt/

Writing File

~/motor-pathway-ppt/motor_pathway.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Motor Pathways in Physiology";
pres.author = "Clinical Physiology";

// ─────────────────────────────────────────────
// COLOUR PALETTE
// Dark navy: 0D1B2A  |  Teal accent: 00B4D8
// Light blue: 90E0EF  |  Warm white: F0F4F8
// Coral/red accent: E63946  |  Soft grey: 8D99AE
// Gold accent: FFB703
// ─────────────────────────────────────────────
const C = {
  navy:    "0D1B2A",
  teal:    "00B4D8",
  ltBlue:  "90E0EF",
  white:   "F0F4F8",
  coral:   "E63946",
  grey:    "8D99AE",
  gold:    "FFB703",
  dark:    "03045E",
  midBlue: "0077B6",
};

// ─── Helper: add accent bar ───────────────────
function accentBar(slide, color, x=0, y=0, w=10, h=0.07) {
  slide.addShape(pres.ShapeType.rect, { x, y, w, h, fill: { color } });
}

// ─── Helper: section tag pill ────────────────
function sectionTag(slide, text, x=0.35, y=0.18) {
  slide.addShape(pres.ShapeType.roundRect, {
    x, y, w: 1.9, h: 0.28, fill: { color: C.teal }, rectRadius: 0.08,
  });
  slide.addText(text, {
    x, y, w: 1.9, h: 0.28, fontSize: 9, bold: true, color: C.navy,
    align: "center", valign: "middle", margin: 0,
  });
}

// ─── Helper: slide heading ────────────────────
function heading(slide, text, sub="", y=0.55) {
  slide.addText(text, {
    x: 0.35, y, w: 9.3, h: 0.6,
    fontSize: 26, bold: true, color: C.navy, fontFace: "Calibri",
    margin: 0,
  });
  if (sub) {
    slide.addText(sub, {
      x: 0.35, y: y + 0.6, w: 9.3, h: 0.3,
      fontSize: 12, color: C.midBlue, italic: true, margin: 0,
    });
  }
}

// ─── Helper: white card ──────────────────────
function card(slide, x, y, w, h, shadow=true) {
  slide.addShape(pres.ShapeType.rect, {
    x, y, w, h, fill: { color: "FFFFFF" },
    line: { color: "D9E6F0", width: 1 },
    shadow: shadow ? { type:"outer", color:"8D99AE", blur:4, offset:2, angle:45, opacity:0.25 } : undefined,
  });
}

// ─── Helper: coloured label box ──────────────
function labelBox(slide, text, x, y, w=1.5, h=0.32, fill=C.teal) {
  slide.addShape(pres.ShapeType.rect, { x, y, w, h, fill: { color: fill } });
  slide.addText(text, {
    x, y, w, h, fontSize: 9.5, bold: true, color: C.white,
    align: "center", valign: "middle", margin: 0,
  });
}

// ─── Helper: bullet list ─────────────────────
function bullets(slide, items, x, y, w, h, fontSize=11.5, color=C.navy) {
  const rows = items.map((item, i) => ({
    text: item,
    options: { bullet: { type: "bullet" }, breakLine: i < items.length - 1, color, fontSize, fontFace: "Calibri", paraSpaceAfter: 4 },
  }));
  slide.addText(rows, { x, y, w, h });
}

// ─────────────────────────────────────────────
// SLIDE 1 — TITLE
// ─────────────────────────────────────────────
{
  const s = pres.addSlide();
  // Full dark background
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:C.navy } });
  // Decorative teal stripe
  s.addShape(pres.ShapeType.rect, { x:0, y:3.8, w:10, h:0.08, fill:{ color:C.teal } });
  // Gold left border
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:0.18, h:5.625, fill:{ color:C.gold } });

  s.addText("Motor Pathways", {
    x:0.5, y:0.8, w:9, h:1.1,
    fontSize:46, bold:true, color:C.white, fontFace:"Calibri",
    charSpacing:2,
  });
  s.addText("Physiology, Anatomy & Clinical Correlations", {
    x:0.5, y:1.95, w:9, h:0.55,
    fontSize:20, color:C.ltBlue, italic:true, fontFace:"Calibri",
  });

  // Icon-style neuron line art boxes
  const topics = ["Corticospinal Tract", "UMN vs LMN", "Extrapyramidal System", "Cerebellum & Reflexes", "Clinical Lesions"];
  topics.forEach((t, i) => {
    s.addShape(pres.ShapeType.rect, {
      x: 0.5 + i * 1.85, y: 2.9, w: 1.7, h: 0.55,
      fill:{ color: i % 2 === 0 ? C.teal : C.midBlue },
      line:{ color:"FFFFFF", width:0.5 },
    });
    s.addText(t, {
      x: 0.5 + i * 1.85, y: 2.9, w: 1.7, h: 0.55,
      fontSize: 8.5, color: C.white, align:"center", valign:"middle", bold:true,
    });
  });

  s.addText("Based on Guyton & Hall • Neuroanatomy through Clinical Cases • Ganong's Review", {
    x:0.5, y:5.15, w:9, h:0.3, fontSize:8, color:C.grey, italic:true,
  });
}

// ─────────────────────────────────────────────
// SLIDE 2 — OUTLINE
// ─────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:"F7FAFD" } });
  accentBar(s, C.teal, 0, 0, 10, 0.07);
  accentBar(s, C.gold, 0, 5.55, 10, 0.07);

  heading(s, "Lecture Outline", "", 0.45);
  s.addShape(pres.ShapeType.line, { x:0.35, y:1.18, w:9.3, h:0, line:{ color:C.ltBlue, width:1.2 } });

  const outline = [
    ["1. Introduction to Motor Control", "Overview of the motor system hierarchy"],
    ["2. Motor Cortex & Homunculus", "Primary, premotor, SMA areas"],
    ["3. Corticospinal (Pyramidal) Tract", "Origin → decussation → termination"],
    ["4. Internal Capsule & Descending Fibers", "Topography and clinical relevance"],
    ["5. Lower Motor Neurons (LMN)", "Alpha motor neurons, NMJ, final common pathway"],
    ["6. UMN vs. LMN Lesions", "Signs, symptoms, and localization"],
    ["7. Extrapyramidal System", "Basal ganglia circuits and function"],
    ["8. Cerebellar Motor Pathways", "Coordination and proprioception"],
    ["9. Reflexes — Stretch & Babinski", "Physiology and clinical testing"],
    ["10. Gait & Clinical Syndromes", "Hemiplegia, paraplegia, ALS, Parkinson's"],
  ];

  outline.forEach(([title, sub], i) => {
    const col = i < 5 ? 0 : 1;
    const row = i % 5;
    const x = col === 0 ? 0.35 : 5.2;
    const y = 1.35 + row * 0.78;

    s.addShape(pres.ShapeType.rect, {
      x, y, w: 0.36, h: 0.36,
      fill:{ color: i % 2 === 0 ? C.teal : C.midBlue },
    });
    s.addText(String(i+1), {
      x, y, w: 0.36, h: 0.36,
      fontSize:13, bold:true, color:"FFFFFF", align:"center", valign:"middle", margin:0,
    });
    s.addText(title, {
      x: x+0.44, y: y+0.01, w: 4.35, h: 0.2,
      fontSize:11, bold:true, color:C.navy, margin:0,
    });
    s.addText(sub, {
      x: x+0.44, y: y+0.2, w: 4.35, h: 0.18,
      fontSize:8.5, color:C.grey, italic:true, margin:0,
    });
  });
}

// ─────────────────────────────────────────────
// SLIDE 3 — MOTOR SYSTEM HIERARCHY
// ─────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:"F7FAFD" } });
  accentBar(s, C.navy, 0, 0, 10, 0.07);
  sectionTag(s, "INTRODUCTION");
  heading(s, "Motor Control Hierarchy");

  // Pyramid diagram
  const levels = [
    { label: "Association Cortex / Cognitive Planning", fill: C.dark, y: 1.25, w: 9.0, x: 0.5 },
    { label: "Motor Cortex (Primary + Premotor + SMA)", fill: C.midBlue, y: 1.88, w: 7.2, x: 1.4 },
    { label: "Brainstem Motor Nuclei", fill: C.teal, y: 2.51, w: 5.4, x: 2.3 },
    { label: "Spinal Interneurons", fill: C.gold, y: 3.14, w: 3.6, x: 3.2 },
    { label: "Alpha Motor Neurons (LMN)", fill: C.coral, y: 3.77, w: 1.8, x: 4.1 },
  ];

  levels.forEach(({ label, fill, y, w, x }) => {
    s.addShape(pres.ShapeType.rect, { x, y, w, h: 0.55, fill: { color: fill } });
    s.addText(label, {
      x, y, w, h: 0.55, fontSize: 10, bold: true,
      color: fill === C.gold ? C.navy : "FFFFFF",
      align: "center", valign: "middle", margin: 0,
    });
  });

  // Arrow down
  s.addShape(pres.ShapeType.downArrow, { x:4.5, y:4.35, w:1, h:0.55, fill:{ color:C.coral } });

  s.addText("SKELETAL MUSCLE (Final output)", {
    x:2.5, y:4.92, w:5, h:0.35,
    fontSize:11, bold:true, color:C.coral, align:"center",
  });

  // Right annotation
  s.addText([
    { text: "Modulating inputs:\n", options:{ bold:true, breakLine:true, color:C.navy } },
    { text: "• Cerebellum — coordination\n", options:{ color:C.midBlue, breakLine:true } },
    { text: "• Basal Ganglia — initiation/inhibition\n", options:{ color:C.teal, breakLine:true } },
    { text: "• Sensory feedback — reflex arcs", options:{ color:C.grey } },
  ], { x:0.3, y:2.1, w:0.0, h:0 }); // placeholder — proper below

  card(s, 0.3, 2.2, 2.8, 1.6);
  s.addText("Modulating Inputs", { x:0.4, y:2.25, w:2.6, h:0.28, fontSize:10, bold:true, color:C.navy, margin:0 });
  bullets(s, [
    "Cerebellum → coordination",
    "Basal Ganglia → gating",
    "Sensory feedback → reflexes",
    "Thalamus → relay station",
  ], 0.4, 2.55, 2.6, 1.15, 10);
}

// ─────────────────────────────────────────────
// SLIDE 4 — MOTOR CORTEX & HOMUNCULUS
// ─────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:"F7FAFD" } });
  accentBar(s, C.midBlue, 0, 0, 10, 0.07);
  sectionTag(s, "MOTOR CORTEX");
  heading(s, "Motor Cortex Areas & Motor Homunculus");

  // Left: 3 areas
  const areas = [
    { name:"Primary Motor Cortex (M1)", brod:"Area 4 — Precentral Gyrus", desc:"Directly controls voluntary movement; contains Betz cells (giant pyramidal neurons). >50% fibers devoted to hand and speech.", fill:C.navy },
    { name:"Premotor Area (PMA)", brod:"Area 6 — anterior to M1", desc:"Plans and prepares movements; controls trunk & proximal limb. Sequencing of complex movements.", fill:C.midBlue },
    { name:"Supplementary Motor Area (SMA)", brod:"Area 6 — medial surface", desc:"Internally generated movements; bimanual coordination; important for movement initiation.", fill:C.teal },
  ];

  areas.forEach(({ name, brod, desc, fill }, i) => {
    card(s, 0.3, 1.3 + i*1.3, 4.8, 1.18);
    s.addShape(pres.ShapeType.rect, { x:0.3, y:1.3 + i*1.3, w:0.18, h:1.18, fill:{ color:fill } });
    s.addText(name, { x:0.55, y:1.33 + i*1.3, w:4.5, h:0.28, fontSize:11, bold:true, color:fill, margin:0 });
    s.addText(brod, { x:0.55, y:1.61 + i*1.3, w:4.5, h:0.2, fontSize:9, italic:true, color:C.grey, margin:0 });
    s.addText(desc, { x:0.55, y:1.8 + i*1.3, w:4.5, h:0.55, fontSize:9.5, color:C.navy, wrap:true, margin:0 });
  });

  // Right: Homunculus note + key points
  card(s, 5.4, 1.3, 4.25, 4.0);
  s.addText("Motor Homunculus", {
    x:5.5, y:1.35, w:4.0, h:0.3, fontSize:13, bold:true, color:C.navy, margin:0,
  });
  s.addShape(pres.ShapeType.line, { x:5.5, y:1.68, w:4.0, h:0, line:{ color:C.ltBlue, width:1 } });

  const homoPoints = [
    "Topographic map of body on precentral gyrus",
    "Face & mouth — lateral (near Sylvian fissure)",
    "Hand & thumb — large representation (fine motor)",
    "Trunk — near apex of brain",
    "Leg & foot — dip into longitudinal fissure",
    "Disproportionate representation: hand and face occupy >50% of M1",
    "Stimulation of single neuron → contraction of a group of muscles (movement pattern)",
    "Betz cells (~3% of CST neurons) are the largest neurons in the CNS",
  ];

  bullets(s, homoPoints, 5.5, 1.75, 4.0, 3.5, 10.5);
}

// ─────────────────────────────────────────────
// SLIDE 5 — CORTICOSPINAL TRACT OVERVIEW
// ─────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:"F7FAFD" } });
  accentBar(s, C.teal, 0, 0, 10, 0.07);
  sectionTag(s, "CORTICOSPINAL TRACT");
  heading(s, "The Pyramidal Tract — Course & Anatomy");

  // Flow diagram: cortex → IC → cerebral peduncle → pons → medulla → decussation → spinal cord
  const steps = [
    { label: "Cerebral Cortex\n(M1, PMA, SMA, Parietal)", fill: C.dark },
    { label: "Corona Radiata\n(white matter fans)", fill: C.navy },
    { label: "Posterior Limb of\nInternal Capsule", fill: C.midBlue },
    { label: "Cerebral Peduncles\n(middle 3/5)", fill: C.teal },
    { label: "Basis Pontis\n(scattered bundles)", fill: C.teal },
    { label: "Medullary Pyramids", fill: C.gold },
    { label: "Pyramidal Decussation\n(85% cross)", fill: C.coral },
    { label: "Spinal Cord\nLateral & Anterior CST", fill: C.navy },
  ];

  steps.forEach((step, i) => {
    const col = i < 4 ? 0 : 1;
    const row = i < 4 ? i : 7 - i;
    const x = col === 0 ? 0.3 : 5.6;
    const y = 1.35 + row * 0.96;

    s.addShape(pres.ShapeType.rect, {
      x, y, w: 4.0, h: 0.7,
      fill: { color: step.fill },
      line: { color: "FFFFFF", width: 0.5 },
    });
    s.addText(step.label, {
      x, y, w: 4.0, h: 0.7,
      fontSize: 10, bold: true, color: step.fill === C.gold ? C.navy : "FFFFFF",
      align: "center", valign: "middle",
    });

    // Arrow down within column
    if ((col === 0 && i < 3) || (col === 1 && i > 4)) {
      s.addShape(pres.ShapeType.rect, {
        x: x + 1.85, y: y + 0.7, w: 0.3, h: 0.26,
        fill: { color: C.grey },
      });
    }
  });

  // Cross arrow at decussation
  s.addShape(pres.ShapeType.rect, {
    x: 4.3, y: 2.75, w: 1.3, h: 0.3,
    fill: { color: C.coral },
  });
  s.addText("← 85% cross →", {
    x: 4.3, y: 2.75, w: 1.3, h: 0.3,
    fontSize: 8, bold: true, color: "FFFFFF", align: "center", valign: "middle",
  });

  // Key facts box
  card(s, 5.55, 1.35, 4.1, 4.1);
  s.addText("Key Facts", { x:5.65, y:1.4, w:3.9, h:0.28, fontSize:12, bold:true, color:C.navy, margin:0 });
  bullets(s, [
    "~1 million fibers in each CST",
    "Origin: 30% M1, 30% premotor, 40% parietal (sensorimotor integration)",
    "Only ~3% are giant Betz cells",
    "Internal capsule: corticospinal in posterior limb",
    "85% decussate at pyramidal decussation → lateral CST",
    "15% uncrossed → anterior CST (decussate at spinal cord level)",
    "Synapse on: α-motor neurons (direct) + spinal interneurons",
    "Primary role: fine voluntary distal limb movements",
  ], 5.65, 1.72, 3.9, 3.7, 10);
}

// ─────────────────────────────────────────────
// SLIDE 6 — INTERNAL CAPSULE
// ─────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:"F7FAFD" } });
  accentBar(s, C.navy, 0, 0, 10, 0.07);
  sectionTag(s, "INTERNAL CAPSULE");
  heading(s, "Internal Capsule — Topography & Clinical Relevance");

  // Left: Internal capsule schematic
  card(s, 0.3, 1.3, 4.5, 4.0);
  s.addText("Internal Capsule Structure", {
    x:0.4, y:1.35, w:4.3, h:0.28, fontSize:12, bold:true, color:C.navy, margin:0,
  });

  const icParts = [
    { part:"Anterior Limb", fibers:"Frontopontine fibers; thalamocortical fibers to frontal lobe", fill:C.midBlue, y:1.72 },
    { part:"Genu", fibers:"Corticobulbar fibers (to CN nuclei in brainstem)", fill:C.teal, y:2.42 },
    { part:"Posterior Limb", fibers:"Corticospinal tract, thalamocortical sensory fibers (somatosensory), corticorubral fibers", fill:C.navy, y:3.12 },
    { part:"Retrolenticular", fibers:"Optic radiations, posterior thalamocortical fibers", fill:C.grey, y:3.82 },
    { part:"Sublenticular", fibers:"Auditory radiations, temporal bridge fibers", fill:C.dark, y:4.52 },
  ];

  icParts.forEach(({ part, fibers, fill, y }) => {
    s.addShape(pres.ShapeType.rect, { x:0.4, y, w:1.5, h:0.56, fill:{ color:fill } });
    s.addText(part, {
      x:0.4, y, w:1.5, h:0.56,
      fontSize:9.5, bold:true, color:"FFFFFF", align:"center", valign:"middle", margin:0,
    });
    s.addText(fibers, {
      x:1.98, y, w:2.75, h:0.56,
      fontSize:8.5, color:C.navy, valign:"middle", wrap:true, margin:0,
    });
  });

  // Right: Clinical relevance
  card(s, 5.1, 1.3, 4.55, 4.0);
  s.addText("Clinical Importance", {
    x:5.2, y:1.35, w:4.35, h:0.28, fontSize:12, bold:true, color:C.coral, margin:0,
  });
  s.addText("Internal capsule stroke = most common cause of contralateral hemiplegia", {
    x:5.2, y:1.65, w:4.35, h:0.45,
    fontSize:10, color:C.navy, italic:true, wrap:true, bold:true, margin:0,
  });

  const clinPoints = [
    "Posterior limb lesion → contralateral hemiplegia (face, arm, leg all affected)",
    "Genu lesion → central facial palsy + dysarthria (corticobulbar affected)",
    "Capsular stroke typically from lenticulostriate artery occlusion",
    "Because fibers are DENSELY packed, a small lesion → massive deficit",
    "Unlike cortical strokes, there may be no sensory loss if posterior limb spared",
    "Lacunar infarcts are common here (hypertension related)",
    "Pure motor hemiparesis: classic lacunar syndrome of posterior limb",
  ];
  bullets(s, clinPoints, 5.2, 2.15, 4.35, 3.1, 10);
}

// ─────────────────────────────────────────────
// SLIDE 7 — LOWER MOTOR NEURONS
// ─────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:"F7FAFD" } });
  accentBar(s, C.teal, 0, 0, 10, 0.07);
  sectionTag(s, "LMN");
  heading(s, "Lower Motor Neuron — The Final Common Pathway");

  // 3-column layout
  const cols = [
    {
      title: "Alpha (α) Motor Neurons",
      color: C.navy,
      points: [
        "Large multipolar neurons in anterior horn (spinal cord) or CN motor nuclei (brainstem)",
        "Directly innervate extrafusal skeletal muscle fibers",
        "Cell bodies: anterior horn (lamina IX)",
        "Medial group → axial/trunk muscles",
        "Lateral group → distal limb muscles",
        "Each motor neuron + all its muscle fibers = 1 motor unit",
      ],
    },
    {
      title: "Gamma (γ) Motor Neurons",
      color: C.midBlue,
      points: [
        "Innervate intrafusal fibers of muscle spindles",
        "Regulate spindle sensitivity during muscle contraction",
        "Prevent spindle unloading during α motor neuron firing",
        "Work with α neurons — alpha-gamma co-activation",
        "Important for maintaining stretch reflex gain",
      ],
    },
    {
      title: "Neuromuscular Junction",
      color: C.teal,
      points: [
        "Axon terminal releases acetylcholine (ACh)",
        "ACh binds nicotinic receptors on motor endplate",
        "End plate potential → action potential → muscle contraction",
        "Clinical: myasthenia gravis (anti-AChR Ab), Lambert-Eaton, botulism, succinylcholine",
        "Failure here → LMN pattern weakness with NO reflex change initially",
      ],
    },
  ];

  cols.forEach(({ title, color, points }, i) => {
    card(s, 0.25 + i*3.25, 1.3, 3.1, 4.05);
    s.addShape(pres.ShapeType.rect, { x:0.25 + i*3.25, y:1.3, w:3.1, h:0.38, fill:{ color } });
    s.addText(title, {
      x:0.25 + i*3.25, y:1.3, w:3.1, h:0.38,
      fontSize:10.5, bold:true, color:"FFFFFF", align:"center", valign:"middle", margin:0,
    });
    bullets(s, points, 0.35 + i*3.25, 1.72, 2.9, 3.6, 10, C.navy);
  });
}

// ─────────────────────────────────────────────
// SLIDE 8 — UMN vs LMN COMPARISON
// ─────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:"F7FAFD" } });
  accentBar(s, C.coral, 0, 0, 10, 0.07);
  sectionTag(s, "UMN vs LMN");
  heading(s, "Upper vs Lower Motor Neuron Lesions", "Clinical Differentiation");

  // Table header
  const hdr_y = 1.35;
  s.addShape(pres.ShapeType.rect, { x:0.3, y:hdr_y, w:9.4, h:0.4, fill:{ color:C.navy } });
  const hdrs = ["Feature", "UMN Lesion", "LMN Lesion"];
  const hdrX = [0.3, 3.8, 6.85];
  const hdrW = [3.5, 3.05, 3.15];
  hdrs.forEach((h, i) => {
    s.addText(h, {
      x: hdrX[i], y: hdr_y, w: hdrW[i], h: 0.4,
      fontSize:12, bold:true, color:"FFFFFF", align:"center", valign:"middle", margin:0,
    });
  });

  const rows = [
    ["Weakness", "Yes (contralateral)", "Yes (ipsilateral / segmental)"],
    ["Muscle Tone", "⬆ Increased (spasticity)", "⬇ Decreased (flaccidity)"],
    ["Reflexes (DTR)", "⬆ Hyperreflexia", "⬇ Hyporeflexia / areflexia"],
    ["Muscle Atrophy", "Mild (disuse only)", "Marked (denervation)"],
    ["Fasciculations", "Absent", "Present (characteristic)"],
    ["Babinski Sign", "Positive (extensor)", "Absent / Plantar flexion"],
    ["Clonus", "May be present", "Absent"],
    ["Location of Lesion", "Cortex, IC, brainstem, spinal cord (above segment)", "Anterior horn, nerve root, peripheral nerve"],
    ["Examples", "Stroke, MS, SCI above level", "Polio, GBS, ALS (LMN component)"],
  ];

  rows.forEach((row, ri) => {
    const bg = ri % 2 === 0 ? "EBF5FB" : "FFFFFF";
    s.addShape(pres.ShapeType.rect, { x:0.3, y:hdr_y + 0.4 + ri*0.47, w:9.4, h:0.47, fill:{ color:bg } });
    s.addShape(pres.ShapeType.line, { x:0.3, y:hdr_y + 0.4 + ri*0.47, w:9.4, h:0, line:{ color:"D5E8F5", width:0.5 } });

    const vals = row;
    [0.3, 3.8, 6.85].forEach((x, ci) => {
      const color = ci === 1 ? C.coral : ci === 2 ? C.midBlue : C.navy;
      s.addText(vals[ci], {
        x, y: hdr_y + 0.4 + ri*0.47, w: hdrW[ci], h: 0.47,
        fontSize: 9.5, color: ci===0 ? C.navy : color,
        bold: ci===0,
        align: "center", valign: "middle", margin: 3, wrap:true,
      });
    });
  });
}

// ─────────────────────────────────────────────
// SLIDE 9 — BABINSKI & REFLEXES
// ─────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:"F7FAFD" } });
  accentBar(s, C.midBlue, 0, 0, 10, 0.07);
  sectionTag(s, "REFLEXES");
  heading(s, "Spinal Reflexes & Babinski Sign");

  // Left column: stretch reflex
  card(s, 0.3, 1.3, 4.5, 4.1);
  s.addShape(pres.ShapeType.rect, { x:0.3, y:1.3, w:4.5, h:0.38, fill:{ color:C.midBlue } });
  s.addText("Stretch Reflex (Monosynaptic)", {
    x:0.3, y:1.3, w:4.5, h:0.38,
    fontSize:11, bold:true, color:"FFFFFF", align:"center", valign:"middle", margin:0,
  });

  const stretchSteps = [
    "Tendon tap → muscle spindle (Ia afferents) activated",
    "Ia afferent → dorsal root → synapse directly on α motor neuron (monosynaptic)",
    "α motor neuron fires → muscle contracts (reflex jerk)",
    "Simultaneously: Ia afferent inhibits antagonist via Ia inhibitory interneuron",
    "Modulated by γ motor neurons (sensitivity control)",
    "Clinical use: DTRs (biceps C5-6, triceps C7, knee L3-4, ankle S1-2)",
    "Hyperreflexia → UMN lesion (loss of descending inhibition)",
    "Hyporeflexia → LMN lesion, myopathy, or cerebellar disease",
  ];
  bullets(s, stretchSteps, 0.4, 1.73, 4.3, 3.6, 10);

  // Right column: Babinski
  card(s, 5.1, 1.3, 4.55, 4.1);
  s.addShape(pres.ShapeType.rect, { x:5.1, y:1.3, w:4.55, h:0.38, fill:{ color:C.coral } });
  s.addText("Babinski Sign (Plantar Response)", {
    x:5.1, y:1.3, w:4.55, h:0.38,
    fontSize:11, bold:true, color:"FFFFFF", align:"center", valign:"middle", margin:0,
  });

  const babinskiItems = [
    "Test: Stroke lateral sole of foot from heel to toes",
    "Normal adult: plantar flexion of all toes (negative)",
    "Positive Babinski: dorsiflexion of big toe + fanning of other toes",
    "Indicates UMN lesion (loss of cortical inhibition of flexor reflex)",
    "Normal in infants <2 years (CST not yet myelinated)",
    "Physiologic significance: not fully understood",
    "Value: localizes disease to corticospinal tract or above",
    "Related signs: Chaddock, Oppenheim, Gordon (all test CST integrity)",
  ];
  bullets(s, babinskiItems, 5.2, 1.73, 4.35, 3.6, 10);
}

// ─────────────────────────────────────────────
// SLIDE 10 — EXTRAPYRAMIDAL SYSTEM
// ─────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:"F7FAFD" } });
  accentBar(s, C.gold, 0, 0, 10, 0.07);
  sectionTag(s, "EXTRAPYRAMIDAL");
  heading(s, "Extrapyramidal System & Basal Ganglia");

  // Left: circuit
  card(s, 0.3, 1.3, 4.5, 4.1);
  s.addText("Basal Ganglia Circuit", {
    x:0.4, y:1.35, w:4.3, h:0.28, fontSize:12, bold:true, color:C.navy, margin:0,
  });

  const bgNodes = [
    { label:"Motor Cortex\n(Glutamate +)", x:1.3, y:1.75, fill:C.midBlue },
    { label:"Striatum\n(Caudate + Putamen)", x:1.3, y:2.5, fill:C.navy },
    { label:"GPi / SNr\n(Output nuclei, GABA -)", x:0.45, y:3.3, fill:C.dark },
    { label:"Thalamus (VA/VL)\n(Relay to cortex)", x:2.15, y:3.3, fill:C.teal },
    { label:"GPe / STN\n(Indirect pathway)", x:0.45, y:4.1, fill:C.coral },
    { label:"SNc (Dopamine)\nD1/D2 modulation", x:2.15, y:4.1, fill:C.gold },
  ];

  bgNodes.forEach(({ label, x, y, fill }) => {
    s.addShape(pres.ShapeType.rect, { x, y, w:1.7, h:0.6, fill:{ color:fill } });
    s.addText(label, {
      x, y, w:1.7, h:0.6,
      fontSize:9, bold:true,
      color: fill===C.gold ? C.navy : "FFFFFF",
      align:"center", valign:"middle", margin:0,
    });
  });

  // Right: functional notes
  card(s, 5.1, 1.3, 4.55, 4.1);
  s.addText("Function & Clinical Disease", {
    x:5.2, y:1.35, w:4.35, h:0.28, fontSize:12, bold:true, color:C.navy, margin:0,
  });

  s.addShape(pres.ShapeType.rect, { x:5.2, y:1.67, w:4.35, h:0.28, fill:{ color:C.teal } });
  s.addText("Direct Pathway (facilitatory)", {
    x:5.2, y:1.67, w:4.35, h:0.28,
    fontSize:10, bold:true, color:"FFFFFF", align:"center", margin:0,
  });
  bullets(s, ["Cortex → Striatum D1 → GPi (inhibit) → Thalamus disinhibited → Movement ↑"], 5.2, 1.97, 4.35, 0.55, 9.5);

  s.addShape(pres.ShapeType.rect, { x:5.2, y:2.55, w:4.35, h:0.28, fill:{ color:C.coral } });
  s.addText("Indirect Pathway (inhibitory)", {
    x:5.2, y:2.55, w:4.35, h:0.28,
    fontSize:10, bold:true, color:"FFFFFF", align:"center", margin:0,
  });
  bullets(s, ["Cortex → Striatum D2 → GPe (inhibit) → STN active → GPi active → Thalamus inhibited → Movement ↓"], 5.2, 2.85, 4.35, 0.55, 9.5);

  s.addShape(pres.ShapeType.rect, { x:5.2, y:3.43, w:4.35, h:0.28, fill:{ color:C.navy } });
  s.addText("Clinical Diseases", {
    x:5.2, y:3.43, w:4.35, h:0.28,
    fontSize:10, bold:true, color:"FFFFFF", align:"center", margin:0,
  });
  const bgDx = [
    "Parkinson's: SNc loss → dopamine ↓ → hypokinesia, rigidity, tremor",
    "Huntington's: Striatum degeneration → chorea, dementia",
    "Hemiballismus: STN lesion → wild flinging movements",
    "Dystonia: abnormal co-contraction patterns",
  ];
  bullets(s, bgDx, 5.2, 3.73, 4.35, 1.6, 10);
}

// ─────────────────────────────────────────────
// SLIDE 11 — CEREBELLAR MOTOR PATHWAYS
// ─────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:"F7FAFD" } });
  accentBar(s, C.teal, 0, 0, 10, 0.07);
  sectionTag(s, "CEREBELLUM");
  heading(s, "Cerebellar Motor Pathways & Coordination");

  // 3 zones
  const zones = [
    {
      name:"Vestibulocerebellum\n(Archicerebellum)",
      area:"Flocculonodular lobe",
      fn:"Balance, vestibulo-ocular reflex, eye movement coordination",
      dx:"Lesion → truncal ataxia, nystagmus, gait imbalance",
      fill:C.dark,
    },
    {
      name:"Spinocerebellum\n(Paleocerebellum)",
      area:"Vermis + intermediate cortex",
      fn:"Ongoing limb movement regulation; receives proprioception from spinal cord",
      dx:"Lesion → limb ataxia, dysdiadochokinesia, dysmetria",
      fill:C.midBlue,
    },
    {
      name:"Cerebrocerebellum\n(Neocerebellum)",
      area:"Lateral hemispheres",
      fn:"Motor planning, timing, learning; works with motor cortex via dentate nucleus",
      dx:"Lesion → ipsilateral limb incoordination, intention tremor, hypotonia",
      fill:C.teal,
    },
  ];

  zones.forEach(({ name, area, fn, dx, fill }, i) => {
    card(s, 0.25 + i*3.25, 1.3, 3.1, 4.05);
    s.addShape(pres.ShapeType.rect, { x:0.25 + i*3.25, y:1.3, w:3.1, h:0.45, fill:{ color:fill } });
    s.addText(name, {
      x:0.25 + i*3.25, y:1.3, w:3.1, h:0.45,
      fontSize:10, bold:true, color:"FFFFFF", align:"center", valign:"middle", margin:0,
    });
    s.addText(area, {
      x:0.35 + i*3.25, y:1.8, w:2.9, h:0.25,
      fontSize:9.5, italic:true, color:fill, bold:true, margin:0,
    });
    s.addText("Function:", {
      x:0.35 + i*3.25, y:2.1, w:2.9, h:0.2,
      fontSize:10, bold:true, color:C.navy, margin:0,
    });
    s.addText(fn, {
      x:0.35 + i*3.25, y:2.3, w:2.9, h:0.75,
      fontSize:9.5, color:C.navy, wrap:true, margin:0,
    });
    s.addShape(pres.ShapeType.rect, { x:0.35 + i*3.25, y:3.1, w:2.9, h:0.02, fill:{ color:C.ltBlue } });
    s.addText("Clinical:", {
      x:0.35 + i*3.25, y:3.15, w:2.9, h:0.2,
      fontSize:10, bold:true, color:C.coral, margin:0,
    });
    s.addText(dx, {
      x:0.35 + i*3.25, y:3.35, w:2.9, h:0.95,
      fontSize:9.5, color:C.navy, wrap:true, margin:0,
    });
  });

  s.addText("Cerebellar lesions → ipsilateral deficits (cerebellum affects same-side body, unlike CST)", {
    x:0.3, y:5.28, w:9.4, h:0.25,
    fontSize:9.5, italic:true, color:C.coral, align:"center",
  });
}

// ─────────────────────────────────────────────
// SLIDE 12 — EXTRAPYRAMIDAL PATHWAYS (Descending)
// ─────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:"F7FAFD" } });
  accentBar(s, C.navy, 0, 0, 10, 0.07);
  sectionTag(s, "DESCENDING PATHWAYS");
  heading(s, "Non-Pyramidal Descending Motor Pathways");

  const pathways = [
    {
      name:"Rubrospinal Tract",
      origin:"Red nucleus (midbrain tegmentum)",
      cross:"Crosses at midbrain level",
      fn:"Limb flexor tone; parallels lateral CST function in humans (minor role)",
      color:C.midBlue,
    },
    {
      name:"Vestibulospinal Tract",
      origin:"Lateral & medial vestibular nuclei",
      cross:"Uncrossed (lateral); bilateral (medial)",
      fn:"Maintains upright posture; activates extensor muscles; controlled by cerebellum",
      color:C.teal,
    },
    {
      name:"Reticulospinal Tract",
      origin:"Pontine & medullary reticular formation",
      cross:"Bilateral projections",
      fn:"Modulates reflexes, autonomic function, locomotion; controls axial/proximal muscles",
      color:C.gold,
    },
    {
      name:"Tectospinal Tract",
      origin:"Superior colliculus (midbrain tectum)",
      cross:"Crosses in midbrain",
      fn:"Head and eye orientation to visual/auditory stimuli; short cervical projection",
      color:C.navy,
    },
    {
      name:"Corticobulbar Tract",
      origin:"Motor cortex (face representation)",
      cross:"Bilateral to most CN nuclei; contralateral only to lower face (VII), XII",
      fn:"Controls cranial nerve motor nuclei — face, jaw, tongue, pharynx, larynx",
      color:C.coral,
    },
  ];

  pathways.forEach(({ name, origin, cross, fn, color }, i) => {
    const x = i < 3 ? 0.3 : 5.45;
    const y = i < 3 ? 1.32 + i * 1.3 : 1.32 + (i-3) * 1.3;
    card(s, x, y, 4.75, 1.17);
    s.addShape(pres.ShapeType.rect, { x, y, w:0.15, h:1.17, fill:{ color } });
    s.addText(name, {
      x: x+0.22, y: y+0.04, w:4.5, h:0.26,
      fontSize:11, bold:true, color, margin:0,
    });
    s.addText(`Origin: ${origin}`, {
      x: x+0.22, y: y+0.3, w:4.5, h:0.2,
      fontSize:9, color:C.grey, margin:0,
    });
    s.addText(`Crossing: ${cross}`, {
      x: x+0.22, y: y+0.5, w:4.5, h:0.2,
      fontSize:9, italic:true, color:C.grey, margin:0,
    });
    s.addText(`Function: ${fn}`, {
      x: x+0.22, y: y+0.7, w:4.5, h:0.42,
      fontSize:9.5, color:C.navy, wrap:true, margin:0,
    });
  });
}

// ─────────────────────────────────────────────
// SLIDE 13 — CLINICAL SYNDROMES / LESION LOCALIZATION
// ─────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:"F7FAFD" } });
  accentBar(s, C.coral, 0, 0, 10, 0.07);
  sectionTag(s, "CLINICAL SYNDROMES");
  heading(s, "Motor Pathway Lesion Localization");

  const syndromes = [
    {
      site:"Motor Cortex", pattern:"Contralateral mono/hemiparesis; cortical hand area especially affected; seizures possible", color:C.dark,
    },
    {
      site:"Internal Capsule\n(posterior limb)", pattern:"Dense contralateral hemiplegia (face, arm, leg equally); pure motor hemiparesis in lacunar infarcts", color:C.coral,
    },
    {
      site:"Cerebral Peduncle / Brainstem", pattern:"Crossed syndrome: ipsilateral CN palsy + contralateral hemiplegia (Weber, Millard-Gubler, etc.)", color:C.navy,
    },
    {
      site:"Spinal Cord\n(hemi-section)", pattern:"Brown-Séquard: ipsilateral motor loss + vibration/proprioception loss; contralateral pain/temperature loss", color:C.midBlue,
    },
    {
      site:"Anterior Horn Cell", pattern:"LMN signs only (flaccid, atrophy, fasciculations); no sensory loss — polio, ALS (+ UMN)", color:C.teal,
    },
    {
      site:"Peripheral Nerve / Root", pattern:"LMN signs in nerve distribution; sensory loss present; dermatomal (root) vs nerve territory", color:C.gold,
    },
  ];

  syndromes.forEach(({ site, pattern, color }, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = col === 0 ? 0.3 : 5.15;
    const y = 1.35 + row * 1.35;

    card(s, x, y, 4.6, 1.22);
    s.addShape(pres.ShapeType.rect, { x, y, w:1.55, h:1.22, fill:{ color } });
    s.addText(site, {
      x, y, w:1.55, h:1.22,
      fontSize:10, bold:true, color: color===C.gold ? C.navy : "FFFFFF",
      align:"center", valign:"middle", margin:4,
    });
    s.addText(pattern, {
      x: x+1.63, y, w:2.9, h:1.22,
      fontSize:9.5, color:C.navy, valign:"middle", wrap:true, margin:4,
    });
  });
}

// ─────────────────────────────────────────────
// SLIDE 14 — ALS (COMBINED UMN + LMN)
// ─────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:"F7FAFD" } });
  accentBar(s, C.navy, 0, 0, 10, 0.07);
  sectionTag(s, "CLINICAL CASE");
  heading(s, "ALS — Combined UMN + LMN Disease");

  // Banner
  s.addShape(pres.ShapeType.rect, { x:0.3, y:1.35, w:9.4, h:0.38, fill:{ color:C.navy } });
  s.addText("Amyotrophic Lateral Sclerosis (ALS) — Lou Gehrig Disease", {
    x:0.3, y:1.35, w:9.4, h:0.38,
    fontSize:12, bold:true, color:"FFFFFF", align:"center", valign:"middle", margin:0,
  });

  card(s, 0.3, 1.77, 4.6, 3.6);
  s.addText("UMN Signs (Lateral Column)", {
    x:0.4, y:1.82, w:4.4, h:0.28, fontSize:11, bold:true, color:C.coral, margin:0,
  });
  bullets(s, [
    "Spasticity",
    "Hyperreflexia",
    "Positive Babinski",
    "Pseudobulbar affect (emotional lability)",
    "Due to corticospinal tract degeneration",
  ], 0.4, 2.12, 4.4, 1.5, 10.5);

  s.addText("LMN Signs (Anterior Horn)", {
    x:0.4, y:3.7, w:4.4, h:0.28, fontSize:11, bold:true, color:C.midBlue, margin:0,
  });
  bullets(s, [
    "Flaccid weakness + wasting",
    "Fasciculations (hallmark)",
    "Tongue fasciculations + bulbar weakness",
    "Due to α motor neuron degeneration",
  ], 0.4, 4.0, 4.4, 1.3, 10.5);

  card(s, 5.15, 1.77, 4.5, 3.6);
  s.addText("Key Facts", { x:5.25, y:1.82, w:4.3, h:0.28, fontSize:11, bold:true, color:C.navy, margin:0 });
  bullets(s, [
    "Selective degeneration of α-motor neurons + corticospinal tract",
    "Spares: cognition, sensory, bowel/bladder, eye movements",
    "Incidence: 0.5–3 / 100,000/year; peaks in middle age",
    "Survival: typically 3–5 years post-diagnosis",
    "5–10% familial; SOD1 mutation on chromosome 21 (~40% familial)",
    "SOD1 defect → free radical accumulation → neurotoxicity",
    "Treatment: Riluzole (glutamate antagonist — modestly slows progression)",
    "Baclofen for spasticity; supportive ventilation for respiratory failure",
  ], 5.25, 2.12, 4.3, 3.2, 10);
}

// ─────────────────────────────────────────────
// SLIDE 15 — SPASTICITY vs RIGIDITY vs FLACCIDITY
// ─────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:"F7FAFD" } });
  accentBar(s, C.teal, 0, 0, 10, 0.07);
  sectionTag(s, "TONE DISORDERS");
  heading(s, "Tone Abnormalities — Spasticity, Rigidity & Flaccidity");

  const toneCards = [
    {
      title:"SPASTICITY",
      subtitle:"UMN Lesion",
      color:C.coral,
      points:[
        "Velocity-dependent increase in muscle tone",
        "Clasp-knife phenomenon on passive stretch",
        "Affects anti-gravity muscles (flexors in arms, extensors in legs)",
        "Hyperreflexia, clonus, Babinski present",
        "Cause: loss of descending inhibition on stretch reflex",
        "Treatment: baclofen, tizanidine, botulinum toxin, physiotherapy",
      ],
    },
    {
      title:"RIGIDITY",
      subtitle:"Basal Ganglia Lesion (e.g. Parkinson's)",
      color:C.gold,
      points:[
        "Velocity-independent increase in tone",
        "Lead-pipe or cogwheel pattern (cogwheel = tremor superimposed)",
        "Affects flexors and extensors equally",
        "Reflexes: normal or slightly decreased",
        "Mechanism: loss of dopamine → overactive indirect pathway",
        "Parkinson's triad: rigidity + tremor (resting 4–6Hz) + bradykinesia",
      ],
    },
    {
      title:"FLACCIDITY",
      subtitle:"LMN Lesion / Myopathy",
      color:C.midBlue,
      points:[
        "Decreased or absent muscle tone",
        "No resistance to passive movement",
        "Associated with hyporeflexia/areflexia",
        "Muscle wasting ± fasciculations (LMN) or no wasting (NMJ/myopathy)",
        "Also seen acutely after UMN lesion (spinal shock)",
        "Returns to spasticity as spinal shock resolves",
      ],
    },
  ];

  toneCards.forEach(({ title, subtitle, color, points }, i) => {
    card(s, 0.25 + i*3.25, 1.32, 3.1, 4.08);
    s.addShape(pres.ShapeType.rect, { x:0.25 + i*3.25, y:1.32, w:3.1, h:0.55, fill:{ color } });
    s.addText(title, {
      x:0.25 + i*3.25, y:1.32, w:3.1, h:0.32,
      fontSize:13, bold:true,
      color: color===C.gold ? C.navy : "FFFFFF",
      align:"center", valign:"middle", margin:0,
    });
    s.addText(subtitle, {
      x:0.25 + i*3.25, y:1.64, w:3.1, h:0.23,
      fontSize:9, italic:true,
      color: color===C.gold ? C.navy : "FFFFFF",
      align:"center", margin:0,
    });
    bullets(s, points, 0.35 + i*3.25, 1.92, 2.9, 3.45, 10);
  });
}

// ─────────────────────────────────────────────
// SLIDE 16 — GAIT PATTERNS
// ─────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:"F7FAFD" } });
  accentBar(s, C.gold, 0, 0, 10, 0.07);
  sectionTag(s, "GAIT");
  heading(s, "Abnormal Gaits & Motor Lesion Localization");

  const gaits = [
    { name:"Hemiplegic Gait", cause:"UMN (cortex/IC/CST)", desc:"Circumduction of extended spastic leg; arm flexed at elbow; typical after stroke", fill:C.coral },
    { name:"Scissor Gait", cause:"Bilateral UMN (spastic diplegia)", desc:"Legs cross midline with each step; hip adductors tight; seen in cerebral palsy", fill:C.navy },
    { name:"Foot-Drop Gait\n(Steppage)", cause:"LMN — common peroneal nerve / L4-L5", desc:"High stepping to clear foot; slap on landing; cannot dorsiflex foot", fill:C.midBlue },
    { name:"Cerebellar Ataxic Gait", cause:"Cerebellar lesion", desc:"Wide-based, staggering gait; cannot walk heel-to-toe (tandem); worse eyes open or closed", fill:C.teal },
    { name:"Parkinsonian Gait", cause:"Basal ganglia — Parkinson's", desc:"Shuffling, festinating; reduced arm swing; stooped posture; start/stop hesitation", fill:C.gold },
    { name:"Sensory Ataxic Gait", cause:"Posterior column / Large-fiber neuropathy", desc:"Wide-based; high steppage; stamps feet; markedly worse with eyes closed (Romberg +)", fill:C.grey },
  ];

  gaits.forEach(({ name, cause, desc, fill }, i) => {
    const col = i % 3;
    const row = Math.floor(i / 3);
    const x = 0.3 + col * 3.2;
    const y = 1.35 + row * 2.0;

    card(s, x, y, 3.0, 1.88);
    s.addShape(pres.ShapeType.rect, { x, y, w:3.0, h:0.35, fill:{ color:fill } });
    s.addText(name, {
      x, y, w:3.0, h:0.35,
      fontSize:10, bold:true,
      color: fill===C.gold ? C.navy : "FFFFFF",
      align:"center", valign:"middle", margin:0,
    });
    s.addText(`Cause: ${cause}`, {
      x: x+0.1, y: y+0.38, w:2.8, h:0.25,
      fontSize:9, italic:true, color:fill===C.gold ? C.navy : fill, bold:true, margin:0,
    });
    s.addText(desc, {
      x: x+0.1, y: y+0.62, w:2.8, h:1.2,
      fontSize:9.5, color:C.navy, wrap:true, margin:0,
    });
  });
}

// ─────────────────────────────────────────────
// SLIDE 17 — SPINAL SHOCK & RECOVERY
// ─────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:"F7FAFD" } });
  accentBar(s, C.navy, 0, 0, 10, 0.07);
  sectionTag(s, "SPINAL CORD");
  heading(s, "Spinal Shock & Recovery of Function");

  card(s, 0.3, 1.3, 9.4, 0.55);
  s.addText("Spinal Shock: immediate loss of all spinal reflex activity below a complete spinal cord injury, with flaccid paralysis and areflexia — lasting hours to weeks", {
    x:0.5, y:1.34, w:9.1, h:0.47,
    fontSize:11, color:C.navy, italic:false, bold:true, valign:"middle", margin:0,
  });

  // Timeline
  const phases = [
    { phase:"Hours–Days", label:"Spinal Shock", desc:"Complete flaccid paralysis below injury. Areflexia. Loss of autonomic function (hypotension, bradycardia, bladder/bowel paralysis). Mechanism: sudden loss of excitatory input from descending tracts.", fill:C.dark },
    { phase:"Days–Weeks", label:"Early Recovery", desc:"Appearance of Babinski sign. Delayed plantar response returns. Bulbocavernosus reflex returns (earliest sign). Tone begins to increase.", fill:C.navy },
    { phase:"Weeks–Months", label:"Spasticity Emerges", desc:"Hyperreflexia develops. Spastic tone replaces flaccidity. Flexor then extensor spasms. Autonomic dysreflexia risk (lesions above T6). Bladder reflex returns.", fill:C.coral },
    { phase:"Months+", label:"Chronic Phase", desc:"Established spastic paraplegia/quadriplegia. Mass reflex possible (T6 and above). Long-term management: tone, UTI prevention, pressure sore prevention, rehab.", fill:C.midBlue },
  ];

  phases.forEach(({ phase, label, desc, fill }, i) => {
    card(s, 0.3 + i*2.38, 1.95, 2.25, 3.48);
    s.addShape(pres.ShapeType.rect, { x:0.3 + i*2.38, y:1.95, w:2.25, h:0.65, fill:{ color:fill } });
    s.addText(phase, {
      x:0.3 + i*2.38, y:1.95, w:2.25, h:0.3,
      fontSize:9, color:"FFFFFF", align:"center", italic:true, margin:0,
    });
    s.addText(label, {
      x:0.3 + i*2.38, y:2.25, w:2.25, h:0.35,
      fontSize:11, bold:true, color:"FFFFFF", align:"center", valign:"middle", margin:0,
    });
    s.addText(desc, {
      x:0.4 + i*2.38, y:2.65, w:2.1, h:2.7,
      fontSize:9.5, color:C.navy, wrap:true, margin:0,
    });
  });
}

// ─────────────────────────────────────────────
// SLIDE 18 — CLINICAL MNEMONICS & EXAM TIPS
// ─────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:"F7FAFD" } });
  accentBar(s, C.teal, 0, 0, 10, 0.07);
  sectionTag(s, "EXAM TIPS");
  heading(s, "Key Mnemonics & Clinical Pearls");

  const tips = [
    {
      title:'UMN Signs: "SHAFT"',
      items:["S — Spasticity", "H — Hyperreflexia", "A — Atrophy (mild/disuse)", "F — Fasciculations absent", "T — Tone increased + Babinski +ve"],
      color:C.coral,
    },
    {
      title:'LMN Signs: "WAFFLES"',
      items:["W — Weakness (flaccid)", "A — Atrophy (marked)", "F — Fasciculations", "F — Flaccidity", "L — Loss of reflexes (areflexia)", "E — Electromyography abnormal", "S — Sensory may be involved (if nerve)"],
      color:C.midBlue,
    },
    {
      title:"Crossed Brainstem Syndromes",
      items:["CN palsy IPSILATERAL to lesion", "Hemiplegia CONTRALATERAL to lesion", "Weber: CN III + contralateral hemiplegia (midbrain)", "Millard-Gubler: CN VI/VII + contralateral hemi (pons)", "Wallenberg: PICA, lateral medulla — no hemiplegia"],
      color:C.navy,
    },
    {
      title:"High-Yield Reflex Levels",
      items:["Biceps: C5–C6", "Supinator: C5–C6", "Triceps: C7–C8", "Knee (patellar): L3–L4", "Ankle (Achilles): S1–S2", "Plantar (Babinski): S1, tests CST integrity"],
      color:C.teal,
    },
  ];

  tips.forEach(({ title, items, color }, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = col === 0 ? 0.3 : 5.15;
    const y = 1.32 + row * 2.1;

    card(s, x, y, 4.6, 1.98);
    s.addShape(pres.ShapeType.rect, { x, y, w:4.6, h:0.36, fill:{ color } });
    s.addText(title, {
      x, y, w:4.6, h:0.36,
      fontSize:11, bold:true, color:"FFFFFF", align:"center", valign:"middle", margin:0,
    });
    bullets(s, items, x+0.1, y+0.4, 4.4, 1.55, 10);
  });
}

// ─────────────────────────────────────────────
// SLIDE 19 — SUMMARY COMPARISON TABLE
// ─────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:"F7FAFD" } });
  accentBar(s, C.gold, 0, 0, 10, 0.07);
  sectionTag(s, "SUMMARY");
  heading(s, "Motor Pathway Summary — Quick Reference");

  const tableData = [
    ["Feature", "Pyramidal (CST)", "Extrapyramidal (BG)", "Cerebellum"],
    ["Primary Function", "Voluntary movement", "Movement initiation/inhibition, tone", "Coordination & timing"],
    ["Tract Origin", "Motor cortex (area 4, 6)", "Cortex → Striatum → GP → Thalamus", "Cerebellar cortex → deep nuclei"],
    ["Decussation", "Pyramidal decussation (85%)", "N/A (loop through thalamus)", "Superior cerebellar peduncle"],
    ["Ipsi/Contra effect", "Contralateral body control", "Contralateral (via cortex)", "Ipsilateral (same side)"],
    ["If damaged", "Spastic paralysis, Babinski+, hyperreflexia", "Parkinsonism or dyskinesia", "Ataxia, dysmetria, tremor (intention)"],
    ["Key neurons", "Betz cells, α-motor neurons", "Medium spiny neurons (striatum)", "Purkinje cells (inhibitory)"],
    ["Key NT", "Glutamate (excitatory)", "Dopamine (D1+, D2-), GABA", "GABA (Purkinje → deep nuclei)"],
  ];

  const colW = [2.1, 2.45, 2.7, 2.3];
  const colX = [0.2, 2.3, 4.75, 7.45];
  const fills = [C.navy, C.teal, C.gold, C.midBlue];

  // Header row
  tableData[0].forEach((h, ci) => {
    s.addShape(pres.ShapeType.rect, { x:colX[ci], y:1.32, w:colW[ci], h:0.38, fill:{ color:fills[ci] } });
    s.addText(h, {
      x:colX[ci], y:1.32, w:colW[ci], h:0.38,
      fontSize:10.5, bold:true,
      color: fills[ci]===C.gold ? C.navy : "FFFFFF",
      align:"center", valign:"middle", margin:0,
    });
  });

  // Data rows
  tableData.slice(1).forEach((row, ri) => {
    const bg = ri % 2 === 0 ? "EBF5FB" : "FFFFFF";
    row.forEach((cell, ci) => {
      s.addShape(pres.ShapeType.rect, {
        x:colX[ci], y:1.7 + ri*0.55, w:colW[ci], h:0.55,
        fill:{ color:bg },
        line:{ color:"D5E8F5", width:0.5 },
      });
      s.addText(cell, {
        x:colX[ci]+0.06, y:1.7 + ri*0.55, w:colW[ci]-0.1, h:0.55,
        fontSize:9, color: ci===0 ? C.navy : C.dark,
        bold: ci===0, valign:"middle", wrap:true, margin:0,
      });
    });
  });
}

// ─────────────────────────────────────────────
// SLIDE 20 — THANK YOU / REFERENCES
// ─────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:C.navy } });
  s.addShape(pres.ShapeType.rect, { x:0, y:3.8, w:10, h:0.08, fill:{ color:C.gold } });
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:0.18, h:5.625, fill:{ color:C.teal } });

  s.addText("Thank You", {
    x:0.5, y:0.6, w:9, h:0.9,
    fontSize:44, bold:true, color:C.white, charSpacing:2,
  });
  s.addText("Motor Pathways in Clinical Physiology", {
    x:0.5, y:1.55, w:9, h:0.4,
    fontSize:16, color:C.ltBlue, italic:true,
  });

  s.addText("References", {
    x:0.5, y:2.1, w:9, h:0.28, fontSize:13, bold:true, color:C.gold,
  });

  const refs = [
    "Guyton AC, Hall JE. Textbook of Medical Physiology, 14th ed. Elsevier, 2020.",
    "Blumenfeld H. Neuroanatomy through Clinical Cases, 3rd ed. Sinauer Associates, 2021.",
    "Ganong WF. Review of Medical Physiology, 26th ed. McGraw-Hill, 2019.",
    "Brazis PW, Masdeu JC, Biller J. Localization in Clinical Neurology, 8th ed. Wolters Kluwer, 2022.",
  ];

  refs.forEach((ref, i) => {
    s.addText(`• ${ref}`, {
      x:0.5, y:2.44 + i*0.32, w:9, h:0.3,
      fontSize:9.5, color:C.grey, italic:false,
    });
  });

  s.addText("Key Questions to Review:", {
    x:0.5, y:3.97, w:9, h:0.24, fontSize:11, bold:true, color:C.teal,
  });
  const qs = [
    "1. What signs distinguish UMN from LMN lesion? Why does Babinski sign occur?",
    "2. Trace a corticospinal fiber from M1 to a hand muscle — name every structure it passes through.",
    "3. How does loss of dopamine in Parkinson's disease shift basal ganglia circuit balance?",
  ];
  qs.forEach((q, i) => {
    s.addText(q, { x:0.5, y:4.22 + i*0.3, w:9, h:0.28, fontSize:9.5, color:C.ltBlue });
  });
}

// ─────────────────────────────────────────────
// WRITE FILE
// ─────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/motor-pathway-ppt/Motor_Pathways_Physiology.pptx" })
  .then(() => console.log("✅ PPTX created successfully!"))
  .catch(err => { console.error("❌ Error:", err); process.exit(1); });
Running Command

cd /home/daytona/workspace/motor-pathway-ppt && node motor_pathway.js 2>&1

Running Command

ls -lh /home/daytona/workspace/motor-pathway-ppt/Motor_Pathways_Physiology.pptx

Your presentation is ready! Download it here:

Motor Pathways Physiology

Presentation · PPTX


What's inside — 20 slides (navy/teal/gold design):

#SlideContent
1TitleMotor Pathways - Physiology, Anatomy & Clinical Correlations
2Outline10-topic overview with numbered cards
3Motor Control HierarchyPyramid diagram: cortex → brainstem → spinal cord → muscle
4Motor Cortex & HomunculusM1, PMA, SMA (Brodmann areas) + homuncular representation
5Corticospinal TractFull course: corona radiata → IC → peduncles → pyramidal decussation
6Internal CapsuleAll 5 parts with tracts + clinical stroke patterns
7Lower Motor Neuronsα neurons, γ neurons, neuromuscular junction
8UMN vs LMN Table9-row comparison: tone, reflexes, atrophy, Babinski, clonus
9Reflexes & BabinskiMonosynaptic stretch reflex arc + Babinski sign physiology
10Extrapyramidal / Basal GangliaDirect vs indirect pathway, Parkinson's, Huntington's, hemiballismus
11Cerebellum3 zones (vestibulocerebellum, spinocerebellum, cerebrocerebellum)
12Non-Pyramidal Descending TractsRubrospinal, vestibulospinal, reticulospinal, corticobulbar
13Lesion LocalizationCortex, IC, brainstem, spinal cord, anterior horn, peripheral nerve
14ALSCombined UMN + LMN disease; SOD1, riluzole, management
15Tone DisordersSpasticity vs rigidity vs flaccidity — mechanism + treatment
16Gait Patterns6 abnormal gaits with cause and clinical description
17Spinal Shock & Recovery4-phase timeline from hours to months post-SCI
18Mnemonics & Exam PearlsSHAFT, WAFFLES, crossed brainstem syndromes, reflex levels
19Summary TablePyramidal vs extrapyramidal vs cerebellar side-by-side
20References & Questions4 textbook references + 3 self-assessment questions
Content sourced from Guyton & Hall, Neuroanatomy through Clinical Cases, and Ganong's Review of Medical Physiology.
This is a shared conversation. Sign in to Orris to start your own chat.