body {
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* The title menu uses screen-sized touch controls on phones. The game canvas
   retains its original resolution once a game or another scene is opened. */
#fq-mobile-title, #fq-mobile-options {
    position: fixed;
    inset: 0;
    z-index: 5;
    overflow: auto;
    background: radial-gradient(ellipse at 50% 15%, #512a16, #160e09 65%, #080605);
    color: #ffe6ae;
    font: 18px/1.4 Georgia, "Times New Roman", serif;
    touch-action: manipulation;
    overscroll-behavior: contain;
}
#fq-mobile-options .fq-options-panel {
    box-sizing: border-box;
    width: 100%;
    max-width: 680px;
    margin: auto;
    padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
        max(28px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}
#fq-mobile-options header {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 18px;
    margin-bottom: 8px;
    border-bottom: 1px solid #a7763f;
}
#fq-mobile-options h1 { margin: 0; font-size: 32px; }
#fq-mobile-options button {
    min-height: 48px;
    padding: 10px 16px;
    border: 1px solid #d4a05b;
    border-radius: 6px;
    box-shadow: inset 0 0 0 2px #2a100b;
    background: linear-gradient(#802b1c, #4e160f);
    color: #fff0d1;
    font: inherit;
    cursor: pointer;
    touch-action: manipulation;
}
#fq-mobile-options .fq-option-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 16px;
    padding: 16px 0;
    border-bottom: 1px solid #795232;
}
#fq-mobile-options label { overflow-wrap: anywhere; }
#fq-mobile-options .fq-option-toggle { min-width: 80px; }
#fq-mobile-options .fq-option-toggle[aria-checked="true"] { background: #536130; }
#fq-mobile-options output { min-width: 4ch; text-align: right; color: #ffe1a5; }
#fq-mobile-options input[type="range"] {
    grid-column: 1 / -1;
    box-sizing: border-box;
    width: 100%;
    min-height: 48px;
    margin: 0;
    accent-color: #e7b46b;
    touch-action: pan-y;
    cursor: pointer;
}
#fq-mobile-options :focus-visible { outline: 3px solid #ffd087; outline-offset: 3px; }
#fq-mobile-title .fq-title-layout {
    box-sizing: border-box;
    min-height: 100%;
    min-height: 100dvh;
    max-width: 1000px;
    margin: auto;
    padding: max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
        max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}
#fq-mobile-title .fq-title-brand {
    width: min(100%, 400px);
    text-align: center;
}
#fq-mobile-title img {
    display: block;
    width: 100%;
    max-height: max(160px, calc(100dvh - 325px));
    object-fit: contain;
}
#fq-mobile-title .fq-title-version {
    margin: 8px 0 0;
    color: #d7bc96;
    font-size: 14px;
}
#fq-mobile-title nav {
    width: min(100%, 360px);
    display: grid;
    gap: 10px;
}
#fq-mobile-title button {
    box-sizing: border-box;
    min-height: 50px;
    width: 100%;
    padding: 10px 18px;
    border: 1px solid #d4a05b;
    border-radius: 6px;
    box-shadow: inset 0 0 0 2px #2a100b, 0 3px 8px #0005;
    background: linear-gradient(#802b1c, #4e160f);
    color: #fff0d1;
    font: inherit;
    cursor: pointer;
    touch-action: manipulation;
}
#fq-mobile-title button:active { background: #a33e25; }
#fq-mobile-title button:focus-visible { outline: 3px solid #ffd087; outline-offset: 3px; }
#fq-mobile-title button:disabled { color: #b09a83; background: #2c211b; cursor: default; }
@media (orientation: landscape) and (max-height: 500px) {
    #fq-mobile-title .fq-title-layout {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 24px;
        align-content: center;
    }
    #fq-mobile-title img { max-height: calc(100dvh - 90px); }
    #fq-mobile-title nav { justify-self: center; }
}
#errorPrinter {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 640px;
    height: 100px;
    transform: translate(-50%, -50%);
    text-align: center;
    text-shadow: 1px 1px 3px #000;
    font-size: 20px;
    color: #fff;
    z-index: 9;
    pointer-events: none;
}
/* Only actual error text and retry buttons should intercept input; the
   transparent container also contains empty child divs during normal play. */
#errorPrinter > * { pointer-events: auto; }
#errorName {
    color: #ff0;
    font-weight: bold;
    -moz-user-select: text;
    -webkit-user-select: text;
    -ms-user-select: text;
    user-select: text;
}
#errorMessage {
    color: #fff;
    -moz-user-select: text;
    -webkit-user-select: text;
    -ms-user-select: text;
    user-select: text;
}
#retryButton {
    font-size: 20px;
    color: #fff;
    background-color: #000;
    border-radius: 8px;
    margin: 20px;
    padding: 10px;
}
#fpsCounterBox {
    position: absolute;
    left: 5px;
    top: 5px;
    width: 90px;
    height: 40px;
    background: #222;
    opacity: 0.8;
    z-index: 8;
}
#fpsCounterLabel {
    position: absolute;
    top: 0px;
    left: 0px;
    padding: 5px 10px;
    height: 30px;
    line-height: 32px;
    font-size: 12px;
    font-family: rmmz-numberfont, sans-serif;
    color: #fff;
    text-align: left;
}
#fpsCounterNumber {
    position: absolute;
    top: 0px;
    right: 0px;
    padding: 5px 10px;
    height: 30px;
    line-height: 30px;
    font-size: 24px;
    font-family: rmmz-numberfont, monospace;
    color: #fff;
    text-align: right;
}
#loadingSpinner {
    margin: auto;
    position: absolute;
    top: 0px;
    left: 0px;
    right: 0px;
    bottom: 0px;
    width: 120px;
    height: 120px;
    z-index: 10;
}
#loadingSpinnerImage {
    margin: 0px;
    padding: 0px;
    border-radius: 50%;
    width: 96px;
    height: 96px;
    border: 12px solid rgba(255, 255, 255, 0.25);
    border-top: 12px solid rgba(255, 255, 255, 1);
    animation: fadein 2s ease, spin 1.5s linear infinite;
}
@keyframes fadein {
    0% {
        opacity: 0;
    }
    20% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}
