Original prompt
Act as an expert software engineer specializing in low-level graphics and simulation algorithms. Build a complete Falling Sand Physics Simulation (cellular automata powder toy) as a single self-contained HTML file using vanilla HTML, CSS, and JavaScript only - NO external libraries or dependencies. Visuals: a clean dark-themed dashboard with the simulation canvas centered and a styled control panel holding one selection button per material, a Clear Canvas button, and a slider that adjusts the brush/drop size. Canvas is fixed at 400x400 pixels with image-rendering: pixelated, backed by an internal simulation grid of exactly 100x100 cells (each cell drawn as a 4x4 pixel block). Element colors are exact: empty space deep charcoal #1e1e24, sand rich gold #e9c46a, water vibrant blue #457b9d, wall solid slate gray #6c757d, acid glowing neon green #55ff33. Physics rules to implement exactly on a discrete 2D grid driven by requestAnimationFrame: Wall is static and can never move or be displaced; Sand falls straight down into empty space, and if blocked below by sand or wall it slides diagonally down-left or down-right at random into empty cells - when it falls into water or acid it sinks through, displacing that liquid upward; Water falls straight down, flows diagonally down-left/down-right when blocked, and otherwise spreads horizontally left or right into empty space until blocked; Acid falls and flows exactly like water but dissolves on contact: if acid touches sand or wall (above, below, or either side), both the acid cell and one pixel of the contacted material become empty space in the same tick. CRITICAL IMPLEMENTATION TRAPS: iterate the grid from the BOTTOM row up to the top row every frame so particles cannot teleport multiple rows in one update, randomize whether diagonal/horizontal checks try left or right first so liquids and piles do not skew to one side, and implement smooth mouse dragging that paints streams of the selected material into the sandbox in real time. SCORING & STATS (REQUIRED): The simulation MUST track meaningful statistics and persist its best/run stats (total particles painted per material, peak particle count, elapsed session time) to localStorage so they survive restarts; load and display them on startup. SUCCESS CRITERIA: the page must (1) render a crisp 400x400 pixelated canvas driven by a 100x100 cell grid updated via requestAnimationFrame, (2) implement all four materials with the exact movement rules including sand sinking through liquids and acid dissolving contact material, (3) support mouse-drag painting with selectable material buttons, a clear-canvas button and a working brush-size slider, (4) process rows bottom-up each frame and randomize left/right diagonal checks so particles never teleport or pile to one side, 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.