/* broadcast — rules used only by this feature, split out of the global stylesheets so other routes do not
   download them. Loaded with the feature (public/features.json), directly after style.css in the cascade.
   Split by class/id ownership with cascade-order checks; edit freely. */
/*  ── from style.css ──  */
.bc-ctrl-btn-active {
    background: var(--accent-strong, var(--accent, #8b5cf6)) !important;
    color: var(--on-accent-strong, var(--on-accent, #fff)) !important;
}
.bc-call-explainer {
    margin: 10px 0 0;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--text-secondary, #a0a0a0);
}
.bc-media-pip {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 8px;
    overflow: hidden;
}
.bc-media-pip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary, var(--bg-secondary));
}
.bc-media-pip-actions { display: flex; gap: 4px; flex-shrink: 0; }
.bc-media-pip-player iframe,
.bc-media-pip-player video,
.bc-media-pip-player audio {
    width: 100%;
    height: 100%;
    display: block;
    border: none;
}
.bc-media-pip-player audio { min-height: 60px; background: #111; }
.bc-media-pip-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    gap: 8px;
}
.bc-media-pip-track {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bc-media-pip-requester {
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.bc-media-pip-btns {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.bc-pip-btn {
    background: var(--bg-tertiary, var(--bg-input));
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.82rem;
    transition: background 0.15s;
}
.bc-pip-btn:hover { background: var(--accent-strong, var(--accent, #8b5cf6)); color: var(--on-accent-strong, var(--on-accent, #fff)); }
.bc-media-pip-queue {
    border-top: 1px solid var(--border);
    padding: 8px 12px;
    max-height: 180px;
    overflow-y: auto;
    font-size: 0.82rem;
}
.bc-media-pip-queue-empty {
    color: var(--text-secondary);
    text-align: center;
    padding: 6px 0;
}
.bc-pip-queue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
    gap: 8px;
}
.bc-pip-queue-item:last-child { border-bottom: none; }
.bc-pip-queue-user {
    color: var(--text-secondary);
    font-size: 0.78rem;
    flex-shrink: 0;
}
.bc-workspace {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--surface);
    margin-top: 16px;
}
.bc-ws-sidebar {
    width: 260px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: color-mix(in srgb, var(--surface) 70%, var(--bg));
}
.bc-ws-sidebar-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-secondary);
    gap: 8px;
}
.bc-ws-add-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    flex-shrink: 0;
}
.bc-ws-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}
.bc-ws-empty-hint {
    padding: 16px 14px;
    font-size: 0.85rem;
    line-height: 1.5;
}
.bc-ws-item-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-muted);
    opacity: 0.4;
}
.bc-ws-item-name {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bc-ws-item-meta {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 2px;
    flex-wrap: wrap;
}
.bc-ws-item-proto {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    border-radius: 3px;
    padding: 1px 5px;
}
.bc-ws-item-slug {
    font-size: 0.72rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 120px;
}
.bc-ws-live-dot {
    font-size: 0.7rem;
    color: var(--live-color, #e53935);
    font-weight: 600;
}
.bc-ws-item-del {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}
.bc-ws-item:hover .bc-ws-item-del { display: flex; align-items: center; }
.bc-ws-item-del:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.bc-ws-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
    text-align: center;
}
.bc-ws-panel-hd {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 18px 20px 12px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
.bc-ws-slug {
    font-size: 0.78rem;
    display: block;
}
.bc-ws-live-badge-hd {
    flex-shrink: 0;
    margin-top: 4px;
}
.bc-ws-live-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 20px;
    background: color-mix(in srgb, var(--live-color, #e53935) 10%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--live-color, #e53935) 20%, transparent);
    flex-wrap: wrap;
}
.bc-ws-live-banner-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.bc-ws-live-banner-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bc-ws-uptime-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.bc-ws-save-status {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
}
.bc-ws-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-start;
}
.bc-ws-quality {
    margin: 0 0 12px;
    padding: 10px 12px;
    background: color-mix(in srgb, var(--surface) 50%, var(--bg));
    border: 1px solid var(--border);
    border-radius: 8px;
}
.bc-ws-quality summary::-webkit-details-marker { display: none; }
.bc-ws-quality-inner {
    margin-top: 10px;
    gap: 10px;
}
.bc-ws-device-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.bc-ws-golive-btn {
    width: 100%;
    margin-top: 12px;
    font-size: 1rem;
    padding: 14px;
}
.bc-ws-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.bc-ws-session {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: color-mix(in srgb, var(--surface) 50%, var(--bg));
    border: 1px solid var(--border);
    border-radius: 8px;
    gap: 12px;
}
.bc-ws-session-title {
    font-size: 0.88rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}
.bc-ws-session-meta {
    display: flex;
    gap: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 3px;
    flex-wrap: wrap;
}
.bc-ws-session-right {
    flex-shrink: 0;
}
@media (max-width: 680px) {
    .bc-workspace {
        flex-direction: column;
        min-height: unset;
    }
    .bc-ws-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .bc-ws-list {
        display: flex;
        flex-direction: row;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        gap: 8px;
        padding: 10px 12px;
    }
    .bc-ws-item {
        flex: 0 0 auto;
        width: auto;
        max-width: 200px;
        padding: 8px 10px;
    }
    .bc-ws-item-name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 130px;
    }
    .bc-ws-item-meta { display: none; }
    .bc-ws-item-del { opacity: 0.6; }
    .bc-ws-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0 12px;
    }
    .bc-ws-tab {
        white-space: nowrap;
        padding: 10px 12px;
    }
    .bc-top-tab { padding: 11px 10px; font-size: 0.9rem; }
    .bc-ws-panel-hd {
        padding: 14px 14px 10px;
    }
    .bc-ws-save-bar {
        padding: 8px 14px;
    }
    .bc-ws-cli-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .bc-ws-cli-tab {
        white-space: nowrap;
        font-size: 0.78rem;
        padding: 6px 10px;
    }
    .bc-ws-row {
        flex-direction: column;
        gap: 8px;
    }
    .bc-ws-screen-info {
        font-size: 0.78rem;
    }
}
/*  ── from broadcast.css ──  */
.broadcast-layout {
    display: flex;
    height: calc(100vh - var(--navbar-h));
    height: calc(100dvh - var(--navbar-h));
    gap: 16px;
    padding: 16px;
}

