/* 放映室 · 设计系统（UI-PORT-CONTRACT-v1 §2）
   权威来源 = theater-ui-prototype/variant-a-immersive.html「变体 A · 暗房」：
   全出血画面 + 浮在画面上的毛玻璃 + 静置自动隐去。类名/token/动效参数照搬它。

   两套词汇表、一套设计：
   · 新（A 层）.app .stage .frame .vid .scene-live .scene-wait .chrome-top/-bottom
     .chrome-inner .material .dock .pill .seg-btn .panel .stream .member .status …
   · 旧（生产层，必须继续可用）.topbar .brand .room-name .live .ghost .screen-shell
     .screen .deck .seg .side .tabs .tab-body .roster .person .pip .tag .mic .act
     .log .msg .composer .micbtn .drawer .statgrid .statcell .sect .row .chips .chip
     .bw .pending .veil .reel .unmute .insecure #toasts .toast …

   纪律（§1 C7 / T-51 / T-52 / T-53 / T-56）：
   · 颜色只出现在下面这个 :root 里 —— 正文零裸 hex
   · 字号全站只有 6 档：--fs-11/13/15/17/20/44
   · 没有 `transition: all`；没有任何 @keyframes 动 box-shadow
   · prefers-reduced-motion: reduce 下 document.getAnimations().length === 0
   · 每个发出的前景/背景组合都实算过 WCAG 比值（见 commit 验收行）
   ══════════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;

  /* 色板：中性石墨，唯一暖强调（Apple HIG 暗色系统色）。
   T-51 实测：A 原始的 --text-2(.66)/--text-3(.40) 压在 --bg 上只有 8.0:1 / 3.55:1，
   压在 --surface-solid 上 6.07:1 / 2.90:1 —— 都不达标，故提亮到 .80 / .58。 */
  --bg: #000000;
  --surface: rgba(28, 28, 30, .72);      /* 毛玻璃材质（A 原值） */
  --surface-solid: #2c2c2e;              /* 弹层 / 卡片 */
  --glass-base: rgba(0, 0, 0, .52);      /* 玻璃底衬：把画面亮度压到可读区间 */
  --field: rgba(0, 0, 0, .36);           /* 内凹输入域 */
  --hairline: rgba(255, 255, 255, .16);  /* 分隔线（纯装饰，WCAG 1.4.11 豁免） */
  --edge-ctl: rgba(255, 255, 255, .40);  /* 控件边界 ≥3:1（默认态） */
  --edge-ctl-on: rgba(255, 255, 255, .58); /* 控件边界 ≥3:1（选中/按下态，底更亮） */
  --edge-on-accent: rgba(0, 0, 0, .55);  /* 浮在画面上的强调色按钮的描边 */
  --fill-1: rgba(255, 255, 255, .08);
  --fill-2: rgba(255, 255, 255, .14);
  --fill-3: rgba(255, 255, 255, .22);
  --text: #f5f5f7;
  --text-2: rgba(235, 235, 245, .80);
  --text-3: rgba(235, 235, 245, .58);
  --accent: #ff9f0a;
  --live: #ff453a;                       /* 直播红：只当色标（圆点/描边）与深底文字 */
  --live-text: #ff9d94;                  /* 亮底上的红字专用（--live 在亮底只有 4.09:1） */
  --ok: #30d158;
  --danger-bg: rgba(255, 69, 58, .14);
  --danger-bg-2: rgba(255, 69, 58, .07);

  /* 渐层 / 阴影 / 材质 */
  /* scrim：0–86% 档位恒 ≥.64（保证顶栏文字压白画面也 ≥4.5:1）， 最后 14% 才化开；.chrome-inner 的 30px 下内边距保证没有文字落在那一段。 */
  --scrim-top: linear-gradient(to bottom,
      rgba(0, 0, 0, .80) 0%, rgba(0, 0, 0, .64) 86%, rgba(0, 0, 0, .30) 100%);
  --backdrop: blur(20px) saturate(180%) brightness(.72);
  --shadow: 0 24px 64px -20px rgba(0, 0, 0, .85);
  --shadow-sm: 0 8px 24px -10px rgba(0, 0, 0, .7);
  --shadow-lg: 0 40px 90px -30px rgba(0, 0, 0, .9);
  --ring-ctl: inset 0 0 0 1px var(--edge-ctl);
  --ring-ctl-on: inset 0 0 0 1px var(--edge-ctl-on);

  /* ── 待播态「余晖」（原型 --video-bg 的四层渐变，原样搬来、只改名）── 只用于 [data-state="waiting"]，不参与任何真实画面渲染。 */
  --ambient:
    radial-gradient(88% 118% at 16% 12%, rgba(96, 128, 208, .52) 0%, rgba(96, 128, 208, 0) 58%),
    radial-gradient(72% 92% at 84% 84%, rgba(255, 124, 58, .34) 0%, rgba(255, 124, 58, 0) 62%),
    radial-gradient(120% 104% at 50% 52%, rgba(0, 0, 0, 0) 38%, rgba(0, 0, 0, .74) 100%),
    linear-gradient(152deg, #1a2740 0%, #2b1b3a 46%, #3a1c22 78%, #0c0a12 100%);

  /* 字号级差：全站只有这 6 档（T-53） */
  --fs-11: 11px;
  --fs-13: 13px;
  --fs-15: 15px;
  --fs-17: 17px;
  --fs-20: 20px;
  --fs-44: 44px;

  /* 字族 / 圆角 / 缓动 */
  --sans: -apple-system, "SF Pro Text", "PingFang SC", "Noto Sans SC",
          "Microsoft YaHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Consolas, monospace;
  --r-pill: 999px;
  --r-card: 16px;
  --r-sm: 10px;
  --r-xs: 6px;
  --ease: cubic-bezier(.32, .72, 0, 1);

}

