
:root {
    --feed-aspect: 16 / 9;
    --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
    --radius: 14px;
    --radius-sm: 10px;
    --btn-size: 52px;
    --icon-size: 22px;
    --pip-w: clamp(148px, 20vw, 236px);
    --pip-gap: 16px;
    --dock-h: calc(var(--btn-size) + 16px + 2px);
    --dock-clear: calc(18px + env(safe-area-inset-bottom) + var(--dock-h) + 12px);

    --bg-primary: #f3f4f6;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e5e7eb;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --bg-video: #e3e6eb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #d1d5db;
    --border-dark: #9ca3af;
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    --accent-active: #1d4ed8;
    --accent-light: rgba(59, 130, 246, 0.1);
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.14);
    --warning: #f59e0b;
    --warning-text: #b45309;
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.14);
    --info-bg: #dbeafe;
    --info-border: #bfdbfe;
    --warn-bg: rgba(245, 158, 11, 0.14);
    --shadow-color: rgba(0, 0, 0, 0.1);

    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-bg-solid: rgba(255, 255, 255, 0.93);
    --glass-border: rgba(17, 24, 39, 0.1);
    --glass-hover: rgba(17, 24, 39, 0.07);
    --glass-hover-strong: rgba(17, 24, 39, 0.13);
    --glass-text: rgba(17, 24, 39, 0.92);
    --glass-muted: rgba(17, 24, 39, 0.65);

    --focus-ring: #3b82f6;
    --track-color: rgba(17, 24, 39, 0.16);
    --thumb-bg: #ffffff;
    --thumb-shadow: 0 0 0 1px rgba(17, 24, 39, 0.24), 0 1px 3px rgba(17, 24, 39, 0.3);
    --placeholder-color: #57606f;
    --pip-border: rgba(17, 24, 39, 0.12);
    --pip-shadow: 0 10px 30px rgba(17, 24, 39, 0.16);
    --panel-shadow: 0 8px 28px rgba(17, 24, 39, 0.14);
    --dock-shadow: 0 10px 34px rgba(17, 24, 39, 0.2);
    --header-scrim: linear-gradient(to bottom, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0));

    --bg-overlay: rgba(17, 24, 39, 0.72);
    --bg-overlay-strong: rgba(8, 10, 14, 0.6);
    --bg-overlay-strong-hover: rgba(8, 10, 14, 0.82);
}

body.light {
    --bg-primary: #f3f4f6;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e5e7eb;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --bg-video: #e3e6eb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #d1d5db;
    --border-dark: #9ca3af;
    --accent-light: rgba(59, 130, 246, 0.1);
    --warning-text: #b45309;
    --info-bg: #dbeafe;
    --info-border: #bfdbfe;
    --shadow-color: rgba(0, 0, 0, 0.1);

    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-bg-solid: rgba(255, 255, 255, 0.93);
    --glass-border: rgba(17, 24, 39, 0.1);
    --glass-hover: rgba(17, 24, 39, 0.07);
    --glass-hover-strong: rgba(17, 24, 39, 0.13);
    --glass-text: rgba(17, 24, 39, 0.92);
    --glass-muted: rgba(17, 24, 39, 0.65);

    --focus-ring: #3b82f6;
    --track-color: rgba(17, 24, 39, 0.16);
    --thumb-bg: #ffffff;
    --thumb-shadow: 0 0 0 1px rgba(17, 24, 39, 0.24), 0 1px 3px rgba(17, 24, 39, 0.3);
    --placeholder-color: #57606f;
    --pip-border: rgba(17, 24, 39, 0.12);
    --pip-shadow: 0 10px 30px rgba(17, 24, 39, 0.16);
    --panel-shadow: 0 8px 28px rgba(17, 24, 39, 0.14);
    --dock-shadow: 0 10px 34px rgba(17, 24, 39, 0.2);
    --header-scrim: linear-gradient(to bottom, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0));
}

