Write university like handwritten notes on urinary bladder for anatomy with clinical applied

Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Loading Image
Loading Image
Loading Image
Finding Sources
Finding Sources
Reading File
Reading File
Running Command

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

Running Command

mkdir -p /home/daytona/workspace/bladder-notes && ls /home/daytona/workspace/bla…

Writing File

~/bladder-notes/create_notes.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = 'LAYOUT_WIDE'; // 13.3" x 7.5"
pres.title = 'Urinary Bladder - Anatomy Notes';
pres.author = 'University Anatomy Notes';

// ─── Color Palette (Handwritten notebook feel) ───────────────────────────────
const BG       = "FFFDF4";   // warm cream paper
const INK      = "1A1A2E";   // deep navy ink
const HEADING  = "1B4F72";   // blue heading (like colored marker)
const RED      = "C0392B";   // red ink for important points
const GREEN    = "1E8449";   // green for clinical notes
const PURPLE   = "6C3483";   // purple for mnemonics
const ORANGE   = "D35400";   // orange for embryology
const LIGHT_BG = "EBF5FB";   // light blue boxes
const GREEN_BG = "EAFAF1";   // light green boxes
const RED_BG   = "FDEDEC";   // light red for clinical
const RULED    = "D6EAF8";   // ruled line color

// ─── Helper: ruled-line background  ─────────────────────────────────────────
function addRuledBg(slide) {
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 7.5, fill: { color: BG }, line: { color: BG } });
  // Horizontal rules
  for (let y = 0.9; y < 7.5; y += 0.34) {
    slide.addShape(pres.ShapeType.line, { x: 0.3, y, w: 12.7, h: 0, line: { color: RULED, width: 0.5, dashType: 'solid' } });
  }
  // Left red margin line
  slide.addShape(pres.ShapeType.line, { x: 1.1, y: 0.3, w: 0, h: 7.0, line: { color: "F1948A", width: 1.2 } });
}

function slideHeader(slide, title, subtitle) {
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 0.62, fill: { color: HEADING }, line: { color: HEADING } });
  slide.addText(title, { x: 0.15, y: 0.08, w: 9, h: 0.48, fontSize: 20, fontFace: 'Patrick Hand SC', bold: true, color: 'FFFFFF', margin: 0 });
  if (subtitle) {
    slide.addText(subtitle, { x: 9.2, y: 0.1, w: 3.9, h: 0.42, fontSize: 11, fontFace: 'Patrick Hand SC', color: 'D6EEF8', align: 'right', margin: 0 });
  }
}

function box(slide, x, y, w, h, fillColor, borderColor, text, textOptions) {
  slide.addShape(pres.ShapeType.roundRect, { x, y, w, h, fill: { color: fillColor }, line: { color: borderColor, width: 1 }, rectRadius: 0.07 });
  if (text) {
    slide.addText(text, { x: x + 0.08, y: y + 0.04, w: w - 0.16, h: h - 0.08, ...textOptions });
  }
}

// ─── SLIDE 1: Title ──────────────────────────────────────────────────────────
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 7.5, fill: { color: "0D2137" }, line: { color: "0D2137" } });
  // decorative ruled lines
  for (let i = 0; i < 14; i++) {
    sl.addShape(pres.ShapeType.line, { x: 0, y: 0.5 + i * 0.52, w: 13.3, h: 0, line: { color: "1B3A55", width: 0.6 } });
  }
  sl.addShape(pres.ShapeType.rect, { x: 0.5, y: 0.9, w: 12.3, h: 5.7, fill: { color: "FFFDF4", transparency: 5 }, line: { color: "A9CCE3", width: 1.5 } });
  sl.addShape(pres.ShapeType.line, { x: 1.6, y: 0.9, w: 0, h: 5.7, line: { color: "F1948A", width: 1.5 } });
  sl.addText("URINARY BLADDER", { x: 2, y: 1.4, w: 10, h: 1.0, fontSize: 48, bold: true, color: INK, fontFace: 'Patrick Hand SC', align: 'center' });
  sl.addText("Anatomy with Clinical Applications", { x: 2, y: 2.55, w: 10, h: 0.55, fontSize: 22, color: HEADING, fontFace: 'Patrick Hand SC', align: 'center', italic: true });
  sl.addShape(pres.ShapeType.line, { x: 2.5, y: 3.2, w: 8.3, h: 0, line: { color: RED, width: 1.5 } });
  sl.addText([
    { text: "Topics: ", options: { bold: true, color: RED } },
    { text: "Position & Parts  •  Relations  •  Interior  •  Histology  •  Blood Supply\nInnervation  •  Lymphatics  •  Micturition  •  Embryology  •  Clinical Notes", options: { color: INK } }
  ], { x: 2, y: 3.4, w: 9.5, h: 1.3, fontSize: 14, fontFace: 'Patrick Hand SC', align: 'center' });
  sl.addText("✏  University Anatomy Notes   |   Date: _______________   |   Subject: Human Anatomy", {
    x: 0.6, y: 6.75, w: 12, h: 0.45, fontSize: 11, color: "7F8C8D", fontFace: 'Patrick Hand SC', align: 'center'
  });
}

// ─── SLIDE 2: Introduction & Position ────────────────────────────────────────
{
  const sl = pres.addSlide();
  addRuledBg(sl);
  slideHeader(sl, "1. INTRODUCTION & POSITION", "Urinary Bladder | Anatomy");

  // Left column
  sl.addText("Definition & Basic Facts", { x: 1.2, y: 0.75, w: 5.5, h: 0.35, fontSize: 14, bold: true, color: HEADING, fontFace: 'Patrick Hand SC', underline: true });
  sl.addText([
    { text: "• ", options: { color: RED, bold: true } }, { text: "Hollow, muscular, distensible reservoir for urine\n", options: { color: INK } },
    { text: "• ", options: { color: RED, bold: true } }, { text: "Located in the lesser pelvis, posterior to pubic symphysis\n", options: { color: INK } },
    { text: "• ", options: { color: RED, bold: true } }, { text: "Capacity: ~", options: { color: INK } }, { text: "500 mL", options: { color: RED, bold: true } }, { text: " (urge to void at ~300 mL)\n", options: { color: INK } },
    { text: "• ", options: { color: RED, bold: true } }, { text: "Shape varies: EMPTY = pyramidal; FULL = ovoid\n", options: { color: INK } },
    { text: "• ", options: { color: RED, bold: true } }, { text: "When full, apex rises above pubic symphysis into abdomen\n", options: { color: INK } },
  ], { x: 1.2, y: 1.12, w: 5.6, h: 1.8, fontSize: 12, fontFace: 'Patrick Hand SC', lineSpacingMultiple: 1.3 });

  sl.addText("Parts of Urinary Bladder", { x: 1.2, y: 3.0, w: 5.5, h: 0.35, fontSize: 14, bold: true, color: HEADING, fontFace: 'Patrick Hand SC', underline: true });

  const parts = [
    { label: "APEX", desc: "Anterosuperior; attached to median umbilical ligament (obliterated urachus) → umbilicus", col: ORANGE },
    { label: "BODY", desc: "Main bulk of organ; bounded by superior + 2 inferolateral surfaces", col: HEADING },
    { label: "FUNDUS (Base)", desc: "Posterior; receives 2 ureters; related to seminal vesicles (M) / uterus/vagina (F)", col: PURPLE },
    { label: "NECK", desc: "Inferiormost; continuous with urethra; most fixed part; rests on prostate (M) / UG diaphragm (F)", col: RED },
  ];

  parts.forEach((p, i) => {
    box(sl, 1.2, 3.45 + i * 0.82, 5.6, 0.74, i % 2 === 0 ? LIGHT_BG : "FEF9E7", p.col, null, {});
    sl.addText(p.label, { x: 1.3, y: 3.5 + i * 0.82, w: 1.5, h: 0.64, fontSize: 11, bold: true, color: p.col, fontFace: 'Patrick Hand SC', valign: 'middle' });
    sl.addText(p.desc, { x: 2.85, y: 3.5 + i * 0.82, w: 4.0, h: 0.64, fontSize: 10.5, color: INK, fontFace: 'Patrick Hand SC', valign: 'middle', wrap: true });
  });

  // Right column: Gender differences box
  sl.addText("Position by Gender & Age", { x: 7.3, y: 0.75, w: 5.6, h: 0.35, fontSize: 14, bold: true, color: HEADING, fontFace: 'Patrick Hand SC', underline: true });

  box(sl, 7.3, 1.12, 5.6, 1.4, LIGHT_BG, HEADING, null, {});
  sl.addText("MALE RELATIONS (posterior)", { x: 7.4, y: 1.18, w: 5.4, h: 0.28, fontSize: 11, bold: true, color: HEADING, fontFace: 'Patrick Hand SC' });
  sl.addText([
    { text: "• Seminal vesicles, vas deferens (posterolateral)\n", options: { color: INK } },
    { text: "• Rectum (posterior, separated by rectovesical pouch)\n", options: { color: INK } },
    { text: "• Prostate gland (inferior to bladder neck)\n", options: { color: INK } },
  ], { x: 7.5, y: 1.5, w: 5.2, h: 1.0, fontSize: 11, fontFace: 'Patrick Hand SC', lineSpacingMultiple: 1.2 });

  box(sl, 7.3, 2.6, 5.6, 1.3, GREEN_BG, GREEN, null, {});
  sl.addText("FEMALE RELATIONS (posterior)", { x: 7.4, y: 2.66, w: 5.4, h: 0.28, fontSize: 11, bold: true, color: GREEN, fontFace: 'Patrick Hand SC' });
  sl.addText([
    { text: "• Uterus (body) separated by vesicouterine pouch\n", options: { color: INK } },
    { text: "• Anterior vaginal wall (base of bladder sits on it)\n", options: { color: INK } },
    { text: "• Bladder neck: rests on perineal membrane / UG diaphragm\n", options: { color: INK } },
  ], { x: 7.5, y: 2.96, w: 5.2, h: 0.9, fontSize: 11, fontFace: 'Patrick Hand SC', lineSpacingMultiple: 1.2 });

  box(sl, 7.3, 3.98, 5.6, 0.75, RED_BG, RED, null, {});
  sl.addText("CHILDREN", { x: 7.4, y: 4.02, w: 5.4, h: 0.25, fontSize: 11, bold: true, color: RED, fontFace: 'Patrick Hand SC' });
  sl.addText("Bladder is an abdominal organ even when empty (descends to pelvis after puberty ~6 yrs)", { x: 7.5, y: 4.3, w: 5.2, h: 0.4, fontSize: 10.5, color: INK, fontFace: 'Patrick Hand SC', wrap: true });

  sl.addText("PERITONEAL RELATIONS:", { x: 7.3, y: 4.82, w: 5.6, h: 0.3, fontSize: 13, bold: true, color: HEADING, fontFace: 'Patrick Hand SC' });
  sl.addText([
    { text: "✦ Superior surface → COVERED by peritoneum\n", options: { color: HEADING } },
    { text: "✦ Anterior & lateral walls → NO peritoneum (retropubic space of Retzius)\n", options: { color: INK } },
    { text: "✦ As bladder fills → peritoneum peels off anterior wall → safe suprapubic access\n", options: { color: GREEN, bold: true } },
  ], { x: 7.3, y: 5.15, w: 5.6, h: 1.1, fontSize: 11, fontFace: 'Patrick Hand SC', lineSpacingMultiple: 1.3 });

  sl.addText("★ MOST FIXED PART = BLADDER NECK (prostate/UG diaphragm)", {
    x: 1.2, y: 7.1, w: 11.5, h: 0.3, fontSize: 11, bold: true, color: RED, fontFace: 'Patrick Hand SC', align: 'center'
  });
}

