/* =========================================================
   Video Session V2 — Zoom-like UI
   Adaptive, theme-aware (light/dark)
   ========================================================= */

:root {
    --vsv2-stage-bg: #0b1020;
    --vsv2-stage-bg-soft: #11172c;
    --vsv2-tile-bg: #000;
    --vsv2-tile-border: rgba(255, 255, 255, .06);
    --vsv2-chrome-bg: rgba(15, 20, 36, .82);
    --vsv2-chrome-border: rgba(255, 255, 255, .08);
    --vsv2-chrome-text: #e6e9f2;
    --vsv2-chrome-muted: #a9b0c3;
    --vsv2-pill-bg: rgba(255, 255, 255, .08);
    --vsv2-pill-bg-hover: rgba(255, 255, 255, .14);
    --vsv2-ctrl-bg: rgba(255, 255, 255, .07);
    --vsv2-ctrl-bg-hover: rgba(255, 255, 255, .14);
    --vsv2-ctrl-off: #f44336;
    --vsv2-leave: #ef4444;
    --vsv2-leave-hover: #dc2626;
    --vsv2-good: #22c55e;
    --vsv2-warn: #f59e0b;
    --vsv2-bad: #ef4444;
}

:root[data-theme="dark"] {
    --vsv2-stage-bg: #04060f;
    --vsv2-stage-bg-soft: #0a0f1f;
}

/* ==================== SESSIONS LIST PAGE V2 ==================== */
.sv2-page {
    max-width: 980px;
    margin: 0 auto;
    padding: 8px 12px 32px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sv2-topbar {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.sv2-back-btn {
    flex-shrink: 0;
    margin-top: 4px;
}

.sv2-title-block {
    flex: 1;
    min-width: 0;
}

.sv2-eyebrow {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--rlv-text-soft);
    font-weight: 600;
}

.sv2-title {
    margin: 4px 0 4px;
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--rlv-text);
    line-height: 1.15;
}

.sv2-subtitle {
    color: var(--rlv-text-soft);
    font-size: .95rem;
}

.sv2-card {
    position: relative;
    border-radius: 22px;
    padding: 22px 24px;
    background: rgba(255, 255, 255, .78);
    backdrop-filter: blur(6px);
    box-shadow: 0 8px 28px rgba(15, 23, 42, .14);
    border: 1px solid rgba(255, 255, 255, .5);
    overflow: hidden;
}

:root[data-theme="dark"] .sv2-card {
    background: rgba(40, 50, 78, .72);
    border-color: rgba(255, 255, 255, .06);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}

/* Empty state */
.sv2-empty-card {
    text-align: center;
    padding: 36px 28px;
}

.sv2-empty-icon {
    width: 88px;
    height: 88px;
    margin: 0 auto 14px;
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e0e5f7, #c8d4f0);
    color: var(--rlv-primary);
    font-size: 38px;
    box-shadow: inset 0 0 0 1px rgba(63, 74, 141, .12);
}

:root[data-theme="dark"] .sv2-empty-icon {
    background: linear-gradient(135deg, #2a335c, #1a2244);
    color: #c3cbf0;
}

.sv2-empty-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--rlv-text);
    margin-bottom: 6px;
}

.sv2-empty-text {
    color: var(--rlv-text-soft);
    max-width: 460px;
    margin: 0 auto 12px;
}

.sv2-empty-hint {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(63, 74, 141, .08);
    color: var(--rlv-primary);
    font-size: .9rem;
}

:root[data-theme="dark"] .sv2-empty-hint {
    background: rgba(195, 203, 240, .1);
    color: #c3cbf0;
}

.sv2-hint-icon {
    font-size: .85rem;
}

/* Active session card (client) */
.sv2-active-card {
    padding: 26px;
}

.sv2-pulse {
    position: absolute;
    top: -40px;
    right: -40px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(52, 229, 54, .25) 0%, rgba(52, 229, 54, 0) 60%);
    animation: sv2pulse 2.4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes sv2pulse {
    0%, 100% { transform: scale(.8); opacity: .6; }
    50%      { transform: scale(1.1); opacity: 1; }
}

.sv2-active-head {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
}

.sv2-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.sv2-avatar {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .25);
    border: 3px solid #fff;
}

:root[data-theme="dark"] .sv2-avatar {
    border-color: #1c2542;
}

