:root {
  --bg: #0e1116;
  --bg-2: #161b22;
  --bg-3: #1f2630;
  --border: #2a313c;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #4f7cff;
  --accent-hover: #6b91ff;
  --danger: #e5484d;
  --danger-hover: #f0676b;
  --ok: #2ecc71;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* ---------- Lobby ---------- */
.lobby {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #1b2433 0%, var(--bg) 60%);
}
.lobby-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.brand-logo {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand h1 { font-size: 20px; margin: 0; }
.brand-sub { margin: 2px 0 0; color: var(--text-dim); font-size: 12px; }

.preview-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid var(--border);
}
.preview-wrap video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.preview-off {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 14px; background: var(--bg-3);
}
.preview-toggles { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; }

.round-btn {
  width: 42px; height: 42px; border-radius: 50%;
  border: none; cursor: pointer;
  background: rgba(255,255,255,.16); color: #fff;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  transition: background .15s;
}
.round-btn:hover { background: rgba(255,255,255,.26); }
.round-btn.off { background: var(--danger); }
.round-btn::before { content: ""; width: 20px; height: 20px; background: #fff; -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; }
#lobbyMic::before { -webkit-mask-image: var(--ico-mic); mask-image: var(--ico-mic); }
#lobbyMic.off::before { -webkit-mask-image: var(--ico-mic-off); mask-image: var(--ico-mic-off); }
#lobbyCam::before { -webkit-mask-image: var(--ico-cam); mask-image: var(--ico-cam); }
#lobbyCam.off::before { -webkit-mask-image: var(--ico-cam-off); mask-image: var(--ico-cam-off); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 11px 12px; border-radius: 10px;
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
  font-size: 14px; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; min-width: 0; }

.primary-btn {
  width: 100%; padding: 13px; border: none; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background .15s; margin-top: 4px;
}
.primary-btn:hover { background: var(--accent-hover); }
.primary-btn:disabled { opacity: .6; cursor: default; }
.hint { color: var(--text-dim); font-size: 12px; text-align: center; min-height: 16px; margin: 10px 0 0; }
.hint.err { color: var(--danger-hover); }

/* ---------- Room ---------- */
.room { height: 100%; display: flex; flex-direction: column; }
.topbar {
  height: 56px; flex: 0 0 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--bg-2);
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(46,204,113,.15); }
.room-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.room-count { color: var(--text-dim); font-size: 13px; }
.ghost-btn {
  padding: 8px 12px; border-radius: 8px; cursor: pointer;
  background: transparent; border: 1px solid var(--border); color: var(--text); font-size: 13px;
}
.ghost-btn:hover { background: var(--bg-3); }

.stage { flex: 1; display: flex; min-height: 0; }

/* ---- layout system (grid / speaker) ---- */
.grid-area { flex: 1; min-width: 0; display: flex; }
.main-zone { min-width: 0; min-height: 0; }
.strip-zone { display: none; }

/* grid (gallery) */
.grid-area.layout-grid { }
.grid-area.layout-grid .main-zone {
  flex: 1; padding: 14px; display: grid; gap: 12px; align-content: center;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); overflow: auto;
}
.grid-area.layout-grid .main-zone.count-1 { grid-template-columns: minmax(0, 1fr); }
.grid-area.layout-grid .strip-zone { display: none !important; }

/* speaker shared */
.grid-area.layout-spk-top .main-zone,
.grid-area.layout-spk-side .main-zone {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 14px;
}
.grid-area.layout-spk-top .main-zone .tile,
.grid-area.layout-spk-side .main-zone .tile {
  width: 100%; height: 100%; aspect-ratio: auto; max-height: 100%;
}
.grid-area.layout-spk-top .strip-zone,
.grid-area.layout-spk-side .strip-zone { display: flex; gap: 10px; }
.grid-area.layout-spk-top .strip-zone .tile,
.grid-area.layout-spk-side .strip-zone .tile { aspect-ratio: 16 / 9; flex: 0 0 auto; }

/* speaker - thumbnails on top */
.grid-area.layout-spk-top { flex-direction: column; }
.grid-area.layout-spk-top .strip-zone {
  order: -1; flex: 0 0 116px; padding: 10px; overflow-x: auto; overflow-y: hidden;
  border-bottom: 1px solid var(--border); align-items: center;
}
.grid-area.layout-spk-top .strip-zone .tile { height: 96px; width: 170px; }

