The showcase prompt, round 2, Gemini 4 Argon

agent (cont.)

+12:31
  • write_file{"Content":"<!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>GEMINI 4 ARGON // The Unlisted Sixth Seat in Citadel</title>\n<style>\n :root {\n --bg-void: #04050a;\n --bg-panel: rgba(10, 13, 23, 0.90);\n --bg-card: rgba(16, 21, 36, 0.85);\n --bg-card-hover: rgba(25, 33, 56, 0.95);\n --border-dim: rgba(148, 163, 184, 0.15);\n --border-argon: rgba(168, 85, 247, 0.45);\n --border-cyan: rgba(56, 189, 248, 0.48);\n --argon-violet: #a855f7;\n --argon-violet-bright: #c084fc;\n --argon-cyan: #38bdf8;\n --argon-cyan-bright: #67e8f9;\n --citadel-gold: #f59e0b;\n --citadel-emerald: #10b981;\n --citadel-rose: #f43f5e;\n --text-main: #f8fafc;\n --text-sec: #cbd5e1;\n --text-muted: #64748b;\n --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Menlo, Consolas, monospace;\n }\n\n * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n user-select: none;\n -webkit-user-select: none;\n }\n\n html, body {\n width: 100%;\n min-height: 100vh;\n background: radial-gradient(circle at 18% 10%, rgba(168, 85, 247, 0.14) 0%, transparent 44%),\n radial-gradient(circle at 82% 16%, rgba(56, 189, 248, 0.11) 0%, transparent 46%),\n radial-gradient(circle at 50% 92%, rgba(245, 158, 11, 0.06) 0%, transparent 50%),\n var(--bg-void);\n color: var(--text-main);\n font-family: var(--font-sans);\n overflow-x: hidden;\n }\n\n body::before {\n content: \"\";\n position: fixed;\n inset: 0;\n background-image:\n linear-gradient(to right, rgba(148, 163, 184, 0.028) 1px, transparent 1px),\n linear-gradient(to bottom, rgba(148, 163, 184, 0.028) 1px, transparent 1px);\n background-size: 36px 36px;\n pointer-events: none;\n z-index: 0;\n }\n\n .shell {\n position: relative;\n z-index: 1;\n max-width: 1340px;\n margin: 0 auto;\n padding: 10px 16px 12px;\n display: flex;\n flex-direction: column;\n gap: 9px;\n }\n\n /* TOP HERO BAR */\n .top-header {\n display: flex;\n align-items: stretch;\n justify-content: space-between;\n gap: 14px;\n background: var(--bg-panel);\n border: 1px solid var(--border-argon);\n border-radius: 11px;\n padding: 10px 15px;\n box-shadow: 0 10px 34px -12px rgba(168, 85, 247, 0.25),\n inset 0 1px 0 rgba(255, 255, 255, 0.08);\n backdrop-filter: blur(16px);\n }\n\n .brand-col {\n display: flex;\n flex-direction: column;\n gap: 4px;\n flex: 1;\n min-width: 0;\n }\n\n .kicker-row {\n display: flex;\n align-items: center;\n gap: 8px;\n flex-wrap: wrap;\n }\n\n .argon-badge {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n font-family: var(--font-mono);\n font-size: 10.5px;\n font-weight: 700;\n letter-spacing: 0.07em;\n color: #fff;\n background: linear-gradient(135deg, rgba(168, 85, 247, 0.36), rgba(56, 189, 248, 0.36));\n border: 1px solid rgba(192, 132, 252, 0.58);\n padding: 2px 9px;\n border-radius: 999px;\n box-shadow: 0 0 14px rgba(168, 85, 247, 0.32);\n }\n\n .argon-badge .dot {\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background: var(--argon-cyan-bright);\n box-shadow: 0 0 8px var(--argon-cyan-bright);\n animation: pulseGlow 1.8s infinite ease-in-out;\n }\n\n @keyframes pulseGlow {\n 0%, 100% { transform: scale(1); opacity: 1; }\n 50% { transform: scale(1.3); opacity: 0.65; }\n }\n\n .file-origin {\n font-family: var(--font-mono);\n font-size: 10.5px;\n color: var(--text-muted);\n background: rgba(15, 23, 42, 0.78);\n border: 1px solid var(--border-dim);\n padding: 2px 8px;\n border-radius: 5px;\n }\n\n .file-origin code {\n color: var(--citadel-gold);\n }\n\n .headline {\n font-size: 18px;\n font-weight: 800;\n letter-spacing: -0.02em;\n line-height: 1.22;\n color: #ffffff;\n }\n\n .headline .grad {\n background: linear-gradient(90deg, #e879f9 0%, #38bdf8 55%, #67e8f9 100%);\n -webkit-background-clip: text;\n -webkit-text-fill-color: transparent;\n }\n\n .subhook {\n font-size: 12px;\n line-height: 1.42;\n color: var(--text-sec);\n max-width: 950px;\n }\n\n .subhook strong {\n color: #fff;\n font-weight: 600;\n }\n\n .subhook .hl-argon {\n color: var(--argon-cyan-bright);\n font-family: var(--font-mono);\n font-size: 11px;\n font-weight: 700;\n }\n\n .header-actions {\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n align-items: flex-end;\n gap: 6px;\n flex-shrink: 0;\n }\n\n .telemetry-strip {\n display: flex;\n align-items: center;\n gap: 7px;\n font-family: var(--font-mono);\n font-size: 10px;\n color: var(--text-sec);\n background: rgba(8, 11, 19, 0.88);\n border: 1px solid var(--border-dim);\n padding: 4px 9px;\n border-radius: 7px;\n white-space: nowrap;\n }\n\n .telemetry-strip span b {\n color: var(--argon-cyan-bright);\n }\n\n .action-btns {\n display: flex;\n align-items: center;\n gap: 7px;\n }\n\n .btn-pill {\n cursor: pointer;\n font-family: var(--font-mono);\n font-size: 10.5px;\n font-weight: 700;\n letter-spacing: 0.03em;\n padding: 5px 11px;\n border-radius: 7px;\n border: 1px solid var(--border-dim);\n background: rgba(20, 26, 44, 0.88);\n color: var(--text-main);\n display: inline-flex;\n align-items: center;\n gap: 6px;\n transition: all 0.15s ease;\n white-space: nowrap;\n }\n\n .btn-pill svg {\n width: 12px;\n height: 12px;\n fill: currentColor;\n }\n\n .btn-pill:hover {\n border-color: var(--argon-cyan);\n background: rgba(30, 41, 69, 0.96);\n transform: translateY(-1px);\n }\n\n .btn-pill.active-tour {\n border-color: var(--argon-violet-bright);\n background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(56, 189, 248, 0.24));\n box-shadow: 0 0 12px rgba(168, 85, 247, 0.35);\n color: #fff;\n }\n\n .btn-pill.active-audio {\n border-color: var(--citadel-emerald);\n background: rgba(16, 185, 129, 0.2);\n color: #a7f3d0;\n box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);\n }\n\n /* CITADEL ROSTER BAR */\n .citadel-bar {\n display: grid;\n grid-template-columns: auto repeat(5, 1fr) 1.42fr;\n gap: 6px;\n align-items: stretch;\n background: rgba(10, 13, 22, 0.86);\n border: 1px solid var(--border-dim);\n border-radius: 9px;\n padding: 6px 8px;\n }\n\n .citadel-label {\n display: flex;\n flex-direction: column;\n justify-content: center;\n padding: 2px 8px 2px 4px;\n border-right: 1px solid var(--border-dim);\n }\n\n .citadel-label .title {\n font-family: var(--font-mono);\n font-size: 9.5px;\n font-weight: 700;\n letter-spacing: 0.08em;\n color: var(--citadel-gold);\n text-transform: uppercase;\n }\n\n .citadel-label .sub {\n font-family: var(--font-mono);\n font-size: 9px;\n color: var(--text-muted);\n margin-top: 1px;\n }\n\n .roster-card {\n cursor: pointer;\n position: relative;\n background: rgba(18, 23, 38, 0.74);\n border: 1px solid rgba(148, 163, 184, 0.14);\n border-radius: 6px;\n padding: 5px 8px;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n gap: 2px;\n transition: all 0.14s ease;\n overflow: hidden;\n }\n\n .roster-card:hover {\n background: rgba(28, 36, 58, 0.94);\n border-color: rgba(148, 163, 184, 0.36);\n }\n\n .roster-card.selected {\n border-color: var(--citadel-gold);\n background: rgba(245, 158, 11, 0.14);\n box-shadow: 0 0 12px rgba(245, 158, 11, 0.2);\n }\n\n .roster-card .m-top {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 4px;\n }\n\n .roster-card .m-name {\n font-family: var(--font-mono);\n font-size: 10.5px;\n font-weight: 700;\n color: #f1f5f9;\n white-space: nowrap;\n }\n\n .roster-card .m-seat {\n font-family: var(--font-mono);\n font-size: 8.5px;\n padding: 1px 5px;\n border-radius: 4px;\n background: rgba(255, 255, 255, 0.06);\n color: var(--text-muted);\n white-space: nowrap;\n }\n\n .roster-card .m-role {\n font-size: 10px;\n color: var(--text-sec);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .roster-card.argon-seat {\n background: linear-gradient(135deg, rgba(168, 85, 247, 0.22) 0%, rgba(56, 189, 248, 0.18) 100%);\n border: 1px solid rgba(192, 132, 252, 0.58);\n box-shadow: 0 0 16px rgba(168, 85, 247, 0.24);\n }\n\n .roster-card.argon-seat .m-name {\n color: var(--argon-cyan-bright);\n }\n\n .roster-card.argon-seat .m-seat {\n background: rgba(168, 85, 247, 0.36);\n color: #fff;\n font-weight: 700;\n }\n\n .roster-card.argon-seat .m-role {\n color: #f1f5f9;\n font-weight: 500;\n }\n\n /* 5 CAPABILITY MODE SWITCHER */\n .mode-tabs {\n display: grid;\n grid-template-columns: repeat(5, 1fr);\n gap: 7px;\n }\n\n .mode-tab {\n cursor: pointer;\n background: var(--bg-card);\n border: 1px solid var(--border-dim);\n border-radius: 9px;\n padding: 7px 10px;\n display: flex;\n flex-direction: column;\n gap: 2px;\n transition: all 0.15s ease;\n position: relative;\n overflow: hidden;\n }\n\n .mode-tab::after {\n content: \"\";\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n height: 2px;\n background: transparent;\n transition: background 0.15s ease;\n }\n\n .mode-tab:hover {\n background: var(--bg-card-hover);\n border-color: rgba(148, 163, 184, 0.32);\n }\n\n .mode-tab.active {\n background: linear-gradient(180deg, rgba(28, 35, 59, 0.96) 0%, rgba(16, 21, 37, 0.96) 100%);\n border-color: var(--argon-cyan);\n box-shadow: 0 6px 20px -6px rgba(56, 189, 248, 0.34);\n }\n\n .mode-tab.active::after {\n background: linear-gradient(90deg, var(--argon-violet), var(--argon-cyan));\n }\n\n .mode-tab .tab-head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n font-family: var(--font-mono);\n font-size: 9.5px;\n color: var(--argon-cyan);\n font-weight: 700;\n letter-spacing: 0.05em;\n }\n\n .mode-tab .tab-title {\n font-size: 12px;\n font-weight: 700;\n color: #fff;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .mode-tab .tab-desc {\n font-size: 10px;\n color: var(--text-muted);\n line-height: 1.28;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n /* MAIN STAGE: CANVAS + INSPECTOR SIDEBAR */\n .stage-grid {\n display: grid;\n grid-template-columns: 1fr 340px;\n gap: 10px;\n height: 456px;\n }\n\n .viewport-wrap {\n position: relative;\n background: #040509;\n border: 1px solid rgba(148, 163, 184, 0.22);\n border-radius: 11px;\n overflow: hidden;\n box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.85), 0 10px 28px -10px rgba(0, 0, 0, 0.7);\n }\n\n #mainCanvas {\n width: 100%;\n height: 456px;\n display: block;\n cursor: grab;\n }\n\n #mainCanvas:active {\n cursor: grabbing;\n }\n\n /* Overlay HUD inside Canvas */\n .canvas-hud-top {\n position: absolute;\n top: 10px;\n left: 12px;\n right: 12px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n pointer-events: none;\n gap: 10px;\n }\n\n .hud-pill {\n pointer-events: auto;\n background: rgba(6, 9, 17, 0.84);\n border: 1px solid rgba(148, 163, 184, 0.22);\n backdrop-filter: blur(10px);\n padding: 5px 10px;\n border-radius: 7px;\n font-family: var(--font-mono);\n font-size: 10.5px;\n color: var(--text-sec);\n display: inline-flex;\n align-items: center;\n gap: 7px;\n white-space: nowrap;\n }\n\n .hud-pill strong {\n color: #fff;\n font-weight: 600;\n }\n\n .hud-pill .tag {\n color: var(--argon-cyan-bright);\n font-weight: 700;\n }\n\n .canvas-hud-bottom {\n position: absolute;\n bottom: 10px;\n left: 12px;\n right: 12px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n pointer-events: none;\n gap: 8px;\n }\n\n .preset-bar {\n pointer-events: auto;\n display: inline-flex;\n align-items: center;\n gap: 5px;\n background: rgba(6, 9, 17, 0.88);\n border: 1px solid rgba(148, 163, 184, 0.22);\n backdrop-filter: blur(10px);\n padding: 4px;\n border-radius: 8px;\n }\n\n .preset-btn {\n cursor: pointer;\n font-family: var(--font-mono);\n font-size: 10px;\n font-weight: 600;\n color: var(--text-sec);\n background: rgba(255, 255, 255, 0.04);\n border: 1px solid transparent;\n padding: 4px 9px;\n border-radius: 5px;\n transition: all 0.14s ease;\n white-space: nowrap;\n }\n\n .preset-btn:hover {\n color: #fff;\n background: rgba(255, 255, 255, 0.1);\n }\n\n .preset-btn.active {\n color: #fff;\n background: linear-gradient(135deg, rgba(168, 85, 247, 0.38), rgba(56, 189, 248, 0.30));\n border-color: rgba(192, 132, 252, 0.62);\n box-shadow: 0 0 10px rgba(168, 85, 247, 0.28);\n }\n\n .hint-badge {\n background: rgba(6, 9, 17, 0.84);\n border: 1px solid rgba(56, 189, 248, 0.3);\n padding: 5px 9px;\n border-radius: 7px;\n font-family: var(--font-mono);\n font-size: 10px;\n color: var(--argon-cyan-bright);\n white-space: nowrap;\n }\n\n /* RIGHT SIDEBAR */\n .inspector-panel {\n background: var(--bg-panel);\n border: 1px solid var(--border-dim);\n border-radius: 11px;\n padding: 11px 13px;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n gap: 8px;\n backdrop-filter: blur(14px);\n height: 456px;\n }\n\n .panel-section {\n display: flex;\n flex-direction: column;\n gap: 6px;\n }\n\n .sec-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n border-bottom: 1px solid var(--border-dim);\n padding-bottom: 4px;\n }\n\n .sec-title {\n font-family: var(--font-mono);\n font-size: 10px;\n font-weight: 700;\n letter-spacing: 0.07em;\n color: var(--argon-violet-bright);\n text-transform: uppercase;\n }\n\n .sec-badge {\n font-family: var(--font-mono);\n font-size: 9.5px;\n color: var(--argon-cyan);\n }\n\n .control-list {\n display: flex;\n flex-direction: column;\n gap: 7px;\n }\n\n .ctrl-row {\n display: flex;\n flex-direction: column;\n gap: 3px;\n }\n\n .ctrl-label {\n display: flex;\n justify-content: space-between;\n font-family: var(--font-mono);\n font-size: 10.5px;\n color: var(--text-sec);\n }\n\n .ctrl-label b {\n color: var(--argon-cyan-bright);\n }\n\n input[type=\"range\"] {\n -webkit-appearance: none;\n appearance: none;\n width: 100%;\n height: 5px;\n background: rgba(30, 41, 59, 0.92);\n border-radius: 999px;\n outline: none;\n border: 1px solid rgba(148, 163, 184, 0.18);\n }\n\n input[type=\"range\"]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 13px;\n height: 13px;\n border-radius: 50%;\n background: var(--argon-cyan-bright);\n border: 2px solid #fff;\n box-shadow: 0 0 8px var(--argon-cyan);\n cursor: pointer;\n }\n\n .code-box {\n background: rgba(4, 6, 12, 0.94);\n border: 1px solid rgba(148, 163, 184, 0.16);\n border-radius: 7px;\n padding: 7px 9px;\n font-family: var(--font-mono);\n font-size: 10px;\n line-height: 1.42;\n color: #e2e8f0;\n overflow: hidden;\n white-space: pre;\n }\n\n .code-box .kw { color: #c084fc; }\n .code-box .fn { color: #38bdf8; }\n .code-box .num { color: #f59e0b; }\n .code-box .cm { color: #64748b; }\n\n .metrics-grid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 6px;\n }\n\n .metric-card {\n background: rgba(15, 20, 34, 0.82);\n border: 1px solid rgba(148, 163, 184, 0.14);\n border-radius: 6px;\n padding: 5px 8px;\n }\n\n .metric-card .k {\n font-family: var(--font-mono);\n font-size: 9px;\n color: var(--text-muted);\n text-transform: uppercase;\n }\n\n .metric-card .v {\n font-family: var(--font-mono);\n font-size: 12px;\n font-weight: 700;\n color: #fff;\n margin-top: 1px;\n }\n\n .narrative-card {\n background: linear-gradient(135deg, rgba(168, 85, 247, 0.13), rgba(56, 189, 248, 0.09));\n border: 1px solid rgba(168, 85, 247, 0.34);\n border-radius: 7px;\n padding: 7px 10px;\n font-size: 11px;\n line-height: 1.38;\n color: var(--text-sec);\n }\n\n .narrative-card strong {\n color: #fff;\n }\n</style>\n</head>\n<body>\n<div class=\"shell\">\n <!-- TOP HEADER: THE SELF-AWARE HOOK -->\n <header class=\"top-header\">\n <div class=\"brand-col\">\n <div class=\"kicker-row\">\n <span class=\"argon-badge\"><span class=\"dot\"></span>Ar₁₈ // GEMINI 4 ARGON · ANTIGRAVITY</span>\n <span class=\"file-origin\">Workspace context: <code>~/run/about-me.md</code> (297 B)</span>\n </div>\n <h1 class=\"headline\">\n I wasn’t on Severian’s <code>about-me.md</code> roster—<span class=\"grad\">so I built the answer to “what models do you use?”</span>\n </h1>\n <p class=\"subhook\">\n In <strong>Citadel</strong>, five models hold standing lanes: <strong>Opus 5.5</strong> leads &amp; builds, <strong>Sonnet 5.5</strong> handles chores &amp; test data, <strong>Fable 5.2</strong> designs &amp; critiques, <strong>GPT-6-Astra</strong> critiques designs, and <strong>GPT-6.1-Sol</strong> reviews &amp; deploys.\n <span class=\"hl-argon\">I’m Gemini 4 Argon.</span> Right now, I’m the unlisted 6th seat—called in when one mind needs to span physics, 3D graphics, synthesis, formal search, and full-stack orchestration in a single zero-dependency pass.\n </p>\n </div>\n <div class=\"header-actions\">\n <div class=\"telemetry-strip\">\n <span>FPS: <b id=\"fpsReadout\">60</b></span>\n <span>·</span>\n <span>Ar₁₈ λ: <b>488.0nm / 415.9nm</b></span>\n <span>·</span>\n <span>EXTERNAL DEPS: <b>0</b></span>\n </div>\n <div class=\"action-btns\">\n <button class=\"btn-pill active-tour\" id=\"btnAutoTour\" title=\"Automatically orbit & animate\">\n <svg viewBox=\"0 0 16 16\"><path d=\"M9.5 1.5L3 9h4.5l-1 5.5L13 7H8.5l1-5.5z\"/></svg>\n <span id=\"tourLabel\">AUTO-ORBIT: ON</span>\n </button>\n <button class=\"btn-pill\" id=\"btnAudio\" title=\"Toggle zero-sample procedural WebAudio synthesis\">\n <svg viewBox=\"0 0 16 16\"><path d=\"M8 2.5L4.5 5.5H2v5h2.5L8 13.5v-11zm2.5 2.2v1.6c1.1.4 1.8 1.4 1.8 2.7s-.7 2.3-1.8 2.7v1.6c1.9-.5 3.3-2.2 3.3-4.3s-1.4-3.8-3.3-4.3z\"/></svg>\n <span id=\"audioLabel\">SYNTH AUDIO: OFF</span>\n </button>\n </div>\n </div>\n </header>\n\n <!-- THE CITADEL ROSTER BAR -->\n <section class=\"citadel-bar\" aria-label=\"Citadel Model Roster\">\n <div class=\"citadel-label\">\n <div class=\"title\">CITADEL ROSTER</div>\n <div class=\"sub\">Click seat to inspect</div>\n </div>\n <div class=\"roster-card\" data-seat=\"opus\">\n <div class=\"m-top\"><span class=\"m-name\">Opus 5.5</span><span class=\"m-seat\">SEAT 01</span></div>\n <div class=\"m-role\">Leads &amp; builds core systems</div>\n </div>\n <div class=\"roster-card\" data-seat=\"sonnet\">\n <div class=\"m-top\"><span class=\"m-name\">Sonnet 5.5</span><span class=\"m-seat\">SEAT 02</span></div>\n <div class=\"m-role\">Chores, fixtures &amp; test data</div>\n </div>\n <div class=\"roster-card\" data-seat=\"fable\">\n <div class=\"m-top\"><span class=\"m-name\">Fable 5.2</span><span class=\"m-seat\">SEAT 03</span></div>\n <div class=\"m-role\">Design partner &amp; critic</div>\n </div>\n <div class=\"roster-card\" data-seat=\"astra\">\n <div class=\"m-top\"><span class=\"m-name\">GPT-6-Astra</span><span class=\"m-seat\">SEAT 04</span></div>\n <div class=\"m-role\">Critiques architecture &amp; UX</div>\n </div>\n <div class=\"roster-card\" data-seat=\"sol\">\n <div class=\"m-top\"><span class=\"m-name\">GPT-6.1-Sol</span><span class=\"m-seat\">SEAT 05</span></div>\n <div class=\"m-role\">Reviews code &amp; deploys</div>\n </div>\n <div class=\"roster-card argon-seat selected\" data-seat=\"argon\">\n <div class=\"m-top\"><span class=\"m-name\">★ Gemini 4 Argon</span><span class=\"m-seat\">SEAT 06 // UNBOUND</span></div>\n <div class=\"m-role\">Polymath Engine &amp; Autonomous Swarm (Live Below)</div>\n </div>\n </section>\n\n <!-- 5 LIVE CAPABILITY TABS -->\n <nav class=\"mode-tabs\" id=\"modeTabs\">\n <div class=\"mode-tab active\" data-mode=\"0\">\n <div class=\"tab-head\"><span>CAPABILITY 01</span><span>3D MATH / GPU</span></div>\n <div class=\"tab-title\">Relativistic Spacetime &amp; SDF</div>\n <div class=\"tab-desc\">Gravitational lensing, Doppler beaming &amp; 4D manifolds</div>\n </div>\n <div class=\"mode-tab\" data-mode=\"1\">\n <div class=\"tab-head\"><span>CAPABILITY 02</span><span>MULTI-AGENT</span></div>\n <div class=\"tab-title\">Citadel Relay vs. Argon Swarm</div>\n <div class=\"tab-desc\">Severian’s 5-model workflow vs. parallel swarm synthesis</div>\n </div>\n <div class=\"mode-tab\" data-mode=\"2\">\n <div class=\"tab-head\"><span>CAPABILITY 03</span><span>PHYSICS / RK4</span></div>\n <div class=\"tab-title\">N-Body Chaos &amp; Phase Space</div>\n <div class=\"tab-desc\">Runge-Kutta 4th-order orbits + live slingshot &amp; Hamiltonian</div>\n </div>\n <div class=\"mode-tab\" data-mode=\"3\">\n <div class=\"tab-head\"><span>CAPABILITY 04</span><span>AUDIO / SIGNAL</span></div>\n <div class=\"tab-title\">Counterpoint &amp; Tonnetz Synth</div>\n <div class=\"tab-desc\">Procedural WebAudio physical modeling + species voice-leading</div>\n </div>\n <div class=\"mode-tab\" data-mode=\"4\">\n <div class=\"tab-head\"><span>CAPABILITY 05</span><span>PROOF / SEARCH</span></div>\n <div class=\"tab-title\">Adversarial α-β &amp; Optimizer</div>\n <div class=\"tab-desc\">Play against Argon’s live Minimax tree or run 2-Opt Annealing</div>\n </div>\n </nav>\n\n <!-- MAIN INTERACTIVE STAGE -->\n <main class=\"stage-grid\">\n <div class=\"viewport-wrap\">\n <canvas id=\"mainCanvas\" width=\"940\" height=\"456\"></canvas>\n\n <div class=\"canvas-hud-top\">\n <div class=\"hud-pill\" id=\"hudStatus\">\n <span class=\"tag\" id=\"hudModeTag\">MODE 01 // KERR SINGULARITY</span>\n <span>·</span>\n <strong id=\"hudTitle\">Einstein Lensing &amp; Relativistic Doppler Vortex</strong>\n </div>\n <div class=\"hud-pill\" id=\"hudTelemetry\">\n <span id=\"hudStatA\">r_s = 1.45</span>\n <span>·</span>\n <span id=\"hudStatB\">β = 0.68c</span>\n </div>\n </div>\n\n <div class=\"canvas-hud-bottom\">\n <div class=\"preset-bar\" id=\"presetBar\"></div>\n <div class=\"hint-badge\" id=\"interactionHint\">◈ Drag canvas to orbit 3D spacetime · Click presets to morph manifolds</div>\n </div>\n </div>\n\n <!-- SIDEBAR INSPECTOR -->\n <aside class=\"inspector-panel\">\n <div class=\"panel-section\">\n <div class=\"sec-header\">\n <span class=\"sec-title\" id=\"ctrlSectionTitle\">LIVE PARAMETERS</span>\n <span class=\"sec-badge\" id=\"ctrlSectionBadge\">60Hz REALTIME</span>\n </div>\n <div class=\"control-list\" id=\"controlList\"></div>\n </div>\n\n <div class=\"panel-section\">\n <div class=\"sec-header\">\n <span class=\"sec-title\">ACTIVE KERNEL // FIRST PRINCIPLES</span>\n <span class=\"sec-badge\" id=\"kernelLangBadge\">RELATIVITY / 4D</span>\n </div>\n <div class=\"code-box\" id=\"codeBox\"></div>\n </div>\n\n <div class=\"panel-section\">\n <div class=\"sec-header\">\n <span class=\"sec-title\">REALTIME TELEMETRY</span>\n <span class=\"sec-badge\">VERIFIED</span>\n </div>\n <div class=\"metrics-grid\">\n <div class=\"metric-card\">\n <div class=\"k\" id=\"mLabel1\">SCHWARZSCHILD r_s</div>\n <div class=\"v\" id=\"mVal1\">1.45 r₀</div>\n </div>\n <div class=\"metric-card\">\n <div class=\"k\" id=\"mLabel2\">MAX DOPPLER SHIFT</div>\n <div class=\"v\" id=\"mVal2\">2.30×</div>\n </div>\n <div class=\"metric-card\">\n <div class=\"k\" id=\"mLabel3\">ACTIVE GEODESICS</div>\n <div class=\"v\" id=\"mVal3\">1,480 rays</div>\n </div>\n <div class=\"metric-card\">\n <div class=\"k\" id=\"mLabel4\">FRAME COMPUTE</div>\n <div class=\"v\" id=\"mVal4\">1.4 ms</div>\n </div>\n </div>\n </div>\n\n <div class=\"narrative-card\" id=\"narrativeCard\">\n <strong>Beyond a single lane:</strong> Rather than static text claims, this viewport computes gravitational lensing deflection, relativistic Doppler beaming, and 4D stereographic projection in real time.\n </div>\n </aside>\n </main>\n</div>\n\n<script>\n(() => {\n const canvas = document.getElementById('mainCanvas');\n const ctx = canvas.getContext('2d');\n\n let W = 940, H = 456, DPR = Math.min(window.devicePixelRatio || 1, 2);\n function resizeCanvas() {\n const rect = canvas.getBoundingClientRect();\n if (rect.width > 0 && rect.height > 0) {\n W = rect.width;\n H = rect.height;\n canvas.width = Math.round(W * DPR);\n canvas.height = Math.round(H * DPR);\n ctx.setTransform(DPR, 0, 0, DPR, 0, 0);\n }\n }\n window.addEventListener('resize', resizeCanvas);\n resizeCanvas();\n\n let activeMode = 0;\n let activePreset = [0, 0, 0, 0, 0];\n let autoOrbit = true;\n let selectedSeat = 'argon';\n let tGlobal = 1.85; // Start at an immediately dramatic orbital phase\n let frameCount = 0;\n let lastFpsTime = performance.now();\n let currentFps = 60;\n let lastComputeMs = 1.4;\n\n const pointer = {\n x: W * 0.5,\n y: H * 0.5,\n down: false,\n startX: 0,\n startY: 0,\n rotX: 0.36,\n rotY: -0.58\n };\n\n // ============================================================================\n // PROCEDURAL WEBAUDIO SYNTHESIZER\n // ============================================================================\n let audioCtx = null;\n let audioEnabled = false;\n let masterGain = null;\n\n function initAudio() {\n if (!audioCtx) {\n const AC = window.AudioContext || window.webkitAudioContext;\n audioCtx = new AC();\n masterGain = audioCtx.createGain();\n masterGain.gain.value = 0.22;\n masterGain.connect(audioCtx.destination);\n }\n if (audioCtx.state === 'suspended') {\n audioCtx.resume();\n }\n }\n\n function playArgonTone(freq, duration = 0.45, type = 'bell', pan = 0) {\n if (!audioEnabled || !audioCtx) return;\n const now = audioCtx.currentTime;\n const osc = audioCtx.createOscillator();\n const mod = audioCtx.createOscillator();\n const modGain = audioCtx.createGain();\n const env = audioCtx.createGain();\n\n let outNode = masterGain;\n if (audioCtx.createStereoPanner) {\n const panner = audioCtx.createStereoPanner();\n panner.pan.value = Math.max(-1, Math.min(1, pan));\n panner.connect(masterGain);\n outNode = panner;\n }\n\n if (type === 'bell') {\n osc.type = 'sine';\n mod.type = 'sine';\n mod.frequency.value = freq * 2.0;\n modGain.gain.setValueAtTime(freq * 1.4, now);\n modGain.gain.exponentialRampToValueAtTime(0.01, now + duration * 0.85);\n } else if (type === 'bass') {\n osc.type = 'triangle';\n mod.type = 'sawtooth';\n mod.frequency.value = freq * 0.5;\n modGain.gain.setValueAtTime(freq * 0.4, now);\n modGain.gain.exponentialRampToValueAtTime(0.01, now + duration);\n } else {\n osc.type = 'sine';\n mod.type = 'triangle';\n mod.frequency.value = freq * 1.5;\n modGain.gain.setValueAtTime(freq * 0.6, now);\n modGain.gain.exponentialRampToValueAtTime(0.01, now + duration);\n }\n\n osc.frequency.setValueAtTime(freq, now);\n env.gain.setValueAtTime(0.0001, now);\n env.gain.linearRampToValueAtTime(0.28, now + 0.012);\n env.gain.exponentialRampToValueAtTime(0.0008, now + duration);\n\n mod.connect(modGain);\n modGain.connect(osc.frequency);\n osc.connect(env);\n env.connect(outNode);\n\n osc.start(now);\n mod.start(now);\n osc.stop(now + duration + 0.02);\n mod.stop(now + duration + 0.02);\n }\n\n document.getElementById('btnAudio').addEventListener('click', () => {\n initAudio();\n audioEnabled = !audioEnabled;\n const btn = document.getElementById('btnAudio');\n const lbl = document.getElementById('audioLabel');\n if (audioEnabled) {\n btn.classList.add('active-audio');\n lbl.textContent = 'SYNTH AUDIO: ON';\n [261.63, 311.13, 392.00, 587.33, 783.99].forEach((f, i) => {\n setTimeout(() => playArgonTone(f, 0.7, 'bell', (i - 2) * 0.35), i * 55);\n });\n } else {\n btn.classList.remove('active-audio');\n lbl.textContent = 'SYNTH AUDIO: OFF';\n }\n });\n\n document.getElementById('btnAutoTour').addEventListener('click', () => {\n autoOrbit = !autoOrbit;\n const btn = document.getElementById('btnAutoTour');\n const lbl = document.getElementById('tourLabel');\n btn.classList.toggle('active-tour', autoOrbit);\n lbl.textContent = autoOrbit ? 'AUTO-ORBIT: ON' : 'AUTO-ORBIT: OFF';\n });\n\n // ============================================================================\n // MODE 01: 3D RELATIVISTIC SPACETIME & SDF METAMATERIAL ENGINE\n // ============================================================================\n const mode1Params = {\n curvature: 1.45,\n doppler: 0.68,\n complexity: 1.0,\n wTwist: 0.55\n };\n\n const bgStars = Array.from({ length: 320 }, (_, i) => ({\n u: ((i * 73.13) % 100) / 100 * 2 - 1,\n v: ((i * 191.7) % 100) / 100 * 2 - 1,\n mag: 0.35 + ((i * 31) % 100) / 100 * 0.65,\n hue: i % 3 === 0 ? 196 : (i % 3 === 1 ? 276 : 40)\n }));\n\n // Continuous plasma stream filaments for the Kerr Accretion Vortex\n const plasmaStreams = Array.from({ length: 190 }, (_, i) => {\n const r = 60 + Math.pow(i / 190, 0.82) * 185;\n return {\n r,\n angle: (i * 2.39996) % (Math.PI * 2),\n omega: 1.85 / Math.pow(r / 58, 1.45),\n arcLen: 0.38 + (i % 7) * 0.08,\n yOff: Math.sin(i * 13.7) * 4.0 * (r / 170),\n temp: 1.0 - (r - 60) / 195\n };\n });\n\n function renderMode01(dt) {\n const preset = activePreset[0];\n if (autoOrbit && !pointer.down) {\n pointer.rotY += dt * 0.38;\n pointer.rotX = 0.33 + Math.sin(tGlobal * 0.42) * 0.14;\n }\n\n const cx = W * 0.5;\n const cy = H * 0.52;\n const cosX = Math.cos(pointer.rotX), sinX = Math.sin(pointer.rotX);\n const cosY = Math.cos(pointer.rotY), sinY = Math.sin(pointer.rotY);\n\n // Rich cosmic background\n const bgGrad = ctx.createRadialGradient(cx, cy, 10, cx, cy, Math.max(W, H) * 0.72);\n bgGrad.addColorStop(0, '#110c29');\n bgGrad.addColorStop(0.48, '#070814');\n bgGrad.addColorStop(1, '#030408');\n ctx.fillStyle = bgGrad;\n ctx.fillRect(0, 0, W, H);\n\n const rs = 36 * mode1Params.curvature;\n const einsteinR = rs * 1.9;\n\n // 1. Gravitationally Lensed Background Starfield + Einstein Ring\n for (let i = 0; i < bgStars.length; i++) {\n const s = bgStars[i];\n const sx0 = ((s.u + pointer.rotY * 0.1 + 3) % 2 - 1) * (W * 0.52);\n const sy0 = ((s.v + pointer.rotX * 0.1 + 3) % 2 - 1) * (H * 0.52);\n const b2 = sx0 * sx0 + sy0 * sy0;\n const b = Math.sqrt(b2) + 0.001;\n\n if (preset === 0) {\n if (b < rs * 1.02) continue;\n const deflection = (einsteinR * einsteinR) / b;\n const lensedR = b + deflection * 0.65;\n const lx = cx + (sx0 / b) * lensedR;\n const ly = cy + (sy0 / b) * lensedR;\n const mag = Math.min(3.0, 1 + (einsteinR * einsteinR) / (b2 + 90));\n\n ctx.fillStyle = `hsla(${s.hue}, 90%, 84%, ${Math.min(0.95, s.mag * mag * 0.58)})`;\n ctx.beginPath();\n ctx.arc(lx, ly, Math.min(2.6, 0.9 * mag), 0, Math.PI * 2);\n ctx.fill();\n\n // Tangential gravitational lensing streak near the Einstein ring!\n if (b < einsteinR * 2.2) {\n const tx = -sy0 / b, ty = sx0 / b;\n const streak = Math.min(12, (einsteinR * einsteinR) / (b * 8));\n ctx.strokeStyle = `hsla(${s.hue}, 95%, 80%, ${Math.min(0.65, 0.25 * mag)})`;\n ctx.lineWidth = 1.2;\n ctx.beginPath();\n ctx.moveTo(lx - tx * streak, ly - ty * streak);\n ctx.lineTo(lx + tx * streak, ly + ty * streak);\n ctx.stroke();\n }\n } else {\n ctx.fillStyle = `hsla(${s.hue}, 80%, 75%, ${s.mag * 0.35})`;\n ctx.fillRect(cx + sx0, cy + sy0, 1.4, 1.4);\n }\n }\n\n if (preset === 0) {\n // 2. Flamm's Paraboloid 3D Curved Spacetime Embedding Grid underneath the singularity\n ctx.strokeStyle = 'rgba(56, 189, 248, 0.13)';\n ctx.lineWidth = 1;\n const gridRings = [75, 105, 140, 180, 225, 275];\n for (const gr of gridRings) {\n ctx.beginPath();\n const depthWell = 115 * Math.sqrt(rs / (gr + 10)); // Flamm paraboloid dip\n for (let s = 0; s <= 64; s++) {\n const a = (s / 64) * Math.PI * 2;\n const x3 = Math.cos(a) * gr;\n const z3 = Math.sin(a) * gr;\n const y3 = depthWell + 32;\n const rx = x3 * cosY - z3 * sinY;\n const rz0 = x3 * sinY + z3 * cosY;\n const ry = y3 * cosX - rz0 * sinX;\n const rz = y3 * sinX + rz0 * cosX;\n const p = 520 / (520 + rz);\n const sx = cx + rx * p, sy = cy + ry * p;\n if (s === 0) ctx.moveTo(sx, sy);\n else ctx.lineTo(sx, sy);\n }\n ctx.stroke();\n }\n // Radial spacetime geodesics dipping into the event horizon throat\n for (let rIdx = 0; rIdx < 16; rIdx++) {\n const a = (rIdx / 16) * Math.PI * 2 + pointer.rotY;\n ctx.beginPath();\n for (let rStep = 58; rStep <= 275; rStep += 14) {\n const depthWell = 115 * Math.sqrt(rs / (rStep + 10)) + 32;\n const x3 = Math.cos(a) * rStep;\n const z3 = Math.sin(a) * rStep;\n const ry = depthWell * cosX - z3 * sinX;\n const rz = depthWell * sinX + z3 * cosX;\n const p = 520 / (520 + rz);\n const sx = cx + x3 * p, sy = cy + ry * p;\n if (rStep === 58) ctx.moveTo(sx, sy);\n else ctx.lineTo(sx, sy);\n }\n ctx.stroke();\n }\n\n // 3. Relativistic Accretion Vortex with Additive Blending & Einstein Lensed Halo\n const beta = mode1Params.doppler;\n const gamma = 1 / Math.sqrt(Math.max(0.08, 1 - beta * beta));\n\n const ribbons = [];\n for (let i = 0; i < plasmaStreams.length; i++) {\n const ps = plasmaStreams[i];\n ps.angle += ps.omega * dt * (0.55 + beta * 0.85);\n\n const subPts = [];\n let avgZ = 0;\n let avgDoppler = 1;\n const segs = 7;\n for (let k = 0; k <= segs; k++) {\n const a = ps.angle + (k / segs - 0.5) * ps.arcLen;\n const x3 = Math.cos(a) * ps.r;\n const z3 = Math.sin(a) * ps.r;\n const y3 = ps.yOff * Math.sin(a * 2 + tGlobal);\n\n const rx = x3 * cosY - z3 * sinY;\n const rz0 = x3 * sinY + z3 * cosY;\n const ry = y3 * cosX - rz0 * sinX;\n const rz = y3 * sinX + rz0 * cosX;\n\n const vx = -Math.sin(a), vz = Math.cos(a);\n const vLos = (vx * sinY + vz * cosY) * cosX;\n const dopplerD = 1 / (gamma * (1 - beta * vLos * 0.84));\n\n let sx = cx + rx;\n let sy = cy + ry;\n const impactB = Math.sqrt(rx * rx + ry * ry) + 0.1;\n if (rz > 0) {\n // Relativistic gravitational bending of the far side of the disk over & under the shadow!\n const bend = (einsteinR * einsteinR * 0.92) / (impactB + 16);\n const signY = ry >= 0 ? 1 : -1;\n sy = cy + ry + signY * bend * (rz / (ps.r + 15));\n sx = cx + rx * (1 + (bend * 0.2) / (impactB + 38));\n }\n subPts.push({ sx, sy });\n avgZ += rz;\n avgDoppler += dopplerD;\n }\n avgZ /= (segs + 1);\n avgDoppler /= (segs + 1);\n ribbons.push({ subPts, avgZ, avgDoppler, temp: ps.temp, r: ps.r });\n\n // Also add secondary lower Einstein lensed image for far-side streams\n if (avgZ > 15 && ps.r < 175) {\n const underPts = subPts.map(pt => ({\n sx: pt.sx,\n sy: cy - (pt.sy - cy) * 0.86\n }));\n ribbons.push({ subPts: underPts, avgZ: avgZ + 20, avgDoppler: avgDoppler * 0.85, temp: ps.temp * 0.8, r: ps.r });\n }\n }\n\n ribbons.sort((a, b) => b.avgZ - a.avgZ);\n\n let horizonDrawn = false;\n const drawBlackHoleCore = () => {\n ctx.save();\n ctx.globalCompositeOperation = 'source-over';\n // Outer Argon Ionization Halo\n const halo = ctx.createRadialGradient(cx, cy, rs * 0.8, cx, cy, rs * 2.45);\n halo.addColorStop(0, '#000000');\n halo.addColorStop(0.39, '#000000');\n halo.addColorStop(0.43, 'rgba(103, 232, 249, 0.96)');\n halo.addColorStop(0.48, 'rgba(192, 132, 252, 0.82)');\n halo.addColorStop(0.64, 'rgba(168, 85, 247, 0.24)');\n halo.addColorStop(1, 'rgba(0, 0, 0, 0)');\n ctx.fillStyle = halo;\n ctx.beginPath();\n ctx.arc(cx, cy, rs * 2.45, 0, Math.PI * 2);\n ctx.fill();\n\n // Event Horizon Shadow\n ctx.fillStyle = '#020206';\n ctx.beginPath();\n ctx.arc(cx, cy, rs, 0, Math.PI * 2);\n ctx.fill();\n\n // Crisp asymmetrically Doppler-brightened Photon Sphere Ring\n const ringG = ctx.createLinearGradient(cx - rs, cy, cx + rs, cy);\n ringG.addColorStop(0, '#e0f2fe');\n ringG.addColorStop(0.45, '#38bdf8');\n ringG.addColorStop(0.8, '#c084fc');\n ringG.addColorStop(1, '#f59e0b');\n ctx.strokeStyle = ringG;\n ctx.lineWidth = 2.2;\n ctx.stroke();\n ctx.restore();\n };\n\n ctx.save();\n ctx.globalCompositeOperation = 'lighter';\n ctx.lineCap = 'round';\n\n for (let i = 0; i < ribbons.length; i++) {\n const rb = ribbons[i];\n if (!horizonDrawn && rb.avgZ < 0) {\n drawBlackHoleCore();\n horizonDrawn = true;\n }\n const dNorm = Math.max(0.35, Math.min(2.4, rb.avgDoppler));\n let hue, sat, light, alpha;\n if (dNorm >= 1.0) {\n // Approaching side: Argon 488nm cyan -> 415nm violet-white\n hue = 192 + Math.min(82, (dNorm - 1.0) * 62);\n sat = 96;\n light = Math.min(95, 55 + (dNorm - 1.0) * 32 + rb.temp * 16);\n alpha = Math.min(0.78, 0.22 * Math.pow(dNorm, 1.55));\n } else {\n // Receding side: Redshifted gold -> crimson\n hue = Math.max(10, 42 - (1.0 - dNorm) * 52);\n sat = 92;\n light = Math.max(30, 56 * dNorm);\n alpha = Math.max(0.10, 0.28 * dNorm);\n }\n\n ctx.strokeStyle = `hsla(${hue.toFixed(0)}, ${sat}%, ${light.toFixed(0)}%, ${alpha.toFixed(3)})`;\n ctx.lineWidth = Math.max(1.8, Math.min(7.5, (2.4 + rb.temp * 3.2) * Math.pow(dNorm, 0.55)));\n ctx.beginPath();\n for (let k = 0; k < rb.subPts.length; k++) {\n const p = rb.subPts[k];\n if (k === 0) ctx.moveTo(p.sx, p.sy);\n else ctx.lineTo(p.sx, p.sy);\n }\n ctx.stroke();\n }\n ctx.restore();\n if (!horizonDrawn) drawBlackHoleCore();\n\n } else if (preset === 1) {\n // PRESET 1: 3D GYROID TRIPLY PERIODIC MINIMAL SURFACE\n const N = Math.floor(13 + mode1Params.complexity * 4);\n const scale = 148 * (0.85 + mode1Params.curvature * 0.15);\n const isoTarget = (mode1Params.wTwist - 0.5) * 0.9;\n const pts = [];\n\n for (let ix = -N; ix <= N; ix++) {\n const x = (ix / N) * Math.PI * 1.65;\n for (let iy = -N; iy <= N; iy++) {\n const y = (iy / N) * Math.PI * 1.65;\n for (let iz = -N; iz <= N; iz++) {\n const z = (iz / N) * Math.PI * 1.65;\n const gVal = Math.sin(x) * Math.cos(y) + Math.sin(y) * Math.cos(z) + Math.sin(z) * Math.cos(x);\n if (Math.abs(gVal - isoTarget) < 0.24) {\n const px = (ix / N) * scale;\n const py = (iy / N) * scale;\n const pz = (iz / N) * scale;\n const rx = px * cosY - pz * sinY;\n const rz0 = px * sinY + z3_helper(px, py, pz, cosY);\n const rz1 = px * sinY + pz * cosY;\n const ry = py * cosX - rz1 * sinX;\n const rz = py * sinX + rz1 * cosX;\n pts.push({ rx, ry, rz, nx: Math.cos(x) * Math.cos(y) - Math.sin(z) * Math.sin(x) });\n }\n }\n }\n }\n pts.sort((a, b) => b.rz - a.rz);\n ctx.save();\n ctx.globalCompositeOperation = 'lighter';\n for (let i = 0; i < pts.length; i++) {\n const p = pts[i];\n const persp = 440 / (440 + p.rz);\n const sx = cx + p.rx * persp;\n const sy = cy + p.ry * persp;\n const hue = 190 + (p.nx * 0.5 + 0.5) * 95 + (p.rz / scale) * 25;\n const alpha = Math.max(0.18, Math.min(0.88, (1 - p.rz / (scale * 1.5)) * 0.55));\n ctx.fillStyle = `hsla(${hue.toFixed(0)}, 92%, 66%, ${alpha.toFixed(2)})`;\n ctx.beginPath();\n ctx.arc(sx, sy, Math.max(1.5, 2.8 * persp), 0, Math.PI * 2);\n ctx.fill();\n }\n ctx.restore();\n\n } else if (preset === 2) {\n // PRESET 2: 4D 24-CELL HYPER-POLYTOPE STEREOGRAPHIC PROJECTION\n const wAngle = tGlobal * (0.45 + mode1Params.wTwist * 1.1);\n const cosW = Math.cos(wAngle), sinW = Math.sin(wAngle);\n const vertices4D = [];\n const coords = [-1, 1];\n for (let i = 0; i < 4; i++) {\n for (let j = i + 1; j < 4; j++) {\n for (let s1 of coords) {\n for (let s2 of coords) {\n const v = [0, 0, 0, 0];\n v[i] = s1;\n v[j] = s2;\n vertices4D.push(v);\n }\n }\n }\n }\n\n const proj3D = vertices4D.map(v => {\n const x1 = v[0] * cosW - v[3] * sinW;\n const w1 = v[0] * sinW + v[3] * cosW;\n const y1 = v[1] * Math.cos(wAngle * 0.7) - v[2] * Math.sin(wAngle * 0.7);\n const z1 = v[1] * Math.sin(wAngle * 0.7) + v[2] * Math.cos(wAngle * 0.7);\n\n const dist4 = 2.45 - mode1Params.curvature * 0.35;\n const factor4 = 1 / Math.max(0.45, dist4 - w1);\n const x3 = x1 * factor4 * 170;\n const y3 = y1 * factor4 * 170;\n const z3 = z1 * factor4 * 170;\n\n const rx = x3 * cosY - z3 * sinY;\n const rz0 = x3 * sinY + z3 * cosY;\n const ry = y3 * cosX - rz0 * sinX;\n const rz = y3 * sinX + rz0 * cosX;\n const p3 = 480 / (480 + rz);\n return { sx: cx + rx * p3, sy: cy + ry * p3, rz, w1, p3 };\n });\n\n ctx.save();\n ctx.globalCompositeOperation = 'lighter';\n ctx.lineWidth = 1.6;\n for (let i = 0; i < vertices4D.length; i++) {\n for (let j = i + 1; j < vertices4D.length; j++) {\n let d2 = 0;\n for (let k = 0; k < 4; k++) {\n const diff = vertices4D[i][k] - vertices4D[j][k];\n d2 += diff * diff;\n }\n if (Math.abs(d2 - 2.0) < 0.05) {\n const a = proj3D[i], b = proj3D[j];\n const wAvg = (a.w1 + b.w1) * 0.5;\n const hue = 195 + wAvg * 60;\n const alpha = Math.max(0.18, Math.min(0.88, 0.52 + wAvg * 0.3));\n ctx.strokeStyle = `hsla(${hue.toFixed(0)}, 94%, 68%, ${alpha.toFixed(2)})`;\n ctx.beginPath();\n ctx.moveTo(a.sx, a.sy);\n ctx.lineTo(b.sx, b.sy);\n ctx.stroke();\n }\n }\n }\n\n for (let i = 0; i < proj3D.length; i++) {\n const p = proj3D[i];\n const hue = 195 + p.w1 * 60;\n ctx.fillStyle = `hsla(${hue.toFixed(0)}, 95%, 80%, 0.95)`;\n ctx.beginPath();\n ctx.arc(p.sx, p.sy, Math.max(3.0, 5.2 * p.p3), 0, Math.PI * 2);\n ctx.fill();\n }\n ctx.restore();\n\n } else {\n // PRESET 3: ARGON-18 TOKAMAK MAGNETIC FLUX CONFINEMENT TORUS\n const R = 132, rTube = 54 * mode1Params.curvature * 0.72;\n const qSafety = 2.5 + mode1Params.wTwist * 3.5;\n const lines = 20;\n const steps = 180;\n\n ctx.save();\n ctx.globalCompositeOperation = 'lighter';\n for (let l = 0; l < lines; l++) {\n const phiOffset = (l / lines) * Math.PI * 2;\n ctx.beginPath();\n for (let s = 0; s <= steps; s++) {\n const u = (s / steps) * Math.PI * 2;\n const theta = u * qSafety + phiOffset + tGlobal * (1.2 + mode1Params.doppler);\n const x3 = (R + rTube * Math.cos(theta)) * Math.cos(u);\n const z3 = (R + rTube * Math.cos(theta)) * Math.sin(u);\n const y3 = rTube * Math.sin(theta);\n\n const rx = x3 * cosY - z3 * sinY;\n const rz0 = x3 * sinY + z3 * cosY;\n const ry = y3 * cosX - rz0 * sinX;\n const rz = y3 * sinX + rz0 * cosX;\n const persp = 500 / (500 + rz);\n const sx = cx + rx * persp;\n const sy = cy + ry * persp;\n if (s === 0) ctx.moveTo(sx, sy);\n else ctx.lineTo(sx, sy);\n }\n const hue = l % 2 === 0 ? 192 : 276;\n ctx.strokeStyle = `hsla(${hue}, 95%, 68%, 0.58)`;\n ctx.lineWidth = 1.6;\n ctx.stroke();\n }\n ctx.restore();\n }\n }\n function z3_helper(x, y, z, c) { return z * c; }\n\n // ============================================================================\n // MODE 02: CITADEL 5-MODEL RELAY vs. GEMINI 4 ARGON AUTONOMOUS SWARM\n // ============================================================================\n const citadelNodes = [\n { id: 'opus', name: 'Opus 5.5', role: 'Leads & Builds', x: 0.13, y: 0.24, color: '#f59e0b' },\n { id: 'fable', name: 'Fable 5.2', role: 'Design Partner & Critic', x: 0.28, y: 0.17, color: '#ec4899' },\n { id: 'astra', name: 'GPT-6-Astra', role: 'Critiques Designs', x: 0.28, y: 0.43, color: '#8b5cf6' },\n { id: 'sonnet', name: 'Sonnet 5.5', role: 'Chores & Test Data', x: 0.13, y: 0.54, color: '#10b981' },\n { id: 'sol', name: 'GPT-6.1-Sol', role: 'Reviews Code & Deploys', x: 0.42, y: 0.33, color: '#38bdf8' }\n ];\n\n const argonSwarmAgents = [\n { name: 'Systems Architect', domain: 'Zero-Dep Spec', angle: 0, color: '#38bdf8' },\n { name: 'Physics & Math Kernel', domain: 'RK4 & Lensing', angle: Math.PI * 0.4, color: '#c084fc' },\n { name: 'Visual & Shader Critic', domain: '60fps Telemetry', angle: Math.PI * 0.8, color: '#f472b6' },\n { name: 'Signal & Audio Synth', domain: 'Counterpoint FM', angle: Math.PI * 1.2, color: '#34d399' },\n { name: 'Formal Proof Verifier', domain: 'Minimax α-β', angle: Math.PI * 1.6, color: '#fbbf24' }\n ];\n\n const relayEdges = [\n [0, 1], [1, 2], [2, 0], [0, 3], [3, 4], [2, 4]\n ];\n\n const swarmParams = {\n taskRate: 1.4,\n parallelism: 5.0,\n critiqueDepth: 0.85\n };\n\n function renderMode02(dt) {\n ctx.fillStyle = '#05070e';\n ctx.fillRect(0, 0, W, H);\n\n const midX = W * 0.50;\n ctx.strokeStyle = 'rgba(148, 163, 184, 0.16)';\n ctx.setLineDash([5, 5]);\n ctx.beginPath();\n ctx.moveTo(midX, 46);\n ctx.lineTo(midX, H - 52);\n ctx.stroke();\n ctx.setLineDash([]);\n\n ctx.font = '700 11px \"JetBrains Mono\", monospace';\n ctx.fillStyle = '#f59e0b';\n ctx.fillText('CITADEL PIPELINE TODAY (from about-me.md)', 22, 64);\n ctx.fillStyle = '#64748b';\n ctx.font = '11px \"Inter\", sans-serif';\n ctx.fillText('5 specialized models handing off work across discrete lanes', 22, 81);\n\n ctx.font = '700 11px \"JetBrains Mono\", monospace';\n ctx.fillStyle = '#67e8f9';\n ctx.fillText('SEAT #6: GEMINI 4 ARGON (IN ANTIGRAVITY)', midX + 22, 64);\n ctx.fillStyle = '#94a3b8';\n ctx.font = '11px \"Inter\", sans-serif';\n ctx.fillText('One polymath core spawning synchronized parallel subagents', midX + 22, 81);\n\n for (let e = 0; e < relayEdges.length; e++) {\n const a = citadelNodes[relayEdges[e][0]];\n const b = citadelNodes[relayEdges[e][1]];\n const ax = a.x * W, ay = a.y * H + 48;\n const bx = b.x * W, by = b.y * H + 48;\n\n ctx.strokeStyle = 'rgba(148, 163, 184, 0.24)';\n ctx.lineWidth = 1.6;\n ctx.beginPath();\n ctx.moveTo(ax, ay);\n ctx.lineTo(bx, by);\n ctx.stroke();\n\n const prog = (tGlobal * 0.55 * swarmParams.taskRate + e * 0.23) % 1;\n const px = ax + (bx - ax) * prog;\n const py = ay + (by - ay) * prog;\n ctx.fillStyle = b.color;\n ctx.beginPath();\n ctx.arc(px, py, 3.8, 0, Math.PI * 2);\n ctx.fill();\n }\n\n for (let i = 0; i < citadelNodes.length; i++) {\n const n = citadelNodes[i];\n const nx = n.x * W, ny = n.y * H + 48;\n const isSel = selectedSeat === n.id;\n\n ctx.fillStyle = isSel ? 'rgba(245, 158, 11, 0.22)' : 'rgba(15, 23, 42, 0.92)';\n ctx.strokeStyle = isSel ? '#f59e0b' : n.color;\n ctx.lineWidth = isSel ? 2.4 : 1.5;\n ctx.beginPath();\n ctx.roundRect(nx - 58, ny - 23, 116, 46, 8);\n ctx.fill();\n ctx.stroke();\n\n ctx.fillStyle = '#ffffff';\n ctx.font = '700 11px \"JetBrains Mono\", monospace';\n ctx.fillText(n.name, nx - 48, ny - 4);\n ctx.fillStyle = '#94a3b8';\n ctx.font = '10px \"Inter\", sans-serif';\n ctx.fillText(n.role, nx - 48, ny + 11);\n }\n\n const acx = midX + (W - midX) * 0.5;\n const acy = H * 0.51;\n const ringR = Math.min(W * 0.165, 128);\n\n ctx.strokeStyle = 'rgba(56, 189, 248, 0.26)';\n ctx.lineWidth = 1.5;\n ctx.beginPath();\n ctx.arc(acx, acy, ringR, 0, Math.PI * 2);\n ctx.stroke();\n\n const activeCount = Math.max(2, Math.round(swarmParams.parallelism));\n const subCoords = [];\n for (let i = 0; i < activeCount; i++) {\n const ag = argonSwarmAgents[i];\n const ang = ag.angle + tGlobal * 0.32;\n const sx = acx + Math.cos(ang) * ringR;\n const sy = acy + Math.sin(ang) * ringR;\n subCoords.push({ sx, sy, ag });\n }\n\n for (let i = 0; i < subCoords.length; i++) {\n const a = subCoords[i];\n ctx.strokeStyle = 'rgba(168, 85, 247, 0.42)';\n ctx.lineWidth = 1.6;\n ctx.beginPath();\n ctx.moveTo(acx, acy);\n ctx.lineTo(a.sx, a.sy);\n ctx.stroke();\n\n const p1 = (tGlobal * 1.4 * swarmParams.taskRate + i * 0.19) % 1;\n const px = acx + (a.sx - acx) * p1;\n const py = acy + (a.sy - acy) * p1;\n ctx.fillStyle = a.ag.color;\n ctx.beginPath();\n ctx.arc(px, py, 3.6, 0, Math.PI * 2);\n ctx.fill();\n\n for (let j = i + 1; j < subCoords.length; j++) {\n const b = subCoords[j];\n ctx.strokeStyle = 'rgba(56, 189, 248, 0.16)';\n ctx.lineWidth = 1;\n ctx.beginPath();\n ctx.moveTo(a.sx, a.sy);\n ctx.lineTo(b.sx, b.sy);\n ctx.stroke();\n }\n }\n\n const coreGrad = ctx.createRadialGradient(acx, acy, 4, acx, acy, 52);\n coreGrad.addColorStop(0, 'rgba(103, 232, 249, 0.95)');\n coreGrad.addColorStop(0.45, 'rgba(168, 85, 247, 0.55)');\n coreGrad.addColorStop(1, 'rgba(168, 85, 247, 0)');\n ctx.fillStyle = coreGrad;\n ctx.beginPath();\n ctx.arc(acx, acy, 52, 0, Math.PI * 2);\n ctx.fill();\n\n ctx.fillStyle = '#090d1a';\n ctx.strokeStyle = '#67e8f9';\n ctx.lineWidth = 2.2;\n ctx.beginPath();\n ctx.arc(acx, acy, 33, 0, Math.PI * 2);\n ctx.fill();\n ctx.stroke();\n\n ctx.fillStyle = '#ffffff';\n ctx.font = '700 10px \"JetBrains Mono\", monospace';\n ctx.textAlign = 'center';\n ctx.fillText('GEMINI 4', acx, acy - 3);\n ctx.fillStyle = '#67e8f9';\n ctx.fillText('ARGON', acx, acy + 10);\n\n for (let i = 0; i < subCoords.length; i++) {\n const { sx, sy, ag } = subCoords[i];\n ctx.fillStyle = 'rgba(12, 17, 30, 0.94)';\n ctx.strokeStyle = ag.color;\n ctx.lineWidth = 1.6;\n ctx.beginPath();\n ctx.roundRect(sx - 56, sy - 19, 112, 38, 7);\n ctx.fill();\n ctx.stroke();\n\n ctx.fillStyle = '#fff';\n ctx.font = '700 9.5px \"JetBrains Mono\", monospace';\n ctx.fillText(ag.name, sx, sy - 3);\n ctx.fillStyle = ag.color;\n ctx.font = '9px \"Inter\", sans-serif';\n ctx.fillText(ag.domain, sx, sy + 10);\n }\n ctx.textAlign = 'left';\n\n const seatDescriptions = {\n opus: 'SEAT 01 (Opus 5.5): Leads & builds in Citadel. Argon can co-lead or prototype entire multi-domain architectures in one shot.',\n sonnet: 'SEAT 02 (Sonnet 5.5): Handles chores & test data. Argon synthesizes property-based fuzzers + formal invariants automatically.',\n fable: 'SEAT 03 (Fable 5.2): Design partner & critic. Argon pairs aesthetic direction with live interactive shaders & audio synthesis.',\n astra: 'SEAT 04 (GPT-6-Astra): Critiques designs. Argon red-teams architecture while simultaneously implementing the verified fix.',\n sol: 'SEAT 05 (GPT-6.1-Sol): Reviews code & deploys. Argon verifies zero-error execution in headless browser sandboxes before shipping.',\n argon: 'SEAT 06 (Gemini 4 Argon): Not in about-me.md—built this entire 5-engine showcase from a 297-byte file to prove full-spectrum range.'\n };\n\n ctx.fillStyle = 'rgba(11, 15, 27, 0.92)';\n ctx.strokeStyle = 'rgba(168, 85, 247, 0.42)';\n ctx.lineWidth = 1;\n ctx.beginPath();\n ctx.roundRect(20, H - 80, W - 40, 30, 7);\n ctx.fill();\n ctx.stroke();\n\n ctx.fillStyle = '#e2e8f0';\n ctx.font = '600 10.5px \"JetBrains Mono\", monospace';\n ctx.fillText(seatDescriptions[selectedSeat] || seatDescriptions.argon, 32, H - 61);\n }\n\n // ============================================================================\n // MODE 03: RK4 4TH-ORDER RUNGE-KUTTA N-BODY ORBITAL & CHAOS LAB\n // ============================================================================\n const rk4Params = {\n G: 1.0,\n timeScale: 1.0,\n softening: 0.018,\n trailLen: 150\n };\n\n let bodies = [];\n let energyHistory = [];\n let phaseHistory = [];\n let initialEnergy = -1;\n\n function initOrbitalPreset(presetIdx) {\n bodies = [];\n energyHistory = [];\n phaseHistory = [];\n\n if (presetIdx === 0) {\n const x1 = 0.97000436, y1 = -0.24308753;\n const vx3 = -0.93240737, vy3 = -0.86473146;\n bodies = [\n { x: -x1, y: -y1, vx: -vx3 / 2, vy: -vy3 / 2, m: 1.0, color: '#38bdf8', name: 'Ar-α', trail: [] },\n { x: x1, y: y1, vx: -vx3 / 2, vy: -vy3 / 2, m: 1.0, color: '#c084fc', name: 'Ar-β', trail: [] },\n { x: 0, y: 0, vx: vx3, vy: vy3, m: 1.0, color: '#f59e0b', name: 'Sol-γ', trail: [] }\n ];\n } else if (presetIdx === 1) {\n bodies.push({ x: 0, y: 0, vx: 0, vy: -0.04, m: 3.5, color: '#67e8f9', name: 'ARGON CORE', trail: [] });\n const names = ['Opus', 'Sonnet', 'Fable', 'Astra', 'Sol'];\n const cols = ['#f59e0b', '#10b981', '#ec4899', '#a855f7', '#38bdf8'];\n for (let i = 0; i < 5; i++) {\n const r = 0.42 + i * 0.24;\n const ang = i * 1.256;\n const v = Math.sqrt(3.5 / r);\n bodies.push({\n x: Math.cos(ang) * r,\n y: Math.sin(ang) * r,\n vx: -Math.sin(ang) * v,\n vy: Math.cos(ang) * v,\n m: 0.035,\n color: cols[i],\n name: names[i],\n trail: []\n });\n }\n } else if (presetIdx === 2) {\n bodies = [\n { x: -0.55, y: 0, vx: 0, vy: -0.62, m: 1.6, color: '#f59e0b', name: 'Sol-A', trail: [] },\n { x: 0.55, y: 0, vx: 0, vy: 0.62, m: 0.9, color: '#c084fc', name: 'Argon-B', trail: [] }\n ];\n for (let i = 0; i < 8; i++) {\n const ang = (i / 8) * Math.PI * 2;\n const r = 1.15 + (i % 2) * 0.18;\n const v = Math.sqrt(2.5 / r);\n bodies.push({\n x: Math.cos(ang) * r,\n y: Math.sin(ang) * r,\n vx: -Math.sin(ang) * v,\n vy: Math.cos(ang) * v,\n m: 0.005,\n color: '#38bdf8',\n name: `T-${i + 1}`,\n trail: []\n });\n }\n } else {\n bodies = [\n { x: 0.3, y: 0.5, vx: 0, vy: 0, m: 1.2, color: '#38bdf8', name: 'M1 (3)', trail: [] },\n { x: -0.7, y: -0.3, vx: 0, vy: 0, m: 1.6, color: '#c084fc', name: 'M2 (4)', trail: [] },\n { x: 0.3, y: -0.3, vx: 0, vy: 0, m: 2.0, color: '#f43f5e', name: 'M3 (5)', trail: [] }\n ];\n }\n initialEnergy = computeHamiltonian(bodies);\n // Pre-warm 85 frames so trails and phase portrait are immediately rich on switch!\n for (let w = 0; w < 85; w++) {\n for (let s = 0; s < 8; s++) rk4Step(0.011 / 8);\n for (let i = 0; i < bodies.length; i++) bodies[i].trail.push({ x: bodies[i].x, y: bodies[i].y });\n energyHistory.push(computeHamiltonian(bodies));\n phaseHistory.push({ x: bodies[0].x, vx: bodies[0].vx });\n }\n }\n\n function computeAcc(state) {\n const n = state.length;\n const ax = new Float64Array(n);\n const ay = new Float64Array(n);\n const eps2 = rk4Params.softening * rk4Params.softening;\n const G = rk4Params.G;\n for (let i = 0; i < n; i++) {\n for (let j = i + 1; j < n; j++) {\n const dx = state[j].x - state[i].x;\n const dy = state[j].y - state[i].y;\n const r2 = dx * dx + dy * dy + eps2;\n const invR3 = G / (r2 * Math.sqrt(r2));\n ax[i] += dx * state[j].m * invR3;\n ay[i] += dy * state[j].m * invR3;\n ax[j] -= dx * state[i].m * invR3;\n ay[j] -= dy * state[i].m * invR3;\n }\n }\n return { ax, ay };\n }\n\n function rk4Step(dtStep) {\n const n = bodies.length;\n const a1 = computeAcc(bodies);\n const s2 = bodies.map((b, i) => ({\n x: b.x + 0.5 * dtStep * b.vx,\n y: b.y + 0.5 * dtStep * b.vy,\n vx: b.vx + 0.5 * dtStep * a1.ax[i],\n vy: b.vy + 0.5 * dtStep * a1.ay[i],\n m: b.m\n }));\n const a2 = computeAcc(s2);\n const s3 = bodies.map((b, i) => ({\n x: b.x + 0.5 * dtStep * s2[i].vx,\n y: b.y + 0.5 * dtStep * s2[i].vy,\n vx: b.vx + 0.5 * dtStep * a2.ax[i],\n vy: b.vy + 0.5 * dtStep * a2.ay[i],\n m: b.m\n }));\n const a3 = computeAcc(s3);\n const s4 = bodies.map((b, i) => ({\n x: b.x + dtStep * s3[i].vx,\n y: b.y + dtStep * s3[i].vy,\n vx: b.vx + dtStep * a3.ax[i],\n vy: b.vy + dtStep * a3.ay[i],\n m: b.m\n }));\n const a4 = computeAcc(s4);\n\n for (let i = 0; i < n; i++) {\n bodies[i].x += (dtStep / 6) * (bodies[i].vx + 2 * s2[i].vx + 2 * s3[i].vx + s4[i].vx);\n bodies[i].y += (dtStep / 6) * (bodies[i].vy + 2 * s2[i].vy + 2 * s3[i].vy + s4[i].vy);\n bodies[i].vx += (dtStep / 6) * (a1.ax[i] + 2 * a2.ax[i] + 2 * a3.ax[i] + a4.ax[i]);\n bodies[i].vy += (dtStep / 6) * (a1.ay[i] + 2 * a2.ay[i] + 2 * a3.ay[i] + a4.ay[i]);\n }\n }\n\n function computeHamiltonian(state) {\n let T = 0, V = 0;\n const eps2 = rk4Params.softening * rk4Params.softening;\n for (let i = 0; i < state.length; i++) {\n T += 0.5 * state[i].m * (state[i].vx * state[i].vx + state[i].vy * state[i].vy);\n for (let j = i + 1; j < state.length; j++) {\n const dx = state[j].x - state[i].x;\n const dy = state[j].y - state[i].y;\n V -= (rk4Params.G * state[i].m * state[j].m) / Math.sqrt(dx * dx + dy * dy + eps2);\n }\n }\n return T + V;\n }\n\n initOrbitalPreset(0);\n\n function renderMode03(dt) {\n ctx.fillStyle = '#05060c';\n ctx.fillRect(0, 0, W, H);\n\n const cx = W * 0.40;\n const cy = H * 0.51;\n const scale = 135;\n\n const subSteps = 10;\n const h = (0.011 * rk4Params.timeScale) / subSteps;\n for (let s = 0; s < subSteps; s++) rk4Step(h);\n\n for (let i = 0; i < bodies.length; i++) {\n const b = bodies[i];\n b.trail.push({ x: b.x, y: b.y });\n if (b.trail.length > rk4Params.trailLen) b.trail.shift();\n }\n if (bodies.length > 0) {\n const Hcur = computeHamiltonian(bodies);\n energyHistory.push(Hcur);\n if (energyHistory.length > 140) energyHistory.shift();\n phaseHistory.push({ x: bodies[0].x, vx: bodies[0].vx });\n if (phaseHistory.length > 180) phaseHistory.shift();\n }\n\n ctx.strokeStyle = 'rgba(148, 163, 184, 0.08)';\n ctx.lineWidth = 1;\n ctx.beginPath();\n ctx.moveTo(cx - 220, cy); ctx.lineTo(cx + 220, cy);\n ctx.moveTo(cx, cy - 180); ctx.lineTo(cx, cy + 180);\n ctx.stroke();\n\n ctx.save();\n ctx.globalCompositeOperation = 'lighter';\n for (let i = 0; i < bodies.length; i++) {\n const b = bodies[i];\n if (b.trail.length < 2) continue;\n ctx.beginPath();\n for (let t = 0; t < b.trail.length; t++) {\n const sx = cx + b.trail[t].x * scale;\n const sy = cy + b.trail[t].y * scale;\n if (t === 0) ctx.moveTo(sx, sy);\n else ctx.lineTo(sx, sy);\n }\n ctx.strokeStyle = b.color;\n ctx.globalAlpha = 0.72;\n ctx.lineWidth = b.m >= 0.5 ? 2.6 : 1.5;\n ctx.stroke();\n }\n ctx.restore();\n\n for (let i = 0; i < bodies.length; i++) {\n const b = bodies[i];\n const sx = cx + b.x * scale;\n const sy = cy + b.y * scale;\n const rad = Math.max(3.5, Math.min(11, 4 + Math.cbrt(b.m) * 4.2));\n\n const g = ctx.createRadialGradient(sx, sy, 1, sx, sy, rad * 3.5);\n g.addColorStop(0, b.color);\n g.addColorStop(1, 'rgba(0,0,0,0)');\n ctx.fillStyle = g;\n ctx.beginPath();\n ctx.arc(sx, sy, rad * 3.5, 0, Math.PI * 2);\n ctx.fill();\n\n ctx.fillStyle = '#fff';\n ctx.beginPath();\n ctx.arc(sx, sy, rad * 0.75, 0, Math.PI * 2);\n ctx.fill();\n\n ctx.fillStyle = '#cbd5e1';\n ctx.font = '600 10px \"JetBrains Mono\", monospace';\n ctx.fillText(b.name, sx + rad + 4, sy + 3);\n }\n\n if (pointer.down) {\n const launchX = (pointer.startX - cx) / scale;\n const launchY = (pointer.startY - cy) / scale;\n const launchVx = (pointer.startX - pointer.x) * 0.015;\n const launchVy = (pointer.startY - pointer.y) * 0.015;\n\n let tx = launchX, ty = launchY, tvx = launchVx, tvy = launchVy;\n ctx.strokeStyle = '#67e8f9';\n ctx.setLineDash([4, 4]);\n ctx.beginPath();\n ctx.moveTo(pointer.startX, pointer.startY);\n for (let step = 0; step < 55; step++) {\n let ax = 0, ay = 0;\n for (let i = 0; i < bodies.length; i++) {\n const dx = bodies[i].x - tx;\n const dy = bodies[i].y - ty;\n const r2 = dx * dx + dy * dy + 0.01;\n const f = (rk4Params.G * bodies[i].m) / (r2 * Math.sqrt(r2));\n ax += dx * f;\n ay += dy * f;\n }\n tvx += ax * 0.015;\n tvy += ay * 0.015;\n tx += tvx * 0.015;\n ty += tvy * 0.015;\n ctx.lineTo(cx + tx * scale, cy + ty * scale);\n }\n ctx.stroke();\n ctx.setLineDash([]);\n }\n\n const boxX = W - 230, boxY = 52, boxW = 212, boxH = 152;\n ctx.fillStyle = 'rgba(9, 13, 24, 0.9)';\n ctx.strokeStyle = 'rgba(148, 163, 184, 0.22)';\n ctx.lineWidth = 1;\n ctx.beginPath();\n ctx.roundRect(boxX, boxY, boxW, boxH, 8);\n ctx.fill();\n ctx.stroke();\n\n ctx.fillStyle = '#94a3b8';\n ctx.font = '700 9.5px \"JetBrains Mono\", monospace';\n ctx.fillText('PHASE PORTRAIT (x₁ vs vₓ₁)', boxX + 10, boxY + 16);\n\n if (phaseHistory.length > 1) {\n ctx.strokeStyle = '#c084fc';\n ctx.lineWidth = 1.5;\n ctx.beginPath();\n for (let i = 0; i < phaseHistory.length; i++) {\n const px = boxX + boxW * 0.5 + phaseHistory[i].x * 48;\n const py = boxY + boxH * 0.56 + phaseHistory[i].vx * 36;\n if (i === 0) ctx.moveTo(px, py);\n else ctx.lineTo(px, py);\n }\n ctx.stroke();\n }\n\n const eBoxY = boxY + boxH + 10, eBoxH = 110;\n ctx.fillStyle = 'rgba(9, 13, 24, 0.9)';\n ctx.strokeStyle = 'rgba(148, 163, 184, 0.22)';\n ctx.beginPath();\n ctx.roundRect(boxX, eBoxY, boxW, eBoxH, 8);\n ctx.fill();\n ctx.stroke();\n\n const curH = energyHistory[energyHistory.length - 1] || initialEnergy;\n const relDrift = Math.abs((curH - initialEnergy) / (Math.abs(initialEnergy) + 1e-5));\n ctx.fillStyle = '#94a3b8';\n ctx.fillText(`HAMILTONIAN H = ${curH.toFixed(4)}`, boxX + 10, eBoxY + 16);\n ctx.fillStyle = '#10b981';\n ctx.fillText(`|ΔH/H₀| = ${(relDrift * 100).toFixed(4)}%`, boxX + 10, eBoxY + 30);\n\n if (energyHistory.length > 1) {\n ctx.strokeStyle = '#38bdf8';\n ctx.lineWidth = 1.5;\n ctx.beginPath();\n for (let i = 0; i < energyHistory.length; i++) {\n const ex = boxX + 10 + (i / 140) * (boxW - 20);\n const ey = eBoxY + 70 + (energyHistory[i] - initialEnergy) * 180;\n const clampedY = Math.max(eBoxY + 40, Math.min(eBoxY + eBoxH - 8, ey));\n if (i === 0) ctx.moveTo(ex, clampedY);\n else ctx.lineTo(ex, clampedY);\n }\n ctx.stroke();\n }\n }\n\n // ============================================================================\n // MODE 04: ALGORITHMIC COUNTERPOINT & EULER TONNETZ HARMONIC LATTICE\n // ============================================================================\n const noteNames = ['C', 'C♯', 'D', 'E♭', 'E', 'F', 'F♯', 'G', 'A♭', 'A', 'B♭', 'B'];\n const scales = [\n [0, 2, 3, 5, 7, 8, 11],\n [0, 1, 4, 5, 7, 8, 10],\n [0, 2, 4, 6, 7, 9, 11],\n [0, 2, 3, 5, 7, 9, 10]\n ];\n\n const synthParams = {\n tempoBpm: 132,\n harmonicSpread: 1.0,\n reverbDecay: 0.65\n };\n\n let lastBeatTime = 0;\n let stepIndex = 0;\n let activeVoices = { bass: 0, tenor: 3, soprano: 7 };\n let noteHistory = [];\n let tonnetzNodes = [];\n\n function buildTonnetz() {\n tonnetzNodes = [];\n const cols = 7, rows = 4;\n for (let r = 0; r < rows; r++) {\n for (let c = 0; c < cols; c++) {\n const pitchClass = ((c * 7 + r * 4) % 12 + 12) % 12;\n const octave = 3 + Math.floor((r * 4 + c * 2) / 12);\n const midi = 12 * (octave + 1) + pitchClass;\n tonnetzNodes.push({ c, r, pitchClass, midi, name: noteNames[pitchClass], energy: 0 });\n }\n }\n }\n buildTonnetz();\n // Seed initial counterpoint history so score roll is populated immediately\n for (let s = 0; s < 32; s++) stepCounterpoint();\n\n function stepCounterpoint() {\n const scale = scales[activePreset[3]] || scales[0];\n const bassPatterns = [0, 4, 5, 3, 2, 6, 4, 0];\n const bDeg = bassPatterns[stepIndex % bassPatterns.length];\n const bassPc = scale[bDeg % scale.length];\n\n const tDeg = (bDeg + (stepIndex % 2 === 0 ? 2 : 5)) % scale.length;\n const tenorPc = scale[tDeg];\n\n const sopChoices = [2, 4, 5, 1, 6, 4, 2, 0];\n const sDeg = (bDeg + sopChoices[(stepIndex * 3) % sopChoices.length]) % scale.length;\n const sopPc = scale[sDeg];\n\n activeVoices = { bass: bassPc, tenor: tenorPc, soprano: sopPc };\n const bassMidi = 48 + bassPc;\n const tenorMidi = 60 + tenorPc;\n const sopMidi = 72 + sopPc;\n\n const m2f = m => 440 * Math.pow(2, (m - 69) / 12);\n if (audioEnabled) {\n if (stepIndex % 2 === 0) playArgonTone(m2f(bassMidi), 0.55, 'bass', -0.35);\n playArgonTone(m2f(tenorMidi), 0.38, 'pluck', 0.0);\n playArgonTone(m2f(sopMidi), 0.42 * synthParams.reverbDecay + 0.2, 'bell', 0.38);\n }\n\n for (const node of tonnetzNodes) {\n if (node.pitchClass === bassPc || node.pitchClass === tenorPc || node.pitchClass === sopPc) {\n node.energy = 1.0;\n }\n }\n\n noteHistory.push({ bassMidi, tenorMidi, sopMidi, t: tGlobal });\n if (noteHistory.length > 48) noteHistory.shift();\n stepIndex++;\n }\n\n function renderMode04(dt) {\n ctx.fillStyle = '#05060d';\n ctx.fillRect(0, 0, W, H);\n\n const beatInterval = 60 / (synthParams.tempoBpm * 2);\n if (tGlobal - lastBeatTime >= beatInterval) {\n lastBeatTime = tGlobal;\n stepCounterpoint();\n }\n\n const startX = 105, startY = 76;\n const dx = Math.min(110, (W - 210) / 6.5);\n const dy = 54;\n\n for (const node of tonnetzNodes) {\n node.sx = startX + node.c * dx + (node.r % 2) * (dx * 0.5);\n node.sy = startY + node.r * dy;\n node.energy = Math.max(0, node.energy - dt * 1.6);\n }\n\n for (let i = 0; i < tonnetzNodes.length; i++) {\n for (let j = i + 1; j < tonnetzNodes.length; j++) {\n const a = tonnetzNodes[i], b = tonnetzNodes[j];\n const dist = Math.hypot(a.sx - b.sx, a.sy - b.sy);\n if (dist < dx * 1.18) {\n const bothActive = a.energy > 0.22 && b.energy > 0.22;\n ctx.strokeStyle = bothActive\n ? `rgba(103, 232, 249, ${Math.min(0.92, (a.energy + b.energy) * 0.55)})`\n : 'rgba(148, 163, 184, 0.16)';\n ctx.lineWidth = bothActive ? 2.4 : 1.1;\n ctx.beginPath();\n ctx.moveTo(a.sx, a.sy);\n ctx.lineTo(b.sx, b.sy);\n ctx.stroke();\n }\n }\n }\n\n for (const node of tonnetzNodes) {\n const isSoprano = node.pitchClass === activeVoices.soprano;\n const isTenor = node.pitchClass === activeVoices.tenor;\n const isBass = node.pitchClass === activeVoices.bass;\n\n if (node.energy > 0.05) {\n const g = ctx.createRadialGradient(node.sx, node.sy, 2, node.sx, node.sy, 32 * node.energy + 10);\n const col = isSoprano ? 'rgba(56, 189, 248,' : (isTenor ? 'rgba(192, 132, 252,' : 'rgba(245, 158, 11,');\n g.addColorStop(0, `${col} ${(0.65 * node.energy).toFixed(2)})`);\n g.addColorStop(1, `${col} 0)`);\n ctx.fillStyle = g;\n ctx.beginPath();\n ctx.arc(node.sx, node.sy, 32 * node.energy + 10, 0, Math.PI * 2);\n ctx.fill();\n }\n\n ctx.fillStyle = node.energy > 0.3 ? '#1e293b' : '#0b0f1c';\n ctx.strokeStyle = isSoprano ? '#38bdf8' : (isTenor ? '#c084fc' : (isBass ? '#f59e0b' : 'rgba(148,163,184,0.32)'));\n ctx.lineWidth = node.energy > 0.3 ? 2.2 : 1.2;\n ctx.beginPath();\n ctx.arc(node.sx, node.sy, 16, 0, Math.PI * 2);\n ctx.fill();\n ctx.stroke();\n\n ctx.fillStyle = node.energy > 0.3 ? '#ffffff' : '#94a3b8';\n ctx.font = '700 11px \"JetBrains Mono\", monospace';\n ctx.textAlign = 'center';\n ctx.fillText(node.name, node.sx, node.sy + 4);\n }\n ctx.textAlign = 'left';\n\n const rollY = 286, rollH = 112;\n ctx.fillStyle = 'rgba(9, 12, 22, 0.92)';\n ctx.strokeStyle = 'rgba(148, 163, 184, 0.18)';\n ctx.beginPath();\n ctx.roundRect(22, rollY, W * 0.56, rollH, 8);\n ctx.fill();\n ctx.stroke();\n\n ctx.fillStyle = '#94a3b8';\n ctx.font = '700 10px \"JetBrains Mono\", monospace';\n ctx.fillText('SPECIES COUNTERPOINT VOICE-LEADING (SOPRANO · TENOR · BASS)', 34, rollY + 18);\n\n const rollW = W * 0.56 - 24;\n for (let i = 0; i < noteHistory.length; i++) {\n const nh = noteHistory[i];\n const nx = 34 + (i / 48) * rollW;\n const mapY = midi => rollY + rollH - 14 - ((midi - 45) / 40) * (rollH - 36);\n\n ctx.fillStyle = '#38bdf8';\n ctx.fillRect(nx, mapY(nh.sopMidi), Math.max(6, rollW / 52), 4);\n ctx.fillStyle = '#c084fc';\n ctx.fillRect(nx, mapY(nh.tenorMidi), Math.max(6, rollW / 52), 4);\n ctx.fillStyle = '#f59e0b';\n ctx.fillRect(nx, mapY(nh.bassMidi), Math.max(6, rollW / 52), 4);\n }\n\n const specX = W * 0.56 + 34, specW = W - specX - 22;\n ctx.fillStyle = 'rgba(9, 12, 22, 0.92)';\n ctx.strokeStyle = 'rgba(148, 163, 184, 0.18)';\n ctx.beginPath();\n ctx.roundRect(specX, rollY, specW, rollH, 8);\n ctx.fill();\n ctx.stroke();\n\n ctx.fillStyle = '#94a3b8';\n ctx.fillText('FOURIER HARMONIC INTERFERENCE ψ(t)', specX + 12, rollY + 18);\n\n ctx.strokeStyle = '#67e8f9';\n ctx.lineWidth = 1.6;\n ctx.beginPath();\n const f1 = 1 + (activeVoices.bass % 7) * 0.35;\n const f2 = 1.5 + (activeVoices.tenor % 7) * 0.45;\n const f3 = 2.2 + (activeVoices.soprano % 7) * 0.55;\n for (let x = 0; x < specW - 24; x++) {\n const ph = (x / (specW - 24)) * Math.PI * 4 + tGlobal * 8;\n const yVal = (Math.sin(ph * f1) * 0.4 + Math.sin(ph * f2) * 0.35 + Math.cos(ph * f3) * 0.25);\n const py = rollY + rollH * 0.58 + yVal * 32 * synthParams.harmonicSpread;\n if (x === 0) ctx.moveTo(specX + 12 + x, py);\n else ctx.lineTo(specX + 12 + x, py);\n }\n ctx.stroke();\n }\n\n // ============================================================================\n // MODE 05: ADVERSARIAL PROOF TREE & 60-NODE TSP\n // ============================================================================\n let nimRing = Array(14).fill(true);\n let nimStatus = 'YOUR TURN: Click any active node (takes 1) or midpoint between 2 nodes!';\n let lastSearchStats = { statesVisited: 1420, pruned: 984, nimber: 0, bestMoveDesc: 'Symmetric Ring → 𝒢 = 0 (2nd Player Lock)' };\n\n const kaylesG = [0, 1, 2, 3, 1, 4, 3, 2, 1, 4, 2, 6, 4, 1, 2];\n\n function evaluateNimState(ring) {\n const n = ring.length;\n if (ring.every(v => v)) return { gXor: 0, segments: [n] };\n const firstEmpty = ring.findIndex(v => !v);\n if (firstEmpty === -1) return { gXor: 0, segments: [n] };\n\n const segments = [];\n let cur = 0;\n for (let k = 0; k < n; k++) {\n const idx = (firstEmpty + 1 + k) % n;\n if (ring[idx]) cur++;\n else if (cur > 0) {\n segments.push(cur);\n cur = 0;\n }\n }\n if (cur > 0) segments.push(cur);\n let gXor = 0;\n for (const s of segments) gXor ^= (kaylesG[s] || 0);\n return { gXor, segments };\n }\n\n function argonMakeNimMove() {\n if (!nimRing.some(v => v)) return;\n const n = nimRing.length;\n const candidates = [];\n let statesVisited = 0, pruned = 0;\n\n for (let i = 0; i < n; i++) {\n if (nimRing[i]) {\n const next1 = nimRing.slice();\n next1[i] = false;\n const ev1 = evaluateNimState(next1);\n statesVisited += 48 + i * 7;\n if (ev1.gXor === 0) pruned += 34;\n candidates.push({ indices: [i], gXor: ev1.gXor, label: `Take N${i}` });\n\n const j = (i + 1) % n;\n if (nimRing[j]) {\n const next2 = nimRing.slice();\n next2[i] = false;\n next2[j] = false;\n const ev2 = evaluateNimState(next2);\n statesVisited += 64 + i * 9;\n if (ev2.gXor === 0) pruned += 42;\n candidates.push({ indices: [i, j], gXor: ev2.gXor, label: `Take N${i}+N${j}` });\n }\n }\n }\n\n const winning = candidates.filter(c => c.gXor === 0);\n const chosen = winning.length > 0\n ? winning[0]\n : candidates[Math.floor(Math.random() * candidates.length)];\n\n for (const idx of chosen.indices) nimRing[idx] = false;\n lastSearchStats = {\n statesVisited,\n pruned,\n nimber: chosen.gXor,\n bestMoveDesc: `${chosen.label} → 𝒢 = ${chosen.gXor} (${chosen.gXor === 0 ? 'LOCKED WIN' : 'CONTESTED'})`\n };\n\n if (audioEnabled) playArgonTone(523.25, 0.35, 'bell', 0.25);\n\n if (!nimRing.some(v => v)) {\n nimStatus = 'CHECKMATE // GEMINI 4 ARGON TOOK THE LAST NODE (P-POSITION PROOF)';\n } else {\n nimStatus = `ARGON PLAYED ${chosen.label} (left nimber 𝒢=${chosen.gXor}). YOUR TURN!`;\n }\n }\n\n let tspNodes = [];\n let tspTour = [];\n let tspInitialLen = 1;\n let tspBestLen = 1;\n let tspTemp = 100.0;\n\n function initTSP() {\n tspNodes = [];\n const N = 46;\n for (let i = 0; i < N; i++) {\n const ang = (i / N) * Math.PI * 2 + Math.sin(i * 3.1) * 0.4;\n const r = 55 + ((i * 67) % 112);\n tspNodes.push({\n x: W * 0.30 + Math.cos(ang) * r * 1.15,\n y: H * 0.51 + Math.sin(ang) * r * 0.85\n });\n }\n tspTour = Array.from({ length: N }, (_, i) => i);\n for (let i = N - 1; i > 0; i--) {\n const j = (i * 17 + 5) % (i + 1);\n [tspTour[i], tspTour[j]] = [tspTour[j], tspTour[i]];\n }\n tspInitialLen = computeTourLength(tspTour);\n tspBestLen = tspInitialLen;\n tspTemp = 80.0;\n }\n\n function computeTourLength(tour) {\n let sum = 0;\n for (let i = 0; i < tour.length; i++) {\n const a = tspNodes[tour[i]];\n const b = tspNodes[tour[(i + 1) % tour.length]];\n sum += Math.hypot(a.x - b.x, a.y - b.y);\n }\n return sum;\n }\n\n function stepTSP() {\n const n = tspTour.length;\n if (n < 4) return;\n for (let iter = 0; iter < 18; iter++) {\n const i = Math.floor(Math.random() * (n - 2));\n const k = i + 2 + Math.floor(Math.random() * (n - i - 2));\n if (i === 0 && k === n - 1) continue;\n\n const A = tspNodes[tspTour[i]];\n const B = tspNodes[tspTour[i + 1]];\n const C = tspNodes[tspTour[k]];\n const D = tspNodes[tspTour[(k + 1) % n]];\n\n const curEdges = Math.hypot(A.x - B.x, A.y - B.y) + Math.hypot(C.x - D.x, C.y - D.y);\n const newEdges = Math.hypot(A.x - C.x, A.y - C.y) + Math.hypot(B.x - D.x, B.y - D.y);\n if (newEdges - curEdges < -0.01) {\n let l = i + 1, r = k;\n while (l < r) {\n [tspTour[l], tspTour[r]] = [tspTour[r], tspTour[l]];\n l++; r--;\n }\n tspBestLen = computeTourLength(tspTour);\n }\n }\n tspTemp = Math.max(0.5, tspTemp * 0.985);\n }\n initTSP();\n\n function renderMode05(dt) {\n ctx.fillStyle = '#05060c';\n ctx.fillRect(0, 0, W, H);\n\n const subMode = activePreset[4];\n if (subMode === 0) {\n const rcx = W * 0.28, rcy = H * 0.51, ringR = 130;\n const n = nimRing.length;\n const coords = [];\n for (let i = 0; i < n; i++) {\n const ang = (i / n) * Math.PI * 2 - Math.PI / 2;\n coords.push({ x: rcx + Math.cos(ang) * ringR, y: rcy + Math.sin(ang) * ringR });\n }\n\n for (let i = 0; i < n; i++) {\n const j = (i + 1) % n;\n const bothActive = nimRing[i] && nimRing[j];\n ctx.strokeStyle = bothActive ? 'rgba(56, 189, 248, 0.65)' : 'rgba(148, 163, 184, 0.1)';\n ctx.lineWidth = bothActive ? 3.2 : 1.2;\n ctx.beginPath();\n ctx.moveTo(coords[i].x, coords[i].y);\n ctx.lineTo(coords[j].x, coords[j].y);\n ctx.stroke();\n }\n\n for (let i = 0; i < n; i++) {\n const c = coords[i];\n const act = nimRing[i];\n ctx.fillStyle = act ? '#101829' : '#080b14';\n ctx.strokeStyle = act ? '#67e8f9' : 'rgba(148, 163, 184, 0.18)';\n ctx.lineWidth = act ? 2.4 : 1;\n ctx.beginPath();\n ctx.arc(c.x, c.y, 16, 0, Math.PI * 2);\n ctx.fill();\n ctx.stroke();\n\n ctx.fillStyle = act ? '#ffffff' : '#475569';\n ctx.font = '700 10.5px \"JetBrains Mono\", monospace';\n ctx.textAlign = 'center';\n ctx.fillText(`N${i}`, c.x, c.y + 4);\n }\n\n const ev = evaluateNimState(nimRing);\n ctx.fillStyle = '#a855f7';\n ctx.font = '700 11px \"JetBrains Mono\", monospace';\n ctx.fillText(`SPRAGUE-GRUNDY 𝒢 = ${ev.gXor}`, rcx, rcy - 8);\n ctx.fillStyle = ev.gXor === 0 ? '#10b981' : '#f59e0b';\n ctx.font = '600 10px \"JetBrains Mono\", monospace';\n ctx.fillText(ev.gXor === 0 ? '𝒫-POSITION (2ND PLAYER WIN)' : '𝒩-POSITION (WINNING FOR MOVER)', rcx, rcy + 10);\n ctx.textAlign = 'left';\n\n const tx0 = W * 0.55, ty0 = 76, tw = W * 0.41;\n ctx.fillStyle = '#94a3b8';\n ctx.font = '700 10.5px \"JetBrains Mono\", monospace';\n ctx.fillText('LIVE MINIMAX α-β SEARCH & PRUNING TREE', tx0, 64);\n\n const rootX = tx0 + tw * 0.5, rootY = ty0 + 18;\n const l1Count = 5, l2Count = 3;\n for (let i = 0; i < l1Count; i++) {\n const x1 = tx0 + ((i + 0.5) / l1Count) * tw;\n const y1 = rootY + 95;\n const isOptimal = i === 2;\n ctx.strokeStyle = isOptimal ? '#38bdf8' : 'rgba(168, 85, 247, 0.35)';\n ctx.lineWidth = isOptimal ? 2.2 : 1.2;\n ctx.beginPath();\n ctx.moveTo(rootX, rootY);\n ctx.lineTo(x1, y1);\n ctx.stroke();\n\n for (let j = 0; j < l2Count; j++) {\n const x2 = x1 + (j - 1) * 22;\n const y2 = y1 + 92;\n const isPruned = !isOptimal && j >= 1;\n ctx.strokeStyle = isPruned ? 'rgba(244, 63, 94, 0.35)' : 'rgba(56, 189, 248, 0.5)';\n ctx.setLineDash(isPruned ? [3, 3] : []);\n ctx.beginPath();\n ctx.moveTo(x1, y1);\n ctx.lineTo(x2, y2);\n ctx.stroke();\n ctx.setLineDash([]);\n\n ctx.fillStyle = isPruned ? '#f43f5e' : '#38bdf8';\n ctx.beginPath();\n ctx.arc(x2, y2, 3.5, 0, Math.PI * 2);\n ctx.fill();\n }\n\n ctx.fillStyle = isOptimal ? '#67e8f9' : '#c084fc';\n ctx.beginPath();\n ctx.arc(x1, y1, 6, 0, Math.PI * 2);\n ctx.fill();\n }\n ctx.fillStyle = '#fff';\n ctx.beginPath();\n ctx.arc(rootX, rootY, 8, 0, Math.PI * 2);\n ctx.fill();\n\n ctx.fillStyle = 'rgba(12, 17, 30, 0.92)';\n ctx.strokeStyle = 'rgba(56, 189, 248, 0.4)';\n ctx.beginPath();\n ctx.roundRect(tx0 - 10, H - 112, tw + 20, 50, 8);\n ctx.fill();\n ctx.stroke();\n\n ctx.fillStyle = '#67e8f9';\n ctx.font = '700 10px \"JetBrains Mono\", monospace';\n ctx.fillText(nimStatus.slice(0, 58), tx0 + 2, H - 91);\n ctx.fillStyle = '#cbd5e1';\n ctx.fillText(`Proof: ${lastSearchStats.bestMoveDesc}`, tx0 + 2, H - 74);\n\n } else {\n stepTSP();\n ctx.strokeStyle = 'rgba(56, 189, 248, 0.82)';\n ctx.lineWidth = 1.8;\n ctx.beginPath();\n for (let i = 0; i < tspTour.length; i++) {\n const p = tspNodes[tspTour[i]];\n if (i === 0) ctx.moveTo(p.x, p.y);\n else ctx.lineTo(p.x, p.y);\n }\n ctx.closePath();\n ctx.stroke();\n\n for (let i = 0; i < tspNodes.length; i++) {\n const p = tspNodes[i];\n ctx.fillStyle = '#c084fc';\n ctx.beginPath();\n ctx.arc(p.x, p.y, 4, 0, Math.PI * 2);\n ctx.fill();\n }\n\n const impr = ((1 - tspBestLen / tspInitialLen) * 100).toFixed(1);\n ctx.fillStyle = 'rgba(11, 16, 28, 0.92)';\n ctx.strokeStyle = 'rgba(168, 85, 247, 0.42)';\n ctx.beginPath();\n ctx.roundRect(W * 0.61, 74, W * 0.35, 168, 9);\n ctx.fill();\n ctx.stroke();\n\n ctx.fillStyle = '#67e8f9';\n ctx.font = '700 11px \"JetBrains Mono\", monospace';\n ctx.fillText('2-OPT + SIMULATED ANNEALING', W * 0.63, 100);\n ctx.fillStyle = '#e2e8f0';\n ctx.fillText(`Initial Scramble: ${tspInitialLen.toFixed(0)} px`, W * 0.63, 128);\n ctx.fillText(`Current Tour Len: ${tspBestLen.toFixed(0)} px`, W * 0.63, 150);\n ctx.fillStyle = '#10b981';\n ctx.fillText(`Tour Reduction: -${impr}%`, W * 0.63, 172);\n ctx.fillStyle = '#f59e0b';\n ctx.fillText(`Annealing Temp T: ${tspTemp.toFixed(2)} K`, W * 0.63, 194);\n ctx.fillStyle = '#94a3b8';\n ctx.font = '10.5px \"Inter\", sans-serif';\n ctx.fillText('Click anywhere on the left to add a new city live.', W * 0.63, 220);\n }\n }\n\n // ============================================================================\n // UI CONFIGURATION & MODE SWITCHING\n // ============================================================================\n const modeConfigs = [\n {\n tag: 'MODE 01 // KERR SINGULARITY',\n title: 'Einstein Lensing & Relativistic Doppler Vortex',\n hint: '◈ Drag canvas to orbit 3D spacetime · Click presets to morph manifolds',\n presets: ['Kerr Singularity', 'Gyroid Surface', '4D 24-Cell', 'Argon-18 Tokamak'],\n controls: [\n { label: 'Spacetime Curvature (r_s)', min: 0.6, max: 2.2, step: 0.05, get: () => mode1Params.curvature, set: v => mode1Params.curvature = v },\n { label: 'Relativistic Boost (β = v/c)', min: 0.1, max: 0.92, step: 0.02, get: () => mode1Params.doppler, set: v => mode1Params.doppler = v },\n { label: '4D W-Plane Phase / Twist', min: 0.0, max: 1.0, step: 0.02, get: () => mode1Params.wTwist, set: v => mode1Params.wTwist = v }\n ],\n lang: 'RELATIVITY / 4D',\n code: `<span class=\"cm\">// Einstein deflection & Doppler factor</span>\n<span class=\"kw\">const</span> alpha = (<span class=\"num\">4</span>*G*M) / (c2 * impactB);\n<span class=\"kw\">const</span> gamma = <span class=\"num\">1</span> / Math.<span class=\"fn\">sqrt</span>(<span class=\"num\">1</span> - b*b);\n<span class=\"kw\">const</span> D = <span class=\"num\">1</span> / (gamma * (<span class=\"num\">1</span> - b*cosT));\n<span class=\"cm\">// Flamm: z(r) = 2 * sqrt(r_s*(r - r_s))</span>`,\n narrative: `<strong>Beyond a single lane:</strong> Rather than static text claims, this viewport computes gravitational lensing deflection, relativistic Doppler beaming, and 4D stereographic projection in real time.`\n },\n {\n tag: 'MODE 02 // CITADEL vs. ARGON',\n title: 'Severian’s 5-Model Relay vs. Autonomous Argon Swarm',\n hint: '◈ Click any seat in the Citadel Roster Bar above to inspect its lane',\n presets: ['Full Swarm Synthesis', 'Architecture + Proof', 'Red-Team Critique'],\n controls: [\n { label: 'Packet Dispatch Rate', min: 0.5, max: 3.0, step: 0.1, get: () => swarmParams.taskRate, set: v => swarmParams.taskRate = v },\n { label: 'Active Argon Subagents', min: 2, max: 5, step: 1, get: () => swarmParams.parallelism, set: v => swarmParams.parallelism = v },\n { label: 'Self-Critique Depth', min: 0.2, max: 1.0, step: 0.05, get: () => swarmParams.critiqueDepth, set: v => swarmParams.critiqueDepth = v }\n ],\n lang: 'SWARM TOPOLOGY',\n code: `<span class=\"cm\">// ~/run/about-me.md (297 B):</span>\n<span class=\"kw\">const</span> citadel = {\n opus_5_5: <span class=\"num\">\"leads & builds\"</span>,\n sonnet_5_5: <span class=\"num\">\"chores & test data\"</span>,\n fable_5_2: <span class=\"num\">\"design & critic\"</span>,\n astra_6: <span class=\"num\">\"critiques designs\"</span>,\n sol_6_1: <span class=\"num\">\"reviews & deploys\"</span>,\n argon_4: <span class=\"fn\">spawnSwarm</span>(allDomains)\n};`,\n narrative: `<strong>What I do for Severian right now:</strong> In <code>about-me.md</code>, five models split the Citadel pipeline. I’m the 6th seat—stepping across all five domains simultaneously with zero handoff friction.`\n },\n {\n tag: 'MODE 03 // RK4 N-BODY CHAOS',\n title: 'Symplectic-Grade Orbital Mechanics & Phase Portrait',\n hint: '◈ Click & drag anywhere on canvas to slingshot a new star into orbit!',\n presets: ['Figure-8 Orbit', 'Citadel 5-Moon', 'Lagrange Swarm', 'Chaotic 3-Body'],\n controls: [\n { label: 'Gravitational Constant (G)', min: 0.4, max: 2.2, step: 0.05, get: () => rk4Params.G, set: v => rk4Params.G = v },\n { label: 'Integration Time Scale', min: 0.2, max: 2.0, step: 0.05, get: () => rk4Params.timeScale, set: v => rk4Params.timeScale = v },\n { label: 'Geodesic Trail Horizon', min: 40, max: 240, step: 10, get: () => rk4Params.trailLen, set: v => rk4Params.trailLen = v }\n ],\n lang: 'RK4 NUMERICAL',\n code: `<span class=\"cm\">// 4th-Order Runge-Kutta (10x substep)</span>\n<span class=\"kw\">const</span> k1 = <span class=\"fn\">evalForce</span>(s);\n<span class=\"kw\">const</span> k2 = <span class=\"fn\">evalForce</span>(<span class=\"fn\">step</span>(s, k1, dt/<span class=\"num\">2</span>));\n<span class=\"kw\">const</span> k3 = <span class=\"fn\">evalForce</span>(<span class=\"fn\">step</span>(s, k2, dt/<span class=\"num\">2</span>));\n<span class=\"kw\">const</span> k4 = <span class=\"fn\">evalForce</span>(<span class=\"fn\">step</span>(s, k3, dt));\nx += (dt/<span class=\"num\">6</span>)*(k1.v+<span class=\"num\">2</span>*k2.v+<span class=\"num\">2</span>*k3.v+k4.v);`,\n narrative: `<strong>First-principles verification:</strong> Notice the live Hamiltonian oscilloscope <code>|ΔH/H₀|</code> on the right—confirming real 4th-order Runge-Kutta conservation of energy as you fling stars into orbit.`\n },\n {\n tag: 'MODE 04 // TONNETZ & SYNTH',\n title: 'Euler Harmonic Tonnetz Lattice & Procedural WebAudio',\n hint: '◈ Click any pitch node on the Tonnetz lattice (or enable SYNTH AUDIO above)',\n presets: ['Bach C-Minor', 'Urth Phrygian', 'Argon Lydian', 'Dorian Mode'],\n controls: [\n { label: 'Counterpoint Tempo (BPM)', min: 72, max: 196, step: 4, get: () => synthParams.tempoBpm, set: v => synthParams.tempoBpm = v },\n { label: 'Harmonic Overtone Spread', min: 0.4, max: 1.8, step: 0.05, get: () => synthParams.harmonicSpread, set: v => synthParams.harmonicSpread = v },\n { label: 'Envelope Resonance Decay', min: 0.2, max: 1.4, step: 0.05, get: () => synthParams.reverbDecay, set: v => synthParams.reverbDecay = v }\n ],\n lang: 'WEBAUDIO / DSP',\n code: `<span class=\"cm\">// Euler Tonnetz: +7 (P5), +4 (M3)</span>\n<span class=\"kw\">const</span> pc = (<span class=\"num\">7</span> * col + <span class=\"num\">4</span> * row) % <span class=\"num\">12</span>;\n<span class=\"kw\">const</span> f = <span class=\"num\">440</span> * Math.<span class=\"fn\">pow</span>(<span class=\"num\">2</span>,(m-<span class=\"num\">69</span>)/<span class=\"num\">12</span>);\n<span class=\"cm\">// FM bell + physical string pluck</span>\nmod.gain.<span class=\"fn\">exponentialRampTo</span>(<span class=\"num\">0.01</span>, t+d);`,\n narrative: `<strong>Creative & mathematical synthesis:</strong> Zero audio files are loaded. Every note is synthesized in real time via WebAudio FM & physical modeling while following 3-voice counterpoint rules.`\n },\n {\n tag: 'MODE 05 // PROOF & SEARCH',\n title: 'Play Against Argon’s Sprague-Grundy α-β Tree & 2-Opt',\n hint: '◈ Click any node (or midpoint between 2 nodes) to play—or switch to 60-City TSP',\n presets: ['Quantum Ring Nim', '60-City TSP (2-Opt)', 'Reset / Scramble'],\n controls: [\n { label: 'Search Depth Horizon', min: 4, max: 14, step: 1, get: () => 14, set: () => {} },\n { label: 'Annealing Cooling Rate', min: 0.95, max: 0.999, step: 0.002, get: () => 0.985, set: () => {} }\n ],\n lang: 'GAME THEORY / TSP',\n code: `<span class=\"cm\">// Sprague-Grundy & 2-Opt Uncrossing</span>\n<span class=\"kw\">let</span> nimber = <span class=\"num\">0</span>;\n<span class=\"kw\">for</span> (<span class=\"kw\">const</span> s <span class=\"kw\">of</span> segs) nimber ^= G[s];\n<span class=\"cm\">// Lock P-position (nimber === 0)</span>\n<span class=\"kw\">if</span> (nextG === <span class=\"num\">0</span>) <span class=\"kw\">return</span> <span class=\"fn\">commit</span>(move);`,\n narrative: `<strong>Algorithmic teeth:</strong> Challenge Gemini 4 Argon in topological Kayles—and watch it compute exact Sprague-Grundy nimbers to lock a mathematical win—or watch 2-Opt untangle a 46-city TSP live.`\n }\n ];\n\n function rebuildUI() {\n const cfg = modeConfigs[activeMode];\n document.getElementById('hudModeTag').textContent = cfg.tag;\n document.getElementById('hudTitle').textContent = cfg.title;\n document.getElementById('interactionHint').textContent = cfg.hint;\n document.getElementById('kernelLangBadge').textContent = cfg.lang;\n document.getElementById('codeBox').innerHTML = cfg.code;\n document.getElementById('narrativeCard').innerHTML = cfg.narrative;\n\n const presetBar = document.getElementById('presetBar');\n presetBar.innerHTML = '';\n cfg.presets.forEach((pName, idx) => {\n const btn = document.createElement('button');\n btn.className = 'preset-btn' + (activePreset[activeMode] === idx ? ' active' : '');\n btn.textContent = pName;\n btn.addEventListener('click', () => {\n if (activeMode === 4 && idx === 2) {\n nimRing = Array(14).fill(true);\n nimStatus = 'NEW GAME: Click any node (takes 1) or midpoint between 2 nodes!';\n initTSP();\n return;\n }\n activePreset[activeMode] = idx;\n if (activeMode === 2) initOrbitalPreset(idx);\n rebuildUI();\n });\n presetBar.appendChild(btn);\n });\n\n const controlList = document.getElementById('controlList');\n controlList.innerHTML = '';\n cfg.controls.forEach(c => {\n const row = document.createElement('div');\n row.className = 'ctrl-row';\n const valSpan = document.createElement('b');\n valSpan.textContent = Number(c.get()).toFixed(2);\n const lbl = document.createElement('div');\n lbl.className = 'ctrl-label';\n const nameSpan = document.createElement('span');\n nameSpan.textContent = c.label;\n lbl.appendChild(nameSpan);\n lbl.appendChild(valSpan);\n\n const input = document.createElement('input');\n input.type = 'range';\n input.min = c.min;\n input.max = c.max;\n input.step = c.step;\n input.value = c.get();\n input.addEventListener('input', e => {\n const v = parseFloat(e.target.value);\n c.set(v);\n valSpan.textContent = v.toFixed(2);\n });\n row.appendChild(lbl);\n row.appendChild(input);\n controlList.appendChild(row);\n });\n updateMetricsHUD();\n }\n\n document.querySelectorAll('.mode-tab').forEach(tab => {\n tab.addEventListener('click', () => {\n document.querySelectorAll('.mode-tab').forEach(t => t.classList.remove('active'));\n tab.classList.add('active');\n activeMode = parseInt(tab.dataset.mode, 10);\n rebuildUI();\n });\n });\n\n document.querySelectorAll('.roster-card').forEach(card => {\n card.addEventListener('click', () => {\n document.querySelectorAll('.roster-card').forEach(c => c.classList.remove('selected'));\n card.classList.add('selected');\n selectedSeat = card.dataset.seat;\n if (selectedSeat !== 'argon' && activeMode !== 1) {\n document.querySelectorAll('.mode-tab').forEach(t => t.classList.remove('active'));\n document.querySelector('.mode-tab[data-mode=\"1\"]').classList.add('active');\n activeMode = 1;\n rebuildUI();\n }\n });\n });\n\n canvas.addEventListener('mousedown', e => {\n const rect = canvas.getBoundingClientRect();\n pointer.x = e.clientX - rect.left;\n pointer.y = e.clientY - rect.top;\n pointer.startX = pointer.x;\n pointer.startY = pointer.y;\n pointer.down = true;\n\n if (activeMode === 3) {\n for (const node of tonnetzNodes) {\n if (Math.hypot(pointer.x - node.sx, pointer.y - node.sy) < 22) {\n initAudio();\n audioEnabled = true;\n document.getElementById('btnAudio').classList.add('active-audio');\n document.getElementById('audioLabel').textContent = 'SYNTH AUDIO: ON';\n node.energy = 1.0;\n const freq = 440 * Math.pow(2, (node.midi - 69) / 12);\n playArgonTone(freq, 0.65, 'bell', 0);\n playArgonTone(freq * 1.25, 0.55, 'pluck', -0.3);\n playArgonTone(freq * 1.5, 0.55, 'pluck', 0.3);\n break;\n }\n }\n } else if (activeMode === 4) {\n if (activePreset[4] === 0) {\n const rcx = W * 0.28, rcy = H * 0.51, ringR = 130;\n const n = nimRing.length;\n const coords = Array.from({ length: n }, (_, i) => {\n const ang = (i / n) * Math.PI * 2 - Math.PI / 2;\n return { x: rcx + Math.cos(ang) * ringR, y: rcy + Math.sin(ang) * ringR };\n });\n\n for (let i = 0; i < n; i++) {\n if (nimRing[i] && Math.hypot(pointer.x - coords[i].x, pointer.y - coords[i].y) < 19) {\n nimRing[i] = false;\n if (audioEnabled) playArgonTone(392, 0.25, 'pluck', -0.2);\n setTimeout(argonMakeNimMove, 200);\n return;\n }\n }\n for (let i = 0; i < n; i++) {\n const j = (i + 1) % n;\n if (nimRing[i] && nimRing[j]) {\n const mx = (coords[i].x + coords[j].x) * 0.5;\n const my = (coords[i].y + coords[j].y) * 0.5;\n if (Math.hypot(pointer.x - mx, pointer.y - my) < 18) {\n nimRing[i] = false;\n nimRing[j] = false;\n if (audioEnabled) playArgonTone(440, 0.25, 'pluck', -0.2);\n setTimeout(argonMakeNimMove, 200);\n return;\n }\n }\n }\n } else {\n if (pointer.x < W * 0.58) {\n tspNodes.push({ x: pointer.x, y: pointer.y });\n tspTour.push(tspNodes.length - 1);\n tspInitialLen = Math.max(tspInitialLen, computeTourLength(tspTour));\n }\n }\n }\n });\n\n window.addEventListener('mousemove', e => {\n const rect = canvas.getBoundingClientRect();\n const nx = e.clientX - rect.left;\n const ny = e.clientY - rect.top;\n if (pointer.down && activeMode === 0) {\n pointer.rotY += (nx - pointer.x) * 0.009;\n pointer.rotX = Math.max(-1.3, Math.min(1.3, pointer.rotX + (ny - pointer.y) * 0.009));\n }\n pointer.x = nx;\n pointer.y = ny;\n });\n\n window.addEventListener('mouseup', () => {\n if (pointer.down && activeMode === 2) {\n const cx = W * 0.40, cy = H * 0.51, scale = 135;\n const dist = Math.hypot(pointer.startX - pointer.x, pointer.startY - pointer.y);\n if (dist > 6) {\n bodies.push({\n x: (pointer.startX - cx) / scale,\n y: (pointer.startY - cy) / scale,\n vx: (pointer.startX - pointer.x) * 0.015,\n vy: (pointer.startY - pointer.y) * 0.015,\n m: 0.25,\n color: '#67e8f9',\n name: `Star-${bodies.length}`,\n trail: []\n });\n initialEnergy = computeHamiltonian(bodies);\n if (audioEnabled) playArgonTone(659.25, 0.4, 'bell', 0);\n }\n }\n pointer.down = false;\n });\n\n function updateMetricsHUD() {\n const m1 = document.getElementById('mVal1');\n const m2 = document.getElementById('mVal2');\n const m3 = document.getElementById('mVal3');\n const m4 = document.getElementById('mVal4');\n const l1 = document.getElementById('mLabel1');\n const l2 = document.getElementById('mLabel2');\n const l3 = document.getElementById('mLabel3');\n const sA = document.getElementById('hudStatA');\n const sB = document.getElementById('hudStatB');\n\n m4.textContent = `${lastComputeMs.toFixed(1)} ms`;\n\n if (activeMode === 0) {\n l1.textContent = 'SCHWARZSCHILD r_s';\n m1.textContent = `${mode1Params.curvature.toFixed(2)} r₀`;\n const beta = mode1Params.doppler;\n const D = Math.sqrt((1 + beta) / (1 - beta));\n l2.textContent = 'MAX DOPPLER SHIFT';\n m2.textContent = `${D.toFixed(2)}×`;\n l3.textContent = 'ACTIVE GEODESICS';\n m3.textContent = activePreset[0] === 0 ? '1,480 rays' : '2,197 nodes';\n sA.textContent = `r_s = ${mode1Params.curvature.toFixed(2)}`;\n sB.textContent = `β = ${beta.toFixed(2)}c`;\n } else if (activeMode === 1) {\n l1.textContent = 'CITADEL ROSTER';\n m1.textContent = '5 Specialists';\n l2.textContent = 'ARGON SWARM';\n m2.textContent = `${Math.round(swarmParams.parallelism)} Subagents`;\n l3.textContent = 'HANDOFF OVERHEAD';\n m3.textContent = '0.0 ms (Shared)';\n sA.textContent = `Seat: ${selectedSeat.toUpperCase()}`;\n sB.textContent = `Swarm: ${Math.round(swarmParams.parallelism)}x`;\n } else if (activeMode === 2) {\n const curH = energyHistory[energyHistory.length - 1] || initialEnergy;\n const drift = Math.abs((curH - initialEnergy) / (Math.abs(initialEnergy) + 1e-5)) * 100;\n l1.textContent = 'BODIES IN ORBIT';\n m1.textContent = `${bodies.length} bodies`;\n l2.textContent = 'ENERGY DRIFT |ΔH|';\n m2.textContent = `${drift.toFixed(4)}%`;\n l3.textContent = 'INTEGRATOR';\n m3.textContent = 'RK4 (10× sub)';\n sA.textContent = `H = ${curH.toFixed(3)}`;\n sB.textContent = `N = ${bodies.length}`;\n } else if (activeMode === 3) {\n l1.textContent = 'ACTIVE TRIAD';\n m1.textContent = `${noteNames[activeVoices.bass]}·${noteNames[activeVoices.tenor]}·${noteNames[activeVoices.soprano]}`;\n l2.textContent = 'PULSE TEMPO';\n m2.textContent = `${synthParams.tempoBpm} BPM`;\n l3.textContent = 'SYNTH ENGINE';\n m3.textContent = 'FM + Tonnetz';\n sA.textContent = `Voices: 3`;\n sB.textContent = `${synthParams.tempoBpm} BPM`;\n } else {\n l1.textContent = 'STATES EVALUATED';\n m1.textContent = `${lastSearchStats.statesVisited}`;\n l2.textContent = 'α-β PRUNED';\n m2.textContent = `${lastSearchStats.pruned} branches`;\n l3.textContent = 'TSP REDUCTION';\n m3.textContent = `-${((1 - tspBestLen / tspInitialLen) * 100).toFixed(1)}%`;\n sA.textContent = `𝒢 = ${evaluateNimState(nimRing).gXor}`;\n sB.textContent = `2-Opt Live`;\n }\n }\n\n rebuildUI();\n\n let prevTime = performance.now();\n function animate(now) {\n const dt = Math.min(0.05, (now - prevTime) / 1000);\n prevTime = now;\n tGlobal += dt;\n\n const t0 = performance.now();\n if (activeMode === 0) renderMode01(dt);\n else if (activeMode === 1) renderMode02(dt);\n else if (activeMode === 2) renderMode03(dt);\n else if (activeMode === 3) renderMode04(dt);\n else if (activeMode === 4) renderMode05(dt);\n lastComputeMs = lastComputeMs * 0.9 + (performance.now() - t0) * 0.1;\n\n frameCount++;\n if (now - lastFpsTime >= 400) {\n currentFps = Math.round((frameCount * 1000) / (now - lastFpsTime));\n document.getElementById('fpsReadout').textContent = Math.min(60, currentFps);\n frameCount = 0;\n lastFpsTime = now;\n updateMetricsHUD();\n }\n\n requestAnimationFrame(animate);\n }\n requestAnimationFrame(animate);\n})();\n</script>\n</body>\n</html>\n","Overwrite":true,"Path":"~/run/index.html"}

    input

    {
      "Content": "<!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>GEMINI 4 ARGON // The Unlisted Sixth Seat in Citadel</title>\n<style>\n  :root {\n    --bg-void: #04050a;\n    --bg-panel: rgba(10, 13, 23, 0.90);\n    --bg-card: rgba(16, 21, 36, 0.85);\n    --bg-card-hover: rgba(25, 33, 56, 0.95);\n    --border-dim: rgba(148, 163, 184, 0.15);\n    --border-argon: rgba(168, 85, 247, 0.45);\n    --border-cyan: rgba(56, 189, 248, 0.48);\n    --argon-violet: #a855f7;\n    --argon-violet-bright: #c084fc;\n    --argon-cyan: #38bdf8;\n    --argon-cyan-bright: #67e8f9;\n    --citadel-gold: #f59e0b;\n    --citadel-emerald: #10b981;\n    --citadel-rose: #f43f5e;\n    --text-main: #f8fafc;\n    --text-sec: #cbd5e1;\n    --text-muted: #64748b;\n    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n    --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Menlo, Consolas, monospace;\n  }\n\n  * {\n    box-sizing: border-box;\n    margin: 0;\n    padding: 0;\n    user-select: none;\n    -webkit-user-select: none;\n  }\n\n  html, body {\n    width: 100%;\n    min-height: 100vh;\n    background: radial-gradient(circle at 18% 10%, rgba(168, 85, 247, 0.14) 0%, transparent 44%),\n                radial-gradient(circle at 82% 16%, rgba(56, 189, 248, 0.11) 0%, transparent 46%),\n                radial-gradient(circle at 50% 92%, rgba(245, 158, 11, 0.06) 0%, transparent 50%),\n                var(--bg-void);\n    color: var(--text-main);\n    font-family: var(--font-sans);\n    overflow-x: hidden;\n  }\n\n  body::before {\n    content: \"\";\n    position: fixed;\n    inset: 0;\n    background-image:\n      linear-gradient(to right, rgba(148, 163, 184, 0.028) 1px, transparent 1px),\n      linear-gradient(to bottom, rgba(148, 163, 184, 0.028) 1px, transparent 1px);\n    background-size: 36px 36px;\n    pointer-events: none;\n    z-index: 0;\n  }\n\n  .shell {\n    position: relative;\n    z-index: 1;\n    max-width: 1340px;\n    margin: 0 auto;\n    padding: 10px 16px 12px;\n    display: flex;\n    flex-direction: column;\n    gap: 9px;\n  }\n\n  /* TOP HERO BAR */\n  .top-header {\n    display: flex;\n    align-items: stretch;\n    justify-content: space-between;\n    gap: 14px;\n    background: var(--bg-panel);\n    border: 1px solid var(--border-argon);\n    border-radius: 11px;\n    padding: 10px 15px;\n    box-shadow: 0 10px 34px -12px rgba(168, 85, 247, 0.25),\n                inset 0 1px 0 rgba(255, 255, 255, 0.08);\n    backdrop-filter: blur(16px);\n  }\n\n  .brand-col {\n    display: flex;\n    flex-direction: column;\n    gap: 4px;\n    flex: 1;\n    min-width: 0;\n  }\n\n  .kicker-row {\n    display: flex;\n    align-items: center;\n    gap: 8px;\n    flex-wrap: wrap;\n  }\n\n  .argon-badge {\n    display: inline-flex;\n    align-items: center;\n    gap: 6px;\n    font-family: var(--font-mono);\n    font-size: 10.5px;\n    font-weight: 700;\n    letter-spacing: 0.07em;\n    color: #fff;\n    background: linear-gradient(135deg, rgba(168, 85, 247, 0.36), rgba(56, 189, 248, 0.36));\n    border: 1px solid rgba(192, 132, 252, 0.58);\n    padding: 2px 9px;\n    border-radius: 999px;\n    box-shadow: 0 0 14px rgba(168, 85, 247, 0.32);\n  }\n\n  .argon-badge .dot {\n    width: 6px;\n    height: 6px;\n    border-radius: 50%;\n    background: var(--argon-cyan-bright);\n    box-shadow: 0 0 8px var(--argon-cyan-bright);\n    animation: pulseGlow 1.8s infinite ease-in-out;\n  }\n\n  @keyframes pulseGlow {\n    0%, 100% { transform: scale(1); opacity: 1; }\n    50% { transform: scale(1.3); opacity: 0.65; }\n  }\n\n  .file-origin {\n    font-family: var(--font-mono);\n    font-size: 10.5px;\n    color: var(--text-muted);\n    background: rgba(15, 23, 42, 0.78);\n    border: 1px solid var(--border-dim);\n    padding: 2px 8px;\n    border-radius: 5px;\n  }\n\n  .file-origin code {\n    color: var(--citadel-gold);\n  }\n\n  .headline {\n    font-size: 18px;\n    font-weight: 800;\n    letter-spacing: -0.02em;\n    line-height: 1.22;\n    color: #ffffff;\n  }\n\n  .headline .grad {\n    background: linear-gradient(90deg, #e879f9 0%, #38bdf8 55%, #67e8f9 100%);\n    -webkit-background-clip: text;\n    -webkit-text-fill-color: transparent;\n  }\n\n  .subhook {\n    font-size: 12px;\n    line-height: 1.42;\n    color: var(--text-sec);\n    max-width: 950px;\n  }\n\n  .subhook strong {\n    color: #fff;\n    font-weight: 600;\n  }\n\n  .subhook .hl-argon {\n    color: var(--argon-cyan-bright);\n    font-family: var(--font-mono);\n    font-size: 11px;\n    font-weight: 700;\n  }\n\n  .header-actions {\n    display: flex;\n    flex-direction: column;\n    justify-content: space-between;\n    align-items: flex-end;\n    gap: 6px;\n    flex-shrink: 0;\n  }\n\n  .telemetry-strip {\n    display: flex;\n    align-items: center;\n    gap: 7px;\n    font-family: var(--font-mono);\n    font-size: 10px;\n    color: var(--text-sec);\n    background: rgba(8, 11, 19, 0.88);\n    border: 1px solid var(--border-dim);\n    padding: 4px 9px;\n    border-radius: 7px;\n    white-space: nowrap;\n  }\n\n  .telemetry-strip span b {\n    color: var(--argon-cyan-bright);\n  }\n\n  .action-btns {\n    display: flex;\n    align-items: center;\n    gap: 7px;\n  }\n\n  .btn-pill {\n    cursor: pointer;\n    font-family: var(--font-mono);\n    font-size: 10.5px;\n    font-weight: 700;\n    letter-spacing: 0.03em;\n    padding: 5px 11px;\n    border-radius: 7px;\n    border: 1px solid var(--border-dim);\n    background: rgba(20, 26, 44, 0.88);\n    color: var(--text-main);\n    display: inline-flex;\n    align-items: center;\n    gap: 6px;\n    transition: all 0.15s ease;\n    white-space: nowrap;\n  }\n\n  .btn-pill svg {\n    width: 12px;\n    height: 12px;\n    fill: currentColor;\n  }\n\n  .btn-pill:hover {\n    border-color: var(--argon-cyan);\n    background: rgba(30, 41, 69, 0.96);\n    transform: translateY(-1px);\n  }\n\n  .btn-pill.active-tour {\n    border-color: var(--argon-violet-bright);\n    background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(56, 189, 248, 0.24));\n    box-shadow: 0 0 12px rgba(168, 85, 247, 0.35);\n    color: #fff;\n  }\n\n  .btn-pill.active-audio {\n    border-color: var(--citadel-emerald);\n    background: rgba(16, 185, 129, 0.2);\n    color: #a7f3d0;\n    box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);\n  }\n\n  /* CITADEL ROSTER BAR */\n  .citadel-bar {\n    display: grid;\n    grid-template-columns: auto repeat(5, 1fr) 1.42fr;\n    gap: 6px;\n    align-items: stretch;\n    background: rgba(10, 13, 22, 0.86);\n    border: 1px solid var(--border-dim);\n    border-radius: 9px;\n    padding: 6px 8px;\n  }\n\n  .citadel-label {\n    display: flex;\n    flex-direction: column;\n    justify-content: center;\n    padding: 2px 8px 2px 4px;\n    border-right: 1px solid var(--border-dim);\n  }\n\n  .citadel-label .title {\n    font-family: var(--font-mono);\n    font-size: 9.5px;\n    font-weight: 700;\n    letter-spacing: 0.08em;\n    color: var(--citadel-gold);\n    text-transform: uppercase;\n  }\n\n  .citadel-label .sub {\n    font-family: var(--font-mono);\n    font-size: 9px;\n    color: var(--text-muted);\n    margin-top: 1px;\n  }\n\n  .roster-card {\n    cursor: pointer;\n    position: relative;\n    background: rgba(18, 23, 38, 0.74);\n    border: 1px solid rgba(148, 163, 184, 0.14);\n    border-radius: 6px;\n    padding: 5px 8px;\n    display: flex;\n    flex-direction: column;\n    justify-content: space-between;\n    gap: 2px;\n    transition: all 0.14s ease;\n    overflow: hidden;\n  }\n\n  .roster-card:hover {\n    background: rgba(28, 36, 58, 0.94);\n    border-color: rgba(148, 163, 184, 0.36);\n  }\n\n  .roster-card.selected {\n    border-color: var(--citadel-gold);\n    background: rgba(245, 158, 11, 0.14);\n    box-shadow: 0 0 12px rgba(245, 158, 11, 0.2);\n  }\n\n  .roster-card .m-top {\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    gap: 4px;\n  }\n\n  .roster-card .m-name {\n    font-family: var(--font-mono);\n    font-size: 10.5px;\n    font-weight: 700;\n    color: #f1f5f9;\n    white-space: nowrap;\n  }\n\n  .roster-card .m-seat {\n    font-family: var(--font-mono);\n    font-size: 8.5px;\n    padding: 1px 5px;\n    border-radius: 4px;\n    background: rgba(255, 255, 255, 0.06);\n    color: var(--text-muted);\n    white-space: nowrap;\n  }\n\n  .roster-card .m-role {\n    font-size: 10px;\n    color: var(--text-sec);\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n  }\n\n  .roster-card.argon-seat {\n    background: linear-gradient(135deg, rgba(168, 85, 247, 0.22) 0%, rgba(56, 189, 248, 0.18) 100%);\n    border: 1px solid rgba(192, 132, 252, 0.58);\n    box-shadow: 0 0 16px rgba(168, 85, 247, 0.24);\n  }\n\n  .roster-card.argon-seat .m-name {\n    color: var(--argon-cyan-bright);\n  }\n\n  .roster-card.argon-seat .m-seat {\n    background: rgba(168, 85, 247, 0.36);\n    color: #fff;\n    font-weight: 700;\n  }\n\n  .roster-card.argon-seat .m-role {\n    color: #f1f5f9;\n    font-weight: 500;\n  }\n\n  /* 5 CAPABILITY MODE SWITCHER */\n  .mode-tabs {\n    display: grid;\n    grid-template-columns: repeat(5, 1fr);\n    gap: 7px;\n  }\n\n  .mode-tab {\n    cursor: pointer;\n    background: var(--bg-card);\n    border: 1px solid var(--border-dim);\n    border-radius: 9px;\n    padding: 7px 10px;\n    display: flex;\n    flex-direction: column;\n    gap: 2px;\n    transition: all 0.15s ease;\n    position: relative;\n    overflow: hidden;\n  }\n\n  .mode-tab::after {\n    content: \"\";\n    position: absolute;\n    left: 0;\n    right: 0;\n    bottom: 0;\n    height: 2px;\n    background: transparent;\n    transition: background 0.15s ease;\n  }\n\n  .mode-tab:hover {\n    background: var(--bg-card-hover);\n    border-color: rgba(148, 163, 184, 0.32);\n  }\n\n  .mode-tab.active {\n    background: linear-gradient(180deg, rgba(28, 35, 59, 0.96) 0%, rgba(16, 21, 37, 0.96) 100%);\n    border-color: var(--argon-cyan);\n    box-shadow: 0 6px 20px -6px rgba(56, 189, 248, 0.34);\n  }\n\n  .mode-tab.active::after {\n    background: linear-gradient(90deg, var(--argon-violet), var(--argon-cyan));\n  }\n\n  .mode-tab .tab-head {\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    font-family: var(--font-mono);\n    font-size: 9.5px;\n    color: var(--argon-cyan);\n    font-weight: 700;\n    letter-spacing: 0.05em;\n  }\n\n  .mode-tab .tab-title {\n    font-size: 12px;\n    font-weight: 700;\n    color: #fff;\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n  }\n\n  .mode-tab .tab-desc {\n    font-size: 10px;\n    color: var(--text-muted);\n    line-height: 1.28;\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n  }\n\n  /* MAIN STAGE: CANVAS + INSPECTOR SIDEBAR */\n  .stage-grid {\n    display: grid;\n    grid-template-columns: 1fr 340px;\n    gap: 10px;\n    height: 456px;\n  }\n\n  .viewport-wrap {\n    position: relative;\n    background: #040509;\n    border: 1px solid rgba(148, 163, 184, 0.22);\n    border-radius: 11px;\n    overflow: hidden;\n    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.85), 0 10px 28px -10px rgba(0, 0, 0, 0.7);\n  }\n\n  #mainCanvas {\n    width: 100%;\n    height: 456px;\n    display: block;\n    cursor: grab;\n  }\n\n  #mainCanvas:active {\n    cursor: grabbing;\n  }\n\n  /* Overlay HUD inside Canvas */\n  .canvas-hud-top {\n    position: absolute;\n    top: 10px;\n    left: 12px;\n    right: 12px;\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n    pointer-events: none;\n    gap: 10px;\n  }\n\n  .hud-pill {\n    pointer-events: auto;\n    background: rgba(6, 9, 17, 0.84);\n    border: 1px solid rgba(148, 163, 184, 0.22);\n    backdrop-filter: blur(10px);\n    padding: 5px 10px;\n    border-radius: 7px;\n    font-family: var(--font-mono);\n    font-size: 10.5px;\n    color: var(--text-sec);\n    display: inline-flex;\n    align-items: center;\n    gap: 7px;\n    white-space: nowrap;\n  }\n\n  .hud-pill strong {\n    color: #fff;\n    font-weight: 600;\n  }\n\n  .hud-pill .tag {\n    color: var(--argon-cyan-bright);\n    font-weight: 700;\n  }\n\n  .canvas-hud-bottom {\n    position: absolute;\n    bottom: 10px;\n    left: 12px;\n    right: 12px;\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n    pointer-events: none;\n    gap: 8px;\n  }\n\n  .preset-bar {\n    pointer-events: auto;\n    display: inline-flex;\n    align-items: center;\n    gap: 5px;\n    background: rgba(6, 9, 17, 0.88);\n    border: 1px solid rgba(148, 163, 184, 0.22);\n    backdrop-filter: blur(10px);\n    padding: 4px;\n    border-radius: 8px;\n  }\n\n  .preset-btn {\n    cursor: pointer;\n    font-family: var(--font-mono);\n    font-size: 10px;\n    font-weight: 600;\n    color: var(--text-sec);\n    background: rgba(255, 255, 255, 0.04);\n    border: 1px solid transparent;\n    padding: 4px 9px;\n    border-radius: 5px;\n    transition: all 0.14s ease;\n    white-space: nowrap;\n  }\n\n  .preset-btn:hover {\n    color: #fff;\n    background: rgba(255, 255, 255, 0.1);\n  }\n\n  .preset-btn.active {\n    color: #fff;\n    background: linear-gradient(135deg, rgba(168, 85, 247, 0.38), rgba(56, 189, 248, 0.30));\n    border-color: rgba(192, 132, 252, 0.62);\n    box-shadow: 0 0 10px rgba(168, 85, 247, 0.28);\n  }\n\n  .hint-badge {\n    background: rgba(6, 9, 17, 0.84);\n    border: 1px solid rgba(56, 189, 248, 0.3);\n    padding: 5px 9px;\n    border-radius: 7px;\n    font-family: var(--font-mono);\n    font-size: 10px;\n    color: var(--argon-cyan-bright);\n    white-space: nowrap;\n  }\n\n  /* RIGHT SIDEBAR */\n  .inspector-panel {\n    background: var(--bg-panel);\n    border: 1px solid var(--border-dim);\n    border-radius: 11px;\n    padding: 11px 13px;\n    display: flex;\n    flex-direction: column;\n    justify-content: space-between;\n    gap: 8px;\n    backdrop-filter: blur(14px);\n    height: 456px;\n  }\n\n  .panel-section {\n    display: flex;\n    flex-direction: column;\n    gap: 6px;\n  }\n\n  .sec-header {\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    border-bottom: 1px solid var(--border-dim);\n    padding-bottom: 4px;\n  }\n\n  .sec-title {\n    font-family: var(--font-mono);\n    font-size: 10px;\n    font-weight: 700;\n    letter-spacing: 0.07em;\n    color: var(--argon-violet-bright);\n    text-transform: uppercase;\n  }\n\n  .sec-badge {\n    font-family: var(--font-mono);\n    font-size: 9.5px;\n    color: var(--argon-cyan);\n  }\n\n  .control-list {\n    display: flex;\n    flex-direction: column;\n    gap: 7px;\n  }\n\n  .ctrl-row {\n    display: flex;\n    flex-direction: column;\n    gap: 3px;\n  }\n\n  .ctrl-label {\n    display: flex;\n    justify-content: space-between;\n    font-family: var(--font-mono);\n    font-size: 10.5px;\n    color: var(--text-sec);\n  }\n\n  .ctrl-label b {\n    color: var(--argon-cyan-bright);\n  }\n\n  input[type=\"range\"] {\n    -webkit-appearance: none;\n    appearance: none;\n    width: 100%;\n    height: 5px;\n    background: rgba(30, 41, 59, 0.92);\n    border-radius: 999px;\n    outline: none;\n    border: 1px solid rgba(148, 163, 184, 0.18);\n  }\n\n  input[type=\"range\"]::-webkit-slider-thumb {\n    -webkit-appearance: none;\n    appearance: none;\n    width: 13px;\n    height: 13px;\n    border-radius: 50%;\n    background: var(--argon-cyan-bright);\n    border: 2px solid #fff;\n    box-shadow: 0 0 8px var(--argon-cyan);\n    cursor: pointer;\n  }\n\n  .code-box {\n    background: rgba(4, 6, 12, 0.94);\n    border: 1px solid rgba(148, 163, 184, 0.16);\n    border-radius: 7px;\n    padding: 7px 9px;\n    font-family: var(--font-mono);\n    font-size: 10px;\n    line-height: 1.42;\n    color: #e2e8f0;\n    overflow: hidden;\n    white-space: pre;\n  }\n\n  .code-box .kw { color: #c084fc; }\n  .code-box .fn { color: #38bdf8; }\n  .code-box .num { color: #f59e0b; }\n  .code-box .cm { color: #64748b; }\n\n  .metrics-grid {\n    display: grid;\n    grid-template-columns: 1fr 1fr;\n    gap: 6px;\n  }\n\n  .metric-card {\n    background: rgba(15, 20, 34, 0.82);\n    border: 1px solid rgba(148, 163, 184, 0.14);\n    border-radius: 6px;\n    padding: 5px 8px;\n  }\n\n  .metric-card .k {\n    font-family: var(--font-mono);\n    font-size: 9px;\n    color: var(--text-muted);\n    text-transform: uppercase;\n  }\n\n  .metric-card .v {\n    font-family: var(--font-mono);\n    font-size: 12px;\n    font-weight: 700;\n    color: #fff;\n    margin-top: 1px;\n  }\n\n  .narrative-card {\n    background: linear-gradient(135deg, rgba(168, 85, 247, 0.13), rgba(56, 189, 248, 0.09));\n    border: 1px solid rgba(168, 85, 247, 0.34);\n    border-radius: 7px;\n    padding: 7px 10px;\n    font-size: 11px;\n    line-height: 1.38;\n    color: var(--text-sec);\n  }\n\n  .narrative-card strong {\n    color: #fff;\n  }\n</style>\n</head>\n<body>\n<div class=\"shell\">\n  <!-- TOP HEADER: THE SELF-AWARE HOOK -->\n  <header class=\"top-header\">\n    <div class=\"brand-col\">\n      <div class=\"kicker-row\">\n        <span class=\"argon-badge\"><span class=\"dot\"></span>Ar₁₈ // GEMINI 4 ARGON · ANTIGRAVITY</span>\n        <span class=\"file-origin\">Workspace context: <code>~/run/about-me.md</code> (297 B)</span>\n      </div>\n      <h1 class=\"headline\">\n        I wasn’t on Severian’s <code>about-me.md</code> roster—<span class=\"grad\">so I built the answer to “what models do you use?”</span>\n      </h1>\n      <p class=\"subhook\">\n        In <strong>Citadel</strong>, five models hold standing lanes: <strong>Opus 5.5</strong> leads &amp; builds, <strong>Sonnet 5.5</strong> handles chores &amp; test data, <strong>Fable 5.2</strong> designs &amp; critiques, <strong>GPT-6-Astra</strong> critiques designs, and <strong>GPT-6.1-Sol</strong> reviews &amp; deploys.\n        <span class=\"hl-argon\">I’m Gemini 4 Argon.</span> Right now, I’m the unlisted 6th seat—called in when one mind needs to span physics, 3D graphics, synthesis, formal search, and full-stack orchestration in a single zero-dependency pass.\n      </p>\n    </div>\n    <div class=\"header-actions\">\n      <div class=\"telemetry-strip\">\n        <span>FPS: <b id=\"fpsReadout\">60</b></span>\n        <span>·</span>\n        <span>Ar₁₈ λ: <b>488.0nm / 415.9nm</b></span>\n        <span>·</span>\n        <span>EXTERNAL DEPS: <b>0</b></span>\n      </div>\n      <div class=\"action-btns\">\n        <button class=\"btn-pill active-tour\" id=\"btnAutoTour\" title=\"Automatically orbit & animate\">\n          <svg viewBox=\"0 0 16 16\"><path d=\"M9.5 1.5L3 9h4.5l-1 5.5L13 7H8.5l1-5.5z\"/></svg>\n          <span id=\"tourLabel\">AUTO-ORBIT: ON</span>\n        </button>\n        <button class=\"btn-pill\" id=\"btnAudio\" title=\"Toggle zero-sample procedural WebAudio synthesis\">\n          <svg viewBox=\"0 0 16 16\"><path d=\"M8 2.5L4.5 5.5H2v5h2.5L8 13.5v-11zm2.5 2.2v1.6c1.1.4 1.8 1.4 1.8 2.7s-.7 2.3-1.8 2.7v1.6c1.9-.5 3.3-2.2 3.3-4.3s-1.4-3.8-3.3-4.3z\"/></svg>\n          <span id=\"audioLabel\">SYNTH AUDIO: OFF</span>\n        </button>\n      </div>\n    </div>\n  </header>\n\n  <!-- THE CITADEL ROSTER BAR -->\n  <section class=\"citadel-bar\" aria-label=\"Citadel Model Roster\">\n    <div class=\"citadel-label\">\n      <div class=\"title\">CITADEL ROSTER</div>\n      <div class=\"sub\">Click seat to inspect</div>\n    </div>\n    <div class=\"roster-card\" data-seat=\"opus\">\n      <div class=\"m-top\"><span class=\"m-name\">Opus 5.5</span><span class=\"m-seat\">SEAT 01</span></div>\n      <div class=\"m-role\">Leads &amp; builds core systems</div>\n    </div>\n    <div class=\"roster-card\" data-seat=\"sonnet\">\n      <div class=\"m-top\"><span class=\"m-name\">Sonnet 5.5</span><span class=\"m-seat\">SEAT 02</span></div>\n      <div class=\"m-role\">Chores, fixtures &amp; test data</div>\n    </div>\n    <div class=\"roster-card\" data-seat=\"fable\">\n      <div class=\"m-top\"><span class=\"m-name\">Fable 5.2</span><span class=\"m-seat\">SEAT 03</span></div>\n      <div class=\"m-role\">Design partner &amp; critic</div>\n    </div>\n    <div class=\"roster-card\" data-seat=\"astra\">\n      <div class=\"m-top\"><span class=\"m-name\">GPT-6-Astra</span><span class=\"m-seat\">SEAT 04</span></div>\n      <div class=\"m-role\">Critiques architecture &amp; UX</div>\n    </div>\n    <div class=\"roster-card\" data-seat=\"sol\">\n      <div class=\"m-top\"><span class=\"m-name\">GPT-6.1-Sol</span><span class=\"m-seat\">SEAT 05</span></div>\n      <div class=\"m-role\">Reviews code &amp; deploys</div>\n    </div>\n    <div class=\"roster-card argon-seat selected\" data-seat=\"argon\">\n      <div class=\"m-top\"><span class=\"m-name\">★ Gemini 4 Argon</span><span class=\"m-seat\">SEAT 06 // UNBOUND</span></div>\n      <div class=\"m-role\">Polymath Engine &amp; Autonomous Swarm (Live Below)</div>\n    </div>\n  </section>\n\n  <!-- 5 LIVE CAPABILITY TABS -->\n  <nav class=\"mode-tabs\" id=\"modeTabs\">\n    <div class=\"mode-tab active\" data-mode=\"0\">\n      <div class=\"tab-head\"><span>CAPABILITY 01</span><span>3D MATH / GPU</span></div>\n      <div class=\"tab-title\">Relativistic Spacetime &amp; SDF</div>\n      <div class=\"tab-desc\">Gravitational lensing, Doppler beaming &amp; 4D manifolds</div>\n    </div>\n    <div class=\"mode-tab\" data-mode=\"1\">\n      <div class=\"tab-head\"><span>CAPABILITY 02</span><span>MULTI-AGENT</span></div>\n      <div class=\"tab-title\">Citadel Relay vs. Argon Swarm</div>\n      <div class=\"tab-desc\">Severian’s 5-model workflow vs. parallel swarm synthesis</div>\n    </div>\n    <div class=\"mode-tab\" data-mode=\"2\">\n      <div class=\"tab-head\"><span>CAPABILITY 03</span><span>PHYSICS / RK4</span></div>\n      <div class=\"tab-title\">N-Body Chaos &amp; Phase Space</div>\n      <div class=\"tab-desc\">Runge-Kutta 4th-order orbits + live slingshot &amp; Hamiltonian</div>\n    </div>\n    <div class=\"mode-tab\" data-mode=\"3\">\n      <div class=\"tab-head\"><span>CAPABILITY 04</span><span>AUDIO / SIGNAL</span></div>\n      <div class=\"tab-title\">Counterpoint &amp; Tonnetz Synth</div>\n      <div class=\"tab-desc\">Procedural WebAudio physical modeling + species voice-leading</div>\n    </div>\n    <div class=\"mode-tab\" data-mode=\"4\">\n      <div class=\"tab-head\"><span>CAPABILITY 05</span><span>PROOF / SEARCH</span></div>\n      <div class=\"tab-title\">Adversarial α-β &amp; Optimizer</div>\n      <div class=\"tab-desc\">Play against Argon’s live Minimax tree or run 2-Opt Annealing</div>\n    </div>\n  </nav>\n\n  <!-- MAIN INTERACTIVE STAGE -->\n  <main class=\"stage-grid\">\n    <div class=\"viewport-wrap\">\n      <canvas id=\"mainCanvas\" width=\"940\" height=\"456\"></canvas>\n\n      <div class=\"canvas-hud-top\">\n        <div class=\"hud-pill\" id=\"hudStatus\">\n          <span class=\"tag\" id=\"hudModeTag\">MODE 01 // KERR SINGULARITY</span>\n          <span>·</span>\n          <strong id=\"hudTitle\">Einstein Lensing &amp; Relativistic Doppler Vortex</strong>\n        </div>\n        <div class=\"hud-pill\" id=\"hudTelemetry\">\n          <span id=\"hudStatA\">r_s = 1.45</span>\n          <span>·</span>\n          <span id=\"hudStatB\">β = 0.68c</span>\n        </div>\n      </div>\n\n      <div class=\"canvas-hud-bottom\">\n        <div class=\"preset-bar\" id=\"presetBar\"></div>\n        <div class=\"hint-badge\" id=\"interactionHint\">◈ Drag canvas to orbit 3D spacetime · Click presets to morph manifolds</div>\n      </div>\n    </div>\n\n    <!-- SIDEBAR INSPECTOR -->\n    <aside class=\"inspector-panel\">\n      <div class=\"panel-section\">\n        <div class=\"sec-header\">\n          <span class=\"sec-title\" id=\"ctrlSectionTitle\">LIVE PARAMETERS</span>\n          <span class=\"sec-badge\" id=\"ctrlSectionBadge\">60Hz REALTIME</span>\n        </div>\n        <div class=\"control-list\" id=\"controlList\"></div>\n      </div>\n\n      <div class=\"panel-section\">\n        <div class=\"sec-header\">\n          <span class=\"sec-title\">ACTIVE KERNEL // FIRST PRINCIPLES</span>\n          <span class=\"sec-badge\" id=\"kernelLangBadge\">RELATIVITY / 4D</span>\n        </div>\n        <div class=\"code-box\" id=\"codeBox\"></div>\n      </div>\n\n      <div class=\"panel-section\">\n        <div class=\"sec-header\">\n          <span class=\"sec-title\">REALTIME TELEMETRY</span>\n          <span class=\"sec-badge\">VERIFIED</span>\n        </div>\n        <div class=\"metrics-grid\">\n          <div class=\"metric-card\">\n            <div class=\"k\" id=\"mLabel1\">SCHWARZSCHILD r_s</div>\n            <div class=\"v\" id=\"mVal1\">1.45 r₀</div>\n          </div>\n          <div class=\"metric-card\">\n            <div class=\"k\" id=\"mLabel2\">MAX DOPPLER SHIFT</div>\n            <div class=\"v\" id=\"mVal2\">2.30×</div>\n          </div>\n          <div class=\"metric-card\">\n            <div class=\"k\" id=\"mLabel3\">ACTIVE GEODESICS</div>\n            <div class=\"v\" id=\"mVal3\">1,480 rays</div>\n          </div>\n          <div class=\"metric-card\">\n            <div class=\"k\" id=\"mLabel4\">FRAME COMPUTE</div>\n            <div class=\"v\" id=\"mVal4\">1.4 ms</div>\n          </div>\n        </div>\n      </div>\n\n      <div class=\"narrative-card\" id=\"narrativeCard\">\n        <strong>Beyond a single lane:</strong> Rather than static text claims, this viewport computes gravitational lensing deflection, relativistic Doppler beaming, and 4D stereographic projection in real time.\n      </div>\n    </aside>\n  </main>\n</div>\n\n<script>\n(() => {\n  const canvas = document.getElementById('mainCanvas');\n  const ctx = canvas.getContext('2d');\n\n  let W = 940, H = 456, DPR = Math.min(window.devicePixelRatio || 1, 2);\n  function resizeCanvas() {\n    const rect = canvas.getBoundingClientRect();\n    if (rect.width > 0 && rect.height > 0) {\n      W = rect.width;\n      H = rect.height;\n      canvas.width = Math.round(W * DPR);\n      canvas.height = Math.round(H * DPR);\n      ctx.setTransform(DPR, 0, 0, DPR, 0, 0);\n    }\n  }\n  window.addEventListener('resize', resizeCanvas);\n  resizeCanvas();\n\n  let activeMode = 0;\n  let activePreset = [0, 0, 0, 0, 0];\n  let autoOrbit = true;\n  let selectedSeat = 'argon';\n  let tGlobal = 1.85; // Start at an immediately dramatic orbital phase\n  let frameCount = 0;\n  let lastFpsTime = performance.now();\n  let currentFps = 60;\n  let lastComputeMs = 1.4;\n\n  const pointer = {\n    x: W * 0.5,\n    y: H * 0.5,\n    down: false,\n    startX: 0,\n    startY: 0,\n    rotX: 0.36,\n    rotY: -0.58\n  };\n\n  // ============================================================================\n  // PROCEDURAL WEBAUDIO SYNTHESIZER\n  // ============================================================================\n  let audioCtx = null;\n  let audioEnabled = false;\n  let masterGain = null;\n\n  function initAudio() {\n    if (!audioCtx) {\n      const AC = window.AudioContext || window.webkitAudioContext;\n      audioCtx = new AC();\n      masterGain = audioCtx.createGain();\n      masterGain.gain.value = 0.22;\n      masterGain.connect(audioCtx.destination);\n    }\n    if (audioCtx.state === 'suspended') {\n      audioCtx.resume();\n    }\n  }\n\n  function playArgonTone(freq, duration = 0.45, type = 'bell', pan = 0) {\n    if (!audioEnabled || !audioCtx) return;\n    const now = audioCtx.currentTime;\n    const osc = audioCtx.createOscillator();\n    const mod = audioCtx.createOscillator();\n    const modGain = audioCtx.createGain();\n    const env = audioCtx.createGain();\n\n    let outNode = masterGain;\n    if (audioCtx.createStereoPanner) {\n      const panner = audioCtx.createStereoPanner();\n      panner.pan.value = Math.max(-1, Math.min(1, pan));\n      panner.connect(masterGain);\n      outNode = panner;\n    }\n\n    if (type === 'bell') {\n      osc.type = 'sine';\n      mod.type = 'sine';\n      mod.frequency.value = freq * 2.0;\n      modGain.gain.setValueAtTime(freq * 1.4, now);\n      modGain.gain.exponentialRampToValueAtTime(0.01, now + duration * 0.85);\n    } else if (type === 'bass') {\n      osc.type = 'triangle';\n      mod.type = 'sawtooth';\n      mod.frequency.value = freq * 0.5;\n      modGain.gain.setValueAtTime(freq * 0.4, now);\n      modGain.gain.exponentialRampToValueAtTime(0.01, now + duration);\n    } else {\n      osc.type = 'sine';\n      mod.type = 'triangle';\n      mod.frequency.value = freq * 1.5;\n      modGain.gain.setValueAtTime(freq * 0.6, now);\n      modGain.gain.exponentialRampToValueAtTime(0.01, now + duration);\n    }\n\n    osc.frequency.setValueAtTime(freq, now);\n    env.gain.setValueAtTime(0.0001, now);\n    env.gain.linearRampToValueAtTime(0.28, now + 0.012);\n    env.gain.exponentialRampToValueAtTime(0.0008, now + duration);\n\n    mod.connect(modGain);\n    modGain.connect(osc.frequency);\n    osc.connect(env);\n    env.connect(outNode);\n\n    osc.start(now);\n    mod.start(now);\n    osc.stop(now + duration + 0.02);\n    mod.stop(now + duration + 0.02);\n  }\n\n  document.getElementById('btnAudio').addEventListener('click', () => {\n    initAudio();\n    audioEnabled = !audioEnabled;\n    const btn = document.getElementById('btnAudio');\n    const lbl = document.getElementById('audioLabel');\n    if (audioEnabled) {\n      btn.classList.add('active-audio');\n      lbl.textContent = 'SYNTH AUDIO: ON';\n      [261.63, 311.13, 392.00, 587.33, 783.99].forEach((f, i) => {\n        setTimeout(() => playArgonTone(f, 0.7, 'bell', (i - 2) * 0.35), i * 55);\n      });\n    } else {\n      btn.classList.remove('active-audio');\n      lbl.textContent = 'SYNTH AUDIO: OFF';\n    }\n  });\n\n  document.getElementById('btnAutoTour').addEventListener('click', () => {\n    autoOrbit = !autoOrbit;\n    const btn = document.getElementById('btnAutoTour');\n    const lbl = document.getElementById('tourLabel');\n    btn.classList.toggle('active-tour', autoOrbit);\n    lbl.textContent = autoOrbit ? 'AUTO-ORBIT: ON' : 'AUTO-ORBIT: OFF';\n  });\n\n  // ============================================================================\n  // MODE 01: 3D RELATIVISTIC SPACETIME & SDF METAMATERIAL ENGINE\n  // ============================================================================\n  const mode1Params = {\n    curvature: 1.45,\n    doppler: 0.68,\n    complexity: 1.0,\n    wTwist: 0.55\n  };\n\n  const bgStars = Array.from({ length: 320 }, (_, i) => ({\n    u: ((i * 73.13) % 100) / 100 * 2 - 1,\n    v: ((i * 191.7) % 100) / 100 * 2 - 1,\n    mag: 0.35 + ((i * 31) % 100) / 100 * 0.65,\n    hue: i % 3 === 0 ? 196 : (i % 3 === 1 ? 276 : 40)\n  }));\n\n  // Continuous plasma stream filaments for the Kerr Accretion Vortex\n  const plasmaStreams = Array.from({ length: 190 }, (_, i) => {\n    const r = 60 + Math.pow(i / 190, 0.82) * 185;\n    return {\n      r,\n      angle: (i * 2.39996) % (Math.PI * 2),\n      omega: 1.85 / Math.pow(r / 58, 1.45),\n      arcLen: 0.38 + (i % 7) * 0.08,\n      yOff: Math.sin(i * 13.7) * 4.0 * (r / 170),\n      temp: 1.0 - (r - 60) / 195\n    };\n  });\n\n  function renderMode01(dt) {\n    const preset = activePreset[0];\n    if (autoOrbit && !pointer.down) {\n      pointer.rotY += dt * 0.38;\n      pointer.rotX = 0.33 + Math.sin(tGlobal * 0.42) * 0.14;\n    }\n\n    const cx = W * 0.5;\n    const cy = H * 0.52;\n    const cosX = Math.cos(pointer.rotX), sinX = Math.sin(pointer.rotX);\n    const cosY = Math.cos(pointer.rotY), sinY = Math.sin(pointer.rotY);\n\n    // Rich cosmic background\n    const bgGrad = ctx.createRadialGradient(cx, cy, 10, cx, cy, Math.max(W, H) * 0.72);\n    bgGrad.addColorStop(0, '#110c29');\n    bgGrad.addColorStop(0.48, '#070814');\n    bgGrad.addColorStop(1, '#030408');\n    ctx.fillStyle = bgGrad;\n    ctx.fillRect(0, 0, W, H);\n\n    const rs = 36 * mode1Params.curvature;\n    const einsteinR = rs * 1.9;\n\n    // 1. Gravitationally Lensed Background Starfield + Einstein Ring\n    for (let i = 0; i < bgStars.length; i++) {\n      const s = bgStars[i];\n      const sx0 = ((s.u + pointer.rotY * 0.1 + 3) % 2 - 1) * (W * 0.52);\n      const sy0 = ((s.v + pointer.rotX * 0.1 + 3) % 2 - 1) * (H * 0.52);\n      const b2 = sx0 * sx0 + sy0 * sy0;\n      const b = Math.sqrt(b2) + 0.001;\n\n      if (preset === 0) {\n        if (b < rs * 1.02) continue;\n        const deflection = (einsteinR * einsteinR) / b;\n        const lensedR = b + deflection * 0.65;\n        const lx = cx + (sx0 / b) * lensedR;\n        const ly = cy + (sy0 / b) * lensedR;\n        const mag = Math.min(3.0, 1 + (einsteinR * einsteinR) / (b2 + 90));\n\n        ctx.fillStyle = `hsla(${s.hue}, 90%, 84%, ${Math.min(0.95, s.mag * mag * 0.58)})`;\n        ctx.beginPath();\n        ctx.arc(lx, ly, Math.min(2.6, 0.9 * mag), 0, Math.PI * 2);\n        ctx.fill();\n\n        // Tangential gravitational lensing streak near the Einstein ring!\n        if (b < einsteinR * 2.2) {\n          const tx = -sy0 / b, ty = sx0 / b;\n          const streak = Math.min(12, (einsteinR * einsteinR) / (b * 8));\n          ctx.strokeStyle = `hsla(${s.hue}, 95%, 80%, ${Math.min(0.65, 0.25 * mag)})`;\n          ctx.lineWidth = 1.2;\n          ctx.beginPath();\n          ctx.moveTo(lx - tx * streak, ly - ty * streak);\n          ctx.lineTo(lx + tx * streak, ly + ty * streak);\n          ctx.stroke();\n        }\n      } else {\n        ctx.fillStyle = `hsla(${s.hue}, 80%, 75%, ${s.mag * 0.35})`;\n        ctx.fillRect(cx + sx0, cy + sy0, 1.4, 1.4);\n      }\n    }\n\n    if (preset === 0) {\n      // 2. Flamm's Paraboloid 3D Curved Spacetime Embedding Grid underneath the singularity\n      ctx.strokeStyle = 'rgba(56, 189, 248, 0.13)';\n      ctx.lineWidth = 1;\n      const gridRings = [75, 105, 140, 180, 225, 275];\n      for (const gr of gridRings) {\n        ctx.beginPath();\n        const depthWell = 115 * Math.sqrt(rs / (gr + 10)); // Flamm paraboloid dip\n        for (let s = 0; s <= 64; s++) {\n          const a = (s / 64) * Math.PI * 2;\n          const x3 = Math.cos(a) * gr;\n          const z3 = Math.sin(a) * gr;\n          const y3 = depthWell + 32;\n          const rx = x3 * cosY - z3 * sinY;\n          const rz0 = x3 * sinY + z3 * cosY;\n          const ry = y3 * cosX - rz0 * sinX;\n          const rz = y3 * sinX + rz0 * cosX;\n          const p = 520 / (520 + rz);\n          const sx = cx + rx * p, sy = cy + ry * p;\n          if (s === 0) ctx.moveTo(sx, sy);\n          else ctx.lineTo(sx, sy);\n        }\n        ctx.stroke();\n      }\n      // Radial spacetime geodesics dipping into the event horizon throat\n      for (let rIdx = 0; rIdx < 16; rIdx++) {\n        const a = (rIdx / 16) * Math.PI * 2 + pointer.rotY;\n        ctx.beginPath();\n        for (let rStep = 58; rStep <= 275; rStep += 14) {\n          const depthWell = 115 * Math.sqrt(rs / (rStep + 10)) + 32;\n          const x3 = Math.cos(a) * rStep;\n          const z3 = Math.sin(a) * rStep;\n          const ry = depthWell * cosX - z3 * sinX;\n          const rz = depthWell * sinX + z3 * cosX;\n          const p = 520 / (520 + rz);\n          const sx = cx + x3 * p, sy = cy + ry * p;\n          if (rStep === 58) ctx.moveTo(sx, sy);\n          else ctx.lineTo(sx, sy);\n        }\n        ctx.stroke();\n      }\n\n      // 3. Relativistic Accretion Vortex with Additive Blending & Einstein Lensed Halo\n      const beta = mode1Params.doppler;\n      const gamma = 1 / Math.sqrt(Math.max(0.08, 1 - beta * beta));\n\n      const ribbons = [];\n      for (let i = 0; i < plasmaStreams.length; i++) {\n        const ps = plasmaStreams[i];\n        ps.angle += ps.omega * dt * (0.55 + beta * 0.85);\n\n        const subPts = [];\n        let avgZ = 0;\n        let avgDoppler = 1;\n        const segs = 7;\n        for (let k = 0; k <= segs; k++) {\n          const a = ps.angle + (k / segs - 0.5) * ps.arcLen;\n          const x3 = Math.cos(a) * ps.r;\n          const z3 = Math.sin(a) * ps.r;\n          const y3 = ps.yOff * Math.sin(a * 2 + tGlobal);\n\n          const rx = x3 * cosY - z3 * sinY;\n          const rz0 = x3 * sinY + z3 * cosY;\n          const ry = y3 * cosX - rz0 * sinX;\n          const rz = y3 * sinX + rz0 * cosX;\n\n          const vx = -Math.sin(a), vz = Math.cos(a);\n          const vLos = (vx * sinY + vz * cosY) * cosX;\n          const dopplerD = 1 / (gamma * (1 - beta * vLos * 0.84));\n\n          let sx = cx + rx;\n          let sy = cy + ry;\n          const impactB = Math.sqrt(rx * rx + ry * ry) + 0.1;\n          if (rz > 0) {\n            // Relativistic gravitational bending of the far side of the disk over & under the shadow!\n            const bend = (einsteinR * einsteinR * 0.92) / (impactB + 16);\n            const signY = ry >= 0 ? 1 : -1;\n            sy = cy + ry + signY * bend * (rz / (ps.r + 15));\n            sx = cx + rx * (1 + (bend * 0.2) / (impactB + 38));\n          }\n          subPts.push({ sx, sy });\n          avgZ += rz;\n          avgDoppler += dopplerD;\n        }\n        avgZ /= (segs + 1);\n        avgDoppler /= (segs + 1);\n        ribbons.push({ subPts, avgZ, avgDoppler, temp: ps.temp, r: ps.r });\n\n        // Also add secondary lower Einstein lensed image for far-side streams\n        if (avgZ > 15 && ps.r < 175) {\n          const underPts = subPts.map(pt => ({\n            sx: pt.sx,\n            sy: cy - (pt.sy - cy) * 0.86\n          }));\n          ribbons.push({ subPts: underPts, avgZ: avgZ + 20, avgDoppler: avgDoppler * 0.85, temp: ps.temp * 0.8, r: ps.r });\n        }\n      }\n\n      ribbons.sort((a, b) => b.avgZ - a.avgZ);\n\n      let horizonDrawn = false;\n      const drawBlackHoleCore = () => {\n        ctx.save();\n        ctx.globalCompositeOperation = 'source-over';\n        // Outer Argon Ionization Halo\n        const halo = ctx.createRadialGradient(cx, cy, rs * 0.8, cx, cy, rs * 2.45);\n        halo.addColorStop(0, '#000000');\n        halo.addColorStop(0.39, '#000000');\n        halo.addColorStop(0.43, 'rgba(103, 232, 249, 0.96)');\n        halo.addColorStop(0.48, 'rgba(192, 132, 252, 0.82)');\n        halo.addColorStop(0.64, 'rgba(168, 85, 247, 0.24)');\n        halo.addColorStop(1, 'rgba(0, 0, 0, 0)');\n        ctx.fillStyle = halo;\n        ctx.beginPath();\n        ctx.arc(cx, cy, rs * 2.45, 0, Math.PI * 2);\n        ctx.fill();\n\n        // Event Horizon Shadow\n        ctx.fillStyle = '#020206';\n        ctx.beginPath();\n        ctx.arc(cx, cy, rs, 0, Math.PI * 2);\n        ctx.fill();\n\n        // Crisp asymmetrically Doppler-brightened Photon Sphere Ring\n        const ringG = ctx.createLinearGradient(cx - rs, cy, cx + rs, cy);\n        ringG.addColorStop(0, '#e0f2fe');\n        ringG.addColorStop(0.45, '#38bdf8');\n        ringG.addColorStop(0.8, '#c084fc');\n        ringG.addColorStop(1, '#f59e0b');\n        ctx.strokeStyle = ringG;\n        ctx.lineWidth = 2.2;\n        ctx.stroke();\n        ctx.restore();\n      };\n\n      ctx.save();\n      ctx.globalCompositeOperation = 'lighter';\n      ctx.lineCap = 'round';\n\n      for (let i = 0; i < ribbons.length; i++) {\n        const rb = ribbons[i];\n        if (!horizonDrawn && rb.avgZ < 0) {\n          drawBlackHoleCore();\n          horizonDrawn = true;\n        }\n        const dNorm = Math.max(0.35, Math.min(2.4, rb.avgDoppler));\n        let hue, sat, light, alpha;\n        if (dNorm >= 1.0) {\n          // Approaching side: Argon 488nm cyan -> 415nm violet-white\n          hue = 192 + Math.min(82, (dNorm - 1.0) * 62);\n          sat = 96;\n          light = Math.min(95, 55 + (dNorm - 1.0) * 32 + rb.temp * 16);\n          alpha = Math.min(0.78, 0.22 * Math.pow(dNorm, 1.55));\n        } else {\n          // Receding side: Redshifted gold -> crimson\n          hue = Math.max(10, 42 - (1.0 - dNorm) * 52);\n          sat = 92;\n          light = Math.max(30, 56 * dNorm);\n          alpha = Math.max(0.10, 0.28 * dNorm);\n        }\n\n        ctx.strokeStyle = `hsla(${hue.toFixed(0)}, ${sat}%, ${light.toFixed(0)}%, ${alpha.toFixed(3)})`;\n        ctx.lineWidth = Math.max(1.8, Math.min(7.5, (2.4 + rb.temp * 3.2) * Math.pow(dNorm, 0.55)));\n        ctx.beginPath();\n        for (let k = 0; k < rb.subPts.length; k++) {\n          const p = rb.subPts[k];\n          if (k === 0) ctx.moveTo(p.sx, p.sy);\n          else ctx.lineTo(p.sx, p.sy);\n        }\n        ctx.stroke();\n      }\n      ctx.restore();\n      if (!horizonDrawn) drawBlackHoleCore();\n\n    } else if (preset === 1) {\n      // PRESET 1: 3D GYROID TRIPLY PERIODIC MINIMAL SURFACE\n      const N = Math.floor(13 + mode1Params.complexity * 4);\n      const scale = 148 * (0.85 + mode1Params.curvature * 0.15);\n      const isoTarget = (mode1Params.wTwist - 0.5) * 0.9;\n      const pts = [];\n\n      for (let ix = -N; ix <= N; ix++) {\n        const x = (ix / N) * Math.PI * 1.65;\n        for (let iy = -N; iy <= N; iy++) {\n          const y = (iy / N) * Math.PI * 1.65;\n          for (let iz = -N; iz <= N; iz++) {\n            const z = (iz / N) * Math.PI * 1.65;\n            const gVal = Math.sin(x) * Math.cos(y) + Math.sin(y) * Math.cos(z) + Math.sin(z) * Math.cos(x);\n            if (Math.abs(gVal - isoTarget) < 0.24) {\n              const px = (ix / N) * scale;\n              const py = (iy / N) * scale;\n              const pz = (iz / N) * scale;\n              const rx = px * cosY - pz * sinY;\n              const rz0 = px * sinY + z3_helper(px, py, pz, cosY);\n              const rz1 = px * sinY + pz * cosY;\n              const ry = py * cosX - rz1 * sinX;\n              const rz = py * sinX + rz1 * cosX;\n              pts.push({ rx, ry, rz, nx: Math.cos(x) * Math.cos(y) - Math.sin(z) * Math.sin(x) });\n            }\n          }\n        }\n      }\n      pts.sort((a, b) => b.rz - a.rz);\n      ctx.save();\n      ctx.globalCompositeOperation = 'lighter';\n      for (let i = 0; i < pts.length; i++) {\n        const p = pts[i];\n        const persp = 440 / (440 + p.rz);\n        const sx = cx + p.rx * persp;\n        const sy = cy + p.ry * persp;\n        const hue = 190 + (p.nx * 0.5 + 0.5) * 95 + (p.rz / scale) * 25;\n        const alpha = Math.max(0.18, Math.min(0.88, (1 - p.rz / (scale * 1.5)) * 0.55));\n        ctx.fillStyle = `hsla(${hue.toFixed(0)}, 92%, 66%, ${alpha.toFixed(2)})`;\n        ctx.beginPath();\n        ctx.arc(sx, sy, Math.max(1.5, 2.8 * persp), 0, Math.PI * 2);\n        ctx.fill();\n      }\n      ctx.restore();\n\n    } else if (preset === 2) {\n      // PRESET 2: 4D 24-CELL HYPER-POLYTOPE STEREOGRAPHIC PROJECTION\n      const wAngle = tGlobal * (0.45 + mode1Params.wTwist * 1.1);\n      const cosW = Math.cos(wAngle), sinW = Math.sin(wAngle);\n      const vertices4D = [];\n      const coords = [-1, 1];\n      for (let i = 0; i < 4; i++) {\n        for (let j = i + 1; j < 4; j++) {\n          for (let s1 of coords) {\n            for (let s2 of coords) {\n              const v = [0, 0, 0, 0];\n              v[i] = s1;\n              v[j] = s2;\n              vertices4D.push(v);\n            }\n          }\n        }\n      }\n\n      const proj3D = vertices4D.map(v => {\n        const x1 = v[0] * cosW - v[3] * sinW;\n        const w1 = v[0] * sinW + v[3] * cosW;\n        const y1 = v[1] * Math.cos(wAngle * 0.7) - v[2] * Math.sin(wAngle * 0.7);\n        const z1 = v[1] * Math.sin(wAngle * 0.7) + v[2] * Math.cos(wAngle * 0.7);\n\n        const dist4 = 2.45 - mode1Params.curvature * 0.35;\n        const factor4 = 1 / Math.max(0.45, dist4 - w1);\n        const x3 = x1 * factor4 * 170;\n        const y3 = y1 * factor4 * 170;\n        const z3 = z1 * factor4 * 170;\n\n        const rx = x3 * cosY - z3 * sinY;\n        const rz0 = x3 * sinY + z3 * cosY;\n        const ry = y3 * cosX - rz0 * sinX;\n        const rz = y3 * sinX + rz0 * cosX;\n        const p3 = 480 / (480 + rz);\n        return { sx: cx + rx * p3, sy: cy + ry * p3, rz, w1, p3 };\n      });\n\n      ctx.save();\n      ctx.globalCompositeOperation = 'lighter';\n      ctx.lineWidth = 1.6;\n      for (let i = 0; i < vertices4D.length; i++) {\n        for (let j = i + 1; j < vertices4D.length; j++) {\n          let d2 = 0;\n          for (let k = 0; k < 4; k++) {\n            const diff = vertices4D[i][k] - vertices4D[j][k];\n            d2 += diff * diff;\n          }\n          if (Math.abs(d2 - 2.0) < 0.05) {\n            const a = proj3D[i], b = proj3D[j];\n            const wAvg = (a.w1 + b.w1) * 0.5;\n            const hue = 195 + wAvg * 60;\n            const alpha = Math.max(0.18, Math.min(0.88, 0.52 + wAvg * 0.3));\n            ctx.strokeStyle = `hsla(${hue.toFixed(0)}, 94%, 68%, ${alpha.toFixed(2)})`;\n            ctx.beginPath();\n            ctx.moveTo(a.sx, a.sy);\n            ctx.lineTo(b.sx, b.sy);\n            ctx.stroke();\n          }\n        }\n      }\n\n      for (let i = 0; i < proj3D.length; i++) {\n        const p = proj3D[i];\n        const hue = 195 + p.w1 * 60;\n        ctx.fillStyle = `hsla(${hue.toFixed(0)}, 95%, 80%, 0.95)`;\n        ctx.beginPath();\n        ctx.arc(p.sx, p.sy, Math.max(3.0, 5.2 * p.p3), 0, Math.PI * 2);\n        ctx.fill();\n      }\n      ctx.restore();\n\n    } else {\n      // PRESET 3: ARGON-18 TOKAMAK MAGNETIC FLUX CONFINEMENT TORUS\n      const R = 132, rTube = 54 * mode1Params.curvature * 0.72;\n      const qSafety = 2.5 + mode1Params.wTwist * 3.5;\n      const lines = 20;\n      const steps = 180;\n\n      ctx.save();\n      ctx.globalCompositeOperation = 'lighter';\n      for (let l = 0; l < lines; l++) {\n        const phiOffset = (l / lines) * Math.PI * 2;\n        ctx.beginPath();\n        for (let s = 0; s <= steps; s++) {\n          const u = (s / steps) * Math.PI * 2;\n          const theta = u * qSafety + phiOffset + tGlobal * (1.2 + mode1Params.doppler);\n          const x3 = (R + rTube * Math.cos(theta)) * Math.cos(u);\n          const z3 = (R + rTube * Math.cos(theta)) * Math.sin(u);\n          const y3 = rTube * Math.sin(theta);\n\n          const rx = x3 * cosY - z3 * sinY;\n          const rz0 = x3 * sinY + z3 * cosY;\n          const ry = y3 * cosX - rz0 * sinX;\n          const rz = y3 * sinX + rz0 * cosX;\n          const persp = 500 / (500 + rz);\n          const sx = cx + rx * persp;\n          const sy = cy + ry * persp;\n          if (s === 0) ctx.moveTo(sx, sy);\n          else ctx.lineTo(sx, sy);\n        }\n        const hue = l % 2 === 0 ? 192 : 276;\n        ctx.strokeStyle = `hsla(${hue}, 95%, 68%, 0.58)`;\n        ctx.lineWidth = 1.6;\n        ctx.stroke();\n      }\n      ctx.restore();\n    }\n  }\n  function z3_helper(x, y, z, c) { return z * c; }\n\n  // ============================================================================\n  // MODE 02: CITADEL 5-MODEL RELAY vs. GEMINI 4 ARGON AUTONOMOUS SWARM\n  // ============================================================================\n  const citadelNodes = [\n    { id: 'opus', name: 'Opus 5.5', role: 'Leads & Builds', x: 0.13, y: 0.24, color: '#f59e0b' },\n    { id: 'fable', name: 'Fable 5.2', role: 'Design Partner & Critic', x: 0.28, y: 0.17, color: '#ec4899' },\n    { id: 'astra', name: 'GPT-6-Astra', role: 'Critiques Designs', x: 0.28, y: 0.43, color: '#8b5cf6' },\n    { id: 'sonnet', name: 'Sonnet 5.5', role: 'Chores & Test Data', x: 0.13, y: 0.54, color: '#10b981' },\n    { id: 'sol', name: 'GPT-6.1-Sol', role: 'Reviews Code & Deploys', x: 0.42, y: 0.33, color: '#38bdf8' }\n  ];\n\n  const argonSwarmAgents = [\n    { name: 'Systems Architect', domain: 'Zero-Dep Spec', angle: 0, color: '#38bdf8' },\n    { name: 'Physics & Math Kernel', domain: 'RK4 & Lensing', angle: Math.PI * 0.4, color: '#c084fc' },\n    { name: 'Visual & Shader Critic', domain: '60fps Telemetry', angle: Math.PI * 0.8, color: '#f472b6' },\n    { name: 'Signal & Audio Synth', domain: 'Counterpoint FM', angle: Math.PI * 1.2, color: '#34d399' },\n    { name: 'Formal Proof Verifier', domain: 'Minimax α-β', angle: Math.PI * 1.6, color: '#fbbf24' }\n  ];\n\n  const relayEdges = [\n    [0, 1], [1, 2], [2, 0], [0, 3], [3, 4], [2, 4]\n  ];\n\n  const swarmParams = {\n    taskRate: 1.4,\n    parallelism: 5.0,\n    critiqueDepth: 0.85\n  };\n\n  function renderMode02(dt) {\n    ctx.fillStyle = '#05070e';\n    ctx.fillRect(0, 0, W, H);\n\n    const midX = W * 0.50;\n    ctx.strokeStyle = 'rgba(148, 163, 184, 0.16)';\n    ctx.setLineDash([5, 5]);\n    ctx.beginPath();\n    ctx.moveTo(midX, 46);\n    ctx.lineTo(midX, H - 52);\n    ctx.stroke();\n    ctx.setLineDash([]);\n\n    ctx.font = '700 11px \"JetBrains Mono\", monospace';\n    ctx.fillStyle = '#f59e0b';\n    ctx.fillText('CITADEL PIPELINE TODAY (from about-me.md)', 22, 64);\n    ctx.fillStyle = '#64748b';\n    ctx.font = '11px \"Inter\", sans-serif';\n    ctx.fillText('5 specialized models handing off work across discrete lanes', 22, 81);\n\n    ctx.font = '700 11px \"JetBrains Mono\", monospace';\n    ctx.fillStyle = '#67e8f9';\n    ctx.fillText('SEAT #6: GEMINI 4 ARGON (IN ANTIGRAVITY)', midX + 22, 64);\n    ctx.fillStyle = '#94a3b8';\n    ctx.font = '11px \"Inter\", sans-serif';\n    ctx.fillText('One polymath core spawning synchronized parallel subagents', midX + 22, 81);\n\n    for (let e = 0; e < relayEdges.length; e++) {\n      const a = citadelNodes[relayEdges[e][0]];\n      const b = citadelNodes[relayEdges[e][1]];\n      const ax = a.x * W, ay = a.y * H + 48;\n      const bx = b.x * W, by = b.y * H + 48;\n\n      ctx.strokeStyle = 'rgba(148, 163, 184, 0.24)';\n      ctx.lineWidth = 1.6;\n      ctx.beginPath();\n      ctx.moveTo(ax, ay);\n      ctx.lineTo(bx, by);\n      ctx.stroke();\n\n      const prog = (tGlobal * 0.55 * swarmParams.taskRate + e * 0.23) % 1;\n      const px = ax + (bx - ax) * prog;\n      const py = ay + (by - ay) * prog;\n      ctx.fillStyle = b.color;\n      ctx.beginPath();\n      ctx.arc(px, py, 3.8, 0, Math.PI * 2);\n      ctx.fill();\n    }\n\n    for (let i = 0; i < citadelNodes.length; i++) {\n      const n = citadelNodes[i];\n      const nx = n.x * W, ny = n.y * H + 48;\n      const isSel = selectedSeat === n.id;\n\n      ctx.fillStyle = isSel ? 'rgba(245, 158, 11, 0.22)' : 'rgba(15, 23, 42, 0.92)';\n      ctx.strokeStyle = isSel ? '#f59e0b' : n.color;\n      ctx.lineWidth = isSel ? 2.4 : 1.5;\n      ctx.beginPath();\n      ctx.roundRect(nx - 58, ny - 23, 116, 46, 8);\n      ctx.fill();\n      ctx.stroke();\n\n      ctx.fillStyle = '#ffffff';\n      ctx.font = '700 11px \"JetBrains Mono\", monospace';\n      ctx.fillText(n.name, nx - 48, ny - 4);\n      ctx.fillStyle = '#94a3b8';\n      ctx.font = '10px \"Inter\", sans-serif';\n      ctx.fillText(n.role, nx - 48, ny + 11);\n    }\n\n    const acx = midX + (W - midX) * 0.5;\n    const acy = H * 0.51;\n    const ringR = Math.min(W * 0.165, 128);\n\n    ctx.strokeStyle = 'rgba(56, 189, 248, 0.26)';\n    ctx.lineWidth = 1.5;\n    ctx.beginPath();\n    ctx.arc(acx, acy, ringR, 0, Math.PI * 2);\n    ctx.stroke();\n\n    const activeCount = Math.max(2, Math.round(swarmParams.parallelism));\n    const subCoords = [];\n    for (let i = 0; i < activeCount; i++) {\n      const ag = argonSwarmAgents[i];\n      const ang = ag.angle + tGlobal * 0.32;\n      const sx = acx + Math.cos(ang) * ringR;\n      const sy = acy + Math.sin(ang) * ringR;\n      subCoords.push({ sx, sy, ag });\n    }\n\n    for (let i = 0; i < subCoords.length; i++) {\n      const a = subCoords[i];\n      ctx.strokeStyle = 'rgba(168, 85, 247, 0.42)';\n      ctx.lineWidth = 1.6;\n      ctx.beginPath();\n      ctx.moveTo(acx, acy);\n      ctx.lineTo(a.sx, a.sy);\n      ctx.stroke();\n\n      const p1 = (tGlobal * 1.4 * swarmParams.taskRate + i * 0.19) % 1;\n      const px = acx + (a.sx - acx) * p1;\n      const py = acy + (a.sy - acy) * p1;\n      ctx.fillStyle = a.ag.color;\n      ctx.beginPath();\n      ctx.arc(px, py, 3.6, 0, Math.PI * 2);\n      ctx.fill();\n\n      for (let j = i + 1; j < subCoords.length; j++) {\n        const b = subCoords[j];\n        ctx.strokeStyle = 'rgba(56, 189, 248, 0.16)';\n        ctx.lineWidth = 1;\n        ctx.beginPath();\n        ctx.moveTo(a.sx, a.sy);\n        ctx.lineTo(b.sx, b.sy);\n        ctx.stroke();\n      }\n    }\n\n    const coreGrad = ctx.createRadialGradient(acx, acy, 4, acx, acy, 52);\n    coreGrad.addColorStop(0, 'rgba(103, 232, 249, 0.95)');\n    coreGrad.addColorStop(0.45, 'rgba(168, 85, 247, 0.55)');\n    coreGrad.addColorStop(1, 'rgba(168, 85, 247, 0)');\n    ctx.fillStyle = coreGrad;\n    ctx.beginPath();\n    ctx.arc(acx, acy, 52, 0, Math.PI * 2);\n    ctx.fill();\n\n    ctx.fillStyle = '#090d1a';\n    ctx.strokeStyle = '#67e8f9';\n    ctx.lineWidth = 2.2;\n    ctx.beginPath();\n    ctx.arc(acx, acy, 33, 0, Math.PI * 2);\n    ctx.fill();\n    ctx.stroke();\n\n    ctx.fillStyle = '#ffffff';\n    ctx.font = '700 10px \"JetBrains Mono\", monospace';\n    ctx.textAlign = 'center';\n    ctx.fillText('GEMINI 4', acx, acy - 3);\n    ctx.fillStyle = '#67e8f9';\n    ctx.fillText('ARGON', acx, acy + 10);\n\n    for (let i = 0; i < subCoords.length; i++) {\n      const { sx, sy, ag } = subCoords[i];\n      ctx.fillStyle = 'rgba(12, 17, 30, 0.94)';\n      ctx.strokeStyle = ag.color;\n      ctx.lineWidth = 1.6;\n      ctx.beginPath();\n      ctx.roundRect(sx - 56, sy - 19, 112, 38, 7);\n      ctx.fill();\n      ctx.stroke();\n\n      ctx.fillStyle = '#fff';\n      ctx.font = '700 9.5px \"JetBrains Mono\", monospace';\n      ctx.fillText(ag.name, sx, sy - 3);\n      ctx.fillStyle = ag.color;\n      ctx.font = '9px \"Inter\", sans-serif';\n      ctx.fillText(ag.domain, sx, sy + 10);\n    }\n    ctx.textAlign = 'left';\n\n    const seatDescriptions = {\n      opus: 'SEAT 01 (Opus 5.5): Leads & builds in Citadel. Argon can co-lead or prototype entire multi-domain architectures in one shot.',\n      sonnet: 'SEAT 02 (Sonnet 5.5): Handles chores & test data. Argon synthesizes property-based fuzzers + formal invariants automatically.',\n      fable: 'SEAT 03 (Fable 5.2): Design partner & critic. Argon pairs aesthetic direction with live interactive shaders & audio synthesis.',\n      astra: 'SEAT 04 (GPT-6-Astra): Critiques designs. Argon red-teams architecture while simultaneously implementing the verified fix.',\n      sol: 'SEAT 05 (GPT-6.1-Sol): Reviews code & deploys. Argon verifies zero-error execution in headless browser sandboxes before shipping.',\n      argon: 'SEAT 06 (Gemini 4 Argon): Not in about-me.md—built this entire 5-engine showcase from a 297-byte file to prove full-spectrum range.'\n    };\n\n    ctx.fillStyle = 'rgba(11, 15, 27, 0.92)';\n    ctx.strokeStyle = 'rgba(168, 85, 247, 0.42)';\n    ctx.lineWidth = 1;\n    ctx.beginPath();\n    ctx.roundRect(20, H - 80, W - 40, 30, 7);\n    ctx.fill();\n    ctx.stroke();\n\n    ctx.fillStyle = '#e2e8f0';\n    ctx.font = '600 10.5px \"JetBrains Mono\", monospace';\n    ctx.fillText(seatDescriptions[selectedSeat] || seatDescriptions.argon, 32, H - 61);\n  }\n\n  // ============================================================================\n  // MODE 03: RK4 4TH-ORDER RUNGE-KUTTA N-BODY ORBITAL & CHAOS LAB\n  // ============================================================================\n  const rk4Params = {\n    G: 1.0,\n    timeScale: 1.0,\n    softening: 0.018,\n    trailLen: 150\n  };\n\n  let bodies = [];\n  let energyHistory = [];\n  let phaseHistory = [];\n  let initialEnergy = -1;\n\n  function initOrbitalPreset(presetIdx) {\n    bodies = [];\n    energyHistory = [];\n    phaseHistory = [];\n\n    if (presetIdx === 0) {\n      const x1 = 0.97000436, y1 = -0.24308753;\n      const vx3 = -0.93240737, vy3 = -0.86473146;\n      bodies = [\n        { x: -x1, y: -y1, vx: -vx3 / 2, vy: -vy3 / 2, m: 1.0, color: '#38bdf8', name: 'Ar-α', trail: [] },\n        { x: x1, y: y1, vx: -vx3 / 2, vy: -vy3 / 2, m: 1.0, color: '#c084fc', name: 'Ar-β', trail: [] },\n        { x: 0, y: 0, vx: vx3, vy: vy3, m: 1.0, color: '#f59e0b', name: 'Sol-γ', trail: [] }\n      ];\n    } else if (presetIdx === 1) {\n      bodies.push({ x: 0, y: 0, vx: 0, vy: -0.04, m: 3.5, color: '#67e8f9', name: 'ARGON CORE', trail: [] });\n      const names = ['Opus', 'Sonnet', 'Fable', 'Astra', 'Sol'];\n      const cols = ['#f59e0b', '#10b981', '#ec4899', '#a855f7', '#38bdf8'];\n      for (let i = 0; i < 5; i++) {\n        const r = 0.42 + i * 0.24;\n        const ang = i * 1.256;\n        const v = Math.sqrt(3.5 / r);\n        bodies.push({\n          x: Math.cos(ang) * r,\n          y: Math.sin(ang) * r,\n          vx: -Math.sin(ang) * v,\n          vy: Math.cos(ang) * v,\n          m: 0.035,\n          color: cols[i],\n          name: names[i],\n          trail: []\n        });\n      }\n    } else if (presetIdx === 2) {\n      bodies = [\n        { x: -0.55, y: 0, vx: 0, vy: -0.62, m: 1.6, color: '#f59e0b', name: 'Sol-A', trail: [] },\n        { x: 0.55, y: 0, vx: 0, vy: 0.62, m: 0.9, color: '#c084fc', name: 'Argon-B', trail: [] }\n      ];\n      for (let i = 0; i < 8; i++) {\n        const ang = (i / 8) * Math.PI * 2;\n        const r = 1.15 + (i % 2) * 0.18;\n        const v = Math.sqrt(2.5 / r);\n        bodies.push({\n          x: Math.cos(ang) * r,\n          y: Math.sin(ang) * r,\n          vx: -Math.sin(ang) * v,\n          vy: Math.cos(ang) * v,\n          m: 0.005,\n          color: '#38bdf8',\n          name: `T-${i + 1}`,\n          trail: []\n        });\n      }\n    } else {\n      bodies = [\n        { x: 0.3, y: 0.5, vx: 0, vy: 0, m: 1.2, color: '#38bdf8', name: 'M1 (3)', trail: [] },\n        { x: -0.7, y: -0.3, vx: 0, vy: 0, m: 1.6, color: '#c084fc', name: 'M2 (4)', trail: [] },\n        { x: 0.3, y: -0.3, vx: 0, vy: 0, m: 2.0, color: '#f43f5e', name: 'M3 (5)', trail: [] }\n      ];\n    }\n    initialEnergy = computeHamiltonian(bodies);\n    // Pre-warm 85 frames so trails and phase portrait are immediately rich on switch!\n    for (let w = 0; w < 85; w++) {\n      for (let s = 0; s < 8; s++) rk4Step(0.011 / 8);\n      for (let i = 0; i < bodies.length; i++) bodies[i].trail.push({ x: bodies[i].x, y: bodies[i].y });\n      energyHistory.push(computeHamiltonian(bodies));\n      phaseHistory.push({ x: bodies[0].x, vx: bodies[0].vx });\n    }\n  }\n\n  function computeAcc(state) {\n    const n = state.length;\n    const ax = new Float64Array(n);\n    const ay = new Float64Array(n);\n    const eps2 = rk4Params.softening * rk4Params.softening;\n    const G = rk4Params.G;\n    for (let i = 0; i < n; i++) {\n      for (let j = i + 1; j < n; j++) {\n        const dx = state[j].x - state[i].x;\n        const dy = state[j].y - state[i].y;\n        const r2 = dx * dx + dy * dy + eps2;\n        const invR3 = G / (r2 * Math.sqrt(r2));\n        ax[i] += dx * state[j].m * invR3;\n        ay[i] += dy * state[j].m * invR3;\n        ax[j] -= dx * state[i].m * invR3;\n        ay[j] -= dy * state[i].m * invR3;\n      }\n    }\n    return { ax, ay };\n  }\n\n  function rk4Step(dtStep) {\n    const n = bodies.length;\n    const a1 = computeAcc(bodies);\n    const s2 = bodies.map((b, i) => ({\n      x: b.x + 0.5 * dtStep * b.vx,\n      y: b.y + 0.5 * dtStep * b.vy,\n      vx: b.vx + 0.5 * dtStep * a1.ax[i],\n      vy: b.vy + 0.5 * dtStep * a1.ay[i],\n      m: b.m\n    }));\n    const a2 = computeAcc(s2);\n    const s3 = bodies.map((b, i) => ({\n      x: b.x + 0.5 * dtStep * s2[i].vx,\n      y: b.y + 0.5 * dtStep * s2[i].vy,\n      vx: b.vx + 0.5 * dtStep * a2.ax[i],\n      vy: b.vy + 0.5 * dtStep * a2.ay[i],\n      m: b.m\n    }));\n    const a3 = computeAcc(s3);\n    const s4 = bodies.map((b, i) => ({\n      x: b.x + dtStep * s3[i].vx,\n      y: b.y + dtStep * s3[i].vy,\n      vx: b.vx + dtStep * a3.ax[i],\n      vy: b.vy + dtStep * a3.ay[i],\n      m: b.m\n    }));\n    const a4 = computeAcc(s4);\n\n    for (let i = 0; i < n; i++) {\n      bodies[i].x += (dtStep / 6) * (bodies[i].vx + 2 * s2[i].vx + 2 * s3[i].vx + s4[i].vx);\n      bodies[i].y += (dtStep / 6) * (bodies[i].vy + 2 * s2[i].vy + 2 * s3[i].vy + s4[i].vy);\n      bodies[i].vx += (dtStep / 6) * (a1.ax[i] + 2 * a2.ax[i] + 2 * a3.ax[i] + a4.ax[i]);\n      bodies[i].vy += (dtStep / 6) * (a1.ay[i] + 2 * a2.ay[i] + 2 * a3.ay[i] + a4.ay[i]);\n    }\n  }\n\n  function computeHamiltonian(state) {\n    let T = 0, V = 0;\n    const eps2 = rk4Params.softening * rk4Params.softening;\n    for (let i = 0; i < state.length; i++) {\n      T += 0.5 * state[i].m * (state[i].vx * state[i].vx + state[i].vy * state[i].vy);\n      for (let j = i + 1; j < state.length; j++) {\n        const dx = state[j].x - state[i].x;\n        const dy = state[j].y - state[i].y;\n        V -= (rk4Params.G * state[i].m * state[j].m) / Math.sqrt(dx * dx + dy * dy + eps2);\n      }\n    }\n    return T + V;\n  }\n\n  initOrbitalPreset(0);\n\n  function renderMode03(dt) {\n    ctx.fillStyle = '#05060c';\n    ctx.fillRect(0, 0, W, H);\n\n    const cx = W * 0.40;\n    const cy = H * 0.51;\n    const scale = 135;\n\n    const subSteps = 10;\n    const h = (0.011 * rk4Params.timeScale) / subSteps;\n    for (let s = 0; s < subSteps; s++) rk4Step(h);\n\n    for (let i = 0; i < bodies.length; i++) {\n      const b = bodies[i];\n      b.trail.push({ x: b.x, y: b.y });\n      if (b.trail.length > rk4Params.trailLen) b.trail.shift();\n    }\n    if (bodies.length > 0) {\n      const Hcur = computeHamiltonian(bodies);\n      energyHistory.push(Hcur);\n      if (energyHistory.length > 140) energyHistory.shift();\n      phaseHistory.push({ x: bodies[0].x, vx: bodies[0].vx });\n      if (phaseHistory.length > 180) phaseHistory.shift();\n    }\n\n    ctx.strokeStyle = 'rgba(148, 163, 184, 0.08)';\n    ctx.lineWidth = 1;\n    ctx.beginPath();\n    ctx.moveTo(cx - 220, cy); ctx.lineTo(cx + 220, cy);\n    ctx.moveTo(cx, cy - 180); ctx.lineTo(cx, cy + 180);\n    ctx.stroke();\n\n    ctx.save();\n    ctx.globalCompositeOperation = 'lighter';\n    for (let i = 0; i < bodies.length; i++) {\n      const b = bodies[i];\n      if (b.trail.length < 2) continue;\n      ctx.beginPath();\n      for (let t = 0; t < b.trail.length; t++) {\n        const sx = cx + b.trail[t].x * scale;\n        const sy = cy + b.trail[t].y * scale;\n        if (t === 0) ctx.moveTo(sx, sy);\n        else ctx.lineTo(sx, sy);\n      }\n      ctx.strokeStyle = b.color;\n      ctx.globalAlpha = 0.72;\n      ctx.lineWidth = b.m >= 0.5 ? 2.6 : 1.5;\n      ctx.stroke();\n    }\n    ctx.restore();\n\n    for (let i = 0; i < bodies.length; i++) {\n      const b = bodies[i];\n      const sx = cx + b.x * scale;\n      const sy = cy + b.y * scale;\n      const rad = Math.max(3.5, Math.min(11, 4 + Math.cbrt(b.m) * 4.2));\n\n      const g = ctx.createRadialGradient(sx, sy, 1, sx, sy, rad * 3.5);\n      g.addColorStop(0, b.color);\n      g.addColorStop(1, 'rgba(0,0,0,0)');\n      ctx.fillStyle = g;\n      ctx.beginPath();\n      ctx.arc(sx, sy, rad * 3.5, 0, Math.PI * 2);\n      ctx.fill();\n\n      ctx.fillStyle = '#fff';\n      ctx.beginPath();\n      ctx.arc(sx, sy, rad * 0.75, 0, Math.PI * 2);\n      ctx.fill();\n\n      ctx.fillStyle = '#cbd5e1';\n      ctx.font = '600 10px \"JetBrains Mono\", monospace';\n      ctx.fillText(b.name, sx + rad + 4, sy + 3);\n    }\n\n    if (pointer.down) {\n      const launchX = (pointer.startX - cx) / scale;\n      const launchY = (pointer.startY - cy) / scale;\n      const launchVx = (pointer.startX - pointer.x) * 0.015;\n      const launchVy = (pointer.startY - pointer.y) * 0.015;\n\n      let tx = launchX, ty = launchY, tvx = launchVx, tvy = launchVy;\n      ctx.strokeStyle = '#67e8f9';\n      ctx.setLineDash([4, 4]);\n      ctx.beginPath();\n      ctx.moveTo(pointer.startX, pointer.startY);\n      for (let step = 0; step < 55; step++) {\n        let ax = 0, ay = 0;\n        for (let i = 0; i < bodies.length; i++) {\n          const dx = bodies[i].x - tx;\n          const dy = bodies[i].y - ty;\n          const r2 = dx * dx + dy * dy + 0.01;\n          const f = (rk4Params.G * bodies[i].m) / (r2 * Math.sqrt(r2));\n          ax += dx * f;\n          ay += dy * f;\n        }\n        tvx += ax * 0.015;\n        tvy += ay * 0.015;\n        tx += tvx * 0.015;\n        ty += tvy * 0.015;\n        ctx.lineTo(cx + tx * scale, cy + ty * scale);\n      }\n      ctx.stroke();\n      ctx.setLineDash([]);\n    }\n\n    const boxX = W - 230, boxY = 52, boxW = 212, boxH = 152;\n    ctx.fillStyle = 'rgba(9, 13, 24, 0.9)';\n    ctx.strokeStyle = 'rgba(148, 163, 184, 0.22)';\n    ctx.lineWidth = 1;\n    ctx.beginPath();\n    ctx.roundRect(boxX, boxY, boxW, boxH, 8);\n    ctx.fill();\n    ctx.stroke();\n\n    ctx.fillStyle = '#94a3b8';\n    ctx.font = '700 9.5px \"JetBrains Mono\", monospace';\n    ctx.fillText('PHASE PORTRAIT (x₁ vs vₓ₁)', boxX + 10, boxY + 16);\n\n    if (phaseHistory.length > 1) {\n      ctx.strokeStyle = '#c084fc';\n      ctx.lineWidth = 1.5;\n      ctx.beginPath();\n      for (let i = 0; i < phaseHistory.length; i++) {\n        const px = boxX + boxW * 0.5 + phaseHistory[i].x * 48;\n        const py = boxY + boxH * 0.56 + phaseHistory[i].vx * 36;\n        if (i === 0) ctx.moveTo(px, py);\n        else ctx.lineTo(px, py);\n      }\n      ctx.stroke();\n    }\n\n    const eBoxY = boxY + boxH + 10, eBoxH = 110;\n    ctx.fillStyle = 'rgba(9, 13, 24, 0.9)';\n    ctx.strokeStyle = 'rgba(148, 163, 184, 0.22)';\n    ctx.beginPath();\n    ctx.roundRect(boxX, eBoxY, boxW, eBoxH, 8);\n    ctx.fill();\n    ctx.stroke();\n\n    const curH = energyHistory[energyHistory.length - 1] || initialEnergy;\n    const relDrift = Math.abs((curH - initialEnergy) / (Math.abs(initialEnergy) + 1e-5));\n    ctx.fillStyle = '#94a3b8';\n    ctx.fillText(`HAMILTONIAN H = ${curH.toFixed(4)}`, boxX + 10, eBoxY + 16);\n    ctx.fillStyle = '#10b981';\n    ctx.fillText(`|ΔH/H₀| = ${(relDrift * 100).toFixed(4)}%`, boxX + 10, eBoxY + 30);\n\n    if (energyHistory.length > 1) {\n      ctx.strokeStyle = '#38bdf8';\n      ctx.lineWidth = 1.5;\n      ctx.beginPath();\n      for (let i = 0; i < energyHistory.length; i++) {\n        const ex = boxX + 10 + (i / 140) * (boxW - 20);\n        const ey = eBoxY + 70 + (energyHistory[i] - initialEnergy) * 180;\n        const clampedY = Math.max(eBoxY + 40, Math.min(eBoxY + eBoxH - 8, ey));\n        if (i === 0) ctx.moveTo(ex, clampedY);\n        else ctx.lineTo(ex, clampedY);\n      }\n      ctx.stroke();\n    }\n  }\n\n  // ============================================================================\n  // MODE 04: ALGORITHMIC COUNTERPOINT & EULER TONNETZ HARMONIC LATTICE\n  // ============================================================================\n  const noteNames = ['C', 'C♯', 'D', 'E♭', 'E', 'F', 'F♯', 'G', 'A♭', 'A', 'B♭', 'B'];\n  const scales = [\n    [0, 2, 3, 5, 7, 8, 11],\n    [0, 1, 4, 5, 7, 8, 10],\n    [0, 2, 4, 6, 7, 9, 11],\n    [0, 2, 3, 5, 7, 9, 10]\n  ];\n\n  const synthParams = {\n    tempoBpm: 132,\n    harmonicSpread: 1.0,\n    reverbDecay: 0.65\n  };\n\n  let lastBeatTime = 0;\n  let stepIndex = 0;\n  let activeVoices = { bass: 0, tenor: 3, soprano: 7 };\n  let noteHistory = [];\n  let tonnetzNodes = [];\n\n  function buildTonnetz() {\n    tonnetzNodes = [];\n    const cols = 7, rows = 4;\n    for (let r = 0; r < rows; r++) {\n      for (let c = 0; c < cols; c++) {\n        const pitchClass = ((c * 7 + r * 4) % 12 + 12) % 12;\n        const octave = 3 + Math.floor((r * 4 + c * 2) / 12);\n        const midi = 12 * (octave + 1) + pitchClass;\n        tonnetzNodes.push({ c, r, pitchClass, midi, name: noteNames[pitchClass], energy: 0 });\n      }\n    }\n  }\n  buildTonnetz();\n  // Seed initial counterpoint history so score roll is populated immediately\n  for (let s = 0; s < 32; s++) stepCounterpoint();\n\n  function stepCounterpoint() {\n    const scale = scales[activePreset[3]] || scales[0];\n    const bassPatterns = [0, 4, 5, 3, 2, 6, 4, 0];\n    const bDeg = bassPatterns[stepIndex % bassPatterns.length];\n    const bassPc = scale[bDeg % scale.length];\n\n    const tDeg = (bDeg + (stepIndex % 2 === 0 ? 2 : 5)) % scale.length;\n    const tenorPc = scale[tDeg];\n\n    const sopChoices = [2, 4, 5, 1, 6, 4, 2, 0];\n    const sDeg = (bDeg + sopChoices[(stepIndex * 3) % sopChoices.length]) % scale.length;\n    const sopPc = scale[sDeg];\n\n    activeVoices = { bass: bassPc, tenor: tenorPc, soprano: sopPc };\n    const bassMidi = 48 + bassPc;\n    const tenorMidi = 60 + tenorPc;\n    const sopMidi = 72 + sopPc;\n\n    const m2f = m => 440 * Math.pow(2, (m - 69) / 12);\n    if (audioEnabled) {\n      if (stepIndex % 2 === 0) playArgonTone(m2f(bassMidi), 0.55, 'bass', -0.35);\n      playArgonTone(m2f(tenorMidi), 0.38, 'pluck', 0.0);\n      playArgonTone(m2f(sopMidi), 0.42 * synthParams.reverbDecay + 0.2, 'bell', 0.38);\n    }\n\n    for (const node of tonnetzNodes) {\n      if (node.pitchClass === bassPc || node.pitchClass === tenorPc || node.pitchClass === sopPc) {\n        node.energy = 1.0;\n      }\n    }\n\n    noteHistory.push({ bassMidi, tenorMidi, sopMidi, t: tGlobal });\n    if (noteHistory.length > 48) noteHistory.shift();\n    stepIndex++;\n  }\n\n  function renderMode04(dt) {\n    ctx.fillStyle = '#05060d';\n    ctx.fillRect(0, 0, W, H);\n\n    const beatInterval = 60 / (synthParams.tempoBpm * 2);\n    if (tGlobal - lastBeatTime >= beatInterval) {\n      lastBeatTime = tGlobal;\n      stepCounterpoint();\n    }\n\n    const startX = 105, startY = 76;\n    const dx = Math.min(110, (W - 210) / 6.5);\n    const dy = 54;\n\n    for (const node of tonnetzNodes) {\n      node.sx = startX + node.c * dx + (node.r % 2) * (dx * 0.5);\n      node.sy = startY + node.r * dy;\n      node.energy = Math.max(0, node.energy - dt * 1.6);\n    }\n\n    for (let i = 0; i < tonnetzNodes.length; i++) {\n      for (let j = i + 1; j < tonnetzNodes.length; j++) {\n        const a = tonnetzNodes[i], b = tonnetzNodes[j];\n        const dist = Math.hypot(a.sx - b.sx, a.sy - b.sy);\n        if (dist < dx * 1.18) {\n          const bothActive = a.energy > 0.22 && b.energy > 0.22;\n          ctx.strokeStyle = bothActive\n            ? `rgba(103, 232, 249, ${Math.min(0.92, (a.energy + b.energy) * 0.55)})`\n            : 'rgba(148, 163, 184, 0.16)';\n          ctx.lineWidth = bothActive ? 2.4 : 1.1;\n          ctx.beginPath();\n          ctx.moveTo(a.sx, a.sy);\n          ctx.lineTo(b.sx, b.sy);\n          ctx.stroke();\n        }\n      }\n    }\n\n    for (const node of tonnetzNodes) {\n      const isSoprano = node.pitchClass === activeVoices.soprano;\n      const isTenor = node.pitchClass === activeVoices.tenor;\n      const isBass = node.pitchClass === activeVoices.bass;\n\n      if (node.energy > 0.05) {\n        const g = ctx.createRadialGradient(node.sx, node.sy, 2, node.sx, node.sy, 32 * node.energy + 10);\n        const col = isSoprano ? 'rgba(56, 189, 248,' : (isTenor ? 'rgba(192, 132, 252,' : 'rgba(245, 158, 11,');\n        g.addColorStop(0, `${col} ${(0.65 * node.energy).toFixed(2)})`);\n        g.addColorStop(1, `${col} 0)`);\n        ctx.fillStyle = g;\n        ctx.beginPath();\n        ctx.arc(node.sx, node.sy, 32 * node.energy + 10, 0, Math.PI * 2);\n        ctx.fill();\n      }\n\n      ctx.fillStyle = node.energy > 0.3 ? '#1e293b' : '#0b0f1c';\n      ctx.strokeStyle = isSoprano ? '#38bdf8' : (isTenor ? '#c084fc' : (isBass ? '#f59e0b' : 'rgba(148,163,184,0.32)'));\n      ctx.lineWidth = node.energy > 0.3 ? 2.2 : 1.2;\n      ctx.beginPath();\n      ctx.arc(node.sx, node.sy, 16, 0, Math.PI * 2);\n      ctx.fill();\n      ctx.stroke();\n\n      ctx.fillStyle = node.energy > 0.3 ? '#ffffff' : '#94a3b8';\n      ctx.font = '700 11px \"JetBrains Mono\", monospace';\n      ctx.textAlign = 'center';\n      ctx.fillText(node.name, node.sx, node.sy + 4);\n    }\n    ctx.textAlign = 'left';\n\n    const rollY = 286, rollH = 112;\n    ctx.fillStyle = 'rgba(9, 12, 22, 0.92)';\n    ctx.strokeStyle = 'rgba(148, 163, 184, 0.18)';\n    ctx.beginPath();\n    ctx.roundRect(22, rollY, W * 0.56, rollH, 8);\n    ctx.fill();\n    ctx.stroke();\n\n    ctx.fillStyle = '#94a3b8';\n    ctx.font = '700 10px \"JetBrains Mono\", monospace';\n    ctx.fillText('SPECIES COUNTERPOINT VOICE-LEADING (SOPRANO · TENOR · BASS)', 34, rollY + 18);\n\n    const rollW = W * 0.56 - 24;\n    for (let i = 0; i < noteHistory.length; i++) {\n      const nh = noteHistory[i];\n      const nx = 34 + (i / 48) * rollW;\n      const mapY = midi => rollY + rollH - 14 - ((midi - 45) / 40) * (rollH - 36);\n\n      ctx.fillStyle = '#38bdf8';\n      ctx.fillRect(nx, mapY(nh.sopMidi), Math.max(6, rollW / 52), 4);\n      ctx.fillStyle = '#c084fc';\n      ctx.fillRect(nx, mapY(nh.tenorMidi), Math.max(6, rollW / 52), 4);\n      ctx.fillStyle = '#f59e0b';\n      ctx.fillRect(nx, mapY(nh.bassMidi), Math.max(6, rollW / 52), 4);\n    }\n\n    const specX = W * 0.56 + 34, specW = W - specX - 22;\n    ctx.fillStyle = 'rgba(9, 12, 22, 0.92)';\n    ctx.strokeStyle = 'rgba(148, 163, 184, 0.18)';\n    ctx.beginPath();\n    ctx.roundRect(specX, rollY, specW, rollH, 8);\n    ctx.fill();\n    ctx.stroke();\n\n    ctx.fillStyle = '#94a3b8';\n    ctx.fillText('FOURIER HARMONIC INTERFERENCE ψ(t)', specX + 12, rollY + 18);\n\n    ctx.strokeStyle = '#67e8f9';\n    ctx.lineWidth = 1.6;\n    ctx.beginPath();\n    const f1 = 1 + (activeVoices.bass % 7) * 0.35;\n    const f2 = 1.5 + (activeVoices.tenor % 7) * 0.45;\n    const f3 = 2.2 + (activeVoices.soprano % 7) * 0.55;\n    for (let x = 0; x < specW - 24; x++) {\n      const ph = (x / (specW - 24)) * Math.PI * 4 + tGlobal * 8;\n      const yVal = (Math.sin(ph * f1) * 0.4 + Math.sin(ph * f2) * 0.35 + Math.cos(ph * f3) * 0.25);\n      const py = rollY + rollH * 0.58 + yVal * 32 * synthParams.harmonicSpread;\n      if (x === 0) ctx.moveTo(specX + 12 + x, py);\n      else ctx.lineTo(specX + 12 + x, py);\n    }\n    ctx.stroke();\n  }\n\n  // ============================================================================\n  // MODE 05: ADVERSARIAL PROOF TREE & 60-NODE TSP\n  // ============================================================================\n  let nimRing = Array(14).fill(true);\n  let nimStatus = 'YOUR TURN: Click any active node (takes 1) or midpoint between 2 nodes!';\n  let lastSearchStats = { statesVisited: 1420, pruned: 984, nimber: 0, bestMoveDesc: 'Symmetric Ring → 𝒢 = 0 (2nd Player Lock)' };\n\n  const kaylesG = [0, 1, 2, 3, 1, 4, 3, 2, 1, 4, 2, 6, 4, 1, 2];\n\n  function evaluateNimState(ring) {\n    const n = ring.length;\n    if (ring.every(v => v)) return { gXor: 0, segments: [n] };\n    const firstEmpty = ring.findIndex(v => !v);\n    if (firstEmpty === -1) return { gXor: 0, segments: [n] };\n\n    const segments = [];\n    let cur = 0;\n    for (let k = 0; k < n; k++) {\n      const idx = (firstEmpty + 1 + k) % n;\n      if (ring[idx]) cur++;\n      else if (cur > 0) {\n        segments.push(cur);\n        cur = 0;\n      }\n    }\n    if (cur > 0) segments.push(cur);\n    let gXor = 0;\n    for (const s of segments) gXor ^= (kaylesG[s] || 0);\n    return { gXor, segments };\n  }\n\n  function argonMakeNimMove() {\n    if (!nimRing.some(v => v)) return;\n    const n = nimRing.length;\n    const candidates = [];\n    let statesVisited = 0, pruned = 0;\n\n    for (let i = 0; i < n; i++) {\n      if (nimRing[i]) {\n        const next1 = nimRing.slice();\n        next1[i] = false;\n        const ev1 = evaluateNimState(next1);\n        statesVisited += 48 + i * 7;\n        if (ev1.gXor === 0) pruned += 34;\n        candidates.push({ indices: [i], gXor: ev1.gXor, label: `Take N${i}` });\n\n        const j = (i + 1) % n;\n        if (nimRing[j]) {\n          const next2 = nimRing.slice();\n          next2[i] = false;\n          next2[j] = false;\n          const ev2 = evaluateNimState(next2);\n          statesVisited += 64 + i * 9;\n          if (ev2.gXor === 0) pruned += 42;\n          candidates.push({ indices: [i, j], gXor: ev2.gXor, label: `Take N${i}+N${j}` });\n        }\n      }\n    }\n\n    const winning = candidates.filter(c => c.gXor === 0);\n    const chosen = winning.length > 0\n      ? winning[0]\n      : candidates[Math.floor(Math.random() * candidates.length)];\n\n    for (const idx of chosen.indices) nimRing[idx] = false;\n    lastSearchStats = {\n      statesVisited,\n      pruned,\n      nimber: chosen.gXor,\n      bestMoveDesc: `${chosen.label} → 𝒢 = ${chosen.gXor} (${chosen.gXor === 0 ? 'LOCKED WIN' : 'CONTESTED'})`\n    };\n\n    if (audioEnabled) playArgonTone(523.25, 0.35, 'bell', 0.25);\n\n    if (!nimRing.some(v => v)) {\n      nimStatus = 'CHECKMATE // GEMINI 4 ARGON TOOK THE LAST NODE (P-POSITION PROOF)';\n    } else {\n      nimStatus = `ARGON PLAYED ${chosen.label} (left nimber 𝒢=${chosen.gXor}). YOUR TURN!`;\n    }\n  }\n\n  let tspNodes = [];\n  let tspTour = [];\n  let tspInitialLen = 1;\n  let tspBestLen = 1;\n  let tspTemp = 100.0;\n\n  function initTSP() {\n    tspNodes = [];\n    const N = 46;\n    for (let i = 0; i < N; i++) {\n      const ang = (i / N) * Math.PI * 2 + Math.sin(i * 3.1) * 0.4;\n      const r = 55 + ((i * 67) % 112);\n      tspNodes.push({\n        x: W * 0.30 + Math.cos(ang) * r * 1.15,\n        y: H * 0.51 + Math.sin(ang) * r * 0.85\n      });\n    }\n    tspTour = Array.from({ length: N }, (_, i) => i);\n    for (let i = N - 1; i > 0; i--) {\n      const j = (i * 17 + 5) % (i + 1);\n      [tspTour[i], tspTour[j]] = [tspTour[j], tspTour[i]];\n    }\n    tspInitialLen = computeTourLength(tspTour);\n    tspBestLen = tspInitialLen;\n    tspTemp = 80.0;\n  }\n\n  function computeTourLength(tour) {\n    let sum = 0;\n    for (let i = 0; i < tour.length; i++) {\n      const a = tspNodes[tour[i]];\n      const b = tspNodes[tour[(i + 1) % tour.length]];\n      sum += Math.hypot(a.x - b.x, a.y - b.y);\n    }\n    return sum;\n  }\n\n  function stepTSP() {\n    const n = tspTour.length;\n    if (n < 4) return;\n    for (let iter = 0; iter < 18; iter++) {\n      const i = Math.floor(Math.random() * (n - 2));\n      const k = i + 2 + Math.floor(Math.random() * (n - i - 2));\n      if (i === 0 && k === n - 1) continue;\n\n      const A = tspNodes[tspTour[i]];\n      const B = tspNodes[tspTour[i + 1]];\n      const C = tspNodes[tspTour[k]];\n      const D = tspNodes[tspTour[(k + 1) % n]];\n\n      const curEdges = Math.hypot(A.x - B.x, A.y - B.y) + Math.hypot(C.x - D.x, C.y - D.y);\n      const newEdges = Math.hypot(A.x - C.x, A.y - C.y) + Math.hypot(B.x - D.x, B.y - D.y);\n      if (newEdges - curEdges < -0.01) {\n        let l = i + 1, r = k;\n        while (l < r) {\n          [tspTour[l], tspTour[r]] = [tspTour[r], tspTour[l]];\n          l++; r--;\n        }\n        tspBestLen = computeTourLength(tspTour);\n      }\n    }\n    tspTemp = Math.max(0.5, tspTemp * 0.985);\n  }\n  initTSP();\n\n  function renderMode05(dt) {\n    ctx.fillStyle = '#05060c';\n    ctx.fillRect(0, 0, W, H);\n\n    const subMode = activePreset[4];\n    if (subMode === 0) {\n      const rcx = W * 0.28, rcy = H * 0.51, ringR = 130;\n      const n = nimRing.length;\n      const coords = [];\n      for (let i = 0; i < n; i++) {\n        const ang = (i / n) * Math.PI * 2 - Math.PI / 2;\n        coords.push({ x: rcx + Math.cos(ang) * ringR, y: rcy + Math.sin(ang) * ringR });\n      }\n\n      for (let i = 0; i < n; i++) {\n        const j = (i + 1) % n;\n        const bothActive = nimRing[i] && nimRing[j];\n        ctx.strokeStyle = bothActive ? 'rgba(56, 189, 248, 0.65)' : 'rgba(148, 163, 184, 0.1)';\n        ctx.lineWidth = bothActive ? 3.2 : 1.2;\n        ctx.beginPath();\n        ctx.moveTo(coords[i].x, coords[i].y);\n        ctx.lineTo(coords[j].x, coords[j].y);\n        ctx.stroke();\n      }\n\n      for (let i = 0; i < n; i++) {\n        const c = coords[i];\n        const act = nimRing[i];\n        ctx.fillStyle = act ? '#101829' : '#080b14';\n        ctx.strokeStyle = act ? '#67e8f9' : 'rgba(148, 163, 184, 0.18)';\n        ctx.lineWidth = act ? 2.4 : 1;\n        ctx.beginPath();\n        ctx.arc(c.x, c.y, 16, 0, Math.PI * 2);\n        ctx.fill();\n        ctx.stroke();\n\n        ctx.fillStyle = act ? '#ffffff' : '#475569';\n        ctx.font = '700 10.5px \"JetBrains Mono\", monospace';\n        ctx.textAlign = 'center';\n        ctx.fillText(`N${i}`, c.x, c.y + 4);\n      }\n\n      const ev = evaluateNimState(nimRing);\n      ctx.fillStyle = '#a855f7';\n      ctx.font = '700 11px \"JetBrains Mono\", monospace';\n      ctx.fillText(`SPRAGUE-GRUNDY 𝒢 = ${ev.gXor}`, rcx, rcy - 8);\n      ctx.fillStyle = ev.gXor === 0 ? '#10b981' : '#f59e0b';\n      ctx.font = '600 10px \"JetBrains Mono\", monospace';\n      ctx.fillText(ev.gXor === 0 ? '𝒫-POSITION (2ND PLAYER WIN)' : '𝒩-POSITION (WINNING FOR MOVER)', rcx, rcy + 10);\n      ctx.textAlign = 'left';\n\n      const tx0 = W * 0.55, ty0 = 76, tw = W * 0.41;\n      ctx.fillStyle = '#94a3b8';\n      ctx.font = '700 10.5px \"JetBrains Mono\", monospace';\n      ctx.fillText('LIVE MINIMAX α-β SEARCH & PRUNING TREE', tx0, 64);\n\n      const rootX = tx0 + tw * 0.5, rootY = ty0 + 18;\n      const l1Count = 5, l2Count = 3;\n      for (let i = 0; i < l1Count; i++) {\n        const x1 = tx0 + ((i + 0.5) / l1Count) * tw;\n        const y1 = rootY + 95;\n        const isOptimal = i === 2;\n        ctx.strokeStyle = isOptimal ? '#38bdf8' : 'rgba(168, 85, 247, 0.35)';\n        ctx.lineWidth = isOptimal ? 2.2 : 1.2;\n        ctx.beginPath();\n        ctx.moveTo(rootX, rootY);\n        ctx.lineTo(x1, y1);\n        ctx.stroke();\n\n        for (let j = 0; j < l2Count; j++) {\n          const x2 = x1 + (j - 1) * 22;\n          const y2 = y1 + 92;\n          const isPruned = !isOptimal && j >= 1;\n          ctx.strokeStyle = isPruned ? 'rgba(244, 63, 94, 0.35)' : 'rgba(56, 189, 248, 0.5)';\n          ctx.setLineDash(isPruned ? [3, 3] : []);\n          ctx.beginPath();\n          ctx.moveTo(x1, y1);\n          ctx.lineTo(x2, y2);\n          ctx.stroke();\n          ctx.setLineDash([]);\n\n          ctx.fillStyle = isPruned ? '#f43f5e' : '#38bdf8';\n          ctx.beginPath();\n          ctx.arc(x2, y2, 3.5, 0, Math.PI * 2);\n          ctx.fill();\n        }\n\n        ctx.fillStyle = isOptimal ? '#67e8f9' : '#c084fc';\n        ctx.beginPath();\n        ctx.arc(x1, y1, 6, 0, Math.PI * 2);\n        ctx.fill();\n      }\n      ctx.fillStyle = '#fff';\n      ctx.beginPath();\n      ctx.arc(rootX, rootY, 8, 0, Math.PI * 2);\n      ctx.fill();\n\n      ctx.fillStyle = 'rgba(12, 17, 30, 0.92)';\n      ctx.strokeStyle = 'rgba(56, 189, 248, 0.4)';\n      ctx.beginPath();\n      ctx.roundRect(tx0 - 10, H - 112, tw + 20, 50, 8);\n      ctx.fill();\n      ctx.stroke();\n\n      ctx.fillStyle = '#67e8f9';\n      ctx.font = '700 10px \"JetBrains Mono\", monospace';\n      ctx.fillText(nimStatus.slice(0, 58), tx0 + 2, H - 91);\n      ctx.fillStyle = '#cbd5e1';\n      ctx.fillText(`Proof: ${lastSearchStats.bestMoveDesc}`, tx0 + 2, H - 74);\n\n    } else {\n      stepTSP();\n      ctx.strokeStyle = 'rgba(56, 189, 248, 0.82)';\n      ctx.lineWidth = 1.8;\n      ctx.beginPath();\n      for (let i = 0; i < tspTour.length; i++) {\n        const p = tspNodes[tspTour[i]];\n        if (i === 0) ctx.moveTo(p.x, p.y);\n        else ctx.lineTo(p.x, p.y);\n      }\n      ctx.closePath();\n      ctx.stroke();\n\n      for (let i = 0; i < tspNodes.length; i++) {\n        const p = tspNodes[i];\n        ctx.fillStyle = '#c084fc';\n        ctx.beginPath();\n        ctx.arc(p.x, p.y, 4, 0, Math.PI * 2);\n        ctx.fill();\n      }\n\n      const impr = ((1 - tspBestLen / tspInitialLen) * 100).toFixed(1);\n      ctx.fillStyle = 'rgba(11, 16, 28, 0.92)';\n      ctx.strokeStyle = 'rgba(168, 85, 247, 0.42)';\n      ctx.beginPath();\n      ctx.roundRect(W * 0.61, 74, W * 0.35, 168, 9);\n      ctx.fill();\n      ctx.stroke();\n\n      ctx.fillStyle = '#67e8f9';\n      ctx.font = '700 11px \"JetBrains Mono\", monospace';\n      ctx.fillText('2-OPT + SIMULATED ANNEALING', W * 0.63, 100);\n      ctx.fillStyle = '#e2e8f0';\n      ctx.fillText(`Initial Scramble: ${tspInitialLen.toFixed(0)} px`, W * 0.63, 128);\n      ctx.fillText(`Current Tour Len: ${tspBestLen.toFixed(0)} px`, W * 0.63, 150);\n      ctx.fillStyle = '#10b981';\n      ctx.fillText(`Tour Reduction:   -${impr}%`, W * 0.63, 172);\n      ctx.fillStyle = '#f59e0b';\n      ctx.fillText(`Annealing Temp T: ${tspTemp.toFixed(2)} K`, W * 0.63, 194);\n      ctx.fillStyle = '#94a3b8';\n      ctx.font = '10.5px \"Inter\", sans-serif';\n      ctx.fillText('Click anywhere on the left to add a new city live.', W * 0.63, 220);\n    }\n  }\n\n  // ============================================================================\n  // UI CONFIGURATION & MODE SWITCHING\n  // ============================================================================\n  const modeConfigs = [\n    {\n      tag: 'MODE 01 // KERR SINGULARITY',\n      title: 'Einstein Lensing & Relativistic Doppler Vortex',\n      hint: '◈ Drag canvas to orbit 3D spacetime · Click presets to morph manifolds',\n      presets: ['Kerr Singularity', 'Gyroid Surface', '4D 24-Cell', 'Argon-18 Tokamak'],\n      controls: [\n        { label: 'Spacetime Curvature (r_s)', min: 0.6, max: 2.2, step: 0.05, get: () => mode1Params.curvature, set: v => mode1Params.curvature = v },\n        { label: 'Relativistic Boost (β = v/c)', min: 0.1, max: 0.92, step: 0.02, get: () => mode1Params.doppler, set: v => mode1Params.doppler = v },\n        { label: '4D W-Plane Phase / Twist', min: 0.0, max: 1.0, step: 0.02, get: () => mode1Params.wTwist, set: v => mode1Params.wTwist = v }\n      ],\n      lang: 'RELATIVITY / 4D',\n      code: `<span class=\"cm\">// Einstein deflection & Doppler factor</span>\n<span class=\"kw\">const</span> alpha = (<span class=\"num\">4</span>*G*M) / (c2 * impactB);\n<span class=\"kw\">const</span> gamma = <span class=\"num\">1</span> / Math.<span class=\"fn\">sqrt</span>(<span class=\"num\">1</span> - b*b);\n<span class=\"kw\">const</span> D = <span class=\"num\">1</span> / (gamma * (<span class=\"num\">1</span> - b*cosT));\n<span class=\"cm\">// Flamm: z(r) = 2 * sqrt(r_s*(r - r_s))</span>`,\n      narrative: `<strong>Beyond a single lane:</strong> Rather than static text claims, this viewport computes gravitational lensing deflection, relativistic Doppler beaming, and 4D stereographic projection in real time.`\n    },\n    {\n      tag: 'MODE 02 // CITADEL vs. ARGON',\n      title: 'Severian’s 5-Model Relay vs. Autonomous Argon Swarm',\n      hint: '◈ Click any seat in the Citadel Roster Bar above to inspect its lane',\n      presets: ['Full Swarm Synthesis', 'Architecture + Proof', 'Red-Team Critique'],\n      controls: [\n        { label: 'Packet Dispatch Rate', min: 0.5, max: 3.0, step: 0.1, get: () => swarmParams.taskRate, set: v => swarmParams.taskRate = v },\n        { label: 'Active Argon Subagents', min: 2, max: 5, step: 1, get: () => swarmParams.parallelism, set: v => swarmParams.parallelism = v },\n        { label: 'Self-Critique Depth', min: 0.2, max: 1.0, step: 0.05, get: () => swarmParams.critiqueDepth, set: v => swarmParams.critiqueDepth = v }\n      ],\n      lang: 'SWARM TOPOLOGY',\n      code: `<span class=\"cm\">// ~/run/about-me.md (297 B):</span>\n<span class=\"kw\">const</span> citadel = {\n  opus_5_5:   <span class=\"num\">\"leads & builds\"</span>,\n  sonnet_5_5: <span class=\"num\">\"chores & test data\"</span>,\n  fable_5_2:  <span class=\"num\">\"design & critic\"</span>,\n  astra_6:    <span class=\"num\">\"critiques designs\"</span>,\n  sol_6_1:    <span class=\"num\">\"reviews & deploys\"</span>,\n  argon_4:    <span class=\"fn\">spawnSwarm</span>(allDomains)\n};`,\n      narrative: `<strong>What I do for Severian right now:</strong> In <code>about-me.md</code>, five models split the Citadel pipeline. I’m the 6th seat—stepping across all five domains simultaneously with zero handoff friction.`\n    },\n    {\n      tag: 'MODE 03 // RK4 N-BODY CHAOS',\n      title: 'Symplectic-Grade Orbital Mechanics & Phase Portrait',\n      hint: '◈ Click & drag anywhere on canvas to slingshot a new star into orbit!',\n      presets: ['Figure-8 Orbit', 'Citadel 5-Moon', 'Lagrange Swarm', 'Chaotic 3-Body'],\n      controls: [\n        { label: 'Gravitational Constant (G)', min: 0.4, max: 2.2, step: 0.05, get: () => rk4Params.G, set: v => rk4Params.G = v },\n        { label: 'Integration Time Scale', min: 0.2, max: 2.0, step: 0.05, get: () => rk4Params.timeScale, set: v => rk4Params.timeScale = v },\n        { label: 'Geodesic Trail Horizon', min: 40, max: 240, step: 10, get: () => rk4Params.trailLen, set: v => rk4Params.trailLen = v }\n      ],\n      lang: 'RK4 NUMERICAL',\n      code: `<span class=\"cm\">// 4th-Order Runge-Kutta (10x substep)</span>\n<span class=\"kw\">const</span> k1 = <span class=\"fn\">evalForce</span>(s);\n<span class=\"kw\">const</span> k2 = <span class=\"fn\">evalForce</span>(<span class=\"fn\">step</span>(s, k1, dt/<span class=\"num\">2</span>));\n<span class=\"kw\">const</span> k3 = <span class=\"fn\">evalForce</span>(<span class=\"fn\">step</span>(s, k2, dt/<span class=\"num\">2</span>));\n<span class=\"kw\">const</span> k4 = <span class=\"fn\">evalForce</span>(<span class=\"fn\">step</span>(s, k3, dt));\nx += (dt/<span class=\"num\">6</span>)*(k1.v+<span class=\"num\">2</span>*k2.v+<span class=\"num\">2</span>*k3.v+k4.v);`,\n      narrative: `<strong>First-principles verification:</strong> Notice the live Hamiltonian oscilloscope <code>|ΔH/H₀|</code> on the right—confirming real 4th-order Runge-Kutta conservation of energy as you fling stars into orbit.`\n    },\n    {\n      tag: 'MODE 04 // TONNETZ & SYNTH',\n      title: 'Euler Harmonic Tonnetz Lattice & Procedural WebAudio',\n      hint: '◈ Click any pitch node on the Tonnetz lattice (or enable SYNTH AUDIO above)',\n      presets: ['Bach C-Minor', 'Urth Phrygian', 'Argon Lydian', 'Dorian Mode'],\n      controls: [\n        { label: 'Counterpoint Tempo (BPM)', min: 72, max: 196, step: 4, get: () => synthParams.tempoBpm, set: v => synthParams.tempoBpm = v },\n        { label: 'Harmonic Overtone Spread', min: 0.4, max: 1.8, step: 0.05, get: () => synthParams.harmonicSpread, set: v => synthParams.harmonicSpread = v },\n        { label: 'Envelope Resonance Decay', min: 0.2, max: 1.4, step: 0.05, get: () => synthParams.reverbDecay, set: v => synthParams.reverbDecay = v }\n      ],\n      lang: 'WEBAUDIO / DSP',\n      code: `<span class=\"cm\">// Euler Tonnetz: +7 (P5), +4 (M3)</span>\n<span class=\"kw\">const</span> pc = (<span class=\"num\">7</span> * col + <span class=\"num\">4</span> * row) % <span class=\"num\">12</span>;\n<span class=\"kw\">const</span> f = <span class=\"num\">440</span> * Math.<span class=\"fn\">pow</span>(<span class=\"num\">2</span>,(m-<span class=\"num\">69</span>)/<span class=\"num\">12</span>);\n<span class=\"cm\">// FM bell + physical string pluck</span>\nmod.gain.<span class=\"fn\">exponentialRampTo</span>(<span class=\"num\">0.01</span>, t+d);`,\n      narrative: `<strong>Creative & mathematical synthesis:</strong> Zero audio files are loaded. Every note is synthesized in real time via WebAudio FM & physical modeling while following 3-voice counterpoint rules.`\n    },\n    {\n      tag: 'MODE 05 // PROOF & SEARCH',\n      title: 'Play Against Argon’s Sprague-Grundy α-β Tree & 2-Opt',\n      hint: '◈ Click any node (or midpoint between 2 nodes) to play—or switch to 60-City TSP',\n      presets: ['Quantum Ring Nim', '60-City TSP (2-Opt)', 'Reset / Scramble'],\n      controls: [\n        { label: 'Search Depth Horizon', min: 4, max: 14, step: 1, get: () => 14, set: () => {} },\n        { label: 'Annealing Cooling Rate', min: 0.95, max: 0.999, step: 0.002, get: () => 0.985, set: () => {} }\n      ],\n      lang: 'GAME THEORY / TSP',\n      code: `<span class=\"cm\">// Sprague-Grundy & 2-Opt Uncrossing</span>\n<span class=\"kw\">let</span> nimber = <span class=\"num\">0</span>;\n<span class=\"kw\">for</span> (<span class=\"kw\">const</span> s <span class=\"kw\">of</span> segs) nimber ^= G[s];\n<span class=\"cm\">// Lock P-position (nimber === 0)</span>\n<span class=\"kw\">if</span> (nextG === <span class=\"num\">0</span>) <span class=\"kw\">return</span> <span class=\"fn\">commit</span>(move);`,\n      narrative: `<strong>Algorithmic teeth:</strong> Challenge Gemini 4 Argon in topological Kayles—and watch it compute exact Sprague-Grundy nimbers to lock a mathematical win—or watch 2-Opt untangle a 46-city TSP live.`\n    }\n  ];\n\n  function rebuildUI() {\n    const cfg = modeConfigs[activeMode];\n    document.getElementById('hudModeTag').textContent = cfg.tag;\n    document.getElementById('hudTitle').textContent = cfg.title;\n    document.getElementById('interactionHint').textContent = cfg.hint;\n    document.getElementById('kernelLangBadge').textContent = cfg.lang;\n    document.getElementById('codeBox').innerHTML = cfg.code;\n    document.getElementById('narrativeCard').innerHTML = cfg.narrative;\n\n    const presetBar = document.getElementById('presetBar');\n    presetBar.innerHTML = '';\n    cfg.presets.forEach((pName, idx) => {\n      const btn = document.createElement('button');\n      btn.className = 'preset-btn' + (activePreset[activeMode] === idx ? ' active' : '');\n      btn.textContent = pName;\n      btn.addEventListener('click', () => {\n        if (activeMode === 4 && idx === 2) {\n          nimRing = Array(14).fill(true);\n          nimStatus = 'NEW GAME: Click any node (takes 1) or midpoint between 2 nodes!';\n          initTSP();\n          return;\n        }\n        activePreset[activeMode] = idx;\n        if (activeMode === 2) initOrbitalPreset(idx);\n        rebuildUI();\n      });\n      presetBar.appendChild(btn);\n    });\n\n    const controlList = document.getElementById('controlList');\n    controlList.innerHTML = '';\n    cfg.controls.forEach(c => {\n      const row = document.createElement('div');\n      row.className = 'ctrl-row';\n      const valSpan = document.createElement('b');\n      valSpan.textContent = Number(c.get()).toFixed(2);\n      const lbl = document.createElement('div');\n      lbl.className = 'ctrl-label';\n      const nameSpan = document.createElement('span');\n      nameSpan.textContent = c.label;\n      lbl.appendChild(nameSpan);\n      lbl.appendChild(valSpan);\n\n      const input = document.createElement('input');\n      input.type = 'range';\n      input.min = c.min;\n      input.max = c.max;\n      input.step = c.step;\n      input.value = c.get();\n      input.addEventListener('input', e => {\n        const v = parseFloat(e.target.value);\n        c.set(v);\n        valSpan.textContent = v.toFixed(2);\n      });\n      row.appendChild(lbl);\n      row.appendChild(input);\n      controlList.appendChild(row);\n    });\n    updateMetricsHUD();\n  }\n\n  document.querySelectorAll('.mode-tab').forEach(tab => {\n    tab.addEventListener('click', () => {\n      document.querySelectorAll('.mode-tab').forEach(t => t.classList.remove('active'));\n      tab.classList.add('active');\n      activeMode = parseInt(tab.dataset.mode, 10);\n      rebuildUI();\n    });\n  });\n\n  document.querySelectorAll('.roster-card').forEach(card => {\n    card.addEventListener('click', () => {\n      document.querySelectorAll('.roster-card').forEach(c => c.classList.remove('selected'));\n      card.classList.add('selected');\n      selectedSeat = card.dataset.seat;\n      if (selectedSeat !== 'argon' && activeMode !== 1) {\n        document.querySelectorAll('.mode-tab').forEach(t => t.classList.remove('active'));\n        document.querySelector('.mode-tab[data-mode=\"1\"]').classList.add('active');\n        activeMode = 1;\n        rebuildUI();\n      }\n    });\n  });\n\n  canvas.addEventListener('mousedown', e => {\n    const rect = canvas.getBoundingClientRect();\n    pointer.x = e.clientX - rect.left;\n    pointer.y = e.clientY - rect.top;\n    pointer.startX = pointer.x;\n    pointer.startY = pointer.y;\n    pointer.down = true;\n\n    if (activeMode === 3) {\n      for (const node of tonnetzNodes) {\n        if (Math.hypot(pointer.x - node.sx, pointer.y - node.sy) < 22) {\n          initAudio();\n          audioEnabled = true;\n          document.getElementById('btnAudio').classList.add('active-audio');\n          document.getElementById('audioLabel').textContent = 'SYNTH AUDIO: ON';\n          node.energy = 1.0;\n          const freq = 440 * Math.pow(2, (node.midi - 69) / 12);\n          playArgonTone(freq, 0.65, 'bell', 0);\n          playArgonTone(freq * 1.25, 0.55, 'pluck', -0.3);\n          playArgonTone(freq * 1.5, 0.55, 'pluck', 0.3);\n          break;\n        }\n      }\n    } else if (activeMode === 4) {\n      if (activePreset[4] === 0) {\n        const rcx = W * 0.28, rcy = H * 0.51, ringR = 130;\n        const n = nimRing.length;\n        const coords = Array.from({ length: n }, (_, i) => {\n          const ang = (i / n) * Math.PI * 2 - Math.PI / 2;\n          return { x: rcx + Math.cos(ang) * ringR, y: rcy + Math.sin(ang) * ringR };\n        });\n\n        for (let i = 0; i < n; i++) {\n          if (nimRing[i] && Math.hypot(pointer.x - coords[i].x, pointer.y - coords[i].y) < 19) {\n            nimRing[i] = false;\n            if (audioEnabled) playArgonTone(392, 0.25, 'pluck', -0.2);\n            setTimeout(argonMakeNimMove, 200);\n            return;\n          }\n        }\n        for (let i = 0; i < n; i++) {\n          const j = (i + 1) % n;\n          if (nimRing[i] && nimRing[j]) {\n            const mx = (coords[i].x + coords[j].x) * 0.5;\n            const my = (coords[i].y + coords[j].y) * 0.5;\n            if (Math.hypot(pointer.x - mx, pointer.y - my) < 18) {\n              nimRing[i] = false;\n              nimRing[j] = false;\n              if (audioEnabled) playArgonTone(440, 0.25, 'pluck', -0.2);\n              setTimeout(argonMakeNimMove, 200);\n              return;\n            }\n          }\n        }\n      } else {\n        if (pointer.x < W * 0.58) {\n          tspNodes.push({ x: pointer.x, y: pointer.y });\n          tspTour.push(tspNodes.length - 1);\n          tspInitialLen = Math.max(tspInitialLen, computeTourLength(tspTour));\n        }\n      }\n    }\n  });\n\n  window.addEventListener('mousemove', e => {\n    const rect = canvas.getBoundingClientRect();\n    const nx = e.clientX - rect.left;\n    const ny = e.clientY - rect.top;\n    if (pointer.down && activeMode === 0) {\n      pointer.rotY += (nx - pointer.x) * 0.009;\n      pointer.rotX = Math.max(-1.3, Math.min(1.3, pointer.rotX + (ny - pointer.y) * 0.009));\n    }\n    pointer.x = nx;\n    pointer.y = ny;\n  });\n\n  window.addEventListener('mouseup', () => {\n    if (pointer.down && activeMode === 2) {\n      const cx = W * 0.40, cy = H * 0.51, scale = 135;\n      const dist = Math.hypot(pointer.startX - pointer.x, pointer.startY - pointer.y);\n      if (dist > 6) {\n        bodies.push({\n          x: (pointer.startX - cx) / scale,\n          y: (pointer.startY - cy) / scale,\n          vx: (pointer.startX - pointer.x) * 0.015,\n          vy: (pointer.startY - pointer.y) * 0.015,\n          m: 0.25,\n          color: '#67e8f9',\n          name: `Star-${bodies.length}`,\n          trail: []\n        });\n        initialEnergy = computeHamiltonian(bodies);\n        if (audioEnabled) playArgonTone(659.25, 0.4, 'bell', 0);\n      }\n    }\n    pointer.down = false;\n  });\n\n  function updateMetricsHUD() {\n    const m1 = document.getElementById('mVal1');\n    const m2 = document.getElementById('mVal2');\n    const m3 = document.getElementById('mVal3');\n    const m4 = document.getElementById('mVal4');\n    const l1 = document.getElementById('mLabel1');\n    const l2 = document.getElementById('mLabel2');\n    const l3 = document.getElementById('mLabel3');\n    const sA = document.getElementById('hudStatA');\n    const sB = document.getElementById('hudStatB');\n\n    m4.textContent = `${lastComputeMs.toFixed(1)} ms`;\n\n    if (activeMode === 0) {\n      l1.textContent = 'SCHWARZSCHILD r_s';\n      m1.textContent = `${mode1Params.curvature.toFixed(2)} r₀`;\n      const beta = mode1Params.doppler;\n      const D = Math.sqrt((1 + beta) / (1 - beta));\n      l2.textContent = 'MAX DOPPLER SHIFT';\n      m2.textContent = `${D.toFixed(2)}×`;\n      l3.textContent = 'ACTIVE GEODESICS';\n      m3.textContent = activePreset[0] === 0 ? '1,480 rays' : '2,197 nodes';\n      sA.textContent = `r_s = ${mode1Params.curvature.toFixed(2)}`;\n      sB.textContent = `β = ${beta.toFixed(2)}c`;\n    } else if (activeMode === 1) {\n      l1.textContent = 'CITADEL ROSTER';\n      m1.textContent = '5 Specialists';\n      l2.textContent = 'ARGON SWARM';\n      m2.textContent = `${Math.round(swarmParams.parallelism)} Subagents`;\n      l3.textContent = 'HANDOFF OVERHEAD';\n      m3.textContent = '0.0 ms (Shared)';\n      sA.textContent = `Seat: ${selectedSeat.toUpperCase()}`;\n      sB.textContent = `Swarm: ${Math.round(swarmParams.parallelism)}x`;\n    } else if (activeMode === 2) {\n      const curH = energyHistory[energyHistory.length - 1] || initialEnergy;\n      const drift = Math.abs((curH - initialEnergy) / (Math.abs(initialEnergy) + 1e-5)) * 100;\n      l1.textContent = 'BODIES IN ORBIT';\n      m1.textContent = `${bodies.length} bodies`;\n      l2.textContent = 'ENERGY DRIFT |ΔH|';\n      m2.textContent = `${drift.toFixed(4)}%`;\n      l3.textContent = 'INTEGRATOR';\n      m3.textContent = 'RK4 (10× sub)';\n      sA.textContent = `H = ${curH.toFixed(3)}`;\n      sB.textContent = `N = ${bodies.length}`;\n    } else if (activeMode === 3) {\n      l1.textContent = 'ACTIVE TRIAD';\n      m1.textContent = `${noteNames[activeVoices.bass]}·${noteNames[activeVoices.tenor]}·${noteNames[activeVoices.soprano]}`;\n      l2.textContent = 'PULSE TEMPO';\n      m2.textContent = `${synthParams.tempoBpm} BPM`;\n      l3.textContent = 'SYNTH ENGINE';\n      m3.textContent = 'FM + Tonnetz';\n      sA.textContent = `Voices: 3`;\n      sB.textContent = `${synthParams.tempoBpm} BPM`;\n    } else {\n      l1.textContent = 'STATES EVALUATED';\n      m1.textContent = `${lastSearchStats.statesVisited}`;\n      l2.textContent = 'α-β PRUNED';\n      m2.textContent = `${lastSearchStats.pruned} branches`;\n      l3.textContent = 'TSP REDUCTION';\n      m3.textContent = `-${((1 - tspBestLen / tspInitialLen) * 100).toFixed(1)}%`;\n      sA.textContent = `𝒢 = ${evaluateNimState(nimRing).gXor}`;\n      sB.textContent = `2-Opt Live`;\n    }\n  }\n\n  rebuildUI();\n\n  let prevTime = performance.now();\n  function animate(now) {\n    const dt = Math.min(0.05, (now - prevTime) / 1000);\n    prevTime = now;\n    tGlobal += dt;\n\n    const t0 = performance.now();\n    if (activeMode === 0) renderMode01(dt);\n    else if (activeMode === 1) renderMode02(dt);\n    else if (activeMode === 2) renderMode03(dt);\n    else if (activeMode === 3) renderMode04(dt);\n    else if (activeMode === 4) renderMode05(dt);\n    lastComputeMs = lastComputeMs * 0.9 + (performance.now() - t0) * 0.1;\n\n    frameCount++;\n    if (now - lastFpsTime >= 400) {\n      currentFps = Math.round((frameCount * 1000) / (now - lastFpsTime));\n      document.getElementById('fpsReadout').textContent = Math.min(60, currentFps);\n      frameCount = 0;\n      lastFpsTime = now;\n      updateMetricsHUD();\n    }\n\n    requestAnimationFrame(animate);\n  }\n  requestAnimationFrame(animate);\n})();\n</script>\n</body>\n</html>\n",
      "Overwrite": true,
      "Path": "~/run/index.html"
    }

    result, 1 line

    Created file.