/* 基础 */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%; margin: 0; padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--fs-15);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

/* 控件不吃 UA 的字号默认值（否则会凭空多出一个 13.3333px 档） */
button, input, select, textarea {
  font: inherit;
  color: inherit;
  touch-action: manipulation;
}
a, button, [role="button"], label, summary { touch-action: manipulation; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.tnum { font-variant-numeric: tabular-nums; }

/* 焦点环：实心 2px 强调色（≥3:1），不靠低透明度 box-shadow */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-xs); }

/* 图标：全部内联 SVG，viewBox 0 0 24 24，stroke=currentColor */
.ic {
  display: block; fill: none; stroke: currentColor;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.spacer { flex: 1 1 auto; min-width: 8px; }

/* 舞台：画面区永远撑满可用区域（T-49 —— 尺寸不许再由空的 <video> 决定） */
.app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  background: var(--bg);
}

/* 观众端：画面贴边全出血（T-49 的几何前提）。
   上面 `.stage`（141 行）那条是给**开播端**用的 —— 带 12px 内边距、
   position:relative、flex:1 1 auto，是"预览 + 设置栏"的排布。
   观众端要的是变体 A 的构图：画面铺满视口，顶栏/底栏浮在画面之上。
   两者词汇表同名但意图不同，用 `.app > .stage` 区分
   （开播端结构是 body.host > .stage-wrap > .stage，没有 .app 祖先，不会被命中）。
   ⚠️ 缺这条时观众端画面被 12px 内边距包住，"全出血"就没了 ——
   这是把 U2 内联关键层折进 app.css（T-65）时实测发现的缺口。 */
.app > .stage { position: absolute; inset: 0; padding: 0; flex: none; }

.stage {
  position: relative;
  flex: 1 1 auto; min-width: 0; min-height: 0;
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px;
  background: var(--bg);
  overflow: hidden;
}

/* 画面区：铺满舞台剩余区域 */
.frame {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.vid {
  position: relative;
  width: 100%; height: 100%;
  min-width: 0; min-height: 0;
  overflow: hidden;
  background: var(--bg);
}
.vid video, video {
  display: block;
  width: 100%; height: 100%;
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  background: var(--bg);
}

/* 待播 / 断流表现 */
.scene-wait {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
}
.breathe {
  width: 10px; height: 10px; border-radius: var(--r-pill);
  background: var(--accent);
  box-shadow: 0 0 24px 2px var(--accent);
  animation: breathe 2.6s var(--ease) infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(.7); opacity: .35; }
  50%      { transform: scale(1);  opacity: 1; }
}
.wait-text {
  margin: 0; font-size: var(--fs-20); font-weight: 600;
  letter-spacing: -.02em; color: var(--text-2); text-wrap: balance;
}
.app[data-state="live"] .scene-wait { display: none; }
.app[data-state="waiting"] .scene-live { display: none; }

/* §2.4 待播态「余晖」：由真实播放状态驱动（player.js 的 setStatus） */
.app[data-state="waiting"] .frame::before,
#hall[data-state="waiting"] .frame::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: var(--ambient);
  opacity: .30;
  filter: saturate(.5) brightness(.8);
  animation: ambient 9s ease-in-out infinite;
}
@keyframes ambient {
  0%, 100% { opacity: .26; transform: scale(1); }
  50%      { opacity: .38; transform: scale(1.04); }
}

/* 毛玻璃材质：浮在画面上的控件 backdrop 先被 brightness 压暗，再叠 --glass-base 与各自的层 —— 这样即使画面全白，材质合成也只有 rgb(45,45,46)，文字对比度仍在界内。 */
.material,
.chrome-top,
.topbar,
.side,
.drawer {
  background-color: var(--glass-base);
  -webkit-backdrop-filter: var(--backdrop);
  backdrop-filter: var(--backdrop);
}
.material,
.side,
.drawer {
  background-image: linear-gradient(var(--surface), var(--surface));
}
.chrome-top,
.topbar {
  background-image: var(--scrim-top);
}

/* 浮层框架 + 静置隐去 */
.chrome { position: fixed; z-index: 60; }
.chrome .chrome-inner { transition: opacity .42s var(--ease); }

.chrome-top {
  top: 0; left: 0; right: 0;
  transition: opacity .42s var(--ease);
}
.chrome-top .chrome-inner {
  display: flex; align-items: center; gap: 14px;
  padding: calc(14px + env(safe-area-inset-top, 0px))
           calc(20px + env(safe-area-inset-right, 0px))
           30px
           calc(20px + env(safe-area-inset-left, 0px));
}