.sv2-online-dot {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--vsv2-good);
    border: 3px solid #fff;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, .55);
    animation: sv2dot 1.6s ease-out infinite;
}

:root[data-theme="dark"] .sv2-online-dot {
    border-color: #1c2542;
}

@keyframes sv2dot {
    0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); }
    100% { box-shadow: 0 0 0 12px rgba(34, 197, 94, 0); }
}

.sv2-active-info {
    flex: 1;
    min-width: 0;
}

.sv2-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 6px;
}

.sv2-badge-live {
    background: rgba(239, 68, 68, .12);
    color: #ef4444;
}

.sv2-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    animation: sv2pulse 1.4s ease-in-out infinite;
}

.sv2-active-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--rlv-text);
    word-break: break-word;
}

.sv2-active-meta {
    margin-top: 4px;
    color: var(--rlv-text-soft);
    font-size: .92rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sv2-active-actions {
    display: flex;
    justify-content: stretch;
}

.sv2-join-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 22px;
    border-radius: 16px;
    border: 0;
    background: linear-gradient(135deg, #34e536, #16a34a);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
    box-shadow: 0 10px 24px rgba(22, 163, 74, .4);
}

.sv2-join-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(22, 163, 74, .5);
}

.sv2-join-btn:active { transform: translateY(0); }

/* Start card (therapist/admin) */
.sv2-start-card {
    padding: 26px;
}

.sv2-start-head {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.sv2-start-icon {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--rlv-primary), var(--rlv-accent));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 8px 20px rgba(63, 74, 141, .35);
}

.sv2-start-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--rlv-text);
    line-height: 1.2;
}

.sv2-start-hint {
    color: var(--rlv-text-soft);
    font-size: .92rem;
    margin-top: 2px;
}

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

.sv2-field-label {
    font-weight: 600;
    color: var(--rlv-text);
    font-size: .9rem;
}

.sv2-start-actions {
    margin-top: 8px;
}

.sv2-primary-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 22px;
    border-radius: 14px;
    border: 0;
    background: linear-gradient(135deg, var(--rlv-primary-500), var(--rlv-primary-600));
    color: #fff;
    font-size: 1.02rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s;
    box-shadow: 0 8px 22px rgba(63, 74, 141, .35);
}

.sv2-primary-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(63, 74, 141, .45);
}

.sv2-primary-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.sv2-tips {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}

.sv2-tip {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(63, 74, 141, .06);
    color: var(--rlv-text-soft);
    font-size: .88rem;
    line-height: 1.4;
}

.sv2-tip i {
    color: var(--rlv-primary);
    margin-top: 2px;
}

:root[data-theme="dark"] .sv2-tip {
    background: rgba(255, 255, 255, .05);
}

:root[data-theme="dark"] .sv2-tip i {
    color: #a8b5ff;
}

@media (max-width: 640px) {
    .sv2-topbar { flex-direction: column; gap: 10px; }
    .sv2-title { font-size: 1.4rem; }
    .sv2-active-head { flex-direction: column; text-align: center; }
    .sv2-active-info { width: 100%; }
    .sv2-active-meta { justify-content: center; }
}

/* =====================================================================
   VIDEO SESSION V2 — ZOOM-LIKE STAGE
   ===================================================================== */
.vsv2-page {
    display: contents;
}

.vsv2-shell {
    position: fixed;
    inset: 0;
    background: var(--vsv2-stage-bg);
    color: var(--vsv2-chrome-text);
    display: grid;
    grid-template-rows: auto 1fr auto;
    z-index: 5;
    overflow: hidden;
}

/* SPLIT MODE — protocol panel is rendered below the video shell on desktop.
   Page escapes the layout column to fixed-fullscreen so video and protocol
   both span the full viewport width. */
.vsv2-page.is-split {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-rows: minmax(360px, 65vh) 1fr;
    background: var(--vsv2-stage-bg);
    overflow-y: auto;
    z-index: 5;
}

.vsv2-page.is-split .vsv2-shell {
    position: relative;
    inset: auto;
    height: 100%;
    z-index: 1;
}

.vsv2-protocol-pane {
    background: linear-gradient(180deg, rgba(11, 16, 32, .04), rgba(11, 16, 32, .02));
    border-top: 1px solid rgba(0, 0, 0, .08);
    padding: 20px 28px 32px;
    min-height: 360px;
}