@media (prefers-color-scheme: dark) {
    :root:not(.light):not(.dark) {
        --bg-primary: #141518;
        --bg-secondary: #1e2024;
        --bg-tertiary: #2c2f36;
        --bg-card: #1e2024;
        --bg-input: #12141a;
        --bg-video: #0d0e11;
        --text-primary: #f5f6f7;
        --text-secondary: #a2a8b3;
        --text-muted: #6d7380;
        --border-color: #343841;
        --border-dark: #4b5563;
        --accent-light: rgba(59, 130, 246, 0.22);
        --warning-text: #f59e0b;
        --info-bg: #16324f;
        --info-border: #274b6d;
        --shadow-color: rgba(0, 0, 0, 0.45);

        --glass-bg: rgba(16, 18, 23, 0.62);
        --glass-bg-solid: rgba(16, 18, 23, 0.86);
        --glass-border: rgba(255, 255, 255, 0.14);
        --glass-hover: rgba(255, 255, 255, 0.16);
        --glass-hover-strong: rgba(255, 255, 255, 0.28);
        --glass-text: rgba(255, 255, 255, 0.95);
        --glass-muted: rgba(255, 255, 255, 0.62);

        --focus-ring: #ffffff;
        --track-color: rgba(255, 255, 255, 0.22);
        --thumb-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
        --placeholder-color: #9ca3af;
        --pip-border: rgba(255, 255, 255, 0.2);
        --pip-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
        --panel-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
        --dock-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
        --header-scrim: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
    }
}

body.dark {
    --bg-primary: #141518;
    --bg-secondary: #1e2024;
    --bg-tertiary: #2c2f36;
    --bg-card: #1e2024;
    --bg-input: #12141a;
    --bg-video: #0d0e11;
    --text-primary: #f5f6f7;
    --text-secondary: #a2a8b3;
    --text-muted: #6d7380;
    --border-color: #343841;
    --border-dark: #4b5563;
    --accent-light: rgba(59, 130, 246, 0.22);
    --warning-text: #f59e0b;
    --info-bg: #16324f;
    --info-border: #274b6d;
    --shadow-color: rgba(0, 0, 0, 0.45);

    --glass-bg: rgba(16, 18, 23, 0.62);
    --glass-bg-solid: rgba(16, 18, 23, 0.86);
    --glass-border: rgba(255, 255, 255, 0.14);
    --glass-hover: rgba(255, 255, 255, 0.16);
    --glass-hover-strong: rgba(255, 255, 255, 0.28);
    --glass-text: rgba(255, 255, 255, 0.95);
    --glass-muted: rgba(255, 255, 255, 0.62);

    --focus-ring: #ffffff;
    --track-color: rgba(255, 255, 255, 0.22);
    --thumb-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    --placeholder-color: #9ca3af;
    --pip-border: rgba(255, 255, 255, 0.2);
    --pip-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --panel-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
    --dock-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
    --header-scrim: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    transition: background-color 0.2s ease, color 0.2s ease;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    display: flex;
    height: 100dvh;
    width: 100dvw;
    position: relative;
}

.sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.icon {
    width: var(--icon-size);
    height: var(--icon-size);
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: block;
}


.login-section {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 20px;
    position: relative;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 34px;
    max-width: 430px;
    width: 100%;
    box-shadow: 0 8px 32px var(--shadow-color);
    border: 1px solid var(--border-color);
}

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

.login-brand h1 {
    font-size: 22px;
    letter-spacing: -0.2px;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 28px;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 0.8rem;
}

.form-group .label-with-tip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: help;
}
.form-group .tip-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 999px;
    border: 1px solid var(--border-dark);
    font-size: 10px;
    font-style: italic;
    font-weight: 700;
    font-family: Georgia, 'Times New Roman', serif;
    color: var(--text-secondary);
    line-height: 1;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-group .backend-seg {
    padding: 0;
    border: none;
    background: transparent;
}
.form-group .backend-seg .seg-btn {
    padding: 8px 10px;
    white-space: normal;
    text-align: center;
}

.form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-group label.override-label {
    margin-top: 10px;
}
.form-group #trackerDefaults {
    margin-bottom: 4px;
}

.primary-btn {
    width: 100%;
    padding: 13px 16px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent-primary);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    transition: background 0.15s ease;
}

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

.primary-btn:active {
    background: var(--accent-active);
}

.primary-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.primary-btn .icon {
    width: 19px;
    height: 19px;
    stroke-width: 2;
}

.info-text {
    margin-top: 20px;
    padding: 13px 14px;
    background: var(--info-bg);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    border: 1px solid var(--info-border);
}

.notice {
    margin-top: 18px;
    padding: 13px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.55;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: var(--warn-bg);
    border: 1px solid var(--warning);
    color: var(--text-primary);
}

.notice.error {
    background: var(--danger-light);
    border-color: var(--danger);
}

.notice .icon {
    width: 18px;
    height: 18px;
    color: var(--warning-text);
    margin-top: 1px;
}

.notice.error .icon {
    color: var(--danger);
}

.notice strong {
    display: block;
    margin-bottom: 3px;
}

.notice code {
    background: var(--bg-tertiary);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 12px;
}

.notice a {
    color: var(--accent-primary);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.call-section {
    position: relative;
    width: 100%;
    height: 100%;
}

.video-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-video);
}

