body {
    margin: 0;
}

/* Container that centers the canvas and limits its size to viewport */
.canvas-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh; /* limit to viewport height */
    box-sizing: border-box;
    padding: 0;
    margin: 0;
}

/* The canvas will never be larger than the viewport in either axis,
   and will preserve its aspect ratio (browser will scale the bitmap). */
.canvas-wrap canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    background: transparent;
}
