/* ═══════════════════════════════════════════════════════════════════════════
   Design tokens
═══════════════════════════════════════════════════════════════════════════ */
:root {
    --bg0:        #0d1117;   /* darkest – main chat bg        */
    --bg1:        #161b22;   /* sidebar / panels              */
    --bg2:        #21262d;   /* inputs, hover states          */
    --bg3:        #30363d;   /* borders                       */
    --txt0:       #e6edf3;   /* primary text                  */
    --txt1:       #8b949e;   /* secondary text / timestamps   */
    --accent:     #58a6ff;   /* links, highlights             */
    --accent-h:   #79c0ff;   /* accent hover                  */
    --green:      #3fb950;   /* success / active state        */
    --red:        #f85149;   /* errors / danger               */
    --yellow:     #d29922;   /* warnings                      */
    --sidebar-w:  240px;
    --panel-w:    210px;
    --topbar-h:   52px;
    --inputbar-h: 64px;
    --radius:     6px;
    --radius-lg:  12px;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    background: var(--bg0);
    color: var(--txt0);
}
ul { list-style: none; }
a  { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-h); text-decoration: underline; }
button { cursor: pointer; border: none; background: none; color: inherit; font: inherit; }
input  { font: inherit; color: inherit; }

/* ─── Utilities ──────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* Controls that only appear on narrow viewports (drawer toggles). Hidden on
   desktop; the mobile media query at the bottom reveals them. */
.mobile-only { display: none !important; }

/* Dim layer behind slide-in drawers (mobile only; toggled via .hidden). */
#drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 55;
}

/* Inline SVG icons inherit button colour and are sized by their container. */
.ctrl-btn svg,
.file-label svg { width: 19px; height: 19px; display: block; }
.icon-btn svg   { width: 16px; height: 16px; display: block; }
.video-fs-btn svg { width: 15px; height: 15px; display: block; }
.file-label span { display: flex; align-items: center; justify-content: center; }

/* ═══════════════════════════════════════════════════════════════════════════
   AUTH SCREEN
═══════════════════════════════════════════════════════════════════════════ */
#auth-view {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    height: 100dvh; /* avoid mobile URL-bar clipping where supported */
    padding: 16px;
    background: radial-gradient(ellipse at 60% 40%, #1a2744 0%, var(--bg0) 70%);
}

.auth-card {
    background: var(--bg1);
    border: 1px solid var(--bg3);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    width: min(360px, 100%);
    box-shadow: 0 24px 64px rgba(0,0,0,.5);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.brand-icon {
    font-size: 28px;
    color: var(--accent);
    line-height: 1;
}

.brand-name {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.5px;
}

.auth-tagline {
    color: var(--txt1);
    font-size: 12px;
    margin-bottom: 24px;
}

.auth-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--bg3);
}

.auth-tab {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--txt1);
    border-radius: var(--radius) var(--radius) 0 0;
    transition: color .15s;
}

.auth-tab:hover { color: var(--txt0); }

.auth-tab.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
    margin-bottom: -1px;
}

.auth-form { display: flex; flex-direction: column; gap: 10px; }

.field-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--txt1);
}

.hint {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--txt1);
    opacity: .8;
}

.field-input {
    background: var(--bg2);
    border: 1px solid var(--bg3);
    border-radius: var(--radius);
    padding: 9px 12px;
    width: 100%;
    outline: none;
    transition: border-color .15s;
}

.field-input:focus { border-color: var(--accent); }

.btn {
    padding: 9px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    transition: opacity .15s, background .15s;
    background: var(--bg2);
    color: var(--txt0);
    border: 1px solid var(--bg3);
}

.btn:hover { opacity: .85; }

.btn-primary {
    background: var(--accent);
    color: #000;
    border-color: transparent;
}

.btn-primary:hover { background: var(--accent-h); opacity: 1; }

.btn-send {
    background: var(--accent);
    color: #000;
    border-color: transparent;
    padding: 8px 18px;
    border-radius: var(--radius);
    font-weight: 600;
    transition: background .15s;
}

.btn-send:hover { background: var(--accent-h); }

.auth-error {
    margin-top: 6px;
    padding: 8px 12px;
    border-radius: var(--radius);
    background: rgba(248,81,73,.15);
    border: 1px solid rgba(248,81,73,.4);
    color: var(--red);
    font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   APP LAYOUT — three-column grid
═══════════════════════════════════════════════════════════════════════════ */
#app-view {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr var(--panel-w);
    height: 100vh;
    height: 100dvh; /* avoid mobile URL-bar clipping where supported */
    overflow: hidden;
}