.chrome-bottom {
  left: 0; right: 0;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  padding: 0 calc(20px + env(safe-area-inset-right, 0px)) 0 calc(20px + env(safe-area-inset-left, 0px));
  transition: opacity .42s var(--ease);
  pointer-events: none;
}

.dock {
  display: flex; gap: 10px;
  padding: 8px;
  border-radius: 20px;
  box-shadow: var(--shadow-sm), var(--ring-ctl);
  pointer-events: auto;
}
.dock-left { flex-direction: column; align-items: flex-start; gap: 7px; }
.dock-row { display: flex; align-items: center; gap: 10px; }
.dock-right { align-items: center; }

.app.idle .chrome-top { opacity: .22; }
.app.idle .chrome-top .chrome-inner { opacity: 0; pointer-events: none; }
.app.idle .chrome-bottom { opacity: 0; pointer-events: none; }
.app.idle .chrome-top:focus-within,
.app.idle .chrome-bottom:focus-within { opacity: 1; pointer-events: auto; }
.app.idle .chrome-top:focus-within .chrome-inner { opacity: 1; pointer-events: auto; }

/* 品牌 / 房间 / 状态 */
.brand { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.brand-cn { font-size: var(--fs-17); font-weight: 600; letter-spacing: -.02em; }
.brand-en {
  font-size: var(--fs-11); font-weight: 500; letter-spacing: .08em;
  color: var(--text-3); text-transform: uppercase;
}
.rule { width: 1px; height: 26px; background: var(--hairline); flex: none; }

.room { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.room-name {
  font-size: var(--fs-15); font-weight: 500; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.room-path {
  font-size: var(--fs-11); color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.status {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: var(--fs-13); font-weight: 500; letter-spacing: -.01em;
  color: var(--text-3); white-space: nowrap;
}
.status .dot { width: 7px; height: 7px; border-radius: var(--r-pill); background: currentColor; flex: none; }
.app[data-state="live"] .status { color: var(--live); }
.app[data-state="live"] .status .dot { animation: pulse 2.4s ease-in-out infinite; }
.app[data-state="waiting"] .status { color: var(--text-3); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.res { font-size: var(--fs-11); color: var(--text-3); font-variant-numeric: tabular-nums; }

/* 控件：pill / 分段 / 图标按钮 */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 38px; padding: 0 14px;
  border: 0; border-radius: var(--r-pill);
  background: var(--fill-1); color: var(--text);
  box-shadow: var(--ring-ctl);
  font-size: var(--fs-15); font-weight: 500; letter-spacing: -.01em;
  white-space: nowrap; cursor: pointer;
  transition: background-color .18s ease, color .18s ease, opacity .18s ease;
}
.pill:hover { background: var(--fill-2); }
.pill:active { background: var(--fill-3); box-shadow: var(--ring-ctl-on); }
.pill.icon { width: 38px; padding: 0; justify-content: center; flex: none; }
.pill.sm { min-height: 30px; padding: 0 11px; font-size: var(--fs-13); }
.pill-unmute { background: var(--fill-2); }

.seg {
  display: inline-flex; gap: 2px; padding: 3px;
  border-radius: var(--r-pill); background: var(--fill-1);
  box-shadow: var(--ring-ctl);   /* 分段控件的外边界同样要 ≥3:1 */
}
.seg-btn,
.seg > button {
  min-height: 32px; padding: 0 12px; border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--text-2);
  box-shadow: var(--ring-ctl);
  font-size: var(--fs-13); font-weight: 500; letter-spacing: -.01em;
  white-space: nowrap; cursor: pointer;
  transition: background-color .18s ease, color .18s ease;
}
.seg-btn:hover,
.seg > button:hover { color: var(--text); }
.seg-btn[aria-pressed="true"],
.seg > button[aria-pressed="true"] {
  background: var(--fill-3); color: var(--text); box-shadow: var(--ring-ctl-on);
}

.chan-desc {
  margin: 0; padding-left: 4px;
  font-size: var(--fs-11); color: var(--text-3); letter-spacing: .01em;
}

/* 右侧滑入面板：聊天 + 成员（默认收起） */
.panel {
  position: fixed; z-index: 70;
  top: calc(16px + env(safe-area-inset-top, 0px));
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  width: min(380px, calc(100vw - 32px));
  display: flex; flex-direction: column;
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  overflow: hidden;
  overscroll-behavior: contain;
  transform: translateX(calc(100% + 32px));
  opacity: 0;
  transition: transform .44s var(--ease), opacity .3s var(--ease);
}
.panel.open { transform: translateX(0); opacity: 1; }
/* 容器只作程序化焦点落点，不画焦点环（内部控件照常有环） */
.panel:focus, .panel:focus-visible { outline: none; }

.panel-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 10px 10px 14px;
  border-bottom: 1px solid var(--hairline);
  flex: none;
}
.tabs { display: flex; gap: 2px; flex: 1 1 auto; min-width: 0; }
.tab {
  min-height: 32px; padding: 0 12px; border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--text-2);
  box-shadow: var(--ring-ctl);
  font-size: var(--fs-13); font-weight: 500; letter-spacing: -.01em;
  white-space: nowrap; cursor: pointer;
  transition: background-color .18s ease, color .18s ease;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--fill-2); color: var(--text); box-shadow: var(--ring-ctl-on); }

