attachment
attachment

Answer these questions for bds 1st year anatomy board exam of kathamndu university each each question holds 10 marks

analyse_media
Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
All 17 questions are answered above. Here is a quick reference index to what each question covers and where to find key points:

Quick Reference Summary

Q#TopicKey Points to Remember
1Joints & Synovial Joints3 structural types; 6 features of synovial joint (cavity, articular cartilage, capsule, synovial fluid, ligaments, nerve supply)
2Elastic Cartilage HistologyPerichondrium, chondrocytes in lacunae, elastic fiber network (Orcein stain); locations: ear, epiglottis
3Long BoneDiaphysis, epiphysis, metaphysis, periosteum, endosteum; 4 blood supplies: nutrient artery (main), metaphyseal, epiphyseal, periosteal
4Sesamoid BoneIn tendons; protect + increase mechanical advantage; examples: Patella (largest) + hallux sesamoids
5EpitheliumSimple (squamous/cuboidal/columnar/pseudostratified) + Stratified (squamous keratinized/non-keratinized/transitional)
6Cartilage TypesHyaline (type II, glassy, calcifies); Elastic (elastic fibers, does NOT calcify); Fibrocartilage (type I, no perichondrium, strongest)
7Endochondral Ossification8 stages; epiphyseal plate zones: Reserve → Proliferating → Hypertrophic → Calcified → Ossification
8Smooth MuscleSpindle-shaped, uninucleate, central nucleus; dense bodies; caveolae; no striations; gap junctions; calmodulin-MLCK pathway
9Trachea Histology4 layers: mucosa (PCCE + thick BM), submucosa (seromucous glands), C-shaped hyaline cartilage rings, adventitia; trachealis muscle posteriorly
10Thin Skin4 layers (no stratum lucidum); has hair follicles + sebaceous glands; vs thick skin (5 layers, no hair, palms/soles)
11Splenic CirculationSplenic a. → trabecular → central a. → penicillar → open (cords → sinus slits) or closed → venous sinuses → splenic vein
12Thick vs Thin SkinKey difference: thick has stratum lucidum, no hair; thin has hair but no stratum lucidum
13Lymph NodeOuter cortex (B-cell follicles), paracortex (T-cells, HEV), medullary cords (plasma cells), medullary sinuses
14NeuronCell body (Nissl bodies), dendrites (toward), axon (away from soma, no Nissl at hillock), myelin/Nodes of Ranvier, synapse
15Spleen HistologyCapsule + trabeculae, white pulp (PALS + follicles), red pulp (sinuses + cords of Billroth), marginal zone
16Skeletal MuscleMultinucleate, peripheral nuclei, sarcomere (Z-I-A-H-M), triads at A-I junction, epimysium/perimysium/endomysium
17ThymusFibroelastic capsule → lobules; cortex (dark, packed thymocytes, BTB, cTECs) + medulla (pale, mTECs, AIRE, Hassall's corpuscles)
Exam tips for Kathmandu University BDS:
  • Always draw diagrams even if they ask only for written descriptions - diagrams earn easy marks
  • For histology questions, always mention H&E staining characteristics
  • For bone/cartilage: always specify type of collagen (I vs II)
  • Hassall's corpuscles = pathognomonic of thymus - always mention this
  • For lymph node vs spleen: lymph filters lymph; spleen filters blood

Generate flashcards PDF with diagrams for quick revision

Reading File
Running Command

ls /home/daytona/workspace/ 2>/dev/null && mkdir -p /home/daytona/workspace/bds-flashcards

Writing File

~/bds-flashcards/generate_flashcards.py

#!/usr/bin/env python3
"""
BDS 1st Year Anatomy Flashcards PDF Generator
Kathmandu University - Board Exam Revision
Uses reportlab for rich PDF generation with diagrams
"""

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import mm, cm
from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer, Table,
                                  TableStyle, PageBreak, HRFlowable, KeepTogether)
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.graphics.shapes import Drawing, Rect, String, Line, Circle, Ellipse, Polygon
from reportlab.graphics import renderPDF
from reportlab.platypus.flowables import Flowable
from reportlab.graphics.shapes import Group
import os

OUTPUT_PATH = "/home/daytona/workspace/bds-flashcards/BDS_Anatomy_Flashcards.pdf"

# ─── Colour palette ────────────────────────────────────────────────────────────
C_NAVY    = colors.HexColor("#1a2744")
C_BLUE    = colors.HexColor("#2563EB")
C_LIGHT   = colors.HexColor("#EFF6FF")
C_YELLOW  = colors.HexColor("#FEF9C3")
C_GREEN   = colors.HexColor("#DCFCE7")
C_RED     = colors.HexColor("#FEE2E2")
C_PURPLE  = colors.HexColor("#F3E8FF")
C_ORANGE  = colors.HexColor("#FFF7ED")
C_TEAL    = colors.HexColor("#CCFBF1")
C_PINK    = colors.HexColor("#FCE7F3")
C_GRAY    = colors.HexColor("#F1F5F9")
C_DARK    = colors.HexColor("#1E293B")
C_WHITE   = colors.white
C_GOLD    = colors.HexColor("#F59E0B")
C_BORDER  = colors.HexColor("#CBD5E1")

W, H = A4  # 595.28 x 841.89 pts

# ─── Styles ────────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

def make_style(name, parent='Normal', **kw):
    s = ParagraphStyle(name, parent=styles[parent], **kw)
    return s

COVER_TITLE  = make_style('CoverTitle',  fontSize=32, textColor=C_WHITE,
                           fontName='Helvetica-Bold', alignment=TA_CENTER, leading=38)
COVER_SUB    = make_style('CoverSub',    fontSize=16, textColor=colors.HexColor("#CBD5E1"),
                           fontName='Helvetica', alignment=TA_CENTER, leading=22)
COVER_INFO   = make_style('CoverInfo',   fontSize=12, textColor=colors.HexColor("#94A3B8"),
                           fontName='Helvetica', alignment=TA_CENTER)

Q_LABEL      = make_style('QLabel',      fontSize=9,  textColor=C_BLUE,
                           fontName='Helvetica-Bold', spaceBefore=2, spaceAfter=1)
CARD_TITLE   = make_style('CardTitle',   fontSize=13, textColor=C_NAVY,
                           fontName='Helvetica-Bold', spaceBefore=3, spaceAfter=4, leading=16)
BODY         = make_style('Body',        fontSize=9.5, textColor=C_DARK,
                           fontName='Helvetica', leading=14, spaceAfter=3)
BODY_B       = make_style('BodyB',       fontSize=9.5, textColor=C_DARK,
                           fontName='Helvetica-Bold', leading=14)
BULLET       = make_style('Bullet',      fontSize=9,  textColor=C_DARK,
                           fontName='Helvetica', leading=13, leftIndent=12,
                           bulletIndent=4, spaceAfter=1)
DIAG_STYLE   = make_style('Diag',        fontSize=8,  textColor=C_DARK,
                           fontName='Courier', leading=11, backColor=C_GRAY,
                           leftIndent=6, rightIndent=6, spaceBefore=4, spaceAfter=4)
SECTION_HDR  = make_style('SectionHdr',  fontSize=11, textColor=C_WHITE,
                           fontName='Helvetica-Bold', alignment=TA_CENTER, leading=15)
TIP_STYLE    = make_style('Tip',         fontSize=8.5, textColor=colors.HexColor("#92400E"),
                           fontName='Helvetica-Oblique', leading=12,
                           backColor=colors.HexColor("#FEF3C7"),
                           leftIndent=8, rightIndent=8)
TABLE_HDR    = make_style('TableHdr',    fontSize=8.5, textColor=C_WHITE,
                           fontName='Helvetica-Bold', alignment=TA_CENTER)
TABLE_CELL   = make_style('TableCell',   fontSize=8,  textColor=C_DARK,
                           fontName='Helvetica', leading=11, alignment=TA_LEFT)
TABLE_CELL_C = make_style('TableCellC',  fontSize=8,  textColor=C_DARK,
                           fontName='Helvetica', leading=11, alignment=TA_CENTER)