/* ─── Left sidebar ───────────────────────────────────────────────────────── */
#sidebar {
    background: var(--bg1);
    border-right: 1px solid var(--bg3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 16px 14px 12px;
    border-bottom: 1px solid var(--bg3);
}

.sidebar-brand {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -.3px;
}

.sidebar-section {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--txt1);
}

.icon-btn {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--txt1);
    transition: color .15s, background .15s;
    line-height: 1;
}

.icon-btn:hover { color: var(--txt0); background: var(--bg2); }
.icon-btn.danger:hover { color: var(--red); }

.room-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    border-radius: var(--radius);
    margin: 1px 6px;
    cursor: pointer;
    transition: background .12s;
    color: var(--txt1);
}

.room-item:hover { background: var(--bg2); color: var(--txt0); }
.room-item.active { background: var(--bg2); color: var(--txt0); font-weight: 600; }

.room-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.room-item-count {
    font-size: 11px;
    background: var(--bg3);
    color: var(--txt1);
    border-radius: 10px;
    padding: 1px 7px;
    margin-left: 6px;
    flex-shrink: 0;
}

.sidebar-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--bg3);
    background: var(--bg0);
}

.sidebar-username {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
}

/* ─── Main area ──────────────────────────────────────────────────────────── */
#main-area {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg0);
}

.placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--txt1);
    gap: 12px;
}

.placeholder-icon { font-size: 48px; }

#room-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative; /* anchor for the drop overlay */
}

/* ─── Top bar ────────────────────────────────────────────────────────────── */

/* ─── Drag-and-drop overlay ──────────────────────────────────────────────── */
#drop-overlay {
    position: absolute;
    inset: 8px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(88, 166, 255, 0.08);
    border: 2px dashed var(--accent);
    border-radius: var(--radius-lg);
    pointer-events: none; /* let drag events pass through to #room-view */
}

.drop-overlay-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--accent);
    font-size: 15px;
    font-weight: 600;
    pointer-events: none;
}

.drop-overlay-icon {
    width: 52px;
    height: 52px;
    stroke: var(--accent);
    opacity: 0.9;
}

/* ─── Top bar ────────────────────────────────────────────────────────────── */
#top-bar {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--bg3);
    flex-shrink: 0;
    background: var(--bg0);
}

.room-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 700;
}

.room-hash { color: var(--txt1); }

.media-controls { display: flex; gap: 6px; }

.ctrl-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--txt1);
    background: transparent;
    transition: background .12s, color .12s;
}

.ctrl-btn:hover { background: var(--bg2); color: var(--txt0); }
.ctrl-btn.active { background: var(--green); color: #000; }
.ctrl-btn.muted  { background: var(--red); color: #fff; }
.ctrl-btn.danger:hover { background: var(--red); color: #fff; }

/* ─── Video grid ─────────────────────────────────────────────────────────── */
#video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 6px;
    padding: 8px;
    background: #000;
    border-bottom: 1px solid var(--bg3);
    max-height: 320px;
    overflow-y: auto;
    flex-shrink: 0;
}

.video-tile {
    position: relative;
    background: #111;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16/9;
}

.video-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-tile .video-label {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0,0,0,.65);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    pointer-events: none;
}

.mirrored { transform: scaleX(-1); }

/* Audio-only participant: hide the empty video frame and centre an avatar. */
.tile-avatar {
    position: absolute;
    inset: 0;
    margin: auto;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, .08);
}
.video-tile .tile-avatar       { display: none; } /* beats .avatar's display:flex */
.video-tile.audio-only         { background: var(--bg2); }
.video-tile.audio-only video   { display: none; }
.video-tile.audio-only .tile-avatar { display: flex; }

.video-tile video { cursor: pointer; }

/* ─── Focus / spotlight mode ──────────────────────────────────────────────── */
/* The focused stream fills its own row as a large stage; the others wrap below
   it as a thumbnail strip. */
#video-grid.has-focus {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    max-height: 78vh;
}
#video-grid.has-focus .video-tile {
    width: 124px;
    flex: 0 0 auto;
}
#video-grid.has-focus .video-tile.focused {
    order: -1;
    width: 100%;
    aspect-ratio: auto;
    height: 60vh;
}
#video-grid.has-focus .video-tile.focused video {
    object-fit: contain;
    background: #000;
}

