html, body {
    padding: 0;
    margin: 0;
    overflow: hidden;
    overflow-x: hidden;
    -webkit-text-size-adjust: none;
    width: 100%;
    height: 100%;
    position: fixed;
    touch-action: none;
    overscroll-behavior: none;
    background: #000;
}
:root {
    --tg-bg-color: #000000;
    --tg-text-color: #ffffff;
    --tg-button-color: #2ea6ff;
}
html.telegram-mini-app body {
    background: var(--tg-bg-color);
    color: var(--tg-text-color);
}
canvas {
    display: block;
    width: 100vw;
    height: 100vh;
    touch-action: none;
}
html.telegram-mini-app #helloDialog {
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}
input[type=checkbox] {
    cursor: pointer;
}

#overlays, #connecting {
    opacity: 0;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 200;
}
#connecting {
    z-index: 100;
}
#connecting-content {
    width: 350px;
    background-color: #fff;
    margin: 100px auto;
    border-radius: 15px;
    padding: 5px 15px;
}
#title {
    padding: 10px;
}
#nick {
    width: 65%;
}
#skin {
    width: 33%;
    float: right;
}
#nick, #skin {
    display: inline;
}
#gamemode {
    margin-top: 5px;
    width: 100%;
}
#helloDialog {
    width: 400px;
    background-color: #fff;
    color: #1a2233;
    margin: 10px auto;
    border-radius: 15px;
    padding: 5px 15px 5px 15px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
#helloDialog .form-control,
#helloDialog label,
#helloDialog .checkbox,
#helloDialog b {
    color: #1a2233;
}
#helloDialog .text-muted,
#footer .text-muted,
#instructions .text-muted {
    color: #586375 !important;
}
#settings label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 10px;
    user-select: none;
}
#settings input[type=checkbox] {
    margin: 0;
}
#helloDialog button,
#helloDialog input,
#helloDialog select,
#settings label {
    touch-action: manipulation;
}
#connecting-content {
    color: #1a2233;
}
#chat_textbox {
    transition: all .5s ease-in-out;
    position: absolute;
    z-index: 1;
    bottom: 10px;
    background: rgba(0, 0, 0, .2);
    border: 0px;
    outline: none;
    color: #fff;
    height: 30px;
    text-indent: 12px;
    left: 10px;
    width: 300px;
    font-family: "Ubuntu";
}
#chat_textbox:focus {
    background: rgba(0, 0, 0, .5);
}
#footer {
    text-align: center;
    margin-bottom: 10px;
    margin-top: -10px;
}
#play-btn {
    width: 85%;
    margin-bottom: 10px;
}
#spectate-btn {
    width: 13%;
    float: right;
    top: 0;
}
#play-btn, #spectate-button {
    display: inline;
}
#gallery-btn {
    width: 100%;
    margin-bottom: 5px;
    display: none; /* Visible when skins are loaded */
}
#touchpad, #touchCircle, #splitBtn, #ejectBtn {
    position: fixed;
}
#touchpad, #splitBtn, #ejectBtn {
    z-index: 2;
}
#touchpad {
    background: #000;
    opacity: 0.3;
    width: min(24vw, 24vh);
    height: min(24vw, 24vh);
    min-width: 108px;
    min-height: 108px;
    max-width: 200px;
    max-height: 200px;
    left: 0;
    bottom: 0;
    border-top-right-radius: 18px;
}
#touchCircle {
    width: min(6vw, 6vh);
    height: min(6vw, 6vh);
    min-width: 26px;
    min-height: 26px;
    max-width: 44px;
    max-height: 44px;
    border-radius: 50%;
    background: #f00;
    opacity: 0.3;
    z-index: 3;
}
#splitBtn, #ejectBtn {
    width: min(13vw, 13vh);
    height: min(13vw, 13vh);
    min-width: 60px;
    min-height: 60px;
    max-width: 110px;
    max-height: 110px;
    border-radius: 50%;
    background: #777;
    opacity: 0.5;
    padding: 10px;
    box-sizing: border-box;
}
#splitBtn {
    right: max(16px, 16vw);
    bottom: 16px;
}
#ejectBtn {
    bottom: max(16px, 16vh);
    right: 16px;
}
#playSounds:checked + #soundsVolume {
    display: inline;
}
#soundsVolume {
    display: none;
    width: 100px;
    height: 18px;
    padding: 0; /* IE fix */
    vertical-align: middle;
}
@media (orientation: portrait) {
    #helloDialog {
        width: min(92vw, 420px);
        max-height: 88vh;
        overflow-y: auto;
    }
    #chat_textbox {
        width: min(70vw, 300px);
    }
}