MNEMONIC     = make_style('Mnemonic',    fontSize=9,  textColor=colors.HexColor("#7C3AED"),
                           fontName='Helvetica-Bold', leading=13,
                           backColor=C_PURPLE, leftIndent=8)
KEY_FACT     = make_style('KeyFact',     fontSize=9,  textColor=colors.HexColor("#065F46"),
                           fontName='Helvetica-Bold', leading=13)

# ─── Helper Flowables ──────────────────────────────────────────────────────────
class ColorRect(Flowable):
    """A solid colour rectangle used as card background."""
    def __init__(self, width, height, fill_color, stroke_color=None, radius=6):
        Flowable.__init__(self)
        self.width = width
        self.height = height
        self.fill_color = fill_color
        self.stroke_color = stroke_color or fill_color
        self.radius = radius

    def draw(self):
        self.canv.setFillColor(self.fill_color)
        self.canv.setStrokeColor(self.stroke_color)
        self.canv.roundRect(0, 0, self.width, self.height,
                            self.radius, stroke=1, fill=1)

class DiagramDrawing(Flowable):
    """Wraps a ReportLab Drawing so it flows in a story."""
    def __init__(self, drawing):
        Flowable.__init__(self)
        self.drawing = drawing
        self.width  = drawing.width
        self.height = drawing.height

    def draw(self):
        renderPDF.draw(self.drawing, self.canv, 0, 0)

# ─── Card builder ──────────────────────────────────────────────────────────────
def card(q_num, topic, bg_color, header_color, content_items, tip=None, mnemonic=None):
    """
    Returns a list of flowables forming one flashcard.
    content_items: list of (style, text_or_table) tuples
    """
    story = []
    card_w = W - 2*cm

    # Header bar
    hdr_data = [[Paragraph(f"Q{q_num}  |  {topic}", SECTION_HDR)]]
    hdr_table = Table(hdr_data, colWidths=[card_w])
    hdr_table.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), header_color),
        ('ROUNDEDCORNERS', [8,8,0,0]),
        ('TOPPADDING',    (0,0), (-1,-1), 8),
        ('BOTTOMPADDING', (0,0), (-1,-1), 8),
        ('LEFTPADDING',   (0,0), (-1,-1), 12),
    ]))

    # Body rows
    body_rows = []
    for (style_or_table, content) in content_items:
        if isinstance(content, list):   # table data
            body_rows.append(content)
        else:
            body_rows.append([Paragraph(content, style_or_table)])

    body_data = [[item] for item in body_rows]
    # flatten: each body_row is already a list-of-one
    flat_rows = [[Paragraph(txt, sty) if not isinstance(txt, list) else txt
                  for (sty, txt) in content_items]]

    # Build inner table
    inner_items = []
    for (sty, txt) in content_items:
        if isinstance(txt, Table):
            inner_items.append(txt)
        elif isinstance(txt, Drawing):
            inner_items.append(DiagramDrawing(txt))
        else:
            inner_items.append(Paragraph(txt, sty))

    if tip:
        inner_items.append(Spacer(1, 4))
        inner_items.append(Paragraph(f"★ Exam Tip: {tip}", TIP_STYLE))

    if mnemonic:
        inner_items.append(Spacer(1, 3))
        inner_items.append(Paragraph(f"🧠 {mnemonic}", MNEMONIC))

    # Wrap everything in a single-cell table for the card background
    body_table_data = [[item] for item in inner_items]
    body_table = Table([[item] for item in inner_items], colWidths=[card_w - 24])
    body_table.setStyle(TableStyle([
        ('BACKGROUND',    (0,0), (-1,-1), bg_color),
        ('LEFTPADDING',   (0,0), (-1,-1), 4),
        ('RIGHTPADDING',  (0,0), (-1,-1), 4),
        ('TOPPADDING',    (0,0), (-1,-1), 2),
        ('BOTTOMPADDING', (0,0), (-1,-1), 2),
    ]))

    outer = Table([[hdr_table], [body_table]], colWidths=[card_w])
    outer.setStyle(TableStyle([
        ('BACKGROUND',    (0,1), (-1,-1), bg_color),
        ('BOX',           (0,0), (-1,-1), 1.2, header_color),
        ('ROUNDEDCORNERS',[8]),
        ('LEFTPADDING',   (0,1), (-1,-1), 12),
        ('RIGHTPADDING',  (0,1), (-1,-1), 12),
        ('TOPPADDING',    (0,1), (-1,-1), 8),
        ('BOTTOMPADDING', (0,1), (-1,-1), 10),
    ]))

    story.append(KeepTogether([outer]))
    story.append(Spacer(1, 10))
    return story

# ─── Diagram helpers ───────────────────────────────────────────────────────────
def diag(text):
    """Return a preformatted diagram paragraph."""
    return (DIAG_STYLE, text)

def b(text): return (BODY_B, text)
def p(text): return (BODY, text)
def bullet(text): return (BULLET, f"• {text}")
def key(text): return (KEY_FACT, f"✦ {text}")

def make_table(headers, rows, col_widths=None, hdr_color=None):
    """Build a styled table."""
    hdr_color = hdr_color or C_NAVY
    n = len(headers)
    if col_widths is None:
        usable = W - 2*cm - 40
        col_widths = [usable/n]*n

    data = [[Paragraph(h, TABLE_HDR) for h in headers]]
    for row in rows:
        data.append([Paragraph(str(c), TABLE_CELL) for c in row])

    t = Table(data, colWidths=col_widths)
    t.setStyle(TableStyle([
        ('BACKGROUND',    (0,0), (-1,0),  hdr_color),
        ('BACKGROUND',    (0,1), (-1,-1), C_WHITE),
        ('ROWBACKGROUNDS',(0,1), (-1,-1), [C_WHITE, C_GRAY]),
        ('GRID',          (0,0), (-1,-1), 0.5, C_BORDER),
        ('TOPPADDING',    (0,0), (-1,-1), 4),
        ('BOTTOMPADDING', (0,0), (-1,-1), 4),
        ('LEFTPADDING',   (0,0), (-1,-1), 5),
        ('RIGHTPADDING',  (0,0), (-1,-1), 5),
        ('VALIGN',        (0,0), (-1,-1), 'TOP'),
    ]))
    return t

