/* Public live video extends the existing conversation; other rooms retain their theme. */
.public-video,.pv-dock,.pv-dialog{--pv-bg:#141421;--pv-panel:#1d1c2d;--pv-line:#3d3754;--pv-ink:#f6f3ff;--pv-muted:#bbb2d1;--pv-purple:#a777fa;--pv-focus:#c9a6ff;color:var(--pv-ink);font-size:12px;line-height:1.45}
.public-video{flex:0 0 auto;min-width:0;background:var(--pv-bg);border-bottom:1px solid var(--pv-line);overflow:hidden}
.public-video[hidden],.pv-dock[hidden],.public-video [hidden],.pv-dialog [hidden]{display:none!important}
.pv-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:46px;padding:7px 12px}
.pv-title{display:flex;align-items:center;gap:8px;flex-wrap:wrap;min-width:0}.pv-title>svg{width:19px;height:19px;color:var(--pv-purple)}.pv-title>strong{font-size:13px;font-weight:650}.pv-live{padding:2px 7px;border-radius:5px;background:#cc334c;color:#fff;font-size:10px;font-weight:700;letter-spacing:.06em}.pv-counts{font-size:11px;color:var(--pv-muted);white-space:nowrap}.pv-top-actions{display:flex;align-items:center;gap:6px;flex-shrink:0}
.pv-button,.pv-icon-button,.pv-media-button,.pv-tab,.pv-camera-more,.pv-camera-expand{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:36px;padding:7px 10px;border:1px solid var(--pv-line);border-radius:8px;background:var(--pv-panel);color:var(--pv-ink);font:inherit;line-height:1.25;cursor:pointer;touch-action:manipulation}
.pv-button:hover,.pv-icon-button:hover,.pv-media-button:hover,.pv-tab:hover{background:#302740;border-color:var(--pv-purple)}.pv-button:focus-visible,.pv-icon-button:focus-visible,.pv-media-button:focus-visible,.pv-tab:focus-visible,.pv-camera-more:focus-visible,.pv-camera-expand:focus-visible,.pv-dialog input:focus-visible,.pv-dialog select:focus-visible,.pv-dialog textarea:focus-visible{outline:2px solid var(--pv-focus);outline-offset:2px}
.pv-button:disabled,.pv-media-button:disabled{opacity:.45;cursor:not-allowed}.pv-button>svg,.pv-media-button>svg,.pv-icon-button>svg,.pv-camera-more>svg,.pv-camera-expand>svg{width:20px;height:20px;flex-shrink:0}.pv-primary{background:#7f38d0;border-color:#ac79f5;color:white;font-weight:600}.pv-primary:hover{background:#9250df}.pv-danger{background:#ae2c44;border-color:#da566a;color:#fff}.pv-icon-button{width:36px;min-width:36px;padding:6px}.pv-icon-button>span,.pv-camera-more>span,.pv-camera-expand>span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
.pv-stage{padding:0 10px 7px}.pv-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:minmax(0,1fr);gap:7px;height:clamp(150px,32svh,310px);max-width:100%;margin:auto}.pv-grid[data-count="0"]{display:none}.pv-grid[data-count="1"]{grid-template-columns:minmax(0,1fr);max-width:720px}.pv-grid[data-count="2"]{height:clamp(140px,26svh,270px)}.pv-grid[data-count="3"]{grid-template-columns:1.4fr 1fr;grid-template-rows:repeat(2,minmax(0,1fr))}.pv-grid[data-count="3"]>.pv-tile:first-child{grid-row:1/3}.pv-grid[data-count="4"]{grid-template-rows:repeat(2,minmax(0,1fr))}
.pv-tile{position:relative;min-width:0;min-height:0;overflow:hidden;border:2px solid #46414f;border-radius:11px;background:#242234;isolation:isolate}.pv-tile.pv-speaking{border-color:#b877ff;box-shadow:0 0 0 1px #a35be6}.pv-camera{display:block;width:100%;height:100%;object-fit:cover;background:#242234;cursor:zoom-in}.pv-self .pv-camera{transform:scaleX(-1)}.pv-camera-placeholder{position:absolute;inset:0;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:5px;background:radial-gradient(ellipse at top,#423251,#201d2c)}.pv-camera-placeholder>.pv-avatar{width:45px;height:45px;font-size:22px;opacity:.9}.pv-camera-placeholder>small{color:var(--pv-muted);font-size:11px}
.pv-camera-label{position:absolute;bottom:0;inset-inline:0;display:flex;align-items:center;gap:6px;min-height:35px;padding:6px;background:linear-gradient(transparent,rgba(0,0,0,.84));pointer-events:none}.pv-camera-name{display:flex;align-items:center;gap:5px;min-width:0;flex:1;overflow:hidden}.pv-nickname{display:inline-flex;align-items:center;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pv-camera-name .nickname-text{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pv-camera-name .member-rank-icon{flex-shrink:0;transform:scale(.85);transform-origin:center}.pv-avatar{display:inline-flex;align-items:center;justify-content:center;width:25px;height:25px;min-width:25px;border-radius:50%;background:#4d3b63;overflow:hidden;font-size:12px;color:#fff}.pv-avatar img{width:100%;height:100%;object-fit:cover}.pv-mic,.pv-quality{display:inline-flex;flex-shrink:0;width:15px;height:18px}.pv-mic svg,.pv-quality svg{width:100%;height:100%}.pv-muted-icon{position:relative;color:#aaa}.pv-muted-icon:after{content:"";position:absolute;left:0;top:9px;width:19px;border-top:2px solid #ff929a;transform:rotate(-45deg)}.pv-quality{color:#80dc9c}.pv-quality[data-quality="poor"]{color:#f3bb65}.pv-quality[data-quality="lost"],.pv-quality[data-quality="unknown"]{color:#c39aa9}.pv-camera-more,.pv-camera-expand{position:absolute;top:5px;background:#14121dbf;border-color:transparent;min-height:30px;width:30px;padding:4px;z-index:2}.pv-camera-more{inset-inline-end:5px}.pv-camera-expand{inset-inline-start:5px}.pv-camera-expand>svg{width:16px;height:16px}
.pv-tile:fullscreen{border:0;border-radius:0;width:100vw;height:100vh;background:#080810}.pv-tile:fullscreen .pv-camera{object-fit:contain}.pv-tile:fullscreen .pv-camera-label{padding:15px;font-size:16px}.pv-tile:fullscreen .pv-camera-expand{width:44px;height:44px}.pv-tile.pv-enlarged{position:fixed;inset:env(safe-area-inset-top) 0 env(safe-area-inset-bottom);z-index:90;border-radius:0}.pv-tile.pv-enlarged .pv-camera{object-fit:contain}.pv-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;min-height:110px;padding:16px;text-align:center;background:#1b1928;border-radius:10px}.pv-empty>svg{width:30px;height:30px;color:var(--pv-purple)}.pv-not-connected .pv-grid{display:none}
.pv-notice{margin:0;padding:4px 12px 8px;color:#c7b8eb;font-size:11px;overflow-wrap:anywhere}.pv-error{color:#ffb3bd!important}.pv-muted{color:var(--pv-muted);font-size:11px}.pv-tabs{display:flex;gap:4px;align-items:center;padding:0 10px;border-top:1px solid #ffffff0b;border-bottom:1px solid var(--pv-line)}.pv-tab{min-height:39px;min-width:72px;border:0;border-bottom:3px solid transparent;border-radius:0;background:transparent;color:var(--pv-muted);padding:6px 11px 4px}.pv-tab[aria-selected="true"]{border-bottom-color:var(--pv-purple);color:#fff}.pv-tab small{min-width:17px;padding:1px 4px;border-radius:5px;background:#3c2d55;color:#dbc7fb;font-size:10px}.pv-pane{max-height:260px;overflow-y:auto;padding:9px;overscroll-behavior:contain;scrollbar-width:thin}.pv-person{display:flex;align-items:center;flex-wrap:wrap;gap:8px;padding:7px 3px;border-bottom:1px solid #ffffff0c}.pv-person-name{display:flex;align-items:center;gap:6px;min-width:0;max-width:70%;padding:0;border:0;background:none;color:inherit;text-align:start;font:inherit;cursor:pointer}.pv-person>.pv-nickname,.pv-person>.pv-person-name{flex:1}.pv-presence{font-size:10px;color:#a7cbb3}.pv-person .pv-button{min-height:32px;padding:5px 8px;font-size:11px}.pv-slot-locks{display:flex;gap:6px;flex-wrap:wrap;padding-top:10px}.pv-slot-locks>strong{width:100%;font-size:12px}.pv-slot-locks button[aria-pressed="true"]{border-color:#bc92ef;background:#432f5d}
.pv-dock{flex:0 0 auto;background:var(--pv-bg);border-top:1px solid var(--pv-line);padding-bottom:env(safe-area-inset-bottom)}.pv-controls{display:flex;align-items:center;justify-content:center;gap:8px;padding:6px 10px;flex-wrap:wrap}.pv-media-button{flex-direction:column;gap:3px;min-width:48px;border:0;background:transparent;font-size:10px;padding:4px 7px;min-height:48px}.pv-media-button.pv-off{color:#b6aec6}.pv-media-button.pv-off>svg{opacity:.7}.pv-controls>.pv-primary,.pv-controls>.pv-danger{min-height:39px;margin-inline-start:6px}.pv-options{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:12px;padding:0 10px 6px;color:var(--pv-muted);font-size:10px}.pv-check{display:inline-flex;align-items:center;gap:6px;min-height:26px;cursor:pointer}.pv-check>input{width:16px;height:16px;accent-color:#a675ef;flex-shrink:0}.pv-field{display:flex;flex-direction:column;gap:5px;min-width:0}.pv-field>span{font-size:12px}.pv-field>input,.pv-field>select,.pv-report textarea,.pv-report-row input{min-height:38px;min-width:0;width:100%;border:1px solid var(--pv-line);border-radius:7px;background:var(--pv-panel);color:var(--pv-ink);padding:7px 9px;font:inherit}.pv-options .pv-field{flex-direction:row;align-items:center;gap:6px}.pv-options .pv-field>span{font-size:10px}.pv-options .pv-field>select{min-height:26px;width:76px;padding:3px 6px;font-size:10px}
.chat-panel[data-video-tab="users"] .conversation-frame,.chat-panel[data-video-tab="requests"] .conversation-frame,.chat-panel[data-video-tab="users"] #messageForm,.chat-panel[data-video-tab="requests"] #messageForm,.chat-panel:is([data-video-tab="users"],[data-video-tab="requests"]) #roomTrivia,.chat-panel:is([data-video-tab="users"],[data-video-tab="requests"]) #aiActivity{display:none!important}.chat-panel:is([data-video-tab="users"],[data-video-tab="requests"]) .public-video.pv-expanded{display:flex;flex-direction:column;flex:1;min-height:0}.chat-panel:is([data-video-tab="users"],[data-video-tab="requests"]) .pv-pane{flex:1;max-height:none;min-height:0}.chat-panel:is([data-video-tab="users"],[data-video-tab="requests"]) .pv-stage{flex:0 0 auto}
.pv-dialog{max-width:480px;width:calc(100% - 24px);max-height:calc(100dvh - 24px);padding:18px;border:1px solid #8262a4;border-radius:16px;background:var(--pv-bg);box-shadow:0 20px 80px #0009;overflow:auto}.pv-dialog::backdrop{background:#06030ebd;backdrop-filter:blur(3px)}.pv-dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:14px}.pv-dialog-heading h2{font-size:18px;margin:0}.pv-dialog-status{color:#e6bdff;font-size:12px;overflow-wrap:anywhere}.pv-dialog-footer{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px;margin-top:14px}.pv-dialog-footer>.pv-button{min-height:42px}.pv-consent{display:flex;flex-direction:column;gap:9px}.pv-consent>p{margin:0}.pv-consent ul{padding-inline-start:20px;margin:0}.pv-consent .pv-check{min-height:44px;align-items:center}.pv-consent .pv-check input{width:19px;height:19px}.pv-preview-camera{display:block;width:100%;max-height:260px;aspect-ratio:16/9;border-radius:10px;background:#211d2f;object-fit:cover;transform:scaleX(-1)}.pv-preview .pv-field{margin-top:8px}.pv-preview .pv-check{min-height:44px}.pv-camera-menu{display:flex;flex-direction:column;gap:9px}.pv-camera-menu>.pv-button{justify-content:flex-start;min-height:42px}.pv-report textarea{display:block;margin-top:12px;resize:vertical}
.pv-admin-card{--pv-bg:var(--surface);--pv-panel:var(--surface);--pv-line:var(--line);--pv-ink:var(--ink);--pv-muted:var(--muted);--pv-purple:var(--accent);--pv-focus:var(--accent);margin-top:14px}.pv-admin-card h3{margin:0 0 12px}.pv-admin-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px;align-items:end}.pv-admin-form>.rank-table-scroll,.pv-admin-form>.pv-check{grid-column:1/-1}.pv-admin-form>.rank-table-scroll{margin:5px 0}.pv-permissions input{width:18px;height:18px;accent-color:var(--accent)}.pv-admin-status{min-height:18px;font-size:13px}.pv-admin-room{border-top:1px solid var(--line);padding:10px 0}.pv-admin-room>summary{cursor:pointer;font-size:13px;font-weight:600;min-height:30px}.pv-admin-room>.pv-admin-form{padding:10px 0}.pv-admin-card .pv-person{border-bottom-color:var(--line)}.pv-report-row{border-top:1px solid var(--line);padding:13px 0}.pv-report-row>p{white-space:pre-wrap;overflow-wrap:anywhere}.pv-report-row>.pv-button{margin:8px 8px 0 0}.pv-report-row input{margin-top:8px}
@media(max-width:680px){.pv-heading{padding:5px 9px;min-height:43px}.pv-title{gap:6px}.pv-title>strong{font-size:12px}.pv-counts{font-size:10px}.pv-title>svg{display:none}.pv-grid{height:clamp(150px,28svh,240px);gap:5px}.pv-grid[data-count="2"]{height:clamp(130px,22svh,190px)}.pv-grid[data-count="1"]{height:clamp(160px,28svh,250px)}.pv-stage{padding:0 6px 5px}.pv-camera-label{gap:3px;padding:4px}.pv-camera-name{gap:3px}.pv-camera-name .pv-avatar{width:20px;height:20px;min-width:20px}.pv-camera-name .member-rank-icon{margin:0;transform:scale(.75)}.pv-quality{width:12px}.pv-mic{width:12px}.pv-camera-placeholder>.pv-avatar{width:35px;height:35px}.pv-camera-more,.pv-camera-expand{width:34px;min-height:34px}.pv-tabs{padding:0 6px}.pv-tab{min-height:42px;flex:1}.pv-controls{justify-content:space-between;gap:2px;padding:5px 7px}.pv-media-button{min-width:43px;padding:4px;min-height:47px}.pv-controls>.pv-primary,.pv-controls>.pv-danger{margin-inline-start:0;font-size:11px;max-width:126px;padding:7px 9px}.pv-options{gap:8px;padding:0 7px 4px}.pv-options>.pv-muted{display:none}.pv-dock{padding-bottom:max(2px,env(safe-area-inset-bottom))}.pv-notice{padding:3px 8px 5px;font-size:10px}.pv-admin-form{grid-template-columns:minmax(0,1fr)}.pv-dialog{padding:14px}.pv-button{min-height:42px}.pv-heading .pv-button{min-height:34px;font-size:11px}}
@media(max-height:600px){.pv-grid,.pv-grid[data-count="1"],.pv-grid[data-count="2"]{height:140px}.pv-heading{min-height:36px;padding-block:3px}.pv-empty{min-height:65px;padding:8px}.pv-empty>svg{display:none}.pv-tab{min-height:34px}.pv-options{display:none}.pv-controls{padding-block:2px}.pv-media-button{min-height:42px}.pv-notice{max-height:42px;overflow:auto}}
@media(prefers-reduced-motion:reduce){.public-video *,.pv-dock *,.pv-dialog *{scroll-behavior:auto;transition:none!important}}
@media(forced-colors:active){.pv-tile.pv-speaking{outline:3px solid Highlight}.pv-tab[aria-selected="true"]{border-bottom:3px solid Highlight}.pv-primary,.pv-danger{border:2px solid ButtonText}.pv-camera-label{background:Canvas;color:CanvasText}}

#videoAdminConsole{--pv-bg:var(--surface);--pv-panel:var(--surface);--pv-line:var(--line);--pv-ink:var(--ink);--pv-muted:var(--muted);--pv-purple:var(--accent);--pv-focus:var(--accent)}

.pv-account-results,.pv-account-selection{grid-column:1/-1;display:flex;flex-wrap:wrap;gap:.5rem;align-items:center}.pv-account-results:empty{display:none}.pv-account-results .pv-person-name{padding:.5rem .75rem;border:1px solid var(--pv-line);border-radius:.7rem}.pv-account-selection{padding:.6rem .8rem;background:rgba(154,110,255,.13);border-radius:.7rem}.pv-account-selection[hidden]{display:none}

/* The closed video summary follows the room theme. The expanded stage retains
   its dark camera surface and all existing capture, consent and video controls. */
.public-video:not(.pv-expanded) {
  --pv-bg: var(--accent-soft); --pv-panel: var(--surface); --pv-line: var(--line);
  --pv-ink: var(--ink); --pv-muted: var(--accent-text); --pv-purple: var(--accent); --pv-focus: var(--focus);
  margin: 8px 14px 0; border: 0; border-radius: 10px; background: var(--pv-bg); color: var(--pv-ink);
}
.public-video:not(.pv-expanded) .pv-heading { min-height: 48px; padding: 2px 8px 2px 10px; gap: 8px; }
.public-video:not(.pv-expanded) .pv-title { flex: 1 1 auto; gap: 7px; }
.public-video:not(.pv-expanded) .pv-title > svg { display: block; width: 18px; height: 18px; }
.public-video:not(.pv-expanded) .pv-title > strong { font-size: 13px; font-weight: 500; }
.public-video:not(.pv-expanded) .pv-counts { font-size: 11px; white-space: normal; }
.public-video:not(.pv-expanded) .pv-counts-compact { white-space: nowrap; }
.public-video:not(.pv-expanded) .pv-open-button { min-width: 44px; min-height: 44px; padding: 6px 9px; gap: 6px; border-color: var(--line); background: var(--surface); color: var(--ink); font-size: 12px; }
.public-video:not(.pv-expanded) .pv-open-button > svg { width: 14px; height: 14px; }
.public-video:not(.pv-expanded) .pv-open-button:hover { border-color: var(--accent); background: var(--subtle); }
.public-video:not(.pv-expanded) .pv-error { color: var(--error) !important; }
.public-video:not(.pv-expanded) .pv-notice { color: var(--muted); }
.public-video.pv-has-live:not(.pv-expanded) .pv-counts-compact { font-weight: 600; }

@media (max-width: 760px) {
  .public-video:not(.pv-expanded) { margin-inline: 12px; }
}
@media (max-width: 359px) {
  .public-video:not(.pv-expanded) { margin-inline: 10px; }
  .public-video:not(.pv-expanded) .pv-heading { padding-inline: 8px; }
  .public-video:not(.pv-expanded) .pv-title { gap: 6px; }
}

/* A split landscape stage is used only while video is expanded. */
@media (orientation: landscape) and (max-height: 550px) and (min-width: 600px) {
  #chatView.has-public-video:has(.public-video.pv-expanded) .conversation-column { display: grid; grid-template-columns: minmax(220px, 43%) minmax(0, 1fr); grid-template-rows: [restriction] auto [connection] auto [messages] minmax(0, 1fr) [composer] auto [video-controls] auto [end]; }
  #chatView.has-public-video:has(.public-video.pv-expanded) .restriction-notice { grid-column: 1 / -1; grid-row: restriction; }
  #chatView.has-public-video:has(.public-video.pv-expanded) .connection-notice { grid-column: 1 / -1; grid-row: connection; }
  #chatView .public-video.pv-expanded { grid-column: 1; grid-row: messages / video-controls; display: flex; flex-direction: column; min-height: 0; border-inline-end: 1px solid var(--pv-line); border-bottom: 0; }
  #chatView .public-video.pv-expanded .pv-stage { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  #chatView .public-video.pv-expanded .pv-grid { flex: 1; width: 100%; height: 100%; }
  #chatView .public-video.pv-expanded .pv-empty { flex: 1; }
  #chatView.has-public-video:has(.public-video.pv-expanded) .conversation-frame { grid-column: 2; grid-row: messages; }
  #chatView.has-public-video:has(.public-video.pv-expanded) #messageForm { grid-column: 2; grid-row: composer; }
  #chatView.has-public-video:has(.public-video.pv-expanded) .pv-dock { grid-column: 1 / -1; grid-row: video-controls; }
  #chatView.has-public-video:has(.public-video.pv-expanded) #roomTrivia, #chatView.has-public-video:has(.public-video.pv-expanded) #aiActivity { display: none; }
  #chatView.has-public-video:is([data-video-tab="users"], [data-video-tab="requests"]) .public-video.pv-expanded { grid-column: 1 / -1; }
  #chatView.has-public-video:is([data-video-tab="users"], [data-video-tab="requests"]) .pv-stage { max-height: 145px; }
  .pv-pane { max-height: 120px; }
  .pv-grid[data-count="3"] { grid-template-columns: 1.4fr 1fr; }
}

/* On a landscape phone the drawer shares the chat track, ending before its
   composer. The video stage remains visible alongside it. */
@media (orientation: landscape) and (max-height: 550px) and (min-width: 600px) and (max-width: 980px) {
  #chatView.has-public-video:has(.public-video.pv-expanded) .lobby-layout { grid-template-columns: minmax(220px, 43%) minmax(0, 1fr); grid-template-rows: [restriction] auto [connection] auto [messages] minmax(0, 1fr) [composer] auto [video-controls] auto [end]; }
  #chatView.has-public-video:has(.public-video.pv-expanded) .conversation-column { display: contents; }
  #chatView.has-public-video:has(.public-video.pv-expanded) .restriction-notice { grid-column: 1 / -1; grid-row: restriction; }
  #chatView.has-public-video:has(.public-video.pv-expanded) .connection-notice { grid-column: 1 / -1; grid-row: connection; }
  #chatView.has-public-video:has(.public-video.pv-expanded) .public-video.pv-expanded { grid-column: 1; grid-row: messages / video-controls; }
  #chatView.has-public-video:has(.public-video.pv-expanded) .conversation-frame { grid-column: 2; grid-row: messages; }
  #chatView.has-public-video:has(.public-video.pv-expanded) #messageForm { grid-column: 2; grid-row: composer; }
  #chatView.has-public-video:has(.public-video.pv-expanded) .pv-dock { grid-column: 1 / -1; grid-row: video-controls; }
  #chatView.has-public-video:has(.public-video.pv-expanded) .lobby-layout > .chat-side-panel { grid-column: 2; grid-row: restriction / composer; justify-self: end; width: min(var(--side-panel-width), 100%); }
  #chatView.has-public-video:is([data-video-tab="users"], [data-video-tab="requests"]) .public-video.pv-expanded { grid-column: 1 / -1; }
}