.call-header {
    position: absolute;
    z-index: 5;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: calc(14px + env(safe-area-inset-top)) 16px 26px;
    background: var(--header-scrim);
    pointer-events: none;
}

.call-header > * {
    pointer-events: auto;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

#meetCodeDisplay {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.meet-chip {
    cursor: pointer;
}
.meet-chip:hover {
    background: var(--glass-hover);
}

#connectionStatus {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.meet-chip,
.status-pill,
.turn-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px;
    border-radius: 999px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--glass-text);
    font-size: 12.5px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    white-space: nowrap;
}

.meet-chip {
    max-width: 52%;
    min-width: 0;
}

.status-pill {
    min-width: 0;
    flex: 0 1 auto;
    cursor: pointer;
}

.status-pill:hover {
    background: var(--glass-hover);
}

.meet-chip .icon {
    width: 15px;
    height: 15px;
    color: var(--glass-muted);
}

.meet-chip-label {
    color: var(--glass-muted);
}

.meet-chip strong {
    font-weight: 600;
    color: var(--glass-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
    flex: none;
}

.status-pill.connected {
    color: var(--glass-text);
    border-color: color-mix(in srgb, var(--success) 60%, transparent);
}

.status-pill.connected .status-dot {
    background: var(--success);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 30%, transparent);
}

.turn-status {
    color: var(--warning-text);
    border-color: color-mix(in srgb, var(--warning-text) 55%, transparent);
}

.turn-status .icon {
    width: 14px;
    height: 14px;
}

.stage {
    position: absolute;
    inset: 0;
}

.video-feed {
    position: absolute;
    background: var(--bg-video);
    overflow: hidden;
}

.video-feed.remote {
    inset: 0;
}

.video-feed.local {
    z-index: 3;
    right: var(--pip-gap);
    bottom: var(--dock-clear);
    width: var(--pip-w);
    aspect-ratio: var(--feed-aspect, 16 / 9);
    border-radius: 12px;
    border: 1px solid var(--pip-border);
    box-shadow: var(--pip-shadow);
    transition: width 0.18s ease, border-radius 0.18s ease;
}

.video-view {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.video-view video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--bg-video);
}

.video-feed.local.mirror .video-view video {
    transform: scaleX(-1);
}

.video-feed-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    justify-content: center;
    color: var(--placeholder-color);
    font-size: 13px;
    letter-spacing: 0.2px;
}

.video-feed-placeholder .icon {
    width: 44px;
    height: 44px;
    stroke-width: 1.4;
}

.video-feed.local .video-feed-placeholder .icon {
    width: 26px;
    height: 26px;
}

.video-feed-placeholder.hidden {
    display: none !important;
}

.remote-identicon {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    background: var(--track-color);
}

.remote-card-name {
    font-size: 16px;
    font-weight: 600;
    max-width: 80%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remote-card-id {
    font-size: 11px;
    opacity: 0.75;
    max-width: 80%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remote-volume {
    position: relative;
    width: 72px;
    height: 3px;
    border-radius: 2px;
    background: var(--track-color);
    overflow: hidden;
}

.remote-volume::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: calc(var(--level, 0) * 100%);
    border-radius: 2px;
    background: var(--success);
    transition: width 0.08s linear;
}

.remote-status {
    font-size: 12px;
    opacity: 0.85;
}

.video-feed-tag {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--bg-overlay);
    color: #fff;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    user-select: none;
    -webkit-user-select: none;
}

.stage:not(.local-large) .video-feed.remote > .video-feed-tag,
.stage.local-large .video-feed.local > .video-feed-tag {
    display: none;
}

.volume-indicator {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 7px;
    height: 3px;
    border-radius: 2px;
    background: var(--track-color);
    overflow: hidden;
}

.volume-indicator::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: calc(var(--level, 0) * 100%);
    border-radius: 2px;
    background: var(--success);
    transition: width 0.08s linear;
}

.pip-expand {
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 8px;
    background: var(--bg-overlay-strong);
    color: #fff;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.pip-expand .icon {
    width: 15px;
    height: 15px;
    stroke-width: 2;
}

.stage.self-hidden .video-feed.local {
    display: none;
}

.video-feed:hover .pip-expand,
.pip-expand:focus-visible {
    opacity: 1;
}

.pip-expand:hover {
    background: var(--bg-overlay-strong-hover);
}

@media (hover: none) {
    .pip-expand {
        opacity: 1;
    }
}

.stage.local-large .video-feed.local {
    inset: 0;
    width: auto;
    aspect-ratio: auto;
    border-radius: 0;
    border: none;
    box-shadow: none;
}