# ─── Cover page ────────────────────────────────────────────────────────────────
def cover_page():
    story = []
    story.append(Spacer(1, 1.5*cm))

    # Big navy block
    cover_data = [[
        Spacer(1, 1.2*cm),
        Paragraph("BDS 1<sup>st</sup> Year Anatomy", COVER_TITLE),
        Spacer(1, 0.4*cm),
        Paragraph("Quick-Revision Flashcards", COVER_SUB),
        Spacer(1, 0.3*cm),
        Paragraph("Kathmandu University Board Exam", COVER_INFO),
        Spacer(1, 0.6*cm),
        HRFlowable(width="70%", thickness=1, color=colors.HexColor("#334155"),
                   hAlign='CENTER'),
        Spacer(1, 0.4*cm),
        Paragraph("17 Topics  •  Bones • Joints • Histology • Lymphoid Organs", COVER_INFO),
        Spacer(1, 1.2*cm),
    ]]
    cover_table = Table([[r] for r in cover_data[0]], colWidths=[W - 4*cm])
    cover_table.setStyle(TableStyle([
        ('BACKGROUND',    (0,0), (-1,-1), C_NAVY),
        ('ROUNDEDCORNERS',[12]),
        ('LEFTPADDING',   (0,0), (-1,-1), 20),
        ('RIGHTPADDING',  (0,0), (-1,-1), 20),
        ('TOPPADDING',    (0,0), (-1,-1), 0),
        ('BOTTOMPADDING', (0,0), (-1,-1), 0),
    ]))
    story.append(cover_table)
    story.append(Spacer(1, 0.8*cm))

    # Topic grid
    topics = [
        ("Q1",  "Joints & Synovial Joint"),
        ("Q2",  "Elastic Cartilage Histology"),
        ("Q3",  "Long Bone: Parts & Blood Supply"),
        ("Q4",  "Sesamoid Bone"),
        ("Q5",  "Epithelium Classification"),
        ("Q6",  "Cartilage Comparison"),
        ("Q7",  "Endochondral Ossification"),
        ("Q8",  "Smooth Muscle Histology"),
        ("Q9",  "Trachea Histology"),
        ("Q10", "Thin Skin Histology"),
        ("Q11", "Splenic Circulation"),
        ("Q12", "Thick vs Thin Skin"),
        ("Q13", "Lymph Node Histology"),
        ("Q14", "Neuron Structure"),
        ("Q15", "Spleen Histology"),
        ("Q16", "Skeletal Muscle Histology"),
        ("Q17", "Thymus Histology"),
    ]
    grid_data = []
    row = []
    for i, (qn, title) in enumerate(topics):
        cell = Table([[Paragraph(f"<b>{qn}</b>", make_style(f'gq{i}', fontSize=8,
                        textColor=C_BLUE, fontName='Helvetica-Bold',
                        alignment=TA_CENTER))],
                      [Paragraph(title, make_style(f'gt{i}', fontSize=7.5,
                        textColor=C_DARK, fontName='Helvetica',
                        alignment=TA_CENTER, leading=10))]],
                     colWidths=[85])
        cell.setStyle(TableStyle([
            ('BACKGROUND',    (0,0), (-1,-1), C_LIGHT),
            ('BOX',           (0,0), (-1,-1), 0.5, C_BLUE),
            ('ROUNDEDCORNERS',[5]),
            ('TOPPADDING',    (0,0), (-1,-1), 5),
            ('BOTTOMPADDING', (0,0), (-1,-1), 5),
        ]))
        row.append(cell)
        if len(row) == 6:
            grid_data.append(row)
            row = []
    if row:
        while len(row) < 6:
            row.append(Paragraph("", BODY))
        grid_data.append(row)

    grid = Table(grid_data, colWidths=[90]*6,
                 rowHeights=None)
    grid.setStyle(TableStyle([
        ('ALIGN',  (0,0), (-1,-1), 'CENTER'),
        ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
        ('TOPPADDING',    (0,0), (-1,-1), 4),
        ('BOTTOMPADDING', (0,0), (-1,-1), 4),
        ('LEFTPADDING',   (0,0), (-1,-1), 3),
        ('RIGHTPADDING',  (0,0), (-1,-1), 3),
    ]))
    story.append(grid)
    story.append(PageBreak())
    return story

# ═══════════════════════════════════════════════════════════════════════════════
# FLASHCARD CONTENT
# ═══════════════════════════════════════════════════════════════════════════════