.panel-body { flex: 1 1 auto; min-height: 0; display: flex; }
.pane { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* 聊天流 */
.stream {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0; padding: 14px; list-style: none;
  display: flex; flex-direction: column; gap: 14px;
  scrollbar-width: thin; scrollbar-color: var(--fill-2) transparent;
}
.msg { min-width: 0; animation: slip .32s var(--ease) both; }
.msg-head { display: flex; align-items: baseline; gap: 7px; margin-bottom: 3px; }
.who { font-size: var(--fs-13); font-weight: 600; letter-spacing: -.01em; color: var(--text); }
.at {
  margin-left: auto; font-size: var(--fs-11); color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.msg-text {
  margin: 0; font-size: var(--fs-15); line-height: 1.5; letter-spacing: -.005em;
  color: var(--text-2);
  overflow-wrap: anywhere; word-break: break-word; white-space: pre-wrap;
}
.msg-sys { text-align: center; font-size: var(--fs-13); color: var(--text-3); }
.msg-gone .msg-text { color: var(--text-3); }
.empty { text-align: center; font-size: var(--fs-13); color: var(--text-3); }

/* 输入 */
.composer {
  display: flex; align-items: center; gap: 8px;
  padding: 10px; border-top: 1px solid var(--hairline);
  flex: none;
}
.composer input {
  flex: 1 1 auto; min-width: 0; min-height: 38px;
  padding: 0 14px; border: 0; border-radius: var(--r-pill);
  background: var(--field); color: var(--text);
  box-shadow: var(--ring-ctl);
  font-size: var(--fs-15); letter-spacing: -.01em;
}
.composer input::placeholder { color: var(--text-3); }
.composer input:focus { outline: none; background: var(--fill-2); }
.composer input:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.composer input:disabled { opacity: .5; }
.sendbtn {
  flex: 0 0 auto; width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--r-pill); cursor: pointer;
  background: var(--accent); color: var(--bg);
  transition: opacity .18s ease;
}
.sendbtn:hover { opacity: .85; }
.muted-note {
  margin: 0; padding: 12px 14px; border-top: 1px solid var(--hairline);
  font-size: var(--fs-13); color: var(--text-3); text-align: center;
}

/* 成员名册 */
.roster {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0; padding: 8px; list-style: none;
  scrollbar-width: thin; scrollbar-color: var(--fill-2) transparent;
}
.member {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: var(--r-sm);
}
.member:hover { background: var(--fill-1); }
.ava {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: var(--r-pill);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--fill-2); color: var(--text);
  font-size: var(--fs-13); font-weight: 600;
  box-shadow: 0 0 0 1.5px var(--edge-ctl);
}
.member[data-role="host"] .ava { box-shadow: 0 0 0 1.5px var(--accent); }
.member[data-role="admin"] .ava { box-shadow: 0 0 0 1.5px var(--ok); }
.m-main { display: flex; align-items: baseline; gap: 7px; min-width: 0; flex: 1 1 auto; }
.m-name {
  font-size: var(--fs-13); font-weight: 500; letter-spacing: -.01em;
  color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.member[aria-current="true"] .m-name { color: var(--text); font-weight: 600; }
.member[aria-current="true"] .m-name::after {
  content: ""; display: inline-block; width: 4px; height: 4px; margin-left: 6px;
  border-radius: var(--r-pill); background: var(--accent); vertical-align: middle;
}
.m-role { font-size: var(--fs-11); color: var(--text-3); white-space: nowrap; }
.m-state { display: inline-flex; align-items: center; gap: 8px; color: var(--text-3); flex: none; }

/* 角色徽标（A 的 .chip，只出现在消息头里） */
.msg .chip,
.chip[data-role] {
  font-size: var(--fs-11); font-weight: 500; line-height: 1.5;
  padding: 0 6px; border-radius: var(--r-pill);
  background: var(--fill-1); color: var(--text-2); box-shadow: none; cursor: default;
}
.msg .chip[data-role="host"], .chip[data-role="host"] { color: var(--accent); }
.msg .chip[data-role="admin"], .chip[data-role="admin"] { color: var(--ok); }

/* 登录页 #gate（启动闩锁由 HTML 的行内规则控制，这里只管样式） */
#gate { position: relative; z-index: 3; height: 100%; display: grid; place-items: center; }

.gate-card {
  width: min(420px, 92vw);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface-solid);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: 40px 34px 30px;
  box-shadow: var(--shadow-lg);
  animation: rise .7s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

.gate-card h1 {
  font-size: var(--fs-44); font-weight: 600;
  line-height: 1.05; letter-spacing: -.02em;
  color: var(--text); text-wrap: balance;
}
.gate-card h1 span { color: var(--accent); }
.gate-sub {
  color: var(--text-3); font-size: var(--fs-11); letter-spacing: .18em;
  text-transform: uppercase; margin: 8px 0 28px;
}

.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: var(--fs-11); letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 7px;
}
.field input {
  width: 100%; min-height: 44px; padding: 11px 14px;
  background: var(--field); border: 1px solid var(--edge-ctl); border-radius: var(--r-sm);
  color: var(--text); font-size: var(--fs-15);
  transition: border-color .18s ease, background-color .18s ease;
}
.field input::placeholder { color: var(--text-3); }
.field input:focus { outline: none; border-color: var(--accent); background: var(--fill-2); }

