body, html {
    background-color:#333;
    text-align: center;
    color: #777;
    font-family: Arial;
    font-size: 18px;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

svg {
    background-color: #333;
    margin: auto;
    align-self: center;
    width: 100% !important;
    height: 100% !important;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.touch-controls {
    position: fixed;
    z-index: 10;
    left: 50%;
    bottom: max(12px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    align-items: center;
}

.touch-controls__switcher {
    display: flex;
    padding: 4px;
    border: 2px solid #806c69;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.85);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45);
}

.touch-controls[hidden] { display: none; }

.touch-controls__button {
    min-width: 88px;
    min-height: 46px;
    padding: 0 16px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: silver;
    font: bold 16px Arial;
    letter-spacing: 1px;
    touch-action: manipulation;
}

.touch-controls__hint {
    width: 46px;
    display: flex;
    flex-direction: column;
    color: #999;
    font: 11px/1.15 Arial;
}

.touch-controls__button + .touch-controls__button {
    border-left: 1px solid #806c69;
}

.mobile-hud {
    position: fixed;
    z-index: 10;
    top: max(8px, env(safe-area-inset-top));
    left: 8px;
    right: 8px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px;
    border: 2px solid #806c69;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.85);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45);
    color: silver;
    font: bold 14px Arial;
}

.mobile-hud[hidden] { display: none; }

.mobile-hud__score {
    display: flex;
    gap: 6px;
    padding-left: 8px;
    white-space: nowrap;
}

.mobile-hud__label { color: silver; }
.mobile-hud__value--lives { color: #e7a0a0; }
.mobile-hud__value--mines { color: #e3bd72; }
.mobile-hud__value--score { color: #9dcc91; }
.mobile-hud__value--players { color: #91bce0; }

.mobile-hud__actions {
    display: flex;
    align-self: stretch;
}

.mobile-hud__button {
    min-width: 58px;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: silver;
    font: bold 14px Arial;
    touch-action: manipulation;
}

.mobile-hud__button--instructions {
    min-width: 82px;
    padding-left: 5px;
    padding-right: 5px;
    font-size: 12px;
}

.mobile-invite {
    position: fixed;
    z-index: 11;
    top: calc(max(8px, env(safe-area-inset-top)) + 54px);
    left: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    padding: 6px;
    border: 2px solid #806c69;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.92);
}

.mobile-invite[hidden] { display: none; }

.mobile-invite__url {
    min-width: 0;
    flex: 1;
    padding: 0 8px;
    border: 1px dotted silver;
    border-radius: 5px;
    background: #111;
    color: silver;
    font: 14px Arial;
}

.instructions-panel {
    position: fixed;
    z-index: 20;
    top: 50%;
    left: 50%;
    width: min(290px, calc(100% - 48px));
    transform: translate(-50%, -50%);
    padding: 18px;
    border: 2px solid #806c69;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.94);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
    color: silver;
    text-align: left;
    font: 14px/1.45 Arial;
}

.instructions-panel[hidden] { display: none; }

.instructions-panel__title {
    color: white;
    font-weight: bold;
}

.instructions-panel__mobile { display: none; }

.instructions-panel__close {
    display: block;
    margin-left: auto;
    padding: 7px 10px;
    border: 1px solid #806c69;
    border-radius: 5px;
    background: #111;
    color: silver;
    font: bold 13px Arial;
}

body.touch-ui .instructions-panel__desktop { display: none; }
body.touch-ui .instructions-panel__mobile { display: block; }

body.touch-ui.mobile-menu-open {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
}

body.touch-ui.mobile-menu-open svg {
    display: block;
    height: var(--mobile-menu-height, 1800px) !important;
    min-height: 100%;
    touch-action: pan-y;
}

@media (max-width: 370px) {
    .touch-controls__button {
        min-width: 76px;
        padding: 0 10px;
    }

    .touch-controls__hint {
        width: 40px;
        font-size: 10px;
    }

    .mobile-hud {
        font-size: 13px;
    }

    .mobile-hud__button {
        min-width: 44px;
        padding: 0 5px;
        font-size: 13px;
    }

    .mobile-hud__button--instructions {
        min-width: 74px;
        font-size: 11px;
    }
}

.touch-controls__button[aria-pressed="true"] {
    background: #645452;
    color: white;
}

#touch_mark[aria-pressed="true"] {
    background: #b36b00;
}

/* because why */
svg text { pointer-events: none }

/* thanks s/o # 826782 */
svg {
    -webkit-touch-callout: none; /* iOS Safari */
      -webkit-user-select: none; /* Safari */
       -khtml-user-select: none; /* Konqueror HTML */
         -moz-user-select: none; /* Old versions of Firefox */
          -ms-user-select: none; /* Internet Explorer/Edge */
              user-select: none; /* Non-prefixed version, currently
                                    supported by Chrome, Edge, Opera and Firefox */
}

.debug_div {
    border-top: 4px dotted #14073A;
}

.debug_div span { color: #14073A; font-weight: bold; }

.debug_div button, .debug_div input {
    padding: 5px;
    margin: 5px;
    font-family: Consolas;
    font-size: 18px;
    background-color:#14073A;
    border:0;
    color: silver;
}

.debug_div button:hover {
    color: white;
    cursor: pointer;
}

.debug_div .pushed { background-color: #28136c }

#invite_code {
    background-color: black;
    opacity: 0.8;
    color: silver;
    text-align: left; 
    padding: 1em;
    height:100%;
}

#invite_code a { color: black; }

#invite_code textarea {
    background-color: black;
    color: red;
    padding:0.5em;
    resize: none;
    width:90%;
    border:1px dotted silver;
    font-size: 20px;
    font-family: Arial;
}

strong { color: white }