.broadcast-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 20px;
    overflow-x: hidden;
    overflow-y: auto;
    background: rgba(22,22,26,0.72);
    box-shadow: var(--shadow-soft, 0 12px 40px rgba(0,0,0,0.28));
}

.broadcast-page-tabs-container {
    display: flex;
    gap: 2px;
    align-items: stretch;
}

.broadcast-page-tab-btn:hover {
    color: var(--text-primary);
}

.broadcast-page-tab-btn.active {
    color: var(--accent);
}
.broadcast-tab-content {
    display: none;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 20px;
}

.bc-settings-group {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 20px;
}

.bc-settings-group .form-group {
    margin-bottom: 12px;
}

.bc-settings-group .form-group:last-child {
    margin-bottom: 0;
}

.bc-settings-actions #bc-settings-save-status {
    margin-left: auto;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .broadcast-page-tabs-container {
        gap: 0;
    }
}

@media (max-width: 480px) {

    .bc-settings-group {
        padding: 12px;
    }
}

#bc-browser-broadcast {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.bc-video-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.bc-stats-overlay .bc-stat-label {
    color: var(--text-muted);
    min-width: 70px;
}

.bc-status-good { background: var(--success); color: #fff; }
.bc-status-warn { background: var(--warning); color: #000; }
.bc-status-bad { background: var(--danger); color: #fff; }
.bc-info-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.bc-info-bar .bc-info-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.bc-info-bar .bc-info-item strong {
    color: var(--text-primary);
}
.bc-perm-request {
    text-align: center;
    padding: 16px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.02);
    margin-bottom: 8px;
}

.bc-perm-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}

.bc-perm-request button {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}
.bc-source-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.bc-source-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 10px 6px 8px;
    background: var(--surface, rgba(255,255,255,0.04));
    border: 2px solid var(--border);
    border-radius: var(--radius, 8px);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.78rem;
    text-align: center;
    min-height: 72px;
}

.bc-source-btn:hover {
    border-color: var(--accent);
    background: rgba(255,255,255,0.06);
}

.bc-source-btn.selected {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb, 241,196,15), 0.12);
    color: var(--accent);
}
@media (max-width: 480px) {
    .bc-source-picker {
        grid-template-columns: repeat(2, 1fr);
    }
}
.bc-video-container:hover .bc-pip-controls { opacity: 1; }
.bc-controls {
    padding: 16px;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent 65%);
}

.bc-ctrl-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.bc-ctrl-btn {
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-hover);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.16);
}

.bc-ctrl-btn:hover {
    border-color: var(--accent-dark);
    background: var(--bg-tertiary);
}

.bc-ctrl-btn:active {
    background: var(--accent);
    color: #000;
}

.bc-ctrl-btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
    font-weight: 700;
}

.bc-ctrl-btn-danger:hover {
    background: #c0392b;
}

.bc-ctrl-btn-active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    font-weight: 700;
}

.bc-ctrl-btn-active:hover {
    background: var(--accent-dark);
}

.bc-camera-sheet-panel {
    width: min(560px, 100%);
    max-height: min(72vh, 620px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 22px;
    border: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(180deg, rgba(24,24,30,0.98), rgba(16,16,22,0.98));
    box-shadow: 0 30px 80px rgba(0,0,0,0.45);
}

.bc-camera-sheet-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.bc-camera-sheet-close {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
}

.bc-camera-sheet-close:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.18);
}

.bc-camera-sheet-list {
    overflow-y: auto;
    padding: 12px 14px 16px;
    display: grid;
    gap: 10px;
}

.bc-camera-sheet-empty {
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.bc-camera-choice:hover {
    transform: translateY(-1px);
    border-color: rgba(241, 196, 15, 0.45);
    background: rgba(241, 196, 15, 0.08);
    box-shadow: 0 14px 30px rgba(0,0,0,0.2);
}

.bc-camera-choice.is-active {
    border-color: rgba(241, 196, 15, 0.9);
    background: rgba(241, 196, 15, 0.12);
    box-shadow: 0 0 0 1px rgba(241, 196, 15, 0.45);
}

.bc-camera-choice.is-loading {
    opacity: 0.7;
    pointer-events: none;
}

.bc-camera-choice-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--accent);
    background: rgba(241, 196, 15, 0.1);
    border: 1px solid rgba(241, 196, 15, 0.18);
}

.bc-camera-choice-body {
    min-width: 0;
    flex: 1;
}

.bc-camera-choice-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-weight: 700;
    font-size: 0.94rem;
}

.bc-camera-choice-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.45;
    word-break: break-word;
}

.bc-camera-choice-badge {
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(46, 204, 113, 0.16);
    color: #7ef0a7;
    white-space: nowrap;
}

.bc-camera-choice-arrow {
    color: var(--text-muted);
    font-size: 0.9rem;
}
.bc-restream-control {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    margin-bottom: 16px;
}

