BUILD REQUEST - PL-171 Pocket Orrery - 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-171-pocket-orrery.html. ===== BEGIN SPEC ===== POCKET ORRERY: Six Planets, True Orbit Ratios HOOK OBJECT: window.__orrery Build "POCKET ORRERY": a flat, top-down model of a small solar system in Canvas 2D (no libraries). A glowing sun sits in the middle and six planets circle it on nested orbits whose speeds follow the true relative orbit times, so the inner planets race around while the outer ones barely crawl. It is one simple, hypnotic motion, and the line-ups keep surprising you. LOOK - Style: clean museum-instrument look, thin glowing lines on a deep space gradient. Background gradient from #0B1030 (center) to #03040C (edges). Sun: a disc 56 px across at 1280x720 (scale with the screen), #FFD36B with a #FF9A3C glow. Orbit rings: 1.5 px, #3A4A8C at 70% opacity. - Six planets, from the sun outward, each a filled disc with a thin lighter rim: Mercury #B7A99A (8 px), Venus #E8C27A (12 px), Earth #4FA3FF (13 px), Mars #E0603A (10 px), Jupiter #D9A877 (26 px), Saturn #E6D3A0 (22 px) with a thin ring ellipse. - Orbit radii are evenly spaced (not to scale): the six rings have radii of 8%, 15%, 22%, 29%, 36% and 43% of the shorter screen side, so the outermost ring is 86% of the shorter side across. Keep the whole picture centered. - A thin reference line runs from the sun straight to the right edge (angle 0). The legend is a list of the six names and periods in the left margin of the screen (name and period in Earth years), never over the planets. - FIRST FRAME (t = 0, no input): the sun, all six rings and all six planets in view, all planets lined up on the reference line, the whole system filling at least 80% of the screen height on a landscape screen, the legend on the left. MOTION / PLAY - Orbit times in Earth years: Mercury 0.2408, Venus 0.6152, Earth 1.0, Mars 1.8808, Jupiter 11.862, Saturn 29.457. Every planet moves at a constant angular speed counter-clockwise, 360 / period degrees per Earth year. All start at angle 0. - One Earth year takes 4 s at normal speed. Controls: keys 1, 2 and 3 (or three on-screen buttons at least 48 px) set the speed to 1x, 4x and 16x. Dragging sideways with the mouse or a finger spins the time forward and backward (exactly 2 Earth years per full screen width of drag). The mouse wheel or a pinch zooms from 1x to 2.5x through setView(zoom). - Tapping a planet pins a highlight ring around it and shows its period large in the legend. - When a planet passes within 2 degrees of Earth's angle (same side of the sun), a thin gold line is drawn from Earth to that planet for 0.5 s and the planet pulses once. After that, the same planet can only trigger it again once it has been more than 10 degrees away from Earth. Planets that start lined up with Earth do not trigger it until they have separated by more than 10 degrees and met again. - ATTRACT MODE: with no input, a hands-free demo starts on load and loops every 25–30 s, showing every main feature (it runs at 1x for 12 s, 4x for 10 s, then 1x again, pins a different planet each time it changes speed). Any input takes over; the demo resumes after 8 s with no input. SOUND - A very soft low drone while the orrery runs. - A short glassy "tick" for every reference-line crossing (pitch lower for the outer planets). - A bright two-note chime when a gold line-up line appears. - A soft whoosh when the speed changes. COUNTERS stats() returns { fps, laps, lineups, earthYears }. - laps: an array of six numbers [Mercury, Venus, Earth, Mars, Jupiter, Saturn]; each goes +1 exactly when that planet's center crosses the reference line counter-clockwise (never at t = 0), with its tick flashing. - lineups: +1 exactly when a gold line-up line appears. - earthYears: +1 each time Earth crosses the reference line (so it always equals laps[2]). - On screen: the laps for all six planets next to their legend rows, and the lineups count at the bottom-left, readable in a paused frame and never over the planets. 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 there are exactly 6 planets and 6 rings, all planets at angle 0, and the outermost ring is at least 80% of the shorter screen side across. 2. After advance(47.6) (11.9 Earth years at 1x), laps is exactly [49, 19, 11, 6, 1, 0] and earthYears is 11. 3. Over advance(8) at 1x, the measured angular speed of Mercury divided by that of Earth is 4.153 within 1%, and Jupiter's angle is 360 x t / 47.448 degrees within 0.5. 4. Detect meetings with a swept test (compare the angle gap on the previous and the current step, so a fast planet cannot skip past the 2 degree window between two steps). At 1x, every time lineups goes up, the angle gap between Earth and the lined-up planet is under 5 degrees (one step can move about 4.7 degrees), and lineups never changes without a gold line on screen. 5. Switching to 16x makes each planet's angle advance 16 times faster per second within 2%, and a full 28 s attract loop has laps[2] of at least 6 with 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 blank page, or only the HUD on a dark page, because one script error killed the scene. - Planets all moving at the same speed, or speeds that do not match the orbit times above. - Planets that start at different angles, so the first frame is not lined up. - Lap counters that tick on a timer instead of when a planet visibly crosses the line. - Line-up lines that fire every frame while two planets stay close, instead of once per meeting. - The outer rings cut off by the screen edge, or labels drawn on top of the planets. - A speed change that jumps the planets to new positions instead of just speeding them up. - 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.