/* ============================================================
   CoWatch · 一起看 — cinema-dark UI
   ============================================================ */

:root {
  /* ---- 结构尺寸（与主题无关） ---- */
  --radius-lg: 22px;
  --radius: 14px;
  --radius-sm: 9px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Noto Sans SC', system-ui, sans-serif;

  /* 让 select 下拉、复选框、滚动条等原生控件使用深色渲染 */
  color-scheme: dark;
}

/* ============================================================
   主题：午夜蓝（默认）
   ============================================================ */
:root,
[data-theme='midnight'] {
  /* 参考深色聊天端：近黑底、1px 细线、中性灰层级，强调色只用在关键动作 */
  --bg: #0a0a0b;
  --bg-soft: #0f0f11;
  --room-bg: #0a0a0b;
  --card-bg: #111113;
  --modal-bg: #131316;
  --topbar-bg: #0e0e10;
  --sidebar-bg: #0c0c0e;
  --input-bg: #16161a;
  --panel: #1a1a1e;
  --panel-strong: #24242a;
  --panel-hover: #202026;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #ededf0;
  --text-soft: #d6d6dc;
  --muted: #9a9aa4;
  --muted-dim: #6e6e78;
  --accent: #ffaa46;
  --accent-deep: #ff8f2e;
  --accent-soft: rgba(255, 170, 70, 0.14);
  --danger: #ff6b6b;
  --ok: #46d39a;
  --warn: #ffb86b;
  --chip-bg: rgba(16, 16, 19, 0.9);
  --toast-bg: #1c1c20;
  --option-bg: #17171a;
  --backdrop: rgba(0, 0, 0, 0.66);
  --scroll-thumb: rgba(255, 255, 255, 0.11);
  --scroll-thumb-hover: rgba(255, 255, 255, 0.2);
  --stage-bg: #000000;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --glow-1: rgba(255, 255, 255, 0.03);
  --glow-2: transparent;
  --glow-3: transparent;
}

/* ============================================================
   主题：纯黑（OLED）
   ============================================================ */
