{"id":"4YrMd4eA53","url":"https://pastebin.ca/4YrMd4eA53","raw_url":"https://raw.anybin.ca/4YrMd4eA53","visibility":"public","access":"public","created_at":1795475775923,"expires_at":1796080575923,"fetch_limit":null,"fetches_used":0,"reads_remaining":null,"size_bytes":59794,"syntax_hint":null,"title":null,"filename":null,"change_note":null,"cipher":null,"cipher_meta":null,"parent_id":null,"root_id":"4YrMd4eA53","version":1,"owner_id":null,"recipient_id":null,"body":"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<title>Post-Sumerian Biopolitical, Plague &amp; IVC Reference Atlas (2004 BCE – 642 CE)</title>\n<style>\n  :root {\n    --bg: #0b0e14;\n    --panel: #131822;\n    --panel-border: #252e42;\n    --text: #e6ecf5;\n    --muted: #8b98b0;\n    --accent: #f59e0b;\n    --accent-soft: rgba(245, 158, 11, 0.16);\n    --plague: #f43f5e;\n    --cattle: #eab308;\n    --pregnancy: #d946ef;\n    --cyan: #38bdf8;\n    --emerald: #10b981;\n  }\n  * { box-sizing: border-box; margin: 0; padding: 0; }\n  body {\n    background: var(--bg);\n    color: var(--text);\n    font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Inter, sans-serif;\n    display: flex;\n    flex-direction: column;\n    height: 100vh;\n    overflow: hidden;\n  }\n  header {\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n    padding: 9px 16px;\n    background: var(--panel);\n    border-bottom: 1px solid var(--panel-border);\n    gap: 10px;\n    flex-wrap: wrap;\n  }\n  .title-block h1 {\n    font-size: 14.5px;\n    font-weight: 700;\n    letter-spacing: 0.3px;\n    color: #fff;\n  }\n  .title-block p {\n    font-size: 11px;\n    color: var(--muted);\n    margin-top: 2px;\n  }\n  .controls {\n    display: flex;\n    align-items: center;\n    gap: 7px;\n    flex-wrap: wrap;\n  }\n  button {\n    background: #1c2434;\n    color: var(--text);\n    border: 1px solid var(--panel-border);\n    padding: 5px 10px;\n    border-radius: 6px;\n    font-size: 11.5px;\n    font-weight: 600;\n    cursor: pointer;\n    transition: all 0.15s ease;\n  }\n  button:hover { background: #263147; border-color: #3b4a69; }\n  button.primary {\n    background: var(--accent);\n    color: #0b0e14;\n    border-color: var(--accent);\n  }\n  button.primary:hover { background: #fbbf24; }\n  .filter-bar {\n    display: flex;\n    align-items: center;\n    background: #0f141d;\n    border: 1px solid var(--panel-border);\n    border-radius: 6px;\n    padding: 2px;\n    gap: 2px;\n  }\n  .filter-btn {\n    border: none;\n    background: transparent;\n    padding: 4px 8px;\n    border-radius: 4px;\n    font-size: 11px;\n    color: var(--muted);\n  }\n  .filter-btn.active {\n    background: #232d42;\n    color: #fff;\n  }\n  .filter-btn.f-plague.active { background: rgba(244, 63, 94, 0.22); color: #fda4af; border: 1px solid rgba(244,63,94,0.45); }\n  .filter-btn.f-cattle.active { background: rgba(234, 179, 8, 0.22); color: #fde047; border: 1px solid rgba(234,179,8,0.45); }\n  .filter-btn.f-preg.active { background: rgba(217, 70, 239, 0.22); color: #f0abfc; border: 1px solid rgba(217,70,239,0.45); }\n  .zoom-group {\n    display: flex;\n    align-items: center;\n    background: #161c28;\n    border: 1px solid var(--panel-border);\n    border-radius: 6px;\n    overflow: hidden;\n  }\n  .zoom-group button {\n    border: none;\n    border-radius: 0;\n    padding: 5px 9px;\n    font-size: 12.5px;\n  }\n  .zoom-label {\n    padding: 0 7px;\n    font-size: 11px;\n    color: var(--muted);\n    font-variant-numeric: tabular-nums;\n  }\n  main {\n    display: grid;\n    grid-template-columns: 1fr 385px;\n    flex: 1;\n    min-height: 0;\n  }\n  .map-wrap {\n    position: relative;\n    width: 100%;\n    height: 100%;\n    background: #070b12;\n    overflow: hidden;\n    cursor: grab;\n  }\n  .map-wrap:active { cursor: grabbing; }\n  canvas {\n    display: block;\n    width: 100%;\n    height: 100%;\n  }\n  .hud-top-left {\n    position: absolute;\n    top: 12px;\n    left: 12px;\n    background: rgba(13, 18, 28, 0.9);\n    backdrop-filter: blur(8px);\n    border: 1px solid var(--panel-border);\n    border-radius: 8px;\n    padding: 9px 12px;\n    pointer-events: none;\n    max-width: 365px;\n  }\n  .epoch-badge {\n    display: inline-block;\n    font-size: 11px;\n    font-weight: 700;\n    color: var(--accent);\n    background: var(--accent-soft);\n    padding: 2px 7px;\n    border-radius: 4px;\n    margin-bottom: 4px;\n    letter-spacing: 0.4px;\n  }\n  .epoch-title {\n    font-size: 13.5px;\n    font-weight: 700;\n    color: #fff;\n  }\n  .map-tooltip {\n    position: absolute;\n    display: none;\n    background: rgba(11, 14, 20, 0.96);\n    border: 1px solid var(--accent);\n    border-radius: 7px;\n    padding: 9px 11px;\n    max-width: 285px;\n    font-size: 11.5px;\n    line-height: 1.42;\n    color: #e2e8f0;\n    pointer-events: none;\n    z-index: 20;\n    box-shadow: 0 8px 24px rgba(0,0,0,0.65);\n  }\n  .map-tooltip .tt-head {\n    font-weight: 700;\n    font-size: 11px;\n    text-transform: uppercase;\n    letter-spacing: 0.5px;\n    margin-bottom: 3px;\n  }\n  .hud-hint {\n    position: absolute;\n    bottom: 12px;\n    left: 12px;\n    background: rgba(13, 18, 28, 0.85);\n    border: 1px solid var(--panel-border);\n    border-radius: 6px;\n    padding: 5px 10px;\n    font-size: 11px;\n    color: var(--muted);\n    pointer-events: none;\n  }\n  .sidebar {\n    background: var(--panel);\n    border-left: 1px solid var(--panel-border);\n    display: flex;\n    flex-direction: column;\n    overflow-y: auto;\n    padding: 12px;\n    gap: 11px;\n  }\n  .card {\n    background: #0f141d;\n    border: 1px solid var(--panel-border);\n    border-radius: 8px;\n    padding: 10px 11px;\n  }\n  .card h3 {\n    font-size: 11px;\n    text-transform: uppercase;\n    letter-spacing: 0.7px;\n    color: var(--muted);\n    margin-bottom: 7px;\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n  }\n  .ivc-box {\n    background: rgba(16, 185, 129, 0.09);\n    border: 1px solid rgba(16, 185, 129, 0.35);\n    border-left: 3px solid #10b981;\n    border-radius: 6px;\n    padding: 8px 9px;\n    font-size: 11.5px;\n    line-height: 1.44;\n    color: #d1fae5;\n  }\n  .ivc-box strong { color: #6ee7b7; }\n  .narrative {\n    font-size: 12px;\n    line-height: 1.5;\n    color: #d5deed;\n  }\n  .narrative strong { color: #fff; }\n  .bio-list, .verb-list {\n    display: flex;\n    flex-direction: column;\n    gap: 6px;\n    font-size: 11.5px;\n  }\n  .bio-card {\n    padding: 7px 9px;\n    border-radius: 6px;\n    background: #141b27;\n    border-left: 3px solid var(--plague);\n    line-height: 1.4;\n  }\n  .bio-card.plague { border-left-color: var(--plague); background: rgba(244, 63, 94, 0.08); }\n  .bio-card.cattle { border-left-color: var(--cattle); background: rgba(234, 179, 8, 0.08); }\n  .bio-card.pregnancy { border-left-color: var(--pregnancy); background: rgba(217, 70, 239, 0.08); }\n  .bio-head {\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n    font-weight: 700;\n    font-size: 10.5px;\n    text-transform: uppercase;\n    letter-spacing: 0.45px;\n    margin-bottom: 3px;\n  }\n  .bio-card.plague .bio-head { color: #fda4af; }\n  .bio-card.cattle .bio-head { color: #fde047; }\n  .bio-card.pregnancy .bio-head { color: #f0abfc; }\n  .bio-loc {\n    font-size: 10px;\n    color: var(--muted);\n    font-weight: 600;\n  }\n  .verb-pill {\n    padding: 6px 8px;\n    border-radius: 6px;\n    background: #151c29;\n    border-left: 3px solid var(--accent);\n    line-height: 1.38;\n  }\n  .verb-pill span.vtag {\n    font-weight: 700;\n    font-size: 10px;\n    text-transform: uppercase;\n    letter-spacing: 0.5px;\n    display: block;\n    margin-bottom: 2px;\n  }\n  .toggle-list {\n    display: flex;\n    flex-direction: column;\n    gap: 5px;\n  }\n  .toggle-item {\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    font-size: 11.5px;\n    color: #d5deed;\n    cursor: pointer;\n    padding: 3px 5px;\n    border-radius: 5px;\n  }\n  .toggle-item:hover { background: rgba(255,255,255,0.05); }\n  .toggle-left {\n    display: flex;\n    align-items: center;\n    gap: 7px;\n  }\n  .swatch {\n    width: 10px;\n    height: 10px;\n    border-radius: 3px;\n    display: inline-block;\n  }\n  footer {\n    background: var(--panel);\n    border-top: 1px solid var(--panel-border);\n    padding: 8px 16px 10px;\n  }\n  .timeline-track-wrap {\n    position: relative;\n    margin-bottom: 7px;\n  }\n  .timeline-pips {\n    display: grid;\n    grid-template-columns: repeat(6, 1fr);\n    gap: 6px;\n    margin-bottom: 4px;\n    padding: 0 54px;\n  }\n  .pip-cluster {\n    display: flex;\n    justify-content: center;\n    gap: 4px;\n    font-size: 10px;\n  }\n  .pip {\n    padding: 1px 5px;\n    border-radius: 10px;\n    font-weight: 700;\n    cursor: pointer;\n    border: 1px solid transparent;\n  }\n  .pip.plague { background: rgba(244,63,94,0.2); color: #fda4af; border-color: rgba(244,63,94,0.4); }\n  .pip.cattle { background: rgba(234,179,8,0.2); color: #fde047; border-color: rgba(234,179,8,0.4); }\n  .pip.pregnancy { background: rgba(217,70,239,0.2); color: #f0abfc; border-color: rgba(217,70,239,0.4); }\n  .timeline-row {\n    display: flex;\n    align-items: center;\n    gap: 10px;\n  }\n  input[type=\"range\"] {\n    flex: 1;\n    accent-color: var(--accent);\n    cursor: pointer;\n    height: 6px;\n  }\n  .stage-buttons {\n    display: grid;\n    grid-template-columns: repeat(6, 1fr);\n    gap: 6px;\n  }\n  .stage-btn {\n    text-align: left;\n    padding: 5px 7px;\n    background: #0f141d;\n    border: 1px solid var(--panel-border);\n    border-radius: 6px;\n    font-size: 11px;\n  }\n  .stage-btn.active {\n    border-color: var(--accent);\n    background: var(--accent-soft);\n  }\n  .stage-btn .yr {\n    display: block;\n    font-weight: 700;\n    color: var(--accent);\n    font-size: 11px;\n  }\n  .stage-btn .lbl {\n    display: block;\n    color: var(--text);\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n    margin-top: 1px;\n  }\n  @media (max-width: 980px) {\n    main { grid-template-columns: 1fr; grid-template-rows: 54vh 1fr; }\n    .stage-buttons, .timeline-pips { grid-template-columns: repeat(3, 1fr); padding: 0; }\n  }\n</style>\n</head>\n<body>\n\n<header>\n  <div class=\"title-block\">\n    <h1>Post-Sumerian Biopolitical, Plague &amp; Static IVC Reference Atlas</h1>\n    <p>Static IVC Zone (c. 3300–1300 BCE) · Geographic coastline &amp; modern borders · Dynamic post-Sumerian polygons &amp; bio-shocks</p>\n  </div>\n  <div class=\"controls\">\n    <button id=\"playBtn\" class=\"primary\">▶ Play Timeline</button>\n    <div class=\"filter-bar\" title=\"Highlight specific biological attrition vectors\">\n      <button class=\"filter-btn active\" data-filter=\"all\">All Bio-Shocks</button>\n      <button class=\"filter-btn f-plague\" data-filter=\"plague\">☠ Plagues</button>\n      <button class=\"filter-btn f-cattle\" data-filter=\"cattle\">🐂 Cattle Death</button>\n      <button class=\"filter-btn f-preg\" data-filter=\"pregnancy\">🧬 Pregnancy Failures</button>\n    </div>\n    <div class=\"zoom-group\">\n      <button id=\"zoomOutBtn\" title=\"Zoom Out\">−</button>\n      <span class=\"zoom-label\" id=\"zoomLabel\">0.85×</span>\n      <button id=\"zoomInBtn\" title=\"Zoom In\">+</button>\n      <button id=\"resetViewBtn\" title=\"Reset View\">Reset</button>\n    </div>\n    <button id=\"macroBtn\" title=\"Zoom out to full Nile–IVC–Steppe view\">Macro View</button>\n  </div>\n</header>\n\n<main>\n  <div class=\"map-wrap\" id=\"mapWrap\">\n    <canvas id=\"mapCanvas\"></canvas>\n    <div class=\"hud-top-left\">\n      <div class=\"epoch-badge\" id=\"hudYear\">2004 BCE</div>\n      <div class=\"epoch-title\" id=\"hudTitle\">Elam Sacks Ur &amp; Audits the Ghee Ledger</div>\n    </div>\n    <div class=\"map-tooltip\" id=\"mapTooltip\"></div>\n    <div class=\"hud-hint\">Static Green Zone = Indus Valley Civilization (3300–1300 BCE) · Scroll to zoom · Drag to pan</div>\n  </div>\n\n  <aside class=\"sidebar\">\n    <div class=\"card\">\n      <h3>\n        <span>Static Reference: Indus Valley Zone</span>\n        <span style=\"color:#34d399;font-weight:700\">3300–1300 BCE</span>\n      </h3>\n      <div class=\"ivc-box\">\n        <strong>When:</strong> Early Harappan <strong>c. 3300–2600 BCE</strong> · Mature Urban Phase <strong>2600–1900 BCE</strong> (contemporary with Sumer Ur III &amp; Elam) · Late Harappan <strong>1900–1300 BCE</strong>.<br>\n        <strong>Where:</strong> Indus &amp; Ghaggar-Hakra basins across modern <strong>Pakistan, NW India &amp; NE Afghanistan</strong>—from <em>Sutkagen Dor</em> (Makran coast) and <em>Dholavira/Lothal</em> (Gujarat) north to <em>Harappa, Rakhigarhi, Manda</em> &amp; <em>Shortugai</em>.\n      </div>\n    </div>\n\n    <div class=\"card\">\n      <h3>\n        <span>Plague, Cattle &amp; Gestational Ledger</span>\n        <span id=\"bioCountBadge\" style=\"color:var(--accent)\">3 Active</span>\n      </h3>\n      <div class=\"bio-list\" id=\"bioList\"></div>\n    </div>\n\n    <div class=\"card\">\n      <h3>Epoch Geopolitical &amp; Forensic Brief</h3>\n      <div class=\"narrative\" id=\"epochNarrative\"></div>\n    </div>\n\n    <div class=\"card\">\n      <h3>Spatial Action Verbs &amp; Vectors</h3>\n      <div class=\"verb-list\" id=\"verbList\"></div>\n    </div>\n\n    <div class=\"card\">\n      <h3>Map &amp; Overlay Layers</h3>\n      <div class=\"toggle-list\">\n        <label class=\"toggle-item\">\n          <span class=\"toggle-left\"><span class=\"swatch\" style=\"background:rgba(16,185,129,0.5);border:1px solid #10b981\"></span>Static IVC Zone (3300–1300 BCE)</span>\n          <input type=\"checkbox\" id=\"chkIVC\" checked>\n        </label>\n        <label class=\"toggle-item\">\n          <span class=\"toggle-left\"><span class=\"swatch\" style=\"background:#f43f5e\"></span>Bio-Shock Hazard Rings (Plague / Cattle / Gestation)</span>\n          <input type=\"checkbox\" id=\"chkBio\" checked>\n        </label>\n        <label class=\"toggle-item\">\n          <span class=\"toggle-left\"><span class=\"swatch\" style=\"background:#334155;border:1px solid #64748b\"></span>Modern Country Borders &amp; Labels</span>\n          <input type=\"checkbox\" id=\"chkBorders\" checked>\n        </label>\n        <label class=\"toggle-item\">\n          <span class=\"toggle-left\"><span class=\"swatch\" style=\"background:#1e293b\"></span>Mountain Relief (Zagros, Taurus, Hindu Kush)</span>\n          <input type=\"checkbox\" id=\"chkTerrain\" checked>\n        </label>\n        <label class=\"toggle-item\">\n          <span class=\"toggle-left\"><span class=\"swatch\" style=\"background:#38bdf8\"></span>Major Rivers (Nile, Tigris, Euphrates, Indus, Hakra)</span>\n          <input type=\"checkbox\" id=\"chkRivers\" checked>\n        </label>\n        <label class=\"toggle-item\">\n          <span class=\"toggle-left\"><span class=\"swatch\" style=\"background:#f59e0b\"></span>Dynamic Empire Polygons</span>\n          <input type=\"checkbox\" id=\"chkPolygons\" checked>\n        </label>\n        <label class=\"toggle-item\">\n          <span class=\"toggle-left\"><span class=\"swatch\" style=\"background:#ef4444\"></span>Action Vectors (Sack, Audit, Shield, Ration)</span>\n          <input type=\"checkbox\" id=\"chkVectors\" checked>\n        </label>\n        <label class=\"toggle-item\">\n          <span class=\"toggle-left\"><span class=\"swatch\" style=\"background:#e2e8f0\"></span>Ancient Cities &amp; Modern Capitals</span>\n          <input type=\"checkbox\" id=\"chkCities\" checked>\n        </label>\n      </div>\n    </div>\n  </aside>\n</main>\n\n<footer>\n  <div class=\"timeline-track-wrap\">\n    <div class=\"timeline-pips\" id=\"timelinePips\"></div>\n    <div class=\"timeline-row\">\n      <span style=\"font-size:11px;color:var(--muted);font-weight:700;min-width:64px;\">2004 BCE</span>\n      <input type=\"range\" id=\"timeSlider\" min=\"0\" max=\"500\" value=\"0\">\n      <span style=\"font-size:11px;color:var(--muted);font-weight:700;min-width:54px;text-align:right;\">642 CE</span>\n    </div>\n  </div>\n  <div class=\"stage-buttons\" id=\"stageButtons\"></div>\n</footer>\n\n<script>\nconst canvas = document.getElementById('mapCanvas');\nconst ctx = canvas.getContext('2d');\nconst mapWrap = document.getElementById('mapWrap');\nconst tooltipEl = document.getElementById('mapTooltip');\n\n// Extended eastward to 78E so the entire IVC (Rakhigarhi, Lothal, Harappa, Shortugai) fits cleanly\nconst GEO = { minLon: 22, maxLon: 78, minLat: 11, maxLat: 43 };\n\nlet cam = {\n  zoom: 0.88,\n  panX: 0,\n  panY: 0,\n  dragging: false,\n  lastX: 0,\n  lastY: 0,\n  mouseX: -1000,\n  mouseY: -1000\n};\n\nlet activeBioFilter = 'all';\nlet screenBioNodes = [];\n\nconst LANDMASSES = [\n  [\n    [22.0, 32.8], [25.2, 31.6], [27.5, 31.2], [29.9, 31.2], [31.9, 31.5],\n    [32.4, 30.0], [33.8, 28.0], [34.5, 29.5], [34.9, 28.5], [35.6, 26.0],\n    [37.2, 24.0], [39.1, 21.5], [41.2, 18.0], [42.8, 15.0], [43.4, 12.6],\n    [45.0, 12.8], [48.5, 14.0], [51.2, 15.2], [54.0, 16.9], [56.5, 18.5],\n    [58.8, 20.5], [59.8, 22.5], [58.5, 23.6], [56.4, 25.0], [56.2, 26.3],\n    [55.2, 25.2], [54.0, 24.2], [51.6, 24.1], [51.5, 25.9], [50.8, 25.8],\n    [50.1, 26.5], [49.5, 27.5], [48.2, 29.4], [48.0, 30.0], [48.8, 30.1],\n    [49.8, 29.5], [50.8, 28.8], [52.5, 27.5], [54.8, 26.6], [56.3, 27.1],\n    [57.2, 25.8], [60.5, 25.3], [63.5, 25.2], [66.8, 24.8], [68.2, 23.8],\n    [69.0, 22.4], [70.2, 22.5], [72.2, 21.6], [72.8, 22.3], [72.8, 20.5],\n    [74.5, 18.0], [78.0, 18.0], [78.0, 43.0], [54.0, 43.0],\n    [53.2, 41.5], [53.8, 39.5], [53.9, 37.2], [51.5, 36.7], [49.2, 37.5],\n    [48.8, 39.2], [49.8, 40.4], [48.5, 42.0], [47.5, 43.0], [41.5, 43.0],\n    [41.6, 41.6], [39.5, 41.0], [36.5, 41.3], [35.0, 42.0], [32.0, 41.5],\n    [29.0, 41.2], [26.5, 40.5], [26.2, 39.2], [27.0, 37.5], [27.5, 36.7],\n    [30.5, 36.8], [32.5, 36.2], [34.8, 36.8], [36.0, 36.8], [35.8, 35.5],\n    [35.5, 33.9], [35.0, 32.8], [34.6, 31.5], [34.2, 31.2], [32.4, 31.3],\n    [31.5, 31.5], [30.0, 31.2], [27.0, 31.4], [24.0, 32.1], [22.0, 32.8]\n  ],\n  [[32.3, 35.1], [33.0, 35.4], [34.5, 35.6], [33.9, 35.0], [33.0, 34.7], [32.4, 34.9]],\n  [[23.5, 35.5], [26.2, 35.3], [26.1, 35.0], [23.6, 35.2]]\n];\n\n// Static Indus Valley Civilization (IVC) Geographic Polygon (c. 3300–1300 BCE; Mature 2600–1900 BCE)\nconst IVC_STATIC_ZONE = {\n  name: 'INDUS VALLEY CIVILIZATION (IVC)',\n  span: 'c. 3300–1300 BCE (Mature: 2600–1900 BCE)',\n  pts: [\n    [61.8, 25.2], // Sutkagen Dor (Makran coast)\n    [65.5, 28.8], // Mehrgarh / Bolan Pass\n    [69.8, 33.8], // Taxila / Bannu northern fringe\n    [70.3, 36.9], // Shortugai (Oxus / Badakhshan outpost)\n    [74.7, 32.9], // Manda (Jammu / Chenab foothills)\n    [76.6, 30.9], // Ropar (Sutlej)\n    [77.4, 29.2], // Alamgirpur (Upper Yamuna–Ganga Doab)\n    [76.1, 29.3], // Rakhigarhi (Haryana)\n    [74.2, 29.4], // Kalibangan (Ghaggar-Hakra)\n    [72.3, 23.0], // Lothal (Gulf of Khambhat, Gujarat)\n    [70.2, 23.9], // Dholavira (Rann of Kutch)\n    [68.1, 24.2], // Indus Delta / Allahdino\n    [66.5, 25.0]  // Balakot / Sonmiani\n  ]\n};\n\nconst MODERN_BORDERS = [\n  [[25.0, 31.6], [25.0, 22.0]],\n  [[22.0, 22.0], [36.8, 22.0]],\n  [[34.2, 31.2], [34.9, 29.5]],\n  [[35.6, 33.2], [35.5, 31.2], [35.0, 29.5]],\n  [[35.9, 34.6], [36.5, 34.2], [35.8, 33.3]],\n  [[36.0, 36.8], [38.0, 36.9], [40.5, 37.1], [42.3, 37.1]],\n  [[42.3, 37.1], [41.2, 35.0], [38.8, 33.3]],\n  [[35.8, 32.7], [37.0, 32.3], [38.8, 33.3]],\n  [[35.0, 29.5], [36.2, 29.2], [38.0, 30.0], [37.5, 31.5], [39.0, 32.1]],\n  [[39.0, 32.1], [41.5, 31.2], [44.5, 29.2], [46.5, 29.1], [47.7, 30.0]],\n  [[46.5, 29.1], [47.7, 30.0], [48.0, 29.1], [47.4, 28.5], [46.5, 29.1]],\n  [[42.3, 37.1], [43.5, 37.3], [44.8, 37.1]],\n  [[44.8, 37.1], [45.8, 35.5], [45.5, 34.0], [46.2, 33.0], [47.7, 31.0], [48.0, 30.0]],\n  [[42.8, 16.4], [45.0, 17.4], [48.0, 18.2], [52.0, 19.0], [53.1, 16.6]],\n  [[53.1, 16.6], [55.0, 20.0], [55.2, 22.6], [56.0, 24.2]],\n  [[51.6, 24.1], [54.0, 22.8], [55.2, 22.6], [56.3, 25.0]],\n  [[54.0, 37.9], [58.5, 37.5], [61.2, 35.6], [60.6, 33.5], [60.9, 31.5], [61.8, 29.8], [63.2, 27.2], [61.5, 25.2]],\n  [[61.8, 29.8], [66.3, 30.0], [69.3, 32.0], [70.0, 34.0], [71.5, 36.8]],\n  [[68.2, 23.8], [71.0, 24.5], [70.5, 26.8], [73.8, 29.8], [74.5, 32.5]]\n];\n\nconst COUNTRY_LABELS = [\n  { name: 'EGYPT', lon: 29.2, lat: 26.8 },\n  { name: 'SAUDI ARABIA', lon: 44.2, lat: 23.8 },\n  { name: 'YEMEN', lon: 47.5, lat: 15.5 },\n  { name: 'OMAN', lon: 56.8, lat: 21.2 },\n  { name: 'IRAQ', lon: 43.3, lat: 33.0 },\n  { name: 'SYRIA', lon: 38.4, lat: 35.0 },\n  { name: 'JORDAN', lon: 36.7, lat: 31.0 },\n  { name: 'TURKEY', lon: 34.5, lat: 39.0 },\n  { name: 'IRAN', lon: 53.8, lat: 32.6 },\n  { name: 'AFGHANISTAN', lon: 65.5, lat: 33.8 },\n  { name: 'PAKISTAN', lon: 67.5, lat: 29.6 },\n  { name: 'INDIA', lon: 75.5, lat: 24.5 }\n];\n\nconst RIVERS = [\n  { name: 'Nile', pts: [[31.2, 31.4], [31.2, 30.0], [31.0, 28.0], [32.6, 25.7], [32.9, 24.1], [31.5, 22.0]], dash: [] },\n  { name: 'Euphrates', pts: [[39.0, 38.5], [38.0, 36.8], [39.0, 35.9], [40.5, 35.0], [42.5, 34.1], [44.4, 32.5], [46.0, 31.0], [47.4, 31.0], [48.0, 30.0]], dash: [] },\n  { name: 'Tigris', pts: [[40.2, 37.9], [42.4, 37.1], [43.1, 36.3], [43.3, 35.4], [44.4, 33.3], [45.8, 32.2], [47.4, 31.0]], dash: [] },\n  { name: 'Karun', pts: [[50.8, 32.3], [49.0, 31.8], [48.5, 31.3], [48.2, 30.4]], dash: [] },\n  { name: 'Indus', pts: [[74.5, 35.5], [72.2, 33.5], [71.2, 31.2], [69.5, 28.8], [68.2, 26.8], [67.8, 24.2]], dash: [] },\n  { name: 'Ghaggar-Hakra', pts: [[76.8, 30.7], [74.5, 29.5], [72.0, 28.5], [70.2, 27.5], [69.2, 25.2]], dash: [3, 3] }\n];\n\nconst MOUNTAIN_RANGES = [\n  { name: 'ZAGROS MTS', pts: [[45.5, 36.5], [47.5, 34.5], [49.8, 32.5], [52.2, 30.3], [55.0, 28.2]] },\n  { name: 'TAURUS MTS', pts: [[31.0, 37.2], [34.5, 37.5], [38.0, 38.0], [41.5, 38.3]] },\n  { name: 'ELBURZ MTS', pts: [[49.5, 37.0], [52.5, 36.3], [56.0, 36.7]] },\n  { name: 'HINDU KUSH', pts: [[66.0, 34.8], [69.5, 35.6], [72.5, 36.5]] }\n];\n\nconst CITIES = [\n  { name: 'Ur', lon: 46.1, lat: 30.96, type: 'ancient' },\n  { name: 'Babylon', lon: 44.42, lat: 32.54, type: 'ancient' },\n  { name: 'Baghdad', lon: 44.36, lat: 33.31, type: 'modern' },\n  { name: 'Mari', lon: 40.89, lat: 34.55, type: 'ancient' },\n  { name: 'Assur', lon: 43.26, lat: 35.45, type: 'ancient' },\n  { name: 'Nineveh', lon: 43.15, lat: 36.36, type: 'ancient' },\n  { name: 'Susa', lon: 48.25, lat: 32.19, type: 'ancient' },\n  { name: 'Anshan', lon: 52.89, lat: 29.93, type: 'ancient' },\n  { name: 'Tehran', lon: 51.39, lat: 35.69, type: 'modern' },\n  { name: 'Damascus', lon: 36.29, lat: 33.51, type: 'modern' },\n  { name: 'Mecca / Hijaz', lon: 39.82, lat: 21.42, type: 'ancient' },\n  { name: 'Riyadh (Najd)', lon: 46.72, lat: 24.71, type: 'modern' },\n  { name: 'Memphis / Cairo', lon: 31.23, lat: 30.04, type: 'modern' },\n  { name: 'Taxila', lon: 72.80, lat: 33.74, type: 'ancient' },\n  // Key IVC Cities\n  { name: 'Harappa', lon: 72.87, lat: 30.63, type: 'ivc' },\n  { name: 'Mohenjo-daro', lon: 68.14, lat: 27.32, type: 'ivc' },\n  { name: 'Rakhigarhi', lon: 76.11, lat: 29.29, type: 'ivc' },\n  { name: 'Dholavira', lon: 70.21, lat: 23.89, type: 'ivc' },\n  { name: 'Lothal', lon: 72.25, lat: 22.52, type: 'ivc' },\n  { name: 'Sutkagen Dor', lon: 61.85, lat: 25.49, type: 'ivc' }\n];\n\nconst EPOCHS = [\n  {\n    year: '2004 BCE',\n    title: 'Elam Sacks Ur & Audits the Ghee Ledger',\n    narrative: 'King <strong>Kindattu</strong> of Elam descends from the Zagros highlands, sacks <strong>Ur</strong>, captures Ibbi-Sin, and confiscates the Ur III palace ledgers (while the <strong>Mature IVC</strong> thrives contemporaneously across the Indus–Hakra basin). Auditing the Ur tablets exposes how salinized floodplain cattle murrain, siege pestilence, and palace <em>ì-nun</em> (ghee) retinoid overload rotted Sumer’s ruling bloodline from inside.',\n    bioEvents: [\n      {\n        type: 'plague',\n        icon: '☠',\n        tag: 'PLAGUE & SIEGE PESTILENCE',\n        title: 'Ur III Siege Pestilence (Lamentation over Ur)',\n        location: 'Ur & Nippur (S. Iraq)',\n        lon: 46.1, lat: 30.96,\n        detail: 'Cuneiform laments record acute epidemic mortality (\"corpses piled at the city gates\") as irrigation breakdown and siege crowding triggered waterborne & zoonotic fever waves.'\n      },\n      {\n        type: 'cattle',\n        icon: '🐂',\n        tag: 'CATTLE DEATH & SALINIZATION',\n        title: 'Drehem / Puzrish-Dagan Herd Murrain & Marsh Ghee',\n        location: 'Lower Euphrates Marshes',\n        lon: 45.2, lat: 31.85,\n        detail: 'Ur III livestock tablets document massive cattle die-offs (murṣu) from salinized pastures; rendering fat from stressed marsh cattle concentrated lipophilic toxins & retinoids into palace ì-nun (ghee).'\n      },\n      {\n        type: 'pregnancy',\n        icon: '🧬',\n        tag: 'PREGNANCY & NURSERY FAILURE',\n        title: 'Gipar Retinoid Overload & Wet-Nurse Swap',\n        location: 'Ur Royal Gipar Quarters',\n        lon: 46.6, lat: 30.4,\n        detail: 'Excess preformed retinol in clarified butter disrupted embryonic neural/axis patterning while wet-nurse stipends (um-me-ga-lá) severed maternal exosomal telemetry; Elam purged both after sacking Ur.'\n      }\n    ],\n    verbs: [\n      { tag: 'SACK & OCCUPY', color: '#a855f7', text: 'Elam marches from Susa/Anshan to sack Ur (2004 BCE) & seize Ur III archives.' },\n      { tag: 'FORENSIC AUDIT', color: '#f59e0b', text: 'Confiscated clay ledgers reveal palace ghee retinoid overload & wet-nurse exosome swaps.' },\n      { tag: 'UPHILL SHIELD', color: '#10b981', text: 'Elam marches Ibbi-Sin & source scrolls uphill to Anshan; purges marsh ghee from royal nurseries.' }\n    ],\n    polygons: [\n      { name: 'Sumer (Collapsing Ur III)', color: 'rgba(234,179,8,0.30)', stroke: '#eab308', pts: [[44.2,32.6],[46.6,32.5],[48.0,30.1],[46.2,29.8],[44.5,31.0]] },\n      { name: 'Elam (Susa + Anshan Core)', color: 'rgba(168,85,247,0.40)', stroke: '#a855f7', pts: [[47.4,33.6],[51.2,32.8],[54.2,30.2],[53.0,28.5],[49.2,29.8],[47.8,31.2]] },\n      { name: 'Amorite Steppe Tribes', color: 'rgba(16,185,129,0.22)', stroke: '#10b981', pts: [[37.0,36.2],[41.8,36.0],[42.5,33.5],[38.2,32.8],[36.5,34.4]] },\n      { name: 'Old Assyria (Upper Tigris)', color: 'rgba(239,68,68,0.26)', stroke: '#ef4444', pts: [[41.8,37.0],[44.5,36.8],[44.2,35.0],[42.0,35.1]] },\n      { name: 'Middle Kingdom Egypt', color: 'rgba(56,189,248,0.26)', stroke: '#38bdf8', pts: [[29.8,31.3],[32.2,31.2],[32.8,24.5],[31.0,24.5],[30.3,29.5]] }\n    ],\n    vectors: [\n      { from: [48.6, 32.0], to: [46.1, 30.96], label: 'SACK OF UR (2004 BCE)', color: '#a855f7', dashed: false },\n      { from: [46.1, 30.96], to: [52.89, 29.93], label: 'AUDIT & UPHILL SHIELD', color: '#f59e0b', dashed: true },\n      { from: [39.5, 35.0], to: [43.5, 33.2], label: 'STEPPE INCURSION', color: '#10b981', dashed: true }\n    ]\n  },\n  {\n    year: '1760 BCE',\n    title: 'Amorite Babylon, Mari Quarantines & Late IVC Transition',\n    narrative: 'Semi-nomadic <strong>Amorites</strong> capture Babylon and Mari—enforcing strict palace plague quarantines while codifying <em>Atra-Hasis</em> population-attrition theology—just as the <strong>IVC</strong> enters its Late Harappan de-urbanization phase (1900–1300 BCE) following Ghaggar-Hakra hydrological shifts.',\n    bioEvents: [\n      {\n        type: 'plague',\n        icon: '☠',\n        tag: 'PLAGUE & QUARANTINE PROTOCOL',\n        title: 'Mari Royal Archives Mūtānu Epidemic Isolation',\n        location: 'Mari & Terqa (Syria/Iraq Border)',\n        lon: 40.89, lat: 34.55,\n        detail: 'King Zimri-Lim’s letters enforce strict palace quarantine (\"no one shall drink from her cup or sit on her chair\") during contagious mūtānu outbreaks in Terqa while letting lower towns absorb the wave.'\n      },\n      {\n        type: 'cattle',\n        icon: '🐂',\n        tag: 'CATTLE DEATH & FODDER TOXINS',\n        title: 'Euphrates Valley Cattle Plague & Steppe Herd Split',\n        location: 'Middle Euphrates / Babylon',\n        lon: 44.42, lat: 32.54,\n        detail: 'Alluvial cattle murrains and granary mycotoxins devastate sedentary herds; Amorite elites keep clean steppe sheep/goat milk while rationing omega-6 sesame oil & barley to laborers.'\n      },\n      {\n        type: 'pregnancy',\n        icon: '🧬',\n        tag: 'PREGNANCY FAILURE POLITICS',\n        title: 'Atra-Hasis Codified Barrenness & Pāšittu Infant Loss',\n        location: 'Babylon & Sippar',\n        lon: 44.25, lat: 33.1,\n        detail: 'Old Babylonian state theology explicitly frames plagues, female barrenness (ša lā alādi), and neonatal death (pāšittu) as administrative population-control levers over lower-caste labor.'\n      }\n    ],\n    verbs: [\n      { tag: 'CAPTURE & CODIFY', color: '#10b981', text: 'Amorites seize Babylon & Mari; publish transparent statutory law vs. temple omen guilds.' },\n      { tag: 'RATION WEAPONRY', color: '#ef4444', text: 'Standardized barley + omega-6 sesame oil rations institutionalize compliant lowland labor.' },\n      { tag: 'HIGHLAND BUFFER', color: '#a855f7', text: 'Elam rotates royal pregnancies uphill to Anshan; avoids irrigated floodplain cattle ghee.' }\n    ],\n    polygons: [\n      { name: 'Amorite Babylon & Mari', color: 'rgba(16,185,129,0.34)', stroke: '#10b981', pts: [[38.0,36.2],[43.2,35.6],[47.5,31.0],[46.0,29.8],[43.5,31.8],[39.5,33.6]] },\n      { name: 'Elam (Sukkalmah Empire)', color: 'rgba(168,85,247,0.36)', stroke: '#a855f7', pts: [[47.3,34.0],[51.8,33.0],[54.8,29.8],[53.2,28.2],[48.8,29.8],[47.7,31.3]] },\n      { name: 'Assyrian Trade Axis', color: 'rgba(239,68,68,0.28)', stroke: '#ef4444', pts: [[41.5,37.2],[44.8,37.0],[44.5,35.1],[41.8,35.2]] },\n      { name: 'Egypt (Late Middle Kingdom)', color: 'rgba(56,189,248,0.26)', stroke: '#38bdf8', pts: [[29.8,31.3],[32.3,31.2],[33.0,23.5],[31.0,23.5],[30.2,29.5]] }\n    ],\n    vectors: [\n      { from: [40.89, 34.55], to: [44.42, 32.54], label: 'PASTORAL DYNASTY CAPTURE', color: '#10b981', dashed: false },\n      { from: [48.25, 32.19], to: [52.89, 29.93], label: 'GESTATION QUARANTINE', color: '#a855f7', dashed: true },\n      { from: [44.42, 32.54], to: [46.1, 30.96], label: 'GRAIN/OIL LABOR RATIONS', color: '#ef4444', dashed: true }\n    ]\n  },\n  {\n    year: '1155 BCE',\n    title: 'Shutruk-Nahhunte’s Sack, Bronze Age Plagues & Egyptian Inbreeding',\n    narrative: 'Elamite king <strong>Shutruk-Nahhunte</strong> sacks Babylon (1155 BCE) and hauls legal/medical source texts to Susa amid the Late Bronze Age Collapse. Megadroughts trigger cattle plagues across the Fertile Crescent, while Egypt’s royal bloodlines rot from mandatory sibling inbreeding and lead-antimony cosmetics.',\n    bioEvents: [\n      {\n        type: 'plague',\n        icon: '☠',\n        tag: 'PLAGUE & BRONZE AGE COLLAPSE',\n        title: 'Levant–Mesopotamia Erra / Namtar Pestilence Wave',\n        location: 'Syria / Upper Euphrates Corridor',\n        lon: 38.4, lat: 35.0,\n        detail: 'Late Bronze Age trade collapse and refugee movements trigger severe epidemic fevers across Levantine and Babylonian cities, collapsing urban garrison densities.'\n      },\n      {\n        type: 'cattle',\n        icon: '🐂',\n        tag: 'CATTLE DEATH & MEGADROUGHT',\n        title: 'Anatolian–Mesopotamian Livestock Die-Off',\n        location: 'Upper Tigris & N. Syria',\n        lon: 41.8, lat: 36.6,\n        detail: 'Severe 12th-century BCE aridification causes mass cattle and grain failures across Hittite and Kassite territories, driving nomadic pastoralist incursions.'\n      },\n      {\n        type: 'pregnancy',\n        icon: '🧬',\n        tag: 'DYNASTIC GESTATIONAL COLLAPSE',\n        title: 'Egyptian Sibling Inbreeding & Lead/Antimony Kohl',\n        location: 'Thebes / Memphis (Egypt)',\n        lon: 31.23, lat: 28.5,\n        detail: 'Late 18th–20th Dynasty sibling marriages plus chronic lead/antimony cosmetic toxicity produce severe congenital bone necrosis, cleft palate, stillbirths, and immune fragility.'\n      }\n    ],\n    verbs: [\n      { tag: 'ARCHIVE EXTRACTION', color: '#a855f7', text: 'Shutruk-Nahhunte sacks Babylon (1155 BCE) & hauls legal/medical source texts to Susa.' },\n      { tag: 'MILITARIZE CORE', color: '#ef4444', text: 'Middle Assyria locks down Upper Tigris iron logistics & capital laws against pregnancy tampering.' },\n      { tag: 'CLOSED INBREEDING', color: '#38bdf8', text: 'Egyptian dynasties compound sibling inbreeding, lead cosmetics & priestly hoarding.' }\n    ],\n    polygons: [\n      { name: 'Elam (Post-Babylon Sack)', color: 'rgba(168,85,247,0.42)', stroke: '#a855f7', pts: [[44.2,33.5],[48.5,34.2],[52.5,32.6],[55.0,29.6],[52.8,28.2],[48.2,30.0],[45.5,31.5]] },\n      { name: 'Middle Assyria', color: 'rgba(239,68,68,0.34)', stroke: '#ef4444', pts: [[40.2,37.4],[44.8,37.2],[45.2,34.6],[41.2,34.8]] },\n      { name: 'Early Arabian Camel Clans', color: 'rgba(249,115,22,0.26)', stroke: '#f97316', pts: [[37.5,28.5],[44.5,28.0],[47.0,22.0],[41.0,19.5],[38.0,24.0]] },\n      { name: 'New Kingdom Egypt', color: 'rgba(56,189,248,0.32)', stroke: '#38bdf8', pts: [[29.6,31.4],[34.5,31.2],[34.8,29.6],[33.2,22.5],[31.0,22.5],[30.0,29.5]] }\n    ],\n    vectors: [\n      { from: [48.25, 32.19], to: [44.42, 32.54], label: 'SACK OF BABYLON (1155 BCE)', color: '#a855f7', dashed: false },\n      { from: [44.42, 32.54], to: [48.25, 32.19], label: 'CONFISCATE TEXTS & STELAE', color: '#f59e0b', dashed: true },\n      { from: [41.5, 23.0], to: [38.5, 29.5], label: 'CAMEL PASTORAL EXPANSION', color: '#f97316', dashed: true }\n    ]\n  },\n  {\n    year: '647 BCE',\n    title: 'Neo-Assyrian Deportation Plagues & Mutagen Polypharmacy',\n    narrative: '<strong>Ashurbanipal</strong> sacks Susa (647 BCE) and hoards medical texts in Nineveh—institutionalizing a lethal two-tier split: mechanical surgery for kings vs. licorice (<em>šūšu</em>), mandrake, and lead pastes for deportees, while forced marches spread epidemics and livestock die-offs.',\n    bioEvents: [\n      {\n        type: 'plague',\n        icon: '☠',\n        tag: 'PLAGUE & DEPORTATION CORRIDORS',\n        title: 'Neo-Assyrian Mūtānu Garrison & Deportee Epidemics',\n        location: 'Nineveh & Kalhu (N. Iraq)',\n        lon: 43.15, lat: 36.36,\n        detail: 'Court astrological/medical tablets report recurring mūtānu plagues erupting along forced-deportation columns and overcrowded provincial garrisons, bleeding Assyria’s core manpower.'\n      },\n      {\n        type: 'cattle',\n        icon: '🐂',\n        tag: 'CATTLE CONFISCATION & MURRAIN',\n        title: 'Imperial Herd Seizure & Susiana Livestock Collapse',\n        location: 'Susa / Khuzestan Plain',\n        lon: 48.25, lat: 32.19,\n        detail: 'Assyria strips prime highland cattle and horses as tribute for its military elite while scorched-earth campaigns trigger epizootic herd collapses across Elam and Babylonia.'\n      },\n      {\n        type: 'pregnancy',\n        icon: '🧬',\n        tag: 'MUTAGEN PHARMACOLOGY & HPA HIJACK',\n        title: 'Licorice (Šūšu) Cortisol Flood & Mandrake Pastes',\n        location: 'Babylon & Nineveh Lower Towns',\n        lon: 44.42, lat: 32.54,\n        detail: 'Nineveh formularies pack glycyrrhizin-heavy licorice (blocking placental 11β-HSD2), mandrake alkaloids, and lead/antimony pastes into common remedies—inducing fetal HPA-axis damage and teratogenic drift.'\n      }\n    ],\n    verbs: [\n      { tag: 'SACK & CONSOLIDATE', color: '#ef4444', text: 'Assyria sacks Susa (647 BCE), deporting populations & hoarding texts in Nineveh.' },\n      { tag: 'MUTAGEN POLYPHARMACY', color: '#f59e0b', text: 'Two-tier split: mechanical surgery for kings vs. licorice/mandrake/mineral pastes for masses.' },\n      { tag: 'UPHILL PERSIAN PIVOT', color: '#a855f7', text: 'Elamite scribal DNA survives in highland Anshan, seeding the Achaemenid Persian state.' }\n    ],\n    polygons: [\n      { name: 'Neo-Assyrian Hyper-Empire', color: 'rgba(239,68,68,0.42)', stroke: '#ef4444', pts: [[30.0,31.2],[35.5,36.8],[43.5,37.6],[48.5,34.5],[48.8,30.2],[44.5,30.5],[36.5,31.2],[34.5,29.5],[32.8,24.5],[30.5,24.5]] },\n      { name: 'Highland Anshan (Proto-Persia)', color: 'rgba(168,85,247,0.36)', stroke: '#a855f7', pts: [[50.2,32.5],[55.5,31.2],[56.2,28.0],[51.8,28.2]] },\n      { name: 'Arabian Steppe Confederations', color: 'rgba(249,115,22,0.32)', stroke: '#f97316', pts: [[36.5,30.2],[45.5,29.2],[50.5,24.5],[48.5,17.5],[41.5,17.0],[37.5,23.5]] }\n    ],\n    vectors: [\n      { from: [43.15, 36.36], to: [48.25, 32.19], label: 'SACK OF SUSA (647 BCE)', color: '#ef4444', dashed: false },\n      { from: [48.25, 32.19], to: [43.15, 36.36], label: 'MASS DEPORTATIONS & TEXTS', color: '#f59e0b', dashed: true },\n      { from: [43.15, 36.36], to: [31.23, 30.04], label: 'IMPERIAL OVERSTRETCH', color: '#ef4444', dashed: true }\n    ]\n  },\n  {\n    year: '522 BCE',\n    title: 'Achaemenid Satrapies vs. Arabian Bādiya Desert Firewall',\n    narrative: '<strong>Darius I</strong> builds an empire from the Nile into the northern Indus zone (Gandhara/Taxila)—projecting Aramaic/Kharosthi orthographic control while keeping Persian princes sequestered in highland estates. Across the desert, Arabian elites institutionalize <strong><em>bādiya</em> Bedouin fostering</strong> to escape urban plagues and wet-nurse/apothecary attrition.',\n    bioEvents: [\n      {\n        type: 'plague',\n        icon: '☠',\n        tag: 'PLAGUE & CANAL-ZONE ENDEMICS',\n        title: 'Nile Delta & Babylonian Canal-Grid Endemic Fevers',\n        location: 'Memphis / Lower Nile & Babylon',\n        lon: 31.23, lat: 30.04,\n        detail: 'Dense irrigated river hubs suffer chronic malaria, schistosomiasis, and garrison plagues, while Persian vispuhrān princes and Bedouin clans stay insulated in high/arid ecological zones.'\n      },\n      {\n        type: 'cattle',\n        icon: '🐂',\n        tag: 'LIVESTOCK RESILIENCE SPLIT',\n        title: 'Alluvial Cattle Murrain vs. Desert Camel/Goat Immunity',\n        location: 'Hijaz & Najd Steppe (Arabia)',\n        lon: 43.5, lat: 24.5,\n        detail: 'Lowland river herds remain vulnerable to seasonal murrains and aflatoxin fodder, whereas decentralized Arabian camel and desert-goat herds provide clean, unboiled lactoferrin-rich milk.'\n      },\n      {\n        type: 'pregnancy',\n        icon: '🧬',\n        tag: 'ANTI-URBAN GESTATIONAL SHIELD',\n        title: 'Bādiya Desert Fostering vs. Urban Electuaries',\n        location: 'Mecca / Hijaz Desert Frontier',\n        lon: 39.82, lat: 21.42,\n        detail: 'Arabian nobility deliberately sends infants to Bedouin foster-mothers (mustarḍiʿāt) to prevent urban polypharmacy exposure, wet-nurse stress-cortisol swaps, and early-childhood mortality.'\n      }\n    ],\n    verbs: [\n      { tag: 'IMPERIAL OVERLAY', color: '#a855f7', text: 'Achaemenids fuse Elamite highland security with Assyrian Aramaic bureaucracy to Taxila.' },\n      { tag: 'BĀDIYA FOSTERING', color: '#f97316', text: 'Arabian elites send infants to desert foster-mothers for clean camel milk & zero urban drugs.' },\n      { tag: 'COLONIAL EXTRACTION', color: '#38bdf8', text: 'Egypt reduced to a taxed satrapy while priestly castes hoard decaying temple medicine.' }\n    ],\n    polygons: [\n      { name: 'Achaemenid Persian Empire', color: 'rgba(168,85,247,0.36)', stroke: '#a855f7', pts: [[29.8,31.3],[35.8,36.8],[44.5,38.0],[55.0,37.2],[68.5,35.5],[72.8,33.7],[68.0,25.2],[56.5,27.0],[48.2,30.0],[36.2,31.2],[33.0,23.5],[30.5,23.5]] },\n      { name: 'Arabian Bādiya Heartland', color: 'rgba(249,115,22,0.38)', stroke: '#f97316', pts: [[36.2,30.2],[46.5,29.0],[54.5,23.5],[53.0,15.5],[43.5,14.5],[38.0,21.5]] }\n    ],\n    vectors: [\n      { from: [52.89, 29.93], to: [72.8, 33.74], label: 'ARAMAIC / KHAROSTHI VECTOR', color: '#a855f7', dashed: true },\n      { from: [39.82, 21.42], to: [44.5, 25.5], label: 'BĀDIYA DESERT SHIELD', color: '#f97316', dashed: false },\n      { from: [52.89, 29.93], to: [31.23, 30.04], label: 'SATRAPY TRIBUTE DRAIN', color: '#38bdf8', dashed: true }\n    ]\n  },\n  {\n    year: '642 CE',\n    title: 'Justinianic/Amwas Plagues & Collapse of Hollowed-Out Egypt',\n    narrative: 'Recurrent waves of the <strong>Plague of Justinian</strong> (541–640s CE) and the <strong>Plague of Amwas</strong> (639 CE), paired with Nile cattle murrains and centuries of Ptolemaic–Byzantine inbreeding and lead/grain attrition, leave Egypt and Sasanian Iraq demographically hollow before the high-vitality Arabian expansion.',\n    bioEvents: [\n      {\n        type: 'plague',\n        icon: '☠',\n        tag: 'PANDEMIC COLLAPSE (YERSINIA PESTIS)',\n        title: 'Plague of Justinian & Plague of Amwas (638–639 CE)',\n        location: 'Pelusium / Alexandria & Levant',\n        lon: 32.3, lat: 31.0,\n        detail: 'Originating through Pelusium in Egypt (541 CE) with recurring waves through 639 CE (Amwas), bubonic plague gutted dense Byzantine & Sasanian urban tax bases while decentralized tribal networks rebounded fast.'\n      },\n      {\n        type: 'cattle',\n        icon: '🐂',\n        tag: 'NILE MURRAIN & AGRARIAN CRASH',\n        title: 'Late-Byzantine Egyptian Cattle Plague & Silt Failure',\n        location: 'Nile Valley (Egypt)',\n        lon: 31.1, lat: 27.5,\n        detail: '6th–7th century epizootic cattle die-offs wiped out draft oxen across Byzantine Egypt, collapsing irrigation maintenance and starving the imperial grain-tribute engine.'\n      },\n      {\n        type: 'pregnancy',\n        icon: '🧬',\n        tag: 'CUMULATIVE DEMOGRAPHIC EXHAUSTION',\n        title: 'Multi-Century Urban Attrition vs. Bādiya Kin Vitality',\n        location: 'Cairo / Fustat & Ctesiphon',\n        lon: 44.58, lat: 33.09,\n        detail: 'Centuries of Ptolemaic/Roman extraction, heavy-metal cosmetics, and urban polypharmacy left river-valley populations depleted—allowing mobile, desert-fostered Arabian clans to take Egypt (639–642 CE) with minimal resistance.'\n      }\n    ],\n    verbs: [\n      { tag: 'COLLAPSE OF HOLLOW CORE', color: '#38bdf8', text: 'Internally exhausted Egypt falls rapidly to Amr ibn al-As (639–642 CE) without local defense.' },\n      { tag: 'VITALITY EXPANSION', color: '#f97316', text: 'Decentralized Arabian networks absorb both Sasanian Iran/Iraq and Byzantine Levant/Egypt.' },\n      { tag: 'TWO-TIER CONTINUUM', color: '#f59e0b', text: 'Caliphal elites keep Bedouin fostering while scaling urban Qarābādīn polypharmacy manuals.' }\n    ],\n    polygons: [\n      { name: 'Early Caliphate (High-Vitality Expansion)', color: 'rgba(249,115,22,0.40)', stroke: '#f97316', pts: [[25.0,31.6],[32.2,31.3],[36.2,36.6],[44.5,37.4],[54.5,36.8],[61.5,35.0],[61.0,25.5],[56.2,26.8],[54.5,23.5],[53.0,15.5],[43.5,14.5],[38.0,21.5],[34.5,29.5],[32.8,23.0],[29.5,23.0]] }\n    ],\n    vectors: [\n      { from: [39.82, 21.42], to: [31.23, 30.04], label: 'CONQUEST OF EGYPT (639–642 CE)', color: '#f97316', dashed: false },\n      { from: [44.5, 25.5], to: [44.36, 33.31], label: 'FALL OF SASANIAN IRAQ', color: '#f97316', dashed: false },\n      { from: [44.36, 33.31], to: [41.5, 24.0], label: 'NOBLE BĀDIYA NURSERY LOOP', color: '#10b981', dashed: true }\n    ]\n  }\n];\n\nlet currentSlider = 0;\nlet playing = false;\nlet animPhase = 0;\n\nconst stageButtonsEl = document.getElementById('stageButtons');\nconst timelinePipsEl = document.getElementById('timelinePips');\n\nEPOCHS.forEach((ep, idx) => {\n  const btn = document.createElement('button');\n  btn.className = 'stage-btn' + (idx === 0 ? ' active' : '');\n  btn.innerHTML = `<span class=\"yr\">${ep.year}</span><span class=\"lbl\">${ep.title.split('&')[0].trim()}</span>`;\n  btn.addEventListener('click', () => jumpToStage(idx, 'all'));\n  stageButtonsEl.appendChild(btn);\n\n  const cluster = document.createElement('div');\n  cluster.className = 'pip-cluster';\n  ep.bioEvents.forEach(ev => {\n    const pip = document.createElement('span');\n    pip.className = `pip ${ev.type}`;\n    pip.textContent = ev.icon;\n    pip.title = `${ep.year} — ${ev.title}`;\n    pip.addEventListener('click', () => jumpToStage(idx, ev.type));\n    cluster.appendChild(pip);\n  });\n  timelinePipsEl.appendChild(cluster);\n});\n\nfunction jumpToStage(idx, filterType) {\n  playing = false;\n  updatePlayBtn();\n  currentSlider = idx * 100;\n  document.getElementById('timeSlider').value = currentSlider;\n  if (filterType) setBioFilter(filterType);\n  updateSidebar(idx);\n}\n\nfunction setBioFilter(filterType) {\n  activeBioFilter = filterType;\n  document.querySelectorAll('.filter-btn').forEach(b => {\n    b.classList.toggle('active', b.dataset.filter === filterType);\n  });\n  updateSidebar(Math.round(currentSlider / 100));\n}\n\ndocument.querySelectorAll('.filter-btn').forEach(btn => {\n  btn.addEventListener('click', () => setBioFilter(btn.dataset.filter));\n});\n\nfunction updatePlayBtn() {\n  document.getElementById('playBtn').textContent = playing ? '⏸ Pause' : '▶ Play Timeline';\n}\n\ndocument.getElementById('playBtn').addEventListener('click', () => {\n  playing = !playing;\n  if (playing && currentSlider >= 500) currentSlider = 0;\n  updatePlayBtn();\n});\n\ndocument.getElementById('timeSlider').addEventListener('input', (e) => {\n  playing = false;\n  updatePlayBtn();\n  currentSlider = Number(e.target.value);\n  updateSidebar(Math.round(currentSlider / 100));\n});\n\nfunction setZoom(newZoom) {\n  cam.zoom = Math.max(0.55, Math.min(3.5, newZoom));\n  document.getElementById('zoomLabel').textContent = cam.zoom.toFixed(2) + '×';\n}\n\ndocument.getElementById('zoomOutBtn').addEventListener('click', () => setZoom(cam.zoom * 0.8));\ndocument.getElementById('zoomInBtn').addEventListener('click', () => setZoom(cam.zoom * 1.25));\ndocument.getElementById('resetViewBtn').addEventListener('click', () => {\n  cam.zoom = 0.88; cam.panX = 0; cam.panY = 0;\n  document.getElementById('zoomLabel').textContent = cam.zoom.toFixed(2) + '×';\n});\ndocument.getElementById('macroBtn').addEventListener('click', () => {\n  cam.zoom = 0.62; cam.panX = 0; cam.panY = 0;\n  document.getElementById('zoomLabel').textContent = cam.zoom.toFixed(2) + '×';\n});\n\nmapWrap.addEventListener('wheel', (e) => {\n  e.preventDefault();\n  setZoom(cam.zoom * (e.deltaY > 0 ? 0.88 : 1.14));\n}, { passive: false });\n\nmapWrap.addEventListener('mousedown', (e) => {\n  cam.dragging = true;\n  cam.lastX = e.clientX;\n  cam.lastY = e.clientY;\n});\n\nwindow.addEventListener('mousemove', (e) => {\n  const rect = mapWrap.getBoundingClientRect();\n  cam.mouseX = e.clientX - rect.left;\n  cam.mouseY = e.clientY - rect.top;\n\n  if (cam.dragging) {\n    cam.panX += (e.clientX - cam.lastX);\n    cam.panY += (e.clientY - cam.lastY);\n    cam.lastX = e.clientX;\n    cam.lastY = e.clientY;\n    tooltipEl.style.display = 'none';\n    return;\n  }\n\n  let hit = null;\n  for (const node of screenBioNodes) {\n    if (Math.hypot(cam.mouseX - node.x, cam.mouseY - node.y) <= 22) {\n      hit = node;\n      break;\n    }\n  }\n  if (hit) {\n    const colorMap = { plague: '#fda4af', cattle: '#fde047', pregnancy: '#f0abfc' };\n    tooltipEl.style.display = 'block';\n    tooltipEl.style.left = Math.min(rect.width - 295, Math.max(12, hit.x + 16)) + 'px';\n    tooltipEl.style.top = Math.min(rect.height - 135, Math.max(12, hit.y - 20)) + 'px';\n    tooltipEl.style.borderColor = colorMap[hit.ev.type];\n    tooltipEl.innerHTML = `\n      <div class=\"tt-head\" style=\"color:${colorMap[hit.ev.type]}\">${hit.ev.icon} ${hit.ev.tag}</div>\n      <div style=\"font-weight:700;color:#fff;margin-bottom:3px\">${hit.ev.title} (${hit.ev.location})</div>\n      <div>${hit.ev.detail}</div>\n    `;\n  } else {\n    tooltipEl.style.display = 'none';\n  }\n});\n\nwindow.addEventListener('mouseup', () => { cam.dragging = false; });\n\nfunction updateSidebar(stageIdx) {\n  const ep = EPOCHS[stageIdx];\n  document.getElementById('hudYear').textContent = ep.year;\n  document.getElementById('hudTitle').textContent = ep.title;\n  document.getElementById('epochNarrative').innerHTML = ep.narrative;\n\n  const filteredBios = ep.bioEvents.filter(ev => activeBioFilter === 'all' || ev.type === activeBioFilter);\n  document.getElementById('bioCountBadge').textContent = `${filteredBios.length} Highlighted`;\n  document.getElementById('bioList').innerHTML = filteredBios.map(ev => `\n    <div class=\"bio-card ${ev.type}\">\n      <div class=\"bio-head\">\n        <span>${ev.icon} ${ev.tag}</span>\n        <span class=\"bio-loc\">${ev.location}</span>\n      </div>\n      <div style=\"font-weight:700;color:#fff;margin-bottom:2px\">${ev.title}</div>\n      <div style=\"color:#cbd5e1\">${ev.detail}</div>\n    </div>\n  `).join('');\n\n  document.getElementById('verbList').innerHTML = ep.verbs.map(v => `\n    <div class=\"verb-pill\" style=\"border-left-color:${v.color}\">\n      <span class=\"vtag\" style=\"color:${v.color}\">${v.tag}</span>\n      ${v.text}\n    </div>\n  `).join('');\n\n  document.querySelectorAll('.stage-btn').forEach((b, i) => {\n    b.classList.toggle('active', i === stageIdx);\n  });\n}\n\nfunction geoToScreen(lon, lat, w, h) {\n  const midLatRad = ((GEO.minLat + GEO.maxLat) / 2) * Math.PI / 180;\n  const cosLat = Math.cos(midLatRad);\n  const geoW = (GEO.maxLon - GEO.minLon) * cosLat;\n  const geoH = (GEO.maxLat - GEO.minLat);\n  const baseScale = Math.min(w / geoW, h / geoH) * 0.94;\n  const centerLon = (GEO.minLon + GEO.maxLon) / 2;\n  const centerLat = (GEO.minLat + GEO.maxLat) / 2;\n  const x = (w / 2) + ((lon - centerLon) * cosLat * baseScale * cam.zoom) + cam.panX;\n  const y = (h / 2) - ((lat - centerLat) * baseScale * cam.zoom) + cam.panY;\n  return [x, y];\n}\n\nfunction drawPolygon(pts, w, h, fill, stroke, lineWidth = 1.5, dash = []) {\n  if (!pts || pts.length < 3) return;\n  ctx.save();\n  ctx.beginPath();\n  pts.forEach(([lon, lat], i) => {\n    const [x, y] = geoToScreen(lon, lat, w, h);\n    if (i === 0) ctx.moveTo(x, y);\n    else ctx.lineTo(x, y);\n  });\n  ctx.closePath();\n  if (fill) { ctx.fillStyle = fill; ctx.fill(); }\n  if (stroke) {\n    ctx.setLineDash(dash);\n    ctx.strokeStyle = stroke;\n    ctx.lineWidth = lineWidth;\n    ctx.stroke();\n  }\n  ctx.restore();\n}\n\nfunction drawPolyline(pts, w, h, stroke, lineWidth = 1.2, dash = []) {\n  if (!pts || pts.length < 2) return;\n  ctx.save();\n  ctx.beginPath();\n  pts.forEach(([lon, lat], i) => {\n    const [x, y] = geoToScreen(lon, lat, w, h);\n    if (i === 0) ctx.moveTo(x, y);\n    else ctx.lineTo(x, y);\n  });\n  ctx.setLineDash(dash);\n  ctx.strokeStyle = stroke;\n  ctx.lineWidth = lineWidth;\n  ctx.stroke();\n  ctx.restore();\n}\n\nfunction drawArrowVector(v, w, h, phase) {\n  const [x1, y1] = geoToScreen(v.from[0], v.from[1], w, h);\n  const [x2, y2] = geoToScreen(v.to[0], v.to[1], w, h);\n  const dx = x2 - x1, dy = y2 - y1;\n  const len = Math.hypot(dx, dy);\n  if (len < 12) return;\n\n  const nx = -dy / len, ny = dx / len;\n  const curve = Math.min(28, len * 0.16);\n  const cx = (x1 + x2) / 2 + nx * curve;\n  const cy = (y1 + y2) / 2 + ny * curve;\n\n  ctx.save();\n  ctx.beginPath();\n  ctx.moveTo(x1, y1);\n  ctx.quadraticCurveTo(cx, cy, x2, y2);\n  ctx.strokeStyle = v.color;\n  ctx.lineWidth = 2.2;\n  if (v.dashed) {\n    ctx.setLineDash([7, 5]);\n    ctx.lineDashOffset = -phase * 24;\n  }\n  ctx.stroke();\n\n  const t = phase % 1;\n  const px = (1 - t) * (1 - t) * x1 + 2 * (1 - t) * t * cx + t * t * x2;\n  const py = (1 - t) * (1 - t) * y1 + 2 * (1 - t) * t * cy + t * t * y2;\n  ctx.setLineDash([]);\n  ctx.beginPath();\n  ctx.arc(px, py, 3.5, 0, Math.PI * 2);\n  ctx.fillStyle = '#fff';\n  ctx.fill();\n\n  const angle = Math.atan2(y2 - cy, x2 - cx);\n  const headLen = 8.5;\n  ctx.beginPath();\n  ctx.moveTo(x2, y2);\n  ctx.lineTo(x2 - headLen * Math.cos(angle - Math.PI / 6), y2 - headLen * Math.sin(angle - Math.PI / 6));\n  ctx.lineTo(x2 - headLen * Math.cos(angle + Math.PI / 6), y2 - headLen * Math.sin(angle + Math.PI / 6));\n  ctx.closePath();\n  ctx.fillStyle = v.color;\n  ctx.fill();\n\n  const lx = 0.25 * x1 + 0.5 * cx + 0.25 * x2;\n  const ly = 0.25 * y1 + 0.5 * cy + 0.25 * y2;\n  ctx.font = 'bold 9.5px -apple-system, BlinkMacSystemFont, sans-serif';\n  const tw = ctx.measureText(v.label).width;\n  ctx.fillStyle = 'rgba(11, 14, 20, 0.85)';\n  ctx.fillRect(lx - tw / 2 - 4, ly - 7, tw + 8, 14);\n  ctx.strokeStyle = v.color;\n  ctx.lineWidth = 1;\n  ctx.strokeRect(lx - tw / 2 - 4, ly - 7, tw + 8, 14);\n  ctx.fillStyle = '#fff';\n  ctx.textAlign = 'center';\n  ctx.textBaseline = 'middle';\n  ctx.fillText(v.label, lx, ly);\n  ctx.restore();\n}\n\nfunction drawBioHazardNode(ev, w, h, phase) {\n  const [x, y] = geoToScreen(ev.lon, ev.lat, w, h);\n  screenBioNodes.push({ x, y, ev });\n\n  const colorCfg = {\n    plague: { main: '#f43f5e', glow: 'rgba(244, 63, 94, 0.35)', text: '#fda4af' },\n    cattle: { main: '#eab308', glow: 'rgba(234, 179, 8, 0.35)', text: '#fde047' },\n    pregnancy: { main: '#d946ef', glow: 'rgba(217, 70, 239, 0.35)', text: '#f0abfc' }\n  }[ev.type];\n\n  const pulse = (phase * 1.4) % 1;\n  const rOuter = 12 + pulse * 24;\n\n  ctx.save();\n  ctx.beginPath();\n  ctx.arc(x, y, rOuter, 0, Math.PI * 2);\n  ctx.strokeStyle = colorCfg.main;\n  ctx.globalAlpha = Math.max(0, 1 - pulse) * 0.85;\n  ctx.lineWidth = 2;\n  ctx.stroke();\n\n  ctx.globalAlpha = 1;\n  ctx.beginPath();\n  ctx.arc(x, y, 13, 0, Math.PI * 2);\n  ctx.fillStyle = colorCfg.glow;\n  ctx.fill();\n  ctx.strokeStyle = colorCfg.main;\n  ctx.lineWidth = 2;\n  ctx.stroke();\n\n  ctx.beginPath();\n  ctx.arc(x, y, 9.5, 0, Math.PI * 2);\n  ctx.fillStyle = '#0b0e14';\n  ctx.fill();\n  ctx.font = '11px sans-serif';\n  ctx.textAlign = 'center';\n  ctx.textBaseline = 'middle';\n  ctx.fillText(ev.icon, x, y + 0.5);\n\n  const label = `${ev.type.toUpperCase()}: ${ev.location.split('(')[0].trim()}`;\n  ctx.font = 'bold 9.5px sans-serif';\n  const tw = ctx.measureText(label).width;\n  ctx.fillStyle = 'rgba(11, 14, 20, 0.92)';\n  ctx.fillRect(x - tw / 2 - 5, y + 15, tw + 10, 14);\n  ctx.strokeStyle = colorCfg.main;\n  ctx.lineWidth = 1;\n  ctx.strokeRect(x - tw / 2 - 5, y + 15, tw + 10, 14);\n  ctx.fillStyle = colorCfg.text;\n  ctx.fillText(label, x, y + 22);\n  ctx.restore();\n}\n\nfunction render() {\n  const dpr = window.devicePixelRatio || 1;\n  const rect = mapWrap.getBoundingClientRect();\n  if (canvas.width !== Math.floor(rect.width * dpr) || canvas.height !== Math.floor(rect.height * dpr)) {\n    canvas.width = Math.floor(rect.width * dpr);\n    canvas.height = Math.floor(rect.height * dpr);\n  }\n  const w = rect.width;\n  const h = rect.height;\n  ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n  screenBioNodes = [];\n\n  // 1. Ocean background\n  ctx.fillStyle = '#070d17';\n  ctx.fillRect(0, 0, w, h);\n\n  // 2. Graticule\n  ctx.save();\n  ctx.strokeStyle = 'rgba(148, 163, 184, 0.07)';\n  ctx.lineWidth = 1;\n  ctx.font = '10px monospace';\n  ctx.fillStyle = 'rgba(148, 163, 184, 0.32)';\n  for (let lon = 10; lon <= 85; lon += 5) {\n    const [x1, y1] = geoToScreen(lon, 5, w, h);\n    const [x2, y2] = geoToScreen(lon, 48, w, h);\n    ctx.beginPath(); ctx.moveTo(x1, y1); ctx.lineTo(x2, y2); ctx.stroke();\n    ctx.fillText(`${lon}°E`, x1 + 3, h - 8);\n  }\n  for (let lat = 10; lat <= 45; lat += 5) {\n    const [x1, y1] = geoToScreen(10, lat, w, h);\n    const [x2, y2] = geoToScreen(85, lat, w, h);\n    ctx.beginPath(); ctx.moveTo(x1, y1); ctx.lineTo(x2, y2); ctx.stroke();\n    ctx.fillText(`${lat}°N`, 8, y1 - 3);\n  }\n  ctx.restore();\n\n  // 3. Landmasses\n  LANDMASSES.forEach(poly => drawPolygon(poly, w, h, '#141c29', '#3b4d6b', 1.4));\n\n  // Water labels\n  ctx.save();\n  ctx.font = 'italic 11px Georgia, serif';\n  ctx.fillStyle = 'rgba(56, 189, 248, 0.30)';\n  ctx.textAlign = 'center';\n  [\n    { name: 'MEDITERRANEAN SEA', lon: 29.5, lat: 33.8 },\n    { name: 'RED SEA', lon: 38.2, lat: 20.5 },\n    { name: 'PERSIAN GULF', lon: 51.5, lat: 26.8 },\n    { name: 'ARABIAN SEA', lon: 61.5, lat: 18.5 },\n    { name: 'CASPIAN SEA', lon: 51.2, lat: 40.2 }\n  ].forEach(s => {\n    const [sx, sy] = geoToScreen(s.lon, s.lat, w, h);\n    ctx.fillText(s.name, sx, sy);\n  });\n  ctx.restore();\n\n  // 4. Static Indus Valley Civilization (IVC) Zone Polygon (Translucent Green)\n  if (document.getElementById('chkIVC').checked) {\n    drawPolygon(\n      IVC_STATIC_ZONE.pts,\n      w,\n      h,\n      'rgba(16, 185, 129, 0.22)',\n      '#10b981',\n      2.0,\n      [6, 4]\n    );\n    const [ivcX, ivcY] = geoToScreen(71.2, 28.1, w, h);\n    ctx.save();\n    ctx.font = 'bold 10.5px sans-serif';\n    ctx.textAlign = 'center';\n    const w1 = ctx.measureText(IVC_STATIC_ZONE.name).width;\n    const w2 = ctx.measureText(IVC_STATIC_ZONE.span).width;\n    const boxW = Math.max(w1, w2) + 12;\n    ctx.fillStyle = 'rgba(6, 28, 22, 0.88)';\n    ctx.fillRect(ivcX - boxW / 2, ivcY - 14, boxW, 28);\n    ctx.strokeStyle = '#10b981';\n    ctx.lineWidth = 1.2;\n    ctx.strokeRect(ivcX - boxW / 2, ivcY - 14, boxW, 28);\n    ctx.fillStyle = '#6ee7b7';\n    ctx.fillText(IVC_STATIC_ZONE.name, ivcX, ivcY - 2);\n    ctx.font = '600 9px sans-serif';\n    ctx.fillStyle = '#a7f3d0';\n    ctx.fillText(IVC_STATIC_ZONE.span, ivcX, ivcY + 10);\n    ctx.restore();\n  }\n\n  // 5. Mountain relief\n  if (document.getElementById('chkTerrain').checked) {\n    ctx.save();\n    MOUNTAIN_RANGES.forEach(mr => {\n      drawPolyline(mr.pts, w, h, 'rgba(148, 163, 184, 0.22)', 8, [3, 5]);\n      const mid = mr.pts[Math.floor(mr.pts.length / 2)];\n      const [mx, my] = geoToScreen(mid[0], mid[1], w, h);\n      ctx.font = 'bold 9.5px sans-serif';\n      ctx.fillStyle = 'rgba(203, 213, 225, 0.42)';\n      ctx.textAlign = 'center';\n      ctx.fillText(`▲ ${mr.name}`, mx, my - 7);\n    });\n    ctx.restore();\n  }\n\n  // 6. Modern borders\n  if (document.getElementById('chkBorders').checked) {\n    MODERN_BORDERS.forEach(b => drawPolyline(b, w, h, 'rgba(148, 163, 184, 0.34)', 1.1, [4, 4]));\n    ctx.save();\n    ctx.font = '700 10px sans-serif';\n    ctx.fillStyle = 'rgba(148, 163, 184, 0.38)';\n    ctx.textAlign = 'center';\n    COUNTRY_LABELS.forEach(c => {\n      const [cx, cy] = geoToScreen(c.lon, c.lat, w, h);\n      ctx.fillText(c.name, cx, cy);\n    });\n    ctx.restore();\n  }\n\n  // 7. Rivers\n  if (document.getElementById('chkRivers').checked) {\n    RIVERS.forEach(r => drawPolyline(r.pts, w, h, 'rgba(56, 189, 248, 0.52)', 1.6, r.dash || []));\n  }\n\n  const stageIdx = Math.min(EPOCHS.length - 1, Math.round(currentSlider / 100));\n  const activeEpoch = EPOCHS[stageIdx];\n\n  // 8. Dynamic historical polygons\n  if (document.getElementById('chkPolygons').checked) {\n    activeEpoch.polygons.forEach(p => {\n      drawPolygon(p.pts, w, h, p.color, p.stroke, 1.8);\n      let sumLon = 0, sumLat = 0;\n      p.pts.forEach(([lo, la]) => { sumLon += lo; sumLat += la; });\n      const [lx, ly] = geoToScreen(sumLon / p.pts.length, sumLat / p.pts.length, w, h);\n      ctx.save();\n      ctx.font = 'bold 10.5px sans-serif';\n      ctx.textAlign = 'center';\n      ctx.fillStyle = 'rgba(11,14,20,0.72)';\n      const tw = ctx.measureText(p.name).width;\n      ctx.fillRect(lx - tw / 2 - 4, ly - 7, tw + 8, 14);\n      ctx.fillStyle = '#fff';\n      ctx.fillText(p.name, lx, ly + 3);\n      ctx.restore();\n    });\n  }\n\n  // 9. Action vectors\n  if (document.getElementById('chkVectors').checked) {\n    activeEpoch.vectors.forEach(v => drawArrowVector(v, w, h, animPhase));\n  }\n\n  // 10. Reference cities (including IVC urban nodes)\n  if (document.getElementById('chkCities').checked) {\n    ctx.save();\n    CITIES.forEach(city => {\n      if (city.type === 'ivc' && !document.getElementById('chkIVC').checked) return;\n      const [cx, cy] = geoToScreen(city.lon, city.lat, w, h);\n      ctx.beginPath();\n      ctx.arc(cx, cy, city.type === 'modern' ? 2.5 : 3.2, 0, Math.PI * 2);\n      ctx.fillStyle = city.type === 'ivc' ? '#34d399' : (city.type === 'ancient' ? '#fbbf24' : '#cbd5e1');\n      ctx.fill();\n      ctx.font = city.type === 'modern' ? '9.5px sans-serif' : 'bold 10px sans-serif';\n      ctx.fillStyle = city.type === 'ivc' ? '#6ee7b7' : (city.type === 'ancient' ? '#fde68a' : '#94a3b8');\n      ctx.textAlign = 'left';\n      ctx.fillText(city.name, cx + 5, cy + 3);\n    });\n    ctx.restore();\n  }\n\n  // 11. Bio-Attrition Hazard Rings\n  if (document.getElementById('chkBio').checked) {\n    activeEpoch.bioEvents\n      .filter(ev => activeBioFilter === 'all' || ev.type === activeBioFilter)\n      .forEach(ev => drawBioHazardNode(ev, w, h, animPhase));\n  }\n}\n\nlet lastStage = -1;\nfunction tick() {\n  animPhase += 0.008;\n  if (playing) {\n    currentSlider += 0.35;\n    if (currentSlider >= 500) {\n      currentSlider = 500;\n      playing = false;\n      updatePlayBtn();\n    }\n    document.getElementById('timeSlider').value = Math.floor(currentSlider);\n  }\n  const st = Math.round(currentSlider / 100);\n  if (st !== lastStage) {\n    lastStage = st;\n    updateSidebar(st);\n  }\n  render();\n  requestAnimationFrame(tick);\n}\n\nupdateSidebar(0);\nsetZoom(0.88);\nrequestAnimationFrame(tick);\n</script>\n</body>\n</html>"}