// data.jsx — Pathline learning tracker mock data
// One coherent world: 5 domains → topics → notes + generated materials.

const ACCENT = { green:'#2E7A3A', lilac:'#D49CEE', blue:'#1E8FF0', clay:'#C7937D', sage:'#9FC09C' };

// Selectable accent colors — each with a light value, a text-ink value, and a
// brighter/lighter value used only in dark mode.
const ACCENTS = [
  { id:'blue',   light:'#1E8FF0', ink:'#0E6BC4', dark:'#5CB3FF' },
  { id:'green',  light:'#2E7A3A', ink:'#1F5C2A', dark:'#62D981' },
  { id:'purple', light:'#8B53C0', ink:'#6E3BA0', dark:'#CB97FF' },
  { id:'clay',   light:'#C2795C', ink:'#9C5B40', dark:'#FBA982' },
];

const DOMAINS = [
  { id:'bio',  name:'Biology',        accent:ACCENT.green, pos:[24,24] },
  { id:'esp',  name:'Language Learning',accent:ACCENT.lilac, pos:[75,20] },
  { id:'ml',   name:'Machine Learning',accent:ACCENT.blue, pos:[84,56] },
  { id:'hist', name:'World History',  accent:ACCENT.clay,  pos:[56,82] },
  { id:'mus',  name:'Music Theory',   accent:ACCENT.sage,  pos:[16,62] },
  { id:'sci',  name:'Everyday Science', accent:ACCENT.blue, pos:[48,12] },
  { id:'body', name:'The Human Body', accent:ACCENT.clay, pos:[28,88] },
  { id:'tech', name:'Everyday Technology', accent:ACCENT.blue, pos:[88,86] },
  { id:'rome', name:'Ancient Rome',        accent:ACCENT.clay,  pos:[38,67] },
  { id:'astro',name:'Astronomy',           accent:ACCENT.lilac, pos:[69,37] },
];

const TOPICS = [
  { id:'cell',  domain:'bio',  name:'Cell Biology',          notes:14, progress:78, due:8, pos:[11,11] },
  { id:'gen',   domain:'bio',  name:'Genetics',              notes:9,  progress:42, due:3, pos:[36,8] },
  { id:'verb',  domain:'esp',  name:'Verb Conjugation',      notes:11, progress:55, due:5, pos:[64,7] },
  { id:'vocab', domain:'esp',  name:'Travel Vocabulary',     notes:7,  progress:33, due:2, pos:[87,34] },
  { id:'nn',    domain:'ml',   name:'Neural Networks',       notes:21, progress:90, due:4, pos:[90,45] },
  { id:'grad',  domain:'ml',   name:'Gradient Descent',      notes:12, progress:61, due:0, pos:[89,73] },
  { id:'cold',  domain:'hist', name:'The Cold War',          notes:16, progress:48, due:6, pos:[42,95] },
  { id:'indr',  domain:'hist', name:'Industrial Revolution', notes:10, progress:70, due:1, pos:[73,94] },
  { id:'scale', domain:'mus',  name:'Scales & Modes',        notes:8,  progress:36, due:2, pos:[9,50] },
  { id:'chord', domain:'mus',  name:'Chord Progressions',    notes:6,  progress:52, due:0, pos:[9,84] },
  { id:'minor', domain:'mus',  name:'Minor Chords',          notes:5,  progress:30, due:6, pos:[22,76] },
  { id:'simpson',domain:'ml',  name:"Simpson's Paradox",      notes:7,  progress:40, due:3, pos:[78,66] },
  { id:'tardi', domain:'bio',  name:'Tardigrades',           notes:6,  progress:25, due:4, pos:[30,32] },
  { id:'sky',   domain:'sci',  name:'The Blue Sky',          notes:5,  progress:55, due:2, pos:[40,6] },
  { id:'onion', domain:'sci',  name:'Onion Chemistry',       notes:6,  progress:45, due:3, pos:[56,6] },
  { id:'bees',  domain:'sci',  name:'The Waggle Dance',      notes:5,  progress:20, due:5, pos:[62,20] },
  { id:'caf',   domain:'body', name:'Caffeine',           notes:6, progress:35, due:3, pos:[16,90] },
  { id:'doms',  domain:'body', name:'Muscle Soreness',    notes:5, progress:20, due:2, pos:[24,95] },
  { id:'hic',   domain:'body', name:'Hiccups',            notes:4, progress:15, due:1, pos:[33,90] },
  { id:'dream', domain:'body', name:'Why We Dream',       notes:7, progress:40, due:4, pos:[40,95] },
  { id:'blush', domain:'body', name:'Blushing',           notes:5, progress:25, due:2, pos:[20,82] },
  { id:'eye',   domain:'body', name:'Eye Color',          notes:5, progress:30, due:2, pos:[36,82] },
  { id:'micro', domain:'tech', name:'Microwave Ovens',    notes:6, progress:45, due:3, pos:[80,93] },
  { id:'gps',   domain:'tech', name:'GPS & Relativity',   notes:8, progress:55, due:4, pos:[90,93] },
  { id:'touch', domain:'tech', name:'Touchscreens',       notes:5, progress:30, due:2, pos:[95,84] },
  { id:'fridge',domain:'tech', name:'Refrigeration',      notes:6, progress:38, due:3, pos:[94,76] },
  { id:'mrna',  domain:'tech', name:'mRNA Vaccines',      notes:7, progress:42, due:3, pos:[82,80] },
  { id:'libatt',domain:'tech', name:'Lithium-ion Batteries', notes:6, progress:35, due:2, pos:[90,68] },
  // Ancient Rome — imported deep-dive report (6 dives)
  { id:'rkings', domain:'rome', name:'From Kings to Republic', notes:12, progress:64, due:5, pos:[30,60] },
  { id:'rlegion',domain:'rome', name:'The Roman Legion',       notes:10, progress:48, due:7, pos:[44,57] },
  { id:'rrepub', domain:'rome', name:'Fall of the Republic',   notes:14, progress:55, due:4, pos:[53,66] },
  { id:'radmin', domain:'rome', name:'Governing the Empire',   notes:9,  progress:38, due:6, pos:[47,77] },
  { id:'rsoc',   domain:'rome', name:'Roman Society',          notes:8,  progress:42, due:3, pos:[33,78] },
  { id:'rfall',  domain:'rome', name:'The Fall of Rome',       notes:11, progress:30, due:8, pos:[25,69] },
  // Astronomy — imported deep-dive report (6 dives)
  { id:'aspec',  domain:'astro',name:'Reading Starlight',      notes:9,  progress:58, due:4, pos:[60,28] },
  { id:'astars', domain:'astro',name:'Life & Death of Stars',  notes:12, progress:66, due:5, pos:[73,26] },
  { id:'adist',  domain:'astro',name:'The Distance Ladder',    notes:8,  progress:44, due:6, pos:[81,35] },
  { id:'aexp',   domain:'astro',name:'The Expanding Universe', notes:10, progress:50, due:4, pos:[78,47] },
  { id:'abh',    domain:'astro',name:'Black Holes',            notes:11, progress:35, due:7, pos:[65,49] },
  { id:'adark',  domain:'astro',name:'Dark Matter & Energy',   notes:7,  progress:22, due:5, pos:[57,40] },
];

const MAT_TYPE = {
  summary: { label:'Summary',     icon:'book',     tint:'#1E8FF0', bg:'rgba(30,143,240,.12)' },
  map:     { label:'Concept map', icon:'map',      tint:'#8B53C0', bg:'rgba(212,156,238,.20)' },
  deck:    { label:'Flashcards',  icon:'cards',    tint:'#2E7A3A', bg:'rgba(46,122,58,.12)' },
};

const MATERIALS = [
  { id:'m-cell-deck', type:'deck',    topic:'cell',  title:'Cell Biology — core terms',         cards:8, updated:'2d ago' },
  { id:'m-cell-sum',  type:'summary', topic:'cell',  title:'The eukaryotic cell, summarized',    updated:'2d ago' },
  { id:'m-cell-map',  type:'map',     topic:'cell',  title:'Organelles & their functions',       updated:'5d ago' },
  { id:'m-nn-deck',   type:'deck',    topic:'nn',    title:'Neural network fundamentals',        cards:6, updated:'1d ago' },
  { id:'m-nn-sum',    type:'summary', topic:'nn',    title:'How a network learns',               updated:'4d ago' },
  { id:'m-nn-map',    type:'map',     topic:'nn',    title:'From perceptron to deep net',         updated:'1w ago' },
  { id:'m-verb-deck', type:'deck',    topic:'verb',  title:'Preterite vs. imperfect',            cards:24, updated:'3d ago' },
  { id:'m-vocab-deck',type:'deck',    topic:'vocab', title:'Airport & directions',              cards:40, updated:'1w ago' },
  { id:'m-cold-sum',  type:'summary', topic:'cold',  title:'Cold War — key flashpoints',         updated:'6h ago' },
  { id:'m-cold-map',  type:'map',     topic:'cold',  title:'Alliances & proxy conflicts',        updated:'2w ago' },
  { id:'m-indr-deck', type:'deck',    topic:'indr',  title:'Inventions & inventors',             cards:18, updated:'2w ago' },
  { id:'m-scale-deck',type:'deck',    topic:'scale', title:'Major & minor modes',               cards:12, updated:'3w ago' },
  { id:'m-gen-map',   type:'map',     topic:'gen',   title:'Mendelian inheritance',              updated:'1w ago' },
  { id:'m-sky-sum',    type:'summary', topic:'sky',    title:'Why the sky is blue — and sunsets red', updated:'1h ago' },
  { id:'m-sky-deck',   type:'deck',    topic:'sky',    title:'Rayleigh scattering — quick cards', cards:6, updated:'1h ago' },
  { id:'m-sky-map',    type:'map',     topic:'sky',    title:'Same law, two outcomes', updated:'1d ago' },
  { id:'m-onion-sum',  type:'summary', topic:'onion',  title:'From knife to tears, step by step', updated:'4h ago' },
  { id:'m-onion-deck', type:'deck',    topic:'onion',  title:'Onion chemistry — key terms', cards:6, updated:'4h ago' },
  { id:'m-tardi-sum',  type:'summary', topic:'tardi',  title:'How tardigrades survive drying out', updated:'2d ago' },
  { id:'m-tardi-map',  type:'map',     topic:'tardi',  title:'Cryptobiosis: the protective glass', updated:'3d ago' },
  { id:'m-minor-sum',  type:'summary', topic:'minor',  title:'Major vs. minor: one note, two moods', updated:'2d ago' },
  { id:'m-minor-deck', type:'deck',    topic:'minor',  title:'Minor chords — concepts', cards:6, updated:'2d ago' },
  { id:'m-simpson-sum',type:'summary', topic:'simpson',title:'When a trend flips on merging groups', updated:'1d ago' },
  { id:'m-simpson-map',type:'map',     topic:'simpson',title:'Confounding & aggregation', updated:'2d ago' },
  { id:'m-bees-sum',   type:'summary', topic:'bees',   title:'The waggle dance, decoded', updated:'3d ago' },
  { id:'m-bees-deck',  type:'deck',    topic:'bees',   title:'Waggle dance — key facts', cards:6, updated:'3d ago' },
  { id:'m-minor-map',  type:'map',     topic:'minor',  title:'What makes a chord minor', updated:'2d ago' },
  { id:'m-onion-map',  type:'map',     topic:'onion',  title:'Knife to tears — the chain', updated:'4h ago' },
  { id:'m-bees-map',   type:'map',     topic:'bees',   title:'Anatomy of the waggle dance', updated:'3d ago' },
  { id:'m-indr-map',   type:'map',     topic:'indr',   title:'Drivers of industrialization', updated:'1w ago' },
  { id:'m-scale-map',  type:'map',     topic:'scale',  title:'Modes & the major scale', updated:'2w ago' },
  { id:'m-caf-sum',    type:'summary', topic:'caf',    title:'How caffeine wakes you up', updated:'2h ago' },
  { id:'m-caf-map',    type:'map',     topic:'caf',    title:'Adenosine, blocked', updated:'2h ago' },
  { id:'m-caf-deck',   type:'deck',    topic:'caf',    title:'Caffeine — key terms', cards:5, updated:'2h ago' },
  { id:'m-doms-sum',   type:'summary', topic:'doms',   title:'Why muscles ache two days later', updated:'1d ago' },
  { id:'m-doms-map',   type:'map',     topic:'doms',   title:'DOMS: damage, not lactic acid', updated:'1d ago' },
  { id:'m-hic-sum',    type:'summary', topic:'hic',    title:'The reflex behind a hiccup', updated:'3d ago' },
  { id:'m-hic-map',    type:'map',     topic:'hic',    title:'The hiccup reflex arc', updated:'3d ago' },
  { id:'m-dream-sum',  type:'summary', topic:'dream',  title:'Why we dream — the theories', updated:'5h ago' },
  { id:'m-dream-map',  type:'map',     topic:'dream',  title:'Competing theories of dreaming', updated:'5h ago' },
  { id:'m-blush-sum',  type:'summary', topic:'blush',  title:'The science of blushing', updated:'2d ago' },
  { id:'m-blush-map',  type:'map',     topic:'blush',  title:'Why a blush evolved', updated:'2d ago' },
  { id:'m-eye-sum',    type:'summary', topic:'eye',    title:'Why eyes are different colors', updated:'1d ago' },
  { id:'m-eye-map',    type:'map',     topic:'eye',    title:'Pigment, scattering & genes', updated:'1d ago' },
  { id:'m-micro-sum',  type:'summary', topic:'micro',  title:'How a microwave heats food', updated:'6h ago' },
  { id:'m-micro-map',  type:'map',     topic:'micro',  title:'Inside the microwave oven', updated:'6h ago' },
  { id:'m-micro-deck', type:'deck',    topic:'micro',  title:'Microwave physics — cards', cards:5, updated:'6h ago' },
  { id:'m-gps-sum',    type:'summary', topic:'gps',    title:'How GPS finds you', updated:'1d ago' },
  { id:'m-gps-map',    type:'map',     topic:'gps',    title:'GPS: timing, trilateration, relativity', updated:'1d ago' },
  { id:'m-gps-deck',   type:'deck',    topic:'gps',    title:'GPS & relativity — cards', cards:5, updated:'1d ago' },
  { id:'m-touch-sum',  type:'summary', topic:'touch',  title:'How a touchscreen knows your finger', updated:'3d ago' },
  { id:'m-touch-map',  type:'map',     topic:'touch',  title:'Capacitive sensing', updated:'3d ago' },
  { id:'m-fridge-sum', type:'summary', topic:'fridge', title:'How a fridge pumps heat uphill', updated:'2d ago' },
  { id:'m-fridge-map', type:'map',     topic:'fridge', title:'The refrigeration cycle', updated:'2d ago' },
  { id:'m-mrna-sum',   type:'summary', topic:'mrna',   title:'How an mRNA vaccine works', updated:'4h ago' },
  { id:'m-mrna-map',   type:'map',     topic:'mrna',   title:'mRNA to immunity', updated:'4h ago' },
  { id:'m-mrna-deck',  type:'deck',    topic:'mrna',   title:'mRNA vaccine — key terms', cards:5, updated:'4h ago' },
  { id:'m-libatt-sum', type:'summary', topic:'libatt', title:'How a lithium-ion battery stores power', updated:'2d ago' },
  { id:'m-libatt-map', type:'map',     topic:'libatt', title:'Inside a lithium-ion cell', updated:'2d ago' },
  { id:'m-libatt-deck',type:'deck',    topic:'libatt', title:'Li-ion battery — cards', cards:5, updated:'2d ago' },
  // Backfill — every topic gets a concept map; grad & chord get a full set
  { id:'m-verb-map',  type:'map',     topic:'verb',  title:'Spanish verb forms', updated:'3d ago' },
  { id:'m-vocab-map', type:'map',     topic:'vocab', title:'Travel words by situation', updated:'1w ago' },
  { id:'m-grad-sum',  type:'summary', topic:'grad',  title:'How gradient descent finds a minimum', updated:'1d ago' },
  { id:'m-grad-map',  type:'map',     topic:'grad',  title:'The loss landscape', updated:'1d ago' },
  { id:'m-grad-deck', type:'deck',    topic:'grad',  title:'Gradient descent — key cards', cards:6, updated:'1d ago' },
  { id:'m-chord-sum', type:'summary', topic:'chord', title:'How chord progressions create motion', updated:'2d ago' },
  { id:'m-chord-map', type:'map',     topic:'chord', title:'How chords move', updated:'2d ago' },
  { id:'m-chord-deck',type:'deck',    topic:'chord', title:'Chord progressions — key cards', cards:6, updated:'2d ago' },
  { id:'m-gen-sum',   type:'summary', topic:'gen',   title:'How traits pass to offspring', updated:'1w ago' },
  { id:'m-verb-sum',  type:'summary', topic:'verb',  title:'Preterite vs. imperfect, summarized', updated:'3d ago' },
  { id:'m-vocab-sum', type:'summary', topic:'vocab', title:'Travel vocabulary, by situation', updated:'1w ago' },
  { id:'m-indr-sum',  type:'summary', topic:'indr',  title:'What drove the Industrial Revolution', updated:'2w ago' },
  { id:'m-scale-sum', type:'summary', topic:'scale', title:'Scales & modes, summarized', updated:'3w ago' },
  // Ancient Rome materials
  { id:'m-rkings-sum', type:'summary', topic:'rkings', title:'How Rome got rid of its kings', updated:'just now' },
  { id:'m-rkings-map', type:'map',     topic:'rkings', title:'The Republic’s machinery', updated:'just now' },
  { id:'m-rkings-deck',type:'deck',    topic:'rkings', title:'The early Republic — key cards', cards:6, updated:'just now' },
  { id:'m-rlegion-sum', type:'summary', topic:'rlegion', title:'How the legion conquered the Mediterranean', updated:'just now' },
  { id:'m-rlegion-map', type:'map',     topic:'rlegion', title:'Anatomy of the Roman army', updated:'just now' },
  { id:'m-rlegion-deck',type:'deck',    topic:'rlegion', title:'The Roman legion — key cards', cards:6, updated:'just now' },
  { id:'m-rrepub-sum', type:'summary', topic:'rrepub', title:'How the Republic became one-man rule', updated:'just now' },
  { id:'m-rrepub-map', type:'map',     topic:'rrepub', title:'From Republic to Principate', updated:'just now' },
  { id:'m-rrepub-deck',type:'deck',    topic:'rrepub', title:'Fall of the Republic — key cards', cards:6, updated:'just now' },
  { id:'m-radmin-sum', type:'summary', topic:'radmin', title:'How Rome ran an empire with few officials', updated:'just now' },
  { id:'m-radmin-map', type:'map',     topic:'radmin', title:'How the empire was governed', updated:'just now' },
  { id:'m-radmin-deck',type:'deck',    topic:'radmin', title:'Governing the empire — key cards', cards:6, updated:'just now' },
  { id:'m-rsoc-sum', type:'summary', topic:'rsoc', title:'How Roman society was organized', updated:'just now' },
  { id:'m-rsoc-map', type:'map',     topic:'rsoc', title:'The Roman social hierarchy', updated:'just now' },
  { id:'m-rsoc-deck',type:'deck',    topic:'rsoc', title:'Roman society — key cards', cards:6, updated:'just now' },
  { id:'m-rfall-sum', type:'summary', topic:'rfall', title:'Why the Western Roman Empire fell', updated:'just now' },
  { id:'m-rfall-map', type:'map',     topic:'rfall', title:'Why Rome fell — the debate', updated:'just now' },
  { id:'m-rfall-deck',type:'deck',    topic:'rfall', title:'The fall of Rome — key cards', cards:6, updated:'just now' },
  // Astronomy materials
  { id:'m-aspec-sum', type:'summary', topic:'aspec', title:'How we know what a star is made of', updated:'just now' },
  { id:'m-aspec-map', type:'map',     topic:'aspec', title:'Reading a stellar spectrum', updated:'just now' },
  { id:'m-aspec-deck',type:'deck',    topic:'aspec', title:'Spectroscopy — key cards', cards:6, updated:'just now' },
  { id:'m-astars-sum', type:'summary', topic:'astars', title:'Why stars shine, and how they die', updated:'just now' },
  { id:'m-astars-map', type:'map',     topic:'astars', title:'The life cycle of a star', updated:'just now' },
  { id:'m-astars-deck',type:'deck',    topic:'astars', title:'Stellar life & death — key cards', cards:6, updated:'just now' },
  { id:'m-adist-sum', type:'summary', topic:'adist', title:'How we measure the distance to a star', updated:'just now' },
  { id:'m-adist-map', type:'map',     topic:'adist', title:'The cosmic distance ladder', updated:'just now' },
  { id:'m-adist-deck',type:'deck',    topic:'adist', title:'Distance ladder — key cards', cards:6, updated:'just now' },
  { id:'m-aexp-sum', type:'summary', topic:'aexp', title:'How we know the universe is expanding', updated:'just now' },
  { id:'m-aexp-map', type:'map',     topic:'aexp', title:'Evidence for the Big Bang', updated:'just now' },
  { id:'m-aexp-deck',type:'deck',    topic:'aexp', title:'The expanding universe — key cards', cards:6, updated:'just now' },
  { id:'m-abh-sum', type:'summary', topic:'abh', title:'What a black hole really is', updated:'just now' },
  { id:'m-abh-map', type:'map',     topic:'abh', title:'Anatomy of a black hole', updated:'just now' },
  { id:'m-abh-deck',type:'deck',    topic:'abh', title:'Black holes — key cards', cards:6, updated:'just now' },
  { id:'m-adark-sum', type:'summary', topic:'adark', title:'Why most of the universe is missing', updated:'just now' },
  { id:'m-adark-map', type:'map',     topic:'adark', title:'The dark universe', updated:'just now' },
  { id:'m-adark-deck',type:'deck',    topic:'adark', title:'Dark matter & energy — key cards', cards:6, updated:'just now' },
];

