

A text-based mafia game is a nice fit for the browser, since most of the depth lives in systems like smuggling routes and heist roles rather than in rendering. Heists with assigned roles sound like the hardest part to balance, because one weak role can make the whole crew feel stuck waiting. On mobile, I’d be curious how you handle long lists of crimes and routes without endless scrolling. Did you design the onboarding around one first crime loop, or let new players pick from everything right away?
The fullscreen case is a sneaky one, since the browser can hide a panel without ever running your close handler. I like the random-click tester idea a lot; mashing buttons while toggling fullscreen and switching tabs catches stuff no normal playtest does. In my own browser game the tab losing focus was the other sneaky path, so I ended up deriving pause from what is actually visible instead of a flag I set and clear by hand. Did you also check visibilitychange, or does the fight keep running when someone switches tabs?