.stage.local-large .video-feed.remote {
    z-index: 4;
    right: var(--pip-gap);
    left: auto;
    top: auto;
    bottom: var(--dock-clear);
    width: var(--pip-w);
    aspect-ratio: var(--feed-aspect, 16 / 9);
    border-radius: 12px;
    border: 1px solid var(--pip-border);
    box-shadow: var(--pip-shadow);
}

.rail-slider {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.rail-icon {
    width: 16px;
    height: 16px;
    color: var(--glass-muted);
}

.rail-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.rail-title {
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--glass-muted);
}

.rail-value {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--glass-text);
    min-width: 36px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.controls-panel input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 28px;
    margin: 0;
    background: transparent;
    cursor: pointer;
    outline: none;
}

.controls-panel input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 3px;
    background: linear-gradient(to right,
        var(--accent-primary) 0 var(--fill, 50%),
        var(--track-color) var(--fill, 50%) 100%);
}

.controls-panel input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 13px;
    height: 13px;
    margin-top: -4.5px;
    border-radius: 50%;
    background: var(--thumb-bg);
    border: none;
    box-shadow: var(--thumb-shadow);
}

.controls-panel input[type="range"]::-moz-range-track {
    height: 4px;
    border-radius: 3px;
    background: var(--track-color);
}

.controls-panel input[type="range"]::-moz-range-progress {
    height: 4px;
    border-radius: 3px;
    background: var(--accent-primary);
}

.controls-panel input[type="range"]::-moz-range-thumb {
    width: 13px;
    height: 13px;
    border: none;
    border-radius: 50%;
    background: var(--thumb-bg);
}

.controls-panel input[type="range"]:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 4px;
}

.controls-panel {
    position: absolute;
    z-index: 7;
    top: calc(env(safe-area-inset-top) + 60px);
    right: var(--pip-gap);
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: min(262px, calc(100vw - 2 * var(--pip-gap)));
    padding: 8px;
    border-radius: var(--radius);
    background: var(--glass-bg-solid);
    border: 1px solid var(--glass-border);
    box-shadow: var(--dock-shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.controls-panel.hidden {
    display: none;
}

.controls-panel .rail-slider {
    padding: 7px 8px;
    border-radius: 10px;
    background: var(--glass-hover);
}

.ctl-divider {
    flex: none;
    height: 1px;
    margin: 5px 2px;
    background: var(--glass-border);
}

.ctl-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--glass-text);
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.ctl-row:hover {
    background: var(--glass-hover-strong);
}

.ctl-row:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 1px;
}

.ctl-row[aria-pressed="true"] {
    color: var(--accent-primary);
}

.ctl-ico {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--glass-hover);
}

.ctl-row[aria-pressed="true"] .ctl-ico {
    background: var(--accent-light);
}

.ctl-ico .icon {
    width: 17px;
    height: 17px;
}

.ctl-label {
    flex: 1 1 auto;
    min-width: 0;
}

.controls-bar {
    position: absolute;
    z-index: 6;
    left: 50%;
    bottom: calc(18px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 999px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--dock-shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    max-width: calc(100vw - 24px);
}

.control-btn {
    width: var(--btn-size);
    height: var(--btn-size);
    border: none;
    border-radius: 50%;
    background: var(--glass-hover);
    color: var(--glass-text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.control-btn:hover {
    background: var(--glass-hover-strong);
}

.control-btn:active {
    transform: scale(0.94);
}

.control-btn:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.control-btn .icon {
    width: 22px;
    height: 22px;
}

.control-btn.off {
    background: var(--danger);
    color: #fff;
}

.control-btn.off:hover {
    background: #dc2626;
}

.control-btn.share.active {
    background: var(--accent-primary);
    color: #fff;
}

.control-btn.share.active:hover {
    background: var(--accent-hover);
}

.control-btn.danger {
    background: var(--danger);
    color: #fff;
}

.control-btn.danger:hover {
    background: #dc2626;
}

.room-section {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 20px;
    position: relative;
}

.room-section .theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
}

.room-card {
    width: 100%;
    max-width: 430px;
    max-height: min(92dvh, 720px);
    display: flex;
    flex-direction: column;
    padding: 26px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px var(--shadow-color);
    color: var(--text-primary);
}

.room-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.room-head .icon {
    width: 28px;
    height: 28px;
    color: var(--accent-primary);
    flex: 0 0 auto;
}

.room-head-text h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
}

.room-head-text {
    flex: 1 1 auto;
    min-width: 0;
}

#roomTitle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#roomCode {
    font-family: var(--mono, ui-monospace, monospace);
    letter-spacing: 0.5px;
}

