html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: #050505;
    color: #f5f5f5;
    font-family: Arial, Helvetica, sans-serif;
}

body::before,
body::after {
    content: "";
    position: fixed;
    left: 0;
    right: 0;
    z-index: 1;
    pointer-events: none;
}

body::before {
    top: 0;
    height: 26vh;
    background: linear-gradient(180deg, #CD201F 0, #A91B1A 62%, rgba(205, 32, 31, 0) 100%);
}

body::after {
    bottom: 0;
    height: 10px;
    background: #CD201F;
}

body.has-video::before,
body.has-video::after {
    display: none;
}

button {
    font: inherit;
}

#stage,
#player,
#player iframe {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #050505;
}

#fullscreenTouchLayer {
    position: fixed;
    inset: 0;
    z-index: 3;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

#fullscreenTouchLayer:focus {
    outline: none;
}

#welcomePanel {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 5;
    width: min(86vw, 360px);
    box-sizing: border-box;
    transform: translate(-50%, -50%);
    overflow: hidden;
    padding: 26px 24px 22px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(15, 15, 15, 0.96);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.7);
    text-align: center;
    transition: left 300ms ease, top 300ms ease, transform 300ms ease, opacity 300ms ease;
}

#welcomePanel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 7px;
    background: #CD201F;
}

body.has-video #welcomePanel {
    left: auto;
    right: 14px;
    top: auto;
    bottom: 14px;
    width: 150px;
    transform: none;
    padding: 8px;
    opacity: 0.88;
}

body.has-video #welcomePanel:hover {
    opacity: 1;
}

#displayWordmark {
    display: block;
    width: min(230px, 68vw);
    height: auto;
    margin: 0 auto 18px;
}

body.has-video #displayWordmark {
    display: none;
}

#roomName {
    margin-bottom: 14px;
    color: #f1f1f1;
    font-size: 16px;
    font-weight: 700;
}

body.has-video #roomName,
body.has-video #fullscreenButton {
    display: none;
}

#qrCode {
    display: flex;
    width: 184px;
    height: 184px;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 8px;
    border-radius: 0;
    background: #fff;
    line-height: 0;
    overflow: hidden;
}

body.has-video #qrCode {
    width: 124px;
    height: 124px;
    padding: 6px;
}

#qrCode img,
#qrCode canvas {
    display: block;
    width: 168px !important;
    height: 168px !important;
}

body.has-video #qrCode img,
body.has-video #qrCode canvas {
    width: 112px !important;
    height: 112px !important;
}

#controlLink {
    display: flex;
    width: fit-content;
    margin: 0 auto;
    line-height: 0;
}

#controlUrl {
    display: none;
}

#fullscreenButton {
    display: block;
    margin: 14px auto 0;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 8px;
    background: #f5f5f5;
    color: #101010;
    cursor: pointer;
    font-weight: 700;
}

#hud {
    position: fixed;
    left: 16px;
    top: 16px;
    z-index: 4;
    max-width: min(620px, calc(100vw - 32px));
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.58);
    text-shadow: 0 1px 2px #000;
    pointer-events: none;
}

body.hide-title #hud,
body.hide-qr #welcomePanel {
    display: none;
}

#videoTitle {
    font-size: 18px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#videoMeta {
    margin-top: 4px;
    color: #d6d6d6;
    font-size: 13px;
}

#statsPanel {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 4;
    display: none;
    width: min(420px, calc(100vw - 32px));
    max-height: calc(100vh - 120px);
    overflow: auto;
    box-sizing: border-box;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.72);
    color: #f4f4f4;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    text-shadow: 0 1px 2px #000;
    pointer-events: none;
}

body.show-stats #statsPanel {
    display: block;
}

.statsTitle {
    margin-bottom: 8px;
    color: #b7d9ff;
    font-weight: 700;
}

#statsList {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 5px 12px;
    margin: 0;
}

#statsList dt,
#statsList dd {
    margin: 0;
}

#statsList dt {
    color: #a8b5c4;
}

#statsList dd {
    overflow-wrap: anywhere;
}

#enablePlaybackPanel {
    position: fixed;
    inset: 0;
    z-index: 7;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.44);
}

body.needs-playback-enable #enablePlaybackPanel {
    display: flex;
}

#enablePlaybackButton {
    min-height: 54px;
    padding: 0 24px;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 8px;
    background: #f5f5f5;
    color: #101010;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65);
}

#enablePlaybackButton:active {
    transform: translateY(1px);
}

@media (max-width: 640px) {
    #hud {
        left: 10px;
        top: 10px;
        max-width: calc(100vw - 20px);
    }

    #videoTitle {
        font-size: 15px;
    }

    body.has-video #welcomePanel {
        right: 10px;
        bottom: 10px;
    }

    #statsPanel {
        left: 10px;
        bottom: 10px;
        width: calc(100vw - 20px);
    }
}