[data-theme='black'] {
  --bg: #000000;
  --bg-soft: #0a0a0a;
  --room-bg: #000000;
  --card-bg: linear-gradient(180deg, #141414, #0b0b0b);
  --modal-bg: linear-gradient(180deg, #161616, #0a0a0a);
  --topbar-bg: rgba(0, 0, 0, 0.82);
  --sidebar-bg: rgba(8, 8, 8, 0.72);
  --input-bg: rgba(255, 255, 255, 0.05);
  --panel: rgba(255, 255, 255, 0.05);
  --panel-strong: rgba(255, 255, 255, 0.085);
  --panel-hover: rgba(255, 255, 255, 0.12);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f3f4f6;
  --text-soft: #dcdde1;
  --muted: #b0b2b8;
  --muted-dim: #92949b;
  --chip-bg: rgba(0, 0, 0, 0.72);
  --toast-bg: #1a1a1a;
  --option-bg: #171717;
  --backdrop: rgba(0, 0, 0, 0.9);
  --scroll-thumb: rgba(255, 255, 255, 0.16);
  --scroll-thumb-hover: rgba(255, 255, 255, 0.26);
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.85);
  --glow-1: rgba(255, 150, 60, 0.1);
  --glow-2: rgba(90, 120, 255, 0.08);
  --glow-3: rgba(255, 90, 60, 0.05);
}

/* ============================================================
   主题：暖夜（琥珀 / 护眼）
   ============================================================ */
[data-theme='warm'] {
  --bg: #100d0a;
  --bg-soft: #17120d;
  --room-bg: #0c0906;
  --card-bg: linear-gradient(180deg, rgba(34, 26, 18, 0.95), rgba(20, 15, 10, 0.96));
  --modal-bg: linear-gradient(180deg, #241a12, #150f0a);
  --topbar-bg: rgba(18, 13, 9, 0.82);
  --sidebar-bg: rgba(18, 13, 9, 0.66);
  --input-bg: rgba(0, 0, 0, 0.34);
  --panel: rgba(255, 220, 170, 0.06);
  --panel-strong: rgba(255, 220, 170, 0.1);
  --panel-hover: rgba(255, 220, 170, 0.14);
  --line: rgba(255, 220, 170, 0.12);
  --line-strong: rgba(255, 220, 170, 0.2);
  --text: #f7ecdd;
  --text-soft: #ecdcc6;
  --muted: #c2ab90;
  --muted-dim: #a08a70;
  --accent: #ffb35c;
  --accent-deep: #e8892f;
  --accent-soft: rgba(255, 179, 92, 0.15);
  --chip-bg: rgba(16, 11, 7, 0.72);
  --toast-bg: #241a12;
  --option-bg: #241a12;
  --backdrop: rgba(8, 5, 2, 0.9);
  --scroll-thumb: rgba(255, 220, 170, 0.16);
  --scroll-thumb-hover: rgba(255, 220, 170, 0.28);
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
  --glow-1: rgba(255, 150, 60, 0.2);
  --glow-2: rgba(120, 80, 40, 0.12);
  --glow-3: rgba(255, 90, 60, 0.06);
}

/* ============================================================
   主题：日间（浅色）
   ============================================================ */
[data-theme='light'] {
  --bg: #f2f4f7;
  --bg-soft: #e9edf3;
  --room-bg: #eef1f5;
  --card-bg: #ffffff;
  --modal-bg: #ffffff;
  --topbar-bg: rgba(255, 255, 255, 0.92);
  --sidebar-bg: rgba(255, 255, 255, 0.72);
  --input-bg: #ffffff;
  --panel: rgba(17, 24, 39, 0.045);
  --panel-strong: rgba(17, 24, 39, 0.075);
  --panel-hover: rgba(17, 24, 39, 0.11);
  --line: rgba(17, 24, 39, 0.12);
  --line-strong: rgba(17, 24, 39, 0.22);
  --text: #131722;
  --text-soft: #2a3040;
  --muted: #4d5668;
  --muted-dim: #67707f;
  --accent: #c2760d;
  --accent-deep: #a45c05;
  --accent-soft: rgba(194, 118, 13, 0.12);
  --danger: #d33a3a;
  --ok: #14915f;
  --warn: #a15c00;
  --chip-bg: rgba(255, 255, 255, 0.86);
  --toast-bg: #ffffff;
  --option-bg: #ffffff;
  --backdrop: rgba(15, 20, 28, 0.38);
  --scroll-thumb: rgba(17, 24, 39, 0.16);
  --scroll-thumb-hover: rgba(17, 24, 39, 0.28);
  --stage-bg: #000000;
  --shadow: 0 24px 70px rgba(17, 24, 39, 0.16);
  --glow-1: rgba(255, 180, 84, 0.1);
  --glow-2: rgba(90, 120, 255, 0.06);
  --glow-3: rgba(255, 120, 60, 0.05);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  /* 界面缩放：由设置写入 --ui-scale */
  zoom: var(--ui-scale, 1);
}

html,
body {
  height: 100%;
}

[data-motion='reduced'] * {
  animation: none !important;
  transition: none !important;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
  display: flex;
  flex-direction: column;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(1100px 480px at 50% -18%, var(--glow-1), transparent 72%);
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
}

/* --------------------------- 自绘窗口标题栏 ---------------------------- */

.titlebar {
  position: relative;
  z-index: 40;
  flex: none;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 12px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
  -webkit-app-region: drag;
  user-select: none;
}

.titlebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  -webkit-app-region: drag;
}

.titlebar-mark {
  width: 19px;
  height: 19px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: linear-gradient(155deg, #ffd089, #ff9445 58%, #f9702f);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 2px 6px rgba(255, 130, 50, 0.25);
  color: #2a1706;
}

.titlebar-mark svg {
  width: 11px;
  height: 11px;
  stroke-width: 2.2;
}

.titlebar-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.titlebar-drag {
  flex: 1;
  height: 100%;
}

.titlebar-actions {
  display: flex;
  align-items: stretch;
  height: 100%;
  -webkit-app-region: no-drag;
}

.win-btn {
  width: 46px;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition:
    background 0.12s ease,
    color 0.12s ease;
}

.win-btn:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.win-btn:active {
  background: var(--panel-strong);
}

.win-btn.is-close:hover {
  background: #c42b1c;
  color: #ffffff;
}

/* 房间页顶部不再重复品牌图标（标题栏已有） */
.custom-chrome .topbar {
  height: 48px;
}

.custom-chrome .topbar .brand-mark {
  display: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

input,
select {
  user-select: text;
}

::selection {
  background: var(--accent-soft);
}

/* ---------------------------------- buttons --------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
  background: var(--panel);
  border: 1px solid transparent;
  transition:
    background 0.14s ease,
    color 0.14s ease,
    border-color 0.14s ease,
    opacity 0.14s ease;
  white-space: nowrap;
}

.btn:hover {
  background: var(--panel-hover);
  border-color: var(--line);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 9px;
}

.btn-primary {
  color: #24160a;
  background: linear-gradient(180deg, #ffc272, #ff9433);
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(255, 140, 50, 0.18);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #ffcf8b, #ffa044);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--panel);
  border-color: transparent;
}

.btn-danger {
  color: #ff8383;
  background: rgba(255, 95, 95, 0.1);
  border-color: transparent;
}

.btn-danger:hover {
  background: rgba(255, 95, 95, 0.18);
  border-color: transparent;
}

.btn-lg {
  height: 46px;
  padding: 0 22px;
  font-size: 14.5px;
  border-radius: 12px;
}

.btn-block {
  width: 100%;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
}

/* ---------------------------------- home ------------------------------ */

.home {
  height: 100%;
  display: grid;
  /* safe center：内容高于窗口时从顶部开始，避免上下被裁掉 */
  place-items: safe center;
  padding: 40px 48px;
  overflow: auto;
  position: relative;
}

/* 首页右上角的设置入口 */
.home-gear {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--muted-dim);
  background: transparent;
  border: 1px solid transparent;
  transition:
    background 0.14s ease,
    color 0.14s ease,
    border-color 0.14s ease;
}

.home-gear:hover {
  color: var(--text);
  background: var(--panel);
  border-color: var(--line);
}

.home-inner {
  width: min(1060px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 404px);
  gap: 60px;
  align-items: center;
}

.hero {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 556px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(155deg, #ffd089, #ff9445 58%, #f9702f);
  box-shadow:
    0 6px 16px rgba(255, 132, 55, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.42);
  color: #2a1706;
}

.brand-mark svg {
  width: 26px;
  height: 26px;
}

.brand-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}

.brand-sub {
  margin-top: 3px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 2px 0 0;
  font-size: clamp(32px, 4vw, 50px);
  line-height: 1.1;
  letter-spacing: -0.028em;
  font-weight: 800;
  color: var(--text);
  text-wrap: balance;
}

.hero h1 em {
  font-style: normal;
  background-image: linear-gradient(96deg, #ffd39a 0%, #ffab55 52%, #ff7d3b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

[data-theme='light'] .hero h1 em {
  background-image: linear-gradient(96deg, #d98a12 0%, #b96304 62%, #a85c04 100%);
}

.hero p {
  margin: 0;
  max-width: 440px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.85;
  letter-spacing: 0.005em;
  text-wrap: pretty;
}

.feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.feature {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px 8px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-soft);
  background: var(--panel);
  border: 1px solid transparent;
  transition:
    background 0.16s ease,
    border-color 0.16s ease;
}

.feature:hover {
  background: var(--panel-strong);
  border-color: var(--line);
}

.feature svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
  opacity: 0.9;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.form-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field > label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: 0.02em;
}

.input {
  height: 44px;
  width: 100%;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  outline: none;
  font-size: 14.5px;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.input::placeholder {
  color: var(--muted-dim);
}

.input:hover {
  border-color: var(--line-strong);
}

.input:focus {
  border-color: rgba(255, 180, 84, 0.45);
  box-shadow: 0 0 0 3px rgba(255, 180, 84, 0.1);
}

.input.mono {
  font-family: 'SFMono-Regular', ui-monospace, 'Cascadia Mono', 'Consolas', monospace;
  letter-spacing: 0.28em;
  font-size: 17px;
  text-transform: uppercase;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--input-bg);
  border: 1px solid var(--line);
}

.tab {
  height: 38px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  transition:
    color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.tab:hover {
  color: var(--text);
}

.tab[aria-selected='true'] {
  color: var(--text);
  background: var(--panel-strong);
  box-shadow:
    inset 0 0 0 1px var(--line-strong),
    0 1px 2px rgba(0, 0, 0, 0.18);
}

.btn:focus-visible,
.tab:focus-visible,
.link-btn:focus-visible,
.code-chip:focus-visible,
.rail-btn:focus-visible,
.win-btn:focus-visible,
.sidebar-tab:focus-visible,
.dd:focus-visible,
.send-btn:focus-visible,
.volume-btn:focus-visible {
  outline: 2px solid rgba(255, 170, 70, 0.5);
  outline-offset: 2px;
}

.hint {
  font-size: 12.5px;
  color: var(--muted-dim);
  line-height: 1.7;
  text-wrap: pretty;
}

.hint.warn {
  color: var(--warn);
}

.form-note {
  margin: -2px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted-dim);
  opacity: 0.85;
}

.card-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 2px;
}

.server-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  min-width: 0;
}

.server-row .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-dim);
  flex: none;
}