const FLASHCARDS = {
  'm-cell-deck':[
    { q:'What is the primary function of the mitochondria?', a:'To generate ATP through cellular respiration — the cell’s main energy currency.', label:'Organelles' },
    { q:'What distinguishes prokaryotic from eukaryotic cells?', a:'Eukaryotes have a membrane-bound nucleus and organelles; prokaryotes do not.', label:'Cell types' },
    { q:'What is the role of the cell membrane?', a:'A selectively permeable barrier that controls what enters and leaves the cell.', label:'Membranes' },
    { q:'Where in the cell does protein synthesis occur?', a:'On ribosomes — free in the cytoplasm or bound to the rough endoplasmic reticulum.', label:'Synthesis' },
    { q:'What does the Golgi apparatus do?', a:'It modifies, sorts, and packages proteins and lipids for secretion or delivery.', label:'Organelles' },
    { q:'Define osmosis.', a:'The diffusion of water across a semipermeable membrane toward higher solute concentration.', label:'Transport' },
    { q:'What are lysosomes responsible for?', a:'Breaking down waste, debris, and worn-out organelles using digestive enzymes.', label:'Organelles' },
    { q:'What is the cytoskeleton?', a:'A network of protein filaments that gives the cell shape and enables movement.', label:'Structure' },
  ],
  'm-nn-deck':[
    { q:'What is an activation function?', a:'A non-linear function on a neuron’s output that lets networks model complex relationships.', label:'Basics' },
    { q:'What does backpropagation compute?', a:'Gradients of the loss with respect to weights, via the chain rule, propagated backward.', label:'Training' },
    { q:'What is a perceptron?', a:'The simplest neural unit: a weighted sum of inputs passed through a threshold function.', label:'Basics' },
    { q:'Why prefer ReLU over sigmoid?', a:'ReLU avoids vanishing gradients and is cheaper to compute, speeding up training.', label:'Activations' },
    { q:'What is overfitting?', a:'When a model memorizes training data and fails to generalize to unseen examples.', label:'Generalization' },
    { q:'What is dropout?', a:'A regularization method that randomly disables neurons during training to curb overfitting.', label:'Regularization' },
  ],
  'm-sky-deck':[
    { q:'Why is the daytime sky blue?', a:'Air molecules scatter short (blue) wavelengths far more than long ones, so blue light fills the whole sky.', label:'Scattering' },
    { q:'What is Rayleigh scattering?', a:'Scattering of light by particles much smaller than its wavelength, biased strongly toward short (blue) wavelengths.', label:'Scattering' },
    { q:'Why are sunsets red?', a:'Low-angle light travels through much more air; the blue is scattered away, leaving red and orange.', label:'Geometry' },
    { q:'What does the fourth-power rule say?', a:'Scattering is proportional to 1/wavelength⁴ — halve the wavelength and it scatters about 16× more strongly.', label:'Law' },
    { q:'Is the sky blue because it reflects the ocean?', a:'No — the colour comes from scattering of sunlight in the air, not reflection.', label:'Myths' },
    { q:'Why blue rather than violet?', a:'Violet scatters even more, but sunlight contains less violet and our eyes are more sensitive to blue.', label:'Detail' },
  ],
  'm-onion-deck':[
    { q:'Why does the tear gas form only when you cut an onion?', a:'Cutting ruptures cells, letting a stored sulfur compound meet an enzyme that was kept separate from it.', label:'Mechanism' },
    { q:'What is the lachrymatory factor in onions?', a:'syn-Propanethial-S-oxide — a small, volatile gas that irritates the eyes.', label:'Molecule' },
    { q:'What does the gas do at your eye?', a:'It dissolves in the eye’s moisture to form a mild acid; tear glands respond by flushing it out.', label:'Effect' },
    { q:'Why does cutting near a fan help?', a:'The gas is light and volatile; moving air carries it away before it reaches your eyes.', label:'Tips' },
    { q:'Why doesn’t garlic make you cry?', a:'Garlic lacks the specific enzyme-and-compound pair that produces the onion’s lachrymatory factor.', label:'Compare' },
    { q:'What is a defense compound?', a:'A chemical a plant makes to deter being eaten — the onion gas is one.', label:'Concept' },
  ],
  'm-minor-deck':[
    { q:'What single change turns a major chord into a minor one?', a:'Lower the middle note (the third) by one semitone.', label:'Construction' },
    { q:'What is sensory dissonance?', a:'Tension produced when closely spaced frequencies sound together.', label:'Acoustics' },
    { q:'Is “minor = sad” universal?', a:'No — the physical darkness is universal, but the emotional label is partly learned and cultural.', label:'Culture' },
    { q:'What is a semitone?', a:'The smallest interval in Western music — one piano key.', label:'Terms' },
    { q:'Why might a fast, loud minor chord not sound sad?', a:'Tempo and dynamics shape emotion too; it can feel furious instead.', label:'Nuance' },
    { q:'What is the tonic?', a:'The “home” note of a scale.', label:'Terms' },
  ],
  'm-bees-deck':[
    { q:'What does a waggle run pointing straight up mean?', a:'Fly toward the Sun; an angle from vertical maps to that same angle from the Sun outside.', label:'Direction' },
    { q:'How is distance encoded?', a:'By the duration of each waggle run — longer waggles mean farther food.', label:'Distance' },
    { q:'Round dance vs. waggle dance?', a:'Round = food close, no precise direction; waggle = far food, encoding direction and distance.', label:'Types' },
    { q:'What is symbolic communication?', a:'Using an arbitrary signal to convey information about something not present.', label:'Concept' },
    { q:'Who decoded the dance and what did he win?', a:'Karl von Frisch — the 1973 Nobel Prize in Physiology or Medicine.', label:'History' },
    { q:'Is the dance only visual?', a:'No — it is multimodal: movement plus ~280 Hz sound and nectar smell and taste.', label:'Detail' },
  ],
  'm-caf-deck':[
    { q:'What does adenosine do as it builds up during the day?', a:'It binds A1/A2A receptors, slows neural activity, and makes you feel sleepy — a running tally of time awake.', label:'Adenosine' },
    { q:'How can caffeine block adenosine if it is a different molecule?', a:'Its shape is similar enough to slip into the same receptors without activating them — it is an antagonist.', label:'Mechanism' },
    { q:'Why does regular coffee lead to tolerance?', a:'The brain grows more adenosine receptors to compensate, so the same dose has less effect.', label:'Tolerance' },
    { q:'Why does quitting suddenly cause headaches?', a:'All the extra receptors sit unopposed, so backed-up adenosine floods in — fatigue and headache.', label:'Withdrawal' },
    { q:'Does caffeine give you energy?', a:'No — it only blocks the “you are tired” signal; the crash comes when it wears off.', label:'Myths' },
  ],
  'm-micro-deck':[
    { q:'What device produces the waves, and at what frequency?', a:'A magnetron, at about 2.45 GHz.', label:'Hardware' },
    { q:'Why does water heat while a dry plate stays cool?', a:'Water is a polar dipole that rotates in the alternating field (dielectric heating); dry ceramic has little to grab it.', label:'Heating' },
    { q:'What is wrong with “tuned to water’s resonant frequency”?', a:'The waves are broadband dielectric heating, not resonance — many molecules absorb them too.', label:'Myths' },
    { q:'Why is soup often hot at the edges, cold in the middle?', a:'Energy deposits wherever there is water; thick food still relies on slow conduction to finish the centre.', label:'Detail' },
    { q:'Why should you never run an empty microwave?', a:'With nothing to absorb the energy, the oven can reflect it back and damage itself.', label:'Safety' },
  ],
  'm-gps-deck':[
    { q:'How does a satellite time delay become a distance?', a:'The signal travels at the speed of light, so delay × c gives distance — placing you on a sphere around the satellite.', label:'Timing' },
    { q:'Why do you need four satellites, not three?', a:'Three locate you; the fourth solves for your receiver’s own cheap clock error.', label:'Trilateration' },
    { q:'Which way does each relativistic effect push the clocks?', a:'Special relativity (motion) slows them ~7 µs/day; general relativity (weaker gravity) speeds them ~45 µs/day.', label:'Relativity' },
    { q:'What happens if the relativity correction is off?', a:'Clocks drift ~38 µs/day fast → about 10 km of position error per day.', label:'Relativity' },
    { q:'Do satellites track your phone?', a:'No — your phone is a passive listener and computes its own position from one-way broadcasts.', label:'Myths' },
  ],
  'm-mrna-deck':[
    { q:'What does the vaccine’s mRNA instruct cells to make?', a:'A harmless piece of the virus — for SARS-CoV-2, the spike protein.', label:'Mechanism' },
    { q:'Why can’t the vaccine change your DNA?', a:'mRNA never enters the nucleus where DNA lives, and it is degraded within days.', label:'Myths' },
    { q:'What is the role of the lipid nanoparticle?', a:'A fatty bubble that protects the fragile mRNA and delivers it into cells.', label:'Delivery' },
    { q:'How does displaying the spike piece create protection?', a:'The immune system sees the foreign shape and builds antibodies and memory cells.', label:'Immunity' },
    { q:'Define antigen.', a:'Any molecule the immune system learns to recognize.', label:'Terms' },
  ],
  'm-libatt-deck':[
    { q:'Name the four key parts of a lithium-ion cell.', a:'Graphite anode, metal-oxide cathode, liquid electrolyte, and a porous separator.', label:'Parts' },
    { q:'What moves during discharge?', a:'Lithium ions drift anode→cathode through the electrolyte; electrons go through the external circuit (the current).', label:'Discharge' },
    { q:'What does the separator do?', a:'Lets ions pass but blocks electrons, forcing them to do useful work instead of short-circuiting.', label:'Separator' },
    { q:'What is intercalation?', a:'Lithium ions tucking into and out of the electrode structures — the “rocking-chair” shuttle.', label:'Chemistry' },
    { q:'Why lithium?', a:'It is very light and gives up its electron readily, packing high energy into little mass.', label:'Why Li' },
  ],
  // ===== Ancient Rome =====
  'm-rkings-deck':[
    { q:'What replaced the king, and what stopped any one official from dominating?', a:'Two consuls who shared power, served only a one-year term, and could each veto the other.', label:'Government' },
    { q:'What was the Senate in the early Republic?', a:'An unelected council of around 300 elite men that controlled finances and foreign policy.', label:'Institutions' },
    { q:'Who were the patricians and plebeians?', a:'The hereditary aristocracy versus the common citizen majority.', label:'Classes' },
    { q:'What was the \u201cstruggle of the orders\u201d?', a:'The plebeians\u2019 two-century fight for political rights, winning gains like the Twelve Tables, Rome\u2019s first written law code.', label:'Classes' },
    { q:'What is the cursus honorum?', a:'The fixed ladder of public offices ambitious Romans climbed.', label:'Terms' },
    { q:'Why do historians treat the founding story with caution?', a:'It was written down centuries later; the monarchy more likely ended through military defeat and foreign intervention, not a heroic uprising.', label:'Evidence' },
  ],
  'm-rlegion-deck':[
    { q:'What was the manipular system?', a:'Three rotating lines of small, flexible units (hastati, principes, triarii) that replaced the rigid phalanx.', label:'Tactics' },
    { q:'Why was a maniple more flexible than a phalanx?', a:'Small, independently manoeuvrable \u201chandfuls\u201d of men could rotate fresh troops to the front \u2014 \u201cthe phalanx had been given joints.\u201d', label:'Tactics' },
    { q:'How could Rome survive disasters like Cannae and still win?', a:'A huge pool of citizens and allies let it raise new legions, and its culture treated defeat as temporary so long as the war was won.', label:'Strategy' },
    { q:'What did the Marian reforms change?', a:'From 107 BCE they dropped the property requirement, opening the legions to poor, landless citizens and creating a professional standing army.', label:'Reform' },
    { q:'Why did a professional army threaten the Republic?', a:'Soldiers now looked to their general \u2014 not the state \u2014 for land and pay, creating private armies loyal to ambitious men.', label:'Politics' },
    { q:'What were auxiliaries?', a:'Non-citizen troops who could earn Roman citizenship through long service.', label:'Terms' },
  ],
  'm-rrepub-deck':[
    { q:'Name several structural causes of the Republic\u2019s decline.', a:'Widening inequality from conquest, political violence, broken norms, and armies loyal to generals rather than the state.', label:'Causes' },
    { q:'What was the significance of Caesar crossing the Rubicon?', a:'His 49 BCE march into Italy with his army turned a political standoff into the civil war that effectively ended the Republic.', label:'Turning point' },
    { q:'How did Caesar\u2019s assassination backfire on its plotters?', a:'Instead of restoring the Republic it triggered more civil war, ending with his heir Octavian as sole ruler.', label:'Irony' },
    { q:'How did Augustus disguise monarchy as a restored Republic?', a:'He kept the Senate and old offices as a respectable shell, claimed to have \u201crestored the Republic,\u201d and took the modest title princeps, \u201cfirst citizen.\u201d', label:'Principate' },
    { q:'What was the First Triumvirate?', a:'The informal power-sharing alliance between Caesar, Pompey, and Crassus.', label:'Terms' },
    { q:'What was the Pax Romana?', a:'The long peace of the early empire that helped make Augustus\u2019s disguised monarchy acceptable.', label:'Terms' },
  ],
  'm-radmin-deck':[
    { q:'How could Rome govern tens of millions with so few central officials?', a:'It delegated most day-to-day administration to self-governing cities and local elites rather than occupying every town.', label:'Administration' },
    { q:'What was Romanization, and why did it help hold the empire together?', a:'Conquered peoples \u2014 especially their elites \u2014 adopted Roman culture and won posts and citizenship, so assimilation rather than force kept the empire together.', label:'Culture' },
    { q:'What did Caracalla do in 212 CE?', a:'He extended citizenship to virtually all free inhabitants of the empire, partly to widen the tax base.', label:'Citizenship' },
    { q:'Name two lasting legacies of Roman law.', a:'Legal precedent, and the principle that the spirit of a law can matter more than its letter.', label:'Law' },
    { q:'What was a province?', a:'The basic administrative unit of conquered territory, run by a governor (proconsul or imperial legate).', label:'Terms' },
    { q:'How could non-citizens earn citizenship?', a:'Through military service \u2014 auxiliaries could win it after about 25 years and pass it to their children.', label:'Citizenship' },
  ],
  'm-rsoc-deck':[
    { q:'Name the main tiers of Roman society from top to bottom.', a:'Elite orders (patricians, then senators and equestrians), plebeian citizens, freedmen, and slaves.', label:'Hierarchy' },
    { q:'How did Roman slavery differ from later race-based slavery?', a:'It was not based on skin colour, and manumission was common \u2014 freed slaves\u2019 children could become full citizens.', label:'Slavery' },
    { q:'What was the patron-client system?', a:'A web of mutual obligation: lower-status clients sought favours from higher-status patrons, repaying them with services and loyalty.', label:'Society' },
    { q:'What did \u201cbread and circuses\u201d accomplish for the elite?', a:'Free grain and public games kept the urban masses fed, entertained, and orderly \u2014 a deliberate instrument of social control.', label:'Control' },
    { q:'What were freedmen?', a:'Former slaves \u2014 free, but carrying lasting social marks of their origin.', label:'Terms' },
    { q:'What was manumission?', a:'The freeing of slaves, a regular and even routine Roman practice.', label:'Terms' },
  ],
  'm-rfall-deck':[
    { q:'Why is 476 CE only a convenient marker rather than a precise end?', a:'The western empire\u2019s decline was long and gradual, and Roman institutions and culture persisted well beyond that single date.', label:'Dating' },
    { q:'What major clusters of causes do historians propose?', a:'External invasion, military change (reliance on hired \u201cbarbarian\u201d troops), economic strain, and political instability.', label:'Causes' },
    { q:'Why does the survival of the eastern empire complicate the story?', a:'Only the west \u201cfell\u201d \u2014 the eastern, Byzantine empire continued for nearly another thousand years.', label:'Nuance' },
    { q:'Why do some historians prefer \u201ctransformation\u201d to \u201cdecline and fall\u201d?', a:'The Roman and Germanic worlds merged into medieval Europe rather than the civilization simply collapsing.', label:'Debate' },
    { q:'What was Gibbon\u2019s thesis, and how is it viewed now?', a:'He blamed internal decay and the rise of Christianity; most modern scholars reject that, stressing military and economic factors.', label:'Historiography' },
    { q:'Who was Romulus Augustulus?', a:'The last western emperor \u2014 a teenager deposed by the Germanic leader Odoacer in 476 CE.', label:'Terms' },
  ],
  // ===== Astronomy =====
  'm-aspec-deck':[
    { q:'Why does each element produce its own unique pattern of spectral lines?', a:'Its electrons can jump only between certain fixed energy levels, so it absorbs and emits at a fixed set of wavelengths \u2014 a fingerprint.', label:'Atoms' },
    { q:'What causes the dark absorption lines in a star\u2019s spectrum?', a:'Elements in the star\u2019s cooler outer atmosphere absorb their signature wavelengths from the light passing through.', label:'Mechanism' },
    { q:'How do astronomers turn those lines into a list of elements?', a:'By matching the star\u2019s lines to the known fingerprints of elements measured in laboratories on Earth.', label:'Method' },
    { q:'What surprising fact did spectroscopy reveal about stars?', a:'They are overwhelmingly hydrogen and helium \u2014 Earth\u2019s rock and metal is the oddity, not the rule.', label:'Discovery' },
    { q:'What is the difference between absorption and emission lines?', a:'Absorption is a dark gap where an element removes specific wavelengths; emission is a bright line where it gives them off.', label:'Terms' },
    { q:'Does a star\u2019s colour tell you its composition?', a:'No \u2014 colour gives temperature; only the spectral lines reveal which elements are present.', label:'Myths' },
  ],
  'm-astars-deck':[
    { q:'What two forces are in balance during a star\u2019s main-sequence life?', a:'The outward push of fusion and the inward pull of gravity \u2014 hydrostatic balance.', label:'Balance' },
    { q:'Why does a star\u2019s mass determine how it will die?', a:'Low-mass stars swell to red giants and leave white dwarfs; massive stars fuse up to iron and collapse into a supernova.', label:'Mass' },
    { q:'Why can\u2019t a star release energy by fusing iron?', a:'Fusing iron absorbs energy rather than releasing it, so the core can no longer hold itself up and collapses in under a second.', label:'Iron wall' },
    { q:'Where did the heavy elements in your body originally form?', a:'Inside stars \u2014 forged by fusion and scattered into space by supernova explosions.', label:'Origins' },
    { q:'What ignites fusion in a newborn star?', a:'Gravity squeezing the core until it reaches about 15 million degrees.', label:'Birth' },
    { q:'What does a Sun-like star leave behind?', a:'A red-giant phase, then a slowly cooling ember called a white dwarf.', label:'Remnants' },
  ],
  'm-adist-deck':[
    { q:'How does parallax use Earth\u2019s orbit to measure a star\u2019s distance?', a:'As Earth orbits the Sun, a nearby star appears to shift against the background; the size of that shift gives its distance by geometry.', label:'Parallax' },
    { q:'What makes an object a usable \u201cstandard candle\u201d?', a:'We know its true brightness, so comparing true to apparent brightness gives distance via the inverse-square law.', label:'Candles' },
    { q:'Why are Cepheids and Type Ia supernovae useful at different ranges?', a:'Cepheids reach nearby galaxies; far brighter Type Ia supernovae can be seen across billions of light-years.', label:'Ranges' },
    { q:'Why must each rung of the ladder be calibrated against the one below?', a:'Each method has a limited range \u2014 parallax calibrates Cepheids, which calibrate supernovae \u2014 with overlaps as deliberate cross-checks.', label:'Calibration' },
    { q:'What did Henrietta Swan Leavitt discover?', a:'That a Cepheid\u2019s pulsation period reveals its true luminosity \u2014 turning pulsing stars into cosmic measuring sticks.', label:'History' },
    { q:'Is a light-year a time or a distance?', a:'A distance \u2014 how far light travels in one year.', label:'Myths' },
  ],
  'm-aexp-deck':[
    { q:'What does the redshift of distant galaxies tell us?', a:'That they are receding \u2014 the universe is expanding, stretching their light toward longer, redder wavelengths.', label:'Redshift' },
    { q:'State Hubble\u2019s Law in your own words.', a:'The farther away a galaxy is, the faster it recedes, in proportion to its distance.', label:'Hubble' },
    { q:'Why is it more accurate to say space is expanding than that galaxies fly through space?', a:'Space itself stretches everywhere at once, carrying galaxies apart and stretching the light traveling through it \u2014 there is no center.', label:'Expansion' },
    { q:'Name two pieces of evidence beyond redshift for the Big Bang.', a:'The cosmic microwave background (a ~2.7 K afterglow) and the cosmic abundance of hydrogen and helium matching predictions.', label:'Evidence' },
    { q:'What is the cosmic microwave background?', a:'Light set free about 380,000 years after the Big Bang when atoms first formed, now stretched to microwaves.', label:'CMB' },
    { q:'How old is the universe?', a:'About 13.8 billion years.', label:'Terms' },
  ],
  'm-abh-deck':[
    { q:'What defines the event horizon of a black hole?', a:'The boundary, or point of no return, where the escape velocity would have to exceed the speed of light.', label:'Horizon' },
    { q:'How does a stellar-mass black hole form?', a:'When a very massive star dies and its core collapses with nothing left to hold it up.', label:'Formation' },
    { q:'If black holes emit no light, how do astronomers detect them?', a:'By X-rays from gas heated as it spirals in, the motion of stars orbiting an unseen mass, and gravitational waves from collisions.', label:'Detection' },
    { q:'Why can\u2019t current physics describe what happens at the singularity?', a:'Near it quantum effects should matter, but we have no working theory of quantum gravity.', label:'Limits' },
    { q:'What did the 2019 Event Horizon Telescope image show?', a:'The shadow and the glowing matter just outside the horizon of the black hole in galaxy M87 \u2014 not the inside.', label:'Discovery' },
    { q:'Is a black hole a cosmic vacuum cleaner?', a:'No \u2014 from a safe distance its gravity behaves like any other mass; you orbit it rather than being inevitably pulled in.', label:'Myths' },
  ],
  'm-adark-deck':[
    { q:'What observation about galaxies first pointed to dark matter?', a:'They spin too fast for the gravity of their visible matter to hold them together \u2014 so some unseen mass must be present.', label:'Evidence' },
    { q:'What discovery about cosmic expansion revealed dark energy?', a:'In 1998 two teams measuring distant Type Ia supernovae found the expansion is speeding up, not slowing down.', label:'Discovery' },
    { q:'Roughly what fractions are ordinary matter, dark matter, and dark energy?', a:'About 5% ordinary matter, 27% dark matter, and 68% dark energy.', label:'Composition' },
    { q:'Why are \u201cdark matter\u201d and \u201cdark energy\u201d labels, not explanations?', a:'They name effects we have measured but cannot yet explain \u2014 we do not know what either actually is.', label:'Limits' },
    { q:'How is dark matter detected if it gives off no light?', a:'Only through its gravity \u2014 for example by galaxy rotation curves and by gravitational lensing.', label:'Detection' },
    { q:'Are dark matter and dark energy the same thing?', a:'No \u2014 one is unseen mass pulling galaxies together; the other is an influence pushing the universe apart faster.', label:'Myths' },
  ],
  'm-grad-deck':[
    { q:'What does a gradient tell you?', a:'The direction of steepest increase of the loss — so you step the opposite way to reduce it.', label:'Gradient' },
    { q:'What does the learning rate control?', a:'The size of each downhill step; too large overshoots, too small crawls.', label:'Learning rate' },
    { q:'What is a local minimum?', a:'A valley in the loss landscape that is low nearby but may not be the lowest overall.', label:'Landscape' },
    { q:'Batch vs stochastic gradient descent?', a:'Batch uses all the data per step; stochastic uses one example at a time (mini-batch is in between).', label:'Variants' },
    { q:'What does convergence mean?', a:'The loss stops meaningfully improving — the steps settle near a minimum.', label:'Terms' },
    { q:'Why does feature scaling help?', a:'Without it the landscape is stretched, so steps zig-zag inefficiently toward the minimum.', label:'Practice' },
  ],
  'm-chord-deck':[
    { q:'What is the tonic chord?', a:'The “home” chord (I) — the point of rest a progression returns to.', label:'Function' },
    { q:'Why does the dominant (V) feel unstable?', a:'It carries tension that pulls strongly back toward the tonic.', label:'Function' },
    { q:'What is a cadence?', a:'A chord pair that ends a phrase, like V–I, creating a sense of arrival.', label:'Cadence' },
    { q:'What is the I–V–vi–IV progression?', a:'A hugely common pop loop that cycles tension and rest.', label:'Examples' },
    { q:'What does the subdominant (IV) do?', a:'It moves away from home, setting up a return to the tonic.', label:'Function' },
    { q:'What is resolution?', a:'Tension releasing, usually to the tonic — the satisfying “landing.”', label:'Terms' },
  ],
};
const FALLBACK_DECK = FLASHCARDS['m-cell-deck'];

