refactor: split the main.ts god module into features over a shared app context
main.ts: 1289 → 88 lines — now a composition root that reads as a boot tour.
- src/app.ts: the shell — shared state (session/handle/defaults), the canvas +
chrome refs, the router, and a tiny event bus ("view"/"refresh") so features
react without importing each other.
- src/auth.ts: oauth init, signIn, logout.
- src/ui/: slots (the icon registry), sheets (the shared bottom-sheet).
- src/features/: tools, chrome, gallery, settings, preferences, remix,
icon-mode, save. each exposes init(); save reads remix/icon/prefs via their
getters (the integration seam stays explicit, no behavior change).
behaviour preserved; tsc + build green. plan in docs/refactor-main.md.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>