*,
*::before,
*::after {
    box-sizing: border-box;
}

/* ── SCROLLBARS ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ── LEFT SIDE (VIDEO AREA) and body: defined in Right Column Wrapper section ── */


#video-grid {
    flex: 1;
    display: grid;
    gap: 6px;
    padding: 6px;
}

.stream-container {
    position: relative;
    background: #0d0d14;
    overflow: hidden;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stream-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.stream-label {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 20px;
    z-index: 5;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.stream-drag-handle {
    cursor: grab;
    opacity: 0.5;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
}
.stream-drag-handle:hover { opacity: 1; }
.stream-drag-handle:active { cursor: grabbing; }

.stream-minimize-btn {
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s, color 0.2s;
    background: none;
    border: none;
    color: white;
    padding: 2px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.stream-minimize-btn:hover { opacity: 1; color: #ff6b6b; }

.stream-container.dragging { opacity: 0.5; }
.stream-container.drag-over { border: 2px solid #00d4aa; }
.stream-modal-item.dragging { opacity: 0.5; background: rgba(72, 199, 116, 0.1); }
.stream-modal-item.drag-over { border-top: 2px solid #00d4aa; }

#no-stream-message {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    color: rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.8);
    z-index: 10;
}

/* ── BASE LAYOUT ── */
body {
    margin: 0;
    font-family: 'Inter', Arial, sans-serif;
    display: flex;
    height: 100vh;
    background: #0a0a0f;
    color: white;
    overflow: hidden;
}

/* Video area: takes all remaining horizontal space */
#left {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #050508;
    position: relative;
}

/* Right sidebar column: stacks user-header above #right */
#sidebar {
    width: 300px;
    min-width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    /* Softer border */
    background: rgba(20, 20, 28, 0.4);
    /* Darker tinted glass base */
    backdrop-filter: blur(24px);
    /* Heavier blur */
    -webkit-backdrop-filter: blur(24px);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    /* Ambient shadow */
    overflow: hidden;
    transition: width 0.3s ease, min-width 0.3s ease;
}

#sidebar.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    border-left: none !important;
}

/* ── USER HEADER ── */
#user-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    min-height: 44px;
    flex-shrink: 0;
}

#right {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 12px;
    overflow: hidden;
    position: relative;
}

#right::before {
    content: "";
    position: absolute;
    top: -60px;
    right: -60px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(72, 199, 116, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

/* Base styles for Mobile UI components (Hidden on Desktop) */
#mobile-drawer-toggle,
#mobile-tabs-header {
    display: none;
}

.drawer-content-chat {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    order: 2;
}

.drawer-content-controls {
    display: flex;
    flex-direction: column;
    flex: none;
    overflow-y: visible;
    order: 1;
    padding-bottom: 12px;
}

@media (min-width: 769px) {

    /* Forcibly show both on desktop, overriding any mobile JS inline styles */
    #drawer-chat-section,
    #drawer-controls-section {
        display: flex !important;
    }
}

/* ── USER HEADER ── */
#user-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    min-height: 32px;
}

.user-info-area {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    gap: 6px;
}

.user-info-area .user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-actions-area {
    display: flex;
    gap: 4px;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 0;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.icon-btn.danger:hover {
    background: rgba(255, 80, 80, 0.15);
    border-color: rgba(255, 80, 80, 0.3);
    color: #ff6b6b;
    box-shadow: 0 4px 12px rgba(255, 80, 80, 0.2);
}


@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 12px rgba(72, 199, 116, 0.5);
    }

    50% {
        opacity: 0.7;
        box-shadow: 0 0 20px rgba(72, 199, 116, 0.8);
    }
}

/* ── MANAGE STREAMS BUTTON ── */
.manage-streams-float {
    position: absolute;
    bottom: 16px;
    left: 16px;
    z-index: 40;
    padding: 10px 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    background: rgba(20, 20, 28, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
}

#left:hover .manage-streams-float,
#left.show-controls .manage-streams-float {
    opacity: 1;
    pointer-events: auto;
}

.manage-streams-float:hover {
    background: rgba(40, 40, 50, 0.9);
    border-color: rgba(72, 199, 116, 0.4);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
}

/* Modal Stream Items */
.stream-modal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: grab;
    transition: background 0.2s, border-color 0.2s, transform 0.1s;
}

.stream-modal-item:hover {
    background: rgba(72, 199, 116, 0.08);
    border-color: rgba(72, 199, 116, 0.25);
}

.stream-modal-item:active {
    cursor: grabbing;
}

.stream-toggle-check {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.stream-modal-item.active .stream-toggle-check {
    background: #48c774;
    border-color: #48c774;
}
.stream-modal-item.active .stream-toggle-check::after {
    content: "✓";
    color: black;
    font-size: 12px;
    font-weight: bold;
}

/* ── DIVIDER ── */
.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    margin: 0 0 10px;
}

/* ── SECTION LABELS (Chat, Replay) ── */
.chat-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 8px;
}

/* ── MESSAGES ── */
#messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 4px;
    margin-bottom: 10px;
}

