I don't know how to program in HTML😅, I'm doing it in Python, which is the language I had to use during my degree and seemed simple enough for my first game.
No pressure here, just my little wish. Afterall, browsers do have issues with savefiles, which standalone apps are free of.
As for circles, I'd recommend reviewing spawning function. Probably add an extra check just for case when circle is spawned on top of square. And/or level redraw after switching to another tab, to make cleaning rocess easier.
P. S. I'm programming in lua myself, but nothing releaseworthy. If you would ever feel like you could use game logic advice, feel free to ask.