/* ==========================================================================
   Wigmorean GoLive — Stage room  v1.0.0
   Extends wig-golive.css. Palette inherited: navy #0C1A2E, slate #646970,
   green #1A6B3A. Nothing here overrides a 1.0.0 selector.
   ========================================================================== */

:root {
    --wig-gl-navy:  #0C1A2E;
    --wig-gl-slate: #646970;
    --wig-gl-green: #1A6B3A;
    --wig-gl-gold:  #C9A84C;
    --wig-gl-ink:   #E8ECF2;
    --wig-gl-stage-bg: #0A1420;
    --wig-gl-panel: rgba(255, 255, 255, .06);
}

.wig-gl-body {
    margin: 0;
    background: var(--wig-gl-stage-bg);
    color: var(--wig-gl-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overflow: hidden;
}

.wig-gl-stage {
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    height: 100vh;
    height: 100dvh;
}

/* ─── Top bar ───────────────────────────────────────────────────────────── */
.wig-gl-bar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 10px 18px;
    background: var(--wig-gl-navy);
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.wig-gl-bar__left, .wig-gl-bar__right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.wig-gl-bar__title {
    font-weight: 700; font-size: 15px; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw;
}
.wig-gl-chip {
    font-size: 12px; padding: 3px 10px; border-radius: 50px;
    background: var(--wig-gl-panel); color: var(--wig-gl-ink); white-space: nowrap;
}
.wig-gl-timer { font-size: 12px; color: #93A2B5; font-variant-numeric: tabular-nums; }
.wig-gl-timer.is-urgent { color: var(--wig-gl-gold); font-weight: 700; }

/* ─── The toggle ────────────────────────────────────────────────────────── */
.wig-gl-toggle {
    display: inline-flex; align-items: center; gap: 9px;
    background: none; border: none; cursor: pointer; padding: 4px 6px;
    color: var(--wig-gl-ink); font-size: 13px; font-weight: 600;
}
.wig-gl-toggle__track {
    position: relative; width: 44px; height: 24px; border-radius: 50px;
    background: rgba(255,255,255,.18); transition: background .18s ease; flex: none;
}
.wig-gl-toggle__knob {
    position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
    border-radius: 50%; background: #fff; transition: transform .18s ease;
}
.wig-gl-toggle[aria-pressed="true"] .wig-gl-toggle__track { background: var(--wig-gl-green); }
.wig-gl-toggle[aria-pressed="true"] .wig-gl-toggle__knob  { transform: translateX(20px); }
.wig-gl-toggle:focus-visible { outline: 2px solid var(--wig-gl-gold); outline-offset: 3px; border-radius: 6px; }

/* ─── Permission panel ──────────────────────────────────────────────────── */
.wig-gl-perms {
    background: #10203A; border-bottom: 1px solid rgba(255,255,255,.08);
    padding: 14px 18px;
}
.wig-gl-perms__head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin-bottom: 12px; font-size: 13px;
}
.wig-gl-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.wig-gl-preset {
    background: var(--wig-gl-panel); border: 1px solid transparent; color: var(--wig-gl-ink);
    border-radius: 50px; padding: 4px 14px; font-size: 12px; font-weight: 600; cursor: pointer;
    transition: background .15s, border-color .15s;
}
.wig-gl-preset:hover     { background: rgba(255,255,255,.12); }
.wig-gl-preset.is-active { background: var(--wig-gl-green); border-color: var(--wig-gl-green); color: #fff; }

.wig-gl-perms__list {
    list-style: none; margin: 0; padding: 0;
    display: grid; gap: 8px 24px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.wig-gl-switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; }
.wig-gl-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.wig-gl-switch__ui {
    position: relative; width: 36px; height: 20px; border-radius: 50px; flex: none;
    background: rgba(255,255,255,.18); transition: background .16s;
}
.wig-gl-switch__ui::after {
    content: ""; position: absolute; top: 3px; left: 3px;
    width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .16s;
}
.wig-gl-switch input:checked + .wig-gl-switch__ui { background: var(--wig-gl-green); }
.wig-gl-switch input:checked + .wig-gl-switch__ui::after { transform: translateX(16px); }
.wig-gl-switch input:focus-visible + .wig-gl-switch__ui { outline: 2px solid var(--wig-gl-gold); outline-offset: 2px; }
.wig-gl-perms__note { margin: 12px 0 0; font-size: 12px; color: #93A2B5; }

/* ─── Stage ─────────────────────────────────────────────────────────────── */
.wig-gl-main { display: flex; min-height: 0; overflow: hidden; }

.wig-gl-grid {
    flex: 1; min-width: 0; padding: 14px; overflow-y: auto;
    display: grid; gap: 12px; align-content: start;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
/* When someone shares, the share takes the room and faces go small. */
.wig-gl-grid.has-screen { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.wig-gl-grid.has-screen .wig-gl-tile.is-screen { grid-column: 1 / -1; aspect-ratio: 16 / 9; }

.wig-gl-tile {
    position: relative; background: #0F1B2B; border-radius: 10px; overflow: hidden;
    aspect-ratio: 16 / 9; box-shadow: 0 2px 12px rgba(0,0,0,.35);
}
.wig-gl-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.wig-gl-tile.is-screen video { object-fit: contain; background: #000; }
.wig-gl-tile__name {
    position: absolute; bottom: 8px; left: 8px; z-index: 2;
    background: rgba(0,0,0,.6); color: #fff; font-size: 12px;
    padding: 3px 9px; border-radius: 50px; max-width: calc(100% - 16px);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ─── People panel ──────────────────────────────────────────────────────── */
.wig-gl-people {
    width: 300px; flex: none; background: #10203A; overflow-y: auto;
    padding: 16px; border-left: 1px solid rgba(255,255,255,.08);
}
.wig-gl-people h3 {
    margin: 0 0 12px; font-size: 14px; color: #fff;
    display: flex; align-items: center; gap: 8px;
}
.wig-gl-hand-count {
    background: var(--wig-gl-gold); color: var(--wig-gl-navy);
    border-radius: 50px; padding: 1px 8px; font-size: 11px; font-weight: 700;
}
.wig-gl-people ul { list-style: none; margin: 0; padding: 0; }
.wig-gl-person {
    display: flex; align-items: center; gap: 6px; padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,.06); font-size: 13px;
}
.wig-gl-person.has-hand { color: var(--wig-gl-gold); font-weight: 600; }
.wig-gl-person__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wig-gl-person__act {
    background: var(--wig-gl-panel); border: none; color: var(--wig-gl-ink);
    border-radius: 6px; padding: 3px 9px; font-size: 11px; cursor: pointer; white-space: nowrap;
}
.wig-gl-person__act:hover { background: rgba(255,255,255,.14); }

/* ─── Control bar ───────────────────────────────────────────────────────── */
.wig-gl-controls {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 14px; background: var(--wig-gl-navy);
    border-top: 1px solid rgba(255,255,255,.08);
}
.wig-gl-ctl {
    background: var(--wig-gl-panel); border: none; color: var(--wig-gl-ink);
    border-radius: 50px; padding: 10px 20px; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: background .15s, color .15s;
}
.wig-gl-ctl:hover { background: rgba(255,255,255,.14); }
.wig-gl-ctl.is-active { background: var(--wig-gl-green); color: #fff; }
.wig-gl-ctl--danger { background: #8B1A1A; color: #fff; }
.wig-gl-ctl--danger:hover { background: #A32020; }
.wig-gl-ctl:focus-visible { outline: 2px solid var(--wig-gl-gold); outline-offset: 3px; }

/* Recording indicator */
#wig-gl-record .wig-gl-rec-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: #666; margin-right: 6px; vertical-align: middle;
}
#wig-gl-record.is-recording .wig-gl-rec-dot { background: #E03131; animation: wig-gl-pulse 1.4s infinite; }
@keyframes wig-gl-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ─── Space panel (course page / portal) ────────────────────────────────── */
.wig-gl-space {
    border: 1px solid #E3E7EC; border-radius: 12px; padding: 20px;
    background: #fff; color: #0C1A2E; margin: 20px 0;
}
.wig-gl-space__head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.wig-gl-space__title { margin: 0; font-size: 17px; }
.wig-gl-space__live {
    display: inline-flex; align-items: center; gap: 6px;
    background: #FDECEC; color: #A32020; font-size: 12px; font-weight: 700;
    padding: 3px 12px; border-radius: 50px;
}
.wig-gl-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #E03131;
    animation: wig-gl-pulse 1.4s infinite;
}
.wig-gl-space__actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.wig-gl-space__idle { color: #5A6672; font-size: 14px; margin: 6px 0 0; }
.wig-gl-space__sub { margin: 22px 0 10px; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: #5A6672; }
.wig-gl-space__list { list-style: none; margin: 0; padding: 0; }
.wig-gl-space__list li {
    display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap;
    padding: 9px 0; border-bottom: 1px solid #EEF1F4; font-size: 14px;
}
.wig-gl-when { font-weight: 700; min-width: 150px; }
.wig-gl-mode { font-size: 12px; color: #5A6672; }

.wig-gl-recs { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.wig-gl-rec__player iframe {
    width: 100%; aspect-ratio: 16 / 9; border: none; border-radius: 8px; display: block;
}
.wig-gl-rec__meta { font-size: 13px; margin-top: 7px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wig-gl-rec__meta span { color: #5A6672; font-variant-numeric: tabular-nums; }

/* ─── Small screens ─────────────────────────────────────────────────────── */
@media (max-width: 782px) {
    .wig-gl-bar { flex-wrap: wrap; gap: 8px; }
    .wig-gl-bar__title { max-width: 100%; }
    .wig-gl-people { position: absolute; inset: auto 0 0 0; width: 100%; max-height: 55vh; z-index: 20; }
    .wig-gl-grid { grid-template-columns: 1fr; }
    .wig-gl-controls { flex-wrap: wrap; }
    .wig-gl-ctl { padding: 9px 14px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .wig-gl-toggle__track, .wig-gl-toggle__knob,
    .wig-gl-switch__ui, .wig-gl-switch__ui::after { transition: none; }
    .wig-gl-dot, #wig-gl-record.is-recording .wig-gl-rec-dot { animation: none; }
}