/* Per-user volume slider, revealed on hover like the fullscreen button. */
.video-vol-ctrl {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,0,0,.65);
    border-radius: 4px;
    padding: 3px 8px;
    opacity: 0;
    transition: opacity .2s;
    z-index: 10;
}
.video-tile:hover .video-vol-ctrl { opacity: 1; }
.video-vol-icon { font-size: 12px; line-height: 1; }
.video-vol {
    width: 78px;
    accent-color: var(--accent);
    cursor: pointer;
}

.video-fs-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,.65);
    color: #fff;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s, background .15s;
    cursor: pointer;
    z-index: 10;
    flex-shrink: 0;
}

.video-tile:hover .video-fs-btn { opacity: 1; }
.video-fs-btn:hover { background: rgba(0,0,0,.85); }

/* ─── Fullscreen tile ─────────────────────────────────────────────────────── */
.video-tile:fullscreen {
    border-radius: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
}

.video-tile:fullscreen video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-tile:fullscreen .video-fs-btn { opacity: 1; }
.video-tile:fullscreen .video-label  { font-size: 14px; padding: 4px 12px; }
.video-tile:fullscreen video.mirrored { transform: scaleX(1); }

/* ─── Messages ───────────────────────────────────────────────────────────── */
#messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#messages::-webkit-scrollbar { width: 6px; }
#messages::-webkit-scrollbar-track { background: transparent; }
#messages::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 3px; }

.message {
    display: flex;
    gap: 10px;
    padding: 4px 6px;
    border-radius: var(--radius);
    transition: background .1s;
}

.message:hover { background: var(--bg2); }

.message.self .msg-username { color: var(--accent); }

.avatar {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    color: #fff;
}

.msg-body { flex: 1; min-width: 0; }

.msg-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 3px;
}

.msg-username {
    font-size: 13px;
    font-weight: 700;
    color: var(--txt0);
}

.msg-time {
    font-size: 11px;
    color: var(--txt1);
}

.msg-text {
    color: var(--txt0);
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
}

.msg-file {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: var(--bg2);
    border-radius: var(--radius);
    border: 1px solid var(--bg3);
    width: fit-content;
    margin-top: 2px;
}

.file-link { font-size: 13px; font-weight: 500; }
.file-size { font-size: 11px; color: var(--txt1); }

.file-thumb {
    display: block;
    margin-top: 6px;
    max-width: 320px;
    max-height: 240px;
    width: auto;
    height: auto;
    border-radius: var(--radius);
    border: 1px solid var(--bg3);
    background: var(--bg2);
    object-fit: contain;
    cursor: pointer;
    transition: filter .15s;
}
.file-thumb:hover { filter: brightness(1.08); }

.file-audio {
    display: block;
    margin-top: 6px;
    width: 100%;
    max-width: 360px;
    border-radius: var(--radius);
}

.file-video {
    display: block;
    margin-top: 6px;
    max-width: 360px;
    max-height: 240px;
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    border: 1px solid var(--bg3);
    background: #000;
}

/* ─── YouTube embed ──────────────────────────────────────────────────────── */
.yt-embed-wrap {
    position: relative;
    width: 100%;
    max-width: 480px;
    aspect-ratio: 16 / 9;
    margin-top: 8px;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    border: 1px solid var(--bg3);
}

.yt-embed {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ─── Upload preview ─────────────────────────────────────────────────────── */
#upload-preview {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 16px;
    background: var(--bg0);
    border-top: 1px solid var(--bg3);
    flex-shrink: 0;
}

.upload-preview-img {
    max-width: 240px;
    max-height: 160px;
    width: auto;
    height: auto;
    border-radius: var(--radius);
    border: 1px solid var(--bg3);
    background: var(--bg2);
    object-fit: contain;
    opacity: 0.85;
    animation: upload-preview-fade-in .15s ease;
}

.upload-preview-audio {
    max-width: 320px;
    opacity: 0.85;
    animation: upload-preview-fade-in .15s ease;
}

.upload-preview-video {
    max-width: 240px;
    max-height: 160px;
    width: auto;
    height: auto;
    border-radius: var(--radius);
    border: 1px solid var(--bg3);
    background: #000;
    object-fit: contain;
    opacity: 0.85;
    animation: upload-preview-fade-in .15s ease;
}

@keyframes upload-preview-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 0.85; transform: translateY(0); }
}