.btn {
  width: 100%; min-height: 46px; padding: 12px; margin-top: 6px;
  background: var(--accent); color: var(--bg);
  border: 0; border-radius: var(--r-sm);
  font-size: var(--fs-15); font-weight: 600; letter-spacing: .02em;
  cursor: pointer; transition: opacity .18s ease, transform .1s ease;
}
.btn:hover { opacity: .88; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.gate-err { color: var(--live-text); font-size: var(--fs-13); min-height: 22px; margin-top: 14px; }
.gate-hint {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--hairline);
  font-size: var(--fs-13); color: var(--text-2); line-height: 1.8;
}
.gate-hint code {
  font-family: var(--mono); font-size: var(--fs-11); color: var(--text);
  background: var(--field); padding: 2px 6px; border-radius: var(--r-xs);
}

/* 大厅骨架（生产层）：.topbar / .stage-wrap / .side */
#hall {
  position: relative; z-index: 3; height: 100%;
  display: none; flex-direction: column;
  background: var(--bg);
}

/* 顶栏 = 与 A 的 .chrome-top 同一块材质（文字压白画面也 ≥4.5:1） */
.topbar {
  display: flex; align-items: center; gap: 14px; flex: none;
  padding: 9px 18px 11px;
  border-bottom: 1px solid var(--hairline);
}
.topbar .brand {
  font-size: var(--fs-17); font-weight: 600; letter-spacing: -.02em;
  white-space: nowrap; color: var(--text); flex-direction: row;
}
.topbar .brand em { font-style: normal; color: var(--accent); }
.topbar .room-name {
  font-size: var(--fs-13); color: var(--text-3); padding-left: 14px;
  border-left: 1px solid var(--hairline); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 22vw;
}

.live {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--fs-13); letter-spacing: -.01em; color: var(--text-3); white-space: nowrap;
}
.live .beacon {
  width: 7px; height: 7px; border-radius: var(--r-pill);
  background: var(--text-3); flex: none;
}
.live.on { color: var(--live); }
.live.on .beacon { background: var(--live); animation: pulse 2.4s ease-in-out infinite; }

.ghost {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 6px 14px;
  background: var(--fill-1); border: 0; border-radius: var(--r-pill);
  color: var(--text-2); box-shadow: var(--ring-ctl);
  font-size: var(--fs-13); letter-spacing: -.01em; white-space: nowrap;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease;
}
.ghost:hover { color: var(--text); background: var(--fill-2); }
.ghost:active { background: var(--fill-3); box-shadow: var(--ring-ctl-on); }
a.ghost { text-decoration: none; }

/* 舞台 + 侧栏 */
.stage-wrap { position: relative; flex: 1 1 auto; display: flex; min-height: 0; }

/* 银幕（旧词汇表）：尺寸由容器决定，不再由空 <video> 决定 */
.screen-shell {
  position: relative; flex: 1 1 auto; min-height: 0; min-width: 0;
  display: flex; align-items: center; justify-content: center;
}
.screen {
  position: relative;
  width: 100%; height: 100%;
  min-width: 0; min-height: 0;
  background: var(--bg);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.screen-shell.lit .screen { box-shadow: 0 0 0 1px var(--edge-ctl); }

/* 开启声音浮层 */
.unmute {
  position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%);
  z-index: 3; display: none;
  padding: 11px 22px; border: 0; border-radius: var(--r-pill);
  background: var(--accent); color: var(--bg); cursor: pointer;
  box-shadow: 0 0 0 1px var(--edge-on-accent), var(--shadow-sm);
  font-size: var(--fs-15); font-weight: 600; letter-spacing: .02em; white-space: nowrap;
  animation: nudge 2.4s ease-in-out infinite;
}
.unmute.on { display: block; }
.unmute:hover { opacity: .9; }
@keyframes nudge {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50%      { transform: translateX(-50%) scale(1.04); }
}

/* 不安全上下文的提示条 */
.insecure {
  display: none; padding: 9px 14px; margin: 0 0 10px;
  background: var(--danger-bg); border: 1px solid var(--live); border-radius: var(--r-sm);
  color: var(--live-text); font-size: var(--fs-13); line-height: 1.7;
}
.insecure.on { display: block; }
.insecure b { color: var(--text); }