.room-sub {
    display: block;
    margin-top: 2px;
    font-size: 12.5px;
    color: var(--text-secondary);
}

.room-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 2px;
}

.room-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

.room-row.self {
    border-color: var(--accent-primary);
    background: var(--accent-light);
}

.room-row.wants {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 1px var(--accent-primary);
}

.room-avatar {
    position: relative;
    width: 46px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 6px;
    background: var(--accent-light);
    overflow: hidden;
}

.room-avatar .room-icon {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.room-dot {
    position: absolute;
    top: -1px;
    right: -1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-primary);
    border: 2px solid var(--bg-card);
    box-sizing: content-box;
}

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

.room-name {
    font-size: 14.5px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.room-id {
    display: block;
    margin-top: 1px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11.5px;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    user-select: all;
}

.room-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.room-tag {
    padding: 3px 9px;
    border-radius: var(--radius-sm);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.room-tag.you {
    color: #fff;
    background: var(--accent-active);
    border-color: var(--accent-active);
}

.room-tag.busy {
    color: var(--text-secondary);
}

.room-tag.declined {
    color: var(--danger);
    background: var(--danger-light);
    border-color: var(--danger);
}

.room-btn {
    height: 32px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    transition: background 0.15s ease, color 0.15s ease;
}

.room-btn.primary {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
    transition: background 0.15s ease;
}

.room-btn.primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.room-btn.primary:active {
    background: var(--accent-active);
    border-color: var(--accent-active);
}

.room-btn.decline {
    color: var(--danger);
    border-color: var(--danger);
}

.room-btn.decline:hover {
    background: var(--danger-light);
}

.room-foot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 3rem;
}

.room-copy-link {
    margin-left: auto;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.room-copy-link .icon {
    width: 16px;
    height: 16px;
}

.room-copy-link:hover {
    background: var(--accent-light);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.room-leave {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.room-leave .icon {
    width: 16px;
    height: 16px;
}

.danger-ghost-btn {
    flex: 1;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    border: 1.5px solid var(--danger);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--danger);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.danger-ghost-btn:hover {
    background: var(--danger-light);
}

.danger-ghost-btn:active {
    transform: scale(0.98);
}

.danger-ghost-btn:focus-visible {
    outline: 2px solid var(--danger);
    outline-offset: 2px;
}

.danger-ghost-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.debug-panel {
    position: absolute;
    z-index: 4;
    left: var(--pip-gap);
    top: calc(env(safe-area-inset-top) + 88px);
    bottom: calc(18px + env(safe-area-inset-bottom) + var(--dock-h) + 8px);
    width: min(680px, 64vw);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--glass-bg-solid);
    border: 1px solid var(--glass-border);
    color: var(--glass-text);
}

.debug-panel h4 {
    color: var(--glass-muted);
    margin: 0;
    flex: 1 1 auto;
    font-size: 12px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.debug-panel-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.debug-close {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--glass-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.debug-close .icon {
    width: 14px;
    height: 14px;
}

.debug-close:hover {
    background: var(--glass-hover-strong);
    color: var(--glass-text);
}

.debug-close:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 1px;
}

.debug-panel pre {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--glass-muted);
    white-space: pre-wrap;
    word-break: break-all;
}

.stats-panel {
    position: absolute;
    z-index: 4;
    right: var(--pip-gap);
    top: calc(env(safe-area-inset-top) + 88px);
    display: flex;
    flex-direction: column;
    width: 300px;
    max-height: min(52vh, 420px);
    border-radius: 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--panel-shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.stats-panel.hidden {
    display: none;
}

.stats-panel:hover {
    background: var(--glass-bg-solid);
}

.stats-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--glass-border);
}

.stats-head h4 {
    flex: 1;
    margin: 0;
    font-size: 12px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--glass-muted);
}

.stats-live {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: var(--glass-muted);
}

.stats-live.on {
    color: #22c55e;
}

.stats-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 12px 12px;
    overflow-y: auto;
}

.stats-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.stats-group-title {
    padding: 0 0 3px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--glass-muted);
}

.stats-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 2px 0;
    font-size: 12px;
    line-height: 1.4;
}

.stats-row-label {
    flex: none;
    color: var(--glass-muted);
}

.stats-row-val {
    min-width: 0;
    text-align: right;
    font-weight: 600;
    color: var(--glass-text);
    font-variant-numeric: tabular-nums;
}

