I designed the app around a local-first model: local state and local snapshots are treated as the primary workflow, while Firebase sync is an optional enhancement for authenticated users.
I separated session state, player state, persistence, auth, cloud writers, and formatting utilities so settlement rules stay predictable and reusable across normal sessions, quick records, history, and cloud sync.
I normalized financial data at write boundaries, keeping cash values to two decimals, ROI to fixed precision, and chip counts as integers to avoid inconsistent summaries across screens.
I used role-aware permission checks so host-only behaviours, cloud updates, and settlement currency tools could be guarded without blocking local play.