def all_cards():
    story = []

    # ── Q1: Joints ─────────────────────────────────────────────────────────────
    synovial_diag = """
  SYNOVIAL JOINT CROSS-SECTION
  ┌─────────────────────────────────────────┐
  │              BONE                       │
  │  ┌──────────────────────────────────┐  │
  │  │   ARTICULAR CARTILAGE (Hyaline)  │  │
  │  └──────┬───────────────────┬───────┘  │
  │  Fibrous│Capsule    Synovial│Membrane  │
  │         │                   │          │
  │  ┌──────┴───────────────────┴───────┐  │
  │  │         JOINT CAVITY             │  │
  │  │      (Synovial Fluid)            │  │
  │  └──────┬───────────────────┬───────┘  │
  │  ┌──────┴───────────────────┴───────┐  │
  │  │   ARTICULAR CARTILAGE (Hyaline)  │  │
  │  └──────────────────────────────────┘  │
  │              BONE                       │
  │   ←──── Ligament ────────────────────  │
  └─────────────────────────────────────────┘"""

    joint_table = make_table(
        ["Type", "Union", "Mobility", "Example"],
        [
            ["Fibrous", "Fibrous CT", "None (synarthrosis)", "Skull sutures, gomphosis"],
            ["Cartilaginous\n(Primary)", "Hyaline cartilage", "Slight", "Costochondral, epiphyseal plate"],
            ["Cartilaginous\n(Secondary)", "Fibrocartilage", "Slight (amphiarthrosis)", "Pubic symphysis, IVD"],
            ["Synovial", "Joint cavity", "Free (diarthrosis)", "Knee, hip, shoulder, TMJ"],
        ],
        col_widths=[85, 90, 100, 140],
        hdr_color=C_BLUE
    )

    story += card(1, "Joints & Synovial Joint", C_LIGHT, C_BLUE,
        [
            b("DEFINITION: A joint = site where 2+ bones meet."),
            p("Classified by <b>structure</b> (fibrous / cartilaginous / synovial) <br/>"
              "or <b>function</b> (synarthrosis / amphiarthrosis / diarthrosis)."),
            (BODY, joint_table),
            b("6 FEATURES OF SYNOVIAL JOINT:"),
            bullet("1. Articular Cavity (joint space)"),
            bullet("2. Articular Cartilage — hyaline; avascular; reduces friction"),
            bullet("3. Articular Capsule — outer fibrous + inner synovial membrane"),
            bullet("4. Synovial Fluid — viscous; hyaluronic acid; lubricates + nourishes"),
            bullet("5. Ligaments — intracapsular / capsular / extracapsular"),
            bullet("6. Nerve supply (Hilton's Law) + rich blood supply"),
            diag(synovial_diag),
        ],
        tip="6 features by mnemonic CACLES: Cavity, Articular cartilage, Capsule, Ligaments, Epithelium (synovial), Synovial fluid",
        mnemonic="Hilton's Law: nerve to joint = nerve to muscle moving it = nerve to skin over it"
    )

    # ── Q2: Elastic Cartilage ──────────────────────────────────────────────────
    elastic_diag = """
  ELASTIC CARTILAGE — LS
  ┌──────────────────────────────────────────┐
  │ PERICHONDRIUM                            │
  │  [Outer fibrous layer — fibroblasts]     │
  │  [Inner chondrogenic — chondroblasts]    │
  ├──────────────────────────────────────────┤
  │ CARTILAGE:                               │
  │   ≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈ Elastic fibers │
  │       ○    ○○     ○                      │
  │      (L)  (IG)   (L)   Chondrocytes     │
  │   ≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈               │
  │       ○        ○○     ○                  │
  │   ≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈               │
  │  Ground substance (basophilic)           │
  └──────────────────────────────────────────┘
  L=Lacuna  IG=Isogenous group  ≈=Elastic fibers"""

    story += card(2, "Elastic Cartilage — Histology", C_TEAL, colors.HexColor("#0F766E"),
        [
            b("KEY FEATURE: Elastic fibers throughout matrix (+ type II collagen)"),
            p("<b>Stain:</b> Orcein / Verhoeff stain → elastic fibers dark brown/black<br/>"
              "<b>H&amp;E:</b> Matrix lightly basophilic; elastic fibers barely visible"),
            b("Structural Components:"),
            bullet("<b>Perichondrium</b> — present; outer fibrous + inner chondrogenic"),
            bullet("<b>Chondrocytes</b> — large, numerous, closely packed; in lacunae; isogenous groups"),
            bullet("<b>Matrix</b> — elastic fibers + type II collagen + proteoglycans (aggrecan, chondroitin sulfate, keratan sulfate, hyaluronan)"),
            bullet("<b>Does NOT calcify</b> — elastic fibers prevent mineralization"),
            b("Locations (PEAEC):"),
            bullet("Pinna (ear) — Epiglottis — Arytenoid (apices) — Eustachian tube — Cuneiform cartilage"),
            diag(elastic_diag),
        ],
        tip="Elastic cartilage is the ONLY cartilage that does NOT calcify with age",
        mnemonic="PEAEC: Pinna, Epiglottis, Arytenoid (apices), Eustachian tube, Cuneiform"
    )

    # ── Q3: Long Bone ──────────────────────────────────────────────────────────
    bone_diag = """
  TYPICAL LONG BONE
  ┌──────────────────────────────────────────┐
  │ PROXIMAL EPIPHYSIS ← articular cartilage│
  │  (spongy bone + red marrow)             │
  │  ↑ Epiphyseal artery                    │
  ├──────────────────────────────────────────┤
  │ METAPHYSIS ← epiphyseal plate (child)   │
  │             ← metaphyseal arteries      │
  ├──────────────────────────────────────────┤
  │      DIAPHYSIS (compact bone)           │
  │   ←─ Periosteum (outer fibrous +       │
  │        inner osteogenic layer)          │
  │   ┌────────────────────┐               │
  │   │  MEDULLARY CAVITY  │ ← nutrient    │
  │   │  (yellow marrow)   │   foramen     │
  │   └────────────────────┘   + artery    │
  │   ←─ Endosteum (inner lining)          │
  ├──────────────────────────────────────────┤
  │ METAPHYSIS                              │
  ├──────────────────────────────────────────┤
  │ DISTAL EPIPHYSIS ← articular cartilage │
  └──────────────────────────────────────────┘"""

    bs_table = make_table(
        ["Source", "Supplies", "Direction"],
        [
            ["Nutrient artery (main)", "Inner 2/3 cortex + medulla", "Centrifugal (inside→out)"],
            ["Metaphyseal arteries", "Metaphysis + inner epiphysis", "Multiple small vessels"],
            ["Epiphyseal arteries", "Epiphysis (separate in children)", "Via periarticular anastomosis"],
            ["Periosteal arteries", "Outer 1/3 cortex", "Centripetal (outside→in)"],
        ],
        col_widths=[120, 155, 130],
        hdr_color=colors.HexColor("#7C3AED")
    )

    story += card(3, "Typical Long Bone — Parts & Blood Supply", C_PURPLE, colors.HexColor("#7C3AED"),
        [
            b("7 PARTS of a Long Bone:"),
            bullet("1. <b>Diaphysis</b> — shaft; compact bone; contains medullary cavity"),
            bullet("2. <b>Epiphysis</b> (×2) — ends; spongy bone; articular cartilage on surface"),
            bullet("3. <b>Metaphysis</b> — flared region; epiphyseal plate (child) / line (adult)"),
            bullet("4. <b>Articular Cartilage</b> — hyaline; avascular; no perichondrium"),
            bullet("5. <b>Periosteum</b> — outer: fibrous (Sharpey's fibers); inner: osteogenic (osteoblasts)"),
            bullet("6. <b>Endosteum</b> — thin inner lining of medullary cavity + canals"),
            bullet("7. <b>Medullary (Marrow) Cavity</b> — yellow marrow (adult), red marrow (child)"),
            b("BLOOD SUPPLY (4 sources):"),
            (BODY, bs_table),
            diag(bone_diag),
        ],
        tip="Nutrient artery = principal supply; enters via nutrient foramen obliquely; flows centrifugally",
        mnemonic="DEMMPA: Diaphysis, Epiphysis, Metaphysis, Medullary cavity, Periosteum, Articular cartilage"
    )

    # ── Q4: Sesamoid Bone ──────────────────────────────────────────────────────
    story += card(4, "Sesamoid Bone — Special Features", C_YELLOW, C_GOLD,
        [
            b("DEFINITION: Small bones <u>embedded within tendons</u> at friction/stress points."),
            b("Special Features:"),
            bullet("1. Develop within tendons by endochondral ossification (fibrocartilage → bone)"),
            bullet("2. <b>Covered by fibrocartilage</b> on articular surface; fibrous tissue elsewhere"),
            bullet("3. <b>No periosteum</b> on articular surface; no perichondrium"),
            bullet("4. Compact bone outside; cancellous bone + red marrow inside"),
            bullet("5. Poor blood supply — prone to avascular necrosis"),
            bullet("6. Develop in response to mechanical stress (compression + tension)"),
            b("FUNCTIONS:"),
            bullet("Protect tendon from wear and friction"),
            bullet("Increase mechanical advantage (alter angle of tendon pull)"),
            bullet("Absorb compressive forces"),
            b("TWO EXAMPLES:"),
            bullet("<b>Patella</b> — largest sesamoid; in quadriceps tendon; extends knee; ossifies 3–6 yrs"),
            bullet("<b>Hallux sesamoids</b> — 2 bones (medial/lateral) in flexor hallucis brevis tendon; plantar surface 1st MTP joint; weight-bearing during push-off"),
            (DIAG_STYLE, """
  PATELLA (cross-section view)        HALLUX SESAMOIDS
  ┌──────────────────┐                ┌───────────────────────┐
  │ Quadriceps tendon│                │  1st Metatarsal head  │
  │    ↓             │                │       ↓               │
  │ ┌──────────┐     │                │   [Med.] [Lat.]       │
  │ │ PATELLA  │     │                │  sesamoid sesamoid    │
  │ │(sesamoid)│     │                │      ↑         ↑      │
  │ └──────────┘     │                │  Flex.hallucis brevis │
  │    ↓             │                └───────────────────────┘
  │ Patellar ligament│
  └──────────────────┘"""),
        ],
        tip="Patella = largest sesamoid. Sesamoids increase mechanical advantage (like a pulley).",
        mnemonic="Other sesamoids: Pisiform (wrist), Fabella (knee — inconstant), Thumb IP joint"
    )

    # ── Q5: Epithelium ─────────────────────────────────────────────────────────
    epi_table = make_table(
        ["Type", "Layers", "Shape", "Location", "Function"],
        [
            ["Simple squamous", "1", "Flat", "Endothelium, alveoli, Bowman's capsule, mesothelium", "Diffusion, filtration"],
            ["Simple cuboidal", "1", "Cube", "Thyroid follicles, kidney tubules", "Secretion, absorption"],
            ["Simple columnar", "1", "Tall", "GI tract, gallbladder, uterine glands", "Absorption, secretion"],
            ["Pseudostratified", "1 (appears >1)", "Columnar+cilia", "Respiratory tract, epididymis", "Mucus movement"],
            ["Stratified squamous\nkeratinized", ">1", "Squamous (dead)", "Epidermis (skin)", "Protection, waterproofing"],
            ["Stratified squamous\nnon-keratinized", ">1", "Squamous (live)", "Oral cavity, vagina, esophagus, cornea", "Protection, withstands friction"],
            ["Transitional (Urothelium)", ">1", "Dome-shaped", "Urinary bladder, ureter, renal pelvis", "Distension"],
        ],
        col_widths=[82, 45, 65, 140, 85],
        hdr_color=colors.HexColor("#DC2626")
    )

    story += card(5, "Epithelium — Definition & Classification", C_RED, colors.HexColor("#DC2626"),
        [
            b("DEFINITION: Tissue of closely packed polyhedral cells covering surfaces/lining cavities/forming glands."),
            p("<b>Key properties:</b> Avascular | Rests on basement membrane | High mitotic rate | Cell polarity (apical/lateral/basal)"),
            b("BASIS OF CLASSIFICATION: Number of layers × Shape of surface cells"),
            (BODY, epi_table),
            b("GLANDULAR EPITHELIUM:"),
            bullet("<b>Exocrine</b> — secrete via ducts (salivary glands, sweat glands, pancreas exocrine)"),
            bullet("<b>Endocrine</b> — secrete into bloodstream; no ducts (thyroid, adrenal cortex, pituitary)"),
        ],
        tip="Transitional epithelium = UROTHELIUM = only found in urinary tract. Dome-shaped surface cells = umbrella cells.",
        mnemonic="Simple epithelia where thin & efficient = Squamous. Where active = Cuboidal/Columnar."
    )

    # ── Q6: Cartilage Comparison ───────────────────────────────────────────────
    cart_table = make_table(
        ["Feature", "Hyaline", "Elastic", "Fibrocartilage"],
        [
            ["Matrix fiber", "Type II collagen (invisible H&E)", "Type II + elastic fibers (Orcein stain)", "Type I collagen (visible H&E — eosinophilic bundles)"],
            ["Appearance", "Glassy, bluish-white, translucent", "Yellow, opaque, flexible", "White, dense, opaque — like fibrous tissue"],
            ["Perichondrium", "Present (absent on articular surfaces)", "Present", "ABSENT"],
            ["Calcification", "YES — with aging; basis for endochondral ossification", "NO — elastic fibers prevent it", "May calcify in old age"],
            ["Chondrocytes", "Small; isogenous groups; in lacunae", "Large, numerous, closely packed", "Sparse; rows between collagen bundles; no capsule"],
            ["Mechanical property", "Firm, resilient; resists compression", "Flexible, elastic; returns to shape", "Strongest; resists tension AND compression"],
            ["Locations", "Articular cartilage, trachea, larynx, ribs, fetal skeleton", "Ear pinna, epiglottis, arytenoids, Eustachian tube", "IVD annulus, pubic symphysis, menisci, glenoid/acetabular labra"],
        ],
        col_widths=[80, 118, 108, 108],
        hdr_color=colors.HexColor("#0369A1")
    )

    story += card(6, "Cartilage Types — Comparison", C_LIGHT, colors.HexColor("#0369A1"),
        [
            b("THREE TYPES: Hyaline | Elastic | Fibrocartilage (White fibro)"),
            (BODY, cart_table),
        ],
        tip="Fibrocartilage is the ONLY type with NO perichondrium and NO capsule around chondrocytes",
        mnemonic="HEF = Hyaline (most common) → Elastic (ear/epiglottis) → Fibro (discs/symphysis)"
    )

    # ── Q7: Endochondral Ossification ─────────────────────────────────────────
    ossif_diag = """
  ENDOCHONDRAL OSSIFICATION — STAGES
  ┌────────────────────────────────────────────────────┐
  │ 1. Cartilage model (mesenchyme → chondroblasts)    │
  │ 2. Cartilage growth + central hypertrophy +        │
  │    calcification of matrix                         │
  │ 3. Bone collar forms (periosteum → osteoblasts)    │
  │ 4. Vascular invasion → PRIMARY ossification center │
  │    (diaphysis) — osteoclasts resorb calcified cart;│
  │    osteoblasts deposit woven bone on remnant spicules│
  │ 5. Medullary cavity formation (osteoclast resorption)│
  │ 6. SECONDARY ossification centers form (epiphyses) │
  │    — mostly postnatal                              │
  │ 7. Epiphyseal plate activity (growth in length):   │
  │    Reserve → Proliferating → Hypertrophic →        │
  │    Calcified → Ossification (RPHCO)                │
  │ 8. Epiphyseal plate closure (sex hormones puberty) │
  └────────────────────────────────────────────────────┘
  
  EPIPHYSEAL PLATE ZONES (metaphysis → epiphysis):
  ┌────────────────────────────────────────────────────┐
  │ OSSIFICATION zone  ← woven bone deposited here     │
  │ CALCIFIED zone     ← chondrocytes dying, Ca2+      │
  │ HYPERTROPHIC zone  ← cells enlarge; secrete VEGF   │
  │ PROLIFERATING zone ← columns of dividing cells     │
  │ RESERVE zone       ← small inactive chondrocytes   │
  └────────────────────────────────────────────────────┘"""

    story += card(7, "Intracartilaginous (Endochondral) Ossification", C_GREEN,
                  colors.HexColor("#15803D"),
        [
            b("Endochondral ossification = bone formation on a PRE-EXISTING hyaline cartilage model."),
            p("Forms: long bones, vertebrae, ribs, pelvis, base of skull (most of skeleton)."),
            b("8 KEY STAGES:"),
            bullet("1. <b>Cartilage model</b> formed by mesenchymal cells → chondroblasts"),
            bullet("2. <b>Hypertrophy + calcification</b> of central cartilage; chondrocytes secrete alkaline phosphatase + VEGF"),
            bullet("3. <b>Bone collar</b> (periosteal intramembranous bone) around midshaft"),
            bullet("4. <b>Vascular invasion</b> → primary ossification center (diaphysis, fetal life)"),
            bullet("5. <b>Medullary cavity</b> created by osteoclasts"),
            bullet("6. <b>Secondary ossification centers</b> in epiphyses (postnatal)"),
            bullet("7. <b>Epiphyseal plate (physis)</b> — 5 zones drive lengthening"),
            bullet("8. <b>Plate closure</b> at puberty (sex hormones) → epiphyseal line"),
            diag(ossif_diag),
        ],
        tip="Mnemonic for epiphyseal plate zones (epiphysis → diaphysis): RPHCO",
        mnemonic="RPHCO: Reserve, Proliferating, Hypertrophic, Calcified, Ossification"
    )

    # ── Q8: Smooth Muscle ─────────────────────────────────────────────────────
    sm_diag = """
  SMOOTH MUSCLE — LS and TS
  
  LONGITUDINAL SECTION (LS):          TRANSVERSE SECTION (TS):
  ┌─────────────────────────┐         ┌──────────────────────┐
  │   ____________          │         │  ○  ○ (○) ○  ○  ○   │
  │  /  Nucleus    \        │         │  ○  ○  ○  (N) ○  ○  │
  │ / (cigar-shaped)\ ←cell │         │  ○  ○  ○   ○  ○  ○  │
  │ \               / body  │         │  ○  ○  (○) ○  ○  ○  │
  │  \   actin ~~~~\/       │         │                      │
  │   \  myosin ===\        │         │  ○ = cell profile    │
  │  ● dense bodies│        │         │ (N) = cell with      │
  │ ° caveolae (PM)│        │         │  nucleus (central)   │
  │  ←gap junctions→        │         │                      │
  └─────────────────────────┘         └──────────────────────┘
  
  CONTRACT via: Ca2+→Calmodulin→MLCK→phosphorylate myosin→cross bridges"""

    story += card(8, "Smooth Muscle — Histological Structure", C_ORANGE, colors.HexColor("#C2410C"),
        [
            b("Smooth = Involuntary, Non-striated, Visceral muscle"),
            b("CELL (Smooth muscle fiber):"),
            bullet("<b>Shape:</b> Spindle-shaped (fusiform); tapered ends"),
            bullet("<b>Nucleus:</b> Single, elongated (cigar-shaped), CENTRAL; corkscrews when contracted"),
            bullet("<b>No striations</b> — actin + myosin not in sarcomeres; no Z-discs → instead <b>DENSE BODIES</b>"),
            bullet("<b>Dense bodies</b> — anchor actin filaments; contain α-actinin (analogous to Z-discs)"),
            bullet("<b>Caveolae</b> — plasma membrane invaginations; Ca2+ storage (= T-tubules)"),
            bullet("<b>Intermediate filaments</b> (desmin, vimentin) — cytoskeletal scaffold"),
            bullet("<b>Gap junctions (Nexus)</b> — electrical coupling for coordinated contraction"),
            b("CONNECTIVE TISSUE:"),
            bullet("Endomysium (reticular type III collagen) around each cell"),
            bullet("Perimysium → Epimysium around bundles/whole muscle"),
            b("CONTRACTION MECHANISM:"),
            bullet("Ca2+ → binds Calmodulin → activates MLCK → phosphorylates myosin → cross-bridge cycling → contraction"),
            b("LOCATION: GI tract, uterus, blood vessels, bronchi, iris, ciliary body, bladder"),
            diag(sm_diag),
        ],
        tip="TS section: central cells largest (nucleus at equator); peripheral cells appear as empty circles",
        mnemonic="Smooth muscle: Single nucleus, Central, No striations, Caveolae, Calmodulin"
    )

    # ── Q9: Trachea ───────────────────────────────────────────────────────────
    trachea_diag = """
  TRACHEA — WALL LAYERS (lumen → outside)
  ┌────────────────────────────────────────────────┐
  │ LUMEN                                          │
  ├────────────────────────────────────────────────┤
  │ 1. MUCOSA                                      │
  │    ├─ Pseudostratified Ciliated Columnar Epi   │
  │    │  (PCCE: ciliated cells, goblet cells,     │
  │    │   basal cells, brush cells, DNES cells)   │
  │    ├─ THICK BASEMENT MEMBRANE (★ hallmark)     │
  │    └─ Lamina propria (loose CT + elastic fibers)│
  ├────────────────────────────────────────────────┤
  │ 2. SUBMUCOSA                                   │
  │    └─ Mixed seromucous TRACHEAL GLANDS        │
  │       (keep airway moist; drain via ducts)     │
  ├────────────────────────────────────────────────┤
  │ 3. HYALINE CARTILAGE RINGS (C-shaped, 16–20)  │
  │    └─ Open posteriorly                         │
  │    └─ Between rings: annular (fibroelastic)    │
  │       ligaments                                │
  ├────────────────────────────────────────────────┤
  │ 4. ADVENTITIA (Fibrosa) — dense CT            │
  ├────────────────────────────────────────────────┤
  │ POSTERIOR WALL: TRACHEALIS MUSCLE (smooth m.)  │
  │  (closes gap between cartilage tips)           │
  └────────────────────────────────────────────────┘"""

    story += card(9, "Trachea — Histology & Diagram", C_TEAL, colors.HexColor("#0F766E"),
        [
            b("4 WALL LAYERS + Posterior trachealis muscle"),
            bullet("<b>MUCOSA:</b> PCCE + thick BM + lamina propria"),
            bullet("<b>SUBMUCOSA:</b> seromucous tracheal glands (keep mucosa moist)"),
            bullet("<b>CARTILAGE LAYER:</b> 16–20 C-shaped hyaline cartilage rings; open posteriorly"),
            bullet("<b>ADVENTITIA:</b> dense fibroelastic CT blending with mediastinum"),
            bullet("<b>TRACHEALIS:</b> smooth muscle bridging posterior gap; contracts during coughing"),
            b("Cells of respiratory epithelium (PCCE):"),
            bullet("Ciliated columnar cells (most numerous — cilia beat mucus upward = mucociliary escalator)"),
            bullet("Goblet cells — mucus secreting"),
            bullet("Basal cells — stem cells; rest on BM only"),
            bullet("Brush cells (sensory) + Kulchitsky/DNES cells (neuroendocrine)"),
            diag(trachea_diag),
        ],
        tip="THICK basement membrane = hallmark of trachea in histology slides",
        mnemonic="Layers: MSCA = Mucosa, Submucosa, Cartilage rings, Adventitia + Trachealis posteriorly"
    )

    # ── Q10: Thin Skin ────────────────────────────────────────────────────────
    thin_skin_diag = """
  THIN SKIN — LAYERS (surface → deep)
  ┌────────────────────────────────────────────────┐
  │ EPIDERMIS (4 layers):                          │
  │  4. Stratum CORNEUM   ← dead corneocytes,      │
  │                          keratin; thin         │
  │  3. Stratum GRANULOSUM← keratohyalin granules  │
  │                          (2-3 layers)          │
  │  2. Stratum SPINOSUM  ← Langerhans cells;      │
  │                          prickle cells         │
  │  1. Stratum BASALE    ← stem cells; melanocytes│
  │     (Germinativum)       hemidesmosomes on BM  │
  ├────────────────────────────────────────────────┤
  │ DERMIS:                                        │
  │  Papillary layer — loose CT; dermal papillae   │
  │                    (shorter/fewer in thin skin) │
  │  Reticular layer — dense CT; hair follicles;   │
  │                    sebaceous glands; sweat glands│
  ├────────────────────────────────────────────────┤
  │ HYPODERMIS — loose CT + adipose (not true skin)│
  └────────────────────────────────────────────────┘
  ★ THIN SKIN HAS: Hair follicles, Sebaceous glands,
    Arrector pili — ALL ABSENT in thick skin"""

    story += card(10, "Thin Skin — Histology", C_PINK, colors.HexColor("#BE185D"),
        [
            b("Thin skin = covers most body; ~0.5–3 mm thick; has HAIR FOLLICLES"),
            b("EPIDERMIS — 4 LAYERS (no stratum lucidum):"),
            bullet("<b>Stratum Basale</b> — single columnar/cuboidal; stem cells + melanocytes (1:10 keratinocytes)"),
            bullet("<b>Stratum Spinosum</b> — polygonal cells; desmosomes (prickles); Langerhans cells (APC); lamellar bodies"),
            bullet("<b>Stratum Granulosum</b> — 2–5 layers; keratohyalin granules (basophilic); lamellar body lipid release (waterproofing)"),
            bullet("<b>Stratum Corneum</b> — anucleate dead squames; keratin + lipid cement; THINNER than thick skin"),
            b("DERMIS:"),
            bullet("<b>Papillary layer</b> — loose CT; dermal papillae; Meissner's corpuscles; capillary loops"),
            bullet("<b>Reticular layer</b> — dense irregular CT; type I collagen; hair follicles, sebaceous glands, eccrine/apocrine sweat glands, arrector pili"),
            diag(thin_skin_diag),
        ],
        tip="Thin skin LACKS stratum lucidum (found only in thick skin of palms/soles)",
        mnemonic="Layers of epidermis (deep to surface): Brave SPies Get Cornered = Basale, Spinosum, Granulosum, (Lucidum in thick), Corneum"
    )

    # ── Q11: Splenic Circulation ──────────────────────────────────────────────
    splenic_diag = """
  SPLENIC CIRCULATION PATHWAY:
  ┌────────────────────────────────────────────────────┐
  │ Splenic artery (celiac trunk)                      │
  │   → Trabecular arteries (in trabeculae)            │
  │      → Central arteries (enter PALS = white pulp) │
  │         → Penicillar arteries:                     │
  │            - Pulp arterioles                       │
  │            - Sheathed capillaries (Ellipsoids)     │
  │            - Terminal capillaries                  │
  │                   ↓                                │
  │        ┌──────────┴──────────┐                     │
  │    OPEN (90%)           CLOSED (10%)               │
  │  cords of Billroth →    direct to sinuses          │
  │  squeeze through                                   │
  │  endothelial slits  →   fast; no screening         │
  │  (SLOW; macrophage                                 │
  │   screening here)                                  │
  │        └──────────┬──────────┘                     │
  │         Venous sinuses                             │
  │          → Pulp veins                              │
  │             → Trabecular veins                     │
  │                → Splenic vein                      │
  └────────────────────────────────────────────────────┘"""

    story += card(11, "Splenic Circulation", C_LIGHT, C_BLUE,
        [
            b("Spleen filters BLOOD (not lymph). Open circulation = dominant pathway."),
            b("SEQUENCE:"),
            bullet("Splenic a. → Trabecular aa. → Central aa. (in PALS/white pulp)"),
            bullet("→ Penicillar arteries → Sheathed capillaries (Ellipsoids — Schweigger-Seidel sheaths)"),
            bullet("→ RED PULP via two routes:"),
            bullet("<b>Open (slow, 90%)</b>: capillaries → cords of Billroth → must squeeze through endothelial slits → venous sinuses"),
            bullet("<b>Closed (fast, 10%)</b>: capillaries → directly into venous sinuses"),
            bullet("Venous sinuses → Pulp veins → Trabecular veins → Splenic vein"),
            b("SIGNIFICANCE of open circulation:"),
            bullet("<b>Culling</b> — phagocytosis of old/deformed RBCs"),
            bullet("<b>Pitting</b> — remove inclusions WITHOUT destroying RBC"),
            bullet("<b>Immune surveillance</b> — antigen presentation in white pulp"),
            bullet("<b>Platelet reservoir</b> — ~30% platelets stored here"),
            diag(splenic_diag),
        ],
        tip="OPEN circulation = slow; macrophages in cords destroy old RBCs. Endothelial slits = quality-control checkpoint.",
        mnemonic="Old RBCs are culled (destroyed) and pitted (inclusions removed) in the splenic cords"
    )

    # ── Q12: Thick vs Thin Skin ───────────────────────────────────────────────
    skin_table = make_table(
        ["Feature", "THICK Skin", "THIN Skin"],
        [
            ["Location", "Palms, soles, fingertips", "Rest of body"],
            ["Epidermal layers", "5 (includes stratum lucidum)", "4 (NO stratum lucidum)"],
            ["Stratum corneum", "Very thick", "Thin"],
            ["Hair follicles", "ABSENT", "Present"],
            ["Sebaceous glands", "ABSENT", "Present"],
            ["Arrector pili", "ABSENT", "Present"],
            ["Dermal papillae", "Tall, regular, numerous", "Short, fewer, irregular"],
            ["Sweat glands", "Eccrine only; densely packed", "Eccrine + apocrine"],
            ["Dermatoglyphics", "Present (fingerprints)", "Absent"],
            ["Sensory receptors", "Meissner's (papillary dermis); Pacinian (deep dermis)", "Free nerve endings, hair follicle receptors"],
            ["Melanocytes", "Fewer", "More per unit area"],
        ],
        col_widths=[110, 135, 160],
        hdr_color=colors.HexColor("#BE185D")
    )

    story += card(12, "Thick Skin vs Thin Skin", C_PINK, colors.HexColor("#BE185D"),
        [
            b("KEY DIFFERENCES AT A GLANCE:"),
            (BODY, skin_table),
        ],
        tip="The ONLY difference in layers: thick skin has STRATUM LUCIDUM between granulosum and corneum",
        mnemonic="Thick skin: BSGLC (has all 5 layers). Thin skin: BSGC (no Lucidum)"
    )

    # ── Q13: Lymph Node ───────────────────────────────────────────────────────
    ln_diag = """
  LYMPH NODE — MICROSCOPIC STRUCTURE
  ┌────────────────────────────────────────────────┐
  │  ↓↓↓ Afferent lymphatics (multiple)           │
  │ CAPSULE (dense collagen)                       │
  │  └─ Subcapsular sinus (macrophages below)      │
  │     Trabeculae + trabecular sinuses            │
  │ OUTER CORTEX (B-cell zone):                    │
  │  ○ Primary follicle — resting B cells          │
  │  ◎ Secondary follicle:                         │
  │    [Germinal center — proliferating B cells,   │
  │     FDCs, Th cells, tingible-body macrophages] │
  │    {Mantle zone — resting B cells}             │
  │ PARACORTEX (T-cell zone / inner cortex):       │
  │  ⊕ HEV — lymphocyte homing from blood         │
  │    Interdigitating dendritic cells (APCs)      │
  │ MEDULLA:                                       │
  │  ▓ Medullary cords — plasma cells + B cells   │
  │  ░ Medullary sinuses → efferent lymphatic      │
  │              ↓ Efferent lymphatic (single)     │
  │           HILUM (blood vessels)                │
  └────────────────────────────────────────────────┘"""

    story += card(13, "Lymph Node — Microscopic Features", C_PURPLE, colors.HexColor("#7C3AED"),
        [
            b("Lymph node = bean-shaped; filters LYMPH; encapsulated; along lymphatic vessels"),
            b("STRUCTURE:"),
            bullet("<b>Capsule</b> → Subcapsular sinus (macrophages) → Trabeculae + trabecular sinuses"),
            b("OUTER CORTEX (B-cell zone):"),
            bullet("<b>Primary follicle</b> — compact; small resting B lymphocytes; no germinal center"),
            bullet("<b>Secondary follicle</b> — has germinal center (GC) + mantle zone"),
            bullet("GC: centroblasts → centrocytes; somatic hypermutation; class switching; FDCs; tingible-body macrophages"),
            b("PARACORTEX (Inner cortex / T-cell zone):"),
            bullet("<b>T lymphocytes</b> (predominantly); expands in cell-mediated immunity"),
            bullet("<b>HEV (High Endothelial Venules)</b> — tall cuboidal endothelium; lymphocyte recirculation from blood"),
            bullet("Interdigitating dendritic cells (APCs)"),
            b("MEDULLA:"),
            bullet("<b>Medullary cords</b> — plasma cells (antibody secretion), B cells, macrophages"),
            bullet("<b>Medullary sinuses</b> — connect to efferent lymphatic at hilum"),
            diag(ln_diag),
        ],
        tip="Absent paracortex = DiGeorge syndrome (T-cell deficiency). HEV = where lymphocytes home into node from blood.",
        mnemonic="Outer cortex = B-cells, Inner cortex (paracortex) = T-cells, Medulla = Plasma cells"
    )

    # ── Q14: Neuron ───────────────────────────────────────────────────────────
    neuron_diag = """
  NEURON STRUCTURE
  
        DENDRITES (many; toward cell body)
          \\   |   /
           \\  |  /
   ┌────────────────────────────┐
   │      CELL BODY (SOMA)      │
   │  ┌────────────────────┐   │
   │  │  Nucleus + Nucleolus│   │
   │  │  ("owl-eye")        │   │
   │  └────────────────────┘   │
   │  ≡ Nissl bodies (RER)     │
   │  • Mitochondria           │
   │  ↕ Neurofilaments/tubules │
   └────────────┬───────────────┘
                │ ← Axon Hillock (NO Nissl bodies)
                │ ← Initial segment (AP trigger zone)
     ═══════════╪═══════════  Myelin sheath
                │             (Schwann cell — PNS;
     ───────────┼───────────  Oligodendrocyte — CNS)
                │ ← Node of Ranvier (gap in myelin)
     ═══════════╪═══════════
                │ AXON (single; uniform diameter)
               /|\
              / | \  ← Telodendria (terminal branches)
             ●  ●  ● ← Synaptic boutons/terminals
                       (vesicles + mitochondria)"""

    story += card(14, "Neuron — Structure with Diagram", C_YELLOW, C_GOLD,
        [
            b("Neuron = structural + functional unit of NS; specialized for electrochemical signal transmission"),
            b("PARTS:"),
            bullet("<b>Cell body (Soma/Perikaryon)</b> — metabolic center; nucleus (large, round, pale/euchromatic, prominent nucleolus = 'owl-eye'); Nissl bodies (RER stacks = protein synthesis); Golgi; neurofilaments; lipofuscin"),
            bullet("<b>Nissl bodies</b> — in cytoplasm + dendrites; ABSENT at axon hillock + in axon"),
            bullet("<b>Dendrites</b> — multiple, short, branching; conduct impulses TOWARD soma; dendritic spines = synaptic sites"),
            bullet("<b>Axon</b> — single, uniform diameter; arises from axon hillock; conducts AWAY from soma; NO Nissl/RER; axoplasmic transport (anterograde = kinesin; retrograde = dynein)"),
            bullet("<b>Myelin sheath</b> — Schwann cells (PNS) or Oligodendrocytes (CNS); insulation; saltatory conduction"),
            bullet("<b>Nodes of Ranvier</b> — gaps in myelin; action potential 'jumps' = saltatory conduction"),
            bullet("<b>Synaptic bouton</b> — presynaptic vesicles + mitochondria | synaptic cleft (~30 nm) | postsynaptic receptors"),
            diag(neuron_diag),
        ],
        tip="Retrograde transport used by: herpes virus, rabies virus, tetanospasmin — they travel from terminal to cell body",
        mnemonic="Nissl bodies = Rough ER; present in dendrites BUT NOT in axon hillock or axon"
    )

    # ── Q15: Spleen ───────────────────────────────────────────────────────────
    spleen_diag = """
  SPLEEN — HISTOLOGICAL STRUCTURE
  ┌────────────────────────────────────────────────────┐
  │ CAPSULE (fibrous + smooth muscle cells)            │
  │  └─ TRABECULAE (carry trabecular vessels)          │
  │                                                    │
  │  WHITE PULP (islands):                             │
  │  ┌──────────────────────────────────────────────┐ │
  │  │  PALS (T-cells around central artery)        │ │
  │  │       ─ Central Artery                       │ │
  │  │  ┌─────────────────────────────────┐         │ │
  │  │  │ Lymphoid Follicle (B-cells)     │         │ │
  │  │  │  ○ Primary OR                  │         │ │
  │  │  │  [GC] + {mantle} = Secondary   │         │ │
  │  │  └─────────────────────────────────┘         │ │
  │  └──────────────────────────────────────────────┘ │
  │  ←── Marginal Zone (B-cells, macrophages, NK) ──→  │
  │                                                    │
  │  RED PULP:                                         │
  │  ≈≈ VENOUS SINUSES (rod endothelium + ring fibers) │
  │  ▓▓ CORDS of BILLROTH (macrophages, RBCs)         │
  └────────────────────────────────────────────────────┘"""

    story += card(15, "Spleen — Histological Structure", C_GREEN, colors.HexColor("#15803D"),
        [
            b("Spleen = largest 2° lymphoid organ; filters BLOOD; hilum for vessels"),
            b("STRUCTURE:"),
            bullet("<b>Capsule</b> — fibrous + elastic + smooth muscle cells; trabeculae extend inward"),
            bullet("<b>Stroma</b> — reticular fibers (type III collagen) + reticular cells"),
            b("WHITE PULP (~20–25%):"),
            bullet("<b>PALS</b> (Periarteriolar Lymphoid Sheath) — T lymphocytes around central artery"),
            bullet("<b>Lymphoid follicles</b> (Malpighian corpuscles) — eccentric to PALS; B lymphocytes"),
            bullet("Primary (resting) or secondary follicles (with germinal center)"),
            bullet("<b>Marginal zone</b> — B cells, macrophages, NK cells; filters blood from central artery"),
            b("RED PULP (~75–80%):"),
            bullet("<b>Venous sinuses</b> — lined by rod-shaped endothelial cells (parallel to long axis); ring fibers (reticular hoops) external; SLITS between cells = RBC quality control"),
            bullet("<b>Cords of Billroth</b> — reticular meshwork; macrophages; RBCs; platelets; plasma cells"),
            diag(spleen_diag),
        ],
        tip="Venous sinuses of spleen: rod-shaped (barrel stave) endothelium + ring fibers = unique and testable",
        mnemonic="Spleen = Blood filter; White pulp = immunity; Red pulp = RBC destruction"
    )

    # ── Q16: Skeletal Muscle ─────────────────────────────────────────────────
    skel_diag = """
  SKELETAL MUSCLE — LS AND SARCOMERE
  ┌──────────────────────────────────────────────────┐
  │  Epimysium → Perimysium → Endomysium            │
  │  MUSCLE FIBER (Cell):                           │
  │   N  N  N  N  ← peripheral nuclei (multiple)   │
  │   ─────────────────────────── Sarcolemma        │
  │   |  Myofibril:               T-tubule ↕        │
  │   | ┌──────────────────────────────────────┐   │
  │   | │Z─[I]─[──A──]─[H]─[──A──]─[I]─Z      │   │
  │   | │  ↑    ↑    ↑   ↑                     │   │
  │   | │Z-disc I-band A-band H-zone M-line     │   │
  │   | └──────────────────────────────────────┘   │
  │   | Sarcoplasmic reticulum (SR)                │
  │   | Terminal cisternae ← TRIAD (T+2SR)         │
  │   │  located at A-I junction in skeletal muscle │
  └──────────────────────────────────────────────────┘
  SARCOMERE = Z-disc to Z-disc (~2.5 µm at rest)
  Thin filaments (actin 7nm): I-band + part of A-band
  Thick filaments (myosin 15nm): A-band only"""

    story += card(16, "Skeletal Muscle — Histological Structure", C_ORANGE, colors.HexColor("#C2410C"),
        [
            b("Skeletal = Striated, Voluntary, Multinucleate"),
            b("MUSCLE FIBER (Cell):"),
            bullet("Largest cells in body: 10–100 µm diameter; up to 30 cm long"),
            bullet("<b>Multinucleate</b> (syncytium; from myoblast fusion)"),
            bullet("<b>PERIPHERAL nuclei</b> (below sarcolemma) ← key ID feature"),
            bullet("<b>Satellite cells</b> — mononuclear stem cells under sarcolemma; regeneration"),
            b("CT ORGANIZATION:"),
            bullet("<b>Epimysium</b> — whole muscle; <b>Perimysium</b> — fascicles; <b>Endomysium</b> — individual fibers"),
            b("SARCOMERE (Z to Z):"),
            bullet("<b>Z-disc</b> — anchors actin; sarcomere boundary; α-actinin"),
            bullet("<b>I-band</b> (light) — thin filaments (actin) only; bisected by Z-disc"),
            bullet("<b>A-band</b> (dark) — full myosin length; DOES NOT shorten during contraction"),
            bullet("<b>H-zone</b> — myosin only; narrows during contraction"),
            bullet("<b>M-line</b> — center of A-band; cross-links myosin"),
            b("T-TUBULES + SR → TRIAD (T-tubule flanked by 2 SR cisternae at A-I junction)"),
            diag(skel_diag),
        ],
        tip="During contraction: I-band shortens, H-zone shortens, A-band LENGTH UNCHANGED",
        mnemonic="I-band and H-zone = Intersect = shorten. A-band = Always same length"
    )

    # ── Q17: Thymus ──────────────────────────────────────────────────────────
    thymus_diag = """
  THYMUS — HISTOLOGICAL STRUCTURE
  ┌────────────────────────────────────────────────────┐
  │ FIBROELASTIC CAPSULE                               │
  │  └─ Interlobular septa (trabeculae) → LOBULES     │
  │                                                    │
  │  LOBULE:                                           │
  │  ┌──────────────────────────────────────────────┐ │
  │  │ CORTEX (dark) — densely packed thymocytes    │ │
  │  │  • cTECs (Nurse cells — MHC I + II)         │ │
  │  │  • Blood-Thymus Barrier (BTB) — cortex only  │ │
  │  │  • Macrophages (phagocytose dead thymocytes) │ │
  │  │  ← ~95% thymocytes die here by apoptosis →  │ │
  │  ├──────────────────────────────────────────────┤ │
  │  │ MEDULLA (pale) — fewer thymocytes            │ │
  │  │  • mTECs + AIRE (self-antigen expression)    │ │
  │  │  ⊕ HASSALL'S CORPUSCLES ← pathognomonic!    │ │
  │  │    (concentric whorls of keratinized eTECs)  │ │
  │  │  • No BTB — mature T-cells exit via HEV      │ │
  │  └──────────────────────────────────────────────┘ │
  │  Medullae of adjacent lobules are CONTINUOUS       │
  └────────────────────────────────────────────────────┘"""

    story += card(17, "Thymus — Capsule & Histological Structure", C_TEAL, colors.HexColor("#0F766E"),
        [
            b("CAPSULE NAME: Thin FIBROELASTIC connective tissue capsule"),
            p("Sends <b>interlobular septa (trabeculae)</b> inward → divides gland into incomplete <b>lobules</b>.<br/>"
              "Medullae of adjacent lobules are continuous (lobules only incomplete)."),
            b("PRIMARY lymphoid organ; most active birth → puberty → involutes (replaced by fat)."),
            b("CORTEX (outer; dark-staining):"),
            bullet("Densely packed <b>thymocytes</b> (T-cell precursors from bone marrow)"),
            bullet("<b>cTECs (Cortical Thymic Epithelial Cells / Nurse Cells)</b> — reticular network; express MHC I + II; POSITIVE SELECTION"),
            bullet("<b>Blood-Thymus Barrier (BTB)</b> — protects cortex from blood-borne antigens; capillary endothelium + BL + perivascular CT + epithelial BL"),
            bullet("<b>~95% thymocytes DIE here</b> by apoptosis; phagocytosed by macrophages"),
            b("MEDULLA (inner; pale-staining):"),
            bullet("<b>mTECs + AIRE gene</b> — express tissue-specific antigens → NEGATIVE SELECTION (delete self-reactive T cells)"),
            bullet("<b>HASSALL'S CORPUSCLES</b> (Thymic corpuscles) — concentric whorls of flattened keratinized epithelial cells; may be calcified/cystic; <b>PATHOGNOMONIC of thymus</b>"),
            bullet("Mature T-cells exit via medullary HEV into circulation"),
            diag(thymus_diag),
        ],
        tip="Hassall's corpuscles = ONLY in thymus. Their presence identifies thymus in any histology slide.",
        mnemonic="Cortex = Positive selection (keep if recognize self-MHC). Medulla = Negative selection (kill if attack self-antigens)"
    )

    return story

# ─── Main PDF build ────────────────────────────────────────────────────────────
def main():
    os.makedirs(os.path.dirname(OUTPUT_PATH), exist_ok=True)
    doc = SimpleDocTemplate(
        OUTPUT_PATH,
        pagesize=A4,
        leftMargin=1*cm, rightMargin=1*cm,
        topMargin=1.2*cm, bottomMargin=1.2*cm,
        title="BDS 1st Year Anatomy Flashcards — Kathmandu University",
        author="Orris Medical AI",
        subject="BDS Anatomy Board Exam Revision"
    )

    story = []
    story += cover_page()
    story += all_cards()

    doc.build(story)
    print(f"PDF generated: {OUTPUT_PATH}")
    import os as _os
    size = _os.path.getsize(OUTPUT_PATH)
    print(f"File size: {size/1024:.1f} KB")

if __name__ == "__main__":
    main()
Running Command

cd /home/daytona/workspace/bds-flashcards && python generate_flashcards.py 2>&1

This is a shared conversation. Sign in to Orris to start your own chat.