Original prompt
Act as an expert game engineer specializing in retro rogue-like mechanics and 2D graphics math. Build a Procedural Dungeon Generator with Dynamic Fog of War as a single self-contained HTML file using vanilla HTML, CSS, and JavaScript only - NO libraries. Visuals: a clean dark cyber-grid dashboard with centered canvas and a control panel holding a Regenerate Map button, a God Mode toggle button that reveals the entire map for debugging, and a text readout of the player's current coordinates. Canvas fixed at 600x600 pixels with image-rendering: pixelated backed by exactly 60x60 map cells (10x10 pixel tiles). Colors: unexplored fog absolute black #000000, visible walls deep stone gray #4a4e69, visible floor soft slate gray #9a8c98, player a bright green #55ff33 square. Core mechanics: represent the map as a 2D grid (1 = wall, 0 = floor) plus a parallel visibility grid (0 hidden, 1 revealed). Generate the dungeon with EITHER binary space partitioning into rectangular rooms connected by carved straight hallways, OR cellular automata: fill randomly with about 45 percent walls then run 4-5 smoothing steps, guaranteeing isolated cavern pockets get connected by carved tunnels so every floor is reachable. Spawn the player on a valid floor tile. Arrow keys or WASD move the player exactly one tile per keypress and never through walls. Line of sight is the core challenge: maintain a visibility radius of 8 to 10 tiles and cast one ray from the player's tile to every perimeter cell of that radius, tracing each ray with generalized Bresenham's line algorithm step-by-step, marking each visited cell revealed, and stopping the ray immediately when it enters a wall cell so vision cannot pass behind walls. Re-run raycasting whenever the player moves or the map regenerates. SCORING & STATS (REQUIRED): The simulation MUST track meaningful statistics and persist its best/run stats (e.g. fastest solve ticks, best explored percent, best population) to localStorage so they survive restarts; load and display them on startup. SUCCESS CRITERIA: the page must (1) generate a procedural dungeon (BSP rooms+hallways or cellular automata caves) whose floors are fully connected and render it at 60x60 tiles on a 600x600 canvas, (2) move the player one tile per WASD/arrow keypress with wall collision and show live coordinates, (3) reveal visibility via Bresenham raycasting to every perimeter cell within radius 8-10, stopping rays at walls so fog stays behind them, (4) wire Regenerate Map and God Mode full-reveal toggle buttons, and (5) auto-start / render its initial state without any user gesture so the headless renderer captures a non-blank frame. OUTPUT FORMAT: Respond with the COMPLETE, self-contained HTML document in ONE single ```html code block. Do NOT split the code across multiple blocks, do NOT include a thinking summary inside the block, and do NOT place any prose, explanation, or comments between the opening and closing of the code block. The entire document (doctype through </html>) must be inside one fenced code block so it can be extracted and rendered verbatim. OUTPUT REQUIREMENT: Respond with ONLY the raw, runnable source code in a single fenced code block, with the first line starting at column 0 (no leading indentation). Do not include any thinking, explanation, summary, or prose before or after the code, and keep comments inside the code minimal.