BUILD REQUEST - PL-114 Endless Nightmares - 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-114-endless-nightmares.html. ===== BEGIN SPEC ===== PL-114 — Endless Nightmares: The Town You Can't Leave — Hard WHAT THIS TESTS: An endless agent simulation with a real day/night cycle, named characters who have backstories and lasting memory, counters tied to real events, night lighting and fog in Three.js, and a camera that tells stories on its own. Build a never-ending, never-looping screensaver called "Endless Nightmares": a small, isolated, cut-off community in the woods. People work together by day and hide at night, because creatures come out of the trees after dark. New people keep arriving at any hour, and some don't make it. It should feel tense, eerie and watchable for hours. Everything is original: no characters, names, symbols or places from any TV show, film or game, no logos and no real people. It must be safe to post publicly, with NO gore and NO blood (see DEATHS). THE WORLD (Three.js, low-poly, moody) A clearing about 120 x 120 units, ringed by thick dark forest that the camera never goes past. One dirt road comes in from the forest, loops through town and goes back out into the same forest (people who try to leave come back in on the other side). At least 12 small houses with porches and lit windows, a diner, a big stone "Shelter Hall" with a heavy door, a well, a vegetable field, a woodpile and chopping block, a chicken coop, a clothesline, a bell tower, and a few old cars that don't run. Every house has a protective charm of your own invention hanging over its door (for example a ring of iron nails and a glass bead). When the door is shut and the charm is up, creatures cannot get in. Show it glowing faintly at night. DAY AND NIGHT (the core loop) A full day takes 4 minutes at normal speed: dawn 25 s, day 120 s, dusk 25 s, night 70 s. Show the clock as "Day 37 · 6:42 PM". Day: warm sunlight with soft shadows, birdsong, everyone works. Jobs include farming the field, chopping wood, carrying water from the well, cooking at the diner, fixing roofs, hanging laundry, searching the forest edge, walking the road trying to escape, holding a town meeting and burying the dead. Each person picks jobs that fit their backstory. Dusk: the bell in the tower rings 3 times (visible swing plus sound), the sky goes orange then purple, and everyone hurries home or to Shelter Hall and shuts the door. Someone who is too far away has to run. Night: dark blue moonlight, thick fog, porch lamps and lit windows, crickets and wind. Creatures come out of the tree line: 3 to 6 tall, thin, pale figures of your own design with slow, wrong movements and dim glowing eyes. They walk the streets, peer into windows and tap on doors. Anyone caught outside is in danger. At dawn the creatures walk back into the forest and the doors open again. PEOPLE (agent-based, named, with stories) Start with 18 to 24 residents. Every person has a unique first and last name (generated from big original name lists, never repeated in a run), an age, a former job, a one-sentence backstory ("Retired bus driver who took a wrong turn chasing his dog"), a trait (brave, careful, curious, reckless, kind) and a home. Traits change behavior: reckless people stay out later, careful people head home early, brave ones go out to rescue a new arrival at dusk, and curious ones wander toward the trees. People look different: at least 8 clothing colors, different heights and skin tones, children and older adults, walking with swinging arms and legs. Relationships: people who work together become friends. When someone dies, their friends visit their grave the next day. Click or tap a person to open a card with their name, age, backstory, trait, days in town and current activity. NEW ARRIVALS (any hour) New people arrive at random times of day or night (on average 1 or 2 per in-game day): headlights come out of the forest, a car stops on the road, and the driver or family gets out confused. Each one gets a full name and backstory on the spot. Arriving by day: a resident walks over, greets them and gives them a home or a spot in Shelter Hall. Arriving at night: they wander, call out, and residents shout from windows. A brave resident may run out to bring them inside. Some make it and some are caught. Chances depend on time to dawn, distance to a door and the creatures nearby, and are never scripted. Show a log line for every arrival: "Day 37, 11:12 PM — Arrived: Maya Ortiz, 34, a night-shift nurse who followed a detour sign." DEATHS (no gore) A death happens only when a creature actually reaches a person who is outside at night. The creature wraps around them, the screen dims slightly, and both fade into the fog. There is no blood or body. The next day a simple wooden cross with the name appears in a graveyard at the edge of town. The graveyard grows forever. ON-SCREEN COUNTERS (every number must come from a real event) Top-left panel: "CENSUS: 21 alive", "ARRIVED: 47", "LOST: 26", and "DAYS SINCE LAST DEATH: 3". Census = starting residents + arrivals − deaths, always. "Days since last death" resets to 0 the moment a death happens and goes up by 1 at each dawn with no death. Animate the reset with a short red flash on the number. RIP list: a scrollable panel on the right, newest first: "† Maya Ortiz, 34 — night-shift nurse — Day 37, 11:20 PM — 0 days in town". It keeps every death, forever. Event log at the bottom-left showing the last 6 events (arrivals, deaths, rescues, a new friendship, the bell, someone trying the road out). On a phone the panels fold into tabs (Census / RIP / Log) so they don't cover the scene. KEEP IT ENDLESS The town must never die out or overfill. If the census drops below 10, arrivals speed up. If it goes over 40, arrivals slow down. Night deaths should average about 1 every 2 to 3 nights, with some quiet weeks and some bad nights. No two nights play out the same. Everything comes from each agent's own choices and a seeded random generator. ?seed=123 repeats a run exactly. CAMERA (auto storyteller) The default view is close (a person is at least 100 px tall at 1280x720). An auto camera director glides between stories in 3 to 4 s with ease-in-out and no cuts: a new arrival, a rescue run, someone chopping wood, a creature at a window, a funeral, the bell at dusk. It follows each one for 8 to 15 s. Every 6th shot is a wide shot of the whole town for 5 s. When a death or arrival happens, the camera goes to it (it never misses one). A caption names the story: "Story: Maya Ortiz arrives at night". Drag to orbit, pinch or wheel to zoom (0.7x to 1.5x), and after 6 s idle it goes back to auto. Press C to toggle auto, press 1 to 4 to set speed (1x, 2x, 5x, 20x), and tap the clock to pause. SOUND Use Web Audio only (no audio files), starting on the first tap: day birds, night crickets and wind, the 3-ring bell at dusk, a low drone when a creature is near the camera, a knocking sound at doors, and a quiet chime for an arrival. No voices that try to speak words. Show a mute button. PERFORMANCE 60 fps target on a laptop and smooth on iPhone, with up to 40 people and 6 creatures. Use instanced or merged meshes where it helps and only one shadow-casting light. The fog and darkness must still let you read the scene: at night, people near lamps are clearly visible. BUILD CONTRACT Deliver ONE self-contained index.html with inline CSS and JS, with Three.js (and any add-ons) loaded from a public CDN with a pinned version. No other files. It must open straight from a file in desktop Chrome and iPhone Safari. HONEST TESTING Expose a read-only window.__sim with: day, clock, phase (dawn/day/dusk/night), census, arrived, lost, daysSinceDeath, people (name, age, backstory, trait, state, position, alive), creatures, rip list and event log. Add ?test=1, which runs at 20x for 10 in-game days with ?seed=7 and checks, logging PASS/FAIL to the console and to window.__testResults: Census always equals start + arrived − lost, checked every frame. Every death is matched by a creature being within 1.5 units of that person at night while they were outside. Zero deaths happen by day or indoors. daysSinceDeath resets on each death and rises only at dawns with no death. RIP list length = lost, and every name in it is unique and also appears in the arrival or starting list. Every person has a non-empty name, age and backstory. Zero duplicate full names. At least 1 arrival happened at night and at least 1 by day. At least 1 night rescue was attempted. Everyone outside goes inside within 30 in-game minutes after the dusk bell (except the reckless, the late, and new arrivals). The census stays between 6 and 45 for all 10 days. Same seed twice gives the same event log. Zero console errors. WORK LOOP AND OUTPUT Build, run it, test it, fix it, and retest yourself until every check passes. Take screenshots at 1280x720 and 390x844 at noon, at dusk, at night with a creature in frame, and at a funeral, and actually look at them: the night must be dark and scary but readable, the panels must be readable in a frozen frame, and the creatures must look unsettling, not silly. Mark anything you could not run as UNMEASURED and never invent results. If you are chat-only: first list each checklist item with how your code meets it, then give one corrected complete file. Output ONE complete HTML code block, then the PASS/FAIL/UNMEASURED checklist with the measured numbers. No snippets. ===== END SPEC ===== Now build it. Reply with ONE complete HTML file in ONE code block.