// Preset summary content (sourced from the curiosity deep-dives report)
const SUMMARIES = {
  'm-sky-sum':{
    head:'Why the sky is blue — and sunsets red',
    intro:'Sunlight is white — a blend of every visible colour. One physical effect, Rayleigh scattering, explains both the blue daytime sky and the red of a sunset.',
    secs:[
      { h:'Core idea', b:'Entering the atmosphere, sunlight hits tiny gas molecules that scatter short (blue) wavelengths far more than long (red) ones. Blue scatters across the whole sky, so the sky glows blue. At sunset the light travels through much more air, so the blue is scattered out of the path, leaving red and orange. Same mechanism, opposite outcomes.' },
      { h:'Why it matters', b:'It is a clean way into the idea that light is a wave with a wavelength, and that colours interact with matter differently because their wavelengths differ — an idea that reappears across physics, chemistry, and astronomy. The fourth-power rule (scattering ∝ 1/λ⁴) explains why the effect is so dramatic: halve the wavelength and it scatters about sixteen times more.' },
      { h:'Common pitfalls', b:'The sky is not blue because it reflects the ocean — the colour comes from scattering in the air. Sunsets are not red because of pollution; pollution can intensify them, but the basic effect happens in clean air. Violet scatters even more than blue, but sunlight has less violet and our eyes are more sensitive to blue.' },
    ],
    links:[
      { label:'Why Is the Sky Blue? — NASA Space Place', url:'https://spaceplace.nasa.gov/blue-sky/en/' },
      { label:'Why is The Sky Blue? — Space.com', url:'https://www.space.com/why-is-the-sky-blue' },
      { label:'Blue Sky and Rayleigh Scattering — HyperPhysics', url:'http://hyperphysics.phy-astr.gsu.edu/hbase/atmos/blusky.html' },
    ],
  },
  'm-onion-sum':{
    head:'From knife to tears, step by step',
    intro:'Cutting an onion triggers a fast chemical chain that ends in a gas which irritates your eyes — a near-perfect example of specific molecules producing a specific effect.',
    secs:[
      { h:'Core idea', b:'Onions store sulfur compounds separately from an enzyme that reacts with them. While cells are intact the two stay apart. Cutting ruptures cells and brings them together; the enzyme turns the sulfur compound into an unstable acid that rearranges into a small, volatile gas — syn-propanethial-S-oxide. The gas drifts up, reaches the moisture on your eyes, forms a mild acid, and your tear glands flush it out.' },
      { h:'Why it matters', b:'It shows that “chemistry” is about named molecules producing traceable effects. The gas is the onion defending itself against being eaten — a defense compound, like capsaicin in chillies or allicin in garlic.' },
      { h:'Common pitfalls', b:'It is not the smell that makes you cry — the trigger is a specific volatile compound formed only on cutting. Rinsing helps only a little, because the main reaction happens the moment you cut intact cells. Cutting near a fan helps because the light gas is carried away before reaching your eyes; garlic does not produce the same factor.' },
    ],
    links:[
      { label:'Why Do Onions Make You Cry? — Britannica', url:'https://www.britannica.com/story/why-do-onions-make-you-cry' },
      { label:'Why Do Onions Make Us Cry? — NPR, The Salt', url:'https://www.npr.org/sections/thesalt/2016/06/22/482032913/the-science-of-why-onions-make-us-cry' },
      { label:'Molecule of the Week: syn-Propanethial S-oxide — ACS', url:'https://www.acs.org/molecule-of-the-week/archive/p/syn-propanethial-s-oxide.html' },
    ],
  },
  'm-tardi-sum':{
    head:'How tardigrades survive being dried out',
    intro:'Most living things die without water within hours. Tardigrades can be dried out almost entirely, sit for years, and revive with a single drop.',
    secs:[
      { h:'Core idea', b:'When the environment dries out, a tardigrade enters a paused state called cryptobiosis and its metabolism drops to near zero. CAHS proteins (found in no other known animal) condense into a gel that hardens into a glass-like solid as water leaves; a sugar called trehalose helps. The cell’s machinery is locked in a non-crystalline shell so nothing can break. When water returns, the glass dissolves and the cell resumes.' },
      { h:'Why it matters', b:'If we could borrow the trick, we might store medicines, vaccines, and even tissues without refrigeration. The protection is structural — the cell’s insides set like hard candy.' },
      { h:'Common pitfalls', b:'Dried tardigrades are not “dead” then “revived”; their metabolism is just too low to measure. They are not indestructible either — survival depends on slow “preconditioning”, and fast drying kills nearly all of them.' },
    ],
    links:[
      { label:'Tardigrades survive drying out — Live Science', url:'https://www.livescience.com/tardigrades-survive-drying-out-proteins' },
      { label:'Cryptobiosis Protects From Extremes — AskNature', url:'https://asknature.org/strategy/cryptobiosis-protects-from-extremes/' },
      { label:'Trehalose & CAHS proteins work synergistically — Nature', url:'https://www.nature.com/articles/s42003-022-04015-2' },
    ],
  },
  'm-minor-sum':{
    head:'Major vs. minor: one note, two moods',
    intro:'Changing a single note by a semitone can flip the emotional feel of a whole piece. But how much of “sadness” is physics and how much is culture?',
    secs:[
      { h:'Core idea', b:'A major chord uses the first, third, and fifth notes of a scale. A minor chord is the same chord with the middle note (the third) lowered by one semitone. That tiny change crowds the frequencies slightly closer, creating more sensory dissonance — a low-grade tension that Western listeners reliably label “sad”.' },
      { h:'Why it matters', b:'It is a case study in telling apart what is hardwired from what is learned. The physical difference is universal; the emotional label is at least partly cultural — some traditions hear minor scales as cheerful.' },
      { h:'Common pitfalls', b:'Minor chords are not universally sad — labelling is partly cultural. And “major = happy, minor = sad” is not absolute: a fast, loud minor chord can feel furious, while a slow, soft major chord can feel solemn. Tempo and dynamics matter too.' },
    ],
    links:[
      { label:'Why are minor chords sad and major chords happy? — BBC Science Focus', url:'https://www.sciencefocus.com/science/why-are-minor-chords-sad-and-major-chords-happy' },
      { label:'Why Do Songs In A Minor Key Sound Sad? — NME', url:'https://www.nme.com/blogs/nme-blogs/the-science-of-music-why-do-songs-in-a-minor-key-sound-sad-760215' },
      { label:'Why Do Minor Keys Sound Sad to Me? — Success Music Studio', url:'https://successmusicstudio.com/why-do-minor-keys-sound-sad-to-me/' },
    ],
  },
  'm-simpson-sum':{
    head:'When a trend flips on merging groups',
    intro:'A treatment can look better in every subgroup yet worse once you combine the data. The reversal is real, has a name — Simpson’s paradox — and changes how you read any combined statistic.',
    secs:[
      { h:'Core idea', b:'Simpson’s paradox happens when a pattern that holds in each subgroup reverses when the subgroups are combined. The mechanism: the groups have very different sizes and a hidden confounding variable is unevenly spread across them, so combining lets that imbalance dominate and flip the trend.' },
      { h:'Why it matters', b:'It shows up in medical trials, court cases, university admissions, and A/B tests. In the 1986 kidney-stone study, Treatment A was better for small and large stones separately, but B looked better combined — because stone size (severity) was a lurking variable. An overall statistic is not always the truest one.' },
      { h:'Common pitfalls', b:'Do not assume the totals must be the truth — sometimes totals are the most misleading view. And do not assume subgroups and totals must agree; Simpson’s paradox is exactly when they don’t. Always ask what hidden variable might differ across the groups.' },
    ],
    links:[
      { label:'Simpson’s paradox — Wikipedia', url:'https://en.wikipedia.org/wiki/Simpson%27s_paradox' },
      { label:'What Is Simpson’s Paradox and Why Does It Matter? — Science Insights', url:'https://scienceinsights.org/what-is-simpsons-paradox-and-why-does-it-matter/' },
      { label:'Simpson’s Paradox — The Engines of Our Ingenuity (UH)', url:'https://www.uh.edu/engines/epi3016.htm' },
    ],
  },
  'm-bees-sum':{
    head:'The waggle dance, decoded',
    intro:'A single bee returning from a flower patch can tell the hive both the distance and the direction of food — using a figure-eight dance. Karl von Frisch decoded it and won the 1973 Nobel Prize.',
    secs:[
      { h:'Core idea', b:'A bee that found good food performs a figure-eight dance on the comb. The straight middle “waggle run” encodes two things. Direction: its angle relative to straight up maps onto the angle to fly relative to the Sun outside. Distance: the duration of each run — longer waggles mean farther flights. The dance is a tiny symbolic map.' },
      { h:'Why it matters', b:'Symbolic communication — using an arbitrary signal to convey precise information about something not present — was once thought unique to humans. The dance moved that boundary, and is the cleanest single example of a genuinely symbolic animal communication system.' },
      { h:'Common pitfalls', b:'Bees do not lead each other to the food — foragers convey information and recruits fly out alone. And the dance is not only about direction: it encodes direction, distance, and food quality, and is multimodal (movement plus ~280 Hz sound and nectar scent).' },
    ],
    links:[
      { label:'The Waggle Dance — PlanetBee', url:'https://www.planetbee.org/post/the-waggle-dance-bees-high-tech-navigation-system' },
      { label:'Frisch Discovers Bees Communicate Through Body Movements — EBSCO', url:'https://www.ebsco.com/research-starters/history/frisch-discovers-bees-communicate-through-body-movements' },
      { label:'Waggle dance — Wikipedia', url:'https://en.wikipedia.org/wiki/Waggle_dance' },
    ],
  },
  'm-caf-sum':{
    head:'How caffeine wakes you up',
    intro:'Caffeine is the most widely used psychoactive substance on Earth, yet most people have no idea how it works. The answer is a neat piece of molecular mimicry.',
    secs:[
      { h:'Core idea', b:'While you are awake, adenosine accumulates and binds its receptors (A1, A2A), slowing neural activity and making you sleepy. Caffeine is shaped similarly enough to slip into those receptors without activating them, blocking the sleepy signal — with knock-on boosts to transmitters like dopamine.' },
      { h:'Why it matters', b:'It is a clean introduction to how neurotransmitters and receptors govern alertness, and it explains tolerance (the brain grows more receptors), the afternoon crash, and the withdrawal headache.' },
      { h:'Common pitfalls', b:'Caffeine does not add energy — it blocks the “you are tired” signal, so the crash arrives when it wears off and backed-up adenosine floods in. And there is no single clean mechanism; several brain systems are involved.' },
    ],
    links:[
      { label:'How Caffeine Works — HowStuffWorks', url:'https://science.howstuffworks.com/caffeine4.htm' },
      { label:'Caffeine and adenosine — Ultrahuman', url:'https://blog.ultrahuman.com/blog/caffeine-and-adenosine/' },
      { label:'Arousal Effect of Caffeine — Journal of Neuroscience', url:'https://www.jneurosci.org/content/31/27/10067' },
    ],
  },
  'm-doms-sum':{
    head:'Why muscles ache two days later',
    intro:'The soreness that peaks a day or two after a hard workout is something nearly everyone has felt — and nearly everyone explains wrongly.',
    secs:[
      { h:'Core idea', b:'It is called delayed onset muscle soreness (DOMS), caused by microscopic damage to muscle fibres and connective tissue — especially after eccentric exercise (lowering a weight, running downhill). That microdamage triggers an inflammatory repair response over 24–72 hours, and the swelling stimulates pain nerve endings.' },
      { h:'Why it matters', b:'It is a great lesson in muscle physiology and in how a tidy, century-old explanation can be completely wrong yet still get repeated everywhere.' },
      { h:'Common pitfalls', b:'Lactic acid does not cause next-day soreness — lactate is cleared within about an hour and recycled as fuel. Soreness is also not required for a workout to “count.” The exact mechanism is still genuinely debated.' },
    ],
    links:[
      { label:'It’s nothing to do with lactic acid — The Conversation', url:'https://theconversation.com/why-are-my-muscles-sore-after-exercise-hint-its-nothing-to-do-with-lactic-acid-214638' },
      { label:'Lactic Acid Is Not What Causes Sore Muscles — Discovery', url:'https://www.discovery.com/science/lactic-acid-is-not-what-causes-sore-muscles' },
      { label:'Delayed onset muscle soreness — Wikipedia', url:'https://en.wikipedia.org/wiki/Delayed_onset_muscle_soreness' },
    ],
  },
  'm-hic-sum':{
    head:'The reflex behind a hiccup',
    intro:'A hiccup is a tiny involuntary event almost everyone experiences and no one can fully explain — a neat way into reflex arcs and the nerves controlling breathing.',
    secs:[
      { h:'Core idea', b:'A hiccup is a sudden spasm of the diaphragm that pulls air in sharply; a fraction of a second later the glottis snaps shut, making the “hic.” The reflex loops through the phrenic nerve (diaphragm) and the vagus nerve (organs to brainstem); irritation of either can trigger it.' },
      { h:'Why it matters', b:'It is a humbling reminder that some very ordinary bodily events still have no agreed-upon purpose — one leading idea is an evolutionary leftover.' },
      { h:'Common pitfalls', b:'Hiccups are a neuromuscular reflex, not a stomach problem as such. Folk cures are unproven; the ones that help mostly raise carbon dioxide or stimulate the vagus nerve. Hiccups lasting days can signal a real medical issue.' },
    ],
    links:[
      { label:'Hiccups — Cleveland Clinic', url:'https://my.clevelandclinic.org/health/diseases/17672-hiccups' },
      { label:'Why Do I Hiccup? — WebMD', url:'https://www.webmd.com/digestive-disorders/why-do-i-hiccup' },
      { label:'Causes and cures remain elusive — Penn State Health', url:'https://pennstatehealthnews.org/2019/01/the-medical-minute-causes-and-cures-of-hiccups-remain-elusive/' },
    ],
  },
  'm-dream-sum':{
    head:'Why we dream — the theories',
    intro:'You spend years of your life dreaming, and science still cannot say for sure why — a perfect case study in reasoning about a hard question with competing theories.',
    secs:[
      { h:'Core idea', b:'Most vivid dreaming happens in REM sleep, when the brain is highly active but the body is largely paralysed. Leading theories: memory consolidation (filing the day’s experiences), emotional processing (a safe space to work through feelings), threat-simulation (rehearsing dangers), and activation-synthesis (a story built from random brainstem signals).' },
      { h:'Why it matters', b:'It introduces sleep stages, memory, and emotion in the brain — and shows how science holds several plausible, overlapping theories at once.' },
      { h:'Common pitfalls', b:'Dreaming is not REM-only — it happens in other stages, less vividly. No single theory is proven, and “dream dictionaries” that assign fixed symbol meanings have no scientific support.' },
    ],
    links:[
      { label:'Dreams and Dreaming — Lumen/OpenStax', url:'https://courses.lumenlearning.com/suny-hvcc-psychology-1/chapter/reading-dreams/' },
      { label:'The Neuroscience of Dreams — ScienceInsights', url:'https://scienceinsights.org/the-neuroscience-of-dreams-how-and-why-we-dream/' },
      { label:'Dreaming in Emotional Processes — Frontiers in Psychology', url:'https://www.frontiersin.org/journals/psychology/articles/10.3389/fpsyg.2019.00459/full' },
    ],
  },
  'm-blush-sum':{
    head:'The science of blushing',
    intro:'Blushing is, in Darwin’s words, “the most peculiar and most human of all expressions” — involuntary, impossible to fake, and it broadcasts the emotion you most want to hide.',
    secs:[
      { h:'Core idea', b:'A blush is reddening of the face caused by small blood vessels widening (vasodilation) and filling with blood, driven by the sympathetic (fight-or-flight) nervous system — but triggered by social emotions like embarrassment rather than physical danger. Facial skin is rich in wide, near-surface vessels, making it an effective “billboard.”' },
      { h:'Why it matters', b:'It joins the body’s stress response to a deep puzzle: why advertise embarrassment? The leading answer is that an honest, uncontrollable signal serves an appeasement function — it shows you recognize a misstep, helping others trust and forgive you.' },
      { h:'Common pitfalls', b:'Blushing is not under your control, and trying to suppress it usually makes it worse. It is not simply a flaw — the leading account treats it as a useful honest signal — and humans may not be the only blushers.' },
    ],
    links:[
      { label:'Why Do We Blush? — Reader’s Digest', url:'https://www.rd.com/article/why-do-people-blush/' },
      { label:'The Puzzle of Blushing — British Psychological Society', url:'https://www.bps.org.uk/psychologist/puzzle-blushing' },
      { label:'Expression of the Emotions, Ch. 13 — Darwin (1872)', url:'https://brocku.ca/MeadProject/Darwin/Darwin_1872_13.html' },
    ],
  },
  'm-eye-sum':{
    head:'Why eyes are different colors',
    intro:'Eye color seems like the simplest genetics lesson — and it is a perfect example of how that tidy “brown beats blue” story is wrong.',
    secs:[
      { h:'Core idea', b:'Eye color comes almost entirely from melanin in the front of the iris — the same brown-black pigment in skin and hair. Brown eyes have a lot; blue eyes have very little, and the blue is a structural color from light scattering (the same Rayleigh/Tyndall scattering that makes the sky blue). Green and hazel mix a little melanin with that scattering.' },
      { h:'Why it matters', b:'It shows that real inheritance is polygenic — many genes contribute (OCA2 and HERC2 especially) — which is why two brown-eyed parents can have a blue-eyed child.' },
      { h:'Common pitfalls', b:'Two big myths: that one gene sets eye color with brown dominant, and that blue/green eyes contain blue/green pigment. They do not — the color is structural. Eye color can also shift in babies.' },
    ],
    links:[
      { label:'What Gives Eyes Their Color — ScienceInsights', url:'https://scienceinsights.org/what-gives-eyes-their-color-melanin-genes/' },
      { label:'Is Eye Color Determined by Genetics? — MedlinePlus (NIH)', url:'https://medlineplus.gov/genetics/understanding/traits/eyecolor/' },
      { label:'Eye color — Wikipedia', url:'https://en.wikipedia.org/wiki/Eye_color' },
    ],
  },
  'm-micro-sum':{
    head:'How a microwave heats food',
    intro:'The microwave can boil a mug of water in ninety seconds without getting hot itself — a clean way into the physics of electromagnetic waves.',
    secs:[
      { h:'Core idea', b:'A magnetron produces electromagnetic waves at about 2.45 GHz. Water molecules are electric dipoles, so the rapidly reversing field makes them rotate billions of times a second — molecular friction, which is heat. Energy is absorbed wherever there is water, so moist food heats throughout; dry glass and ceramic stay relatively cool.' },
      { h:'Why it matters', b:'It clears up one of the most repeated myths in popular science — that microwaves are “tuned” to a special resonant frequency of water.' },
      { h:'Common pitfalls', b:'The waves are broadband dielectric heating, not resonance, and other molecules absorb them too. Microwaves also do not cook “from the inside out” — thick foods still rely on conduction to finish the centre.' },
    ],
    links:[
      { label:'How Does a Microwave Oven Work? — Britannica', url:'https://www.britannica.com/technology/How-Does-a-Microwave-Oven-Work' },
      { label:'How do Microwaves Work? — Physics Van (UIUC)', url:'https://van.physics.illinois.edu/ask/listing/821' },
      { label:'Why “tuned to water” is a myth — C. Baird (WTAMU)', url:'https://www.wtamu.edu/~cbaird/sq/2014/10/15/why-are-the-microwaves-in-a-microwave-oven-tuned-to-water/' },
    ],
  },
  'm-gps-sum':{
    head:'How GPS finds you, with help from Einstein',
    intro:'The blue dot on your map is one of the few places in daily life where Einstein’s relativity is not optional.',
    secs:[
      { h:'Core idea', b:'Each satellite carries an atomic clock and broadcasts the time and its position. Your receiver turns each signal’s travel time into a distance (delay × speed of light), placing you on a sphere; four satellites intersect at your location and fix the receiver’s own clock.' },
      { h:'Why it matters', b:'The satellites move fast (special relativity slows their clocks ~7 µs/day) and sit in weaker gravity (general relativity speeds them ~45 µs/day). The net ~38 µs/day would cause ~10 km of error daily, so clocks are corrected before launch — GPS is a daily test of relativity.' },
      { h:'Common pitfalls', b:'Satellites do not “track” your phone — it is a passive listener. You need four satellites, not three. And the relativity correction is not negligible; it is the difference between metres and kilometres.' },
    ],
    links:[
      { label:'How the heck does GPS work? — Per Thirty Six', url:'https://perthirtysix.com/how-the-heck-does-gps-work' },
      { label:'Real-World Relativity: GPS — Ohio State University', url:'https://www.astronomy.ohio-state.edu/pogge.1/Ast162/Unit5/gps.html' },
      { label:'Relativity in the GPS — Neil Ashby (review)', url:'https://pmc.ncbi.nlm.nih.gov/articles/PMC5253894/' },
    ],
  },
  'm-touch-sum':{
    head:'How a touchscreen knows your finger',
    intro:'Touchscreens feel like magic precisely because nothing moves and nothing is pressed.',
    secs:[
      { h:'Core idea', b:'A phone uses a projected-capacitive screen: a grid of transparent electrodes (indium tin oxide) under the glass holds a small electric field. Your conductive fingertip distorts that field and changes the capacitance at the nearest grid points; a controller scans the grid and reports the coordinates.' },
      { h:'Why it matters', b:'It is a tidy introduction to capacitance and electric fields, and explains a dozen everyday quirks — why gloves fail, why a wet screen misbehaves, why a pen tip does nothing.' },
      { h:'Common pitfalls', b:'Capacitive screens sense conductivity and field changes, not pressure — “pressing harder” only spreads your fingertip over more sensing points. Resistive screens (older kiosks) are the ones that use pressure.' },
    ],
    links:[
      { label:'How do touch screens actually work? — Scienceline', url:'https://scienceline.org/2012/01/okay-but-how-do-touch-screens-actually-work/' },
      { label:'Touch Screens — USC Viterbi (Illumin)', url:'https://illumin.usc.edu/touch-screens-how-our-devices-moved-beyond-buttons/' },
      { label:'What is a capacitive touchscreen? — TechTarget', url:'https://www.techtarget.com/whatis/definition/capacitive-touch-screen' },
    ],
  },
  'm-fridge-sum':{
    head:'How a fridge pumps heat uphill',
    intro:'A refrigerator does something that sounds impossible: it makes the inside colder than the room by moving heat the “wrong” way, from cold to hot.',
    secs:[
      { h:'Core idea', b:'A refrigerant circulates through four stages: a compressor raises its pressure and temperature; the condenser coils release that heat to the room and the gas condenses to liquid; an expansion valve drops the pressure and the liquid turns cold; the evaporator coils inside absorb heat from the food as the refrigerant boils back to gas.' },
      { h:'Why it matters', b:'It is the clearest everyday lesson in the second law of thermodynamics and phase changes — and the same machine run in reverse logic is exactly how a heat pump warms a house.' },
      { h:'Common pitfalls', b:'A fridge does not “create cold” — there is no cold to add; it removes heat and dumps it into the room (so the back is warm, and leaving the door open won’t cool a kitchen). The compressor’s work is what pays for moving heat uphill, so the second law holds.' },
    ],
    links:[
      { label:'How does a refrigerator work? — Real Simple', url:'https://www.foxnews.com/food-drink/how-does-a-refrigerator-work' },
      { label:'Understanding the Refrigerant Cycle — Trane', url:'https://www.trane.com/residential/en/resources/glossary/hvac-refrigeration-cycle/' },
      { label:'Refrigerator and heat pump — BCcampus Thermo', url:'https://pressbooks.bccampus.ca/thermo1/chapter/6-2-refrigerator-and-heat-pump/' },
    ],
  },
  'm-mrna-sum':{
    head:'How an mRNA vaccine works',
    intro:'mRNA vaccines went from a niche research idea to a household word in a single year — and they are widely misunderstood.',
    secs:[
      { h:'Core idea', b:'A cell makes proteins by reading messenger RNA. An mRNA vaccine delivers a lab-made strand, wrapped in a lipid nanoparticle, carrying instructions for one harmless piece of the virus (for SARS-CoV-2, the spike protein). Your cells build that piece and display it; your immune system learns to recognize it and makes antibodies and memory cells.' },
      { h:'Why it matters', b:'It is a clear introduction to the central dogma (DNA → mRNA → protein) and to how the immune system learns — and the same platform is being tested against flu and cancer.' },
      { h:'Common pitfalls', b:'The vaccine cannot alter your DNA — mRNA never enters the nucleus and is degraded within days. It contains no live virus, so it cannot give you the disease, and the spike instructions are short-lived by design.' },
    ],
    links:[
      { label:'Understanding COVID-19 mRNA Vaccines — NHGRI', url:'https://www.genome.gov/about-genomics/fact-sheets/Understanding-COVID-19-mRNA-Vaccines' },
      { label:'COVID-19 Vaccine Basics — CDC', url:'https://www.cdc.gov/covid/vaccines/how-they-work.html' },
      { label:'Different types of COVID-19 vaccines — Mayo Clinic', url:'https://www.mayoclinic.org/diseases-conditions/coronavirus/in-depth/different-types-of-covid-19-vaccines/art-20506465' },
    ],
  },
  'm-libatt-sum':{
    head:'How a lithium-ion battery stores power',
    intro:'Almost every portable device you own runs on a lithium-ion battery, and the same chemistry now powers cars and grids.',
    secs:[
      { h:'Core idea', b:'A cell has a graphite anode and a metal-oxide cathode, separated by a liquid electrolyte and a porous separator. Lithium ions can tuck into (intercalate) both electrodes. On discharge, ions drift anode→cathode through the electrolyte while electrons are forced through the external circuit — that flow powers your device. Charging pushes them back.' },
      { h:'Why it matters', b:'It is a practical introduction to electrochemistry, and explains charging habits, battery aging, and why cells occasionally catch fire. Lithium is used because it is light and gives up its electron readily — high energy per unit mass.' },
      { h:'Common pitfalls', b:'The separator blocks electrons but passes ions, forcing electrons to do useful work instead of short-circuiting. “Lithium-ion” is a family — the cathode chemistry (NMC, LFP) sets a cell’s trade-offs in energy, cost, safety, and lifespan.' },
    ],
    links:[
      { label:'How Lithium-ion Batteries Work — U.S. Dept. of Energy', url:'https://www.energy.gov/energysaver/articles/how-lithium-ion-batteries-work' },
      { label:'How does a lithium-ion battery work? — Let’s Talk Science', url:'https://letstalkscience.ca/educational-resources/stem-explained/how-does-a-lithium-ion-battery-work' },
      { label:'BU-204: How do Lithium Batteries Work? — Battery University', url:'https://www.batteryuniversity.com/article/bu-204-how-do-lithium-batteries-work/' },
    ],
  },
  // ===== Ancient Rome =====
  'm-rkings-sum':{
    head:'How Rome got rid of its kings',
    intro:'Rome traded one-man rule for a Republic \u2014 res publica, \u201cthe public thing\u201d \u2014 built to stop any single man from dominating. But how much of that founding story is history, and how much is legend?',
    secs:[
      { h:'Core idea', b:'By tradition Rome expelled its last king, Tarquin the Proud, in 509 BCE and replaced him with two consuls who shared power, served a single year, and could veto each other. Real influence lay with the Senate, an unelected council of around 300 elite men, while popular assemblies elected officials and passed laws. Ambitious men climbed a fixed ladder of offices, the cursus honorum. The early Republic was no democracy: power sat with the patrician elite, and the plebeian majority had to fight for rights over two centuries \u2014 the \u201cstruggle of the orders.\u201d' },
      { h:'Why it matters', b:'This machinery \u2014 Senate, paired consuls, the ladder of offices \u2014 governed Rome for nearly five centuries and shaped later ideas of republican government down to the American founders. Seeing how much of the founding is legend is also a first lesson in handling thin and biased ancient evidence.' },
      { h:'Common pitfalls', b:'The Republic was not a modern democracy \u2014 votes were weighted toward the rich. The heroic founding story (Lucretia, Brutus, 509 BCE) was written down centuries later and is largely legendary; the monarchy more likely ended through military defeat and foreign intervention. And \u201cRepublic\u201d did not mean a small or weak state \u2014 it was the system under which Rome conquered the whole Mediterranean.' },
    ],
    links:[
      { label:'Roman Republic \u2014 Britannica', url:'https://www.britannica.com/place/Roman-Republic' },
      { label:'Roman Government \u2014 World History Encyclopedia', url:'https://www.worldhistory.org/Roman_Government/' },
      { label:'Overthrow of the Roman monarchy \u2014 Wikipedia', url:'https://en.wikipedia.org/wiki/Overthrow_of_the_Roman_monarchy' },
      { label:'Rome\u2019s Transition from Republic to Empire \u2014 National Geographic', url:'https://education.nationalgeographic.org/resource/romes-transition-republic-empire/' },
    ],
  },
  'm-rlegion-sum':{
    head:'How Rome\u2019s army conquered the Mediterranean',
    intro:'Rome\u2019s expansion ran on its army \u2014 and the secret was not a wonder-weapon but a way of organizing people, one that let it absorb disasters that would have destroyed any other state.',
    secs:[
      { h:'Core idea', b:'The early army was a citizen militia: men supplied their own gear, tying service to wealth. Its great innovation, forged in the hard Samnite Wars, was the manipular system \u2014 breaking the rigid phalanx into small, flexible units (maniples) arranged in three lines by age and experience (hastati, principes, triarii) that could rotate fresh troops forward. \u201cThe phalanx had been given joints.\u201d But Rome\u2019s deepest edge was structural: vast reserves of citizens and allies, and a culture that treated defeat as temporary. Even after Hannibal annihilated armies at Trebia, Trasimene, and Cannae, Rome raised new legions and won. The Marian reforms (from 107 BCE) dropped the property requirement, creating a professional standing army.' },
      { h:'Why it matters', b:'The legion explains not just how Rome won battles but how it survived catastrophes \u2014 and the shift to a professional army loyal to its general, rather than the state, set up the civil wars that broke the Republic.' },
      { h:'Common pitfalls', b:'Rome did not win because it never lost \u2014 it suffered some of antiquity\u2019s worst defeats and won anyway through persistence and manpower. There was no single super-weapon; the advantage was organization, discipline, and adaptability. And the army was a self-equipping militia for centuries before it ever became professional.' },
    ],
    links:[
      { label:'How the Roman legions changed \u2014 History Skills', url:'https://www.historyskills.com/classroom/year-7/roman-legions-evolution/' },
      { label:'Roman Legion: From Tribal Levy to Imperial Legion \u2014 Roman-Britain.co.uk', url:'https://www.roman-britain.co.uk/military/the-structure-and-soldiers-of-the-roman-army/roman-legion-from-tribal-levy-to-imperial-legion/' },
      { label:'Roman Legion Structure Explained \u2014 Myth and Memory', url:'https://mythandmemory.org/military-history/roman-legion-structure-explained-organization-tactics-evolution/' },
      { label:'The Manipular formation \u2014 Kocho-Williams (UW)', url:'https://minds.wisconsin.edu/bitstream/handle/1793/46588/Kochom.pdf?sequence=2' },
    ],
  },
  'm-rrepub-sum':{
    head:'How the Republic became one-man rule',
    intro:'The fall of the Roman Republic is history\u2019s great case study in how a free state can destroy itself \u2014 not in a single coup, but over decades of inequality, broken norms, and private armies.',
    secs:[
      { h:'Core idea', b:'The Republic eroded over roughly a century. Conquest widened inequality, politics turned violent (the reforming Gracchi brothers were killed), and the Marian army was loyal to generals who could promise land. Caesar, Pompey, and Crassus formed an informal alliance, the First Triumvirate. Ordered to give up his army, Caesar crossed the Rubicon in 49 BCE, won the civil war, and made himself dictator for life. Senators assassinated him on the Ides of March, 44 BCE \u2014 but triggered more war. His heir Octavian defeated his rivals and emerged as sole ruler. His genius was presentation: he claimed to have \u201crestored the Republic,\u201d kept the Senate and old offices as a shell, and took the modest title princeps, \u201cfirst citizen.\u201d Historians call this the Principate \u2014 monarchy in substance, Republic in form.' },
      { h:'Why it matters', b:'The collapse has been invoked as a warning in every age since. Understanding how Rome slid from republic to monarchy, and how Augustus disguised that monarchy as a restoration, is essential to understanding power itself.' },
      { h:'Common pitfalls', b:'The Republic did not fall because of one man or one event \u2014 it decayed over decades. Caesar was never \u201cemperor\u201d in the later sense and did not found the empire; his heir Augustus did. And Augustus did not abolish the Republic openly \u2014 he kept its forms and titles, claiming to restore it, which is precisely why the transition worked.' },
    ],
    links:[
      { label:'Julius Caesar\u2019s Assassination \u2014 History.com', url:'https://www.history.com/articles/julius-caesar-assassination-fall-roman-republic' },
      { label:'Caesar\u2019s civil war \u2014 Wikipedia', url:'https://en.wikipedia.org/wiki/Caesar%27s_civil_war' },
      { label:'Rome\u2019s Transition from Republic to Empire \u2014 National Geographic', url:'https://education.nationalgeographic.org/resource/romes-transition-republic-empire/' },
      { label:'How Ancient Rome Thrived During Pax Romana \u2014 History.com', url:'https://www.history.com/articles/pax-romana-roman-empire-peace-augustus' },
    ],
  },
  'm-radmin-sum':{
    head:'How Rome ran an empire with so few officials',
    intro:'At its height Rome governed perhaps 60\u201370 million people across three continents with a tiny central administration \u2014 a masterclass in soft power as much as hard power.',
    secs:[
      { h:'Core idea', b:'Rome conquered with its army but governed mostly on the cheap. It divided territory into provinces run by governors, yet needed few imperial officials because it left day-to-day administration to self-governing cities and local elites. Two things were the glue. First, Romanization: conquered peoples \u2014 especially their elites \u2014 adopted Roman culture, language, and town life, winning posts and even citizenship, so assimilation rather than constant force held the empire together. Second, citizenship itself, which carried legal protections and the right to appeal to Roman law anywhere; in 212 CE the emperor Caracalla extended it to nearly all free inhabitants. Binding it physically were tens of thousands of miles of roads; binding it legally was Roman law, which bequeathed precedent and the idea that a law\u2019s spirit can matter more than its letter.' },
      { h:'Why it matters', b:'Roman law and infrastructure outlived the empire itself, shaping Europe for the next fifteen centuries. The empire ran on co-opting local elites and spreading a shared culture, not brute occupation \u2014 major revolts were the exception, not the rule.' },
      { h:'Common pitfalls', b:'Rome did not run its empire with a huge bureaucracy occupying every town \u2014 central administration was small. Citizenship was not limited to the city of Rome; after 212 CE it covered almost all free inhabitants. And the Pax Romana was no gentle peace \u2014 it was imposed by conquest and maintained by force, as the British chieftain Calgacus bitterly noted: \u201cthey make a desolation and call it peace.\u201d' },
    ],
    links:[
      { label:'How Rome Ruled Its Vast Empire \u2014 TheCollector', url:'https://www.thecollector.com/roman-provinces-conquered-governed/' },
      { label:'Local government in ancient Rome \u2014 Wikipedia', url:'https://en.wikipedia.org/wiki/Local_government_in_ancient_Rome' },
      { label:'The Roman Empire \u2014 Western Civilization (open textbook)', url:'https://louis.pressbooks.pub/westernciv/chapter/chapter9/' },
      { label:'How Ancient Rome Thrived During Pax Romana \u2014 History.com', url:'https://www.history.com/articles/pax-romana-roman-empire-peace-augustus' },
    ],
  },
  'm-rsoc-sum':{
    head:'How Roman society was actually organized',
    intro:'Behind the politics and battles, Rome was a steeply unequal society resting on a foundation of slavery and bound together by personal obligation.',
    secs:[
      { h:'Core idea', b:'Roman society was a rigid hierarchy. At the top sat the elite orders \u2014 patricians, later the senatorial and equestrian (business) classes \u2014 who dominated land and politics. The plebeians were the citizen majority. Beneath citizens were freedmen (former slaves) and, at the bottom, slaves, who were legally property. Slavery was vast and central to the economy, but two features set it apart from later race-based slavery: it was not based on skin colour, and manumission was common, with freedmen\u2019s children able to become full citizens. Society was knit by the patron-client system \u2014 lower-status clients sought favours from patrons, repaying with loyalty. And to keep the urban masses content, the elite provided \u201cbread and circuses\u201d: free grain and lavish public games \u2014 a real tool of social control, named sourly by the poet Juvenal.' },
      { h:'Why it matters', b:'Understanding the hierarchy reveals the human reality beneath the marble and corrects the romantic picture of Rome as a society of toga-clad citizens \u2014 many of its people were owned, poor, or politically powerless.' },
      { h:'Common pitfalls', b:'Roman slavery was not based on race or skin colour \u2014 slaves came mainly from conquest, debt, and birth, and could be freed. \u201cBread and circuses\u201d was not mere entertainment but a deliberate instrument of social control. And Rome was not a broadly equal society: it was steeply hierarchical, with a large share of its people enslaved or powerless.' },
    ],
    links:[
      { label:'Social class in ancient Rome \u2014 Wikipedia', url:'https://en.wikipedia.org/wiki/Social_class_in_ancient_Rome' },
      { label:'Social Classes in Ancient Rome \u2014 Facts and Details', url:'https://europe.factsanddetails.com/article/entry-1144.html' },
      { label:'Roman Plebeians: Definition, History & Life \u2014 Study.com', url:'https://study.com/academy/lesson/roman-plebs-definition-lesson-quiz.html' },
      { label:'Daily Life in Ancient Rome \u2014 Science News Today', url:'https://www.sciencenewstoday.org/daily-life-in-ancient-rome-citizens-and-slaves' },
    ],
  },
  'm-rfall-sum':{
    head:'Why the Western Roman Empire fell',
    intro:'The fall of Rome is the most famous collapse in history \u2014 and one of the most fiercely debated questions in all of historical study, with no consensus on why, or even exactly when, it happened.',
    secs:[
      { h:'Core idea', b:'The conventional date is 476 CE, when the Germanic leader Odoacer deposed the last western emperor, the teenager Romulus Augustulus \u2014 but almost everything about that framing is debated. The causes most often cited fall into clusters: external pressure (Germanic peoples pushed by the Huns, and crushing defeats like Adrianople in 378), military change (reliance on hired \u201cbarbarian\u201d soldiers), economic strain (overspending, taxation, inflation), and political instability (a revolving door of short-lived, often murdered emperors). Edward Gibbon\u2019s hugely influential Decline and Fall blamed internal decay and the rise of Christianity \u2014 a view most modern scholars now reject. Three points unsettle the whole story: the fall was only in the west (the eastern, Byzantine empire lasted nearly another thousand years); 476 is a convenience, since decline was gradual; and \u201cdecline and fall\u201d is contested, with some historians preferring \u201ctransformation.\u201d' },
      { h:'Why it matters', b:'Every later age has read its own anxieties into Rome\u2019s decline. Learning this dive means learning to handle genuine, unresolved historical controversy rather than a tidy answer \u2014 one scholar once catalogued more than two hundred proposed causes.' },
      { h:'Common pitfalls', b:'Rome did not fall in a single year \u2014 476 is a convenient marker for a long, gradual process, and Roman institutions and culture persisted well beyond it. The whole empire did not fall: the eastern, Byzantine half lasted nearly another thousand years. And the fall was not caused simply by \u201cbarbarians\u201d \u2014 that is one factor among many, and Gibbon\u2019s once-standard blame on Christianity is now largely rejected.' },
    ],
    links:[
      { label:'8 Reasons Why Rome Fell \u2014 History.com', url:'https://www.history.com/articles/8-reasons-why-rome-fell' },
      { label:'Fall of the Western Roman Empire \u2014 World History Encyclopedia', url:'https://www.worldhistory.org/article/835/fall-of-the-western-roman-empire/' },
      { label:'Is this the real reason the Roman Empire collapsed? \u2014 National Geographic', url:'https://www.nationalgeographic.com/history/article/fall-of-ancient-roman-empire' },
      { label:'Historiography of the fall of the Western Roman Empire \u2014 Wikipedia', url:'https://en.wikipedia.org/wiki/Historiography_of_the_fall_of_the_Western_Roman_Empire' },
    ],
  },
  // ===== Astronomy =====
  'm-aspec-sum':{
    head:'How we know what a star is made of',
    intro:'We will never collect a sample from a star, yet we can say with confidence the Sun is mostly hydrogen and helium. The method that makes this possible \u2014 spectroscopy \u2014 is the single most important tool in all of astronomy.',
    secs:[
      { h:'Core idea', b:'Pass starlight through a prism or grating and it spreads into a spectrum crossed by dark lines. The reason is atomic: each element absorbs light at a fixed set of wavelengths \u2014 a fingerprint \u2014 because its electrons can jump only between certain energy levels. As light from a star\u2019s hot interior passes through its cooler outer atmosphere, the elements there absorb their signature wavelengths, leaving dark absorption lines. Matching those lines to elements measured in Earth laboratories identifies exactly what is present, and the line strength tells how much. This is how Kirchhoff first detected sodium in the Sun in the 1860s, and how Cecilia Payne-Gaposchkin showed in the 1920s that stars are overwhelmingly hydrogen and helium.' },
      { h:'Why it matters', b:'It is a clean way into the idea that light is a wave with a wavelength, and that colours interact with matter differently because their wavelengths differ \u2014 and it is the foundation that makes the whole field even possible.' },
      { h:'Common pitfalls', b:'Composition is not read from a star\u2019s colour alone \u2014 colour gives temperature; the spectral lines reveal which elements are present. The dark lines are not flaws in the telescope; they are real absorption by specific elements. And the elements found are not exotic \u2014 the same hydrogen, helium, and sodium we know on Earth.' },
    ],
    links:[
      { label:'Spectroscopy in Astronomy \u2014 OpenStax / Lumen', url:'https://courses.lumenlearning.com/suny-astronomy/chapter/spectroscopy-in-astronomy/' },
      { label:'What are stars made of? \u2014 Science in School', url:'https://scienceinschool.org/article/2016/what-are-stars-made/' },
      { label:'How do scientists determine chemical compositions? \u2014 Astronomy.com', url:'https://www.astronomy.com/science/how-do-scientists-determine-the-chemical-compositions-of-the-planets-and-stars/' },
      { label:'Star \u2014 Stellar spectra \u2014 Britannica', url:'https://www.britannica.com/science/star-astronomy/Stellar-spectra' },
    ],
  },
  'm-astars-sum':{
    head:'Why stars shine, and how they die',
    intro:'A star is a delicate, centuries-long balancing act between two titanic forces \u2014 and the story of how it lives and dies explains where almost everything around you came from.',
    secs:[
      { h:'Core idea', b:'A star is born when gravity pulls a cloud of gas and dust together until the core reaches about 15 million degrees and ignites nuclear fusion, fusing hydrogen into helium. For most of its life \u2014 the main sequence \u2014 the outward push of fusion exactly offsets gravity\u2019s inward pull. When the core\u2019s hydrogen runs low, what happens next depends almost entirely on mass. A Sun-like star swells into a red giant, sheds its outer layers, and leaves behind a slowly cooling white dwarf. A much more massive star fuses heavier and heavier elements until its core is iron \u2014 and because fusing iron absorbs energy rather than releasing it, the core collapses in under a second and rebounds as a supernova, leaving a neutron star or black hole and seeding space with the heavy elements that later build planets and people.' },
      { h:'Why it matters', b:'The carbon in your body, the oxygen you breathe, the iron in your blood \u2014 all were forged inside stars and scattered by their deaths. Understanding stellar life is, quite literally, understanding our own origins.' },
      { h:'Common pitfalls', b:'Stars do not \u201cburn\u201d like a fire \u2014 there is no combustion; they shine by nuclear fusion. The Sun will not explode as a supernova \u2014 only much more massive stars do; it will become a red giant and then a white dwarf. And a supernova is triggered by the sudden gravitational collapse of a core that can no longer support itself, not simply by burning fuel.' },
    ],
    links:[
      { label:'Stars \u2014 NASA Science', url:'https://science.nasa.gov/universe/stars/' },
      { label:'Stellar Evolution \u2014 EBSCO Research Starters', url:'https://www.ebsco.com/research-starters/physics/stellar-evolution' },
      { label:'The Life Cycles of Stars \u2014 NASA Goddard', url:'https://imagine.gsfc.nasa.gov/educators/lifecycles/LC_main3.html' },
      { label:'Star \u2014 Spectra, Classification, Evolution \u2014 Britannica', url:'https://www.britannica.com/science/star-astronomy/Stellar-spectra' },
    ],
  },
  'm-adist-sum':{
    head:'How we measure the distance to a star',
    intro:'Almost everything in astronomy depends on knowing how far away things are \u2014 yet we cannot stretch a tape measure into space. The ingenious solution is a chain of methods, each calibrating the next.',
    secs:[
      { h:'Core idea', b:'Because no single method reaches all the way out, astronomers build a \u201ccosmic distance ladder\u201d of overlapping techniques. The first rung is parallax: as Earth orbits the Sun, a nearby star appears to shift slightly against the distant background, and the size of that shift gives its distance by simple geometry. Parallax works only for nearby stars, so the next rungs use \u201cstandard candles\u201d \u2014 objects whose true brightness we know, so comparing true to apparent brightness yields distance via the inverse-square law. Cepheid variable stars are the classic example (Henrietta Swan Leavitt found a Cepheid\u2019s pulsation period reveals its luminosity) and are bright enough to be seen in other galaxies. Farther still, Type Ia supernovae have a known, consistent peak brightness visible across billions of light-years. Each rung is calibrated against the one below it.' },
      { h:'Why it matters', b:'It is what lets us say the Andromeda Galaxy is 2.5 million light-years away with a straight face \u2014 and the same standard candles led directly to the discovery of dark energy.' },
      { h:'Common pitfalls', b:'Parallax is not how we measure distances to other galaxies \u2014 it works only for relatively nearby stars; distant objects need standard candles. A light-year is a distance, not a time. And the distance ladder is not a single clever trick but a chain \u2014 each method has a limited range and must be calibrated against the rung below.' },
    ],
    links:[
      { label:'Parallax, Cepheids, Supernovae \u2014 Physics LibreTexts', url:'https://phys.libretexts.org/Courses/University_of_California_Davis/Physics_156:_A_Cosmology_Workbook/01:_Workbook/1.16:_Parallax_Cepheid_Variables_Supernovae_and_Distance_Measurement' },
      { label:'The Cosmic Distance Ladder \u2014 AAVSO', url:'https://www.aavso.org/cosmic-distance-ladder' },
      { label:'Lecture 33: The Cosmic Distance Scale \u2014 Ohio State', url:'https://www.astronomy.ohio-state.edu/ryden.1/ast162_8/notes33.html' },
      { label:'Cosmic Distance Ladder and Standard Candles \u2014 Fiveable', url:'https://fiveable.me/astrophysics-ii/unit-12/cosmic-distance-ladder-standard-candles/study-guide/UEZBV3Y0ZqPeJWto' },
    ],
  },
  'm-aexp-sum':{
    head:'How we know the universe is expanding',
    intro:'A century ago almost everyone assumed the universe was static and eternal. The discovery that it is expanding \u2014 and therefore had a beginning \u2014 is one of the great upheavals in the history of thought.',
    secs:[
      { h:'Core idea', b:'When astronomers split the light of distant galaxies, they find the spectral lines shifted toward the red end \u2014 a \u201credshift.\u201d In the 1920s Edwin Hubble (building on Georges Lema\u00eetre\u2019s theory) found that the farther a galaxy is, the greater its redshift: Hubble\u2019s Law. The right interpretation is subtle and crucial \u2014 galaxies are not flying through space away from a center; rather, space itself is expanding, stretching the light traveling through it. Run that expansion backwards and the universe was once hot, dense, and tiny: the Big Bang, about 13.8 billion years ago. Two more pillars clinch it: the cosmic microwave background, a faint afterglow now stretched to microwaves at about 2.7 K (Penzias and Wilson, 1960s), and the observed cosmic abundance of hydrogen and helium, which matches Big Bang predictions.' },
      { h:'Why it matters', b:'It transforms the night sky from a fixed backdrop into something with a history, an age, and a first moment \u2014 and it shows how a few faint smears of light overturned an entire worldview.' },
      { h:'Common pitfalls', b:'The Big Bang was not an explosion at a point in space that galaxies are flying away from \u2014 it was an expansion of space itself, happening everywhere at once, with no center. Cosmological redshift is mostly not ordinary Doppler motion but the stretching of light by expanding space. And the universe has no edge we could reach or a center it grew from.' },
    ],
    links:[
      { label:'Hubble Cosmological Redshift \u2014 NASA Science', url:'https://science.nasa.gov/mission/hubble/science/science-behind-the-discoveries/hubble-cosmological-redshift/' },
      { label:'Big Bang Theory and Cosmic Microwave Background \u2014 Fiveable', url:'https://fiveable.me/principles-physics-iii-thermal-physics-waves/unit-12/big-bang-theory-cosmic-microwave-background/study-guide/Tef6oAOV2dD1Od1D' },
      { label:'Hubble Big Bang \u2014 NASA Science', url:'https://science.nasa.gov/mission/hubble/science/science-behind-the-discoveries/hubble-big-bang/' },
      { label:'Evidence for the Big Bang \u2014 Magis Center', url:'https://www.magiscenter.com/blog/evidence-for-the-big-bang' },
    ],
  },
  'm-abh-sum':{
    head:'What a black hole really is',
    intro:'Black holes are where our two best theories of physics collide and intuition fails completely \u2014 regions where gravity is so strong that not even light escapes.',
    secs:[
      { h:'Core idea', b:'A black hole is a region where gravity is so strong that nothing, not even light, can escape. Most form when a very massive star dies and its core collapses with nothing left to hold it up. The defining feature is the event horizon \u2014 not a physical surface but a boundary, the point of no return, where the escape velocity would have to exceed the speed of light. At the center, general relativity predicts a singularity, a point of infinite density where the known laws break down \u2014 and near it our theories fail, because we have no working theory of quantum gravity. Since black holes emit no light, we detect them indirectly: by the X-rays from gas heated white-hot as it spirals in, by the motion of stars orbiting an unseen mass, and by gravitational waves from black holes colliding. In 2019 the Event Horizon Telescope produced the first image of a black hole\u2019s shadow, in the galaxy M87.' },
      { h:'Why it matters', b:'Black holes are no longer speculation \u2014 we have photographed their shadows and heard them collide. Understanding them is understanding the most extreme gravity in the universe, and one of the clearest places where current physics admits it does not yet know the answer.' },
      { h:'Common pitfalls', b:'A black hole is not a cosmic vacuum cleaner that sucks everything in \u2014 from a safe distance its gravity behaves like any other mass; you orbit it. The event horizon is not a solid surface but a boundary in space. And we have not \u201cseen inside\u201d one: the 2019 image shows the shadow and glowing matter outside the horizon, while what happens at the singularity remains genuinely unknown.' },
    ],
    links:[
      { label:'Anatomy \u2014 NASA Science (Black Holes)', url:'https://science.nasa.gov/universe/black-holes/anatomy/' },
      { label:'Black holes, explained by an astrophysicist \u2014 Astronomy.com', url:'https://www.astronomy.com/science/black-holes-explained-by-an-astrophysicist/' },
      { label:'Black holes, explained \u2014 University of Chicago News', url:'https://news.uchicago.edu/explainer/black-holes-explained' },
      { label:'What is a black hole event horizon? \u2014 Space.com', url:'https://www.space.com/black-holes-event-horizon-explained.html' },
    ],
  },
  'm-adark-sum':{
    head:'Why most of the universe is missing',
    intro:'Everything we can see \u2014 every star, planet, and glowing cloud of gas \u2014 adds up to only about five percent of the universe. The other 95 percent is two mysteries we have named but cannot explain.',
    secs:[
      { h:'Core idea', b:'Two separate lines of evidence reveal that the visible universe is only a sliver of the whole. First, galaxies spin too fast: the gravity of their visible matter is nowhere near enough to hold them together at the speeds we observe, so they should fly apart \u2014 unless some unseen mass provides extra gravity. This missing mass is called dark matter; it does not emit, absorb, or reflect light, and we detect it only through its gravity. Second, in 1998 two teams measuring distant Type Ia supernovae found the universe\u2019s expansion is not slowing under gravity as expected but speeding up. The unknown influence driving this is called dark energy, and it seems spread evenly through all of space. Adding them up: ordinary matter is about five percent, dark matter about 27 percent, and dark energy about 68 percent.' },
      { h:'Why it matters', b:'Confronting dark matter and dark energy is confronting the frontier of astronomy itself \u2014 the place where the textbooks stop and the open questions begin. The names are not explanations; they are honest labels for things detected by their effects but not understood.' },
      { h:'Common pitfalls', b:'Dark matter and dark energy are not the same thing \u2014 one is unseen mass that pulls galaxies together, the other a mysterious influence pushing the universe apart faster. \u201cDark\u201d does not mean we know what they are. And they are not fringe speculation \u2014 they rest on solid, repeated observations; it is their nature, not their existence, that is uncertain.' },
    ],
    links:[
      { label:'Dark Matter \u2014 NASA Science', url:'https://science.nasa.gov/dark-matter/' },
      { label:'What is Dark Energy? \u2014 NASA Science', url:'https://science.nasa.gov/dark-energy/' },
      { label:'Dark Energy and Dark Matter \u2014 Harvard-Smithsonian CfA', url:'https://www.cfa.harvard.edu/research/topic/dark-energy-and-dark-matter' },
      { label:'Dark matter \u2014 CERN', url:'https://home.cern/science/physics/dark-matter/' },
    ],
  },
  'm-cell-sum':{
    head:'The eukaryotic cell, summarized',
    intro:'Every plant, animal, and fungus is built from eukaryotic cells — compartmentalized factories where each organelle does a specialized job.',
    secs:[
      { h:'Core idea', b:'A eukaryotic cell keeps its DNA inside a membrane-bound nucleus and divides labour among organelles: mitochondria generate ATP through respiration, ribosomes build proteins, the endoplasmic reticulum and Golgi apparatus modify and ship them, and lysosomes recycle waste. A selectively permeable membrane controls what enters and leaves, and a cytoskeleton gives the cell shape and movement.' },
      { h:'Why it matters', b:'It is the structural foundation of all complex life and of biology itself — understanding the parts explains how cells make energy, build proteins, and stay organized.' },
      { h:'Common pitfalls', b:'Prokaryotes (bacteria) are not just “smaller” eukaryotes — they lack a nucleus and membrane-bound organelles entirely. And the membrane is not a passive wall; it actively regulates transport, as in osmosis and the sodium–potassium pump.' },
    ],
    links:[
      { label:'Cell — Britannica', url:'https://www.britannica.com/science/cell-biology' },
      { label:'Structure of a cell — Khan Academy', url:'https://www.khanacademy.org/science/biology/structure-of-a-cell' },
      { label:'Cell — National Geographic Education', url:'https://education.nationalgeographic.org/resource/cell/' },
    ],
  },
  'm-nn-sum':{
    head:'How a neural network learns',
    intro:'A neural network turns examples into a model by adjusting millions of small weights until its outputs match the right answers.',
    secs:[
      { h:'Core idea', b:'A network stacks layers of simple units. Each unit takes a weighted sum of its inputs and passes it through a non-linear activation function (like ReLU), letting the network model complex patterns. Training compares the output to the truth with a loss, then backpropagation uses the chain rule to find how each weight contributed to the error, and gradient descent nudges the weights to reduce it — repeated over many examples.' },
      { h:'Why it matters', b:'This single loop — predict, measure the error, adjust — underlies modern AI, from image recognition to the large language models behind chat assistants.' },
      { h:'Common pitfalls', b:'A network does not “understand” — it fits patterns in data, so it can overfit (memorize) and fail to generalize; regularizers like dropout help. And more layers are not automatically better without enough data and careful training.' },
    ],
    links:[
      { label:'Neural network — Wikipedia', url:'https://en.wikipedia.org/wiki/Neural_network_(machine_learning)' },
      { label:'But what is a neural network? — 3Blue1Brown', url:'https://www.3blue1brown.com/topics/neural-networks' },
      { label:'Neural Networks — Google ML Crash Course', url:'https://developers.google.com/machine-learning/crash-course/neural-networks' },
    ],
  },
  'm-cold-sum':{
    head:'The Cold War — key flashpoints',
    intro:'For four decades the United States and the Soviet Union never fought directly, yet shaped the whole world through a tense rivalry of ideology, nuclear weapons, and proxy conflicts.',
    secs:[
      { h:'Core idea', b:'After 1945 a US-led capitalist bloc and a Soviet-led communist bloc divided Europe along the “Iron Curtain.” Direct war was deterred by nuclear weapons, so the conflict played out through an arms race, a space race, espionage, and proxy wars in Korea, Vietnam, and Afghanistan. Flashpoints like the Berlin blockade and the 1962 Cuban Missile Crisis brought the world close to nuclear war; later détente eased tensions before the Soviet bloc collapsed in 1989–91.' },
      { h:'Why it matters', b:'It defined the second half of the 20th century — drawing borders, funding wars, and building the nuclear arsenals and alliances (NATO, the Warsaw Pact) that still shape geopolitics today.' },
      { h:'Common pitfalls', b:'It was not a single continuous crisis — long stretches were tense stand-off rather than active conflict. And “cold” is relative: the proxy wars were devastatingly hot for the countries that fought them.' },
    ],
    links:[
      { label:'Cold War — Britannica', url:'https://www.britannica.com/event/Cold-War' },
      { label:'Cold War History — History.com', url:'https://www.history.com/topics/cold-war/cold-war-history' },
      { label:'The Cuban Missile Crisis — Office of the Historian', url:'https://history.state.gov/milestones/1961-1968/cuban-missile-crisis' },
    ],
  },
  'm-gen-sum':{
    head:'How traits pass to offspring',
    intro:'Genetics began with Gregor Mendel’s pea plants and a simple question: why do offspring resemble their parents in such predictable patterns?',
    secs:[
      { h:'Core idea', b:'Traits are carried by genes, and each gene can come in variant forms called alleles. Offspring inherit one allele from each parent. A dominant allele masks a recessive one, so the visible trait (phenotype) does not always reveal the underlying genes (genotype). A Punnett square predicts the ratios of offspring traits from the parents’ alleles.' },
      { h:'Why it matters', b:'These rules are the foundation of heredity, plant and animal breeding, and modern genetics — and the basis for understanding genetic disease and DNA.' },
      { h:'Common pitfalls', b:'Most real traits are not single-gene — height, skin colour, and eye colour are polygenic, which is why simple dominant/recessive ratios often break down. And “dominant” does not mean more common or stronger — only that it masks the recessive allele.' },
    ],
    links:[
      { label:'Heredity — Britannica', url:'https://www.britannica.com/science/heredity-genetics' },
      { label:'Heredity & genetics — Khan Academy', url:'https://www.khanacademy.org/science/ap-biology/heredity' },
      { label:'Mendelian Inheritance — Genome.gov', url:'https://www.genome.gov/genetics-glossary/Mendelian-Inheritance' },
    ],
  },
  'm-verb-sum':{
    head:'Preterite vs. imperfect, summarized',
    intro:'Spanish has two simple past tenses, and choosing between them is less about when something happened than about how you frame the action.',
    secs:[
      { h:'Core idea', b:'Conjugation changes a verb to match its subject and tense, starting from the infinitive. The preterite describes completed, bounded past actions (“I ate”), while the imperfect describes ongoing, habitual, or background past states (“I was eating,” “I used to eat”). Both are regular for most verbs, but a core set of high-frequency verbs is irregular and must be memorized.' },
      { h:'Why it matters', b:'Past-tense choice is one of the hardest and most important skills in Spanish — it can change the meaning of a sentence, not just its grammar.' },
      { h:'Common pitfalls', b:'The choice is not about how long ago something happened — both tenses can describe distant or recent events. And the imperfect is not just a past progressive; it also covers habitual actions and descriptions.' },
    ],
    links:[
      { label:'Preterite vs. Imperfect — SpanishDict', url:'https://www.spanishdict.com/guide/preterite-vs-imperfect-in-spanish' },
      { label:'Spanish verbs — Wikipedia', url:'https://en.wikipedia.org/wiki/Spanish_verbs' },
      { label:'Preterite vs Imperfect — StudySpanish', url:'https://studyspanish.com/grammar/lessons/pretimp' },
    ],
  },
  'm-vocab-sum':{
    head:'Travel vocabulary, by situation',
    intro:'The fastest way to learn travel vocabulary is to group words by the situation where you will actually use them.',
    secs:[
      { h:'Core idea', b:'Rather than memorizing a flat word list, cluster vocabulary around real moments: asking directions (left, right, straight, near), the airport (gate, boarding, luggage), getting around (bus, train, taxi, ticket), lodging (hotel, room, reservation), and the social glue of greetings, “please,” and “thank you” — plus numbers for prices and times.' },
      { h:'Why it matters', b:'Situational grouping mirrors how memory works, so the right word comes to mind exactly when you need it — at the counter, not on a flashcard.' },
      { h:'Common pitfalls', b:'Memorizing isolated words is far weaker than learning short, usable phrases. And politeness words matter more than tourists expect — a greeting and a “thank you” often unlock more help than perfect grammar.' },
    ],
    links:[
      { label:'Spaced repetition — Wikipedia', url:'https://en.wikipedia.org/wiki/Spaced_repetition' },
      { label:'Language immersion — Wikipedia', url:'https://en.wikipedia.org/wiki/Language_immersion' },
    ],
  },
  'm-indr-sum':{
    head:'What drove the Industrial Revolution',
    intro:'In a single century, Britain shifted from making goods by hand to making them by machine — a change that remade work, cities, and daily life.',
    secs:[
      { h:'Core idea', b:'Beginning in Britain around 1760, the steam engine provided power beyond muscle, water, and wind, and the factory system concentrated machines and workers under one roof. It started in textiles, ran on coal and iron, and spread on a network of railways that moved goods and people at unprecedented speed. The result was mass production, falling prices, and rapid urbanization as workers crowded into industrial cities.' },
      { h:'Why it matters', b:'It is the origin of the modern economy and the modern city — and of both the enormous gains in living standards and the harsh labour conditions that followed.' },
      { h:'Common pitfalls', b:'It was not a sudden “revolution” but a decades-long transformation. And progress was deeply uneven — early factory work meant long hours, child labour, and dangerous conditions alongside the new wealth.' },
    ],
    links:[
      { label:'Industrial Revolution — Britannica', url:'https://www.britannica.com/event/Industrial-Revolution' },
      { label:'Industrial Revolution — History.com', url:'https://www.history.com/topics/industrial-revolution/industrial-revolution' },
      { label:'The Industrial Revolution — BBC Bitesize', url:'https://www.bbc.co.uk/bitesize/topics/ztvxsbk' },
    ],
  },
  'm-scale-sum':{
    head:'Scales and modes, summarized',
    intro:'A scale is just an ordered set of notes — but the pattern of steps between them is what gives music its mood and its sense of “home.”',
    secs:[
      { h:'Core idea', b:'A major scale follows a fixed pattern of whole and half steps that sounds bright; the minor scale uses a darker pattern. Modes are scales that start on a different degree of the major scale, each with its own colour. The tonic is the “home” note a melody resolves to, intervals are the distances between notes, and a key signature’s sharps or flats define which scale a piece lives in.' },
      { h:'Why it matters', b:'Scales and modes are the raw material of melody and harmony — knowing them lets you understand why music feels the way it does and gives you the vocabulary to build your own.' },
      { h:'Common pitfalls', b:'Major is not simply “happy” and minor “sad” — tempo, rhythm, and harmony shape emotion too. And modes are not exotic foreign scales; they are reorderings of the familiar major scale.' },
    ],
    links:[
      { label:'Scale (music) — Wikipedia', url:'https://en.wikipedia.org/wiki/Scale_(music)' },
      { label:'Mode (music) — Wikipedia', url:'https://en.wikipedia.org/wiki/Mode_(music)' },
      { label:'Key signature — Wikipedia', url:'https://en.wikipedia.org/wiki/Key_signature' },
    ],
  },
  'm-grad-sum':{
    head:'How gradient descent finds a minimum',
    intro:'Training a model means minimizing error. Gradient descent is the workhorse that does it — taking small, repeated steps downhill on a “loss landscape.”',
    secs:[
      { h:'Core idea', b:'A loss function measures how wrong the model is. Its gradient points in the direction of steepest increase, so stepping the opposite way reduces the loss. The learning rate sets how big each step is; repeat until the loss stops improving (convergence). Variants differ in how much data each step uses — full-batch, mini-batch, or stochastic (one example at a time).' },
      { h:'Why it matters', b:'Almost every neural network is trained this way, so the idea underlies modern machine learning. It also explains practical headaches: too large a learning rate overshoots the minimum, too small and training crawls.' },
      { h:'Common pitfalls', b:'Gradient descent does not guarantee the global minimum — it can settle in a local minimum or a flat region. A bigger learning rate is not always faster; past a point it diverges. And without feature scaling the steps zig-zag inefficiently.' },
    ],
    links:[
      { label:'Gradient descent — Wikipedia', url:'https://en.wikipedia.org/wiki/Gradient_descent' },
      { label:'Reducing Loss: Gradient Descent — Google ML Crash Course', url:'https://developers.google.com/machine-learning/crash-course/reducing-loss/gradient-descent' },
      { label:'An overview of gradient descent optimization — Sebastian Ruder', url:'https://www.ruder.io/optimizing-gradient-descent/' },
    ],
  },
  'm-chord-sum':{
    head:'How chord progressions create motion',
    intro:'Music feels like it goes somewhere because chords set up tension and release. A progression is simply an ordered sequence of chords that guides that journey.',
    secs:[
      { h:'Core idea', b:'Chords have functions relative to a key: the tonic (I) is home, the dominant (V) pulls strongly back to it, and the subdominant (IV) moves away. Stringing these together creates expectation; a cadence resolves it. The most common pop progression, I–V–vi–IV, cycles tension and rest in a loop.' },
      { h:'Why it matters', b:'Understanding function lets you hear why a song feels resolved, suspended, or surprising — and lets you write progressions on purpose rather than by trial and error.' },
      { h:'Common pitfalls', b:'A progression is not just “random chords that sound nice” — its pull comes from each chord’s function in the key. And “sad” minor or “happy” major chords are only part of it; order and cadence shape the feeling as much as the chords themselves.' },
    ],
    links:[
      { label:'Chord progression — Wikipedia', url:'https://en.wikipedia.org/wiki/Chord_progression' },
      { label:'Function (music) — Wikipedia', url:'https://en.wikipedia.org/wiki/Function_(music)' },
      { label:'Cadence — Wikipedia', url:'https://en.wikipedia.org/wiki/Cadence' },
    ],
  },
};

