--- name: single-file-webapp description: > Patterns for browser apps delivered as ONE self-contained HTML file (ES modules from a CDN import map, UI wiring, state, save/load JSON, file import/export, undo, test hooks, compact mobile-friendly layout) plus a static checker. Use for any "build a tool/editor/game in a single HTML file" task, before writing the first line. --- # Single-file web app ## Structure ```html โ€ฆ ``` Pin CDN versions (`@0.160.0`, never `@latest`). Keep everything in the file; no build step, no npm for the app itself. ## The five rules that prevent the usual bugs 1. **No inline handlers with a module script.** `onclick="save()"` cannot see functions declared inside `