.server-row .dot.ok {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(61, 220, 151, 0.12);
}

.server-row .dot.bad {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(255, 95, 95, 0.12);
}

.server-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 11.5px;
  letter-spacing: -0.01em;
  color: var(--text-soft);
}

.link-btn {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 0;
}

.link-btn:hover {
  text-decoration: underline;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 0;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.grow {
  flex: 1;
  min-width: 0;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
}

.check input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent-deep);
}

/* ---------------------------------- room ------------------------------ */

.room {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--room-bg);
  position: relative;
}

/* 窄窗口下才出现的侧栏开关 / 遮罩 */
.sidebar-toggle {
  display: none;
}

.sidebar-scrim {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 25;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(2px);
}

.topbar {
  height: 48px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  position: relative;
  z-index: 26;
}

.room-hash {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: var(--muted-dim);
  flex: none;
}

.room-label {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  padding-right: 2px;
}

/* 左侧窄图标栏 */
.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 0 12px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  min-height: 0;
}

.rail-brand {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: linear-gradient(155deg, #ffd089, #ff9445 58%, #f9702f);
  color: #2a1706;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.rail-sep {
  width: 20px;
  height: 1px;
  background: var(--line);
  margin: 2px 0;
}

.rail-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  transition:
    background 0.14s ease,
    color 0.14s ease,
    border-color 0.14s ease;
}

