* {
    box-sizing: border-box;
}

[hidden] {
    display: none;
}

html,
body {
    width: 100%;
    height: 100%;
    min-height: 100%;
    margin: 0;
    overflow: hidden;
    background-color: #070707;
    color: #eee8d8;
    font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
}

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

.viewer-shell {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    background-color: #0b0a09;
}

.game-stage {
    position: absolute;
    top: 18px;
    right: 232px;
    bottom: 18px;
    left: 18px;
    overflow: hidden;
    background-color: #050505;
    border: 1px solid #332f28;
}

.game-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 320px;
    height: 200px;
    overflow: hidden;
    border: 6px solid #29251f;
    background-color: #000;
    transform: translate(-50%, -50%);
}

#canvas {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    border: 0;
    background-color: #000;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    outline: none;
}

.side-panel {
    position: absolute;
    top: 18px;
    right: 18px;
    bottom: 18px;
    width: 196px;
    padding: 16px 14px;
    overflow: hidden;
    border: 1px solid #39332b;
    background-color: #171411;
}

.eyebrow,
.join-heading {
    color: #c9a960;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 2px;
    line-height: 1.2;
    text-transform: uppercase;
}

.brand-block h2,
.loading-card h1 {
    margin: 7px 0 5px;
    color: #d7c490;
    font-family: Impact, "Arial Black", sans-serif;
    font-size: 44px;
    line-height: 0.9;
    letter-spacing: 2px;
}

.brand-block p,
.key-hint,
.sound-hint {
    margin: 0;
    color: #a8a093;
    font-size: 12px;
    line-height: 1.4;
}

.join-block {
    margin-top: 18px;
    border-top: 1px solid #39332b;
    padding-top: 14px;
}

.qr-panel {
    width: 166px;
    min-height: 230px;
    margin-top: 7px;
}

.rcRoomQrCodeLink,
.rcRoomQrCodeLink * {
    box-sizing: content-box;
}

.rcRoomQrCodeLink {
    display: block;
    width: 150px;
    margin: 0 auto;
    overflow: hidden;
    border: solid 8px #fff;
    border-radius: 8px;
    color: #fff;
    background-color: #fff;
    text-align: center;
    text-decoration: none;
}

.rcTechLabel {
    margin: 0 0 8px 0;
    padding: 4px;
    background-color: #000;
    color: #fff;
    font-family: monospace;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 0.2em;
}

.rcRoomQrCode {
    width: 150px;
    height: 150px;
    overflow: hidden;
}

.rcRoomQrCode img,
.rcRoomQrCode canvas {
    display: block;
    width: 150px !important;
    height: 150px !important;
}

.rcRoomId {
    margin: 8px 0 0 0;
    padding: 4px;
    background-color: #000;
    color: #fff;
    font-family: monospace;
    font-size: 16px;
    letter-spacing: 0.25em;
}

.viewer-status {
    position: absolute;
    right: 14px;
    bottom: 58px;
    left: 14px;
    min-height: 52px;
    padding: 10px 8px 8px 34px;
    border-top: 1px solid #39332b;
}

.status-light {
    position: absolute;
    top: 14px;
    left: 8px;
    width: 14px;
    height: 14px;
    border: 2px solid #777066;
    border-radius: 50%;
    background-color: #342f29;
}

.status-light.online {
    border-color: #8daa68;
    background-color: #6e953e;
}

.viewer-status strong,
.viewer-status span {
    display: block;
}

.viewer-status strong {
    color: #e8dfca;
    font-size: 12px;
}

.viewer-status #networkStatus {
    margin-top: 3px;
    color: #8f877c;
    font-size: 10px;
}

.key-hint {
    position: absolute;
    right: 14px;
    bottom: 13px;
    left: 14px;
    font-size: 10px;
}

.loading-panel,
.error-panel {
    position: absolute;
    z-index: 4;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: #090807;
}

.loading-card,
.error-panel {
    text-align: center;
}