// ─── SLIDE 3: Interior & Histology ───────────────────────────────────────────
{
  const sl = pres.addSlide();
  addRuledBg(sl);
  slideHeader(sl, "2. INTERIOR OF BLADDER & HISTOLOGY", "Urinary Bladder | Anatomy");

  // Left: Interior
  sl.addText("Interior of Bladder", { x: 1.2, y: 0.75, w: 5.5, h: 0.35, fontSize: 14, bold: true, color: HEADING, fontFace: 'Patrick Hand SC', underline: true });

  sl.addText([
    { text: "Mucosa (empty): ", options: { bold: true, color: HEADING } }, { text: "thrown into irregular RUGAE / FOLDS → disappear when distended\n", options: { color: INK } },
    { text: "Mucosa (trigone): ", options: { bold: true, color: ORANGE } }, { text: "SMOOTH, no folds → firmly adherent to detrusor\n", options: { color: INK } },
  ], { x: 1.2, y: 1.15, w: 5.6, h: 0.85, fontSize: 12, fontFace: 'Patrick Hand SC', lineSpacingMultiple: 1.35 });

  // Trigone box
  box(sl, 1.2, 2.08, 5.6, 2.5, "FEF9E7", ORANGE, null, {});
  sl.addText("TRIGONE OF BLADDER", { x: 1.35, y: 2.14, w: 5.3, h: 0.35, fontSize: 13, bold: true, color: ORANGE, fontFace: 'Patrick Hand SC' });
  sl.addText([
    { text: "Triangular smooth area on the FLOOR / POSTERIOR WALL\n\n", options: { color: INK, bold: true } },
    { text: "Boundaries:\n", options: { bold: true, color: ORANGE } },
    { text: "  • Superolateral angles (×2) = ", options: { color: INK } }, { text: "Ureteric orifices\n", options: { bold: true, color: HEADING } },
    { text: "  • Inferior angle = ", options: { color: INK } }, { text: "Internal urethral orifice\n\n", options: { bold: true, color: HEADING } },
    { text: "Interureteric ridge (Mercier's bar) = ", options: { bold: true, color: PURPLE } }, { text: "transverse fold connecting ureteric orifices\n\n", options: { color: INK } },
    { text: "Uvula vesicae = ", options: { bold: true, color: RED } }, { text: "small elevation at internal urethral orifice in MALES (due to median lobe of prostate)\n\n", options: { color: INK } },
    { text: "Embryology: Trigone derived from MESONEPHRIC DUCT (mesoderm)\n", options: { color: ORANGE, italic: true } },
    { text: "  → NO muscularis mucosae or submucosal layer!\n", options: { color: ORANGE, italic: true } },
    { text: "Rest of bladder derived from CLOACA (endoderm)\n", options: { color: ORANGE, italic: true } },
  ], { x: 1.35, y: 2.52, w: 5.3, h: 2.0, fontSize: 10.5, fontFace: 'Patrick Hand SC', lineSpacingMultiple: 1.2 });

  sl.addText("Ureteric orifices open OBLIQUELY (antireflux mechanism!)", { x: 1.2, y: 4.65, w: 5.6, h: 0.3, fontSize: 11, bold: true, color: GREEN, fontFace: 'Patrick Hand SC' });

  // Right: Histology layers
  sl.addText("Histology / Layers of Bladder Wall", { x: 7.1, y: 0.75, w: 5.8, h: 0.35, fontSize: 14, bold: true, color: HEADING, fontFace: 'Patrick Hand SC', underline: true });

  const layers = [
    { num: "1", name: "UROTHELIUM (Transitional Epithelium)", detail: "Lines entire interior; stratified; 4-6 cell layers when empty, 2-3 when distended. Barrier function against urine. Umbrella cells at surface.", col: HEADING, bg: LIGHT_BG },
    { num: "2", name: "LAMINA PROPRIA", detail: "Loose vascular connective tissue; contains muscularis mucosae (thin, variable). ABSENT in trigone.", col: PURPLE, bg: "F9F0FF" },
    { num: "3", name: "DETRUSOR MUSCLE", detail: "Three ill-defined smooth muscle layers: inner longitudinal, middle circular, outer longitudinal. At internal urethral orifice → forms INTERNAL SPHINCTER (involuntary).\n• Sympathetic (β₃): RELAXES detrusor\n• Parasympathetic (M3): CONTRACTS detrusor", col: GREEN, bg: GREEN_BG },
    { num: "4", name: "ADVENTITIA / SEROSA", detail: "Fibrofattite adventitia on most surfaces. PERITONEUM (serosa) only on superior surface & part of posterior surface above trigone.", col: ORANGE, bg: "FEF9E7" },
  ];

  layers.forEach((l, i) => {
    box(sl, 7.1, 1.15 + i * 1.52, 5.8, 1.42, l.bg, l.col, null, {});
    sl.addText(l.num, { x: 7.18, y: 1.2 + i * 1.52, w: 0.38, h: 1.3, fontSize: 18, bold: true, color: l.col, fontFace: 'Patrick Hand SC', valign: 'middle', align: 'center' });
    sl.addText(l.name, { x: 7.6, y: 1.22 + i * 1.52, w: 5.2, h: 0.32, fontSize: 11.5, bold: true, color: l.col, fontFace: 'Patrick Hand SC' });
    sl.addText(l.detail, { x: 7.6, y: 1.56 + i * 1.52, w: 5.2, h: 1.0, fontSize: 10, color: INK, fontFace: 'Patrick Hand SC', wrap: true, lineSpacingMultiple: 1.15 });
  });

  // Footer note
  sl.addText("★ Trigone = smooth & adherent (no rugae) → First site of tumor implantation / schistosomiasis calcification", {
    x: 1.2, y: 7.05, w: 11.5, h: 0.35, fontSize: 10.5, bold: true, color: RED, fontFace: 'Patrick Hand SC', align: 'center'
  });
}

