styles.css
#c {
  border:1vmin groove gold;
}
globals.js
var g_ctx;
var g_side;
my.js
function setup() {
  var canvas=document.getElementById('c');
  g_side=45*vmin();
  canvas.width=g_side; canvas.height=g_side;
  g_ctx=canvas.getContext('2d');
}
function vmin() {
  var w=innerWidth; var h=innerHeight;
  var v=w;
  if (h<w) v=h;
  return v/100;
}