.rail-btn:hover {
  color: var(--text);
  background: var(--panel);
  border-color: var(--line);
}

.rail-btn-accent {
  color: var(--accent);
  background: var(--accent-soft);
}

.rail-btn-accent:hover {
  color: var(--accent);
  background: rgba(255, 170, 70, 0.22);
  border-color: rgba(255, 170, 70, 0.32);
}

.rail-self {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #14140f;
  background: var(--panel-strong);
}

.topbar .brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
}

.topbar .brand-mark svg {
  width: 17px;
  height: 17px;
}

.code-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.16em;
  font-size: 12px;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
}

.code-chip:hover {
  background: var(--panel-hover);
  border-color: var(--line-strong);
}

.code-chip svg {
  width: 13px;
  height: 13px;
  letter-spacing: normal;
  color: var(--muted);
}

.conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted-dim);
}

.conn .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-dim);
}

.conn[data-state='online'] .dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.14);
}

.conn[data-state='offline'] .dot {
  background: var(--danger);
}

.conn[data-state='connecting'] .dot {
  background: var(--accent);
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

.spacer {
  flex: 1;
}

.select {
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--text);
  outline: none;
}

.select:focus {
  border-color: rgba(255, 170, 70, 0.45);
}

/* 下拉列表项必须有实色背景，否则会出现「白底白字」 */
.select option {
  background-color: var(--option-bg);
  color: var(--text);
  padding: 6px 8px;
}

/* --------------------------- 自绘下拉（替代原生 select） ---------------- */

.dd {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 8px 0 10px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  max-width: 100%;
  transition:
    background 0.14s ease,
    border-color 0.14s ease;
}

.dd:hover {
  background: var(--panel-hover);
  border-color: var(--line-strong);
}

.dd[aria-expanded='true'] {
  background: var(--panel-strong);
  border-color: var(--line-strong);
}

.dd-label {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dd-caret {
  flex: none;
  color: var(--muted-dim);
  transition: transform 0.16s ease;
}

.dd[aria-expanded='true'] .dd-caret {
  transform: rotate(180deg);
}

.dd-menu {
  position: fixed;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 5px;
  border-radius: 10px;
  background: var(--modal-bg);
  border: 1px solid var(--line-strong);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
  max-height: 300px;
  overflow: auto;
  animation: dd-in 0.12s ease;
}

@keyframes dd-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.dd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text-soft);
  text-align: left;
}

.dd-item:hover,
.dd-item.is-active {
  background: var(--panel-strong);
  color: var(--text);
}

.dd-item[aria-selected='true'] {
  color: var(--text);
  font-weight: 600;
}