// ─── SLIDE 4: Blood Supply & Lymphatics ──────────────────────────────────────
{
  const sl = pres.addSlide();
  addRuledBg(sl);
  slideHeader(sl, "3. BLOOD SUPPLY & LYMPHATIC DRAINAGE", "Urinary Bladder | Anatomy");

  // Arterial supply
  sl.addText("Arterial Supply", { x: 1.2, y: 0.75, w: 5.5, h: 0.35, fontSize: 14, bold: true, color: RED, fontFace: 'Patrick Hand SC', underline: true });

  const arteries = [
    { vessel: "Superior Vesical Artery (×2)", src: "Branch of umbilical artery → from internal iliac artery", supply: "Superior, anterior & lateral surfaces of bladder + upper ureter", col: RED },
    { vessel: "Inferior Vesical Artery (×2)", src: "Direct branch of anterior trunk of internal iliac artery (male)\nVaginal artery equivalent (female)", supply: "Base (fundus), neck of bladder, seminal vesicles, prostate (M) / upper vagina (F)", col: PURPLE },
    { vessel: "Middle Rectal Artery", src: "Branch of internal iliac", supply: "Minor contribution to bladder base", col: ORANGE },
    { vessel: "Obturator & Inferior Gluteal", src: "Internal iliac branches", supply: "Small accessory twigs to bladder", col: "7D6608" },
  ];

  arteries.forEach((a, i) => {
    box(sl, 1.2, 1.15 + i * 1.1, 5.7, 1.02, i % 2 === 0 ? RED_BG : "FDF2F8", a.col, null, {});
    sl.addText(a.vessel, { x: 1.3, y: 1.18 + i * 1.1, w: 5.5, h: 0.3, fontSize: 11.5, bold: true, color: a.col, fontFace: 'Patrick Hand SC' });
    sl.addText("Source: " + a.src, { x: 1.3, y: 1.5 + i * 1.1, w: 5.5, h: 0.3, fontSize: 10, color: HEADING, fontFace: 'Patrick Hand SC', wrap: true });
    sl.addText("Supply: " + a.supply, { x: 1.3, y: 1.72 + i * 1.1, w: 5.5, h: 0.36, fontSize: 10, color: INK, fontFace: 'Patrick Hand SC', wrap: true });
  });

  sl.addText("All arterial supply from INTERNAL ILIAC ARTERY (anterior trunk)", {
    x: 1.2, y: 5.6, w: 5.7, h: 0.3, fontSize: 11, bold: true, color: RED, fontFace: 'Patrick Hand SC', align: 'center'
  });
  sl.addText("Rich collateral network → ligation of single artery is NOT detrimental", {
    x: 1.2, y: 5.9, w: 5.7, h: 0.3, fontSize: 10.5, color: GREEN, fontFace: 'Patrick Hand SC', align: 'center', italic: true
  });

  // Right: Venous & Lymphatics
  sl.addText("Venous Drainage", { x: 7.2, y: 0.75, w: 5.8, h: 0.35, fontSize: 14, bold: true, color: HEADING, fontFace: 'Patrick Hand SC', underline: true });
  box(sl, 7.2, 1.12, 5.8, 1.4, LIGHT_BG, HEADING, null, {});
  sl.addText([
    { text: "Vesical venous plexus ", options: { bold: true, color: HEADING } }, { text: "→ surrounds fundus & base\n", options: { color: INK } },
    { text: "→ Drains into ", options: { color: INK } }, { text: "Internal Iliac Veins\n", options: { bold: true, color: RED } },
    { text: "Communicates with: Prostatic venous plexus (M) | Vaginal venous plexus (F)\n", options: { color: INK } },
    { text: "Also communicates with vertebral (Batson's) plexus → metastasis pathway!", options: { bold: true, color: RED } },
  ], { x: 7.3, y: 1.2, w: 5.6, h: 1.28, fontSize: 10.5, fontFace: 'Patrick Hand SC', lineSpacingMultiple: 1.3 });

  sl.addText("Lymphatic Drainage", { x: 7.2, y: 2.62, w: 5.8, h: 0.35, fontSize: 14, bold: true, color: GREEN, fontFace: 'Patrick Hand SC', underline: true });

  const lymph = [
    { from: "Superior & lateral wall", to: "External iliac nodes", col: GREEN },
    { from: "Fundus & Trigone (base)", to: "Internal iliac nodes", col: HEADING },
    { from: "Anterior wall", to: "Internal iliac nodes (via obturator/iliac)", col: PURPLE },
    { from: "All nodes → ultimately", to: "Para-aortic nodes (lateral aortic)", col: ORANGE },
  ];

  box(sl, 7.2, 3.05, 5.8, 2.15, GREEN_BG, GREEN, null, {});
  sl.addText("Region → Lymph Node", { x: 7.3, y: 3.1, w: 5.6, h: 0.28, fontSize: 11, bold: true, color: GREEN, fontFace: 'Patrick Hand SC' });
  sl.addShape(pres.ShapeType.line, { x: 7.3, y: 3.4, w: 5.6, h: 0, line: { color: GREEN, width: 0.5 } });

  lymph.forEach((l, i) => {
    sl.addText(`${l.from}  →  `, { x: 7.35, y: 3.46 + i * 0.43, w: 3.1, h: 0.38, fontSize: 10.5, color: INK, fontFace: 'Patrick Hand SC', valign: 'middle' });
    sl.addText(l.to, { x: 10.45, y: 3.46 + i * 0.43, w: 2.4, h: 0.38, fontSize: 10.5, bold: true, color: l.col, fontFace: 'Patrick Hand SC', valign: 'middle' });
  });

  // Clinical note: vesical fistula
  box(sl, 7.2, 5.3, 5.8, 1.15, RED_BG, RED, null, {});
  sl.addText("⚕ CLINICAL: Lymphatic spread of bladder carcinoma", { x: 7.3, y: 5.36, w: 5.6, h: 0.3, fontSize: 11, bold: true, color: RED, fontFace: 'Patrick Hand SC' });
  sl.addText([
    { text: "Bladder TCC spreads to → External iliac → Common iliac → Para-aortic\n", options: { color: INK } },
    { text: "Trigone tumors → directly to internal iliac & obturator nodes\n", options: { color: INK } },
    { text: "Check obturator nodes in radical cystectomy!", options: { bold: true, color: RED } },
  ], { x: 7.3, y: 5.68, w: 5.6, h: 0.73, fontSize: 10, fontFace: 'Patrick Hand SC', lineSpacingMultiple: 1.2 });

  sl.addText("MNEMONIC - Arterial supply: 'SLIM' = Superior Vesical, (inferior) Linings vesical, Internal iliac Main trunk", {
    x: 1.2, y: 6.95, w: 11.5, h: 0.35, fontSize: 10.5, color: PURPLE, fontFace: 'Patrick Hand SC', italic: true, align: 'center'
  });
}

