body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    background: #000;
    overflow: hidden;
}

#mycanvas {
    position: relative;
    max-width: 100%;
    max-height: 100vh;
    width: auto;
    height: auto;
}

@media (min-aspect-ratio: 1/1) {
    #mycanvas {
        width: 100vh;
        height: 100vh;
    }
}

@media (max-aspect-ratio: 1/1) {
    #mycanvas {
        width: 100vw;
        height: 100vw;
    }
}