How to size Phaser games according to dimensions of browser? Phaser/JS/CSS(?)

I want to size my Phaser games to be as large as possible in any browser size. So if the browser is 160 by 100 and my game is square-shaped, it’ll be maximum size i.e. 100 by 100. Or if browser is 200 by 160 and my game has a 1:2 dimension ratio, it’ll be 80 by 160, maximum size without cutting anything off or being distorted.
How do I achieve this? Thanks!