  #side {
    position: relative;
    width: 264px; display: flex; flex-direction: column; min-height: 0;
    border-left: 1px solid #1b2742; background: rgba(11,17,32,0.85);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  }
  /* drag handle on the sidebar's left edge to resize it */
  #sideResizer { position: absolute; left: -4px; top: 0; bottom: 0; width: 9px; cursor: ew-resize; z-index: 6; }
  #sideResizer::after {
    content: ""; position: absolute; left: 3px; top: 0; bottom: 0; width: 2px;
    background: transparent; transition: background .12s;
  }
  #sideResizer:hover::after, #sideResizer.drag::after { background: #4774b8; }
  #people { padding: 12px 14px; border-bottom: 1px solid #1b2742; }
  .side-h {
    font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
    color: #6b7aa0; margin-bottom: 10px; display: flex; align-items: center; gap: 7px;
  }
  #nearbyTag {
    margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 600;
    font-size: 12px; color: #cfe0ff; background: #16233f; border: 1px solid #2a3a5e;
    padding: 2px 9px; border-radius: 999px;
  }
  #nearbyTag.full { background: #3a1622; border-color: #6e2c3a; color: #ffd7df; }
  .lockbtn { margin-left: auto; background: #16233f; border: 1px solid #2a3a5e; color: #cfe0ff; border-radius: 999px; padding: 2px 8px; font-size: 13px; cursor: pointer; }
  .lockbtn + #nearbyTag { margin-left: 6px; }
  .lockbtn.act { background: #2c2440; border-color: #6b5aa6; }
  #peopleList { display: flex; flex-direction: column; gap: 4px; max-height: 32vh; overflow-y: auto; }
  .person { display: flex; align-items: center; gap: 8px; padding: 4px 2px; font-size: 13.5px; }
  .pstatus { width: 9px; height: 9px; border-radius: 50%; flex: none; margin-left: 2px; }
  .pname { flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .psub { flex: 1 1 auto; min-width: 0; font-size: 11.5px; font-style: italic; color: #8aa0c8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #zoneDir { margin-top: 10px; }
  #zoneDir .side-h { margin-bottom: 4px; }
  .zdir-row { display: flex; align-items: center; gap: 8px; padding: 3px 2px; font-size: 13px; }
  .zdir-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #cfe0ff; }
  .zdir-cnt { font-size: 11.5px; color: #8aa0c8; }
  .psub.empty { opacity: 0.5; cursor: pointer; }
  .person:not(:hover) .psub.empty { visibility: hidden; }
  .pbtn {
    width: 26px; height: 26px; padding: 0; font-size: 13px; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 7px; border: 1px solid #2a3a5e; background: #11203a; color: #dce7fb; cursor: pointer;
  }
  .pbtn:hover { background: #1a2c4d; }
  .pbtn.on { background: #5aa6ff; border-color: #5aa6ff; }
  /* Role badges (owner / editor / admin) inline with the name. */
  .prole { display: inline-block; margin-left: 4px; font-size: 11px; line-height: 1; vertical-align: middle; }
  .prole-owner  { filter: drop-shadow(0 0 2px rgba(255,200,50,0.55)); }
  .prole-editor { filter: drop-shadow(0 0 2px rgba(90,166,255,0.45)); }
  .prole-admin  { filter: drop-shadow(0 0 2px rgba(255,255,255,0.45)); }
  .prole-muted  { opacity: 0.85; filter: drop-shadow(0 0 2px rgba(255,120,120,0.45)); }
  #videos {
    flex: 1; padding: 14px; display: flex; flex-direction: column; gap: 12px;
    overflow-y: auto; min-height: 0;
  }
  /* fullscreen / theater: big centred grid of the call tiles */
  #videos:fullscreen, #videos:-webkit-full-screen {
    background: #06080f; padding: 3vw; display: grid; align-content: center; gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); overflow: auto;
  }
  #videos:fullscreen .tile { aspect-ratio: 16/9; max-height: 78vh; }
  #videos:fullscreen .tile video { object-fit: contain; background: #000; }
  .tile { cursor: pointer; }
  /* compact tiles: small square grid instead of one long 4/3 column
     (only in the docked side panel — never in fullscreen/spotlight) */
  #videos.compact:not(.spot):not(:fullscreen) {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px; align-content: start;
  }
  #videos.compact:not(.spot):not(:fullscreen) .tile { aspect-ratio: 1/1; }
  #videos.compact:not(.spot):not(:fullscreen) .tile .cap { font-size: 10px; padding: 1px 5px; max-width: 86%; }
  .tile.screen { outline: 2px solid #6ef0a8; }
  .tile.screen video { object-fit: contain; background: #000; }
  .vreact { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); font-size: 30px; pointer-events: none; animation: vreactUp 1.6s ease-out forwards; z-index: 3; }
  @keyframes vreactUp { 0% { opacity: 0; transform: translate(-50%, 8px) scale(0.6); } 20% { opacity: 1; transform: translate(-50%, 0) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -42px) scale(1); } }
  .vreactbar { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; opacity: 0; transition: opacity .12s; z-index: 4; }
  .tile:hover .vreactbar { opacity: 1; }
  .vreactbar button { width: 26px; height: 26px; padding: 0; border: none; border-radius: 7px; background: rgba(12,19,32,0.82); cursor: pointer; font-size: 14px; }
  .vreactbar button:hover { background: rgba(40,60,100,0.95); }
  /* spotlight: one big "stage" tile, the rest shrink to a strip */
  #videos.spot { flex-direction: column; }
  #videos.spot .tile { aspect-ratio: auto; }
  #videos.spot .spot-main { order: -1; flex: 1 1 auto; min-height: 240px; }
  #videos.spot .tile:not(.spot-main) { flex: 0 0 72px; }
  #videos:fullscreen.spot { display: flex; flex-direction: row; flex-wrap: wrap; align-content: center; }
  #videos:fullscreen.spot .spot-main { flex: 1 0 100%; max-height: 72vh; min-height: 0; }
  #videos:fullscreen.spot .tile:not(.spot-main) { flex: 0 0 200px; height: 116px; }
  /* Left chat sidebar (collapsible Slack-style column) */
  #chatPanel {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; min-height: 0;
    width: 320px; flex-shrink: 0;
    background: rgba(11,17,32,0.85); border-right: 1px solid #1b2742;
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    transition: width 120ms ease;
  }
  #chatPanel.cs-collapsed { width: 40px; }
  .cs-head {
    display: flex; align-items: center; gap: 7px;
    padding: 10px 12px; border-bottom: 1px solid #1b2742;
    color: #cfe0ff;
  }
  .cs-title { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
  .cs-icon { font-size: 16px; }
  .cs-name { color: #cfe0ff; }
  .cs-toggle {
    background: transparent; border: 1px solid #2a3a5e; color: #cfe0ff;
    border-radius: 6px; padding: 2px 7px; font-size: 12px; cursor: pointer;
  }
  .cs-toggle:hover { background: #16233f; }
  /* In collapsed mode, the .cs-head reflows as a vertical centered stack
     of just the .cs-icon and #peopleCount. Everything else hides. */
  #chatPanel.cs-collapsed .cs-head {
    flex-direction: column; gap: 8px; padding: 12px 6px; border-bottom: none;
  }
  #chatPanel.cs-collapsed .cs-name,
  #chatPanel.cs-collapsed #chatCollapse,
  #chatPanel.cs-collapsed #lockBtn,
  #chatPanel.cs-collapsed #nearbyTag,
  #chatPanel.cs-collapsed #people,
  #chatPanel.cs-collapsed #chatLog,
  #chatPanel.cs-collapsed #chatForm,
  #chatPanel.cs-collapsed #chatResizer { display: none; }
  /* The whole collapsed rail is clickable (expands on any click — see chat.js
     #chatPanel click handler), so the pointer cursor should cover all of it. */
  #chatPanel.cs-collapsed { cursor: pointer; }
  #chatPanel #chatLog {
    flex: 1 1 auto; min-height: 0; overflow-y: auto;
    padding: 10px 12px; display: flex; flex-direction: column; gap: 4px;
    font-size: 13px;
  }
  #chatLog .cm { color: #cfe0ff; line-height: 1.4; word-break: break-word; }
  #chatLog .cm b { color: #79b8ff; }
  #chatLog .cm.me b { color: #6ef0a8; }
  #chatLog .cm.dm b { color: #c98bff; }
  #chatLog .cm.dm { color: #d9c2f0; }
  #chatLog .cm.zone b { color: #ffd45a; }
  #chatLog .cm.zone { color: #efe2b8; }
  #chatLog .cm.mention { background: #2b2440; border-left: 2px solid #c98bff; padding-left: 6px; border-radius: 4px; }
  #chatLog .cm a { color: #79b8ff; text-decoration: underline; word-break: break-all; }
  #chatLog .cm a:hover { color: #aecbff; }
  #chatForm { display: flex; padding: 10px 12px; border-top: 1px solid #1b2742; }
  #chatInput {
    width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid #2a3a5e;
    background: #0e1726; color: #fff; font-size: 14px;
  }
  #chatInput:focus { outline: none; border-color: #5aa6ff; }
  /* drag handle on the chat sidebar's right edge — mirror of #sideResizer */
  #chatResizer { position: absolute; right: -4px; top: 0; bottom: 0; width: 9px; cursor: ew-resize; z-index: 6; }
  #chatResizer::after {
    content: ""; position: absolute; left: 3px; top: 0; bottom: 0; width: 2px;
    background: transparent; transition: background .12s;
  }
  #chatResizer:hover::after, #chatResizer.drag::after { background: #4774b8; }
  /* Floating media controls (mic/cam/share/exit) reparented into #videos while
     fullscreen — the real toolbar buttons relocate here so they stay reachable. */
  #fsControls {
    position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
    z-index: 20; display: flex; gap: 8px; padding: 8px 10px;
    background: rgba(12,19,32,0.86); border: 1px solid #2a3a5e; border-radius: 14px;
    box-shadow: 0 8px 28px rgba(0,0,0,.5); opacity: 0.55; transition: opacity .15s;
  }
  #fsControls:hover { opacity: 1; }
  #fsControls .icon { font-size: 18px; }
  #chatUnread {
    position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 999px; background: #ff5a8a; color: #fff; font-size: 10px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
  }
  #chatBtn { position: relative; }
  /* "Press X" interaction prompt */
  #interactPrompt {
    position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%); z-index: 17;
    background: rgba(12,19,32,0.92); border: 1px solid #2a3a5e; color: #e8eefc;
    padding: 8px 14px; border-radius: 999px; font-size: 14px; box-shadow: 0 6px 18px rgba(0,0,0,.5);
  }
  #interactPrompt b { color: #ffd45a; }
  /* "You're busy — go free?" prompt when you wander into a nearby call */
  #busyPrompt {
    position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%); z-index: 17;
    display: flex; align-items: center; gap: 10px;
    background: rgba(12,19,32,0.94); border: 1px solid #2a3a5e; color: #e8eefc;
    padding: 8px 12px; border-radius: 999px; font-size: 14px; box-shadow: 0 6px 18px rgba(0,0,0,.5);
  }
  #busyPrompt b { color: #ffb347; }
  #busyPrompt button { padding: 5px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; border: 1px solid #2a3a5e; }
  #busyPrompt .primary { background: #39d98a; border-color: #39d98a; color: #06231a; font-weight: 600; }
  #busyPrompt .ghost { background: transparent; color: #9fb0d0; }
  .zdir-priv { font-size: 10.5px; opacity: 0.9; }
