body {
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
}

canvas {
  max-width: 100%;
  max-height: 100%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@media (min-aspect-ratio: 1 / 1) {
  canvas {
    max-width: 100%;
    height: auto;
  }
}
@media (max-aspect-ratio: 1 / 1) {
  canvas {
    max-height: 100%;
    width: auto;
  }
}