// Concept-map node content keyed by topic — real key concepts (label + short note).
const CONCEPT_MAPS = {
  caf:[ {label:'Adenosine',note:'Builds up while awake; signals sleepiness'},{label:'A1 / A2A receptors',note:'Where adenosine binds to slow neurons'},{label:'Antagonist',note:'Caffeine blocks without activating'},{label:'Dopamine',note:'Knock-on alertness boost'},{label:'Tolerance',note:'Brain grows more receptors'},{label:'Withdrawal',note:'Unopposed adenosine → headache'},{label:'Half-life',note:'~5 hours; it lingers into evening'},{label:'Cortisol',note:'Why waking groggy ≠ needing coffee yet'},{label:'Vasoconstriction',note:'Narrows vessels; can ease some headaches'},{label:'Sleep pressure',note:'The sleep drive adenosine builds'},{label:'Caffeine sources',note:'Coffee, tea, cocoa, some sodas'} ],
  doms:[ {label:'DOMS',note:'Soreness peaking 24–72h later'},{label:'Eccentric exercise',note:'Muscle lengthens under load'},{label:'Microtrauma',note:'Tiny damage to fibres & tissue'},{label:'Inflammation',note:'Repair response causes the pain'},{label:'Lactate myth',note:'Cleared within ~1 hour; not the cause'},{label:'Repeated-bout effect',note:'Less sore the second time'},{label:'Recovery',note:'Light movement and time, not more pain'},{label:'Connective tissue',note:'Also strained, not just the muscle'},{label:'Protein synthesis',note:'Rebuilds fibres a little stronger'},{label:'Hydration & sleep',note:'Help speed the repair'} ],
  hic:[ {label:'Diaphragm',note:'Spasms, pulling air in sharply'},{label:'Glottis',note:'Snaps shut to make the “hic”'},{label:'Phrenic nerve',note:'Controls the diaphragm'},{label:'Vagus nerve',note:'Links organs to the brainstem'},{label:'Reflex arc',note:'Involuntary nerve loop'},{label:'Unknown purpose',note:'Maybe an evolutionary leftover'},{label:'Cure logic',note:'Breath-holding raises CO₂ to reset the reflex'},{label:'Singultus',note:'The medical name for hiccups'},{label:'Triggers',note:'Fizzy drinks, big meals, excitement'},{label:'Persistent hiccups',note:'Lasting >48h can signal illness'} ],
  dream:[ {label:'REM sleep',note:'Active brain, still body'},{label:'Memory consolidation',note:'Filing the day’s experiences'},{label:'Emotional processing',note:'Working through feelings'},{label:'Threat simulation',note:'Rehearsing dangers'},{label:'Activation-synthesis',note:'Story from random signals'},{label:'Amygdala',note:'Emotion hub, loud in REM'},{label:'Hippocampus',note:'Replays memories during sleep'},{label:'Lucid dreaming',note:'Aware that you are dreaming'},{label:'Brainstem',note:'Generates the REM signals'},{label:'Nightmares',note:'Fear-laden dreams in REM'},{label:'Dream recall',note:'Fades fast once you wake'} ],
  blush:[ {label:'Vasodilation',note:'Facial vessels widen, redden'},{label:'Sympathetic system',note:'Fight-or-flight drives it'},{label:'Social emotion',note:'Embarrassment, not danger'},{label:'Honest signal',note:'Can’t be faked'},{label:'Appeasement',note:'Signals you know the misstep'},{label:'Darwin’s puzzle',note:'Why advertise embarrassment?'},{label:'Capillaries',note:'Tiny facial vessels that flush red'},{label:'Embarrassment',note:'The classic trigger'},{label:'Adrenaline',note:'Hormone that widens the vessels'},{label:'Erythrophobia',note:'Fear of blushing itself'} ],
  eye:[ {label:'Melanin',note:'The only eye pigment'},{label:'Iris',note:'Colored ring around the pupil'},{label:'Structural color',note:'Blue from scattering, not pigment'},{label:'Rayleigh scattering',note:'Same physics as the blue sky'},{label:'Polygenic (OCA2/HERC2)',note:'Many genes contribute'},{label:'Blue ≠ pigment',note:'No blue pigment exists'},{label:'Tyndall effect',note:'Scattering inside the cloudy iris'},{label:'Melanin amount',note:'More = brown, less = blue or green'},{label:'Stroma',note:'Iris layer that scatters light'},{label:'Heterochromia',note:'Two differently colored eyes'} ],
  micro:[ {label:'Magnetron',note:'Generates the microwaves'},{label:'2.45 GHz',note:'The oven’s wave frequency'},{label:'Water dipole',note:'Polar molecule that rotates'},{label:'Dielectric heating',note:'Rotation = molecular friction = heat'},{label:'Conduction',note:'Finishes thick food slowly'},{label:'Resonance myth',note:'Not “tuned” to water'},{label:'Standing waves',note:'Hot/cold spots; the turntable evens them'},{label:'Penetration depth',note:'Heats only ~1–2 cm in'},{label:'Faraday cage',note:'Mesh door keeps the waves inside'},{label:'Uneven heating',note:'Why we stir and let food rest'},{label:'Microwave band',note:'Part of the radio spectrum'} ],
  gps:[ {label:'Trilateration',note:'Position from distances to points'},{label:'Atomic clock',note:'On each satellite'},{label:'Four satellites',note:'Fix location + receiver clock'},{label:'Special relativity',note:'Motion slows clocks ~7 µs/day'},{label:'General relativity',note:'Weak gravity speeds them ~45 µs/day'},{label:'38 µs/day',note:'~10 km error if uncorrected'},{label:'Receiver',note:'Solves the timing equations for your spot'},{label:'Constellation',note:'~24+ satellites orbiting Earth'},{label:'Signal travel time',note:'Distance = light speed × time'},{label:'Multipath error',note:'Signals bouncing off buildings'} ],
  touch:[ {label:'Capacitance',note:'Charge stored between conductors'},{label:'Projected-capacitive',note:'Electrode grid under glass'},{label:'Indium tin oxide',note:'Transparent + conductive'},{label:'Dielectric',note:'Insulating layer of the capacitor'},{label:'Multi-touch',note:'Per-point sensing across grid'},{label:'Not pressure',note:'Senses conductivity, not force'},{label:'Stylus',note:'Conductive tip mimics a fingertip'},{label:'Mutual capacitance',note:'Sensing at each grid crossing'},{label:'Resistive screen',note:'Older type that needs pressure'},{label:'Palm rejection',note:'Ignoring unintended contact'} ],
  fridge:[ {label:'Refrigerant',note:'Fluid cycling gas↔liquid'},{label:'Compressor',note:'Raises pressure & temperature'},{label:'Condenser',note:'Sheds heat to the room'},{label:'Expansion valve',note:'Pressure drops → cold'},{label:'Evaporator',note:'Absorbs heat from food'},{label:'Second law',note:'Work pays for moving heat uphill'},{label:'Latent heat',note:'Energy moved by changing phase'},{label:'Heat pump',note:'The same cycle run to warm a room'},{label:'Phase change',note:'Boiling and condensing move heat'},{label:'Thermostat',note:'Switches the compressor on and off'},{label:'Insulation',note:'Keeps the cold air in'} ],
  mrna:[ {label:'mRNA',note:'Short-lived protein instructions'},{label:'Spike protein',note:'Harmless viral target piece'},{label:'Antigen',note:'Shape the immune system learns'},{label:'Antibody',note:'Binds the spike'},{label:'Lipid nanoparticle',note:'Protects & delivers the mRNA'},{label:'No DNA change',note:'Never enters the nucleus'},{label:'Cold chain',note:'Kept frozen to protect the mRNA'},{label:'Booster',note:'Re-teaches immunity as it wanes'},{label:'Ribosome',note:'Reads mRNA to build the protein'},{label:'Immune memory',note:'B and T cells that remember'},{label:'mRNA degrades',note:'Broken down within days'} ],
  libatt:[ {label:'Graphite anode',note:'Stores lithium when charged'},{label:'Metal-oxide cathode',note:'Receives ions on discharge'},{label:'Electrolyte',note:'Lets ions drift across'},{label:'Separator',note:'Passes ions, blocks electrons'},{label:'Intercalation',note:'Ions tuck into electrodes'},{label:'Rocking-chair',note:'Ions shuttle back & forth'},{label:'Charge cycle',note:'One full charge then discharge'},{label:'Thermal runaway',note:'Overheating failure to avoid'},{label:'Lithium ions',note:'The charge carriers moving inside'},{label:'Voltage',note:'The push that drives the current'},{label:'Capacity fade',note:'Why batteries weaken with age'} ],
  sky:[ {label:'Rayleigh scattering',note:'Blue scatters most'},{label:'Wavelength',note:'Short = bluer, long = redder'},{label:'1/λ⁴ rule',note:'Halve λ → ~16× scatter'},{label:'Sunset geometry',note:'Long path strips out blue'},{label:'Not ocean reflection',note:'Color is from the air'},{label:'Blue vs violet',note:'Eyes favor blue'},{label:'Atmosphere',note:'Air molecules do the scattering'},{label:'Visible spectrum',note:'Red through violet sunlight'},{label:'Sunlight',note:'White light, all colors mixed'},{label:'Mie scattering',note:'Big particles make clouds white'} ],
  tardi:[ {label:'Cryptobiosis',note:'Paused, near-zero metabolism'},{label:'Anhydrobiosis',note:'The dried-out form'},{label:'CAHS proteins',note:'Form a protective glass'},{label:'Trehalose',note:'Sugar that stabilizes structures'},{label:'Glass state',note:'Cell insides set solid'},{label:'Preconditioning',note:'Must dry slowly to survive'},{label:'Tun state',note:'Curled, barrel-shaped dried form'},{label:'Radiation tolerance',note:'Survives doses that kill most life'},{label:'Extremophile',note:'Thrives where most life cannot'},{label:'Desiccation',note:'Drying out triggers the pause'},{label:'Rehydration',note:'Water revives the animal'} ],
  simpson:[ {label:'Subgroup trend',note:'Pattern within each group'},{label:'Aggregation',note:'Combining the groups'},{label:'Confounding variable',note:'Hidden third factor'},{label:'Reversal',note:'Trend flips when merged'},{label:'Kidney-stone case',note:'Severity was the lurking variable'},{label:'Trust subgroups',note:'Totals can mislead'},{label:'Group weighting',note:'Unequal group sizes skew the total'},{label:'Lurking variable',note:'Another name for the confounder'},{label:'Correlation ≠ causation',note:'Why the reversal misleads'},{label:'Stratification',note:'Analyze each group separately'} ],
  minor:[ {label:'Major triad',note:'1st, 3rd, 5th notes'},{label:'Lowered third',note:'Drop the middle a semitone'},{label:'Semitone',note:'Smallest Western interval'},{label:'Sensory dissonance',note:'Crowded frequencies = tension'},{label:'Tonic',note:'The “home” note'},{label:'Cultural labeling',note:'“Sad” is partly learned'},{label:'Interval',note:'The distance between two notes'},{label:'Major third',note:'The brighter interval it replaces'},{label:'Minor third',note:'Three semitones; the dark color'},{label:'Mode',note:'The scale flavor a chord lives in'} ],
  onion:[ {label:'Sulfur compound',note:'Stored stable in the cell'},{label:'Enzyme',note:'Kept apart until cut'},{label:'Lachrymatory factor',note:'syn-Propanethial-S-oxide'},{label:'Volatile gas',note:'Light, rises to your eyes'},{label:'Tear response',note:'Mild acid → glands flush'},{label:'Defense compound',note:'Onion deters being eaten'},{label:'Cutting tips',note:'Chilling or rinsing cuts the gas'},{label:'Alliinase',note:'The enzyme released by cutting'},{label:'Sulfoxide',note:'Sulfur compound it acts on'},{label:'Cornea',note:'Eye surface the gas irritates'} ],
  bees:[ {label:'Waggle run',note:'Straight middle of the dance'},{label:'Direction',note:'Angle vs. up = angle vs. Sun'},{label:'Distance',note:'Longer waggle = farther'},{label:'Round dance',note:'Food close, no direction'},{label:'Symbolic communication',note:'Signal for something absent'},{label:'von Frisch',note:'Decoded it; 1973 Nobel'},{label:'Forager',note:'Returns to recruit hive-mates'},{label:'Collective choice',note:'The colony decides as a group'},{label:'Waggle angle',note:'Encodes the direction to food'},{label:'Recruitment',note:'More dancing = better food'},{label:'Honeybee',note:'The species that waggles'} ],
  rkings:[ {label:'Republic (res publica)',note:'Government as a \u201cpublic thing,\u201d not a king\u2019s'},{label:'Consuls',note:'Two officials, one-year term, mutual veto'},{label:'Senate',note:'Unelected elite council that dominated policy'},{label:'Patricians vs plebeians',note:'Aristocracy versus the citizen majority'},{label:'Cursus honorum',note:'The fixed ladder of public offices'},{label:'Twelve Tables',note:'Rome\u2019s first written law code'},{label:'Tribunes',note:'Plebeian officials with veto power'},{label:'Praetors',note:'Magistrates who ran the courts'},{label:'Censor',note:'Official of census and morals'},{label:'Conflict of the Orders',note:'Plebeian struggle for rights'} ],
  rlegion:[ {label:'Legion',note:'The main large unit of the army'},{label:'Maniple',note:'A small, flexible unit \u2014 \u201ca handful\u201d'},{label:'Manipular system',note:'Three rotating lines by age & skill'},{label:'Phalanx',note:'The rigid formation it replaced'},{label:'Marian reforms',note:'c. 107 BCE \u2014 a professional army'},{label:'Auxiliaries',note:'Non-citizens who earned citizenship'},{label:'Centurion',note:'Hardened officer leading a century'},{label:'Legionary',note:'The professional foot soldier'},{label:'Cohort',note:'Ten of these made a legion'},{label:'Gladius',note:'The short stabbing sword'} ],
  rrepub:[ {label:'First Triumvirate',note:'Caesar\u2013Pompey\u2013Crassus deal'},{label:'Crossing the Rubicon',note:'Caesar\u2019s 49 BCE march into Italy'},{label:'Dictator',note:'Emergency office turned \u201cfor life\u201d'},{label:'Ides of March',note:'15 March 44 BCE \u2014 the assassination'},{label:'Principate',note:'Augustus\u2019s disguised monarchy'},{label:'Princeps',note:'\u201cFirst citizen\u201d \u2014 his modest title'},{label:'Civil war',note:'Caesar versus Pompey for control'},{label:'Second Triumvirate',note:'Octavian, Antony and Lepidus'},{label:'Optimates vs Populares',note:'Senate elite versus the people'},{label:'Sulla',note:'An earlier dictator and precedent'},{label:'Battle of Actium',note:'31 BCE; Octavian wins it all'} ],
  radmin:[ {label:'Province',note:'Basic unit of conquered territory'},{label:'Romanization',note:'Spread of Roman culture to provincials'},{label:'Citizenship',note:'Prized status carrying legal rights'},{label:'Antonine Constitution',note:'212 CE \u2014 near-universal citizenship'},{label:'Roman roads',note:'Network binding the empire physically'},{label:'Roman law',note:'Bequeathed precedent and lasting ideas'},{label:'Governor',note:'Rome’s official running a province'},{label:'Tribute & taxes',note:'What provinces owed Rome'},{label:'Frontier legions',note:'Held and policed the borders'},{label:'Latin & Greek',note:'The shared languages of empire'} ],
  rsoc:[ {label:'Patricians',note:'The old hereditary aristocracy'},{label:'Plebeians',note:'The ordinary citizen majority'},{label:'Slaves',note:'Legal property, central to the economy'},{label:'Manumission',note:'The freeing of slaves \u2014 a common practice'},{label:'Patron-client system',note:'Web of mutual obligation across ranks'},{label:'Bread and circuses',note:'Free grain & games to keep order'},{label:'Freedmen',note:'Former slaves, now partial citizens'},{label:'Paterfamilias',note:'The household’s ruling father'},{label:'Equites',note:'The wealthy business class'},{label:'Clients',note:'Dependents owing a patron support'} ],
  rfall:[ {label:'476 CE',note:'Conventional (debated) date of the fall'},{label:'Romulus Augustulus',note:'Last western emperor, deposed by Odoacer'},{label:'Adrianople (378)',note:'Catastrophic defeat by the Goths'},{label:'Edward Gibbon',note:'\u201cDecline and Fall\u201d (1776\u201388)'},{label:'Byzantine Empire',note:'The east, ~1,000 more years'},{label:'Transformation thesis',note:'Rome changed rather than simply fell'},{label:'Barbarian migrations',note:'Mounting pressure on the frontiers'},{label:'East–West split',note:'Diocletian divided the empire to rule it'},{label:'Economic decline',note:'Debased coinage and lost trade'},{label:'Overexpansion',note:'Borders too long to defend'},{label:'Sack of Rome (410)',note:'Visigoths breach the city'} ],
  aspec:[ {label:'Spectrum',note:'Light spread out by wavelength'},{label:'Spectroscopy',note:'Analyzing a spectrum to learn its source'},{label:'Absorption line',note:'Dark gap where an element absorbs'},{label:'Emission line',note:'Bright line where an element emits'},{label:'Spectral fingerprint',note:'Each element\u2019s unique line pattern'},{label:'Energy levels',note:'Fixed electron orbits whose jumps make lines'},{label:'Doppler shift',note:'Lines shift with the source’s motion'},{label:'Wavelength',note:'Color position along the spectrum'},{label:'Prism / grating',note:'Splits light into its colors'},{label:'Blackbody',note:'Glow reveals a star’s temperature'} ],
  astars:[ {label:'Nuclear fusion',note:'Merging light nuclei, releasing energy'},{label:'Main sequence',note:'The long, stable hydrogen-fusing phase'},{label:'Hydrostatic balance',note:'Fusion\u2019s push offsets gravity\u2019s pull'},{label:'Red giant',note:'Swollen late stage of a Sun-like star'},{label:'White dwarf',note:'The cooling remnant left behind'},{label:'Supernova',note:'Explosive death of a massive star'},{label:'Protostar',note:'Collapsing cloud before fusion ignites'},{label:'Neutron star',note:'Ultra-dense core left by a big star'},{label:'Nebula',note:'Gas cloud where stars are born'},{label:'Stellar mass',note:'Decides the star’s whole fate'},{label:'Black hole',note:'End of the most massive stars'} ],
  adist:[ {label:'Cosmic distance ladder',note:'Chain of overlapping methods'},{label:'Parallax',note:'Shift of a nearby star as Earth orbits'},{label:'Standard candle',note:'Known true brightness gives distance'},{label:'Inverse-square law',note:'Brightness falls with distance squared'},{label:'Cepheid variable',note:'Period reveals true luminosity'},{label:'Type Ia supernova',note:'Standard candle across the cosmos'},{label:'Light-year',note:'How far light travels in a year'},{label:'Apparent brightness',note:'How bright it merely looks'},{label:'Luminosity',note:'The true energy a star pours out'},{label:'Redshift distance',note:'Far galaxies gauged by redshift'} ],
  aexp:[ {label:'Redshift',note:'Light stretched by expanding space'},{label:'Hubble\u2019s Law',note:'Farther galaxies recede faster'},{label:'Expansion of space',note:'Space itself stretches, no center'},{label:'Big Bang',note:'Hot, dense start ~13.8 billion years ago'},{label:'Cosmic microwave background',note:'Faint afterglow of the early universe'},{label:'Big Bang nucleosynthesis',note:'Early formation of hydrogen & helium'},{label:'Hubble constant',note:'The expansion rate measured today'},{label:'Recession velocity',note:'How fast a galaxy moves away'},{label:'Observable universe',note:'All that we can possibly see'},{label:'Age of the universe',note:'~13.8 billion years'} ],
  abh:[ {label:'Black hole',note:'Gravity lets nothing, not even light, escape'},{label:'Event horizon',note:'The point-of-no-return boundary'},{label:'Singularity',note:'Center where known physics breaks down'},{label:'Escape velocity',note:'Speed needed to break free of gravity'},{label:'Accretion disk',note:'Hot glowing matter we actually observe'},{label:'Gravitational waves',note:'Ripples from black holes merging'},{label:'Schwarzschild radius',note:'Sets the size of the event horizon'},{label:'Hawking radiation',note:'Slow quantum evaporation'},{label:'Stellar black hole',note:'From a collapsed massive star'},{label:'Supermassive black hole',note:'Millions of suns, in galaxy cores'},{label:'Spaghettification',note:'Tidal stretching near one'} ],
  adark:[ {label:'Dark matter',note:'Unseen mass detected only by gravity'},{label:'Galaxy rotation curve',note:'Spin-speed evidence for dark matter'},{label:'Dark energy',note:'Unknown influence accelerating expansion'},{label:'Accelerating expansion',note:'The 1998 supernova discovery'},{label:'Cosmic composition',note:'~5% matter, 27% dark matter, 68% dark energy'},{label:'Gravitational lensing',note:'Light bent by mass, used to map dark matter'},{label:'WIMP',note:'A leading dark-matter candidate particle'},{label:'Gravity',note:'The only way we sense dark matter'},{label:'Cosmic web',note:'Dark-matter scaffolding of galaxies'},{label:'Lambda-CDM',note:'Standard model of the cosmos'} ],
  cell:[ {label:'Mitochondria',note:'Generate ATP via cellular respiration'},{label:'Cell membrane',note:'Selectively permeable barrier'},{label:'Nucleus',note:'Holds DNA; the control centre'},{label:'Ribosomes',note:'Sites of protein synthesis'},{label:'Golgi apparatus',note:'Modifies, sorts & packages proteins'},{label:'Lysosomes',note:'Break down waste & debris'},{label:'Cytoskeleton',note:'Gives shape; enables movement'},{label:'Endoplasmic reticulum',note:'Builds proteins and lipids'},{label:'Chloroplast',note:'Runs photosynthesis in plant cells'},{label:'Cytoplasm',note:'Jelly holding the organelles'},{label:'Vacuole',note:'Storage sac, large in plants'},{label:'Cell wall',note:'Rigid outer layer in plants'} ],
  nn:[ {label:'Perceptron',note:'Weighted sum + threshold'},{label:'Activation function',note:'Adds non-linearity'},{label:'Backpropagation',note:'Gradients via the chain rule'},{label:'ReLU',note:'Avoids vanishing gradients'},{label:'Overfitting',note:'Memorizing, not generalizing'},{label:'Dropout',note:'Randomly disables neurons'},{label:'Epoch',note:'One full pass over the data'},{label:'Weights & biases',note:'The parameters that get learned'},{label:'Neuron',note:'A single computing unit'},{label:'Layer',note:'A stack of neurons'},{label:'Gradient descent',note:'How the weights get tuned'} ],
  cold:[ {label:'Iron Curtain',note:'The divide between East and West'},{label:'Containment',note:'US policy to limit Soviet spread'},{label:'Arms race',note:'The nuclear weapons buildup'},{label:'Proxy wars',note:'Korea, Vietnam, Afghanistan'},{label:'Cuban Missile Crisis',note:'1962 nuclear brink'},{label:'Détente',note:'An easing of tensions'},{label:'Berlin Wall',note:'Built 1961, fell 1989'},{label:'NATO vs Warsaw Pact',note:'The two rival military alliances'},{label:'Marshall Plan',note:'US aid to rebuild Europe'},{label:'Space race',note:'Sputnik to the Moon landing'},{label:'Glasnost & Perestroika',note:'Reforms before the USSR fell'} ],
  indr:[ {label:'Steam engine',note:'Power beyond muscle and water'},{label:'Factory system',note:'Centralized mechanized production'},{label:'Textile mills',note:'Where it began'},{label:'Coal & iron',note:'Fuel and material of industry'},{label:'Railways',note:'Moved goods and people fast'},{label:'Urbanization',note:'Workers crowd into cities'},{label:'Division of labour',note:'Tasks split for efficiency'},{label:'Child labour',note:'A harsh human cost of the mills'},{label:'Mechanization',note:'Machines replace handwork'},{label:'Mass production',note:'Many identical goods, cheaply'},{label:'Labour unions',note:'Workers organize for rights'} ],
  scale:[ {label:'Major scale',note:'Bright, “happy” pattern of steps'},{label:'Minor scale',note:'A darker pattern of steps'},{label:'Mode',note:'A scale starting on a different degree'},{label:'Tonic',note:'The “home” note'},{label:'Interval',note:'The distance between two notes'},{label:'Key signature',note:'Sharps/flats that define the key'},{label:'Octave',note:'Same note at double the frequency'},{label:'Whole & half steps',note:'The building blocks of a scale'},{label:'Pentatonic scale',note:'A common five-note scale'},{label:'Chromatic scale',note:'All twelve semitones'} ],
  gen:[ {label:'Gene',note:'A unit of heredity'},{label:'Allele',note:'A variant form of a gene'},{label:'Dominant & recessive',note:'Which allele shows in the trait'},{label:'Genotype vs phenotype',note:'Genes versus visible traits'},{label:'Mendelian inheritance',note:'How traits pass to offspring'},{label:'Punnett square',note:'Predicts offspring ratios'},{label:'Chromosome',note:'Packaged DNA that carries genes'},{label:'Mutation',note:'A change in the DNA sequence'},{label:'DNA',note:'The molecule genes are written in'},{label:'Homozygous vs heterozygous',note:'Matching vs differing alleles'},{label:'Genetic variation',note:'Differences across a population'} ],
  verb:[ {label:'Infinitive',note:'The base, unconjugated verb'},{label:'Conjugation',note:'Changing a verb by subject & tense'},{label:'Preterite',note:'Completed past actions'},{label:'Imperfect',note:'Ongoing or habitual past'},{label:'Subjunctive',note:'Doubt, wish, emotion'},{label:'Irregular verbs',note:'Forms that break the pattern'},{label:'Reflexive verbs',note:'Action turns back on the subject'},{label:'Tense',note:'When the action happens'},{label:'Mood',note:'Fact, command, or possibility'},{label:'Ser vs estar',note:'Two verbs for “to be”'} ],
  vocab:[ {label:'Directions',note:'Left, right, straight, near'},{label:'At the airport',note:'Gate, boarding, luggage'},{label:'Transport',note:'Bus, train, taxi, ticket'},{label:'Lodging',note:'Hotel, room, reservation'},{label:'Greetings',note:'Hello, please, thank you'},{label:'Numbers',note:'Counting, prices, time'},{label:'Emergencies',note:'Help, doctor, pharmacy'},{label:'Restaurant',note:'Menu, order, the bill'},{label:'Shopping',note:'Size, price, payment'},{label:'Time & dates',note:'Days, hours, the calendar'} ],
  grad:[ {label:'Loss function',note:'What we want to minimize'},{label:'Gradient',note:'Direction of steepest increase'},{label:'Learning rate',note:'The size of each step'},{label:'Local minimum',note:'A valley that may not be lowest'},{label:'Convergence',note:'Settling near a minimum'},{label:'Batch vs stochastic',note:'How much data per step'},{label:'Epoch',note:'One sweep through the dataset'},{label:'Momentum',note:'Smooths and speeds the descent'},{label:'Backpropagation',note:'Computes the gradients'},{label:'Overshooting',note:'Too big a step diverges'},{label:'Global minimum',note:'The truly lowest point'} ],
  chord:[ {label:'Tonic (I)',note:'Home chord, point of rest'},{label:'Dominant (V)',note:'Creates tension toward home'},{label:'Subdominant (IV)',note:'Moves away from home'},{label:'Cadence',note:'A chord pair that ends a phrase'},{label:'Resolution',note:'Tension releasing to the tonic'},{label:'Key',note:'The tonal home of the progression'},{label:'Voice leading',note:'Smooth motion between chords'},{label:'Triad',note:'A basic three-note chord'},{label:'Seventh chord',note:'Adds a fourth, richer note'},{label:'Progression',note:'A sequence of chords'} ],
};