.dd-item-label {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dd-check {
  flex: none;
  color: var(--accent);
}

.quality-host {
  display: flex;
  align-items: center;
  min-width: 0;
}

/* --------------------------- 自绘提示气泡（替代 title） ----------------- */

.tip {
  position: fixed;
  z-index: 200;
  max-width: 240px;
  padding: 5px 9px;
  border-radius: 7px;
  background: var(--modal-bg);
  border: 1px solid var(--line-strong);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.45;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(2px);
  transition:
    opacity 0.12s ease,
    transform 0.12s ease;
}

.tip.show {
  opacity: 1;
  transform: none;
}

/* 设置里的「高级」折叠，去掉浏览器默认三角 */
.disc {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  list-style: none;
  width: fit-content;
}

.disc::-webkit-details-marker {
  display: none;
}

.disc-caret {
  display: inline-flex;
  transition: transform 0.16s ease;
}

details[open] .disc-caret {
  transform: rotate(180deg);
}

.room-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 320px;
}

.stage-wrap {
  position: relative;
  min-height: 0;
  display: flex;
  padding: 10px;
}

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--stage-bg);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: grid;
  place-items: center;
}

.stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--stage-bg);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stage video.live {
  opacity: 1;
}

/* 影院模式下的套娃提示：只在共享整屏 + 全屏时出现 */
.stage-nesting {
  position: absolute;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%);
  z-index: 4;
  display: none;
  align-items: center;
  gap: 12px;
  max-width: min(760px, calc(100% - 48px));
  padding: 10px 12px 10px 16px;
  border-radius: 12px;
  background: rgba(20, 16, 8, 0.88);
  border: 1px solid rgba(255, 196, 87, 0.35);
  color: #ffe2a8;
  font-size: 13px;
  line-height: 1.5;
  backdrop-filter: blur(8px);
}

.stage-nesting.show {
  display: flex;
}

.stage-nesting .btn {
  flex: none;
}

.stage-empty {
  position: relative;
  z-index: 2;  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px;
  text-align: center;
  /* 放映区永远是黑底，文字与图标不跟随浅色主题 */
  color: #f2f2f4;
}

.stage-empty .glyph {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.72);
}

.stage-empty .glyph svg {
  width: 30px;
  height: 30px;
}

.stage-empty h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #f4f4f6;
}

.stage-empty p {
  margin: 0;
  max-width: 380px;
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.58);
}

.live-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 3;
  display: none;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ffd2d2;
  background: rgba(220, 40, 40, 0.72);
  backdrop-filter: blur(6px);
}

.live-badge.show {
  display: inline-flex;
}

.live-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  animation: pulse 1.6s infinite;
}

.stage-tools {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  display: flex;
  gap: 8px;
}

