/* Screen Test Viewer — circa-2015 CSS 3, lean-paint support, canonical QR panel. */
* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #000000;
    color: #f2f5f9;
    font-family: Arial, Helvetica, sans-serif;
    -webkit-user-select: none;
    user-select: none;
}

button {
    font: inherit;
}

.stage-wrap {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: #000000;
    overflow: hidden;
}

.stage-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: #000000;
}

.stage-canvas.scale-pixelated {
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.stage-canvas.scale-smooth {
    image-rendering: auto;
}

/* 4K Image & Video Stage (from RCWeb 4ktest) */
.fourk-stage {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: #000000;
    overflow: hidden;
}

.fourk-media {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    object-fit: contain;
}

.fourk-stage.fit-cover .fourk-media {
    object-fit: cover;
}

.fourk-stage.fit-native .fourk-media {
    top: 50%;
    left: 50%;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    object-fit: none;
}

.fourk-video {
    display: none;
}

.fourk-stage.show-video .fourk-image {
    display: none;
}

.fourk-stage.show-video .fourk-video {
    display: block;
}

.fourk-meta {
    position: absolute;
    top: 16px;
    left: 50%;
    -webkit-transform: translateX(-50%);
    transform: translateX(-50%);
    z-index: 6;
    padding: 6px 14px;
    border: 1px solid #304258;
    border-radius: 6px;
    background: rgba(10, 14, 22, 0.86);
    color: #e2ecf8;
    font-family: monospace;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
}

/* Floating HUD overlays (auto-hide / always / hidden via controller) */
.hud-panel {
    position: fixed;
    z-index: 10;
    border: 1px solid #2b384a;
    border-radius: 8px;
    background: rgba(10, 14, 22, 0.84);
    color: #f0f4fa;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-transition: opacity 240ms ease;
    transition: opacity 240ms ease;
}

.title-badge {
    top: 16px;
    right: 16px;
    max-width: 360px;
    padding: 10px 14px;
    text-align: right;
}

.title-cat {
    color: #5cc8ff;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.title-name {
    margin-top: 2px;
    color: #ffffff;
    font-size: 16px;
    font-weight: bold;
    line-height: 1.25;
}

.title-sub {
    margin-top: 3px;
    color: #9fb2c8;
    font-size: 12px;
    line-height: 1.3;
}

.telemetry-bar {
    left: 16px;
    bottom: 16px;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    padding: 6px 10px;
}

.metric-box {
    padding: 2px 10px 2px 0;
    margin-right: 10px;
    border-right: 1px solid #263242;
}

.metric-label {
    display: block;
    color: #8296ae;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 0.06em;
}

.metric-value {
    display: block;
    margin-top: 2px;
    color: #ffffff;
    font-family: monospace;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
}

.sync-pill {
    padding: 5px 10px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.sync-syncing {
    background: #17467a;
    color: #bfe0ff;
}

.sync-ready {
    background: #145c34;
    color: #98ffc6;
}

.sync-stutter {
    background: #7c3c0e;
    color: #ffd6a6;
}

.bar-divider {
    width: 1px;
    height: 24px;
    margin: 0 10px;
    background: #263242;
}

.conn-box {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    max-width: 170px;
    margin-right: 10px;
}

.conn-dot {
    -webkit-flex: 0 0 8px;
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    background: #ffc857;
}

.conn-dot-ok {
    background: #3ddc84;
}

.conn-dot-wait {
    background: #ffc857;
}

.conn-dot-err {
    background: #ff5a6a;
}

.conn-status {
    overflow: hidden;
    color: #b7c6d8;
    font-family: monospace;
    font-size: 11px;
    font-weight: bold;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fs-icon-btn {
    -webkit-flex: 0 0 34px;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #3c506b;
    border-radius: 6px;
    background: #1a2638;
    color: #ffffff;
    cursor: pointer;
}

.fs-icon-btn:hover,
.fs-icon-btn:focus {
    background: #253752;
    border-color: #4f8cff;
}

.fs-icon-btn:active {
    background: #122033;
}

.fs-icon-svg {
    display: block;
}

/* Corner dock for standard QR panel tucked into bottom-right corner */
.corner-dock {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 12;
    text-align: center;
}

.qr-wrap {
    margin: 0;
}

/* HUD visibility states */
body.hud-faded .hud-panel {
    opacity: 0;
    pointer-events: none;
}

body.hud-off .hud-panel {
    display: none !important;
}

body.hide-title .title-badge {
    display: none !important;
}

body.hide-telemetry .telemetry-bar {
    display: none !important;
}

body.hide-qr .qr-wrap {
    display: none !important;
}

/* Canonical RCWeb Standard QR Panel (verbatim from v/style.css + border-box restore) */
.rcRoomQrCodeLink,
.rcRoomQrCodeLink * {
    box-sizing: content-box;
}

.rcRoomQrCodeLink {
    display: block;
    width: 150px;
    margin-left: auto;
    margin-right: auto;
    border: solid 8px #fff;
    border-radius: 8px;
    color: #fff;
    background-color: #fff;
    text-align: center;
    transition: opacity 1s ease;
    text-decoration: none;
    box-shadow: 0 0 32px #000;
    transform-origin: center;
    transform: scale(1);
    animation: pop-in 500ms ease-in-out forwards;
}

@keyframes pop-in {
    0% {
        transform: scale(0.5);
    }
    66% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

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

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

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

/* Lean-paint path for weak signage / TV devices: flat colors, no shadows/animations */
body.lean .hud-panel,
body.lean .fourk-meta {
    background: #0d121a;
    -webkit-transition: none;
    transition: none;
}

body.lean .rcRoomQrCodeLink {
    box-shadow: none;
    animation: none;
    transition: none;
}

/* Responsive viewports: 960x540, 1080x1920, 450x960 */
@media (max-width: 1000px), (max-height: 600px) {
    .title-badge {
        top: 10px;
        right: 10px;
        max-width: 260px;
        padding: 7px 10px;
    }

    .title-name {
        font-size: 14px;
    }

    .telemetry-bar {
        left: 10px;
        bottom: 10px;
        padding: 5px 8px;
    }

    .metric-box {
        padding-right: 7px;
        margin-right: 7px;
    }

    .metric-value {
        font-size: 12px;
    }

    .corner-dock {
        right: 10px;
        bottom: 10px;
    }

    /* Uniform scale for entire QR panel on compact viewports */
    .qr-wrap {
        position: relative;
        width: 136px;
        height: 184px;
        margin: 0 0 0 auto;
        overflow: visible;
    }

    .qr-wrap .rcRoomQrCodeLink {
        position: absolute;
        right: 0;
        bottom: 0;
        margin: 0;
        -webkit-transform-origin: bottom right;
        transform-origin: bottom right;
        -webkit-transform: scale(0.78);
        transform: scale(0.78);
        animation: none;
    }

    .conn-box {
        max-width: 115px;
        margin-right: 7px;
    }

    .bar-divider {
        margin: 0 7px;
    }
}

@media (max-width: 540px) {
    .title-badge {
        max-width: 250px;
    }

    .telemetry-bar {
        left: 10px;
        right: 10px;
        bottom: auto;
        top: 84px;
        -webkit-flex-wrap: wrap;
        flex-wrap: wrap;
    }

    .metric-box {
        border-right: none;
        padding-right: 8px;
        margin-right: 4px;
    }

    .bar-divider {
        display: none;
    }

    .conn-box {
        margin-left: 8px;
        margin-right: auto;
    }

    .qr-wrap {
        position: relative;
        width: 122px;
        height: 165px;
    }

    .qr-wrap .rcRoomQrCodeLink {
        position: absolute;
        right: 0;
        bottom: 0;
        margin: 0;
        -webkit-transform-origin: bottom right;
        transform-origin: bottom right;
        -webkit-transform: scale(0.7);
        transform: scale(0.7);
        animation: none;
    }
}