.bc-restream-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    font-size: 0.82rem;
}
/* Second line under a destination: uptime, fps/bitrate, the last error, retry countdown. */
.bc-restream-detail {
    flex-basis: 100%;
    padding-left: 30px;
    font-size: 0.74rem;
    color: var(--text-secondary);
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.bc-restream-err { color: var(--danger, #e74c3c); }
.bc-restream-warn { color: var(--warning, #f39c12); }
.bc-restream-transport {
    margin-left: 6px;
    padding: 1px 5px;
    border-radius: 6px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    vertical-align: 1px;
}

.bc-restream-platform-icon {
    width: 20px;
    text-align: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.bc-restream-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.bc-restream-status-badge {
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}
.bc-restream-status-live { background: rgba(46, 204, 113, 0.15); color: var(--success, #2ecc71); }
.bc-restream-status-starting { background: rgba(243, 156, 18, 0.15); color: var(--warning, #f39c12); }
.bc-restream-status-error { background: rgba(231, 76, 60, 0.15); color: var(--danger, #e74c3c); }
.bc-restream-status-idle { background: var(--bg-tertiary); color: var(--text-secondary); }
.bc-restream-status-failed { background: rgba(231, 76, 60, 0.15); color: var(--danger, #e74c3c); }

.bc-restream-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
}

.bc-restream-dest-card .bc-restream-name {
    flex: 1;
    min-width: 0;
}
.bc-rs-control {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    margin-bottom: 16px;
}

.bc-rs-stream-picker {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.bc-rs-stream-picker label {
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}
.bc-rs-stream-picker select {
    padding: 4px 8px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.82rem;
    cursor: pointer;
}

.bc-rs-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.bc-rs-status {
    font-size: 0.82rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.bc-rs-live    { color: var(--success, #2ecc71); }
.bc-rs-connecting { color: var(--warning, #f39c12); }
.bc-rs-error   { color: var(--danger, #e74c3c); }
.bc-rs-ready   { color: var(--text-secondary, #888); }
.bc-rs-off     { color: var(--text-muted, #555); }

.bc-ctrl-btn-sm {
    padding: 4px 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-hover);
    color: var(--text-primary);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.bc-ctrl-btn-sm:hover {
    border-color: var(--accent-dark);
    background: var(--bg-tertiary);
}
.bc-settings-group {
    margin-bottom: 20px;
}

.bc-settings-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent);
    padding: 8px 0;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.bc-setting-row {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    gap: 12px;
}

.bc-setting-row:last-child {
    border-bottom: none;
}

.bc-setting-label {
    min-width: 160px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.bc-setting-control {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bc-setting-control select:focus {
    border-color: var(--accent-dark);
}

.bc-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.bc-toggle-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: 0.2s;
}

.bc-toggle input:checked + .bc-toggle-slider::before {
    transform: translateX(20px);
    background: var(--accent);
}
@media (max-width: 1180px) {
    .broadcast-layout {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - var(--navbar-h));
        min-height: calc(100dvh - var(--navbar-h));
    }
    .broadcast-main {
        min-height: 0;
    }
}
@media (max-width: 768px) {

    .broadcast-main {
        flex: 1;
        min-height: 0; /* allow shrink in flex */
        border-radius: 0;
        border: none;
        overflow-y: auto;
        /* .broadcast-layout pins its bottom padding to 0, so this scroller ran to the very edge of
           the viewport and whatever sat last in it — "Add Destination", at the end of the settings
           panel — ended up inside the home-indicator strip, where the system takes the touch. The
           inset plus a little room means the end of the list can always be scrolled clear of it. */
        padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
        scroll-padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    }
    .bc-video-container video {
        max-height: clamp(240px, 46dvh, 460px);
    }
    .bc-video-container.bc-vertical-preview {
        min-height: clamp(300px, 48dvh, 520px);
        max-height: clamp(320px, 62dvh, 640px);
    }
    .bc-video-container.bc-vertical-preview video {
        max-height: clamp(320px, 62dvh, 640px);
    }

    .bc-info-bar {
        gap: 10px;
        padding: 10px max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
    }

    .bc-controls {
        padding: 12px max(12px, env(safe-area-inset-right)) calc(22px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    }

    .bc-ctrl-buttons {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .bc-ctrl-btn {
        justify-content: center;
    }

    .bc-rs-control {
        flex-direction: column;
        align-items: stretch;
    }
    .bc-rs-status-row {
        margin-left: 0;
        justify-content: space-between;
    }
    .bc-restream-row {
        flex-wrap: wrap;
    }
    .bc-restream-actions {
        margin-left: 0;
    }

    .bc-setting-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .bc-setting-label {
        min-width: unset;
        margin-bottom: 4px;
    }
}
@media (max-width: 768px) and (orientation: portrait) {
    .bc-video-container video {
        max-height: clamp(260px, 48dvh, 460px);
    }
    .bc-video-container.bc-vertical-preview {
        min-height: clamp(320px, 52dvh, 560px);
        max-height: clamp(360px, 68dvh, 700px);
    }
    .bc-video-container.bc-vertical-preview video {
        max-height: clamp(360px, 68dvh, 700px);
    }
    .bc-ctrl-buttons {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    .bc-info-bar {
        padding: 6px 10px;
        gap: 6px;
    }
}
@media (max-height: 500px) and (min-width: 700px) and (max-width: 1100px) {
    .broadcast-main {
        flex: 1;
        min-width: 0;
        border-radius: 0;
        border: none;
    }
}
.bc-tabs-bar {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 8px;
    height: 44px;
    flex-shrink: 0;
    overflow: hidden;
}

.bc-tabs-scroll {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 4px 0;
    flex: 1;
    min-width: 0;
}

.bc-tabs-scroll::-webkit-scrollbar { display: none; }

.bc-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.82rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font);
}

.bc-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.bc-tab.active {
    background: var(--accent-dark);
    color: #fff;
    font-weight: 600;
}

.bc-tab .bc-tab-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--live-red);
    flex-shrink: 0;
    animation: pulse-live 1.5s infinite;
}
.bc-tab .bc-tab-dot-broadcasting {
    width: 8px;
    height: 8px;
    background: #00e676;
    box-shadow: 0 0 6px rgba(0, 230, 118, 0.6);
    animation: pulse-live 1.2s infinite;
}

.bc-tab .bc-tab-viewers {
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    background: var(--live-red, #e53935);
    padding: 2px 7px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
}

.bc-tab.active .bc-tab-viewers {
    background: rgba(255,255,255,0.22);
}

.bc-tab-add {
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
    margin-left: 4px;
}

.bc-tab-add:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(241, 196, 15, 0.06);
}

.bc-tab .bc-tab-close {
    margin-left: 2px;
    opacity: 0;
    font-size: 0.7rem;
    padding: 2px 4px;
    border-radius: 4px;
    transition: opacity 0.15s, background 0.15s;
    color: inherit;
}

.bc-tab:hover .bc-tab-close {
    opacity: 0.6;
}

.bc-tab .bc-tab-close:hover {
    opacity: 1;
    background: rgba(231, 76, 60, 0.3);
    color: var(--danger);
}
#bc-stream-manager {
    padding: 24px;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

#bc-stream-manager h2 {
    font-size: 1.3rem;
    color: var(--accent);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
#bc-existing-streams {
    display: none;
}
.bc-active-streams-section {
    background: rgba(196, 181, 253, 0.08);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
}

#bc-existing-streams h3 {
    font-size: 1.05rem;
    color: var(--text-primary);
    margin-bottom: 12px;
}
.bc-streams-list {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 520px;
    overflow-y: auto;
}

.bc-stream-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s;
}

.bc-stream-item:hover {
    border-color: var(--accent-dark);
}

.bc-stream-item.bc-stream-live {
    border-color: var(--live-red);
    background: rgba(231, 76, 60, 0.05);
}

.bc-stream-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bc-stream-info .muted {
    font-size: 0.8rem;
}

.bc-stream-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bc-create-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}
.bc-instructions-intro {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: rgba(46, 204, 113, 0.06);
    border: 1px solid rgba(46, 204, 113, 0.18);
}
.bc-instructions-panel {
    padding: 24px;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
}

.bc-instructions-panel ol,
.bc-instructions-panel ul {
    padding-left: 20px;
    margin: 8px 0 16px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

.bc-instructions-panel li {
    margin-bottom: 4px;
}

.bc-code-block code {
    color: var(--text-primary);
    user-select: all;
}

.bc-code-copy:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.bc-secret-token-row code {
    flex: 1 1 100%;
    min-width: 0;
    display: block;
    overflow-x: auto;
    word-break: break-all;
    white-space: pre-wrap;
    padding-right: 0;
}

.bc-secret-token-row button {
    flex: 0 0 auto;
}
.bc-app-guide {
    margin-top: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    overflow: hidden;
}
.bc-app-guide summary::marker { display: none; content: ''; }

.bc-app-guide summary:hover {
    background: var(--bg-hover);
}

.bc-app-guide[open] summary {
    border-bottom: 1px solid var(--border);
}

.bc-app-guide-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.bc-app-guide-badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--accent);
    color: var(--bg-primary);
    margin-left: auto;
}

.bc-app-guide-body {
    padding: 16px;
}

.bc-app-guide-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}

.bc-app-guide-desc a {
    color: var(--accent);
    text-decoration: underline;
}

.bc-app-guide-body ol {
    padding-left: 20px;
    margin: 8px 0 16px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

.bc-app-guide-body li {
    margin-bottom: 6px;
}

.bc-inline-code {
    display: inline;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px 8px;
    user-select: all;
    word-break: break-all;
}

.btn-inline-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 6px;
    margin-left: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.15s;
    vertical-align: middle;
}

.btn-inline-copy:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.bc-app-guide-tips {
    margin-top: 12px;
    padding: 12px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.83rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.bc-app-guide-tips ul {
    padding-left: 18px;
    margin: 0;
    font-size: 0.82rem;
}

.bc-app-guide-tips li {
    margin-bottom: 4px;
}

.bc-app-guide-tips code {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    background: var(--bg-tertiary);
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    color: var(--accent);
}
.bc-page-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: -8px 0 20px;
    line-height: 1.5;
}

/* Guests get the sign-in gate and nothing else of the Go Live workspace (broadcast.js). */
#bc-stream-manager.bc-guest > :not(h2):not(.bc-signin-gate) { display: none !important; }
.bc-signin-gate {
    max-width: 520px;
    margin: 24px auto;
    padding: 28px 20px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    background: var(--bg-secondary);
}
.bc-signin-gate[hidden] { display: none; }
.bc-signin-gate-icon { font-size: 2rem; color: var(--accent); margin-bottom: 12px; }
.bc-signin-gate h3 { margin: 0 0 8px; }
.bc-signin-gate p { color: var(--text-secondary); line-height: 1.5; margin: 0 0 16px; overflow-wrap: anywhere; }
.bc-signin-gate .bc-signin-gate-fine { font-size: 0.8rem; color: var(--text-muted); margin: 12px 0 0; }

.bc-step-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.bc-method-card.selected .bc-method-best {
    color: var(--accent);
    border-top-color: rgba(241, 196, 15, 0.2);
}
.bc-create-reassurance {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 10px;
    line-height: 1.4;
}
.bc-create-section .form-group {
    margin-bottom: 16px;
}
@media (max-width: 768px) {

    .bc-stream-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .bc-stream-actions {
        width: 100%;
        justify-content: flex-end;
    }

    #bc-stream-manager,
    .bc-instructions-panel {
        padding: 16px;
    }
}

@media (max-width: 520px) {
    .bc-ctrl-buttons {
        grid-template-columns: 1fr;
    }

    .bc-camera-sheet-panel {
        width: 100%;
        max-height: 84vh;
        border-radius: 22px 22px 0 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
    }

    .bc-tabs-bar {
        height: auto;
        padding: 8px;
        gap: 8px;
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .bc-tab-add {
        width: 100%;
        margin-left: 0;
        justify-content: center;
    }

    .bc-stream-actions {
        width: 100%;
        flex-wrap: wrap;
    }
}
@media (max-width: 480px) {
    .broadcast-main { border-radius: 0; }
    .bc-video-container video { max-height: 42dvh; }
    .bc-video-container.bc-vertical-preview { min-height: 300px; max-height: 58dvh; }
    .bc-video-container.bc-vertical-preview video { max-height: 58dvh; }
    .bc-info-bar { padding: 6px 8px; gap: 6px; font-size: 0.78rem; }
    .bc-ctrl-btn { padding: 6px 8px; font-size: 0.75rem; gap: 4px; }
    .bc-rs-control { padding: 4px 8px; gap: 6px; font-size: 0.75rem; }
    .bc-restream-control { padding: 4px 8px; gap: 4px; font-size: 0.75rem; }
    .bc-ctrl-btn-sm { padding: 3px 6px; font-size: 0.7rem; }
    .bc-setting-label { font-size: 0.78rem; }
    #bc-stream-manager,
    .bc-instructions-panel { padding: 10px; }
}
.bc-rtmp-status {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 18px; border-radius: var(--radius);
    margin: 16px 0;
    transition: all 0.4s ease;
}
.bc-rtmp-status.waiting {
    background: rgba(241, 196, 15, 0.08);
    border: 1px solid rgba(241, 196, 15, 0.3);
}
.bc-rtmp-status.receiving {
    background: rgba(46, 204, 113, 0.08);
    border: 1px solid rgba(46, 204, 113, 0.3);
}
.bc-rtmp-status-icon {
    font-size: 1.4rem; flex-shrink: 0;
}
.bc-rtmp-status.waiting .bc-rtmp-status-icon { color: #f1c40f; }
.bc-rtmp-status.receiving .bc-rtmp-status-icon { color: #2ecc71; }
.bc-rtmp-status-text {
    display: flex; flex-direction: column; gap: 2px;
}
.bc-live-settings-panel {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.bc-live-settings-panel .bc-settings-group {
    margin-bottom: 16px;
}
.bc-disconnect-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: color-mix(in srgb, var(--danger) 15%, var(--bg-secondary));
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    color: var(--danger);
    font-size: 0.85rem;
    font-weight: 600;
    margin: 8px 16px;
    animation: bc-alert-pulse 2s ease-in-out infinite;
}
.bc-rtmp-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.bc-ext-live-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 16px;
    background: var(--surface-raised);
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: var(--radius);
    flex-wrap: wrap;
}
.bc-ext-live-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.bc-ext-live-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.bc-ext-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #dc2626;
    color: #fff;
    padding: 3px 10px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.bc-ext-live-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}
.bc-live-settings-anchor {
    /* placeholder container for the shared live settings panel */
}
.bc-ws-live-proto-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    border-radius: 3px;
    padding: 2px 6px;
    align-self: center;
}
.bc-ws-endpoint-section {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}
.bc-ws-endpoint-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.bc-ws-endpoint-note {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0 0 12px;
    line-height: 1.5;
}
.bc-ws-key-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.bc-ws-key-display {
    display: flex;
    gap: 4px;
    align-items: center;
    flex: 1;
    min-width: 0;
}
.bc-ws-key-toggle,
.bc-ws-regen-btn {
    flex-shrink: 0;
}
.bc-ws-method-info {
    background: color-mix(in srgb, var(--accent) 4%, var(--surface));
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}
.bc-ws-method-info-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}
.bc-ws-method-info-row:last-of-type {
    margin-bottom: 0;
}
.bc-ws-method-info-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 80px;
    flex-shrink: 0;
    padding-top: 3px;
}
.bc-ws-method-info-val {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}
.bc-ws-method-info-val code {
    font-size: 0.78rem;
    word-break: break-all;
    flex: 1;
    background: color-mix(in srgb, var(--border) 30%, transparent);
    padding: 2px 5px;
    border-radius: 3px;
}
.bc-ws-method-info-note {
    font-size: 0.82rem;
    color: var(--text-muted);
    flex: 1;
    padding-top: 3px;
}
.bc-ws-method-info-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 8px 0 0;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
.bc-ws-device-local-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    margin-bottom: 10px;
    padding: 6px 10px;
    background: color-mix(in srgb, var(--accent) 6%, transparent);
    border-radius: 6px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}
.bc-ws-save-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 80px;
    text-align: right;
}
.bc-ws-dirty { color: var(--warning, #e6a700); }
.bc-ws-saving { color: var(--text-muted); }
.bc-ws-saved { color: var(--success, #2ecc71); }
.bc-ws-save-error { color: var(--danger, #e74c3c); }
.bc-ws-panel-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.bc-ws-panel-title { display: flex; flex-direction: column; gap: 2px; }
.bc-ws-slug { font-size: 0.78rem; }
.bc-ws-live-badge-hd { flex-shrink: 0; }
.bc-ws-profile-section { margin-bottom: 20px; }
.bc-ws-save-btn { min-width: 70px; }
.bc-ws-endpoint-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}
.bc-ws-endpoint-note {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.bc-ws-key-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.bc-ws-key-display {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}
.bc-ws-key-toggle { padding: 4px 6px; }
.bc-ws-regen-btn { white-space: nowrap; }
.bc-ws-golive-section { margin-bottom: 20px; }
.bc-ws-golive-btn {
    width: 100%;
    margin-top: 6px;
    font-size: 1.05rem;
    padding: 10px 20px;
}
.bc-ws-device-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.bc-ws-device-row .form-group { min-width: 140px; }
.bc-ws-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.bc-ws-save-bar .bc-ws-save-status {
    font-size: 0.82rem;
    white-space: nowrap;
}
.bc-ws-save-bar .bc-ws-save-btn {
    min-width: 120px;
}
.bc-ws-save-bar .bc-ws-discard-btn {
    min-width: 80px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.bc-ws-save-bar .bc-ws-discard-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
}
.bc-ws-confirm-dialog {
    background: var(--surface, #1e1e22);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 16px 64px rgba(0,0,0,0.5);
}
.bc-ws-confirm-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.bc-ws-confirm-actions .btn { min-width: 90px; }
.bc-ws-quality,
.bc-ws-screen-quality { margin: 8px 0 4px; }
.bc-ws-quality summary i,
.bc-ws-screen-quality summary i { margin-right: 4px; }
.bc-ws-quality-inner { margin-top: 8px; }
.bc-ws-slot-settings {
    margin: 12px 0 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.bc-ws-slot-settings-inner {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.bc-ws-slot-settings .bc-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    cursor: pointer;
}
.bc-ws-restream-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.bc-ws-restream-card {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    transition: opacity 0.15s;
}
.bc-ws-restream-card.disabled {
    opacity: 0.5;
}
.bc-ws-restream-card-hd {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bc-ws-restream-platform {
    font-weight: 600;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.bc-ws-restream-badges {
    display: flex;
    gap: 6px;
    margin-left: auto;
    font-size: 0.78rem;
}
.bc-ws-restream-badge {
    color: var(--text-secondary);
}
.bc-ws-restream-actions {
    display: flex;
    gap: 4px;
    margin-left: 4px;
}
.bc-ws-restream-actions .btn {
    padding: 2px 6px;
    font-size: 0.75rem;
}
.bc-ws-restream-card-info {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
}
.bc-ws-restream-card.cooling {
    border-color: color-mix(in srgb, var(--warning, #e0a800) 55%, var(--border));
    background: color-mix(in srgb, var(--warning, #e0a800) 8%, var(--bg-tertiary));
}
.bc-ws-restream-cooldown {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding: 7px 9px;
    border-radius: 5px;
    background: color-mix(in srgb, var(--warning, #e0a800) 14%, transparent);
    color: var(--text-secondary);
    font-size: 0.76rem;
    line-height: 1.35;
}
.bc-ws-restream-cooldown .btn {
    padding: 3px 9px;
    font-size: 0.74rem;
    white-space: nowrap;
}
.bc-ws-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    background: color-mix(in srgb, var(--surface) 80%, var(--bg));
}
.bc-ws-tab {
    padding: 10px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.bc-ws-tab:hover { color: var(--text-primary); }
.bc-ws-tab-panel { display: none; }
.bc-top-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
}
.bc-top-tab {
    flex: 1;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}
.bc-top-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--live-red, #e74c3c);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    margin-left: 2px;
}
.bc-top-tab-panel { display: none; }
.bc-ws-live-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding: 12px 0;
}
.bc-ws-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    min-width: 80px;
}
.bc-ws-stat-val {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}
.bc-ws-stat-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.bc-ws-autodetect {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: color-mix(in srgb, var(--accent) 6%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border));
    border-radius: 8px;
    margin: 12px 0 16px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.bc-ws-autodetect .bc-ws-autodetect-pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    animation: ws-autodetect-pulse 2s ease infinite;
}
.bc-ws-popout-chat-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
}
.bc-ws-live-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: color-mix(in srgb, var(--danger, #e74c3c) 10%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--danger, #e74c3c) 30%, var(--border));
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.bc-ws-live-banner-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.bc-ws-live-banner-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bc-ws-uptime-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.bc-ws-live-proto-badge {
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--border);
    color: var(--text-secondary);
}
.bc-ws-history-list { display: flex; flex-direction: column; gap: 6px; }
.bc-ws-session {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.bc-ws-session-title { font-weight: 600; font-size: 0.88rem; }
.bc-ws-session-meta {
    display: flex;
    gap: 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    margin-top: 2px;
}
.bc-ws-session-right { flex-shrink: 0; }
.bc-ws-mic-image-preview {
    margin-top: 8px;
    max-width: 120px;
}
.bc-ws-mic-image-preview img {
    max-width: 100%;
    border-radius: 6px;
    border: 1px solid var(--border);
}
.bc-ws-screen-info {
    display: flex;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
    padding: 8px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.bc-ws-screen-section {
    margin-bottom: 12px;
}
.bc-ws-screen-section-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.bc-ws-screen-perm-item {
    margin-bottom: 4px;
}
.bc-ws-screen-device-inline {
    margin: 4px 0 2px 26px;
}
.bc-ws-screen-perm-inline {
    margin: 6px 0 2px 26px;
}
.bc-ws-screen-perm-inline .btn {
    font-size: 0.78rem;
    padding: 4px 10px;
}
.bc-ws-cli-examples { margin-top: 12px; }
.bc-ws-cli-examples-inner { margin-top: 12px; }
.bc-ws-cli-examples-inner h5 {
    margin: 16px 0 4px;
    font-size: 0.82rem;
    color: var(--text-primary);
}
.bc-ws-cli-examples-inner h5:first-child { margin-top: 0; }
.bc-ws-cli-code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 0.75rem;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre;
    color: var(--text-primary);
    font-family: 'Fira Code', 'Cascadia Code', monospace;
}
.bc-ws-cli-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}
.bc-ws-cli-tab {
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .15s, border-color .15s;
}
.bc-ws-cli-panel {
    display: none;
    padding: 12px 0 0;
}
.bc-ws-cli-panel h5 {
    margin: 14px 0 4px;
    font-size: 0.82rem;
    color: var(--text-primary);
}
.bc-ws-cli-panel h5:first-of-type { margin-top: 8px; }
.bc-ws-cli-panel h5 i { margin-right: 4px; opacity: .6; }
.bc-ws-cli-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0 0 8px;
    line-height: 1.5;
}
.bc-ws-cli-note {
    margin-top: 12px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.bc-ws-cli-note code {
    background: var(--bg);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.78rem;
}
.bc-ws-cli-ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    margin-top: 8px;
}
.bc-ws-cli-ref-table th,
.bc-ws-cli-ref-table td {
    text-align: left;
    padding: 4px 8px;
    border-bottom: 1px solid var(--border);
}
.bc-ws-cli-ref-table th {
    color: var(--text-secondary);
    font-weight: 600;
}
.bc-ws-cli-ref-table code {
    background: var(--bg);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.75rem;
}

.bc-perm-card {
    width: min(460px, 100%);
    background: var(--bg-card, #14161f);
    border: 1px solid var(--border, rgba(255,255,255,.10));
    border-radius: 14px; padding: 20px;
    box-shadow: 0 18px 50px rgba(0,0,0,.5);
}
.bc-perm-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.bc-perm-icon {
    flex-shrink: 0; width: 42px; height: 42px; border-radius: 11px;
    display: grid; place-items: center; font-size: 1.05rem; color: #fff;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
}
.bc-perm-icon.is-blocked { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.bc-perm-mock {
    border: 1px solid var(--border, rgba(255,255,255,.10));
    border-radius: 10px; overflow: hidden; margin-bottom: 12px;
    background: rgba(255,255,255,.03);
}
.bc-perm-mock-bar {
    display: flex; align-items: center; gap: 7px;
    padding: 7px 10px; font-size: .78rem; color: var(--text-muted, #9aa3b2);
    background: rgba(255,255,255,.05); border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
}
.bc-perm-mock-pop { padding: 12px 12px 13px; }
.bc-perm-mock-btns { display: flex; gap: 8px; justify-content: flex-end; }
.bc-perm-mock-btns .ghost { border: 1px solid var(--border, rgba(255,255,255,.14)); color: var(--text-muted, #9aa3b2); }
.bc-perm-mock-btns .primary {
    background: #3b82f6; color: #fff; font-weight: 600;
    box-shadow: 0 0 0 3px rgba(59,130,246,.28);
    animation: bcPermPulse 1.7s ease-in-out infinite;
}

.bc-perm-note {
    margin: 7px 0 0; font-size: .79rem; line-height: 1.45;
    color: var(--text-muted, #9aa3b2); display: flex; gap: 8px;
}

.bc-perm-steps { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.bc-perm-step { display: flex; gap: 11px; align-items: flex-start; }

.bc-perm-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 18px; }
.bc-mic-meter-wrap { margin-top: 7px; }
.bc-mic-meter {
    width: 100%; height: 22px; display: block;
    border-radius: 5px; background: rgba(255,255,255,.05);
}
.bc-mic-meter-status { font-size: .76rem; color: var(--text-muted, #9aa3b2); margin-top: 4px; display: block; }
.bc-mic-meter-status.is-good { color: #22c55e; }
.bc-mic-meter-status.is-warn { color: #f59e0b; }
.bc-mic-meter-status.is-bad  { color: #ef4444; }
.bc-cap-list { display: flex; flex-direction: column; gap: 6px; }
.bc-cap-row {
    display: flex; align-items: center; gap: 11px;
    padding: 8px 11px; border-radius: 8px;
    background: rgba(255,255,255,.035);
    border: 1px solid transparent;
}
.bc-cap-row.is-on { border-color: rgba(34,197,94,.28); background: rgba(34,197,94,.07); }
.bc-cap-row.is-off { opacity: .62; }
.bc-cap-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.bc-cap-row em {
    font-style: normal; font-size: .7rem; font-weight: 700;
    letter-spacing: .04em; text-transform: uppercase; flex-shrink: 0;
}
.bc-cap-row.is-on em { color: #22c55e; }
.bc-cap-row.is-off em { color: var(--text-muted, #9aa3b2); }
.bc-cap-warn {
    margin: -1px 0 3px; padding: 6px 11px; font-size: .76rem; line-height: 1.4;
    color: #f59e0b; display: flex; gap: 7px; align-items: flex-start;
}
.bc-ws-toggle-group { margin-top: 10px; }
.bc-ws-toggle-group-title {
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
    color: var(--text-secondary); margin-bottom: 6px; display: flex; align-items: center; gap: 6px;
}

/* ═══ Go Live workspace layout (2026-09-28) ═══════════════════════════════════
   No box around the page: while the slot manager shows, the main column is transparent and is the one scroll
   (a thin themed scrollbar at the window edge, not one in the middle of the page). The slot list and the panel
   are two cards side by side: the list is as tall as its slots and stays in view while the panel scrolls. */
.broadcast-main:has(> #bc-stream-manager:not([style*="display: none"])) {
    background: transparent; border: 0; border-radius: 0; box-shadow: none;
}
.broadcast-main { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--accent) 38%, transparent) transparent; }
.broadcast-main::-webkit-scrollbar { width: 8px; }
.broadcast-main::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--accent) 38%, transparent); border-radius: 8px; }
.broadcast-main::-webkit-scrollbar-track { background: transparent; }
#bc-stream-manager { max-width: 1480px; padding: 4px clamp(0px, 1vw, 12px) 28px; flex: none; min-height: auto; overflow: visible; }
#bc-stream-manager > h2 { margin: 0 0 2px; font-size: 1.22rem; flex-wrap: wrap; row-gap: 6px; }
#bc-stream-manager > h2 .glw-open-btn { margin-left: 6px; }
#bc-stream-manager > .bc-page-subtitle { margin: 0 0 10px; font-size: 0.86rem; }
.bc-workspace { flex: none; border: 0; border-radius: 0; background: transparent; overflow: visible; gap: 14px; align-items: flex-start; margin-top: 6px; }
.bc-ws-sidebar, .bc-ws-main {
    border: 1px solid var(--border); border-radius: 14px;
    background: color-mix(in srgb, var(--bg-card, var(--surface)) 92%, transparent);
    box-shadow: 0 1px 0 color-mix(in srgb, var(--text-primary) 4%, transparent) inset;
}
.bc-ws-sidebar { width: clamp(200px, 17vw, 264px); border-right: 1px solid var(--border); overflow: hidden; }
.bc-ws-sidebar-hd { padding: 10px 10px 10px 14px; }
.bc-ws-list { padding: 4px; flex: none; }
.bc-ws-item { border-radius: 10px; padding: 9px 10px; }
.bc-ws-item.selected { box-shadow: inset 3px 0 0 var(--accent); }
.bc-ws-main { min-height: 0; }
.bc-ws-panel { overflow: visible; }
@media (min-width: 681px) {
    .bc-ws-sidebar { position: sticky; top: 0; align-self: flex-start; max-height: calc(100dvh - var(--navbar-h, 56px) - 40px); }
    .bc-ws-list { overflow-y: auto; flex: 1 1 auto; }
}
@media (max-width: 680px) {
    .bc-workspace { gap: 10px; }
    .bc-ws-sidebar { width: 100%; border-bottom: 1px solid var(--border); }
    .bc-ws-main { width: 100%; }
}

/* NSFW: a themed switch with what it does, instead of a bare checkbox floating beside a select. */
.bc-switch { display: flex; align-items: flex-start; gap: 12px; margin: 2px 0 16px; padding: 10px 12px; cursor: pointer;
    border: 1px solid var(--border); border-radius: 12px; background: color-mix(in srgb, var(--bg-input, var(--bg)) 70%, transparent);
    transition: border-color .18s, background-color .18s; }
.bc-switch:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.bc-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.bc-switch-track { flex: none; position: relative; width: 38px; height: 22px; margin-top: 1px; border-radius: 999px;
    background: color-mix(in srgb, var(--text-muted) 35%, transparent); border: 1px solid var(--border); transition: background-color .2s, border-color .2s; }
.bc-switch-thumb { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: transform .22s cubic-bezier(.22,1,.36,1), background-color .2s; }
.bc-switch input:checked + .bc-switch-track { background: var(--danger, #ef4444); border-color: var(--danger, #ef4444); }
.bc-switch input:checked + .bc-switch-track .bc-switch-thumb { transform: translateX(16px); background: #fff; }
.bc-switch input:focus-visible + .bc-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.bc-switch:has(input:checked) { border-color: color-mix(in srgb, var(--danger, #ef4444) 45%, var(--border)); background: color-mix(in srgb, var(--danger, #ef4444) 7%, transparent); }
.bc-switch-text { display: grid; gap: 2px; min-width: 0; }
.bc-switch-text b { font-size: 0.88rem; font-weight: 700; color: var(--text-primary); }
.bc-switch-text b i { color: var(--danger, #ef4444); margin-right: 3px; }
.bc-switch-text small { font-size: 0.76rem; color: var(--text-muted); line-height: 1.4; }

/* Video quality: reads as a row that opens (chevron, current values), not a static label. */
.bc-ws-quality { padding: 0; border-radius: 12px; overflow: hidden; }
.bc-ws-quality > summary { display: flex; align-items: center; gap: 8px; padding: 11px 12px; cursor: pointer; list-style: none; user-select: none;
    font-size: 0.86rem; font-weight: 650; color: var(--text-primary); transition: background-color .15s; }
.bc-ws-quality > summary::-webkit-details-marker { display: none; }
.bc-ws-quality > summary:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.bc-ws-quality > summary > i:first-child { color: var(--accent); margin: 0; }
.bc-sum-val { margin-left: auto; font-size: 0.76rem; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
.bc-sum-chev { color: var(--text-muted); font-size: 0.75rem; transition: transform .22s ease; }
.bc-ws-quality[open] .bc-sum-chev { transform: rotate(180deg); color: var(--accent); }
.bc-ws-quality[open] > summary { border-bottom: 1px solid var(--border); }
.bc-ws-quality .bc-ws-quality-inner { margin: 0; padding: 12px; }
@media (prefers-reduced-motion: reduce) { .bc-switch-thumb, .bc-sum-chev { transition: none; } }

/* Wide panels: details on the left, how you stream on the right, so fields are not a thousand pixels wide. */
.bc-ws-main { container-type: inline-size; container-name: bcws; }
@container bcws (min-width: 960px) {
    .bc-ws-profile-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 8px 28px; align-items: start; }
    .bc-ws-profile-split > .bc-ws-col--method .bc-method-picker-sm { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bc-ws-profile-split > .bc-ws-col--details .bc-switch { margin-bottom: 14px; }
}