#messages::-webkit-scrollbar {
    width: 4px;
}

#messages::-webkit-scrollbar-track {
    background: transparent;
}

#messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

.msg-body {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0 10px 10px 10px;
    padding: 6px 10px;
    font-size: 13px;
    line-height: 1.4;
    max-width: 100%;
    word-break: break-word;
}

.msg-username {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 2px;
}

.msg-text {
    color: rgba(255, 255, 255, 0.8);
}

/* ── USERNAME AREA ── */
#username-area {
    display: flex;
    gap: 6px;
}

#username-area input {
    flex: 1;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#username-area input:focus {
    border-color: rgba(72, 199, 116, 0.5);
    box-shadow: 0 0 0 3px rgba(72, 199, 116, 0.1);
}

#username-area input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

#username-area button {
    padding: 9px 14px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #48c774, #00d4aa);
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    margin-left: 0;
}

#username-area button:hover {
    opacity: 0.85;
}

#username-area button:active {
    transform: scale(0.97);
}

/* ── CHAT INPUT AREA ── */
#input-area {
    display: flex;
    gap: 6px;
}

#chat-input {
    flex: 1;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#chat-input:focus {
    border-color: rgba(72, 199, 116, 0.5);
    box-shadow: 0 0 0 3px rgba(72, 199, 116, 0.1);
}

#chat-input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

#send-btn {
    padding: 9px 14px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #48c774, #00d4aa);
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-left: 0;
    line-height: 1;
    box-shadow: 0 4px 12px rgba(72, 199, 116, 0.3);
}

#send-btn:hover {
    opacity: 0.95;
    box-shadow: 0 6px 16px rgba(72, 199, 116, 0.5);
    transform: translateY(-1px) scale(1.02);
}

#send-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(72, 199, 116, 0.4);
}

/* ── MODAL OVERLAY ── */
#auth-modal,
#settings-modal,
#create-room-modal,
#unlock-room-modal,
#error-modal,
#camera-setup-panel,
#saved-clips-modal,
#streams-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fadeIn 0.15s ease;
}

.modal-card {
    position: relative;
    background: rgba(20, 20, 28, 0.6);
    /* Glassy background */
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    /* Sophisticated border */
    border-radius: 16px;
    padding: 32px 28px 28px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: slideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Springy animation */
}

@keyframes slideUp {
    from {
        transform: translateY(12px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    margin: 0;
    transition: color 0.2s;
}

.modal-close:hover {
    color: white;
}

.modal-title {
    margin: 0 0 20px;
    font-size: 18px;
    font-weight: 700;
}

/* ── MODAL TABS ── */
.modal-tabs {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 24px;
}

.modal-tab {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: rgba(255, 255, 255, 0.45);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin: 0;
}

.modal-tab.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* ── SAVED CLIPS STYLING ── */
.clip-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.clip-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateX(2px);
}

.clip-download-btn {
    padding: 6px !important;
    border-radius: 6px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
}

.clip-download-btn:hover {
    background: rgba(72, 199, 116, 0.2);
    color: #48c774;
}

/* ── FORM ELEMENTS ── */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    border-color: rgba(72, 199, 116, 0.5);
    box-shadow: 0 0 0 3px rgba(72, 199, 116, 0.1);
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.auth-error {
    font-size: 12px;
    color: #ff6b6b;
    margin-bottom: 12px;
    min-height: 16px;
}

.auth-success {
    font-size: 12px;
    color: #48c774;
    margin-bottom: 12px;
    min-height: 16px;
}

.auth-submit-btn {
    width: 100%;
    padding: 11px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #48c774, #00d4aa);
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin: 0;
    transition: opacity 0.2s, transform 0.1s, box-shadow 0.2s;
}

.auth-submit-btn:hover {
    opacity: 0.88;
    box-shadow: 0 0 16px rgba(72, 199, 116, 0.3);
}

.auth-submit-btn:active {
    transform: scale(0.98);
}

/* ── LANDING PAGE ── */
#landing {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0a0f;
}

#landing-user-header {
    position: absolute;
    top: 24px;
    right: 32px;
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 12px;
    border-radius: 12px;
    z-index: 10;
}

#landing::before {
    content: "";
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(72, 199, 116, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

#landing-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: start;
    gap: 40px;
    width: 100%;
    max-width: 1200px;
    padding: 0 24px;
    z-index: 1;
}

#landing-center {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

#landing-rooms-panel {
    grid-column: 3;
    width: 300px;
    flex: 0 0 300px;
    max-height: 70vh;
    overflow-y: auto;
    padding-top: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

#landing-rooms-panel:empty {
    display: none;
}

.landing-card {
    position: relative;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 32px 64px rgba(0, 0, 0, 0.4);
}

.landing-title {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 8px;
    background: linear-gradient(90deg, #48c774, #00d4aa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.35);
    margin: 0 0 36px;
}

.landing-input-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#room-input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    outline: none;
    text-align: center;
    letter-spacing: 1px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#room-input:focus {
    border-color: rgba(72, 199, 116, 0.5);
    box-shadow: 0 0 0 4px rgba(72, 199, 116, 0.1);
}