// ─── SLIDE 5: Nerve Supply ────────────────────────────────────────────────────
{
  const sl = pres.addSlide();
  addRuledBg(sl);
  slideHeader(sl, "4. NERVE SUPPLY & SPHINCTERS", "Urinary Bladder | Anatomy");

  // Left column: nerve table
  sl.addText("Innervation of Urinary Bladder", { x: 1.2, y: 0.75, w: 5.7, h: 0.35, fontSize: 14, bold: true, color: HEADING, fontFace: 'Patrick Hand SC', underline: true });

  const nerves = [
    {
      type: "PARASYMPATHETIC",
      level: "S2, S3, S4 (Pelvic splanchnic nerves)",
      path: "Via inferior hypogastric / pelvic plexus → postganglionic in bladder wall",
      effects: [
        "Contracts DETRUSOR (via M3 muscarinic receptors)",
        "Relaxes INTERNAL SPHINCTER (via NO release)",
        "→ MICTURITION (S2-S4 keeps the urine off the floor!)"
      ],
      bg: LIGHT_BG, col: HEADING
    },
    {
      type: "SYMPATHETIC",
      level: "T11–L2 (Hypogastric nerve / inf. mesenteric plexus)",
      path: "Via superior & inferior hypogastric plexus → vesical plexus",
      effects: [
        "β₃ receptors: RELAXES detrusor (bladder filling)",
        "α₁ receptors: CONTRACTS internal urethral sphincter",
        "→ STORAGE (bladder fills, urine retained)"
      ],
      bg: "FEF9E7", col: ORANGE
    },
    {
      type: "SOMATIC (Pudendal Nerve)",
      level: "S2, S3, S4",
      path: "Via pudendal nerve → perineal nerve → external sphincter",
      effects: [
        "Maintains TONIC CONTRACTION of external (rhabdosphincter)",
        "Voluntary control over micturition",
        "Nicotinic ACh receptors → skeletal muscle contraction"
      ],
      bg: GREEN_BG, col: GREEN
    },
    {
      type: "AFFERENT (Sensory)",
      level: "Travel with both para & sympathetic",
      path: "Stretch receptors in detrusor → sense fullness. Pain fibers via sympathetics (T11-L2)",
      effects: [
        "Urgency & pain travel in SYMPATHETIC fibers",
        "Stretch/fullness sensation in PARASYMPATHETIC (S2-4)",
        "Pain referred to hypogastrium, perineum, inner thigh"
      ],
      bg: "FDF2F8", col: PURPLE
    },
  ];

  nerves.forEach((n, i) => {
    box(sl, 1.2, 1.12 + i * 1.55, 5.7, 1.47, n.bg, n.col, null, {});
    sl.addText(n.type, { x: 1.3, y: 1.17 + i * 1.55, w: 5.5, h: 0.3, fontSize: 11.5, bold: true, color: n.col, fontFace: 'Patrick Hand SC' });
    sl.addText("Level: " + n.level, { x: 1.3, y: 1.48 + i * 1.55, w: 5.5, h: 0.25, fontSize: 9.5, color: HEADING, fontFace: 'Patrick Hand SC', italic: true });
    sl.addText(n.effects.map(e => "→ " + e).join("\n"), { x: 1.3, y: 1.74 + i * 1.55, w: 5.5, h: 0.82, fontSize: 9.5, color: INK, fontFace: 'Patrick Hand SC', lineSpacingMultiple: 1.15, wrap: true });
  });

  // Right: Sphincters + micturition
  sl.addText("Sphincters of Bladder", { x: 7.2, y: 0.75, w: 5.8, h: 0.35, fontSize: 14, bold: true, color: HEADING, fontFace: 'Patrick Hand SC', underline: true });

  const sphincters = [
    {
      name: "INTERNAL URETHRAL SPHINCTER",
      type: "SMOOTH muscle (involuntary)",
      location: "At bladder neck / junction with urethra",
      nerve: "Sympathetic (α₁) → contracts; Parasympathetic (NO) → relaxes",
      bg: LIGHT_BG, col: HEADING
    },
    {
      name: "EXTERNAL URETHRAL SPHINCTER",
      type: "SKELETAL (striated) muscle (voluntary)",
      location: "Surrounds membranous urethra; within deep perineal pouch",
      nerve: "Somatic - Pudendal nerve (S2-4) → tonic contraction maintained",
      bg: GREEN_BG, col: GREEN
    },
  ];

  sphincters.forEach((s, i) => {
    box(sl, 7.2, 1.12 + i * 1.7, 5.8, 1.6, s.bg, s.col, null, {});
    sl.addText(s.name, { x: 7.3, y: 1.17 + i * 1.7, w: 5.6, h: 0.32, fontSize: 12, bold: true, color: s.col, fontFace: 'Patrick Hand SC' });
    sl.addText([
      { text: "Type: ", options: { bold: true, color: s.col } }, { text: s.type + "\n", options: { color: INK } },
      { text: "Location: ", options: { bold: true, color: s.col } }, { text: s.location + "\n", options: { color: INK } },
      { text: "Nerve: ", options: { bold: true, color: s.col } }, { text: s.nerve, options: { color: INK } },
    ], { x: 7.3, y: 1.52 + i * 1.7, w: 5.6, h: 1.1, fontSize: 10, fontFace: 'Patrick Hand SC', lineSpacingMultiple: 1.25 });
  });

  box(sl, 7.2, 4.6, 5.8, 2.2, "FEF9E7", ORANGE, null, {});
  sl.addText("MICTURITION REFLEX (Summary)", { x: 7.3, y: 4.66, w: 5.6, h: 0.3, fontSize: 12, bold: true, color: ORANGE, fontFace: 'Patrick Hand SC' });
  sl.addText([
    { text: "FILLING phase (SYMPATHETIC dominates):\n", options: { bold: true, color: ORANGE } },
    { text: "  β₃ → detrusor relaxes; α₁ → internal sphincter CONTRACTS\n  Pudendal → external sphincter CONTRACTS\n\n", options: { color: INK } },
    { text: "VOIDING phase (PARASYMPATHETIC dominates):\n", options: { bold: true, color: HEADING } },
    { text: "  Stretch receptors → afferents → S2-4 → efferents → ACh\n", options: { color: INK } },
    { text: "  Detrusor CONTRACTS + both sphincters RELAX\n\n", options: { color: INK } },
    { text: "VOLUNTARY CONTROL: Cortex inhibits → pudendal maintains contraction\n", options: { color: GREEN, bold: true } },
    { text: "Higher center (pons micturition center / Barrington's nucleus) coordinates\n", options: { color: INK } },
  ], { x: 7.3, y: 4.99, w: 5.6, h: 1.75, fontSize: 9.5, fontFace: 'Patrick Hand SC', lineSpacingMultiple: 1.15 });

  sl.addText("★ DETRUSOR = Pelvic nerve (S2-4) | SPHINCTER = Pudendal (S2-4) | STORAGE = Hypogastric (L1-2)", {
    x: 1.2, y: 7.0, w: 11.5, h: 0.35, fontSize: 10.5, bold: true, color: PURPLE, fontFace: 'Patrick Hand SC', align: 'center'
  });
}

// ─── SLIDE 6: Embryology ─────────────────────────────────────────────────────
{
  const sl = pres.addSlide();
  addRuledBg(sl);
  slideHeader(sl, "5. EMBRYOLOGY OF URINARY BLADDER", "Urinary Bladder | Anatomy");

  sl.addText("Development Overview", { x: 1.2, y: 0.75, w: 6, h: 0.35, fontSize: 14, bold: true, color: ORANGE, fontFace: 'Patrick Hand SC', underline: true });

  // Timeline boxes
  const stages = [
    { week: "Week 4", event: "Cloaca forms (expanded hindgut terminal part)", detail: "Receives allantois anteriorly, hindgut posteriorly, and mesonephric ducts laterally" },
    { week: "Week 4-7", event: "Urorectal septum divides cloaca", detail: "→ Urogenital sinus (anterior) + Rectum (posterior)" },
    { week: "Week 5-7", event: "3 parts of urogenital sinus form", detail: "VESICAL part → bladder body\nPELVIC part → urethra neck\nPHALLIC part → grows toward genital tubercle" },
    { week: "Week 7-12", event: "Allantois obliterates → URACHUS", detail: "Urachus = fibrous cord from apex of bladder to umbilicus → Adult = MEDIAN UMBILICAL LIGAMENT" },
    { week: "Week 8-12", event: "Mesonephric ducts absorbed into bladder wall", detail: "Contribute connective tissue to TRIGONE\nUreters gain separate openings into bladder\nTrigone mucosa → MESODERMAL origin" },
  ];

  stages.forEach((s, i) => {
    box(sl, 1.2, 1.15 + i * 1.2, 6.0, 1.1, i % 2 === 0 ? "FFF8EC" : LIGHT_BG, ORANGE, null, {});
    sl.addShape(pres.ShapeType.rect, { x: 1.2, y: 1.15 + i * 1.2, w: 1.05, h: 1.1, fill: { color: ORANGE }, line: { color: ORANGE } });
    sl.addText(s.week, { x: 1.22, y: 1.2 + i * 1.2, w: 1.0, h: 1.0, fontSize: 10, bold: true, color: "FFFFFF", fontFace: 'Patrick Hand SC', align: 'center', valign: 'middle' });
    sl.addText(s.event, { x: 2.3, y: 1.18 + i * 1.2, w: 4.8, h: 0.3, fontSize: 11, bold: true, color: ORANGE, fontFace: 'Patrick Hand SC' });
    sl.addText(s.detail, { x: 2.3, y: 1.5 + i * 1.2, w: 4.8, h: 0.7, fontSize: 10, color: INK, fontFace: 'Patrick Hand SC', wrap: true, lineSpacingMultiple: 1.15 });
  });

  // Right column
  sl.addText("Urachal Remnants & Anomalies", { x: 7.5, y: 0.75, w: 5.5, h: 0.35, fontSize: 14, bold: true, color: RED, fontFace: 'Patrick Hand SC', underline: true });

  const urachus = [
    { name: "Patent Urachus", desc: "Urachus remains open → Urine drains from umbilicus", color: RED },
    { name: "Urachal Cyst", desc: "Obliterated at both ends but patent in middle → cyst forms; can become infected", color: PURPLE },
    { name: "Urachal Sinus", desc: "Open at umbilical end only → drains at umbilicus", color: ORANGE },
    { name: "Vesicourachal Diverticulum", desc: "Open at bladder end only → diverticulum at apex of bladder", color: HEADING },
    { name: "Urachal Adenocarcinoma", desc: "Rare (~1% of bladder tumors); located at dome/apex; often mucin-secreting adenocarcinoma", color: RED },
  ];

  urachus.forEach((u, i) => {
    box(sl, 7.5, 1.12 + i * 1.2, 5.5, 1.1, i % 2 === 0 ? RED_BG : "FEF9E7", u.color, null, {});
    sl.addText(u.name, { x: 7.62, y: 1.16 + i * 1.2, w: 5.3, h: 0.3, fontSize: 11, bold: true, color: u.color, fontFace: 'Patrick Hand SC' });
    sl.addText(u.desc, { x: 7.62, y: 1.48 + i * 1.2, w: 5.3, h: 0.7, fontSize: 10, color: INK, fontFace: 'Patrick Hand SC', wrap: true, lineSpacingMultiple: 1.15 });
  });

  sl.addText("Epithelium origin: Bladder body (endoderm of cloaca) | Trigone (mesoderm of mesonephric duct)", {
    x: 1.2, y: 7.05, w: 11.5, h: 0.35, fontSize: 10.5, bold: true, color: ORANGE, fontFace: 'Patrick Hand SC', align: 'center'
  });
}

