BUILD REQUEST - PL-166 Chladni Plate - 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-166-chladni-plate.html. ===== BEGIN SPEC ===== CHLADNI PLATE: Sand Patterns That Sing HOOK OBJECT: window.__chladni Build "CHLADNI PLATE": an acoustic resonance bench in raw WebGL2 and GLSL (no Three.js, no libraries) where 16,000 gleaming quartz sand grains bounce across a dark brushed-brass square plate driven by a pure harmonic oscillator. Sweeping the driving frequency visibly shakes grains off anti-nodes and herds them into razor-sharp geometric Chladni nodal figures, while the exact standing-wave pitch rings in sync. LOOK - Style: dark museum acoustics bench, palette obsidian studio #080A0F, dark brushed brass plate #262018 with bevel trim #C89B4B, illuminated quartz sand #FFF1CC, subtle nodal shimmer #7FD8FF, mode indicator #E6A94C. - Subject: a centered square brass Chladni plate (filling at least 72% of screen height) with central mounting bolt, fine brushed metallic grain rendered in GLSL, 16,000 individual WebGL2 point-sprite sand grains with specular glint, and a live harmonic frequency strip along the side or bottom never overlapping the plate. - FIRST FRAME (t = 0, no input): the lit brass plate fills 72%+ of screen height, with 16,000 grains already half-assembled into crisp mode (3, 5) nodal arcs so the glowing geometry reads immediately on frame 0. MOTION / PLAY - Controls: drag horizontally across the frequency slider or press Left/Right (or keys 1–6) to step through resonant (n, m) eigenmodes (1,3), (2,5), (3,5), (3,7), (4,7), (5,8); click/tap anywhere on the plate to scatter a fresh pinch of grains and disturb the local pattern; Space toggles BOW/DRIVE excitation; setCamera(panX, panY, zoom) zooms into individual grain clusters. - Standing-wave physics: exact Chladni eigenfunction `W(x, y) = cos(n*pi*x)*cos(m*pi*y) - cos(m*pi*x)*cos(n*pi*y)` (smoothly interpolating frequency between modes). Each of the 16,000 grains computes local vibration amplitude `|W(x, y)|`: grains on high-amplitude anti-nodes receive stochastic upward/lateral kicks proportional to `|W|` and bounce rapidly until they settle along the quiet zero-amplitude nodal lines (`|W| < 0.08`)! - ATTRACT MODE: with no input, a hands-free 28–30 s acoustic showcase sweeps smoothly through 5 distinct resonant modes, pausing on each so the sand visibly snaps from chaotic buzzing into crisp geometric lacework before jumping to the next harmonic pitch. Any input takes over; after 8 s idle it resumes. SOUND - Plate oscillator -> pure warm harmonic sine + subtle metallic overtone whose pitch matches the active Chladni mode frequency in Hz (220 Hz to 1,180 Hz). - Anti-node grain bounce -> crisp sandy sizzle volume proportional to the fraction of currently buzzing grains (quiets down as the figure locks in!). - Mode jump / bow attack -> resonant brass bow swell. COUNTERS stats() returns { fps, grains, freqHz, modeN, modeM, nodalRatio, modesLocked }. - grains: exact particle count (16,000). - freqHz: current driving frequency in Hz. - nodalRatio: real measured fraction (0 to 1) of grains currently sitting on quiet nodal zones (`|W(x, y)| < 0.12`). - modesLocked: +1 each time a newly selected eigenmode crosses `nodalRatio >= 0.72` (once per mode switch). Never on load. - On screen: top-left pill "MODE (n,m) · NNN Hz · NODAL NN% · LOCKED N", never over the plate. 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 & zero network: grains === 16000, brass plate fills at least 70% of screen height, and `performance.getEntriesByType("resource").length === 0`. 2. Nodal self-assembly: starting from a uniform random grain distribution under mode (3, 5), advancing 4 s raises `nodalRatio` from < 0.25 to >= 0.75 while all 16,000 grains stay within the plate bounds. 3. Mode switching physics: switching from locked mode (3, 5) to mode (2, 7) immediately drops `nodalRatio` below 0.35 (proving grains really sat on the old nodes), then advancing 4 s re-locks `nodalRatio >= 0.72` and increments `modesLocked` by 1. 4. Bow-off quiescence: disabling excitation (`drive = 0`) halts stochastic bouncing so mean grain displacement per frame drops below 0.0005 plate units within 0.5 s. 5. Attract showcase: advancing 28 s hands-free visits >= 4 distinct (n, m) modes, records `modesLocked >= 3`, and logs 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 - Drawing a static contour shader of the Chladni math instead of actually moving 16,000 particles. - Grains freezing into a blurred fog or escaping off the edges of the brass plate. - Audio pitch staying constant instead of tracking the live resonant mode frequency. - Counters incrementing on a timer rather than measuring real grain nodal ratios. - HUD overlapping the brass plate. - 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.