/* 待播 / 断流遮罩（旧词汇表；与 .scene-wait 同一套语言） */
.veil {
  position: absolute; inset: 0; z-index: 2;
  display: grid; place-items: center; align-content: center; gap: 10px;
  background: var(--bg);
  text-align: center;
  transition: opacity .5s var(--ease);
}
.veil.hide { opacity: 0; pointer-events: none; }
.veil .reel {
  width: 40px; height: 40px; border-radius: var(--r-pill);
  border: 2px solid var(--fill-2); border-top-color: var(--accent);
  animation: spin 1.4s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.veil p { color: var(--text-2); font-size: var(--fs-13); letter-spacing: .02em; margin: 0; }

/* 屏幕下方控制条 */
.deck {
  flex: none; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  min-height: 34px;
}
.deck .meta { font-size: var(--fs-11); color: var(--text-3); letter-spacing: .01em; }

/* 侧栏（旧词汇表） */
.side {
  width: 336px; flex: none; display: flex; flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--hairline);
  overscroll-behavior: contain;
}
.tabs {
  display: flex; flex: none;
  border-bottom: 1px solid var(--hairline);
  padding: 6px; gap: 2px;
}
.panel-head .tabs { border-bottom: 0; padding: 0; }
.tabs > button {
  flex: 1; min-height: 34px;
  background: transparent; border: 0; border-radius: var(--r-pill);
  color: var(--text-2); box-shadow: var(--ring-ctl);
  padding: 8px; cursor: pointer; font-size: var(--fs-13); letter-spacing: -.01em;
  transition: background-color .18s ease, color .18s ease;
}
.tabs > button[aria-selected="true"] { background: var(--fill-2); color: var(--text); box-shadow: var(--ring-ctl-on); }
.tabs > button:hover { color: var(--text); }
.tab-body { flex: 1; min-height: 0; display: none; flex-direction: column; }
.tab-body.on { display: flex; }

/* 成员列表 */
.person {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: var(--r-sm);
  transition: background-color .16s ease;
}
.person:hover { background: var(--fill-1); }
.person .pip {
  width: 26px; height: 26px; border-radius: var(--r-pill); flex: none;
  display: grid; place-items: center;
  font-size: var(--fs-11); font-weight: 600; color: var(--bg);
  background: var(--fill-3);
  box-shadow: 0 0 0 1.5px var(--edge-ctl);
}
.person[data-role="host"] .pip { background: var(--accent); box-shadow: 0 0 0 1.5px var(--accent); }
.person[data-role="admin"] .pip { background: var(--ok); box-shadow: 0 0 0 1.5px var(--ok); }
.person .nm {
  flex: 1; min-width: 0; font-size: var(--fs-13);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.person .tag {
  font-size: var(--fs-11); letter-spacing: -.01em; color: var(--text-3);
  background: var(--fill-1); padding: 1px 6px; border-radius: var(--r-pill); flex: none;
}
.person[data-role="host"] .tag { color: var(--accent); }
.person[data-role="admin"] .tag { color: var(--ok); }
.person .mic { flex: none; font-size: var(--fs-11); color: var(--text-3); letter-spacing: .01em; }
.person .mic.live { color: var(--ok); }
.person .act {
  flex: none; opacity: 0; background: transparent; border: 0; color: var(--text-2);
  cursor: pointer; padding: 2px 6px; border-radius: var(--r-pill);
  transition: opacity .16s ease, color .16s ease;
}
.person:hover .act, .person:focus-within .act, .person .act:focus-visible { opacity: 1; }
.person .act:hover { color: var(--text); background: var(--fill-1); }

/* 聊天（旧词汇表） */
.log {
  flex: 1; min-height: 0; overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px; display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin; scrollbar-color: var(--fill-2) transparent;
}
@keyframes slip { from { opacity: 0; transform: translateY(7px); } }
.msg .hd { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.msg[data-role="host"] .who { color: var(--accent); }
.msg[data-role="admin"] .who { color: var(--ok); }
.msg .who { color: var(--text); }
.msg .body {
  color: var(--text-2); font-size: var(--fs-15); line-height: 1.5; margin: 0;
  overflow-wrap: anywhere; word-break: break-word; white-space: pre-wrap;
}
.msg.sys { text-align: center; }
.msg.sys .body {
  font-size: var(--fs-13); color: var(--text-3);
  background: var(--fill-1); padding: 4px 12px; border-radius: var(--r-pill);
  display: inline-block;
}
.msg.gone .body { color: var(--text-3); }

.micbtn {
  flex: none; width: 44px; min-height: 38px;
  background: var(--fill-1); border: 0; border-radius: var(--r-pill);
  color: var(--text-2); cursor: pointer; font-size: var(--fs-17);
  box-shadow: var(--ring-ctl);
  transition: background-color .18s ease, color .18s ease;
}
.micbtn:hover { color: var(--text); background: var(--fill-2); }
.micbtn[aria-pressed="true"] { background: var(--fill-2); color: var(--ok); box-shadow: var(--ring-ctl-on); }
.micbtn:disabled { opacity: .45; cursor: not-allowed; }

/* 设置抽屉（开播端） */
.drawer {
  position: fixed; z-index: 40;
  top: 0; right: 0; bottom: 0;
  width: min(430px, 94vw);
  display: flex; flex-direction: column;
  border-left: 1px solid var(--hairline);
  box-shadow: var(--shadow-lg);
  overscroll-behavior: contain;
  transform: translateX(102%);
  transition: transform .32s var(--ease);
}
.drawer.open { transform: none; }
.drawer-hd {
  display: flex; align-items: center; gap: 12px; flex: none;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 18px 14px;
  border-bottom: 1px solid var(--hairline);
}
.drawer-hd h2 { font-size: var(--fs-17); font-weight: 600; letter-spacing: -.02em; flex: 1; text-wrap: balance; }
.drawer-hd .x {
  background: var(--fill-1); border: 0; border-radius: var(--r-pill);
  color: var(--text-2); font-size: var(--fs-20); line-height: 1;
  cursor: pointer; padding: 4px 10px; box-shadow: var(--ring-ctl);
  transition: background-color .16s ease, color .16s ease;
}
.drawer-hd .x:hover { color: var(--text); background: var(--fill-2); }
.drawer-body {
  flex: 1; min-height: 0; overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  scrollbar-width: thin; scrollbar-color: var(--fill-2) transparent;
}
.drawer-ft {
  flex: none;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--hairline);
  display: flex; gap: 10px; align-items: center;
}
.drawer-ft .hint { flex: 1; font-size: var(--fs-11); color: var(--text-3); line-height: 1.5; }

/* 实时状态格 */
.statgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-bottom: 20px; }
.statcell {
  background: var(--field); border-radius: var(--r-sm); padding: 10px 12px;
  box-shadow: var(--ring-ctl);
}
.statcell .k { font-size: var(--fs-11); letter-spacing: .08em; color: var(--text-3); }
.statcell .v {
  font-size: var(--fs-17); font-weight: 600; color: var(--text);
  margin-top: 3px; font-variant-numeric: tabular-nums;
}
.statcell.warn .v { color: var(--live-text); }
.statcell.ok .v { color: var(--ok); }