/* 放映区浮层始终是深色玻璃，避免浅色主题下看不清 */
.stage-tools .btn {
  height: 30px;
  padding: 0 9px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(12, 12, 14, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.stage-tools .btn:hover {
  color: #fff;
  background: rgba(30, 30, 34, 0.78);
}

.stage-count {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(12, 12, 14, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.sidebar {
  border-left: 1px solid var(--line);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-tabs {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 8px 8px;
  border-bottom: 1px solid var(--line);
}

.sidebar-tab {
  flex: 1;
  height: 30px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted-dim);
  transition:
    color 0.14s ease,
    background 0.14s ease;
}

.sidebar-tab:hover {
  color: var(--text);
}

.sidebar-tab[aria-selected='true'] {
  color: var(--text);
  background: var(--panel);
}

/* 抽屉态才出现的关闭按钮 */
.sidebar-close {
  display: none;
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0;
}

.sidebar-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 6px 8px 8px;
  overflow: hidden;
}

.panel-label {
  flex: none;
  padding: 10px 8px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted-dim);
  text-transform: uppercase;
}

.members {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.member {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: 8px;
}

.member:hover {
  background: var(--panel);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 700;
  flex: none;
  color: #14140f;
  background: #9aa3b4;
}

.avatar.sm {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.avatar.host {
  box-shadow: 0 0 0 2px rgba(255, 170, 70, 0.7);
}

.member-info {
  min-width: 0;
  flex: 1;
}

.member-name {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-you {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
  color: var(--muted);
  background: var(--panel-strong);
}

.member-sub {
  font-size: 11px;
  color: var(--muted-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-soft);
}

.badge.live {
  color: var(--ok);
  background: rgba(70, 211, 154, 0.14);
}

.chat-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 4px 10px;
}

.chat-empty {
  margin: auto;
  text-align: center;
  color: var(--muted-dim);
  font-size: 12px;
  line-height: 1.8;
}

.chat-day {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 2px;
  font-size: 10.5px;
  color: var(--muted-dim);
}

.chat-day::before,
.chat-day::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.chat-msg {
  display: flex;
  gap: 9px;
}

.chat-body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.chat-author {
  font-size: 12px;
  font-weight: 700;
}

.chat-time {
  font-size: 10px;
  color: var(--muted-dim);
}

.chat-text {
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-soft);
  word-break: break-word;
  user-select: text;
}

.composer {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 4px 4px 4px 6px;
  border-radius: 10px;
  background: var(--input-bg);
  border: 1px solid var(--line);
}

.composer:focus-within {
  border-color: var(--line-strong);
}

.composer .input {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 6px;
  border: none;
  background: transparent;
  font-size: 12.5px;
  box-shadow: none;
}

.composer .input:focus {
  border: none;
  box-shadow: none;
}

.send-btn {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text);
  background: var(--panel-strong);
  transition:
    background 0.14s ease,
    color 0.14s ease;
}

.send-btn:hover {
  background: var(--accent);
  color: #24160a;
}

/* ---------------------------------- modal ------------------------------ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 32px;
  background: var(--backdrop);
  animation: fade 0.16s ease;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.modal {
  width: min(920px, 100%);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  background: var(--modal-bg);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.modal-head p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.modal-body {
  padding: 18px 20px;
  overflow: auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.picker-item {
  text-align: left;
  padding: 8px;
  border-radius: 13px;
  border: 2px solid transparent;
  background: var(--panel);
  transition: all 0.14s ease;
}

.picker-item:hover {
  background: var(--panel-strong);
  transform: translateY(-2px);
}

.picker-item[aria-selected='true'] {
  border-color: var(--accent);
  background: rgba(255, 180, 84, 0.1);
}

.picker-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: var(--room-bg);
  display: grid;
  place-items: center;
  margin-bottom: 9px;
}

.picker-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.picker-thumb .kind {
  position: absolute;
  left: 7px;
  top: 7px;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.62);
  color: var(--accent);
  letter-spacing: 0.04em;
}

.picker-thumb .kind.kind-warn {
  background: rgba(40, 28, 6, 0.86);
  color: #ffc457;
}

.picker-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-all;
}

.picker-title img {
  width: 16px;
  height: 16px;
  flex: none;
  border-radius: 3px;
}

.invite-code {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 44px;
  font-weight: 800;
  letter-spacing: 0.3em;
  text-align: center;
  color: var(--accent);
  padding: 22px 0 8px;
  user-select: text;
}

.invite-label {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 20px;
}

.copy-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  margin-bottom: 10px;
}

.copy-field .label {
  font-size: 11.5px;
  color: var(--muted-dim);
  width: 66px;
  flex: none;
}

.copy-field .value {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: text;
}

/* ---------------------------------- toast ------------------------------ */

.toast-layer {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 520px;
  padding: 11px 16px;
  border-radius: 11px;
  font-size: 13px;
  color: var(--text);
  background: var(--toast-bg);
  border: 1px solid var(--line-strong);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.18s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.toast.error {
  border-color: rgba(255, 95, 95, 0.45);
  color: var(--danger);
}

.toast.success {
  border-color: rgba(61, 220, 151, 0.4);
  color: var(--ok);
}

/* fullscreen cinema mode */
.room.cinema .topbar,
.room.cinema .sidebar,
.room.cinema .rail {
  display: none;
}

.room.cinema .room-body {
  grid-template-columns: 1fr;
}

.room.cinema .stage-wrap {
  padding: 0;
}

.room.cinema .stage {
  border-radius: 0;
  border: none;
}

/*
 * 全屏不放大：按视频自身分辨率 1:1 居中显示，超出部分留黑边。
 * 居中用 inset+margin:auto，不用 transform —— transform 会让视频多一个合成层，
 * 在个别显卡上共享整屏时会让采集画面出问题。
 */
.room.cinema .stage video.native-fit {
  inset: 0;
  left: 0;
  top: 0;
  margin: auto;
  transform: none;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
}
/* 共享整屏时的三条出口：迷你浮窗 / 改共享窗口 / 仍然全屏 */
.choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--option-bg);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.choice:hover {
  background: var(--panel-hover);
  border-color: var(--line-strong);
}

.choice-primary {
  border-color: rgba(255, 170, 70, 0.45);
  background: var(--accent-soft);
}

.choice-primary:hover {
  border-color: rgba(255, 170, 70, 0.8);
  background: rgba(255, 170, 70, 0.2);
}

.choice-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-soft);
}

