html {
    --app-viewport-width: 100vw;
    --app-viewport-height: 100vh;
}

html,
body {
    width: 100%;
    height: 100%;
    min-height: 100%;
    overflow: hidden;
}

body {
    background: #111316;
    margin: 0;
}

#game-shell {
    position: relative;
    width: var(--app-viewport-width);
    height: var(--app-viewport-height);
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 50% 42%, rgba(255, 229, 74, 0.06), transparent 34%),
        #111316;
}

#game-shell:fullscreen,
#game-shell.is-immersive {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
    background: #040509;
}

#embed-html {
    width: min(var(--app-viewport-width), calc(var(--app-viewport-height) * 16 / 9));
    height: min(var(--app-viewport-height), calc(var(--app-viewport-width) * 9 / 16));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #040509;
}

#game-shell:fullscreen #embed-html,
#game-shell.is-immersive #embed-html {
    width: min(var(--app-viewport-width), calc(var(--app-viewport-height) * 16 / 9));
    height: min(var(--app-viewport-height), calc(var(--app-viewport-width) * 9 / 16));
    max-width: 100%;
    max-height: 100%;
}

#embed-html > div,
#embed-html table,
#embed-html tbody,
#embed-html tr,
#embed-html td {
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    border-spacing: 0 !important;
}

canvas {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    cursor: default;
    outline: none;
    display: block;
    image-rendering: pixelated;
    touch-action: none;
    user-select: none;
}

p {
    text-align: center;
    color: #eeeeee;
}

a {
    text-align: center;
    color: #bbbbff;
}

.immersive-toggle {
    position: fixed;
    z-index: 3;
    left: 14px;
    bottom: 14px;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #f8d94a;
    border-radius: 6px;
    background: rgba(4, 5, 9, 0.82);
    color: #f8d94a;
    box-shadow:
        0 3px 0 #4c3500,
        0 0 0 1px rgba(0, 0, 0, 0.65),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    cursor: pointer;
    touch-action: manipulation;
}

.immersive-toggle:hover,
.immersive-toggle:focus-visible {
    border-color: #ffe96c;
    color: #ffe96c;
    box-shadow:
        0 3px 0 #4c3500,
        0 0 10px rgba(70, 220, 255, 0.72),
        inset 0 1px 0 rgba(255, 255, 255, 0.16);
    outline: none;
}

.immersive-toggle:active {
    transform: translateY(2px);
    box-shadow:
        0 1px 0 #4c3500,
        0 0 8px rgba(70, 220, 255, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.immersive-toggle.is-unavailable {
    opacity: 0.45;
}

.immersive-icon {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: square;
    stroke-linejoin: miter;
}

.immersive-icon-exit,
.immersive-toggle.is-active .immersive-icon-enter {
    display: none;
}

.immersive-toggle.is-active .immersive-icon-exit {
    display: block;
}

.immersive-hint {
    position: fixed;
    z-index: 3;
    left: 50%;
    bottom: 18px;
    max-width: min(86vw, 420px);
    padding: 8px 12px;
    border: 1px solid #f8d94a;
    border-radius: 6px;
    background: rgba(4, 5, 9, 0.9);
    color: #ffe96c;
    font: 700 13px/1.25 Arial, Helvetica, sans-serif;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    text-shadow: 0 1px 0 #000;
    transform: translate(-50%, 8px);
    transition: opacity 160ms ease, transform 160ms ease;
}

.immersive-hint.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.superdev {
    color: rgb(37,37,37);
    text-shadow: 0px 1px 1px rgba(250,250,250,0.1);
    font-size: 50pt;
    display: block;
    position: fixed;
    z-index: 2;
    right: 18px;
    top: 18px;
    text-decoration: none;
    background-color: rgb(83,87,93);
    box-shadow: 0px 3px 0px 0px rgb(34,34,34),
                0px 7px 10px 0px rgb(17,17,17),
                inset 0px 1px 1px 0px rgba(250, 250, 250, .2),
                inset 0px -12px 35px 0px rgba(0, 0, 0, .5);
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 24px;
    text-align: center;
    line-height: 46px;
}

.superdev:active {
    box-shadow: 0px 0px 0px 0px rgb(34,34,34),
                0px 3px 7px 0px rgb(17,17,17),
                inset 0px 1px 1px 0px rgba(250, 250, 250, .2),
                inset 0px -10px 35px 5px rgba(0, 0, 0, .5);
    background-color: rgb(83,87,93);
    top: 3px;
    color: #fff;
    text-shadow: 0px 0px 3px rgb(250,250,250);
}

.superdev:hover {
    background-color: rgb(100,100,100);
}

@supports (height: 100dvh) {
    #game-shell {
        width: var(--app-viewport-width, 100dvw);
        height: var(--app-viewport-height, 100dvh);
    }

    #embed-html {
        width: min(var(--app-viewport-width, 100dvw), calc(var(--app-viewport-height, 100dvh) * 16 / 9));
        height: min(var(--app-viewport-height, 100dvh), calc(var(--app-viewport-width, 100dvw) * 9 / 16));
    }

    #game-shell:fullscreen #embed-html,
    #game-shell.is-immersive #embed-html {
        width: min(var(--app-viewport-width, 100dvw), calc(var(--app-viewport-height, 100dvh) * 16 / 9));
        height: min(var(--app-viewport-height, 100dvh), calc(var(--app-viewport-width, 100dvw) * 9 / 16));
    }
}

@media (max-width: 700px), (pointer: coarse) {
    .immersive-toggle {
        left: 12px;
        bottom: 12px;
        width: 44px;
        height: 44px;
    }

    .immersive-icon {
        width: 26px;
        height: 26px;
    }
}