// ─── SLIDE 7: Clinical Applied Anatomy ───────────────────────────────────────
{
  const sl = pres.addSlide();
  addRuledBg(sl);
  slideHeader(sl, "6. CLINICAL APPLIED ANATOMY", "Urinary Bladder | HIGH YIELD");

  const clinicals = [
    {
      title: "1. Suprapubic Cystostomy",
      content: "Distended bladder rises above pubic symphysis → peritoneum peels off anterior wall. Needle/trocar inserted just above pubic symphysis avoids peritoneum → extraperitoneal access to bladder. Used in: urethral trauma, BPH, post-op retention.",
      col: HEADING, bg: LIGHT_BG
    },
    {
      title: "2. Vesicoureteric Reflux (VUR)",
      content: "Ureters enter bladder OBLIQUELY through detrusor (2-3 cm intramural course). Detrusor tone compresses ureter → antireflux valve. If obliquity lost (short intramural segment) → urine refluxes to kidney → recurrent UTI, hydronephrosis, scarring.",
      col: GREEN, bg: GREEN_BG
    },
    {
      title: "3. Neurogenic Bladder",
      content: "Upper Motor Neuron lesion (above S2-4): Spastic/reflex bladder → detrusor overactivity, small capacity, incontinence.\nLower Motor Neuron lesion (S2-4 / conus medullaris): Flaccid/autonomous bladder → urinary retention, overflow incontinence, large residual volume.",
      col: PURPLE, bg: "F9F0FF"
    },
    {
      title: "4. Bladder Injuries",
      content: "Intraperitoneal rupture (dome): Blunt abdominal trauma with full bladder → urine into peritoneum → peritonitis. Extraperitoneal rupture: Pelvic fracture lacerates anterolateral wall → urine in retropubic/pelvic fat. Iatrogenic: Midline incision extended to pubis may injure full bladder.",
      col: RED, bg: RED_BG
    },
    {
      title: "5. Bladder Carcinoma",
      content: "Most common: Transitional Cell Ca (TCC/Urothelial Ca). Presents with painless hematuria. Trigone is common site. Spreads → external iliac, internal iliac nodes. Schistosomiasis → squamous cell Ca (S. haematobium; calcification on X-ray). Risk: smoking, aniline dyes, cyclophosphamide (hemorrhagic cystitis → Ca).",
      col: "922B21", bg: "#FDEDEC"
    },
    {
      title: "6. Cystitis & Trigone",
      content: "Cystitis (UTI) → inflammation → trigone involvement → frequency, dysuria, urgency. Trigone is most sensitive area. Female > Male (short urethra 3-4 cm vs male 20 cm). Interstitial cystitis: chronic, sterile inflammation → Hunner's ulcers on trigone/posterior wall.",
      col: ORANGE, bg: "FFF8EC"
    },
  ];

  clinicals.forEach((c, i) => {
    const col = i < 3 ? 0 : 1;
    const row = i % 3;
    const x = col === 0 ? 1.2 : 7.2;
    const y = 0.78 + row * 2.12;
    box(sl, x, y, 5.7, 2.04, c.bg, c.col, null, {});
    sl.addText(c.title, { x: x + 0.1, y: y + 0.06, w: 5.5, h: 0.32, fontSize: 11.5, bold: true, color: c.col, fontFace: 'Patrick Hand SC' });
    sl.addShape(pres.ShapeType.line, { x: x + 0.1, y: y + 0.4, w: 5.5, h: 0, line: { color: c.col, width: 0.5 } });
    sl.addText(c.content, { x: x + 0.1, y: y + 0.44, w: 5.5, h: 1.55, fontSize: 9.5, color: INK, fontFace: 'Patrick Hand SC', wrap: true, lineSpacingMultiple: 1.18 });
  });

  sl.addText("⚕  See also: BPH (prostate compresses bladder neck), Pelvic floor disorders (female), Detrusor overactivity", {
    x: 1.2, y: 7.08, w: 11.5, h: 0.3, fontSize: 10, color: "7F8C8D", fontFace: 'Patrick Hand SC', align: 'center'
  });
}

// ─── SLIDE 8: More Clinical - Fistulae, TURBT, Cystoscopy ─────────────────
{
  const sl = pres.addSlide();
  addRuledBg(sl);
  slideHeader(sl, "7. MORE CLINICAL CORRELATES", "Urinary Bladder | Applied Anatomy");

  // Left: vesical fistulae
  sl.addText("Vesical Fistulae", { x: 1.2, y: 0.75, w: 5.7, h: 0.35, fontSize: 14, bold: true, color: RED, fontFace: 'Patrick Hand SC', underline: true });

  const fistulae = [
    { name: "Vesicovaginal Fistula", cause: "Obstetric trauma, gynecological surgery, cervical Ca, radiotherapy", feature: "Continuous urinary incontinence per vagina; commonest pelvic fistula in developing countries" },
    { name: "Vesicointestinal (Colovesical)", cause: "Diverticular disease, Crohn's, colorectal Ca, pelvic surgery", feature: "Pneumaturia (gas in urine) + fecaluria → PATHOGNOMONIC. Recurrent UTI with mixed organisms" },
    { name: "Vesicouterine", cause: "LSCS complications (lower segment), uterine rupture", feature: "Cyclical hematuria (Youssef's syndrome) + amenorrhea + urinary incontinence" },
    { name: "Urethrovaginal", cause: "Obstetric trauma / anterior colporrhaphy", feature: "Incontinence position-dependent; leakage into vagina" },
  ];

  fistulae.forEach((f, i) => {
    box(sl, 1.2, 1.15 + i * 1.5, 5.7, 1.4, i % 2 === 0 ? RED_BG : "FDF2F8", RED, null, {});
    sl.addText(f.name, { x: 1.3, y: 1.19 + i * 1.5, w: 5.5, h: 0.3, fontSize: 11, bold: true, color: RED, fontFace: 'Patrick Hand SC' });
    sl.addText("Cause: " + f.cause, { x: 1.3, y: 1.51 + i * 1.5, w: 5.5, h: 0.28, fontSize: 9.5, color: HEADING, fontFace: 'Patrick Hand SC', wrap: true });
    sl.addText("Feature: " + f.feature, { x: 1.3, y: 1.8 + i * 1.5, w: 5.5, h: 0.3, fontSize: 9.5, color: INK, fontFace: 'Patrick Hand SC', wrap: true });
  });

  // Right column
  sl.addText("Cystoscopy & Surgical Notes", { x: 7.2, y: 0.75, w: 5.8, h: 0.35, fontSize: 14, bold: true, color: HEADING, fontFace: 'Patrick Hand SC', underline: true });

  box(sl, 7.2, 1.12, 5.8, 1.6, LIGHT_BG, HEADING, null, {});
  sl.addText("Cystoscopy Landmarks", { x: 7.3, y: 1.18, w: 5.6, h: 0.3, fontSize: 11.5, bold: true, color: HEADING, fontFace: 'Patrick Hand SC' });
  sl.addText([
    { text: "• Trigone: Smooth, pale → most common tumor site; easy to see\n", options: { color: INK } },
    { text: "• Ureteric orifices: Slit-like openings; efflux of urine visible\n", options: { color: INK } },
    { text: "• Interureteric ridge (bar): Visible as transverse fold\n", options: { color: INK } },
    { text: "• Uvula vesicae (male): Elevation above internal meatus\n", options: { color: INK } },
    { text: "• Bladder dome: Rugae present (redundant mucosa)\n", options: { color: INK } },
  ], { x: 7.3, y: 1.5, w: 5.6, h: 1.16, fontSize: 10, fontFace: 'Patrick Hand SC', lineSpacingMultiple: 1.2 });

  box(sl, 7.2, 2.8, 5.8, 1.55, GREEN_BG, GREEN, null, {});
  sl.addText("TURBT & Radical Cystectomy", { x: 7.3, y: 2.86, w: 5.6, h: 0.3, fontSize: 11.5, bold: true, color: GREEN, fontFace: 'Patrick Hand SC' });
  sl.addText([
    { text: "TURBT (Trans-Urethral Resection of Bladder Tumor):\n", options: { bold: true, color: GREEN } },
    { text: "  • Peritoneal perforation risk → dome is extraperitoneal (ant) but superior dome = peritoneum\n  • Risk of obturator nerve stimulation → adductor spasm (obturator reflex) during lateral wall resection\n\n", options: { color: INK } },
    { text: "Radical Cystectomy: ", options: { bold: true, color: GREEN } }, { text: "Incision in retropubic space (of Retzius); identify median umbilical ligament (obliterated urachus) as guide to dome", options: { color: INK } },
  ], { x: 7.3, y: 3.18, w: 5.6, h: 1.12, fontSize: 9.5, fontFace: 'Patrick Hand SC', lineSpacingMultiple: 1.18 });

  box(sl, 7.2, 4.43, 5.8, 1.55, "FEF9E7", ORANGE, null, {});
  sl.addText("Space of Retzius (Retropubic Space)", { x: 7.3, y: 4.49, w: 5.6, h: 0.3, fontSize: 11.5, bold: true, color: ORANGE, fontFace: 'Patrick Hand SC' });
  sl.addText([
    { text: "Extraperitoneal potential space between pubis/rectus & bladder\n", options: { color: INK } },
    { text: "Contents: loose areolar tissue, fat, vesical venous plexus\n", options: { color: INK } },
    { text: "Clinical: Catheterization, suprapubic cystostomy, radical prostatectomy, bladder surgery all use this space\n", options: { color: INK } },
    { text: "Retropubic hematoma after pelvic fracture fills this space!", options: { bold: true, color: RED } },
  ], { x: 7.3, y: 4.82, w: 5.6, h: 1.1, fontSize: 9.5, fontFace: 'Patrick Hand SC', lineSpacingMultiple: 1.18 });

  box(sl, 7.2, 6.05, 5.8, 1.2, RED_BG, RED, null, {});
  sl.addText("Overflow / Stress Incontinence", { x: 7.3, y: 6.11, w: 5.6, h: 0.28, fontSize: 11, bold: true, color: RED, fontFace: 'Patrick Hand SC' });
  sl.addText([
    { text: "Stress incontinence (F): Weakened pelvic floor → urethrovesical junction descends → loss of posterior urethrovesical angle → leakage on coughing/sneezing → treat with pelvic floor exercises / TVT\n", options: { color: INK } },
    { text: "Overflow incontinence: BPH → chronic retention → paradoxical incontinence\n", options: { color: INK } },
  ], { x: 7.3, y: 6.42, w: 5.6, h: 0.78, fontSize: 9.5, fontFace: 'Patrick Hand SC', lineSpacingMultiple: 1.15 });

  sl.addText("Remember: Obturator nerve (L2-4) lies on lateral bladder wall → at risk in radical cystectomy & pelvic node dissection", {
    x: 1.2, y: 7.08, w: 11.5, h: 0.3, fontSize: 10, bold: true, color: PURPLE, fontFace: 'Patrick Hand SC', align: 'center'
  });
}