const NOTES = {
  cell:[
    { title:'Lecture 4 — Organelles overview', excerpt:'Mitochondria, ER, Golgi, lysosomes and their roles in the cell…', updated:'2d ago' },
    { title:'Membrane transport notes', excerpt:'Passive vs active transport, osmosis, the sodium-potassium pump…', updated:'3d ago' },
    { title:'Reading: Cell theory', excerpt:'All living things are composed of cells; the cell is the basic unit of life…', updated:'5d ago' },
    { title:'Lab 2 — Microscopy', excerpt:'Observed onion epidermis and cheek cells; sketched the nucleus…', updated:'1w ago' },
  ],
  nn:[
    { title:'Course notes — Forward pass', excerpt:'Inputs × weights + bias, then activation; stacking layers…', updated:'1d ago' },
    { title:'Backprop derivation', excerpt:'Chain rule applied layer by layer; gradient of the loss…', updated:'2d ago' },
    { title:'Reading: Universal approximation', excerpt:'A single hidden layer can approximate any continuous function…', updated:'4d ago' },
  ],
  sky:[
    { title:'Reading — NASA: Why is the sky blue?', excerpt:'White sunlight is a mix of all colours; gas molecules scatter blue most of all…', updated:'1d ago' },
    { title:'Notes — Rayleigh scattering', excerpt:'Intensity ∝ 1/λ⁴; sunsets turn red because of the long atmospheric path…', updated:'3d ago' },
  ],
  onion:[
    { title:'Britannica — Why onions make you cry', excerpt:'Sulfur is stored separately from an enzyme; cutting brings them together…', updated:'2d ago' },
    { title:'ACS — syn-Propanethial-S-oxide', excerpt:'The lachrymatory factor: formula found 1956, structure pinned down 1979…', updated:'5d ago' },
  ],
  rkings:[
    { title:'Britannica — Roman Republic', excerpt:'Tradition dates the Republic to 509 BCE, but the monarchy likely ended through defeat and foreign intervention…', updated:'just now' },
    { title:'World History Encyclopedia — Roman Government', excerpt:'Two consuls replaced the king, supported by praetors and quaestors on the cursus honorum…', updated:'just now' },
    { title:'Wikipedia — Overthrow of the Roman monarchy', excerpt:'The Lucretia–Brutus narrative is dismissed by many modern scholars as largely fictitious…', updated:'just now' },
  ],
  rlegion:[
    { title:'History Skills — How the legions changed', excerpt:'From self-equipping militia to the Marian professional army, with standardized training and kit…', updated:'just now' },
    { title:'Myth and Memory — Roman legion structure', excerpt:'Ten cohorts of six centuries; Rome kept raising armies after Trebia, Trasimene, and Cannae…', updated:'just now' },
    { title:'Kocho-Williams — The manipular formation', excerpt:'“The phalanx had been given joints”; rigid deployment is what ruined the Romans at Cannae…', updated:'just now' },
  ],
  rrepub:[
    { title:'History.com — Caesar’s assassination', excerpt:'The Republic had been declining for decades; the assassins doomed the very thing they meant to save…', updated:'just now' },
    { title:'Wikipedia — Caesar’s civil war', excerpt:'Triggered when the Senate demanded Caesar surrender his army; a common endpoint of the Republic…', updated:'just now' },
    { title:'History.com — Pax Romana', excerpt:'Augustus bought acceptance with peace, a civil service, and competent administration…', updated:'just now' },
  ],
  radmin:[
    { title:'TheCollector — Ruling through provinces', excerpt:'Over 50 provinces by Trajan; roads and baths alongside heavy taxes and conscription…', updated:'just now' },
    { title:'Wikipedia — Local government in ancient Rome', excerpt:'Rome ruled light — self-governing cities ran themselves so the centre didn’t have to…', updated:'just now' },
    { title:'Western Civilization — The Roman Empire', excerpt:'Caracalla extended citizenship in 212 CE; Roman law gave us precedent and lasting principles…', updated:'just now' },
  ],
  rsoc:[
    { title:'Wikipedia — Social class in ancient Rome', excerpt:'Hereditary rank plus the clientela system of patron–client obligation tied society together…', updated:'just now' },
    { title:'Facts and Details — Social classes', excerpt:'Dr Valerie Hope on the free–slave divide — total domination, yet manumission was common…', updated:'just now' },
    { title:'Study.com — Roman plebeians', excerpt:'“Bread and circuses” kept the lower classes fed and entertained — deliberate social management…', updated:'just now' },
  ],
  rfall:[
    { title:'History.com — 8 Reasons Why Rome Fell', excerpt:'Invasions, mercenaries, financial crisis — Gibbon’s Christianity thesis is now widely criticized…', updated:'just now' },
    { title:'World History Encyclopedia — Fall of the West', excerpt:'Historians agree roughly when (476) but argue endlessly why; the fall was only in the west…', updated:'just now' },
    { title:'National Geographic — Why Rome collapsed', excerpt:'Demandt compiled more than two hundred proposed causes — nowhere near consensus…', updated:'just now' },
  ],
  aspec:[
    { title:'OpenStax / Lumen — Spectroscopy in Astronomy', excerpt:'Continuous, emission, or absorption spectra; spectral lines are element fingerprints…', updated:'just now' },
    { title:'Science in School — What are stars made of?', excerpt:'Kirchhoff’s three laws; the whole trick is comparing a star’s lines to lab spectra…', updated:'just now' },
    { title:'Britannica — Stellar spectra', excerpt:'A spectrum encodes temperature, composition, luminosity, even magnetism…', updated:'just now' },
  ],
  astars:[
    { title:'NASA Science — Stars', excerpt:'The main sequence is the long stable middle; a massive star’s iron core collapses into a supernova…', updated:'just now' },
    { title:'EBSCO — Stellar Evolution', excerpt:'Iron is the wall: once a core is iron, energy-releasing fusion stops and collapse follows…', updated:'just now' },
    { title:'NASA Goddard — Life Cycles of Stars', excerpt:'Gravity squeezes the core to ~15 million degrees and fusion ignites — birth has a threshold…', updated:'just now' },
  ],
  adist:[
    { title:'Physics LibreTexts — Parallax & standard candles', excerpt:'Trigonometric parallax, then Cepheids, then Type Ia supernovae — each calibrated by the last…', updated:'just now' },
    { title:'AAVSO — The Cosmic Distance Ladder', excerpt:'Leavitt’s 1908 period–luminosity law turned pulsing stars into measuring sticks…', updated:'just now' },
    { title:'Ohio State — The Cosmic Distance Scale', excerpt:'The ladder escapes the circular problem of needing distance to measure distance…', updated:'just now' },
  ],
  aexp:[
    { title:'NASA — Hubble Cosmological Redshift', excerpt:'Cosmological redshift is space stretching the light, not galaxies simply speeding away…', updated:'just now' },
    { title:'Fiveable — Big Bang & the CMB', excerpt:'Redshift, the 2.7 K microwave background, and light-element abundances all point to a hot start…', updated:'just now' },
    { title:'Magis Center — Evidence for the Big Bang', excerpt:'Lemaître’s math preceded Hubble’s data; the CMB’s 1965 discovery settled the argument…', updated:'just now' },
  ],
  abh:[
    { title:'NASA — Black Holes: Anatomy', excerpt:'We never see the black hole itself, only the glowing matter spiraling in just outside the horizon…', updated:'just now' },
    { title:'University of Chicago — Black holes, explained', excerpt:'Near the singularity we lack a quantum theory of gravity, so we cannot predict what happens…', updated:'just now' },
    { title:'Space.com — The event horizon', excerpt:'For a large black hole a falling observer would cross the horizon without noticing…', updated:'just now' },
  ],
  adark:[
    { title:'NASA — Dark Matter', excerpt:'Ordinary matter is ~5%, dark matter ~27%; it holds galaxies together but does not interact with light…', updated:'just now' },
    { title:'NASA — What is Dark Energy?', excerpt:'Expansion began accelerating ~5 billion years ago, driven by an unknown dark energy…', updated:'just now' },
    { title:'CERN — Dark matter', excerpt:'Galaxies rotate so fast they should tear apart — dark matter is hunted in labs too, not yet caught…', updated:'just now' },
  ],
};
const FALLBACK_NOTES = [
  { title:'Imported note', excerpt:'Synced from your Notion workspace — open to read the full note…', updated:'recently' },
  { title:'Imported note', excerpt:'Highlights and key terms pulled from your source document…', updated:'recently' },
  { title:'Imported note', excerpt:'Captured ideas and references for this topic…', updated:'1w ago' },
];

