BUILD REQUEST - PL-158 Primordial Matrix - please build this now I'm sending you this as my request: please build the one-file HTML app described below. Start now and do the whole build in your answer to this message. - This is a build job, not a document to summarize, review or discuss. Don't ask me anything first: if a detail is unclear, pick the most sensible option and keep going. - The spec is everything between the BEGIN SPEC and END SPEC lines. Follow all of it exactly. - If your tool can create files, also save the finished file as PL-158-primordial-matrix.html. ===== BEGIN SPEC ===== PRIMORDIAL MATRIX: 4,000-Agent Particle Life Microscope HOOK OBJECT: window.__primordial Build "PRIMORDIAL MATRIX": a dark-field phase-contrast microscope world in raw WebGL2 and GLSL (no Three.js, no libraries) where 4,000 glowing micro-organisms across 5 species self-organize into hunting worms, rotating cell membranes, pulsing crystals and symbiotic flocks driven purely by a live 5x5 signed attraction/repulsion matrix. LOOK - Style: dark-field bioluminescent wet-slide microscopy, palette deep abyss slide #03070E, brass reticle #8E9BAE, cyan #3CF2FF, coral #FF5D73, lime #8BFF5A, amber #FFC847, violet #B975FF. - Subject: a circular dark-field microscope aperture with fine degree/micrometer ticks filling at least 75% of the screen height, containing 4,000 soft-haloed motile organisms with faint phosphor motion trails and refractive membrane glow when neighbors cluster, flanked on wide screens (or tucked cleanly below on portrait phones) by a crisp 5x5 color-coded interaction matrix widget that never overlaps the circular slide. - FIRST FRAME (t = 0, no input): all 4,000 glowing organisms distributed in seeded cellular rings inside the lit microscope ring, filling 75%+ of the screen height, bright and immediately readable on frame 0. MOTION / PLAY - Controls: click/tap any cell of the 5x5 matrix widget to cycle/nudge species attraction (-1.0 to +1.0), click/drag inside the slide to drop nutrient attractors or stir a pipette vortex, wheel/pinch or `setCamera(panX, panY, zoom)` to zoom right into individual hunting chains (up to 3.5x) and pan smoothly, keys 1โ€“4 or preset buttons to morph the genome between 4 named canonical ecosystems (SYMBIONT RINGS, PREDATOR WORMS, MITOSIS LATTICE, VORTEX CORAL). - Spatial-grid physics: uniform spatial hash grid (no O(N^2) freeze!) so all 4,000 agents step smoothly at 60 fps. Every pair within interaction radius R obeys a bistable kernel: strong steric repulsion below `r_min` (preventing point collapse) and signed linear-tent attraction/repulsion from `matrix[a][b]` between `r_min` and `R`, confined softly inside the circular slide wall. - ATTRACT MODE: with no input, a hands-free lab study runs on load and loops every 28โ€“30 s, cycling cleanly through at least 3 canonical genomes, zooming in briefly on an emergent multi-species structure and back out, and dropping a nutrient pulse. Any input takes over; the demo resumes after 8 s with no input. SOUND - Genome mutation / preset switch -> crystalline harmonic chord whose intervals reflect the matrix symmetry. - Pipette stir or nutrient drop -> wet microscopic droplet blip and gentle fluid swish. - Ambient bio-activity -> subtle generative glass-marimba pulses driven by real cluster density and chase speed. COUNTERS stats() returns { fps, agents, clusters, mutations, nutrientDrops, meanSpeed }. - agents: exact active organism count (4,000). - clusters: live count of occupied high-density spatial cells (>= 14 organisms in a cell), reflecting real self-assembly. - mutations: +1 each time the 5x5 genome preset or matrix cell changes after load. Never on load. - nutrientDrops: +1 each time a nutrient pulse is dropped onto the slide. - On screen: clean lab readout outside the circular aperture showing "AGENTS 4,000 ยท CLUSTERS NN ยท GENOME ", never overlapping the slide. CHECKS for ?test=1 With ?test=1, run an accelerated self-test that measures real positions and real events (not self-set flags) and logs "TEST n PASS" or "TEST n FAIL: reason" to the console and to window.__testResults: 1. Scale & framing: agents === 4000, the microscope slide fills at least 70% of the screen height, and zero external network files are requested (`performance.getEntriesByType("resource").length === 0`). 2. Steric repulsion (no point collapse): after 5 s of simulation under maximum +1.0 self-attraction, fewer than 2% of sampled neighbor pairs sit closer than `0.35 * r_min`, and all 4,000 agents remain inside the slide radius. 3. Asymmetric chase vs symmetric crystal: under an antisymmetric predator matrix (`M[0][1] = +0.9, M[1][0] = -0.9`), meanSpeed after 4 s is at least 2.2x higher than under a symmetric crystal matrix (`M[a][b] = M[b][a]`). 4. Live genome & pipette response: switching presets increments mutations by 1 and measurably changes `clusters` by >= 20% within 3 s; dropping a nutrient pulse increments nutrientDrops by 1 and draws nearby organisms inward. 5. Smooth 4,000-agent runtime: 28 s of hands-free advance() visits >= 3 genomes with mutations >= 2, nutrientDrops >= 1, and zero console errors. KEEP IT SHORT - Keep the whole file under about 1,500 lines (soft target) so you can write it in one pass and finish well inside 15 minutes. - Save lines with helpers, loops and instancing, not by dropping features. Everything above must really work: no placeholders, no TODOs. BUILD RULES (all required): - Deliver ONE self-contained HTML file: inline CSS and JS, no build step, no local assets. Libraries only from a CDN. If you use Three.js, use exactly this import map: {"imports":{"three":"https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js","three/addons/":"https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/"}} - It must open straight from disk in desktop Chrome and on an iPhone (Safari), fill the full screen, handle resize and touch, and stay smooth (target 60 fps). - It must look stunning in the very FIRST frame: no black screen, no loading wait, no tiny subject. The main subject fills at least 50% of the screen height. - SOUND (required): all sound is made in code with Web Audio (no audio files). Show a small "๐Ÿ”Š TAP FOR SOUND" chip; on the first tap create ONE AudioContext, route everything through a master gain of 0.6 into a DynamicsCompressor, and hide the chip. Also expose enableAudio() on the hook object named at the top. - Expose the hook object named at the top with: setCameraOrbit(azimuthDeg, elevationDeg, distance) (or an equivalent camera setter), advance(seconds) that steps the simulation exactly that much for still captures, enableAudio(), and stats() returning {fps, ...the counters named above}. Use a fixed random seed of 360 so every run is the same. - Every on-screen counter must count a real event you can see happen. No fake numbers. - No text overlapping the subject; any label must be readable in a paused frame. - No brand logos, no real people, no copyrighted characters, brand names or logos. FAILURE MODES TO AVOID - Naive O(N^2) loop over 4,000 particles in JavaScript that tanks frame rate below 20 fps. - Missing short-range repulsion so all particles collapse into 5 static dots. - Additive-blending whiteout where dense clusters blow out into featureless white blobs. - Matrix UI covering the microscope aperture on desktop or 390x844 portrait screens. - Particles escaping off screen instead of staying inside the circular microscope dish. - The same variable declared twice, or methods called on objects that don't exist yet. SELF-TEST LOOP - If you can run code: build the file, open it, read the console, run ?test=1, and take screenshots at 3 s, 10 s and 30 s at 1280x720 and 390x844. Look at the screenshots and fix what looks wrong. Fix and retest until all 5 checks pass with zero console errors. Mark anything you could not run as UNMEASURED; never invent results. - If you are chat-only: go through this prompt line by line, check your code against each line, and fix anything that would fail. Then write one corrected, complete file. - Final answer: ONE complete HTML file in ONE code block, then the 5 checks marked PASS, FAIL or UNMEASURED. No snippets, no "rest unchanged". ===== END SPEC ===== Now build it. Reply with ONE complete HTML file in ONE code block, then the 5 checks marked PASS, FAIL or UNMEASURED.