// ─── SLIDE 9: Quick Revision / Summary Table ─────────────────────────────────
{
  const sl = pres.addSlide();
  addRuledBg(sl);
  slideHeader(sl, "8. QUICK REVISION TABLE", "Urinary Bladder | One-Page Summary");

  // Summary table
  const tHeaders = ["Feature", "Detail", "Key Point"];
  const rows = [
    ["Position", "Lesser pelvis, behind pubic symphysis", "When FULL → rises above symphysis (abdominal!)"],
    ["Parts", "Apex, Body, Fundus (Base), Neck", "Neck = most fixed part"],
    ["Capacity", "~500 mL; urge at ~300 mL", "Children: bladder is abdominal organ"],
    ["Lining", "Transitional epithelium (Urothelium)", "4-6 layers (empty); 2 layers (full)"],
    ["Trigone", "Smooth triangular area at base; no rugae", "Derived from mesonephric duct (mesoderm)"],
    ["Detrusor", "3 smooth muscle layers; inner+outer=longitudinal, mid=circular", "Contracts: Parasympathetic (M3); Relaxes: Sympathetic (β₃)"],
    ["Int. Sphincter", "Smooth muscle at bladder neck", "Sympathetic (α₁) contracts; Parasympathetic relaxes"],
    ["Ext. Sphincter", "Skeletal muscle; membranous urethra", "Pudendal nerve (S2-4); VOLUNTARY"],
    ["Arterial supply", "Superior & inferior vesical arteries", "From internal iliac artery"],
    ["Venous", "Vesical venous plexus → internal iliac veins", "Communicates with Batson's plexus"],
    ["Lymphatics (sup)", "External iliac nodes", "Superior & lateral walls"],
    ["Lymphatics (base)", "Internal iliac nodes", "Fundus, trigone, anterior wall"],
    ["Sympathetic", "T11–L2 via hypogastric nerve", "FILLING: detrusor relaxes, sphincter contracts"],
    ["Parasympathetic", "S2–S4 pelvic splanchnic nerves", "VOIDING: detrusor contracts, sphincter relaxes"],
    ["Peritoneum", "Superior surface only (+ post. above trigone)", "Anterior wall = NO peritoneum → safe for suprapubic puncture"],
    ["Embryology", "Vesical part of urogenital sinus (endoderm)", "Urachus → median umbilical ligament"],
    ["Most common Ca", "TCC / Urothelial carcinoma", "Painless hematuria; spreads to external & internal iliac nodes"],
    ["VUR", "Ureters enter obliquely (antireflux)", "Short intramural segment → VUR → UTI, hydronephrosis"],
  ];

  // Draw table
  const tX = 1.1, tY = 0.72, cellH = 0.35;
  const colW = [2.5, 5.0, 4.5];
  const hdrColors = [HEADING, HEADING, HEADING];

  // Header row
  let cx = tX;
  tHeaders.forEach((h, c) => {
    sl.addShape(pres.ShapeType.rect, { x: cx, y: tY, w: colW[c], h: 0.38, fill: { color: HEADING }, line: { color: "FFFFFF", width: 0.5 } });
    sl.addText(h, { x: cx + 0.05, y: tY + 0.05, w: colW[c] - 0.1, h: 0.28, fontSize: 11, bold: true, color: "FFFFFF", fontFace: 'Patrick Hand SC', valign: 'middle' });
    cx += colW[c];
  });

  rows.forEach((row, r) => {
    const rowBg = r % 2 === 0 ? "F0F4F8" : "FFFDF4";
    cx = tX;
    row.forEach((cell, c) => {
      sl.addShape(pres.ShapeType.rect, { x: cx, y: tY + 0.38 + r * cellH, w: colW[c], h: cellH, fill: { color: rowBg }, line: { color: "C8D6E1", width: 0.3 } });
      const fontSize = cell.length > 60 ? 8 : 9;
      sl.addText(cell, { x: cx + 0.05, y: tY + 0.38 + r * cellH + 0.02, w: colW[c] - 0.1, h: cellH - 0.04, fontSize, color: c === 2 ? RED : INK, fontFace: 'Patrick Hand SC', valign: 'middle', wrap: true });
      cx += colW[c];
    });
  });
}

// ─── SLIDE 10: Mnemonics & Memory Aids ────────────────────────────────────────
{
  const sl = pres.addSlide();
  addRuledBg(sl);
  slideHeader(sl, "9. MNEMONICS & MEMORY AIDS", "Urinary Bladder | Exam Tips");

  const mnemonics = [
    {
      title: "Parts of Bladder: 'A Big Fat Neck'",
      details: "A = Apex (attached to median umbilical lig.)\nB = Body (main part)\nF = Fundus/Base (receives ureters)\nN = Neck (continues as urethra; most FIXED)",
      col: HEADING, bg: LIGHT_BG
    },
    {
      title: "S2,3,4 Keep Urine Off The Floor",
      details: "Pelvic splanchnic nerves (parasympathetic S2-S4) → CONTRACT detrusor → MICTURITION\nAlso pudendal nerve (S2-4) → SOMATIC control of external sphincter",
      col: GREEN, bg: GREEN_BG
    },
    {
      title: "Arterial Supply: 'SIVA'",
      details: "S = Superior vesical artery (from umbilical a.)\nI = Inferior vesical artery (internal iliac a.)\nV = Vesical plexus drains to internal iliac veins\nA = All from INTERNAL ILIAC artery system",
      col: RED, bg: RED_BG
    },
    {
      title: "Trigone: 2U+1U = Triangle",
      details: "2 Ureteric orifices (superolateral angles)\n+1 Urethral orifice (internal; inferior angle)\n= TRIGONE (base of bladder)\nConnected by Interureteric ridge (Mercier's bar)",
      col: ORANGE, bg: "FFF8EC"
    },
    {
      title: "Lymphatics: 'External wall → External nodes'",
      details: "Upper & lateral walls → EXTERNAL iliac nodes\nBase & Trigone → INTERNAL iliac nodes\nAll → ultimately → PARA-AORTIC nodes",
      col: PURPLE, bg: "F9F0FF"
    },
    {
      title: "Filling vs Voiding (PSVP rule)",
      details: "Para S2-4 → Voiding (contracts detrusor)\nSympathetic T11-L2 → Storage/Filling (relaxes detrusor, closes sphincter)\nVoluntary = Pudendal nerve (S2-4) → VOLUNTARY hold",
      col: "1A5276", bg: "EAF2FF"
    },
    {
      title: "Urachal Anomalies: 'PCSD'",
      details: "P = Patent urachus (urine at umbilicus)\nC = Cyst (infected swelling at midline)\nS = Sinus (opens at umbilicus only)\nD = Diverticulum (opens at bladder apex only)",
      col: ORANGE, bg: "FFF8EC"
    },
    {
      title: "Bladder Cancer Memory Aid: 'TCC SMOKES'",
      details: "T = TCC/Urothelial Ca (most common)\nC = Cyclophosphamide → hemorrhagic cystitis → risk\nS = Schistosomiasis → Squamous cell Ca\nM = Male (3:1 over female)\nO = painless hematuria (Obvious sign)\nK = Know: trigone most common site\nE = External iliac nodes (lymph spread)\nS = Smoking = #1 risk factor",
      col: "922B21", bg: "#FDEDEC"
    },
  ];

  mnemonics.forEach((m, i) => {
    const col = i < 4 ? 0 : (i < 8 ? 1 : 2);
    const row = i % 4;
    const x = [1.2, 5.55, 9.85][col];
    const y = 0.75 + row * 1.66;
    box(sl, x, y, 4.1, 1.58, m.bg, m.col, null, {});
    sl.addText(m.title, { x: x + 0.1, y: y + 0.06, w: 3.9, h: 0.32, fontSize: 10.5, bold: true, color: m.col, fontFace: 'Patrick Hand SC', wrap: true });
    sl.addShape(pres.ShapeType.line, { x: x + 0.1, y: y + 0.4, w: 3.9, h: 0, line: { color: m.col, width: 0.5, dashType: 'dash' } });
    sl.addText(m.details, { x: x + 0.1, y: y + 0.44, w: 3.9, h: 1.1, fontSize: 9.5, color: INK, fontFace: 'Patrick Hand SC', wrap: true, lineSpacingMultiple: 1.18 });
  });

  sl.addText("Good Luck! 🎓  Revise with clinical MCQs on urinary bladder  •  Topic: Applied Anatomy", {
    x: 0.5, y: 7.1, w: 12.3, h: 0.3, fontSize: 10.5, color: "7F8C8D", fontFace: 'Patrick Hand SC', align: 'center'
  });
}