:root[data-theme="dark"] .vsv2-protocol-pane {
    background: linear-gradient(180deg, rgba(20, 26, 44, .9), rgba(11, 16, 32, .95));
    border-top-color: rgba(255, 255, 255, .06);
}

.vsv2-protocol-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
}

:root[data-theme="dark"] .vsv2-protocol-head {
    border-bottom-color: rgba(255, 255, 255, .08);
}

.vsv2-protocol-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--rlv-text, #1a1f2e);
    letter-spacing: -0.01em;
}

.vsv2-protocol-title i {
    color: var(--rlv-primary, #5b6cf5);
    font-size: 1rem;
}

.vsv2-protocol-close {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 0;
    background: rgba(0, 0, 0, .05);
    color: var(--rlv-text, #1a1f2e);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s ease, transform .12s ease;
}

:root[data-theme="dark"] .vsv2-protocol-close {
    background: rgba(255, 255, 255, .08);
    color: #e6e9f2;
}

.vsv2-protocol-close:hover { background: rgba(0, 0, 0, .1); }
.vsv2-protocol-close:active { transform: scale(.94); }
:root[data-theme="dark"] .vsv2-protocol-close:hover { background: rgba(255, 255, 255, .14); }

.vsv2-protocol-body {
    max-width: 1400px;
    margin: 0 auto;
}

/* TOPBAR */
.vsv2-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--vsv2-chrome-bg);
    border-bottom: 1px solid var(--vsv2-chrome-border);
    backdrop-filter: blur(10px);
    z-index: 3;
}