#room-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
    letter-spacing: 0;
}

#join-btn {
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #48c774, #00d4aa);
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 0;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
}

#join-btn:hover {
    opacity: 0.88;
    box-shadow: 0 0 20px rgba(72, 199, 116, 0.35);
}

#join-btn:active {
    transform: scale(0.98);
}

/* ── MOBILE ── */
@media (max-width: 900px) {
    body {
        flex-direction: column;
    }

    #left {
        flex: none;
        height: 60vh;
    }

    #right {
        width: 100%;
        min-width: unset;
        flex: none;
        height: 40vh;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    .stream-label {
        font-size: 12px;
    }

    .landing-card {
        margin: 16px;
        padding: 36px 24px;
    }

    .modal-card {
        margin: 16px;
        padding: 28px 20px 20px;
    }
}

/* Save Replay Buttons */
.save-replay-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.55);
    border-radius: 5px;
    padding: 5px 2px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.save-replay-btn:hover {
    background: rgba(0, 212, 170, 0.12);
    color: #00d4aa;
    border-color: rgba(0, 212, 170, 0.3);
}

.save-replay-btn:active {
    background: rgba(0, 212, 170, 0.2);
}

/* Landing Page — Room History */
.landing-rooms-section {
    margin-top: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
}

.landing-rooms-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: rgba(255, 255, 255, 0.3);
    margin-bottom: 10px;
}

.room-pill {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 6px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
}

.room-pill:last-child {
    margin-bottom: 0;
}

.room-pill:hover {
    background: rgba(0, 212, 170, 0.08);
    border-color: rgba(0, 212, 170, 0.25);
}

.room-pill-name {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
}

.room-pill-key {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
    font-family: monospace;
}

/* ── RESPONSIVE MOBILE LAYOUT (MAX 768px) ── */
@media (max-width: 768px) {

    /* Main App Layout */
    body {
        flex-direction: row;
        /* stays row since sidebar and left are siblings */
        height: 100vh;
        overflow: hidden;
    }

    /* Dissolve #sidebar wrapper so children are independently positioned on mobile */
    #sidebar {
        display: contents;
    }

    #left {
        flex: none;
        height: 100vh;
        /* Video takes full height */
        width: 100%;
        z-index: 1;
    }

    #manage-streams-btn {
        display: none !important;
    }

    #drawer-manage-streams-btn {
        display: flex !important;
    }

    /* Fixed top nav bar on mobile */
    #user-header {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 100;
        background: rgba(10, 10, 15, 0.9);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        border-left: none;
        border-right: none;
        padding: 6px 12px;
        min-height: 44px;
    }

    /* Sliding Drawer Overlay */
    #right {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 65vh;
        background: rgba(20, 20, 28, 0.85);
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        z-index: 50;

        /* Drawer is closed by default, leaving just the toggle visible */
        transform: translateY(calc(100% - 44px));
        transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        /* Springy animation */

        border-top: 1px solid rgba(255, 255, 255, 0.15);
        box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
        padding: 0;
        /* Remove default padding to let toggle touch edges */
    }

    /* JavaScript will add this class to open the drawer */
    #right.drawer-open {
        transform: translateY(0);
    }

    /* Drawer Toggle Button (Always visible at the bottom) */
    #mobile-drawer-toggle {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 44px;
        background: rgba(255, 255, 255, 0.04);
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        cursor: pointer;
        flex-shrink: 0;
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
    }

    #mobile-drawer-toggle .drawer-handle {
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 4px;
        margin-bottom: 4px;
    }

    #mobile-drawer-toggle span {
        font-size: 10px;
        color: rgba(255, 255, 255, 0.5);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    /* Tab Header Navigation */
    #mobile-tabs-header {
        display: flex !important;
        background: rgba(0, 0, 0, 0.3);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        flex-shrink: 0;
    }

    .mobile-tab {
        flex: 1;
        background: none;
        border: none;
        color: rgba(255, 255, 255, 0.4);
        padding: 14px 0;
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        border-bottom: 2px solid transparent;
        transition: color 0.2s, border-color 0.2s;
        margin: 0;
    }

    .mobile-tab.active {
        color: #48c774;
        border-bottom-color: #48c774;
    }

    /* Drawer Content Areas */
    .drawer-content-chat,
    .drawer-content-controls {
        flex: 1;
        overflow-y: auto;
        padding: 16px;
    }

    /* Default mobile state: controls are hidden until JS sets inline style */
    #drawer-controls-section:not([style*="display"]) {
        display: none !important;
    }

    /* Landing Page Layout */
    #landing-body {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 32px;
        padding-top: 80px;
        overflow-y: auto;
    }

    #landing-rooms-panel {
        width: 100%;
        max-width: 420px;
    }

    .landing-card {
        padding: 32px 24px;
    }

    #landing-user-header {
        top: 16px;
        right: 16px;
        left: 16px;
        justify-content: space-between;
    }

    #sidebar-toggle-btn {
        display: none !important;
    }
}