.stats-row-val[data-level="good"] { color: #22c55e; }
.stats-row-val[data-level="fair"] { color: #f59e0b; }
.stats-row-val[data-level="poor"] { color: #ef4444; }

    .chat-panel {
        position: absolute;
        z-index: 5;
        right: var(--pip-gap);
        top: calc(env(safe-area-inset-top) + 88px);
        bottom: calc(18px + env(safe-area-inset-bottom) + var(--dock-h) + 8px);
        width: 320px;
        max-width: calc(100vw - 2 * var(--pip-gap));
        display: flex;
        flex-direction: column;
        border-radius: 16px;
        background: var(--glass-bg-solid);
        border: 1px solid var(--glass-border);
        box-shadow: var(--panel-shadow);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        overflow: hidden;
    }

    .chat-bar {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 12px;
        border-bottom: 1px solid var(--glass-border);
    }

    .chat-bar h4 {
        flex: none;
        margin: 0;
        font-size: 12px;
        letter-spacing: 0.4px;
        text-transform: uppercase;
        color: var(--glass-muted);
    }

    .chat-state {
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 11.5px;
        color: var(--glass-muted);
        font-variant-numeric: tabular-nums;
    }

    .chat-log {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        padding: 12px;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .chat-empty {
        margin: auto;
        color: var(--glass-muted);
        font-size: 12.5px;
        line-height: 1.5;
        text-align: center;
        padding: 0 16px;
    }

    .chat-msg {
        max-width: 82%;
        padding: 6px 11px;
        border-radius: 14px;
        font-size: 13.5px;
        line-height: 1.45;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .chat-msg.me {
        align-self: flex-start;
        background: var(--bg-tertiary);
        color: var(--text-primary);
        border-bottom-left-radius: 4px;
    }

    .chat-msg.them {
        align-self: flex-end;
        background: var(--accent-primary);
        color: #fff;
        border-bottom-right-radius: 4px;
    }

    .chat-msg-meta {
        display: flex;
        align-items: baseline;
        gap: 6px;
        margin-bottom: 2px;
        font-size: 10px;
        font-weight: 600;
        letter-spacing: 0.2px;
        color: var(--glass-muted);
    }

    .chat-msg.them .chat-msg-meta {
        color: rgba(255, 255, 255, 0.78);
        justify-content: flex-end;
    }

    .chat-msg-time {
        font-weight: 500;
        font-variant-numeric: tabular-nums;
    }

    .chat-msg.system {
        align-self: center;
        max-width: 100%;
        padding: 0;
        background: none;
        color: var(--glass-muted);
        font-size: 11.5px;
        text-align: center;
    }

    .chat-input-row {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px;
        border-top: 1px solid var(--glass-border);
    }

    .chat-input-row input {
        flex: 1 1 auto;
        min-width: 0;
        padding: 9px 13px;
        border: 1px solid var(--border-color);
        border-radius: 999px;
        background: var(--bg-input);
        color: var(--text-primary);
        font-size: 14px;
        font-family: inherit;
        outline: none;
        transition: border-color 0.2s, box-shadow 0.2s;
    }

    .chat-input-row input:focus {
        border-color: var(--accent-primary);
        box-shadow: 0 0 0 3px var(--accent-light);
    }

    .chat-input-row input::placeholder {
        color: var(--text-muted);
    }

    .chat-send {
        flex: none;
        width: 40px;
        height: 40px;
        border: none;
        border-radius: 50%;
        background: var(--accent-primary);
        color: #fff;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition: background 0.15s ease, transform 0.1s ease;
    }

    .chat-send .icon {
        width: 19px;
        height: 19px;
    }

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

    .chat-send:active {
        transform: scale(0.94);
    }

    .chat-send:focus-visible {
        outline: 2px solid var(--focus-ring);
        outline-offset: 2px;
    }

    .chat-send:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

    .header-icon-btn.chat.active {
        background: var(--accent-light);
        border-color: var(--accent-primary);
        color: var(--accent-primary);
    }

    .header-icon-btn.chat {
        position: relative;
    }

    .header-icon-btn.files {
        position: relative;
    }

    .header-icon-btn.files.active {
        background: var(--accent-light);
        border-color: var(--accent-primary);
        color: var(--accent-primary);
    }

    .chat-badge {
        position: absolute;
        top: -4px;
        right: -4px;
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        border-radius: 999px;
        background: var(--accent-primary);
        color: #fff;
        font-size: 10px;
        font-weight: 700;
        line-height: 16px;
        text-align: center;
        pointer-events: none;
    }

    .stage.chat-open:not(.local-large) .video-feed.local,
    .stage.files-open:not(.local-large) .video-feed.local {
        right: auto;
        left: var(--pip-gap);
    }

    .files-row {
        display: flex;
        flex-direction: column;
        gap: 5px;
        max-width: 100%;
        padding: 9px 11px;
        border-radius: 14px;
        background: var(--bg-tertiary);
        color: var(--text-primary);
    }

    .files-row.out {
        border-bottom-right-radius: 4px;
    }

    .files-row.in {
        border-bottom-left-radius: 4px;
        background: var(--bg-secondary);
        border: 1px solid var(--glass-border);
    }

    .files-row-top {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
    }

    .files-row-icon .icon {
        width: 16px;
        height: 16px;
        color: var(--text-secondary);
        flex: none;
    }

    .files-row-name {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 13px;
        font-weight: 600;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .files-row-size {
        flex: none;
        font-size: 11px;
        color: var(--text-secondary);
        font-variant-numeric: tabular-nums;
    }

    .files-row-status {
        font-size: 11.5px;
        color: var(--text-secondary);
    }

    .files-row.done .files-row-status {
        color: var(--success);
    }

    .files-row.failed .files-row-status {
        color: #ef4444;
    }

    .files-progress {
        height: 5px;
        border-radius: 999px;
        background: var(--border-color);
        overflow: hidden;
    }

    .files-progress > i {
        display: block;
        height: 100%;
        width: 0;
        background: var(--accent-primary);
        border-radius: 999px;
    }

    .files-row.accept .files-progress > i {
        background: var(--success);
    }

    .files-row-actions {
        display: flex;
        align-items: center;
        gap: 6px;
        margin-top: 2px;
    }

    .files-row-note {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 11px;
        color: var(--text-muted);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .files-accept-btn {
        flex: none;
        display: inline-flex;
        align-items: center;
        gap: 5px;
        height: 28px;
        padding: 0 12px;
        border: none;
        border-radius: 999px;
        background: var(--success);
        color: #fff;
        font-size: 12px;
        font-weight: 600;
        font-family: inherit;
        cursor: pointer;
    }

    .files-accept-btn .icon {
        width: 13px;
        height: 13px;
    }

    .files-accept-btn:hover {
        filter: brightness(1.08);
    }

    .files-accept-btn:focus-visible {
        outline: 2px solid var(--focus-ring);
        outline-offset: 2px;
    }

    .files-decline-btn,
    .files-cancel-btn {
        background: var(--danger);
        color: #fff;
    }

    .files-send {
        flex: none;
        width: 40px;
        height: 40px;
        border: none;
        border-radius: 50%;
        background: var(--accent-primary);
        color: #fff;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition: background 0.15s ease, transform 0.1s ease;
    }

    .files-send .icon {
        width: 19px;
        height: 19px;
    }

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

    .files-send:active {
        transform: scale(0.94);
    }

    .files-send:focus-visible {
        outline: 2px solid var(--focus-ring);
        outline-offset: 2px;
    }

    .files-send:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

    .files-pick-label {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 12.5px;
        color: var(--text-secondary);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        user-select: none;
    }

    .options-menu {
    position: absolute;
    z-index: 8;
    left: 50%;
    bottom: calc(18px + env(safe-area-inset-bottom) + var(--dock-h) + 12px);
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: min(300px, calc(100vw - 24px));
    max-height: calc(100vh - 2 * var(--dock-clear) - 40px);
    overflow-y: auto;
    padding: 8px;
    border-radius: var(--radius);
    background: var(--glass-bg-solid);
    border: 1px solid var(--glass-border);
    box-shadow: var(--dock-shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: menu-pop 0.16s ease;
    transform-origin: bottom center;
}

@keyframes menu-pop {
    from { opacity: 0; transform: translateX(-50%) translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.menu-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--glass-text);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
}

.menu-row:hover {
    background: var(--glass-hover);
}

.menu-row:active {
    background: var(--glass-hover-strong);
}

.menu-row:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: -2px;
}

.menu-row:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.menu-row.is-on {
    background: var(--accent-light);
    color: var(--accent-primary);
}

.menu-row.is-on:hover {
    background: var(--accent-light);
}

.menu-row .icon {
    width: 19px;
    height: 19px;
    flex: none;
    color: inherit;
}

.menu-row-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu-row-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 20px;
}

.menu-check {
    width: 17px;
    height: 17px;
    color: var(--accent-primary);
    display: none;
}

.menu-row.is-on .menu-check {
    display: block;
}

.menu-row-value {
    flex: none;
    max-width: 44%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--glass-muted);
}

.menu-divider {
    height: 1px;
    margin: 6px 8px;
    background: var(--glass-border);
}

.menu-quality {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 8px 8px 12px;
    border-radius: 10px;
}

.menu-quality-head {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: none;
    color: var(--glass-text);
    font-size: 14px;
    font-weight: 500;
}

.menu-quality-head .icon {
    width: 19px;
    height: 19px;
    flex: none;
}

.menu-quality-head .menu-row-label {
    flex: none;
}

.seg {
    display: flex;
    width: 100%;
    padding: 3px;
    border-radius: 10px;
    background: var(--glass-hover);
    gap: 2px;
}

.seg-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 6px 8px;
    border: none;
    border-radius: 999px;
    background: rgba(180, 180, 180, 0.15);
    color: var(--glass-muted);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.seg-btn:hover {
    color: var(--glass-text);
}

.seg-btn:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: -2px;
}

.seg-btn.active {
    background: var(--accent-primary);
    color: #fff;
}

.control-btn.menu-toggle.active {
    background: var(--accent-primary);
    color: #fff;
}

.stage.remote-hidden .video-feed.remote {
    display: none;
}

.hidden {
    display: none !important;
}

.header-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--glass-text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.1s ease;
    box-shadow: 0 2px 8px var(--shadow-color);
    flex: none;
    backdrop-filter: blur(8px);
}

.header-icon-btn .icon {
    width: 19px;
    height: 19px;
}

.header-icon-btn:hover {
    background: var(--glass-hover);
}

.header-icon-btn:active {
    transform: scale(0.96);
}

.header-icon-btn:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.header-icon-btn.active {
    background: var(--accent-light);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.header-icon-btn.off {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.1s ease;
    box-shadow: 0 2px 8px var(--shadow-color);
    flex: none;
}

.theme-toggle .icon {
    width: 18px;
    height: 18px;
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
}

.theme-toggle:active {
    transform: scale(0.94);
}

.login-section .theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
}

.login-section .theme-toggle.debug,
.room-section .theme-toggle.debug {
    top: 70px;
}

.theme-toggle.debug.is-on {
    background: var(--accent-light);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.toast {
    position: fixed;
    top: max(20px, env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    background: var(--success);
    color: #fff;
    padding: 11px 20px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 8px 24px var(--shadow-color);
    animation: slideIn 0.28s ease;
    max-width: min(90vw, 520px);
    text-align: center;
}

.toast.error {
    background: var(--danger);
}

.toast strong {
    font-weight: 700;
}
.toast code {
    font-family: var(--mono);
    font-weight: 600;
    letter-spacing: 0.4px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-16px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@media (max-width: 1080px) {
    :root {
        --pip-w: clamp(132px, 24vw, 190px);
    }
}

@media (max-width: 860px) {
    :root {
        --btn-size: 48px;
        --icon-size: 20px;
        --pip-w: clamp(88px, 24vw, 118px);
        --pip-gap: 12px;
        --dock-clear: calc(18px + env(safe-area-inset-bottom) + var(--dock-h) + 14px);
    }

    .stage:not(.local-large) .video-feed.local {
        max-height: 20vh;
    }

    .video-feed.local {
        box-shadow: var(--pip-shadow);
    }

    .meet-chip-label {
        display: none;
    }

    .debug-panel {
        left: 0;
        right: 0;
        top: calc(env(safe-area-inset-top) + 80px);
        bottom: calc(18px + env(safe-area-inset-bottom) + var(--dock-h) + 8px);
        width: auto;
        max-height: none;
        border-radius: 12px;
    }

    .stats-panel {
        left: 0;
        right: 0;
        top: calc(env(safe-area-inset-top) + 80px);
        bottom: calc(18px + env(safe-area-inset-bottom) + var(--dock-h) + 8px);
        width: auto;
        max-height: none;
        transform: none;
        border-radius: 12px;
    }

    .chat-panel {
        left: 0;
        right: 0;
        top: calc(env(safe-area-inset-top) + 80px);
        bottom: calc(18px + env(safe-area-inset-bottom) + var(--dock-h) + 8px);
        width: auto;
        max-width: none;
        border-radius: 12px;
    }
}

@media (max-width: 420px) {
    :root {
        --btn-size: 46px;
    }

    .controls-bar {
        gap: 6px;
    }

    .login-card {
        padding: 24px 20px;
    }

    .rail-title {
        font-size: 9px;
    }

    .call-header {
        gap: 8px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .header-right {
        gap: 6px;
    }

    .header-icon-btn {
        width: 32px;
        height: 32px;
    }

    .header-icon-btn .icon {
        width: 16px;
        height: 16px;
    }

    .meet-chip {
        max-width: 34%;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
