BUILD REQUEST - PL-183 Storm Map - 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-183-storm-map.html. ===== BEGIN SPEC ===== STORM MAP: Rain Radar Over a Made-Up Island HOOK OBJECT: window.__storm Build "STORM MAP": an animated 24-hour rain forecast map of a made-up island (Canvas 2D, no libraries). Colored radar echoes drift in from the west across a code-drawn island with five towns, a time slider scrubs through the forecast, towns flash a warning when the rain over them gets heavy, and tapping a town opens its own 24-hour rain curve. It is fun to keep watching because the storms roll across the island and the warnings pop in one by one. LOOK - Style: dark marine-chart radar console, flat vector shapes, thin crisp lines, soft glow on the radar. Palette: deep ocean #0B2A44 fading to shallow #134B6B near the coast, depth contour lines #1E6A8F, land #3D6150 with ridge bands #4E7A60 and #6B8F6D, coastline #BFE3D0 (1.5 px), graticule lines every 0.25 map units in rgba(255,255,255,0.08), panels #0A1622 at 85% opacity, text #E6F1F7, warning accent #FF5A5F. - Map units: one map unit S = the screen height (S = min(height, 1.18 x width) on a narrow window). The island center is the screen center. A point (u, v) in map units is at screen x = width/2 + u x S, y = height/2 + v x S (v grows downward). All numbers below are checked at 1280x720, where S = 720. - Island coast: polar curve with angle t in radians, R(t) = 0.33 x (1 + 0.18 sin(2t + 0.6) + 0.12 sin(3t + 2.1) + 0.08 sin(5t + 4.0)), point = (R cos t, R sin t). It is about 0.76 wide and 0.67 tall in map units (a bounding box about 549 x 481 px at 1280x720). Draw 3 depth contours around it at 1.12, 1.27 and 1.45 times R, and two ridge bands inside at 0.7 and 0.4 times R. - Towns (angle t in degrees, fraction of R): Port Alder (200, 0.62), Cinder Bay (100, 0.65), Wren Hollow (-20, 0.35), Marl Point (330, 0.80), Fenmoor (250, 0.50). At 1280x720 their markers are at about (472, 299), (614, 508), (730, 327), (815, 259) and (594, 234). Each marker is a 14 px dot with a white ring and a small dark pill label with the town name, 13 px bold, right next to it. - Rain field (relative intensity, 1.0 = heavy) at map point (x, y) and forecast hour h is the sum over five storm cells i of A_i x exp(-((h - tp_i) / w_i)^2) x exp(-((x - x0_i - vx_i x h)^2 + (y - y0_i - vy_i x h)^2) / (2 sigma_i^2)), with these values (x0, y0, vx, vy per hour, A, sigma, tp, w): cell 1 (-0.75, -0.10, 0.075, 0.008, 1.2, 0.11, 6, 8); cell 2 (-0.70, 0.20, 0.065, 0.0, 1.0, 0.09, 10, 7); cell 3 (-0.20, -0.80, 0.012, 0.062, 1.0, 0.08, 8, 7); cell 4 (0.55, 0.80, -0.012, -0.058, 0.9, 0.10, 15, 8); cell 5 (-1.25, -0.10, 0.085, 0.0, 1.3, 0.13, 19, 6). - Radar colors by intensity: below 0.15 clear; 0.15-0.3 #5BD75B; 0.3-0.5 #1FA82A; 0.5-0.7 #F4E04D; 0.7-0.9 #F28C28; 0.9-1.1 #D7263D; 1.1 and up #C026D3. Compute the field on a 128 x 72 grid across the whole screen (cell centers at ((i + 0.5) / 128, (j + 0.5) / 72) of the screen), draw it to a small offscreen canvas and scale it up with smoothing at 80% opacity so the echoes look soft. A town is "in warning" when its rain is at least 0.5. - Layout: title card top-left, "HALCYON ISLE · 24 H RAIN FORECAST", with the clock "+9 h · 15:00" under it (the forecast starts at 06:00) and a small north arrow; a warnings panel top-right listing each town currently in warning with its rain value (or "NO WARNINGS"), and the selected-town card under it; a legend of the 6 radar colors bottom-left above the slider; a bottom bar with a 56 px play/pause button and the time slider (track 8 px tall with a 44 px tall hit area, 26 px thumb, tick labels +0h +6h +12h +18h +24h). On a narrow window the warnings panel, the town card and the legend sit below the island and above the slider. The counter line sits in the bottom bar under the slider ticks. Nothing but the town pills overlaps the island. - FIRST FRAME (t = 0, no input): forecast hour 0, paused, no town selected, the island and its contours centered and about 67% of the screen height, a visible storm front at the west edge, green at its edges and yellow in its core (echoes cover about 6.6% of the map), all five towns marked, the legend and slider visible. MOTION / PLAY - Controls: the play button or Space plays and pauses (1 forecast hour per second of real time; at hour 24 it stops, and pressing play again starts from hour 0). Tap or drag the slider to jump to any hour; this is allowed while playing. Tap a town (within 24 px of its marker) to select it; tap it again or tap empty map to deselect. Drag the map to pan and wheel or pinch to zoom from 1 to 2.5 (panning only when zoomed). Everything works with touch. - Selected-town card: the town's name, its current rain value, and a 24 h rain curve (the field at that town for h = 0 to 24, 200 x 70 px) with a playhead at the current hour. - A town that is "in warning" shows a pulsing #FF5A5F ring around its marker (1 s pulse) and appears in the warnings panel. - Crossing rule: warnings are counted only during playback. Every 1/60 s playback step compares each town's rain with its value on the previous step. A jump (the slider, setHour, a restart) updates the stored values without counting. - Camera: setCamera(zoom, centerU, centerV) sets the zoom (1 to 2.5) and the map point at the screen center (default 1, 0, 0). Zoom and pan only change the view; they never change the rain field, echoCover() or any counter. On a phone in portrait the whole map fills the width and the island is about a third of the screen height (an accepted exception to the 50% first-frame rule, because the island is wider than tall). - The hook also exposes play(), pause(), setHour(h) (same code path as releasing the slider at hour h), selectTown(i) (i = 0 Port Alder, 1 Cinder Bay, 2 Wren Hollow, 3 Marl Point, 4 Fenmoor; same as a real tap), selected() (the selected index or -1), attract(on) (false turns the demo off), rainAt(i) (the field at town i at the current hour), echoCover() (the share of the 128 x 72 grid cells with intensity at least 0.15 at the current hour), and layout() returning { island: { x, y, w, h }, towns: [{ x, y } x 5], slider: { x, y, w, h }, thumb: { x, y }, playButton: { x, y, w, h } } in CSS px. Hook calls are not user input and do not pause the demo. - ATTRACT MODE: with no input, a hands-free demo starts on load and loops every 28 s: hold 1.0 s at hour 0; at 1.0 s the demo drags the slider to +12 h (the thumb slides over 0.3 s, the hour jumps at once); at 1.6 s it drags back to +0 h; at 2.0 s it presses play and the forecast runs from hour 0 to hour 24 in exactly 24 s (until 26.0 s); at 8.0 s it taps Port Alder; at 18.0 s it taps Marl Point; at 26.0 s it deselects; hold until 28.0 s, then everything cuts back to the t = 0 state (1.0 + 0.6 + 0.4 + 24 + 2 = 28 s). Demo taps and drags use the same code path as real ones. Any input takes over; the demo resumes after 8 s with no input. Counters keep their values across the cut. SOUND - A soft rain hiss (filtered noise) whose volume follows echoCover() (0 at no echoes, about 0.15 gain at a cover of 0.25). - A town entering warning → a bell ping (880 Hz, 120 ms) and a low thunder rumble (60 Hz noise burst through a low-pass, 1.2 s). - Selecting a town → a short blip (660 Hz, 40 ms). - Releasing the slider or pressing play/pause → a click (1 kHz, 20 ms). COUNTERS stats() returns { fps, warnings, active, selections, scrubs, hour }. - warnings: +1 exactly when a town's rain crosses up through 0.5 between two playback steps (see the crossing rule). Never on load, never on a jump, never on a timer. - active: the number of towns in warning at the current hour (a live value that goes up and down). - selections: +1 each time a different town becomes selected. Deselecting does not count; selecting the same town again after a deselect does. - scrubs: +1 each time the slider is released (tap, drag, or hook setHour). - hour: the current forecast hour, 0 to 24. - On screen: warnings, active, selections and scrubs in the counter line, readable in a paused frame and never over the island. 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: Each check starts from a fresh load; advance() steps in 1/60 s increments. 1. At t = 0 at 1280x720: the canvas fills the window; stats() is { warnings 0, active 0, selections 0, scrubs 0, hour 0 }; layout().island.h is between 475 and 490 px (about 481), its center is within 3% of the window center, and layout().towns are within 3 px of (472, 299), (614, 508), (730, 327), (815, 259) and (594, 234); echoCover() is 0.066 (within 0.01); selected() is -1. 2. After attract(false): setHour(6) gives rainAt(0) = 0.959 (within 0.03); setHour(12) gives rainAt(2) = 0.708 (within 0.03), echoCover() = 0.224 (within 0.02) and stats().active = 1; setHour(18) gives rainAt(3) = 1.457 (within 0.03); at the end scrubs is 3, warnings is 0 and hour is 18. 3. After attract(false) and play(): advance(6.4) gives hour 6.4 (within 0.02) and warnings 1; advance(2.8) more (hour 9.2) gives warnings 3; advance(2.8) more (hour 12.0) gives warnings 4; advance(2.1) more (hour 14.1) gives warnings 5 and active 1; advance(15) more gives hour 24 (playback stopped), warnings exactly 7 and active 0; advance(1) more leaves hour 24 and warnings 7. 4. After attract(false): a real pointerdown and pointerup at the slider's horizontal 50% (slider.x + 0.5 x slider.w, vertical center) gives hour 12.0 (within 0.2), scrubs 1 and warnings 0; a real drag (pointerdown at 50%, pointermove to 25%, pointerup) gives hour 6.0 (within 0.2), scrubs 2, and the thumb center within 3 px of slider.x + 0.25 x slider.w; then a real tap at layout().towns[2] gives selected() 2 and selections 1; tapping it again gives selected() -1 and selections 1; tapping layout().towns[4] gives selected() 4 and selections 2; tapping the empty ocean at (40, 360) gives selected() -1 and selections 2. 5. On a fresh load with the demo running: at t = 1.2 hour is 12.0 (within 0.05) and scrubs is 1; at t = 1.9 hour is 0 and scrubs is 2; at t = 2.1 hour is 0.1 (within 0.05); at t = 7.5 hour is 5.5 (within 0.05) and warnings is 1; at t = 8.4 selections is 1 and selected() is 0; at t = 18.4 hour is 16.4 (within 0.05), selections is 2 and selected() is 3; at t = 26.5 hour is 24, warnings is 7, active is 0 and selected() is -1; the run has 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 - A map that is only a static picture, or radar that does not move with the slider and playback. - An island that is a plain circle or ellipse instead of the coast formula, or towns that sit in the ocean. - Radar colors that do not match the intensity ramp, hard pixel blocks instead of soft echoes, or echoes that hide the coastline completely. - Warnings that count on a timer, double-count while a town stays heavy, or count when you only jump the slider. - A slider thumb that does not match the hour, a slider that cannot be dragged on a phone, or a thumb hit area under 44 px. - A selected-town card with a curve that does not match the rain at that town, or a playhead stuck at 0. - Panels or legend covering the island, tiny unreadable labels, or text over the radar that cannot be read in a paused frame. - A first frame with no radar visible, or a dark map where the coast cannot be seen. - 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.