.choice-primary .choice-icon {
  background: rgba(255, 170, 70, 0.2);
  color: var(--accent);
}

.choice-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.choice-text b {
  font-size: 13.5px;
  font-weight: 600;
}

.choice-text em {
  font-style: normal;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.choice-badge {
  margin-left: auto;
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #23180a;
  font-size: 11px;
  font-weight: 700;
}

/* mini floating mode：共享整屏时缩成右下角的卡片 */
.room.mini .topbar,
.room.mini .sidebar,
.room.mini .rail,
.room.mini .sidebar-scrim {
  display: none;
}

.room.mini .room-body {
  grid-template-columns: 1fr;
}

.room.mini .stage-wrap {
  flex-direction: column;
  padding: 0;
  background: var(--stage-bg);
}

.room.mini .stage {
  flex: 1;
  border-radius: 0;
  border: none;
}

.room.mini .stage-tools,
.room.mini .stage-nesting,
.room.mini .live-badge,
.room.mini .stage-count,
.room.mini .stage-status {
  display: none;
}

.room.mini .stage video,
.room.mini .stage video.native-fit {
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
}

.room.mini .mini-bar {
  display: flex;
}

/* 迷你卡片里打开聊天：侧栏以浮层盖住卡片，关掉就回到画面 */
.room.mini.sidebar-open .sidebar {
  display: flex;
  position: absolute;
  inset: 0;
  width: auto;
  max-width: none;
  z-index: 20;
  border-left: none;
  background: var(--sidebar-bg);
}

.mini-bar {
  display: none;
  flex: none;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 6px 0 10px;
  background: var(--topbar-bg);
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
  user-select: none;
}

.mini-live {
  display: none;
  align-items: center;
  gap: 5px;
  color: var(--danger);
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.06em;
}

.mini-live.show {
  display: inline-flex;
}

.mini-live .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse 2s ease-in-out infinite;
}