.upload-preview-label {
    font-size: 11px;
    color: var(--txt1);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* ─── Upload progress bar ────────────────────────────────────────────────── */
#upload-progress {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    min-width: 180px;
    flex: 1;
}

.upload-progress-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.upload-progress-name {
    font-size: 12px;
    color: var(--txt0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.upload-progress-pct {
    font-size: 12px;
    color: var(--txt1);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.upload-progress-track {
    height: 4px;
    background: var(--bg3);
    border-radius: 2px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 2px;
    transition: width .1s linear;
}


#input-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--bg3);
    background: var(--bg0);
    flex-shrink: 0;
}

.file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 18px;
    color: var(--txt1);
    transition: background .12s, color .12s;
    flex-shrink: 0;
}

.file-label:hover { background: var(--bg2); color: var(--txt0); }
.file-label input[type="file"] { display: none; }

#msg-input {
    flex: 1;
    background: var(--bg2);
    border: 1px solid var(--bg3);
    border-radius: var(--radius);
    padding: 9px 12px;
    outline: none;
    transition: border-color .15s;
}

#msg-input:focus { border-color: var(--accent); }

/* ─── Right users panel ──────────────────────────────────────────────────── */
#users-panel {
    background: var(--bg1);
    border-left: 1px solid var(--bg3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-heading {
    padding: 16px 14px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--txt1);
    border-bottom: 1px solid var(--bg3);
}

#user-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: var(--radius);
    margin: 1px 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--txt0);
    transition: background .12s;
}

.user-item:hover { background: var(--bg2); }

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════════════════════════════════ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-box {
    background: var(--bg1);
    border: 1px solid var(--bg3);
    border-radius: var(--radius-lg);
    padding: 28px 28px 24px;
    width: 340px;
    box-shadow: 0 12px 40px rgba(0,0,0,.5);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-title { font-size: 16px; font-weight: 700; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOASTS
═══════════════════════════════════════════════════════════════════════════ */
#toasts {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    z-index: 200;
    pointer-events: none;
}

.toast {
    padding: 10px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    max-width: 320px;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity .25s, transform .25s;
    pointer-events: auto;
    border: 1px solid transparent;
}

.toast.visible { opacity: 1; transform: translateX(0); }

.toast-info    { background: var(--bg2); border-color: var(--bg3); color: var(--txt0); }
.toast-success { background: rgba(63,185,80,.15); border-color: rgba(63,185,80,.4); color: var(--green); }
.toast-error   { background: rgba(248,81,73,.15); border-color: rgba(248,81,73,.4); color: var(--red); }

/* ═══════════════════════════════════════════════════════════════════════════
   Scrollbar (non-webkit)
═══════════════════════════════════════════════════════════════════════════ */
* { scrollbar-width: thin; scrollbar-color: var(--bg3) transparent; }

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE  (≤ 768px)
   The three-column grid collapses to a single column (the chat). The sidebar
   and users panel become off-canvas drawers slid in over a backdrop.
═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* Only the main area stays in flow; the panels are taken out via fixed. */
    #app-view { grid-template-columns: 1fr; }

    #sidebar,
    #users-panel {
        position: fixed;
        top: 0;
        bottom: 0;
        z-index: 60;
        transition: transform .25s ease;
        will-change: transform;
    }

    #sidebar {
        left: 0;
        width: 82%;
        max-width: 300px;
        transform: translateX(-100%);
    }

    #users-panel {
        right: 0;
        width: 72%;
        max-width: 260px;
        transform: translateX(100%);
    }

    /* .open is toggled from app.js when a drawer button is tapped. */
    #sidebar.open,
    #users-panel.open {
        transform: translateX(0);
        box-shadow: 0 0 48px rgba(0, 0, 0, .6);
    }

    /* Reveal the drawer-toggle buttons that are hidden on desktop. */
    .mobile-only { display: flex !important; }

    /* Keep the top bar compact so all controls fit a narrow screen. */
    #top-bar { padding: 0 10px; gap: 8px; }
    .media-controls { gap: 2px; }
    .ctrl-btn { width: 38px; height: 38px; } /* comfortable touch targets */
    .room-title { min-width: 0; flex: 1; }
    #room-name-display {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Video tiles stack more densely and never eat the whole screen. */
    #video-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        max-height: 38dvh;
    }

    #messages { padding: 10px 12px; }
    #input-bar { padding: 8px 10px; gap: 6px; }
}