// ─── Write file ──────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/bladder-notes/Urinary_Bladder_Anatomy_Notes.pptx" })
  .then(() => console.log("✅ PPTX created successfully!"))
  .catch(err => console.error("❌ Error:", err));
Running Command

cd /home/daytona/workspace/bladder-notes && node create_notes.js 2>&1

Running Command

ls -lh /home/daytona/workspace/bladder-notes/

Your university-style handwritten anatomy notes on the Urinary Bladder are ready!

Urinary Bladder Anatomy Notes

Presentation · PPTX


What's Inside (10 Slides)

The notes are designed on a warm cream ruled-paper background with a red margin line, colored ink headings, and box callouts - mimicking the feel of high-quality university handwritten notes. Content is sourced from Color Atlas of Human Anatomy, Histology: A Text and Atlas, Guyton & Hall, The Developing Human, and Sabiston Textbook of Surgery.
SlideTopicHighlights
1Title PageTopic overview, date field
2Introduction & PositionParts (APEX / BODY / FUNDUS / NECK), male vs female relations, peritoneal coverage
3Interior & HistologyTrigone (Mercier's bar, uvula vesicae), 4 wall layers, urothelium, detrusor, receptor pharmacology
4Blood Supply & LymphaticsSuperior/inferior vesical arteries from internal iliac, vesical venous plexus → Batson's plexus, lymph node stations
5Nerve Supply & SphinctersParasympathetic S2-4 / Sympathetic T11-L2 / Pudendal nerve, filling vs voiding table, micturition reflex
6EmbryologyWeek-by-week timeline, urorectal septum, urachus → median umbilical ligament, 5 types of urachal remnants
7Clinical Applied AnatomySuprapubic cystostomy, VUR, neurogenic bladder (UMN vs LMN), bladder injuries, carcinoma, cystitis
8More ClinicalVesical fistulae (4 types), cystoscopy landmarks, TURBT hazards, space of Retzius, stress incontinence
9Quick Revision Table18-row summary: every feature in one table
10Mnemonics"A Big Fat Neck", "S2-3-4 keeps urine off the floor", SIVA, Trigone 2U+1U, PCSD, TCC SMOKES

Key Diagrams Referenced

These authoritative textbook diagrams supplement the notes visually:
Urinary bladder anatomy - sagittal sections, trigone, male & female
Innervation of the bladder - sympathetic L1-2, parasympathetic S2-4, pudendal
Male and female bladder anatomy with detrusor, trigone, sphincters

Do it fast

The PPTX is already done and ready to download right now:

Urinary Bladder Anatomy Notes

Presentation · PPTX

10 slides, handwritten notebook style, full anatomy + clinical applied. Just click and download!

It is not downloadable

Running Command

ls -lh /home/daytona/workspace/bladder-notes/ && echo "File exists"

Running Command

cp /home/daytona/workspace/bladder-notes/Urinary_Bladder_Anatomy_Notes.pptx /hom…

Try this direct path link:

Urinary Bladder Anatomy Notes

Presentation · PPTX

If that still doesn't work, the issue may be with your browser or the platform's file serving. Here's what you can do:
Alternative - I can generate it as a PDF instead, which tends to be more universally downloadable. Want me to convert it to PDF right now?

Yes pdf

Running Command

cd /home/daytona/workspace/bladder-notes && libreoffice --headless --convert-to …

Running Command

libreoffice --headless --convert-to pdf /home/daytona/workspace/bladder-notes/Ur…

Running Command

chmod 777 /home/daytona/workspace/bladder-notes/ && libreoffice --headless --con…

Running Command

mkdir -p /tmp/bladder_out && libreoffice --headless --convert-to pdf /home/dayto…

Running Command

cp /tmp/bladder_out/Urinary_Bladder_Anatomy_Notes.pdf /home/daytona/workspace/Ur…

Done! Here's your PDF (230 KB, 10 pages):

Urinary Bladder Anatomy Notes

PDF Document · PDF

Don't create pdf just write it here

📓 URINARY BLADDER — Anatomy Notes

with Clinical Applied Anatomy



1. INTRODUCTION & POSITION

Definition: Hollow, muscular, distensible reservoir for urine located in the lesser pelvis, posterior to the pubic symphysis.
FeatureDetail
Capacity~500 mL; urge to void at ~300 mL
Shape (empty)Pyramidal / tetrahedral
Shape (full)Ovoid; apex rises above pubic symphysis into abdomen
Most fixed partNeck (held by prostate in male / UG diaphragm in female)

2. PARTS OF THE BLADDER

A B F N"A Big Fat Neck"

A — APEX
  • Anterosuperior tip
  • Attached to median umbilical ligament (obliterated urachus) → runs to umbilicus
  • Landmark during bladder surgery
B — BODY
  • Main bulk; has superior surface + 2 inferolateral surfaces
  • Superior surface covered by peritoneum
  • Anterolateral surfaces = no peritoneum (retropubic fat)
F — FUNDUS (Base)
  • Posterior wall, faces posteroinferiorly
  • Receives 2 ureters at its superolateral angles
  • Male: related to seminal vesicles + rectum
  • Female: related to uterus/cervix + vagina
N — NECK
  • Most inferior and fixed part
  • Continuous with urethra below
  • Male: rests on prostate gland
  • Female: rests on perineal membrane / UG diaphragm

3. RELATIONS

Male

SurfaceRelation
AnteriorRetropubic space of Retzius, pubic symphysis
SuperiorPeritoneum → loops of small intestine, sigmoid colon
PosteriorSeminal vesicles, vas deferens, rectovesical pouch, rectum
Inferior (neck)Prostate gland

Female

SurfaceRelation
Posterior (superior)Uterus (body); separated by vesicouterine pouch
Posterior (base)Anterior vaginal wall (firmly adherent)
Inferior (neck)Perineal membrane / UG diaphragm
⚠️ Peritoneum covers only the SUPERIOR surface + part of posterior above trigone. Anterior & lateral walls = extraperitoneal → safe for suprapubic puncture!

4. INTERIOR OF THE BLADDER

Mucosal Surface

  • Most of bladder: Mucosa thrown into RUGAE / FOLDS when empty → disappear when distended
  • Trigone: Smooth, no folds, firmly adherent to detrusor → permanent smooth area

THE TRIGONE (Most Important Area!)

        Ureteric orifice (L)    Ureteric orifice (R)
                 ●──────────────────●
                  \    Interureteric  \
                   \    ridge (bar)    \
                    \                  \
                     ●
              Internal urethral orifice
FeatureDetail
ShapeTriangular
Superolateral angles (×2)Ureteric orifices
Inferior angleInternal urethral orifice
Transverse foldInterureteric ridge (Mercier's bar) connecting ureteric orifices
In malesUvula vesicae = small elevation above internal urethral orifice (due to median lobe of prostate)
MucosaSmooth, pale, always flat
EmbryologyDerived from mesonephric duct (mesoderm)
No muscularis mucosae or submucosa in trigone (unlike rest of bladder)

5. HISTOLOGY / LAYERS OF BLADDER WALL

Layer 1 — UROTHELIUM (Transitional Epithelium)

  • Stratified; 4-6 cell layers when empty, 2-3 layers when distended
  • Surface "umbrella cells" — tight junctions → barrier against urine
  • Lines entire interior including trigone

Layer 2 — LAMINA PROPRIA

  • Loose vascular connective tissue
  • Contains thin muscularis mucosae (variable)
  • ABSENT in trigone (trigone goes straight to muscle)

Layer 3 — DETRUSOR MUSCLE (Most Important!)

  • Three ill-defined smooth muscle layers:
    • Inner longitudinal
    • Middle circular ← thickest
    • Outer longitudinal
  • At bladder neck → circular fibers condense → Internal Urethral Sphincter (involuntary)
  • Receptor pharmacology:
    • β₃ adrenergic → RELAXES detrusor (sympathetic, filling)
    • M3 muscarinic → CONTRACTS detrusor (parasympathetic, voiding)

Layer 4 — ADVENTITIA / SEROSA

  • Adventitia (fibrofatty) on most surfaces
  • Serosa (peritoneum) only on superior surface + posterior above trigone

6. BLOOD SUPPLY

Arterial (all from Internal Iliac Artery)

ArterySourceSupply
Superior vesical arteryUmbilical artery (patent part) → internal iliacSuperior, anterior, lateral walls; upper ureter
Inferior vesical arteryAnterior trunk of internal iliac (M) / Vaginal artery (F)Base, neck, seminal vesicles, prostate (M)
Middle rectal arteryInternal iliacMinor contribution to base
✏️ Rich collateral network → ligation of a single artery is NOT detrimental

Venous Drainage

  • Vesical venous plexus surrounds fundus/base
  • Drains → Internal Iliac Veins
  • Communicates with prostatic plexus (M) / vaginal plexus (F)
  • Also communicates with Batson's vertebral venous plexus → pathway for haematogenous metastasis!

7. LYMPHATIC DRAINAGE

RegionDrains to
Superior & lateral wallsExternal iliac nodes
Base (fundus) & TrigoneInternal iliac nodes
Anterior wallInternal iliac nodes (via obturator channel)
All above → ultimatelyPara-aortic (lateral aortic) nodes
★ Check obturator nodes during radical cystectomy — often skipped but involved early!

8. NERVE SUPPLY

MNEMONIC: "S2, 3, 4 keeps urine off the floor"

Parasympathetic (VOIDING)

  • S2, S3, S4 → pelvic splanchnic nerves → inferior hypogastric plexus
  • ACh → M3 receptors → detrusor CONTRACTS
  • NO release → internal sphincter RELAXES
  • = Micturition

Sympathetic (STORAGE / FILLING)

  • T11–L2 → hypogastric nerve → inferior hypogastric plexus
  • β₃ receptors → detrusor RELAXES
  • α₁ receptors → internal sphincter CONTRACTS
  • = Retention / filling

Somatic (VOLUNTARY)

  • Pudendal nerve (S2, S3, S4)
  • Innervates external urethral sphincter (striated/skeletal muscle)
  • Tonic contraction = continent at rest
  • Voluntary relaxation = micturition begins

Afferent (Sensory)

  • Stretch receptors → via pelvic splanchnic (S2-4) → sense fullness
  • Pain fibres → via sympathetic (T11-L2) → referred to hypogastrium / perineum / inner thigh

9. SPHINCTERS

FeatureInternal SphincterExternal Sphincter
Muscle typeSmooth (involuntary)Skeletal (voluntary)
LocationBladder neckMembranous urethra (deep perineal pouch)
NerveSympathetic (α₁) contracts; Parasympathetic relaxesPudendal nerve S2-4
ControlAutonomicVoluntary (cortical)

10. MICTURITION REFLEX

FILLING PHASE:
Bladder fills → stretch receptors quiet
Sympathetic dominates:
  → Detrusor RELAXES (β₃)
  → Int. sphincter CONTRACTS (α₁)
  → Pudendal → Ext. sphincter CONTRACTS
  → CONTINENT ✓

VOIDING PHASE:
~300 mL → stretch receptors fire → S2-4
Parasympathetic dominates:
  → Detrusor CONTRACTS (M3)
  → Int. sphincter RELAXES (NO)
  → Pudendal inhibited → Ext. sphincter RELAXES
  → MICTURITION ✓

VOLUNTARY CONTROL:
Pontine micturition centre (Barrington's nucleus)
+ Frontal cortex inhibit until appropriate

11. EMBRYOLOGY

Development Timeline

WeekEvent
Week 4Cloaca forms = expanded terminal hindgut
Week 4–7Urorectal septum divides cloaca → Urogenital sinus (ant.) + Rectum (post.)
Week 5–7UG sinus divides into 3 parts: Vesical (→ bladder body) + Pelvic (→ urethra) + Phallic
Week 7Allantois obliterates → Urachus (fibrous cord, apex to umbilicus)
AdultUrachus → Median Umbilical Ligament
Week 8–12Mesonephric ducts absorbed → contribute to trigone connective tissue

Epithelial Origins

  • Bladder body epithelium → Endoderm of cloaca
  • Trigone epithelium → Mesoderm (mesonephric duct)

Urachal Remnants — "PCSD + Ca" Mnemonic

TypeWhat's OpenFeature
Patent urachusBoth endsUrine drips from umbilicus
CystMiddle onlyMidline infraumbilical swelling; can get infected
SinusUmbilical endDischarges at umbilicus
DiverticulumBladder endOutpouching at apex of bladder
Urachal CaRare adenocarcinoma at dome; mucin-secreting

12. CLINICAL APPLIED ANATOMY (HIGH YIELD)


① Suprapubic Cystostomy

  • Distended bladder rises above pubic symphysis
  • Peritoneum peels off anterior abdominal wall → extraperitoneal access
  • Needle inserted just above symphysis pubis → taps bladder without entering peritoneum
  • Used in: urethral trauma, BPH, post-op urinary retention

② Vesicoureteric Reflux (VUR)

  • Ureters enter bladder obliquely through detrusor (2–3 cm intramural course)
  • Detrusor tone compresses ureter = natural antireflux valve
  • If intramural segment too short → urine refluxes to kidney → recurrent UTI, hydronephrosis, renal scarring
  • Grade I–V; treat with antibiotics → surgical reimplantation (Cohen/Politano-Leadbetter)

③ Neurogenic Bladder

LesionTypeFeatures
UMN (above S2-4)Spastic / Reflex bladderSmall capacity, detrusor overactivity, urge incontinence, high pressure
LMN (S2-4 / conus medullaris)Flaccid / Autonomous bladderLarge residual volume, overflow incontinence, low pressure, retention

④ Bladder Injuries

TypeCauseFeature
Intraperitoneal ruptureBlunt trauma to full bladder (dome ruptures)Urine into peritoneum → peritonitis, ileus
Extraperitoneal rupturePelvic fracture lacerates anterolateral wallUrine in retropubic / perivesical fat
IatrogenicMidline incision extended to pubisFull bladder at risk if not displaced

⑤ Bladder Carcinoma

  • Most common: TCC / Urothelial carcinoma (~90%)
  • Classic presentation: Painless haematuria
  • Trigone = most common site
  • Lymphatic spread: External iliac → Internal iliac → Para-aortic
  • Schistosoma haematobium → Squamous cell carcinoma (calcification on X-ray / KUB)
  • Risk factors: Smoking (#1), aniline dyes, cyclophosphamide (→ haemorrhagic cystitis → Ca), radiation

⑥ Vesical Fistulae

FistulaCauseHallmark
VesicovaginalObstructed labour, gynae surgeryContinuous urinary incontinence per vagina
Vesicointestinal (colovesical)Diverticular disease, Crohn's, colorectal CaPneumaturia + fecaluria = pathognomonic
VesicouterineLSCS complicationYoussef's syndrome = cyclical haematuria + amenorrhoea
UrethrovaginalObstetric traumaPositional incontinence into vagina

⑦ Space of Retzius (Retropubic Space)

  • Potential extraperitoneal space between pubic bones/rectus and anterior bladder wall
  • Contains loose areolar tissue, fat, vesical venous plexus
  • Used in: suprapubic cystostomy, radical prostatectomy, TVT for stress incontinence
  • Retropubic haematoma after pelvic fracture fills this space

⑧ Cystoscopy Landmarks

  • Trigone → smooth, pale, most common tumor/schistosomiasis site
  • Ureteric orifices → slit-like; visible efflux of urine (peristaltic jets)
  • Interureteric ridge → visible as transverse mucosal fold
  • Uvula vesicae (male) → elevation above internal meatus (median lobe of prostate)
  • Bladder dome/walls → rugae present when empty

⑨ TURBT Hazards

  • Dome resection → risk of intraperitoneal perforation
  • Lateral wall resection → obturator reflex (nerve stimulation → adductor spasm → bladder perforation)
  • Managed by: obturator nerve block, low current cutting, saline distension (non-electrolyte)

13. MNEMONICS SUMMARY

MnemonicMeaning
A Big Fat NeckApex, Body, Fundus, Neck
S2-3-4 keeps urine off the floorParasympathetic voiding via pelvic splanchnic
SIVASuperior vesical, Inferior vesical, Vesical plexus, All from internal iliac
2U + 1U = Trigone2 Ureteric orifices + 1 Urethral orifice
PCSDPatent, Cyst, Sinus, Diverticulum (urachal remnants)
TCC SMOKESTCC, Cyclophosphamide, Schistosomiasis, Male, painless haematuria, K=know trigone, External iliac nodes, Smoking
Ext. wall → Ext. nodesLateral walls → External iliac; Base → Internal iliac

📌 Exam Tips:
  • Trigone = smooth, no rugae, mesodermal origin, no muscularis mucosae
  • Most fixed part = neck; most mobile = dome/apex
  • Suprapubic puncture safe because peritoneum peels away from anterior wall when bladder is full
  • Painless haematuria = bladder Ca until proven otherwise
  • Pneumaturia = colovesical fistula (diverticular disease most common cause in adults)
  • VUR = short intramural ureteric segment → loss of antireflux mechanism
This is a shared conversation. Sign in to Orris to start your own chat.