.mini-count {
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.mini-status {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.mini-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 24px;
  flex: none;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
}

.mini-btn:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.mini-btn-danger:hover {
  background: rgba(255, 107, 107, 0.16);
  border-color: rgba(255, 107, 107, 0.45);
  color: var(--danger);
}


@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* scrollbars */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 10px;
  border: 3px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
  background-clip: content-box;
  border: 3px solid transparent;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ------------------------------- skeleton ------------------------------ */

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------------------------------- 房间状态 / 音量 -------------------- */

.stage-status {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 3;
  display: none;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(12, 12, 14, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.stage-status.show {
  display: inline-flex;
}

.stage-status.warn {
  color: #ffc078;
  border-color: rgba(255, 170, 70, 0.4);
}

.quality-badge {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.volume-pill {
  display: none;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.volume-pill.is-muted {
  opacity: 0.7;
}

.volume-btn {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: var(--text);
}

.volume-btn:hover {
  background: var(--panel-hover);
}

.volume-pill input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 86px;
  height: 4px;
  border-radius: 4px;
  background: var(--line-strong);
  outline: none;
}

.volume-pill input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.volume-pill input[type='range']:focus-visible {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------------------------------- 设置面板 -------------------------- */

.settings-modal {
  width: min(680px, 100%);
}

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 22px 8px;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-section h4 {
  margin: 0;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-dim);
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.theme-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--panel);
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.theme-card:hover {
  border-color: var(--line-strong);
}

.theme-card[aria-selected='true'] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.theme-swatch {
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
}

.theme-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

.theme-hint {
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted-dim);
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 11px;
  background: var(--input-bg);
  border: 1px solid var(--line);
}

.segmented button {
  flex: 1;
  height: 30px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.segmented button[aria-selected='true'] {
  background: var(--panel-strong);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.switch-row.compact {
  font-size: 12.5px;
  margin-top: 2px;
}

.switch-row input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch {
  position: relative;
  flex: none;
  width: 36px;
  height: 21px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background 0.15s ease;
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.15s ease;
}

.switch-row input:checked + .switch {
  background: var(--accent-deep);
}

.switch-row input:checked + .switch::after {
  transform: translateX(15px);
}

.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-row input[type='range'] {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 4px;
  background: var(--line-strong);
  outline: none;
}

.range-row input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.range-value {
  width: 44px;
  text-align: right;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* 设置面板里的「地址 + 测试连接」一行 */
.settings-body .row > .input {
  flex: 1;
  min-width: 0;
}

.settings-body .row > .btn {
  flex: none;
  height: 42px;
}


/* ------------------------------- 响应式 -------------------------------- */
/* 断点按 CSS 像素（已含界面缩放 zoom），窗口最小 720×540 仍可用 */

/* 大屏：内容区放宽一点，标题略放大 */
@media (min-width: 1500px) {
  .home-inner {
    width: min(1180px, 100%);
  }
  .hero h1 {
    font-size: clamp(50px, 3.6vw, 56px);
  }
}

/* 中屏：两栏收窄 */
@media (max-width: 1150px) {
  .home-inner {
    gap: 48px;
  }
  .room-body {
    grid-template-columns: 56px minmax(0, 1fr) 288px;
  }
}

@media (max-width: 1024px) {
  .home-inner {
    gap: 40px;
  }
  .hero {
    gap: 16px;
  }
  .hero h1 {
    font-size: clamp(30px, 3.9vw, 44px);
  }
}

/* 矮窗口：压缩首页留白，保证一屏能放下 */
@media (max-height: 780px) {
  .home {
    padding: 24px 40px;
  }
  .hero {
    gap: 16px;
  }
  .hero h1 {
    font-size: clamp(28px, 3.4vw, 42px);
  }
  .hero p {
    font-size: 14px;
    line-height: 1.7;
  }
  .form-card {
    gap: 14px;
    padding: 22px;
  }
}

/* 窄窗口：首页单列、房间侧栏变抽屉 */
@media (max-width: 940px) {
  .home {
    padding: 32px 28px;
  }
  .home-inner {
    grid-template-columns: 1fr;
    gap: 28px;
    justify-items: center;
  }
  .hero {
    width: 100%;
    max-width: 520px;
  }
  .form-card {
    width: min(460px, 100%);
  }

  .room-body {
    grid-template-columns: 56px 1fr;
  }
  .stage-wrap {
    padding: 8px;
  }
  .stage {
    border-radius: 12px;
  }

  .sidebar {
    position: absolute;
    top: 48px;
    right: 0;
    bottom: 0;
    z-index: 30;
    width: min(320px, 86vw);
    transform: translateX(101%);
    transition: transform 0.22s ease;
    box-shadow: -18px 0 44px rgba(0, 0, 0, 0.45);
    background: var(--room-bg);
    border-left: 1px solid var(--line);
  }
  .sidebar-scrim {
    top: 48px;
  }
  .room.sidebar-open .sidebar {
    transform: none;
  }
  .room.sidebar-open .sidebar-scrim {
    display: block;
  }
  .sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .sidebar-toggle {
    display: inline-flex;
  }
}

/* 更窄：顶栏压缩，按钮只留图标 */
@media (max-width: 820px) {
  .topbar {
    gap: 8px;
    padding: 0 10px;
  }
  .code-chip {
    height: 30px;
    padding: 0 9px;
    font-size: 12px;
    letter-spacing: 0.16em;
    gap: 7px;
  }
  .quality-badge {
    display: none;
  }
  .select {
    max-width: 120px;
    padding: 0 8px;
    font-size: 12px;
  }
  .topbar .btn {
    padding: 0 12px;
  }
  .conn-text {
    display: none;
  }
  .stage-empty {
    gap: 12px;
    padding: 20px;
  }
  .stage-empty .glyph {
    width: 60px;
    height: 60px;
    border-radius: 18px;
  }
  .stage-empty .glyph svg {
    width: 28px;
    height: 28px;
  }
  .stage-empty h2 {
    font-size: 17px;
  }
}

@media (max-width: 760px) {
  .theme-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .settings-body {
    padding: 16px 14px 8px;
  }
  .invite-code {
    font-size: 32px;
    letter-spacing: 0.18em;
  }
}

@media (max-width: 700px) {
  .home {
    padding: 24px 18px;
  }
  .hero h1 {
    font-size: clamp(26px, 7.4vw, 34px);
  }
  .hero p {
    font-size: 13.5px;
  }
  .feature {
    padding: 7px 11px;
    font-size: 12px;
  }
  .form-card {
    padding: 20px;
  }
  .btn-label {
    display: none;
  }
  .topbar .btn {
    padding: 0 10px;
  }
}