.sect {
  font-size: var(--fs-11); letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-3); margin: 20px 0 12px; padding-bottom: 7px;
  border-bottom: 1px solid var(--hairline); text-wrap: balance;
}
.sect:first-child { margin-top: 0; }

.row { margin-bottom: 15px; }
.row label { display: flex; align-items: baseline; gap: 8px; font-size: var(--fs-13); margin-bottom: 6px; }
.row label .n { color: var(--text-2); }
.row label .cur {
  margin-left: auto; font-size: var(--fs-13); font-weight: 600; color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.row input[type=range] { width: 100%; accent-color: var(--accent); height: 20px; }
.row select, .row input[type=number], .row input[type=text], .row input[type=password] {
  width: 100%; min-height: 40px; padding: 9px 11px;
  background: var(--field); border: 1px solid var(--edge-ctl); border-radius: var(--r-sm);
  color: var(--text); font-size: var(--fs-15);
}
.row select:focus, .row input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 7px 13px;
  background: var(--fill-1); border: 0; border-radius: var(--r-pill);
  color: var(--text-2); font-size: var(--fs-13); cursor: pointer;
  box-shadow: var(--ring-ctl);
  transition: background-color .16s ease, color .16s ease;
}
.chip:hover { color: var(--text); background: var(--fill-2); }
.chip[aria-pressed="true"] { background: var(--fill-3); color: var(--text); box-shadow: var(--ring-ctl-on); }

.bw {
  margin-top: 18px; padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--fill-1); box-shadow: var(--ring-ctl);
  font-size: var(--fs-13); color: var(--text-2); line-height: 1.7;
}
.bw b { color: var(--accent); font-variant-numeric: tabular-nums; }
.bw.danger { background: var(--danger-bg-2); box-shadow: inset 0 0 0 1px var(--live); }
.bw.danger b { color: var(--live-text); }

.pending { color: var(--accent); font-size: var(--fs-11); font-variant-numeric: tabular-nums; }

/* 轻提示浮层（开播端） */
#toasts {
  position: fixed; z-index: 80;
  right: calc(18px + env(safe-area-inset-right, 0px));
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  pointer-events: none; max-width: min(420px, 80vw);
}
#toasts .toast {
  background-color: var(--glass-base);
  background-image: linear-gradient(var(--surface), var(--surface));
  -webkit-backdrop-filter: var(--backdrop);
  backdrop-filter: var(--backdrop);
  border: 0; border-left: 3px solid var(--accent);
  border-radius: var(--r-sm); padding: 10px 14px;
  color: var(--text); font-size: var(--fs-13); line-height: 1.6;
  box-shadow: var(--shadow-sm);
  animation: slip .32s var(--ease) both;
}

/* ══════════════════════════════════════════════════════════════
   集成补齐（总工头，合并 U1/U2/U3 后）
   ─ U1 与 U3 都在 2785f00 上开工，U3 新引入的类 U1 无从得知；
     合并后逐类核对，这里是缺口。全部走既有 token，不新增色值。
   ══════════════════════════════════════════════════════════════ */

/* 管理员凭证列表（U3 新引入：原来是 cssText 内联样式，
   里面写死了 #0c0a07 与旧 --edge —— U1 换掉 token 后那些内联值就瞎了） */
.adm-list { display: flex; flex-direction: column; gap: 6px; }
.adm {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r-sm);
  background: var(--field); box-shadow: var(--ring-ctl);
  font-size: var(--fs-13);
}
.adm-note {
  flex: 1; min-width: 0; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.adm-state { flex: none; color: var(--text-3); font-variant-numeric: tabular-nums; }
.adm.dead .adm-note { color: var(--text-3); text-decoration: line-through; }
.adm.dead .adm-state { color: var(--live-text); }

/* 横排一行（U3 新引入：原来是 2 处 display:flex;gap:8px 的内联样式） */
.inline-row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }

/* 芯片组/滑块组的行标题（U3 新引入：<label> 不能指向 <div>，for 会悬空，
   所以只能用 div + aria-labelledby，视觉上要长得像 .row label） */
.row-hd {
  display: flex; align-items: baseline; gap: 8px;
  font-size: var(--fs-13); color: var(--text-2); margin-bottom: 6px;
}
.row-hd .n { color: var(--text-2); }

/* 抽屉正文里的提示文字。
   ⚠️ U1 只定过 `.drawer-ft .hint`（作用域限定），而 host.html 有 4 处 .hint
   在 .drawer-ft 之外 —— 裸用会掉回继承字号。补一条基线规则；
   抽屉页脚那条更具体的规则仍然优先。 */
.hint { font-size: var(--fs-11); color: var(--text-3); line-height: 1.6; }

/* 紧凑按钮：U1 只定过 .pill.sm，而 U3 用的是 .ghost.sm（管理员行的「复制」） */
.ghost.sm, .btn.sm { min-height: 30px; padding: 6px 11px; font-size: var(--fs-13); }

/* 成员状态里的「已闭麦」（core.js 往 .m-state 上挂 .muted） */
.m-state.muted { color: var(--live-text); }

/* 开播端（body.host） T-57：抽屉不许遮住 deck 与 roster —— 纯 CSS 唯一能**证明**的办法是让它进文档流。 ≥1024px 停靠为右栏；<1024px 变成竖排里的第三段（默认收起）。两者都不覆盖任何东西。 */
@media (min-width: 1024px) {
  body.host .drawer {
    position: static; transform: none;
    width: 430px; flex: none;
    border-left: 1px solid var(--hairline);
    border-radius: 0; box-shadow: none;
  }
  body.host .drawer-hd .x { display: none; }   /* 已停靠，不需要关闭按钮 */
  body.host .side { width: 290px; }
}

@media (max-width: 1023px) {
  /* 竖排：预览 → 设置（打开时）→ 成员。三者互不重叠。 */
  body.host .stage-wrap { flex-direction: column; overflow-y: auto; overscroll-behavior: contain; }
  body.host .stage { flex: none; height: 56vh; min-height: 320px; }
  body.host .side {
    width: auto; height: auto; max-height: 40vh; flex: none; order: 3;
    border-left: 0; border-top: 1px solid var(--hairline);
  }
  body.host .drawer {
    position: static; transform: none; order: 2;
    width: auto; height: auto; max-height: none; flex: none;
    border-left: 0; border-top: 1px solid var(--hairline);
    border-radius: 0; box-shadow: none;
    display: none;
  }
  body.host .drawer.open { display: flex; }
  body.host .drawer .drawer-body { overflow-y: visible; }
}

/* 全屏：只留画面 */
#hall:fullscreen .topbar,
#hall:fullscreen .side,
#hall:fullscreen .deck,
#hall:fullscreen .drawer { display: none; }
#hall:fullscreen .stage { padding: 0; }
#hall:fullscreen .screen { border: 0; border-radius: 0; box-shadow: none; }
#hall:fullscreen .insecure { display: none; }

/* 自适应（A 的断点：1160 / 900 / 760 / 560） */
@media (max-width: 1160px) {
  .chrome-bottom { flex-direction: column; align-items: stretch; gap: 10px; }
  .dock-left { flex-direction: row; align-items: center; gap: 12px; flex-wrap: wrap; }
  .dock-right { justify-content: flex-end; }
}
@media (max-width: 900px) {
  .chan-desc { display: none; }
  /* 观众端窄屏：侧栏折到画面下方。40%（而不是 44%）是为了让画面区仍占到舞台 ≥85% */
  .stage-wrap { flex-direction: column; }
  .side {
    width: auto; height: 38%; flex: none;
    border-left: 0; border-top: 1px solid var(--hairline);
  }
  .stage { padding: 8px; gap: 6px; }
  .topbar .room-name { display: none; }
  .drawer { width: 100vw; }
}
@media (max-width: 760px) {
  .brand-en { display: none; }
  /* 与 A 的 .res 同断点：窄屏收起次要元信息，别让 deck 折行挤掉画面高度 */
  .deck .meta { display: none; }
  .room-path { display: none; }
  .res { display: none; }
  .chrome-top .chrome-inner { padding: 12px 14px 26px; gap: 11px; }
  .chrome-bottom { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 560px) {
  .stage { padding: 6px; }   /* 手机：边距占比最大，收到 6px 才能让画面区仍 ≥85% */
  .dock-right .pill-label, .pill-label { display: none; }
  .dock-right .pill { width: 38px; padding: 0; justify-content: center; }
  .panel {
    top: calc(10px + env(safe-area-inset-top, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
}

/* 减少动态（T-52）：全站零动画、零过渡 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .app[data-state="waiting"] .frame::before,
  #hall[data-state="waiting"] .frame::before { animation: none; }
  .app.idle .chrome-top { opacity: .22; }
}