.vsv2-topbar-left,
.vsv2-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.vsv2-topbar-right {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.vsv2-icon-btn.vsv2-back {
    border-radius: 12px;
    padding: 8px 12px;
}

.vsv2-room-meta {
    min-width: 0;
}

.vsv2-room-title {
    font-size: .98rem;
    font-weight: 700;
    color: var(--vsv2-chrome-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vsv2-room-sub {
    margin-top: 2px;
    font-size: .82rem;
    color: var(--vsv2-chrome-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.vsv2-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--vsv2-pill-bg);
    color: var(--vsv2-chrome-text);
    font-size: .82rem;
    font-weight: 600;
    white-space: nowrap;
}

.vsv2-pill i { font-size: .85rem; }

.vsv2-pill-duration {
    font-variant-numeric: tabular-nums;
    background: rgba(255, 255, 255, .12);
}

.vsv2-pill-conn.is-ok    { background: rgba(34, 197, 94, .18);  color: #86efac; }
.vsv2-pill-conn.is-warn  { background: rgba(245, 158, 11, .18); color: #fcd34d; }
.vsv2-pill-conn.is-bad   { background: rgba(239, 68, 68, .18);  color: #fca5a5; }
.vsv2-pill-conn.is-idle  { background: rgba(160, 174, 192, .18); color: #cbd5e1; }

.vsv2-pill-warn {
    background: rgba(245, 158, 11, .25);
    color: #fcd34d;
}

/* Quality pills: signal bars + label */
.vsv2-pill-q {
    gap: .45rem;
    padding-left: .55rem;
    padding-right: .65rem;
    background: rgba(255, 255, 255, .08);
    transition: background-color .25s ease, color .25s ease;
}
.vsv2-pill-q-label {
    font-size: .78rem;
    letter-spacing: .01em;
    opacity: .9;
}
.vsv2-signal {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 12px;
    color: currentColor;
}
.vsv2-signal > span {
    width: 3px;
    background: currentColor;
    border-radius: 1px;
    opacity: .22;
    transition: opacity .25s ease;
}
.vsv2-signal > span:nth-child(1) { height: 30%; }
.vsv2-signal > span:nth-child(2) { height: 55%; }
.vsv2-signal > span:nth-child(3) { height: 78%; }
.vsv2-signal > span:nth-child(4) { height: 100%; }

.vsv2-pill-q.is-excellent { background: rgba(34, 197, 94, .16);  color: #86efac; }
.vsv2-pill-q.is-excellent .vsv2-signal > span { opacity: 1; }

.vsv2-pill-q.is-good      { background: rgba(132, 204, 22, .14); color: #bef264; }
.vsv2-pill-q.is-good .vsv2-signal > span:nth-child(-n+3) { opacity: 1; }

.vsv2-pill-q.is-poor      { background: rgba(245, 158, 11, .20); color: #fcd34d; }
.vsv2-pill-q.is-poor .vsv2-signal > span:nth-child(-n+2) { opacity: 1; }
.vsv2-pill-q.is-poor .vsv2-signal > span:nth-child(-n+2) { animation: vsv2-sig-pulse 1.6s ease-in-out infinite; }

.vsv2-pill-q.is-lost      { background: rgba(239, 68, 68, .22);  color: #fca5a5; }
.vsv2-pill-q.is-lost .vsv2-signal > span:nth-child(1) { opacity: 1; animation: vsv2-sig-pulse 1.1s ease-in-out infinite; }

.vsv2-pill-q.is-unknown   { background: rgba(160, 174, 192, .14); color: #cbd5e1; }

@keyframes vsv2-sig-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: .35; }
}

/* Stage notice — non-intrusive quality banner */
.vsv2-net-notice {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem .8rem;
    border-radius: 999px;
    font-size: .8rem;
    line-height: 1;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
    z-index: 5;
    pointer-events: none;
    animation: vsv2-net-fadein .35s ease both;
}
.vsv2-net-notice.is-warn { background: rgba(245, 158, 11, .85); color: #1f1408; }
.vsv2-net-notice.is-bad  { background: rgba(239, 68, 68, .9);  color: #fff; }
@keyframes vsv2-net-fadein {
    from { opacity: 0; transform: translate(-50%, -6px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

.vsv2-pill-rec {
    background: rgba(239, 68, 68, .22);
    color: #fca5a5;
    font-variant-numeric: tabular-nums;
}
.vsv2-pill-rec i {
    color: #ef4444;
    animation: vsv2-rec-pulse 1.2s ease-in-out infinite;
}
@keyframes vsv2-rec-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: .35; }
}

/* STAGE — LiveKit manages its own DOM inside .vsv2-livekit-root */
.vsv2-stage {
    position: relative;
    overflow: hidden;
    background: var(--vsv2-stage-bg);
}

.vsv2-livekit-root {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: var(--vsv2-stage-bg);
}

/* LiveKit DOM helpers render their grid inside .vsv2-livekit-root — ensure tiles fill the area */
.vsv2-livekit-root > * {
    width: 100%;
    height: 100%;
}

/* SPOTLIGHT — main video fills stage, other floats as PiP corner.
   Keep .gc-grid using its default grid layout (from group-calls.css)
   so untagged cells render normally. Tagged cells (main/pip) escape
   via position:absolute relative to the already-absolute .gc-grid. */

.vsv2-spotlight .vsv2-livekit-root .gc-cell {
    margin: 0;
    transition: inset .25s ease, width .25s ease, height .25s ease,
                border-radius .25s ease, box-shadow .25s ease;
}

.vsv2-spotlight .vsv2-livekit-root .gc-cell[data-vsv2-pos="main"],
.vsv2-spotlight .vsv2-livekit-root .gc-cell[data-vsv2-pos="pip"] {
    position: absolute;
}

.vsv2-spotlight .vsv2-livekit-root .gc-cell[data-vsv2-pos="main"] {
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    z-index: 1;
    box-shadow: none;
}

.vsv2-spotlight .vsv2-livekit-root .gc-cell[data-vsv2-pos="pip"] {
    inset: auto 16px 16px auto;
    width: clamp(140px, 22vw, 240px);
    aspect-ratio: 3 / 4;
    height: auto;
    border-radius: 14px;
    overflow: hidden;
    z-index: 3;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .08);
    cursor: grab;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.vsv2-spotlight .vsv2-livekit-root .gc-cell[data-vsv2-pos="pip"][data-pip-index="1"] {
    inset: auto auto 16px 16px;
}

.vsv2-spotlight .vsv2-livekit-root .gc-cell[data-vsv2-pos="pip"][data-dragging="true"] {
    cursor: grabbing;
    transition: none;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .75), 0 0 0 1px rgba(168, 181, 255, .55);
}

.vsv2-spotlight .vsv2-livekit-root .gc-cell[data-vsv2-pos="pip"]:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, .65), 0 0 0 1px rgba(168, 181, 255, .35);
}

.vsv2-spotlight .vsv2-livekit-root .gc-cell[data-vsv2-pos="pip"]::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}

/* When immersive on the stage, lift the PiP above any safe-area */
.vsv2-stage.vsv2-immersive .vsv2-livekit-root .gc-cell[data-vsv2-pos="pip"] {
    inset: auto calc(16px + env(safe-area-inset-right, 0px))
           calc(16px + env(safe-area-inset-bottom, 0px)) auto;
}

.vsv2-stage.vsv2-immersive .vsv2-livekit-root .gc-cell[data-vsv2-pos="pip"][data-pip-index="1"] {
    inset: auto auto
           calc(16px + env(safe-area-inset-bottom, 0px))
           calc(16px + env(safe-area-inset-left, 0px));
}

/* FLOATING MINI-CONTROLS (immersive mode) */
.vsv2-mini-controls {
    position: absolute;
    left: 50%;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(11, 16, 32, .72);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 999px;
    backdrop-filter: blur(12px);
    z-index: 6;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
}

.vsv2-mini-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, .08);
    color: #e6e9f2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s ease, transform .12s ease;
    -webkit-tap-highlight-color: transparent;
}

.vsv2-mini-btn:hover { background: rgba(255, 255, 255, .14); }
.vsv2-mini-btn:active { transform: scale(.94); }
.vsv2-mini-btn i { font-size: 1.05rem; line-height: 1; }

.vsv2-mini-btn.is-off {
    background: rgba(239, 68, 68, .28);
    color: #fecaca;
}
.vsv2-mini-btn.is-off i { color: #fca5a5; }

.vsv2-mini-leave {
    background: var(--vsv2-leave);
    color: #fff;
}
.vsv2-mini-leave:hover { background: var(--vsv2-leave-hover); }
.vsv2-mini-leave i { color: #fff; }

/* Unlock-audio prompt overlay */
.vsv2-unlock {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(4, 6, 15, .72);
    z-index: 4;
    backdrop-filter: blur(6px);
}

.vsv2-unlock-card {
    background: var(--vsv2-stage-bg-soft);
    border: 1px solid var(--vsv2-chrome-border);
    border-radius: 18px;
    padding: 22px 26px;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .55);
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.vsv2-unlock-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--vsv2-chrome-text);
}

.vsv2-unlock-text {
    color: var(--vsv2-chrome-muted);
    font-size: .92rem;
}

/* Waiting overlay */
.vsv2-waiting {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: linear-gradient(135deg, rgba(11, 16, 32, .85), rgba(28, 37, 66, .85));
    color: #e6e9f2;
    z-index: 1;
    pointer-events: none;
}

.vsv2-waiting-ring {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, .15);
    border-top-color: #a8b5ff;
    animation: vsv2spin 1s linear infinite;
}

.vsv2-waiting-text { font-size: .95rem; color: #cbd5e1; }

@keyframes vsv2spin {
    to { transform: rotate(360deg); }
}

/* Pre-join lobby */
.vsv2-lobby {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(circle at 50% 35%, rgba(91, 108, 245, .18), transparent 60%),
                linear-gradient(135deg, rgba(11, 16, 32, .92), rgba(28, 37, 66, .92));
    z-index: 2;
}

.vsv2-lobby-card {
    max-width: 460px;
    width: 100%;
    padding: 28px 26px 30px;
    border-radius: 22px;
    background: rgba(15, 20, 36, .88);
    border: 1px solid rgba(255, 255, 255, .08);
    color: #e6e9f2;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
    backdrop-filter: blur(14px);
}

.vsv2-lobby-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5b6cf5, #8b5cf6);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    box-shadow: 0 10px 30px rgba(91, 108, 245, .45);
}

.vsv2-lobby-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.vsv2-lobby-text {
    color: var(--vsv2-chrome-muted);
    font-size: .92rem;
    line-height: 1.45;
    margin-bottom: 22px;
}

.vsv2-lobby-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 26px;
    border-radius: 999px;
    border: 0;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 10px 24px rgba(34, 197, 94, .35);
    transition: transform .12s ease, box-shadow .18s ease, filter .18s ease;
}

.vsv2-lobby-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
    box-shadow: 0 14px 30px rgba(34, 197, 94, .45);
}

.vsv2-lobby-btn:active {
    transform: translateY(0);
}

/* CONTROL BAR */
.vsv2-controlbar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    background: var(--vsv2-chrome-bg);
    border-top: 1px solid var(--vsv2-chrome-border);
    backdrop-filter: blur(10px);
    z-index: 3;
}

.vsv2-ctrl-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.vsv2-ctrl-group-end { margin-left: auto; }

.vsv2-ctrl {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 68px;
    padding: 10px 14px;
    border-radius: 14px;
    border: 0;
    background: var(--vsv2-ctrl-bg);
    color: var(--vsv2-chrome-text);
    font-size: .72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, transform .12s ease;
    -webkit-tap-highlight-color: transparent;
}

.vsv2-ctrl:hover { background: var(--vsv2-ctrl-bg-hover); }
.vsv2-ctrl:active { transform: scale(.96); }

.vsv2-ctrl i {
    font-size: 1.15rem;
    line-height: 1;
}

.vsv2-ctrl-label {
    line-height: 1;
    white-space: nowrap;
}

.vsv2-ctrl.is-off {
    background: rgba(239, 68, 68, .22);
    color: #fecaca;
}

.vsv2-ctrl.is-off i { color: #fca5a5; }

.vsv2-ctrl.is-active {
    background: rgba(99, 102, 241, .25);
    color: #c7d2fe;
}

.vsv2-ctrl.is-rec {
    background: rgba(239, 68, 68, .28);
    color: #fecaca;
}
.vsv2-ctrl.is-rec i { color: #ef4444; }

.vsv2-ctrl-leave {
    background: var(--vsv2-leave);
    color: #fff;
    min-width: 96px;
}

.vsv2-ctrl-leave:hover { background: var(--vsv2-leave-hover); }
.vsv2-ctrl-leave i { color: #fff; }

/* IMMERSIVE — hide chrome, stage takes the whole shell */
.vsv2-shell.is-fullscreen .vsv2-topbar,
.vsv2-shell.is-fullscreen .vsv2-controlbar {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 5;
    opacity: 0;
    pointer-events: none;
    transform: translateY(0);
    transition: opacity .25s ease, transform .25s ease;
}

.vsv2-shell.is-fullscreen .vsv2-topbar    { top: 0; transform: translateY(-100%); }
.vsv2-shell.is-fullscreen .vsv2-controlbar { bottom: 0; transform: translateY(100%); }
.vsv2-shell.is-fullscreen .vsv2-stage     { grid-row: 1 / -1; }

/* MOBILE */
@media (max-width: 768px) {
    .vsv2-topbar { padding: 10px 12px; }
    .vsv2-room-title { font-size: .92rem; }
    .vsv2-pill { padding: 4px 10px; font-size: .76rem; }
    .vsv2-controlbar {
        padding: 10px 8px calc(10px + env(safe-area-inset-bottom, 0px));
        gap: 6px;
    }
    .vsv2-ctrl {
        min-width: 58px;
        padding: 8px 10px;
        font-size: .68rem;
    }
    .vsv2-ctrl i { font-size: 1.05rem; }
    .vsv2-ctrl-leave { min-width: 76px; }
    .vsv2-ctrl-label { display: none; }
    .vsv2-ctrl-leave .vsv2-ctrl-label { display: inline; }
    .vsv2-pill-q-label { display: none; }
    .vsv2-pill-q { padding-left: .5rem; padding-right: .55rem; }
    .vsv2-net-notice { font-size: .72rem; padding: .35rem .65rem; }
}

/* DEVICE SETTINGS MODAL */
.vsv2-settings-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.vsv2-settings-card {
    width: min(420px, 96vw);
    background: var(--vsv2-stage-bg-soft, #11172c);
    color: #f5f7ff;
    border-radius: 16px;
    padding: 18px 18px 16px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, .5);
    border: 1px solid rgba(255, 255, 255, .08);
}

.vsv2-settings-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 14px;
}

.vsv2-settings-close {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 0;
    background: rgba(255, 255, 255, .08);
    color: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.vsv2-settings-close:hover { background: rgba(255, 255, 255, .14); }

.vsv2-settings-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.vsv2-settings-row label {
    font-size: .82rem;
    opacity: .78;
}

.vsv2-settings-row select {
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .06);
    color: inherit;
    font-size: .92rem;
}

.vsv2-settings-row select:focus {
    outline: none;
    border-color: rgba(168, 181, 255, .55);
}

.vsv2-settings-hint {
    font-size: .78rem;
    opacity: .65;
    margin-top: 6px;
    line-height: 1.4;
}