const REVIEW_QUEUE = [
  { id:'m-caf-sum',    type:'summary', title:'How caffeine wakes you up',         topic:'Caffeine',          accent:ACCENT.clay,  due:'review' },
  { id:'m-bees-deck',  type:'deck',    title:'Waggle dance — key facts',          topic:'Honeybees',         accent:ACCENT.sage,  due:'6 cards' },
  { id:'m-tardi-sum',  type:'summary', title:'How tardigrades survive drying out',topic:'Tardigrades',       accent:ACCENT.blue,  due:'review' },
  { id:'m-simpson-map',type:'map',     title:'Confounding & aggregation',         topic:'Simpson’s Paradox', accent:ACCENT.lilac, due:'revisit' },
  { id:'m-onion-deck', type:'deck',    title:'Onion chemistry — key terms',       topic:'Onion Chemistry',   accent:ACCENT.green, due:'6 cards' },
  { id:'m-indr-deck',  type:'deck',    title:'Inventions & inventors',            topic:'Industrial Revolution', accent:ACCENT.clay, due:'18 cards' },
  { id:'m-rrepub-sum', type:'summary', title:'How the Republic became one-man rule', topic:'Fall of the Republic', accent:ACCENT.clay,  due:'review' },
  { id:'m-aexp-deck',  type:'deck',    title:'The expanding universe — key cards',  topic:'The Expanding Universe', accent:ACCENT.lilac, due:'6 cards' },
];