.loading-card {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 360px;
    max-width: 84%;
    transform: translate(-50%, -50%);
}

.loading-card h1 {
    margin: 10px 0;
    font-size: 76px;
}

.loading-card p {
    margin: 8px 0;
    color: #c8bfad;
    font-size: 14px;
}

.load-track {
    width: 100%;
    height: 12px;
    margin-top: 17px;
    overflow: hidden;
    border: 2px solid #4c4437;
    background-color: #17130f;
}

.load-bar {
    display: block;
    width: 8%;
    height: 100%;
    background-color: #a83b2b;
    transition: width 180ms linear;
}

.loading-panel.ready {
    display: none;
}

.sound-gate {
    position: absolute;
    z-index: 6;
    bottom: 12px;
    left: 50%;
    min-width: 150px;
    min-height: 44px;
    padding: 8px 18px;
    border: 2px solid #d0af63;
    border-radius: 8px;
    background-color: #6a2b21;
    color: #fff1dc;
    font: inherit;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    transform: translateX(-50%);
    cursor: pointer;
}

.sound-gate:active {
    background-color: #a83b2b;
    transform: translateX(-50%) scale(0.97);
}

.error-panel {
    padding: 20% 12px 0;
    color: #ffd9cd;
}

.error-panel strong,
.error-panel span {
    display: block;
}

.error-panel strong {
    font-size: 24px;
}

.error-panel span {
    margin-top: 10px;
    color: #c8aaa0;
    font-size: 13px;
}

@media (max-width: 1000px) {
    .game-stage {
        right: 210px;
    }

    .side-panel {
        width: 176px;
        padding-right: 5px;
        padding-left: 5px;
    }

    .brand-block,
    .join-heading,
    .key-hint {
        padding-right: 9px;
        padding-left: 9px;
    }
}

@media (max-height: 600px) and (min-aspect-ratio: 4/5) {
    .side-panel {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .brand-block h2 {
        margin-top: 5px;
        font-size: 34px;
    }

    .brand-block p,
    .key-hint {
        display: none;
    }

    .join-block {
        margin-top: 11px;
        padding-top: 9px;
    }

    .qr-panel {
        width: 132px;
        min-height: 182px;
        margin: 6px auto 0;
    }

    .qr-panel .rcRoomQrCodeLink {
        margin: 0;
        transform: scale(0.78);
        transform-origin: top left;
    }

    .viewer-status {
        right: 10px;
        bottom: 10px;
        left: 10px;
    }
}

@media (max-aspect-ratio: 4/5) {
    .side-panel {
        top: 10px;
        right: 10px;
        bottom: auto;
        left: 10px;
        width: auto;
        height: 210px;
        padding: 12px;
    }

    .brand-block {
        position: absolute;
        top: 14px;
        right: 12px;
        left: 144px;
        padding: 0;
    }

    .brand-block h2 {
        font-size: 36px;
    }

    .join-block {
        position: absolute;
        top: 10px;
        left: 10px;
        width: 118px;
        height: 180px;
        margin: 0;
        padding: 0;
        border: 0;
    }

    .join-heading,
    .key-hint {
        display: none;
    }

    .qr-panel {
        width: 108px;
        min-height: 160px;
        margin: 0;
    }

    .qr-panel .rcRoomQrCodeLink {
        margin: 0;
        transform: scale(0.64);
        transform-origin: top left;
    }

    .viewer-status {
        right: 12px;
        bottom: 12px;
        left: 144px;
    }

    .game-stage {
        top: 230px;
        right: 10px;
        bottom: 10px;
        left: 10px;
    }

    .loading-card h1 {
        font-size: 58px;
    }
}

@media (max-width: 420px) and (max-aspect-ratio: 4/5) {
    .brand-block p {
        font-size: 10px;
    }

    .viewer-status {
        padding-left: 30px;
    }

    .viewer-status strong {
        font-size: 11px;
    }
}
