/* Viewer Mode (Clean View - Camera Only) */
body.viewer-mode .top-left-controls,
body.viewer-mode .next-video-bar,
body.viewer-mode .sidebar-header,
body.viewer-mode .camera-controls-overlay .live-btn-icon,
body.viewer-mode #participantSidebar,
body.viewer-mode #controlsContainer,
body.viewer-mode .video-panel,
body.viewer-mode #localVideoPreview,
/* Hide local preview slot since camera is off */
body.viewer-mode #placeholder,
/* Hide "Connecting..." text */
body.viewer-mode .reaction-container {
    display: none !important;
}

/* Ensure Emoji Bar is visible and positioned nicely for Viewer */
body.viewer-mode .camera-controls-overlay {
    /* We hid individual children, but need the container to align the emoji bar */
    display: flex !important;
    justify-content: center;
    /* Center the emojis */
    pointer-events: none;
    /* Let clicks pass through empty space */
    top: auto;
    /* Move to bottom? Or keep top? User said "viewer side", usually bottom or unobtrusive */
    bottom: 30px;
}

body.viewer-mode .camera-controls-overlay .emoji-bar {
    display: flex !important;
    pointer-events: auto;
    /* Re-enable clicks for buttons */
    background: rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    padding: 5px 10px;
}

/* Zero out margins/paddings for full bleed */
body.viewer-mode,
body.viewer-mode html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
}

/* Force Full Screen Container */
body.viewer-mode .container {
    display: block !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    max-height: none !important;
    background: #000;
}

body.viewer-mode .camera-panel {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    position: absolute;
    top: 0;
    left: 0;
    background: #000;
}


/* Individual Players */
body.viewer-mode .remote-video-player {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    border: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    position: relative;
    background: #000;
    overflow: hidden !important;
    transform: none !important;
    -webkit-transform: none !important;
}

/* Compensate Label Flip to keep text readable */
body.viewer-mode .remote-video-label {
    transform: none !important;
    display: inline-block;
}

/* The video element itself */
body.viewer-mode .remote-video-player video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    position: absolute;
    top: 0;
    left: 0;
    transform: none !important;
    -webkit-transform: none !important;
}

/* Box sizing reset for viewer */
body.viewer-mode * {
    box-sizing: border-box !important;
}

/* [LOG: 20260130_1305] Mobile UI Fixes */
@media (max-width: 768px) {

    /* 1. Lift button to avoid mobile browser bars */
    body.viewer-mode .camera-controls-overlay {
        bottom: 80px !important;
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* [LOG: 20260130_1345] Restore full-screen camera size and enable vertical snap */
    body.viewer-mode .remote-videos-grid {
        display: flex !important;
        flex-direction: column !important;
        /* [LOG: 20260130_1424] Conditional scroll: only show when more than 1 broadcaster */
        overflow-y: auto !important;
        overflow-x: hidden !important;
        scroll-snap-type: y mandatory !important;
        gap: 0 !important;
        padding: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        /* Specific Fix: Only show scrollbar if content exceeds height */
        max-height: 100vh !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        -webkit-overflow-scrolling: touch;
    }

    body.viewer-mode .remote-video-player {
        flex: 0 0 100vh !important;
        width: 100vw !important;
        height: 100vh !important;
        scroll-snap-align: start !important;
    }
}