Tic Tac Toe - shadow DOM components
Here is the Tic Tac Toe game again, but this time each Tic Tac Toe game is a separate shadow DOM component.
This shadow DOM method gives you isolated, or private CSS, which is separate to the rest of the page. Because the CSS is separate, all the CSS needs to be stored in the component declaration itself. Before using the shadow DOM technique, be sure that your target browsers support it.