// Review-completion tracking for the Today queue. Writing here (on finishing a
// deck, or opening a summary/map review) lets Today show that item as completed
// when the user returns. Keyed for "today" so a fresh queue starts uncompleted.
const REVIEW_DONE_KEY = 'pl-review-done';
function getReviewed() { try { return JSON.parse(localStorage.getItem(REVIEW_DONE_KEY) || '[]'); } catch (e) { return []; } }
function setReviewed(ids) { try { localStorage.setItem(REVIEW_DONE_KEY, JSON.stringify(ids)); } catch (e) {} return ids; }
function markReviewed(id) { const a = getReviewed(); if (!a.includes(id)) { a.push(id); setReviewed(a); } return a; }
function toggleReviewed(id) { const a = getReviewed(); return setReviewed(a.includes(id) ? a.filter((x) => x !== id) : [...a, id]); }

const ACTIVITY = [
  { kind:'gen',    accent:ACCENT.clay,  text:'Imported report: 6 Ancient Rome Deep-Dives', meta:'Ancient Rome · just now', nav:{type:'topic', id:'rrepub'} },
  { kind:'gen',    accent:ACCENT.lilac, text:'Generated 18 materials from Astronomy Deep-Dives', meta:'Astronomy · just now', nav:{type:'material', id:'m-adark-sum'} },
  { kind:'sync',   accent:ACCENT.blue,  text:'4 notes synced from Notion',          meta:'Cell Biology · 12m ago', nav:{type:'topic', id:'cell'} },
  { kind:'gen',    accent:ACCENT.green, text:'Generated flashcard deck (8 cards)',  meta:'Cell Biology · 2d ago', nav:{type:'material', id:'m-cell-deck'} },
  { kind:'review', accent:ACCENT.lilac, text:'Reviewed “Preterite vs. imperfect”',  meta:'Verb Conjugation · 2d ago', nav:{type:'material', id:'m-verb-deck'} },
  { kind:'gen',    accent:'#8B53C0',    text:'Generated concept map',               meta:'The Cold War · 6h ago', nav:{type:'material', id:'m-cold-map'} },
  { kind:'sync',   accent:ACCENT.blue,  text:'2 notes synced from Notion',          meta:'Neural Networks · 1d ago', nav:{type:'topic', id:'nn'} },
  { kind:'gen',    accent:ACCENT.blue,  text:'Generated summary: Why the sky is blue', meta:'Everyday Science · 1h ago', nav:{type:'material', id:'m-sky-sum'} },
  { kind:'sync',   accent:ACCENT.blue,  text:'2 notes synced from Notion',          meta:'Onion Chemistry · 4h ago', nav:{type:'topic', id:'onion'} },
];