/* speaker - shared desktop (auto when someone screen-shares) */
.grid-area.layout-screen { flex-direction: row; }
.grid-area.layout-screen .main-zone {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 0;
}
.grid-area.layout-screen .main-zone .tile {
  width: 100%; height: 100%; aspect-ratio: auto; max-height: 100%; border-radius: 0; border-color: transparent;
}
/* 演讲者·共享桌面：共享画面全屏，侧边缩略图全部隐藏 */
.grid-area.layout-screen .strip-zone { display: none !important; }

/* speaker - thumbnails on side */
.grid-area.layout-spk-side { flex-direction: row; }
.grid-area.layout-spk-side .strip-zone {
  flex: 0 0 210px; flex-direction: column; padding: 10px; overflow-y: auto; overflow-x: hidden;
  border-left: 1px solid var(--border);
}
.grid-area.layout-spk-side .strip-zone .tile { width: 100%; height: auto; }

.tile {
  position: relative; background: var(--bg-3); border-radius: 14px; overflow: hidden;
  aspect-ratio: 16 / 9; border: 2px solid transparent; min-height: 0;
}
.tile.speaking { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(79,124,255,.35); }
.tile video { width: 100%; height: 100%; object-fit: cover; background: #000; display: block; }
.tile.mirror video { transform: scaleX(-1); }
.tile .placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #232b38, #18202b);
}
.tile .avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8a5cff);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: #fff;
}
.tile .label {
  position: absolute; left: 10px; bottom: 10px;
  display: flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: 8px; background: rgba(0,0,0,.55);
  font-size: 12px; max-width: calc(100% - 20px);
}
.tile .label .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .mic-badge { width: 14px; height: 14px; flex: 0 0 14px; background: #fff; -webkit-mask: var(--ico-mic) center/contain no-repeat; mask: var(--ico-mic) center/contain no-repeat; }
.tile .mic-badge.muted { background: var(--danger-hover); -webkit-mask-image: var(--ico-mic-off); mask-image: var(--ico-mic-off); }
.tile.screen { aspect-ratio: auto; }
.tile.screen video { object-fit: contain; }

.panel {
  flex: 0 0 260px; border-left: 1px solid var(--border); background: var(--bg-2);
  display: flex; flex-direction: column;
}
.panel-head { padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 600; }
.panel-list { list-style: none; margin: 0; padding: 8px; overflow: auto; }
.panel-list li {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  position: relative;
}
.panel-list li:hover { background: var(--bg-3); }
.panel-list .pavatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px;
  background: linear-gradient(135deg, var(--accent), #8a5cff);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.panel-list .pname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.panel-list .pmic { width: 16px; height: 16px; background: var(--text-dim); -webkit-mask: var(--ico-mic) center/contain no-repeat; mask: var(--ico-mic) center/contain no-repeat; }
.panel-list .pcam { width: 16px; height: 16px; flex: 0 0 16px; background: var(--text-dim); -webkit-mask: var(--ico-cam) center/contain no-repeat; mask: var(--ico-cam) center/contain no-repeat; }
.panel-list .pcam.muted { background: var(--danger-hover); -webkit-mask-image: var(--ico-cam-off); mask-image: var(--ico-cam-off); }
.panel-list .pmic.muted { background: var(--danger-hover); -webkit-mask-image: var(--ico-mic-off); mask-image: var(--ico-mic-off); }
.prow-menu-btn {
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: 7px; cursor: pointer;
  background: transparent; border: 1px solid var(--border); color: var(--text);
  display: flex; align-items: center; justify-content: center; font-size: 18px; line-height: 1;
}
.prow-menu-btn:hover { background: var(--bg-3); }
.prow-menu {
  position: fixed; top: 0; left: 0; z-index: 60; min-width: 124px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 6px; box-shadow: 0 12px 36px rgba(0,0,0,.5);
}
.prow-menu-item {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border: none;
  background: transparent; color: var(--text); font-size: 13px; border-radius: 7px; cursor: pointer;
}
.prow-menu-item:hover { background: var(--bg-3); }
.prow-menu-item.danger { color: var(--danger, #f04438); }
.leave-menu {
  position: fixed; top: 0; left: 0; z-index: 80; min-width: 140px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 6px; box-shadow: 0 12px 36px rgba(0,0,0,.5);
}
.leave-menu-item {
  display: block; width: 100%; text-align: center; padding: 10px 12px; border: none;
  background: transparent; color: var(--text); font-size: 14px; border-radius: 7px; cursor: pointer;
}
.leave-menu-item:hover { background: var(--bg-3); }
.leave-menu-item.danger { color: var(--danger, #f04438); }
.panel-list .phostbadge {
  font-size: 11px; line-height: 1; padding: 2px 6px; border-radius: 6px;
  background: var(--brand, #2563eb); color: #fff; white-space: nowrap;
}

.controls {
  flex: 0 0 76px; display: flex; align-items: center; justify-content: center; gap: 10px;
  border-top: 1px solid var(--border); background: var(--bg-2);
}
.ctrl-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 64px; padding: 8px 12px; border-radius: 12px;
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
  cursor: pointer; transition: background .15s, border-color .15s;
}
.ctrl-btn:hover { background: #28313d; }
.ctrl-btn[disabled] { opacity: .5; cursor: default; pointer-events: none; }
.ctrl-btn.off { background: #3a2226; border-color: #5a2d31; }
.ctrl-btn.active { background: #21304f; border-color: var(--accent); }
.ctrl-btn.danger { background: var(--danger); border-color: var(--danger); }
.ctrl-btn.danger:hover { background: var(--danger-hover); }
.ctrl-label { font-size: 11px; color: var(--text-dim); }
.ctrl-btn.danger .ctrl-label { color: #fff; }
.ctrl-ico { width: 22px; height: 22px; background: var(--text); -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; }
.ctrl-btn.danger .ctrl-ico { background: #fff; }
[data-ico="mic"] { -webkit-mask-image: var(--ico-mic); mask-image: var(--ico-mic); }
.ctrl-btn.off [data-ico="mic"] { -webkit-mask-image: var(--ico-mic-off); mask-image: var(--ico-mic-off); }
[data-ico="cam"] { -webkit-mask-image: var(--ico-cam); mask-image: var(--ico-cam); }
.ctrl-btn.off [data-ico="cam"] { -webkit-mask-image: var(--ico-cam-off); mask-image: var(--ico-cam-off); }
[data-ico="share"] { -webkit-mask-image: var(--ico-share); mask-image: var(--ico-share); }
[data-ico="people"] { -webkit-mask-image: var(--ico-people); mask-image: var(--ico-people); }
[data-ico="leave"] { -webkit-mask-image: var(--ico-leave); mask-image: var(--ico-leave); }

/* hand-raise badge on tile */
.tile .hand-badge {
  position: absolute; top: 10px; left: 10px;
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(245, 197, 24, .92); font-size: 17px; line-height: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  animation: handpop .25s ease;
}
@keyframes handpop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.panel-list .phand { font-size: 15px; line-height: 1; }

/* control unread dot */
.ctrl-btn { position: relative; }
.ctrl-dot {
  position: absolute; top: 6px; right: 10px;
  width: 9px; height: 9px; border-radius: 50%; background: var(--danger-hover);
  box-shadow: 0 0 0 2px var(--bg-2);
}

/* icons for new controls */
[data-ico="chat"] { -webkit-mask-image: var(--ico-chat); mask-image: var(--ico-chat); }
[data-ico="hand"] { -webkit-mask-image: var(--ico-hand); mask-image: var(--ico-hand); }
[data-ico="bg"] { -webkit-mask-image: var(--ico-bg); mask-image: var(--ico-bg); }

/* chat panel */
.chat-panel { padding: 0; }
.chat-list { list-style: none; margin: 0; padding: 12px; flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 90%; align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; }
.chat-msg .cname { font-size: 11px; color: var(--text-dim); margin: 0 2px 3px; }
.chat-msg.mine .cname { text-align: right; }
.chat-msg .cbubble {
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
  padding: 8px 11px; border-radius: 12px; font-size: 14px; line-height: 1.4;
  word-break: break-word; white-space: pre-wrap;
}
.chat-msg.mine .cbubble { background: var(--accent); border-color: var(--accent); color: #fff; }
.chat-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }
.chat-input input {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px;
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text); font-size: 14px; outline: none;
}
.chat-input input:focus { border-color: var(--accent); }
.chat-send {
  width: 40px; flex: 0 0 40px; border: none; border-radius: 10px; cursor: pointer;
  background: var(--accent); display: flex; align-items: center; justify-content: center;
}
.chat-send:hover { background: var(--accent-hover); }
.chat-send::before {
  content: ""; width: 18px; height: 18px; background: #fff;
  -webkit-mask: var(--ico-send) center/contain no-repeat; mask: var(--ico-send) center/contain no-repeat;
}

.toast {
  position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%);
  background: #000a; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px;
  border: 1px solid var(--border); z-index: 50;
}

/* ---- topbar icon buttons + dropdown ---- */
.topbar-right { display: flex; align-items: center; gap: 8px; }
.menu-wrap { position: relative; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 9px; cursor: pointer;
  background: transparent; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--bg-3); }
.icon-btn.active { background: #21304f; border-color: var(--accent); }
.tb-ico { width: 20px; height: 20px; background: var(--text); -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; }
[data-ico="layout"] { -webkit-mask-image: var(--ico-layout); mask-image: var(--ico-layout); }
[data-ico="fullscreen"] { -webkit-mask-image: var(--ico-fullscreen); mask-image: var(--ico-fullscreen); }
[data-ico="settings"] { -webkit-mask-image: var(--ico-settings); mask-image: var(--ico-settings); }
[data-ico="record"] { -webkit-mask-image: var(--ico-record); mask-image: var(--ico-record); }

.dropdown {
  position: absolute; top: 44px; right: 0; z-index: 60; min-width: 184px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 6px; box-shadow: 0 12px 36px rgba(0,0,0,.5);
}
.dd-item {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border: none;
  background: transparent; color: var(--text); font-size: 13px; border-radius: 7px; cursor: pointer;
}
.dd-item:hover { background: var(--bg-3); }
.dd-item.active { background: #21304f; color: #fff; }

/* recording indicator */
.rec-indicator {
  display: inline-flex; align-items: center; gap: 6px; margin-left: 8px;
  padding: 3px 9px; border-radius: 20px; background: rgba(229,72,77,.16);
  color: var(--danger-hover); font-size: 12px; font-variant-numeric: tabular-nums;
}
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); animation: recblink 1s steps(1) infinite; }
@keyframes recblink { 50% { opacity: .25; } }
.ctrl-btn.recording { background: #3a2226; border-color: var(--danger); }
.ctrl-btn.recording .ctrl-ico { background: var(--danger-hover); }

/* ---- settings modal ---- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.modal-box {
  position: relative; width: 100%; max-width: 460px; max-height: 84vh; overflow: hidden;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0,0,0,.55); display: flex; flex-direction: column;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border); font-weight: 600;
}
.modal-close { width: 30px; height: 30px; border-radius: 8px; border: none; background: transparent; cursor: pointer; position: relative; }
.modal-close:hover { background: var(--bg-3); }
.modal-close::before, .modal-close::after {
  content: ""; position: absolute; left: 7px; top: 14px; width: 16px; height: 2px; background: var(--text-dim); border-radius: 2px;
}
.modal-close::before { transform: rotate(45deg); }
.modal-close::after { transform: rotate(-45deg); }
.modal-body { padding: 16px 18px; overflow: auto; }
.set-tabs { display: flex; gap: 6px; margin-bottom: 16px; background: var(--bg-3); padding: 4px; border-radius: 10px; }
.set-tab {
  flex: 1; padding: 8px 10px; border: none; border-radius: 7px; cursor: pointer;
  background: transparent; color: var(--text-dim); font-size: 13px; font-weight: 600;
}
.set-tab.active { background: var(--accent); color: #fff; }
.set-pane { display: none; }
.set-pane.active { display: block; }
.toggle-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toggle-field label { margin-bottom: 0; }
.switch {
  width: 44px; height: 25px; border-radius: 14px; border: none; cursor: pointer;
  background: var(--bg-3); border: 1px solid var(--border); position: relative; flex: 0 0 44px; transition: background .15s;
}
.switch .knob { position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: var(--text-dim); transition: left .15s, background .15s; }
.switch.on { background: var(--accent); border-color: var(--accent); }
.switch.on .knob { left: 21px; background: #fff; }
.bg-options { display: flex; flex-wrap: wrap; gap: 8px; }
.bg-opt {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 9px; cursor: pointer;
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text); font-size: 13px;
}
.bg-opt:hover { background: #28313d; }
.bg-opt.active { background: #21304f; border-color: var(--accent); }
.bg-sw { width: 16px; height: 16px; border-radius: 4px; display: inline-block; }
.rec-loc { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rec-loc-text { font-size: 12px; color: var(--text-dim); word-break: break-all; }
.set-note { font-size: 12px; color: var(--text-dim); margin: 12px 0 0; line-height: 1.5; }

/* 沉浸式悬浮布局：顶/底栏悬浮、舞台铺满；由 JS 在全屏或窄屏时加 .overlay-mode 开启 */
.room.overlay-mode { position: relative; }
.room.overlay-mode .stage { position: absolute; inset: 0; }
.room.overlay-mode .panel { position: absolute; inset: 0; width: 100%; flex-basis: auto; z-index: 20; border-left: none; padding-bottom: 64px; }
.room.overlay-mode .topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 40;
  background: rgba(17,22,29,.82); border-bottom: none;
  transition: transform .28s ease, opacity .28s ease;
}
.room.overlay-mode .controls {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 40;
  background: rgba(17,22,29,.92); border-top: none;
  transition: transform .28s ease, opacity .28s ease;
}
.room.overlay-mode.immersive .topbar { transform: translateY(-100%); opacity: 0; pointer-events: none; }
.room.overlay-mode.immersive .controls { transform: translateY(100%); opacity: 0; pointer-events: none; }

@media (max-width: 640px) {
  .controls { flex-wrap: wrap; gap: 6px; padding: 8px 6px; height: auto; min-height: 60px; }
  .ctrl-label { display: none; }
  .ctrl-btn { min-width: 0; flex: 1 1 0; max-width: 64px; padding: 9px 6px; gap: 0; }
  .ctrl-ico { width: 20px; height: 20px; }
  .room-name { max-width: 30vw; }
  .ghost-btn { display: none; }
  .toast { bottom: 96px; }
}

/* Inline SVG icons as CSS mask data-URIs */
:root {
  --ico-mic: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M12 14a3 3 0 0 0 3-3V5a3 3 0 0 0-6 0v6a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.92V21h2v-3.08A7 7 0 0 0 19 11h-2z'/></svg>");
  --ico-mic-off: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M16 11V5a3 3 0 0 0-5.94-.6l5.83 5.83c.07-.07.11-.15.11-.23zM4.27 3 3 4.27l6 6V11a3 3 0 0 0 4.31 2.69l1.52 1.52A4.9 4.9 0 0 1 12 16a5 5 0 0 1-5-5H5a7 7 0 0 0 6 6.92V21h2v-3.08a6.9 6.9 0 0 0 2.3-.79L19.73 21 21 19.73 4.27 3z'/></svg>");
  --ico-cam: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4z'/></svg>");
  --ico-cam-off: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M21 6.5l-4 4V7a1 1 0 0 0-1-1H9.82L21 17.18V6.5zM3.27 2 2 3.27 4.73 6H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 .73-.32L19.73 21 21 19.73 3.27 2z'/></svg>");
  --ico-share: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M20 3H4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h6v2H8v2h8v-2h-2v-2h6a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2zm0 13H4V5h16v11zm-9-2 5-3-5-3v6z'/></svg>");
  --ico-people: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M16 11a3 3 0 1 0-3-3 3 3 0 0 0 3 3zm-8 0A3 3 0 1 0 5 8a3 3 0 0 0 3 3zm0 2c-2.7 0-8 1.34-8 4v2h8v-2c0-1 .4-1.9 1.1-2.6A12 12 0 0 0 8 13zm8 0c-.3 0-.65 0-1 .05A4.5 4.5 0 0 1 18 17v2h6v-2c0-2.66-5.3-4-8-4z'/></svg>");
  --ico-leave: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M12 9c-1.6 0-3.15.25-4.6.72v3.1c0 .39-.23.74-.56.9-.98.49-1.87 1.12-2.66 1.85a.99.99 0 0 1-1.41-.01L.29 13.08a.99.99 0 0 1 0-1.41C3.34 8.78 7.46 7 12 7s8.66 1.78 11.71 4.67a.99.99 0 0 1 0 1.41l-2.48 2.48a.99.99 0 0 1-1.41.01 11.7 11.7 0 0 0-2.66-1.85.998.998 0 0 1-.56-.9v-3.1A15.6 15.6 0 0 0 12 9z'/></svg>");
  --ico-chat: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2zM7 9h10v2H7V9zm6 5H7v-2h6v2zm4-6H7V6h10v2z'/></svg>");
  --ico-hand: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M13 1.5a1.5 1.5 0 0 0-1.5 1.5v6h-1V4a1.5 1.5 0 0 0-3 0v7.2l-.9-1.1a1.6 1.6 0 0 0-2.5 2l3.2 4.2A6 6 0 0 0 12.4 22H15a6 6 0 0 0 6-6V6.5a1.5 1.5 0 0 0-3 0V9h-1V4a1.5 1.5 0 0 0-3 0v5h-1V3a1.5 1.5 0 0 0-1.5-1.5z'/></svg>");
  --ico-bg: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M12 12a5 5 0 1 0-5-5 5 5 0 0 0 5 5zm0 2c-4 0-9 2-9 5v1h18v-1c0-3-5-5-9-5z' opacity='.5'/><circle cx='12' cy='7' r='5'/><path d='M12 14c-4 0-9 2-9 5v1h18v-1c0-3-5-5-9-5z'/></svg>");
  --ico-send: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M2 21l21-9L2 3v7l15 2-15 2v7z'/></svg>");
  --ico-layout: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5zm2 0v6h6V5H5zm8 0v6h6V5h-6zM5 13v6h6v-6H5zm8 0v6h6v-6h-6z'/></svg>");
  --ico-fullscreen: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M4 9V4h5v2H6v3H4zm0 6h2v3h3v2H4v-5zm16 0v5h-5v-2h3v-3h2zM20 9h-2V6h-3V4h5v5z'/></svg>");
  --ico-settings: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65a.5.5 0 0 0 .12-.64l-2-3.46a.5.5 0 0 0-.61-.22l-2.49 1a7.3 7.3 0 0 0-1.69-.98l-.38-2.65A.49.49 0 0 0 14 1h-4a.49.49 0 0 0-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1a.5.5 0 0 0-.61.22l-2 3.46a.5.5 0 0 0 .12.64l2.11 1.65c-.04.32-.07.65-.07.98s.03.66.07.98l-2.11 1.65a.5.5 0 0 0-.12.64l2 3.46a.5.5 0 0 0 .61.22l2.49-1c.52.39 1.08.73 1.69.98l.38 2.65c.04.24.25.42.49.42h4c.24 0 .45-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1a.5.5 0 0 0 .61-.22l2-3.46a.5.5 0 0 0-.12-.64l-2.11-1.65zM12 15.5A3.5 3.5 0 1 1 12 8.5a3.5 3.5 0 0 1 0 7z'/></svg>");
  --ico-record: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><circle cx='12' cy='12' r='7'/></svg>");
}

/* ---------- 主题切换选项 ---------- */
.theme-options { display: flex; gap: 10px; }
.theme-opt {
  flex: 1; padding: 11px; border-radius: 10px; cursor: pointer;
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
  font-size: 14px; font-weight: 600;
}
.theme-opt.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- 明亮主题 ---------- */
html[data-theme="light"] {
  --bg: #f4f6fa;
  --bg-2: #ffffff;
  --bg-3: #eef1f6;
  --border: #e1e5ec;
  --text: #1f2329;
  --text-dim: #6b7280;
}
html[data-theme="light"] .lobby {
  background: radial-gradient(1200px 600px at 50% -10%, #e7eefc 0%, var(--bg) 60%);
}
html[data-theme="light"] .lobby-card { box-shadow: 0 16px 48px rgba(20, 40, 80, .12); }
html[data-theme="light"] .modal-box { box-shadow: 0 24px 70px rgba(20, 40, 80, .22); }
html[data-theme="light"] .tile .placeholder { background: linear-gradient(135deg, #e7ecf3, #d8dfe9); }
html[data-theme="light"] .ctrl-btn:hover,
html[data-theme="light"] .bg-opt:hover { background: #e3e8f0; }
html[data-theme="light"] .ctrl-btn.off,
html[data-theme="light"] .ctrl-btn.recording { background: #fdecec; border-color: #f3c7c7; }
html[data-theme="light"] .ctrl-btn.active,
html[data-theme="light"] .icon-btn.active,
html[data-theme="light"] .bg-opt.active { background: #e6efff; border-color: var(--accent); color: var(--text); }
html[data-theme="light"] .dd-item.active { background: #e6efff; color: var(--text); }
html[data-theme="light"] .room.overlay-mode .topbar { background: rgba(255, 255, 255, .85); }
html[data-theme="light"] .room.overlay-mode .controls { background: rgba(255, 255, 255, .92); }