const NOTIFS = [
  { accent:ACCENT.lilac, text:'Priya nudged you — get a little learning in today', meta:'Priya Raman · just now', unread:true, nav:{type:'route', route:'today'} },
  { accent:ACCENT.green, text:'8 cards are due for review today',              meta:'Cell Biology · now',     unread:true,  nav:{type:'route', route:'today'} },
  { accent:ACCENT.blue,  text:'Notion sync finished — 4 new notes',            meta:'Cell Biology · 12m ago', unread:true,  nav:{type:'topic', id:'cell'} },
  { accent:'#8B53C0',    text:'Concept map ready: Alliances & proxy conflicts', meta:'The Cold War · 6h ago',  unread:true,  nav:{type:'material', id:'m-cold-map'} },
  { accent:ACCENT.clay,  text:'You hit a 7-day streak. Keep it going.',        meta:'Yesterday',              unread:false, nav:{type:'route', route:'today'} },
  { accent:ACCENT.blue,  text:'New deck ready: Rayleigh scattering',           meta:'The Blue Sky · 1h ago',  unread:true,  nav:{type:'material', id:'m-sky-deck'} },
];

const NAV = [
  { id:'map',       label:'Learning map',   icon:'home' },
  { id:'today',     label:'Today',          icon:'sparkles' },
  { id:'topics',    label:'My Collection',  icon:'layers' },
  { id:'materials', label:'Study materials',icon:'cards' },
  { id:'ideas',     label:'Ideas',          icon:'lightbulb' },
  { id:'friends',   label:'Friends',        icon:'users' },
  { id:'rocky',     label:'Ask Rocky',      icon:'message' },
];

// helpers
const topicById   = id => TOPICS.find(t => t.id === id);
const initialsOf  = n => (n||'').trim().split(/\s+/).map(w => w[0]).slice(0,2).join('').toUpperCase() || 'A';
const domainById  = id => DOMAINS.find(d => d.id === id);
const topicsOf    = dom => TOPICS.filter(t => t.domain === dom);
const materialsOf = top => MATERIALS.filter(m => m.topic === top);
const matMeta     = m => MAT_TYPE[m.type];

// global search across domains, topics, materials, notes
function searchAll(q) {
  q = (q || '').trim().toLowerCase();
  if (!q) return [];
  const res = [];
  DOMAINS.forEach(d => { if (d.name.toLowerCase().includes(q)) res.push({ kind:'domain', id:d.id, title:d.name, sub:'Domain', accent:d.accent }); });
  TOPICS.forEach(t => { const dom = domainById(t.domain);
    if (t.name.toLowerCase().includes(q) || dom.name.toLowerCase().includes(q))
      res.push({ kind:'topic', id:t.id, title:t.name, sub:dom.name + ' · Topic', accent:dom.accent }); });
  MATERIALS.forEach(m => { const top = topicById(m.topic);
    if (m.title.toLowerCase().includes(q) || (top && top.name.toLowerCase().includes(q)))
      res.push({ kind:'material', id:m.id, title:m.title, sub:MAT_TYPE[m.type].label + (top ? ' · ' + top.name : ''), accent:MAT_TYPE[m.type].tint }); });
  Object.entries(NOTES).forEach(([tid, arr]) => arr.forEach(n => {
    if (n.title.toLowerCase().includes(q) || n.excerpt.toLowerCase().includes(q)) {
      const top = topicById(tid);
      res.push({ kind:'note', id:tid, title:n.title, sub:'Note · ' + (top ? top.name : '') });
    }
  }));
  return res.slice(0, 14);
}

Object.assign(window, {
  ACCENT, ACCENTS, DOMAINS, TOPICS, MAT_TYPE, MATERIALS, FLASHCARDS, FALLBACK_DECK,
  NOTES, FALLBACK_NOTES, REVIEW_QUEUE, ACTIVITY, NOTIFS, NAV, searchAll, SUMMARIES, CONCEPT_MAPS,
  topicById, domainById, topicsOf, materialsOf, matMeta, initialsOf,
  getReviewed, setReviewed, markReviewed, toggleReviewed,
});
