/* Static snapshot of the current presenter UI; no Tailwind or runtime required. */

/* ============================================================
   Coolwei AI Lab · 实时数字人对话 Demo
   ------------------------------------------------------------
   视觉语言与 ai-coolwei-web 主站统一：白色表面、克制描边、
   蓝色品牌强调、系统无衬线字体、细线目录式卡片、分段导航。
   颜色一律经 var(--*) 取用。支持明暗主题。
   ------------------------------------------------------------
   布局：视口定高的两段栅格（顶栏 / 工作区）。工作区左右分栏：
   左为形象陪伴栏（大幅形象 + 状态 + 可编辑人设指令），右为对话栏
   （记录 + 输入坞）。页面级滚动全程关闭，只有对话区内部滚动。
   ============================================================ */

/* ---------- Tokens ---------- */

:root {
  /* 与主站 assets/css/styles.css 的亮色 token 对齐 */
  --bg: #ffffff;
  --bg-muted: #f1f4fa;
  --text: #05070d;
  --text-muted: #4a5261;
  --text-subtle: #6b7484;
  --border: #dee4ee;
  --border-strong: #b9c3d4;
  --brand: #0b3df5;
  --brand-strong: #0730c4;
  --brand-soft: #e7ecff;
  --brand-ring: rgba(11, 61, 245, 0.3);
  /* 工作区层次：--ground 是页面底，--panel 是卡片面；暗色下 panel 比 ground 亮一档 */
  --ground: #f4f6fb;
  --panel: #ffffff;
  --radius-control: 12px;
  --radius-media: 16px;
  --radius-card: 18px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 2px rgba(6, 16, 45, 0.04), 0 8px 24px rgba(6, 16, 45, 0.05);
  --shadow-card-hover: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(33, 150, 243, 0.10);
  --shadow-primary: 0 4px 14px rgba(11, 61, 245, 0.22);
  --conversation-user: var(--brand-soft);
  --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  /* 只用于实时遥测数字（时码、TTFA/TTFV、FPS），主站无此场景 */
  --font-mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
  /* 形象在超宽屏上的绝对上限，其余尺寸由剩余空间决定 */
  --avatar-max: 720px;
  /* 对话气泡的可读宽度上限，分栏再宽也不拉成长行 */
  --thread-measure: 780px;
  /* Demo 专属状态色：主站无状态语义，保持克制 */
  --ok: #15803d;
  --ok-soft: rgba(21, 128, 61, 0.09);
  --warn: #b45309;
  --warn-soft: rgba(180, 83, 9, 0.09);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.09);
  color-scheme: light;
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

body {
  color: var(--text);
  font-family: var(--font-display);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { color: inherit; font: inherit; }

/* 作者样式里的 display 会盖掉 UA 的 [hidden]{display:none}，
   人设面板折叠时的 footer 就靠这条才真的收起来。 */
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--brand-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

.chat-thread { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.chat-thread::-webkit-scrollbar { width: 8px; }
.chat-thread::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  background-clip: content-box;
}

@keyframes soft-pulse { 50% { opacity: 0.3; } }

/* ---------- Shell ---------- */

/* 用 height 而非 min-height：否则栅格的 1fr 轨道会被子项的
   min-content 顶高，整页产生滚动、输入坞被挤出视口。 */
.app-shell {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background: var(--bg);
}

/* ---------- 顶栏 ---------- */

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-lockup { flex: 0 0 auto; height: 60px; width: auto; }
.brand-mark {
  display: grid; place-items: center;
  flex: 0 0 auto;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
}
.brand > span:last-child { display: grid; gap: 1px; min-width: 0; }
.brand strong { font-size: 0.82rem; font-weight: 600; letter-spacing: 0.04em; }
.brand small { color: var(--text-subtle); font-size: 0.72rem; }

.deck-meta {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-muted);
  color: var(--text-muted);
  font-size: 0.72rem; letter-spacing: 0.05em;
  white-space: nowrap;
}
.deck-meta .wall-clock { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-subtle); }
.live-dot.service-online { background: var(--ok); animation: soft-pulse 2.4s ease-in-out infinite; }
.live-dot.service-checking { background: var(--warn); animation: soft-pulse 1.2s ease-in-out infinite; }
.live-dot.service-offline { background: var(--danger); }
.divider { width: 1px; height: 12px; background: var(--border-strong); }

.demo-badge {
  justify-self: end;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 0.72rem; font-weight: 500;
  white-space: nowrap;
}

/* ---------- 工作区：形象陪伴栏 + 对话栏 ---------- */

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(360px, 42%) minmax(0, 1fr);
  overflow: hidden;
}

/* ---------- 左：形象陪伴栏 ---------- */

.companion {
  min-height: 0; min-width: 0;
  display: flex; flex-direction: column;
  gap: 14px;
  padding: 22px 24px 20px;
  border-right: 1px solid var(--border);
  /* 极淡点阵，给大面积留白一点质感，不与形象抢注意力 */
  background:
    radial-gradient(circle, color-mix(in srgb, var(--border) 70%, transparent) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--bg);
  overflow: hidden;
}

/* 形象吃掉陪伴栏的全部剩余空间。container-type: size 让内部可以用
   cqw/cqh 取到这块剩余空间的宽高，min() 出的正方形永远不会溢出，
   收起人设指令时也自动变大——不需要再手写第二套 vh 尺寸。 */
.avatar-slot {
  flex: 1 1 auto; min-height: 140px;
  display: grid; place-items: center;
  container-type: size;
}
.avatar-card {
  position: relative;
  width: min(100cqw, 100cqh, var(--avatar-max));
  height: min(100cqw, 100cqh, var(--avatar-max));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--bg-muted);
  box-shadow: var(--shadow-card);
}

/* 静态公模与 Ditto 输出同源同构图（都是这张 1254² 方图），
   必须共用同一套 fit/position，切换时才不会跳帧。 */
.presenter-image, .ditto-video, .ditto-frame {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
}
.presenter-image { z-index: 1; }
.ditto-video, .ditto-frame { z-index: 2; opacity: 0; transition: opacity 0.12s linear; }
.ditto-video.live, .ditto-frame.live { opacity: 1; }
.presenter-image.frame-hidden { opacity: 0; }
.wake-feedback-frame { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 3; opacity: 0; pointer-events: none; }
.wake-feedback-frame.live { opacity: 1; }

.portrait-scan {
  position: absolute; z-index: 3; inset: 0;
  background: linear-gradient(180deg, transparent 0%, var(--brand-ring) 48%, transparent 51%);
  background-size: 100% 210%;
  opacity: 0; pointer-events: none;
}
.avatar-state-thinking .portrait-scan { opacity: 1; animation: portrait-scan 1.8s linear infinite; }
@keyframes portrait-scan { from { background-position: 0 -100%; } to { background-position: 0 100%; } }

/* 说话时一圈品牌色描边 */
.avatar-card::after {
  content: ''; position: absolute; z-index: 4; inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 2px transparent;
  transition: box-shadow 0.2s ease;
  pointer-events: none;
}
.avatar-state-speaking .avatar-card::after { box-shadow: inset 0 0 0 2px var(--brand); }

.ditto-chip {
  position: absolute; z-index: 5; left: 12px; top: 12px;
  padding: 4px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--text-muted);
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.08em;
}
.ditto-chip.state-ready, .ditto-chip.state-available { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 28%, transparent); }
.ditto-chip.state-connecting, .ditto-chip.state-checking { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.ditto-chip.state-streaming { color: var(--brand-strong); border-color: var(--brand); }
.ditto-chip.state-offline { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }

/* VU 电平条 */
.audio-wave {
  position: absolute; z-index: 5; left: 50%; bottom: 12px;
  display: flex; align-items: center; gap: 3px;
  padding: 7px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  background: var(--bg);
  box-shadow: var(--shadow-card);
  transform: translateX(-50%);
  opacity: 0.5;
  transition: opacity 0.18s ease, border-color 0.18s ease;
}
.audio-wave.active { opacity: 1; border-color: var(--brand); }
.audio-wave i {
  width: 2.5px; height: 16px; border-radius: 2px;
  background: var(--text-subtle);
  transform-origin: center;
  transition: transform 0.1s linear, background 0.18s ease;
}
.audio-wave.active i { background: var(--brand); }

/* 形象下方一行状态 */
.avatar-meta {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  color: var(--text-muted); font-size: 0.78rem;
}
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 5px 12px;
  background: var(--bg-muted);
  color: var(--text-muted);
  font-size: 0.75rem; font-weight: 500;
}
.status-pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill.assistant-idle { color: var(--ok); background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 26%, transparent); }
.status-pill.assistant-thinking { color: var(--warn); background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 28%, transparent); }
.status-pill.assistant-thinking i { animation: soft-pulse 0.9s ease-in-out infinite; }
.status-pill.assistant-speaking { color: var(--brand-strong); background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 34%, transparent); }
.status-pill.assistant-speaking i { animation: soft-pulse 0.7s ease-in-out infinite; }
.status-pill.assistant-error { color: var(--danger); background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.latency {
  color: var(--text-subtle);
  font-family: var(--font-mono); font-size: 0.7rem; font-variant-numeric: tabular-nums; letter-spacing: 0.04em;
}

/* ---------- 人设指令面板 ---------- */

/* 自然高度：收起时只剩标题行，剩余空间一律归形象 */
.persona {
  flex: 0 0 auto;
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg);
}
.persona-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.persona-head h2 {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0;
  color: var(--text);
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em;
}
.persona-head h2 b {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-family: var(--font-mono); font-size: 0.58rem; font-weight: 600; letter-spacing: 0.1em;
}
.persona-tools { display: flex; align-items: center; gap: 6px; }
.persona-tools button {
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 4px 11px;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.7rem; cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.persona-tools button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-strong); background: var(--brand-soft); }
.persona-tools button:disabled { opacity: 0.35; cursor: not-allowed; }

.persona-input {
  height: 132px; width: 100%; resize: none;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px;
  outline: 0;
  background: var(--bg-muted); color: var(--text);
  font-family: inherit; font-size: 0.8rem; line-height: 1.75;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.persona-input:focus { border-color: var(--brand); background: var(--bg); box-shadow: 0 0 0 3px var(--brand-ring); }
.persona-input::placeholder { color: var(--text-subtle); }

.persona-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  color: var(--text-subtle); font-size: 0.68rem;
}
.persona-flag { display: inline-flex; align-items: center; gap: 6px; }
.persona-flag::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: var(--border-strong);
}
.persona-flag.dirty { color: var(--brand-strong); }
.persona-flag.dirty::before { background: var(--brand); }
.persona-count { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* 规格：一行三项的极简清单，只在展开高度够时出现 */
.companion-specs {
  flex: 0 0 auto;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 14px; margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.companion-specs dt { color: var(--text-subtle); font-size: 0.66rem; letter-spacing: 0.08em; }
.companion-specs dd {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-family: var(--font-mono); font-size: 0.66rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 右：对话栏 ---------- */

.chat-column {
  min-height: 0; min-width: 0;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  background: var(--bg-muted);
}

.chat-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  padding: 18px 26px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.chat-kicker {
  display: block;
  color: var(--brand-strong);
  font-size: 0.66rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
}
.chat-title { margin: 3px 0 0; font-size: 1.28rem; font-weight: 600; letter-spacing: -0.015em; }
.chat-transport {
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 5px 12px;
  background: var(--bg-muted);
  color: var(--text-muted);
  font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.04em;
  white-space: nowrap;
}

/* 对话：吃满对话栏的剩余高度，只在内部滚动 */
.chat-thread { min-height: 0; overflow-y: auto; padding: 8px 26px; }
.chat-thread-inner { width: 100%; max-width: var(--thread-measure); margin: 0 auto; }
.chat-message { display: grid; gap: 6px; margin: 18px 0; }
.chat-message > span {
  color: var(--text-subtle);
  font-size: 0.66rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
}
.chat-message p {
  width: fit-content; max-width: 88%; margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 4px 14px 14px 14px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem; line-height: 1.75;
  overflow-wrap: anywhere;
}
.chat-message.role-user { justify-items: end; }
.chat-message.role-user p {
  border-color: color-mix(in srgb, var(--brand) 30%, transparent);
  border-radius: 14px 4px 14px 14px;
  background: var(--brand-soft);
}
.typing-dots {
  color: var(--brand);
  font-size: 0.6rem; font-style: normal; letter-spacing: 0.16em;
  animation: soft-pulse 0.9s ease-in-out infinite;
}

/* ---------- 输入坞 ---------- */

.chat-dock {
  display: grid; gap: 10px;
  padding: 14px 26px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.suggestion-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  width: 100%; max-width: var(--thread-measure); margin: 0 auto;
}
.suggestion-row button {
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 6px 14px;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.76rem; cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.suggestion-row button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-strong); background: var(--brand-soft); }
.suggestion-row button:disabled { opacity: 0.4; cursor: not-allowed; }

.composer-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 12px;
  width: 100%; max-width: var(--thread-measure); margin: 0 auto;
}
.composer-signal {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--text-subtle);
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
}
.composer-signal i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.composer-signal.state-thinking i { background: var(--warn); }
.composer-signal.state-speaking i { background: var(--brand); }
.composer-signal.state-error i { background: var(--danger); }
.composer-row textarea {
  width: 100%; min-height: 44px; max-height: 96px; resize: none;
  border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 11px 14px;
  outline: 0;
  background: var(--bg); color: var(--text);
  font-family: inherit; font-size: 0.9rem; line-height: 1.5;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.composer-row textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.composer-row textarea::placeholder { color: var(--text-subtle); }

/* 主站 .btn / .btn-primary 的 pill 处理 */
.send-button, .stop-button {
  min-width: 92px; height: 44px;
  border-radius: var(--radius-pill); padding: 0 20px;
  border: 1px solid transparent;
  font-size: 0.88rem; font-weight: 500; cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.send-button { background: var(--brand); border-color: var(--brand); color: #fff; }
.send-button:hover:not(:disabled) { background: var(--brand-strong); border-color: var(--brand-strong); }
.send-button span { margin-left: 5px; }
.send-button:disabled { cursor: not-allowed; opacity: 0.4; }
.stop-button { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 32%, transparent); color: var(--danger); }
.stop-button:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); }

/* ---------- 响应式 ---------- */

/* 中宽：分栏留不下 360px 陪伴栏时改上下堆叠，形象收小让位给对话 */
@media (max-width: 1080px) {
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .companion {
    flex-direction: row; align-items: stretch; gap: 16px;
    padding: 14px 18px;
    border-right: 0; border-bottom: 1px solid var(--border);
  }
  .companion .avatar-slot { flex: 0 0 auto; min-height: 0; container-type: normal; }
  .companion .avatar-card { width: min(30vh, 200px); height: min(30vh, 200px); }
  .avatar-meta { display: none; }
  .persona { flex: 1 1 auto; }
  .companion-specs { display: none; }
  .chat-head { padding: 12px 18px 10px; }
  .chat-title { font-size: 1.1rem; }
  .chat-thread, .chat-dock { padding-left: 18px; padding-right: 18px; }
}

/* 窄屏：陪伴栏只保留形象与状态，人设指令折进对话上方是多余的层级，
   直接隐藏，展厅横屏场景不走这条分支。 */
@media (max-width: 640px) {
  /* 顶栏三段在窄屏放不下：砍掉副标题、徽标与时码，品牌超长省略 */
  .topbar { grid-template-columns: minmax(0, auto) minmax(0, 1fr); padding: 10px 14px; }
  .brand small, .demo-badge, .deck-meta .wall-clock { display: none; }
  .brand strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .deck-meta { justify-self: end; gap: 8px; padding: 5px 10px; font-size: 0.66rem; }
  .deck-meta .divider:last-of-type { display: none; }
  .companion { flex-direction: column; }
  .companion .avatar-card { width: min(26vh, 168px); height: min(26vh, 168px); }
  .persona { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot, .status-pill i, .typing-dots, .portrait-scan { animation: none !important; }
  .audio-wave i { transition: none; }
}

/* ============================================================
   演示台（/present）：照稿讲解的主场景
   ------------------------------------------------------------
   与 /chat 共用顶栏、形象卡与状态徽标的样式，只补 .stage-* 前缀的
   舞台部件。构图：幻灯片 16:9 画布占满左栏（约七成宽），右栏是竖排
   的形象与遥测；画布下依次是进度轨、提词器字幕与控制坞。
   仅亮色：展厅常亮，无主题切换。
   ============================================================ */

.stage-shell {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background: var(--bg);
}

.stage-topbar { grid-template-columns: minmax(0, 1fr) minmax(0, auto) minmax(0, 1fr); }
.stage-deck { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.stage-deck h1 {
  margin: 0;
  font-size: 1.35rem; font-weight: 600; letter-spacing: -0.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stage-deck span {
  flex: 0 0 auto;
  color: var(--text-subtle);
  font-size: 0.95rem; font-variant-numeric: tabular-nums; letter-spacing: 0.04em;
}
.stage-topbar .brand small { font-size: 0.95rem; font-weight: 600; letter-spacing: 0.06em; }
.stage-health { justify-self: end; }

.stage-main {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(228px, 21vw, 316px);
  gap: 20px;
  padding: 16px 24px 18px;
  overflow: hidden;
  /* 极淡点阵：大面积留白有质感，又不和幻灯片抢注意力 */
  background:
    radial-gradient(circle, color-mix(in srgb, var(--border) 70%, transparent) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--bg);
}

.stage-screen {
  min-width: 0; min-height: 0;
  display: flex; flex-direction: column; gap: 12px;
}

/* container-type: size 让画布用 cq 单位在剩余空间里解出最大的 16:9，
   横向或纵向受限都不会溢出，不需要第二套 vh 尺寸。 */
.stage-canvas-slot {
  flex: 1 1 auto; min-height: 0;
  display: grid; place-items: center;
  container-type: size;
}
.stage-canvas {
  position: relative;
  width: min(100cqw, calc(100cqh * 16 / 9));
  aspect-ratio: 16 / 9;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  /* 幻灯片是深色底：留边时用同族深色，contain 不会露出刺眼白边 */
  background: #0b1622;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 18px 44px rgba(15, 23, 42, 0.12);
}
.stage-canvas img {
  width: 100%; height: 100%;
  display: block;
  object-fit: contain;
  animation: stage-slide-in 0.42s ease both;
}
@keyframes stage-slide-in { from { opacity: 0; transform: scale(1.012); } }
.stage-canvas-empty {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: rgba(255, 255, 255, 0.62); font-size: 0.86rem;
}

/* ---------- 进度轨 ---------- */

.stage-rail { display: flex; align-items: center; gap: 16px; }
.stage-count { display: inline-flex; align-items: baseline; gap: 6px; }
.stage-count b {
  font-size: 1.55rem; font-weight: 700; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.stage-count i { color: var(--text-subtle); font-size: 0.78rem; font-style: normal; font-variant-numeric: tabular-nums; }

.stage-ticks { flex: 1 1 auto; display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.stage-ticks li {
  flex: 1 1 0; height: 4px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.3s ease, transform 0.3s ease;
}
.stage-ticks li.done { background: color-mix(in srgb, var(--brand) 42%, var(--border)); }
.stage-ticks li.live { background: var(--brand); transform: scaleY(2); }

.stage-dots {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-subtle); font-size: 0.7rem;
}
.stage-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); }
.stage-dots i.done { background: color-mix(in srgb, var(--brand) 45%, var(--border-strong)); }
.stage-dots i.live { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.stage-dots em { margin-left: 4px; font-style: normal; font-variant-numeric: tabular-nums; }

/* ---------- 提词器字幕 ---------- */

/* 一行到底：文字随朗读增长，超宽时由 JS 把 scrollLeft 顶到末尾，
   左侧加渐隐遮罩表示前文被滚出去了。 */
.stage-subtitle {
  display: flex; align-items: center; gap: 14px;
  min-height: 60px;
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: 12px;
  background: var(--bg-muted);
}
.stage-subtitle-tag {
  flex: 0 0 auto;
  color: var(--brand-strong);
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.14em;
}
.stage-subtitle-line {
  flex: 1 1 auto; min-width: 0; margin: 0;
  overflow-x: hidden; white-space: nowrap;
  font-size: 1.02rem; line-height: 1.5;
}
.stage-subtitle-line.scrolled { mask-image: linear-gradient(90deg, transparent 0, #000 56px); }
.stage-subtitle-idle { color: var(--text-subtle); font-size: 0.88rem; }
.stage-caret {
  display: inline-block; width: 2px; height: 1.05em; margin-left: 5px;
  background: var(--brand);
  vertical-align: -0.16em;
  animation: stage-blink 1s steps(2, start) infinite;
}
@keyframes stage-blink { 50% { opacity: 0; } }

.stage-alert {
  margin: 0;
  padding: 9px 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.8rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 控制坞 ---------- */

.stage-dock { display: flex; align-items: center; gap: 10px; }
.stage-button {
  min-width: 104px; height: 44px; padding: 0 22px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-pill);
  background: var(--bg); color: var(--text);
  font-size: 0.9rem; font-weight: 500; cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.stage-button:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); }
.stage-button:disabled { opacity: 0.36; cursor: not-allowed; }
.stage-button.primary {
  min-width: 132px;
  border-color: var(--brand); background: var(--brand); color: #fff;
  box-shadow: 0 6px 18px var(--brand-ring);
}
.stage-button.primary:hover:not(:disabled) { border-color: var(--brand-strong); background: var(--brand-strong); color: #fff; }
.stage-button.ghost { margin-left: auto; border-color: transparent; background: transparent; color: var(--text-muted); }
.stage-button.ghost:hover:not(:disabled) { background: var(--bg-muted); color: var(--text); }

/* ---------- 右栏：形象与遥测 ---------- */

.stage-side { min-height: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; overflow: hidden; }
.stage-avatar { flex: 0 0 auto; }
/* 覆盖 .avatar-card 的容器查询尺寸：这里由右栏宽度决定 */
.stage-avatar-card { width: 100%; height: auto; aspect-ratio: 1; }
.stage-presenter { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.stage-summary {
  margin: 0;
  color: var(--text-muted); font-size: 0.76rem; line-height: 1.7;
  overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6;
}
.stage-specs { margin-top: auto; grid-template-columns: minmax(0, 1fr); gap: 7px 0; }
.stage-specs > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.stage-specs dd { margin: 0; }
.stage-badge { flex: 0 0 auto; align-self: flex-start; }

/* ---------- 响应式 ---------- */

/* 右栏塞不下时改成画布上方的一条横排：形象缩到缩略图，只留状态与遥测 */
@media (max-width: 1024px) {
  .stage-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); padding: 12px 16px 14px; }
  .stage-side { grid-row: 1; flex-direction: row; align-items: center; gap: 14px; }
  .stage-avatar-card { width: 76px; }
  .stage-avatar-card .ditto-chip, .stage-avatar-card .audio-wave { display: none; }
  .stage-summary, .stage-specs { display: none; }
  .stage-badge { margin-left: auto; }
  .stage-subtitle { min-height: 52px; padding: 10px 14px; }
}

@media (max-width: 720px) {
  .stage-topbar { grid-template-columns: minmax(0, auto) minmax(0, 1fr); padding: 10px 14px; }
  .stage-deck { display: none; }
  .stage-health { gap: 8px; padding: 5px 10px; font-size: 0.66rem; }
  .stage-dock { flex-wrap: wrap; }
  .stage-button { min-width: 0; flex: 1 1 auto; padding: 0 14px; }
  .stage-button.ghost { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .stage-canvas img, .stage-caret { animation: none !important; }
  .stage-ticks li { transition: none; }
}

/* ---------- 观众提问 ---------- */

/* 提问坞与控制坞同高同间距，两条横排看起来是一组 */
.qa-dock { display: flex; align-items: center; gap: 10px; }
.qa-input {
  flex: 1 1 auto; min-width: 0;
  height: 44px; padding: 0 20px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-pill);
  background: var(--bg); color: var(--text);
  font-family: inherit; font-size: 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.qa-input::placeholder { color: var(--text-subtle); }
.qa-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.qa-input:disabled { background: var(--bg-muted); color: var(--text-subtle); cursor: not-allowed; }
.qa-send { flex: 0 0 auto; }

/* 右栏的问答卡：问题一行小字，回答随流式输出增长 */
.qa-card {
  flex: 0 0 auto;
  display: flex; flex-direction: column; gap: 6px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: var(--shadow-card);
}
.qa-card.qa-pending { border-left-color: var(--warn); }
.qa-question {
  color: var(--text-subtle);
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em; line-height: 1.5;
  overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.qa-answer {
  margin: 0;
  color: var(--text); font-size: 0.82rem; line-height: 1.62;
  overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5;
}
.qa-chip {
  align-self: flex-start;
  padding: 2px 9px;
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  border-radius: var(--radius-pill);
  background: var(--warn-soft); color: var(--warn);
  font-size: 0.64rem; letter-spacing: 0.04em;
}

/* ---------- 形象放大（桌面） ---------- */

/* 形象是这块屏的主角：加宽右栏让方形卡片自然长大，16:9 画布相应收窄。
   两者耦合，比例只能量出来——目标是卡片高 ≈ 画布高的 85%。 */
@media (min-width: 1280px) {
  .stage-main { grid-template-columns: minmax(0, 1fr) clamp(320px, 31vw, 640px); }
  /* 卡片同时受栏宽与右栏剩余高度约束（与 .avatar-slot 同一套 cq 写法）：
     多出问答卡时形象自己让位，下面的状态、简介、参数不会被裁掉。 */
  .stage-avatar {
    flex: 1 1 auto; min-height: 0;
    display: grid; place-items: start center;
    container-type: size;
  }
  .stage-avatar-card { width: min(100cqw, 100cqh); height: auto; }
}

/* 矮屏（1366×768 一类）右栏纵向吃紧：简介收成两行；出了问答卡就把它让出去，
   否则形象要缩掉一大截才装得下 */
@media (min-width: 1280px) and (max-height: 860px) {
  .stage-summary { -webkit-line-clamp: 2; }
  .stage-side:has(.qa-card) .stage-summary { display: none; }
}

/* 右栏在窄屏是一条横排，问答卡与简介一样收起，回答仍在提问坞上方可读 */
@media (max-width: 1024px) {
  .qa-card { display: none; }
}
@media (max-width: 720px) {
  .qa-dock { gap: 8px; }
  /* .stage-button.primary 的 132px 在 375 px 上会把输入框挤没 */
  .stage-button.qa-send { min-width: 84px; padding: 0 16px; }
}

/* Phase 3 语音提问：麦克风状态灯与提示条 */
.qa-mic.mic-listening::before,
.qa-mic.mic-capturing::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--brand);
  animation: mic-pulse 1.6s ease-in-out infinite;
  vertical-align: baseline;
}
.qa-mic.mic-capturing::before {
  background: var(--danger);
  animation-duration: 0.8s;
}
/* 手动模式下「在听」的绿灯是假的：不按住就没人在收音，只留收音中的红灯 */
.qa-mic.qa-mic-ptt.mic-listening::before {
  content: none;
}
.qa-mic.mic-denied,
.qa-mic.mic-error {
  opacity: 0.55;
}
.qa-ptt {
  touch-action: none;
  user-select: none;
}
.qa-voice-notice {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--warn);
}
/* 与 .qa-voice-notice 同一排版，但语气是「她在听」不是报错，用品牌蓝。 */
.qa-wake-window {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--brand-strong);
}
.qa-wake-toggle.active {
  border-color: var(--brand);
  color: var(--brand-strong);
}
@keyframes mic-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

/* Phase 4 讲稿库：首页先选讲稿，再进入幻灯片或演示台。 */
.decks-shell {
  height: 100dvh;
  overflow-y: auto;
  background:
    radial-gradient(circle at 82% 8%, var(--brand-soft) 0, transparent 28%),
    var(--bg-muted);
}
.decks-container { width: min(1180px, calc(100% - 48px)); margin-inline: auto; }
.decks-topbar {
  position: sticky; z-index: 20; top: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(18px);
}
.decks-topbar-inner {
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
}
.decks-brand {
  justify-self: start;
  display: inline-flex; align-items: center; gap: 14px;
  min-width: 0;
  color: inherit; text-decoration: none;
}
.decks-brand .brand-lockup { height: 42px; }
.decks-brand-copy { display: grid; line-height: 1.25; }
.decks-brand-copy strong { font-size: 0.88rem; font-weight: 650; letter-spacing: 0.03em; }
.decks-brand-copy small { margin-top: 2px; color: var(--text-subtle); font-size: 0.68rem; letter-spacing: 0.06em; }
.decks-nav {
  display: flex; align-items: center; gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-muted);
}
.decks-nav a, .decks-nav span {
  min-width: 84px;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  color: var(--text-subtle);
  text-align: center; text-decoration: none;
  font-size: 0.78rem; font-weight: 550;
}
.decks-nav .active {
  background: var(--bg); color: var(--text);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}
.decks-nav span[aria-disabled="true"] { opacity: 0.48; }
.decks-actions { justify-self: end; display: flex; align-items: center; gap: 12px; }
.decks-file { display: none; }
.decks-upload { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.decks-upload > span { margin-top: -1px; font-size: 1.1rem; font-weight: 350; }

.decks-hero { border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 88%, transparent); }
.decks-hero-inner {
  min-height: 194px;
  display: flex; align-items: center; justify-content: space-between; gap: 40px;
  padding-block: 38px;
}
.decks-kicker { color: var(--brand-strong); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.2em; }
.decks-hero h1 { margin: 5px 0 4px; font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.15; letter-spacing: -0.045em; }
.decks-hero p { margin: 0; color: var(--text-muted); font-size: 0.94rem; }
.decks-summary {
  flex: 0 0 auto;
  display: grid;
  min-width: 170px;
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--bg);
  box-shadow: var(--shadow-card);
}
.decks-summary strong { color: var(--brand-strong); font-size: 2rem; line-height: 1.1; letter-spacing: -0.05em; }
.decks-summary span { margin-top: 4px; color: var(--text-subtle); font-size: 0.72rem; }

.decks-content { padding-block: 30px 56px; }
.decks-notice {
  margin: 0 0 20px;
  padding: 11px 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.82rem;
}
.decks-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.decks-section-head > div { display: flex; align-items: center; gap: 9px; }
.decks-section-head h2 { margin: 0; font-size: 1.05rem; font-weight: 650; letter-spacing: -0.01em; }
.decks-section-head span {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--brand-soft); color: var(--brand-strong);
  font-size: 0.66rem; font-weight: 600;
}
.decks-section-head p { margin: 0; color: var(--text-subtle); font-size: 0.72rem; }
.decks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 20px; }
.deck-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--bg);
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.deck-card:hover { border-color: color-mix(in srgb, var(--brand) 34%, var(--border)); box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }
.deck-cover-link { position: relative; display: block; overflow: hidden; color: inherit; text-decoration: none; }
.deck-cover-link.disabled { pointer-events: none; }
.deck-cover {
  margin: 0;
  aspect-ratio: 16 / 9;
  display: grid; place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--brand-soft) 70%, var(--bg-muted)), var(--bg-muted));
}
.deck-cover::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 52%, rgba(5, 18, 31, 0.24));
  opacity: 0;
  transition: opacity 0.2s ease;
}
.deck-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.35s ease; }
.deck-cover-empty { color: var(--text-subtle); font-size: 0.8rem; padding: 0 16px; text-align: center; }
.deck-page-badge {
  position: absolute; z-index: 2; left: 12px; top: 12px;
  padding: 4px 9px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: var(--radius-pill);
  background: rgba(9, 25, 42, 0.7); color: #fff;
  backdrop-filter: blur(8px);
  font-size: 0.66rem; font-weight: 600;
}
.deck-open-cue {
  position: absolute; z-index: 2; right: 14px; bottom: 12px;
  display: flex; align-items: center; gap: 6px;
  color: #fff;
  font-size: 0.72rem; font-weight: 600;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.deck-open-cue b { font-size: 0.9rem; font-weight: 400; }
.deck-cover-link:hover .deck-cover::after, .deck-cover-link:focus-visible .deck-cover::after { opacity: 1; }
.deck-cover-link:hover .deck-cover img, .deck-cover-link:focus-visible .deck-cover img { transform: scale(1.018); }
.deck-cover-link:hover .deck-open-cue, .deck-cover-link:focus-visible .deck-open-cue { opacity: 1; transform: translateY(0); }
.deck-card-body { padding: 16px; }
.deck-meta-row { min-width: 0; }
.deck-meta-row h3 { margin: 0; font-size: 1rem; font-weight: 650; line-height: 1.45; letter-spacing: -0.01em; }
.deck-status { display: flex; align-items: center; gap: 7px; margin: 5px 0 0; color: var(--text-subtle); font-size: 0.72rem; }
.deck-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.deck-failed .deck-status, .deck-interrupted .deck-status { color: var(--danger); }
.deck-failed .deck-status i, .deck-interrupted .deck-status i { background: var(--danger); }
.deck-generating .deck-status, .deck-converting .deck-status { color: var(--warn); }
.deck-generating .deck-status i, .deck-converting .deck-status i { background: var(--warn); animation: soft-pulse 1.2s ease-in-out infinite; }
.deck-actions { display: flex; align-items: center; gap: 8px; margin-top: 15px; }
.deck-actions .stage-button {
  min-width: 0; height: 38px; padding: 0 15px;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none;
  font-size: 0.78rem;
}
.deck-actions .stage-button.primary { min-width: 110px; }
.deck-actions .stage-button.disabled, .stage-button.disabled { opacity: 0.45; pointer-events: none; }
.deck-delete {
  margin-left: auto; padding: 7px 4px;
  border: 0; background: transparent; color: var(--text-subtle);
  font: inherit; font-size: 0.72rem; cursor: pointer;
}
.deck-delete:hover { color: var(--danger); }
.decks-empty {
  grid-column: 1 / -1;
  display: grid; place-items: center;
  min-height: 310px; padding: 46px 24px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-card);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  text-align: center;
}
.decks-empty > span { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-strong); font-size: 1.4rem; }
.decks-empty h2 { margin: 12px 0 0; font-size: 1rem; }
.decks-empty p { margin: 4px 0 16px; color: var(--text-subtle); font-size: 0.8rem; }
.decks-empty .stage-button { display: inline-flex; align-items: center; justify-content: center; width: auto; }

@media (max-width: 720px) {
  .decks-container { width: min(100% - 28px, 1180px); }
  .decks-topbar-inner { min-height: 64px; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
  .decks-brand .brand-lockup { height: 36px; }
  .decks-brand-copy { display: none; }
  .decks-nav { display: none; }
  .decks-upload { min-width: 0; height: 38px; padding: 0 14px; font-size: 0.78rem; }
  .decks-hero-inner { min-height: 164px; padding-block: 28px; }
  .decks-hero h1 { font-size: 2rem; }
  .decks-hero p { max-width: 260px; font-size: 0.82rem; }
  .decks-summary { display: none; }
  .decks-content { padding-block: 24px 40px; }
  .decks-section-head p { display: none; }
  .decks-grid { grid-template-columns: 1fr; }
  .deck-open-cue { opacity: 1; transform: none; }
}

/* Phase 4 讲稿编辑页 */
/* Workspace system · Coolwei tokens on rounded app surfaces. */
[data-theme="dark"] {
  --bg: #0a0e18; --bg-muted: #121828; --text: #f6f9ff;
  --text-muted: #9aa6bd; --text-subtle: #94a1ba; --border: #1d2537; --border-strong: #303c53;
  --brand: #5c7dff; --brand-strong: #8ea6ff; --brand-soft: #101a3c; --brand-ring: rgba(92,125,255,.4);
  --ok: #6bd49a; --warn: #e9ad60; --danger: #ff8585; color-scheme: dark;
  --ground: #0a0e18; --panel: #121828;
  --shadow-card: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  --shadow-primary: 0 4px 14px rgba(92,125,255,.28);
}
input, textarea, select { font: inherit; color: var(--text); }
a, button, input, textarea { -webkit-tap-highlight-color: transparent; }
button:not(:disabled), summary { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
.stage-button { border-radius: var(--radius-control); text-decoration: none; white-space: nowrap; }
.stage-button.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: var(--shadow-primary); }
.stage-button.primary:hover:not(:disabled) { background: var(--brand-strong); }
.workspace-header { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--border); }
.workspace-header-inner { min-height: 80px; padding: 12px 32px; display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: center; gap: 24px; }
.workspace-brand { display: flex; align-items: center; gap: 18px; color: var(--text); text-decoration: none; width: fit-content; }
.workspace-logo { width: 134px; height: 42px; object-fit: contain; }
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }
.workspace-brand > span { border-left: 1px solid var(--border-strong); padding-left: 18px; display: grid; line-height: 1.4; white-space: nowrap; }
.workspace-brand strong { font-size: 16px; letter-spacing: .08em; }
.workspace-brand small { color: var(--text-subtle); font-size: 10px; letter-spacing: .08em; }
.workspace-nav { display: flex; padding: 4px; gap: 3px; background: var(--bg-muted); border: 1px solid var(--border); border-radius: 14px; }
.workspace-nav a { padding: 8px 18px; border-radius: 10px; font-size: 13px; color: var(--text-muted); text-decoration: none; white-space: nowrap; }
.workspace-nav a:hover { color: var(--brand); }
.workspace-nav .active { background: var(--bg); color: var(--brand-strong); box-shadow: 0 1px 3px #06102d12; font-weight: 600; }
[data-theme="dark"] .workspace-nav .active { background: var(--border); box-shadow: none; }
.workspace-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.workspace-actions .stage-button { min-width: 0; height: 38px; padding: 0 16px; font-size: 12px; }
.theme-button { display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--bg); color: var(--text-muted); font-size: 21px; }
.theme-button:hover { border-color: var(--brand); color: var(--brand); }
.workspace-context { padding: 11px 32px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.workspace-context h1 { font-size: 16px; }
.workspace-context .stage-deck span, .context-meta { font-size: 12px; color: var(--text-subtle); }
.context-meta { display: flex; gap: 20px; flex-shrink: 0; }
.header-service { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.save-state { font-size: 11px; color: var(--text-subtle); white-space: nowrap; }
.decks-shell { background: var(--ground); }
.decks-container { width: min(1280px, calc(100% - 80px)); }
.decks-hero { background: var(--bg); }
.decks-hero-inner { min-height: 218px; padding-block: 44px; }
.decks-hero h1 { margin: 12px 0; font-weight: 600; font-size: clamp(32px,4vw,46px); }
.decks-hero p { font-size: 14px; }
.decks-summary { background: var(--panel); min-width: 176px; }
.decks-summary strong { font-size: 44px; font-weight: 500; font-variant-numeric: tabular-nums; }
.decks-content { padding-block: 30px 48px; }
.decks-grid { gap: 30px; grid-template-columns: repeat(auto-fill,minmax(min(100%,340px),1fr)); }
.deck-card { background: var(--panel); }
.deck-card-body { padding: 16px 18px 18px; }
.deck-meta-row h3 { font-size: 17px; font-weight: 600; }
.deck-actions { padding-top: 16px; border-top: 1px solid var(--border); }
.deck-page-badge { left: auto; right: 12px; }
.library-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.filter-tabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-tabs button { border: 0; background: transparent; padding: 8px 12px; color: var(--text-subtle); font-size: 13px; border-radius: 10px; white-space: nowrap; }
.filter-tabs button.active { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }
.library-search { width: 260px; min-width: 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--bg); font-size: 13px; }
.knowledge-entry { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 32px; padding: 22px 24px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--panel); box-shadow: var(--shadow-card); color: var(--brand-strong); font-size: 13px; text-decoration: none; }
.knowledge-entry strong { display: block; color: var(--text); font-size: 16px; font-weight: 500; }
.knowledge-entry small { display: block; color: var(--text-muted); margin-top: 4px; font-size: 12px; }
.empty-state { display: block; grid-column: 1 / -1; text-align: center; padding: 50px 20px; color: var(--text-muted); font-size: 14px; }
.empty-state h2 { color: var(--text); font-size: 20px; font-weight: 500; }
.empty-state p { margin: 8px 0 20px; }
.decks-notice-ok, .inline-notice { padding: 12px 16px; background: var(--brand-soft); color: var(--brand-strong); border: 1px solid var(--border); border-radius: var(--radius-control); font-size: 13px; }
/* A single focused slide, with independent navigation and notes. */
.slide-workspace { display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
.slide-workspace > .decks-notice { margin: 10px 24px 0; flex-shrink: 0; }
.slide-workspace-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 28px; }
.slide-workspace-heading > div { display: flex; align-items: center; gap: 14px; min-width: 0; }
.slide-workspace-heading a { color: var(--text-subtle); text-decoration: none; font-size: 13px; flex-shrink: 0; }
.breadcrumb-slash { color: var(--border-strong); }
.slide-workspace-heading h1 { font-size: 17px; font-weight: 600; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slide-workspace-heading > span { color: var(--text-subtle); font-size: 12px; white-space: nowrap; }
.slide-layout { min-height: 0; flex: 1; display: grid; grid-template-columns: 180px minmax(0,1fr) 310px; border-top: 1px solid var(--border); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; font-size: 12px; color: var(--text-subtle); }
.panel-heading strong { font-weight: 500; color: var(--text); }
.slide-sidebar { min-width: 0; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); }
.slide-thumbnails { overflow: auto; padding: 0 12px 16px; scrollbar-width: thin; }
.slide-thumb { display: flex; width: 100%; align-items: flex-start; gap: 8px; margin-bottom: 10px; border: 1px solid transparent; background: transparent; border-radius: 10px; padding: 7px; color: var(--text-subtle); font-size: 10px; }
.slide-thumb img { width: calc(100% - 22px); border-radius: 4px; border: 1px solid var(--border); aspect-ratio: 16/9; object-fit: contain; background: #fff; }
.slide-thumb.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); }
.slide-preview-panel { background: var(--ground); overflow: auto; min-width: 0; padding: 0 22px 24px; }
.slide-preview-panel > .panel-heading { padding-inline: 0; }
.slide-preview-canvas { min-height: 200px; display: flex; align-items: center; justify-content: center; aspect-ratio: 16/10; }
.slide-preview-canvas img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 6px 28px #06102d14; }
.slide-pagination { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 18px; }
.slide-pagination .stage-button { min-width: 36px; width: 36px; height: 34px; padding: 0; background: var(--bg); }
.slide-pagination label { font-size: 12px; color: var(--text-muted); }
.slide-pagination select { border: 1px solid var(--border); background: var(--bg); border-radius: 8px; padding: 3px 5px; }
.keyboard-hint { text-align: center; font-size: 11px; color: var(--text-subtle); margin: 12px 0 24px; }
.slide-settings { border-top: 1px solid var(--border); padding-top: 14px; font-size: 12px; }
.slide-settings summary { color: var(--text-muted); }
.slide-settings summary span { color: var(--text-subtle); margin-left: 12px; font-size: 11px; }
.slide-settings label, .knowledge-dialog label { display: grid; gap: 8px; font-size: 12px; color: var(--text-muted); margin-top: 16px; }
.slide-settings input, .slide-settings textarea, .knowledge-dialog input, .knowledge-dialog textarea { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-control); padding: 10px 12px; font-size: 13px; background: var(--bg); resize: vertical; line-height: 1.7; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.slide-notes { min-height: 0; display: flex; flex-direction: column; border-left: 1px solid var(--border); }
.notes-tabs { padding: 0 16px 16px; border-bottom: 1px solid var(--border); }
.notes-editor { display: flex; flex-direction: column; flex: 1; min-height: 180px; padding: 18px; }
.notes-editor > label { font-size: 11px; color: var(--text-subtle); line-height: 1.7; margin-bottom: 14px; }
.notes-editor textarea { width: 100%; flex: 1; min-height: 120px; resize: none; border: 0; padding: 0; background: var(--bg); font-size: 14px; line-height: 1.95; }
.notes-count { padding-top: 12px; font-size: 11px; color: var(--text-subtle); }
.notes-knowledge { display: grid; gap: 4px; border-top: 1px solid var(--border); padding: 18px; text-decoration: none; color: var(--text-muted); font-size: 12px; }
.notes-knowledge span { color: var(--brand-strong); }
.text-button { border: 0; background: transparent; color: var(--brand-strong); font-size: 12px; padding: 4px 0; white-space: nowrap; }
.slide-lightbox { width: min(96vw,1700px); max-width: 96vw; max-height: 96dvh; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--bg); color: var(--text); }
dialog::backdrop { background: #04060cb3; backdrop-filter: blur(6px); }
.slide-lightbox img { display: block; width: 100%; max-height: calc(96dvh - 100px); object-fit: contain; }
.lightbox-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; font-size: 13px; gap: 12px; }
.lightbox-toolbar > div { display: flex; gap: 8px; }
.lightbox-toolbar .stage-button { min-width: 0; height: 34px; font-size: 12px; padding: 0 12px; }
/* Knowledge: actual local documents, their inclusion state and indexing state. */
.knowledge-intro { display: flex; align-items: center; gap: 20px; padding: 22px 24px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); margin-bottom: 30px; }
.knowledge-intro-mark { width: 44px; height: 48px; border: 1px solid var(--border-strong); border-radius: 5px 12px 5px 5px; display: grid; place-items: center; color: var(--brand); font-size: 20px; flex-shrink: 0; }
.knowledge-intro strong { font-size: 15px; font-weight: 500; }
.knowledge-intro p { margin: 5px 0 0; color: var(--text-muted); font-size: 12px; }
.knowledge-intro .stage-button { margin-left: auto; flex-shrink: 0; font-size: 12px; min-width: 0; height: 38px; }
.knowledge-list-heading { display: flex; justify-content: space-between; padding: 4px 22px 10px; font-size: 11px; color: var(--text-subtle); }
.knowledge-list { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--panel); box-shadow: var(--shadow-card); }
.knowledge-row { display: flex; align-items: center; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--border); transition: background 0.15s ease; }
.knowledge-row:last-child { border-bottom: 0; }
.knowledge-row:hover { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
.document-icon { display: grid; place-items: center; height: 44px; width: 38px; flex-shrink: 0; background: var(--bg-muted); border: 1px solid var(--border); border-radius: 5px 10px 5px 5px; color: var(--text-subtle); font-size: 11px; }
.knowledge-document { flex: 1; min-width: 0; text-align: left; padding: 0; background: transparent; border: 0; }
.knowledge-document strong { display: block; font-size: 15px; font-weight: 550; overflow-wrap: anywhere; }
.knowledge-document span { display: block; font-size: 11px; color: var(--text-subtle); margin-top: 4px; }
.knowledge-document p { color: var(--text-muted); font-size: 12px; margin: 6px 0 0; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.knowledge-row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; flex-shrink: 0; }
.knowledge-status { font-size: 11px; color: var(--text-subtle); }
.knowledge-status.ready { color: var(--ok); }
.knowledge-status::before { content: ''; display: inline-block; vertical-align: middle; width: 5px; height: 5px; background: currentColor; border-radius: 50%; margin-right: 6px; }
.toggle-switch { width: 32px; height: 19px; border: 0; padding: 3px; background: var(--border-strong); border-radius: 20px; }
.toggle-switch span { width: 13px; height: 13px; display: block; background: #fff; border-radius: 50%; }
.toggle-switch[aria-checked="true"] { background: var(--brand); }
.toggle-switch[aria-checked="true"] span { transform: translateX(13px); }
.danger-text { color: var(--danger); }
.is-disabled .knowledge-document { opacity: .65; }
.library-footnote { font-size: 11px; color: var(--text-subtle); margin-top: 24px; }
.knowledge-dialog { width: min(680px, calc(100vw - 28px)); max-height: 90dvh; padding: 28px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-card); }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; }
.dialog-heading h2 { font-size: 22px; font-weight: 550; margin: 4px 0 0; }
.dialog-meta { display: flex; justify-content: space-between; gap: 12px; margin: 10px 0 20px; color: var(--text-subtle); font-size: 11px; overflow-wrap: anywhere; }
.dialog-footer { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--border); padding-top: 20px; }
.dialog-footer > span { flex: 1; font-size: 11px; color: var(--text-subtle); }
.dialog-footer .stage-button { font-size: 12px; min-width: 0; height: 36px; }
@media (min-width: 1600px) { .slide-layout { grid-template-columns: 210px minmax(0,1fr) 360px; } .slide-preview-panel { padding-inline: 40px; } }
@media (max-width: 1100px) {
  .workspace-header-inner { gap: 16px; padding-inline: 22px; }
  .workspace-brand > span { display: none; }
  .workspace-nav a { padding-inline: 14px; }
  .save-state { display: none; }
  .slide-layout { grid-template-columns: 142px minmax(0,1fr) 270px; }
  .slide-preview-panel { padding-inline: 16px; }
}
@media (max-width: 800px) {
  .workspace-header-inner { grid-template-columns: minmax(0,1fr) auto; gap: 12px; padding: 12px 16px; }
  .workspace-nav { grid-row: 2; grid-column: 1 / -1; justify-self: center; }
  .workspace-actions { grid-row: 1; grid-column: 2; }
  .workspace-logo { width: 120px; height: 34px; }
  .workspace-actions .stage-button { height: 34px; padding: 0 10px; font-size: 11px; }
  .workspace-context { padding: 10px 16px; }
  .workspace-context .stage-deck h1 { font-size: 14px; }
  .context-meta { display: none; }
  .decks-container { width: calc(100% - 32px); }
  .decks-hero-inner { min-height: 180px; padding-block: 30px; }
  .decks-hero p { max-width: none; font-size: 13px; }
  .decks-summary { display: none; }
  .library-toolbar { flex-wrap: wrap; gap: 14px; }
  .library-search { width: 100%; }
  .decks-grid { grid-template-columns: repeat(auto-fill,minmax(min(100%,280px),1fr)); }
  .knowledge-entry { align-items: flex-start; }
  .knowledge-entry > span:last-child { white-space: nowrap; }
  .slide-workspace { overflow: auto; }
  .slide-workspace-heading { padding: 16px; }
  .slide-workspace-heading > span { display: none; }
  .slide-layout { flex: none; grid-template-columns: minmax(0,1fr); }
  .slide-sidebar { border: 0; border-bottom: 1px solid var(--border); }
  .slide-sidebar > .panel-heading { display: none; }
  .slide-thumbnails { display: flex; padding: 10px; gap: 4px; }
  .slide-thumb { width: 112px; flex-shrink: 0; margin: 0; }
  .slide-preview-canvas { min-height: 0; aspect-ratio: 16/9; }
  .slide-preview-panel { overflow: visible; padding-bottom: 18px; }
  .slide-notes { border-left: 0; border-top: 1px solid var(--border); min-height: 420px; }
  .notes-editor textarea { min-height: 200px; }
  .slide-settings { margin-top: 16px; }
  .keyboard-hint { display: none; }
  .knowledge-intro { display: grid; grid-template-columns: 44px minmax(0,1fr); padding: 18px; gap: 14px; }
  .knowledge-intro > div:nth-child(2) { flex: 1; }
  .knowledge-intro .stage-button { grid-column: 2; margin: 0; width: fit-content; padding-inline: 12px; }
  .knowledge-row { flex-wrap: wrap; gap: 12px; }
  .knowledge-document { flex-basis: calc(100% - 60px); }
  .knowledge-row-actions { width: 100%; justify-content: flex-start; gap: 18px; padding-left: 50px; flex-wrap: wrap; }
  .knowledge-dialog { padding: 20px; }
  .dialog-footer { flex-wrap: wrap; justify-content: flex-end; }
  .dialog-footer > span { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* Presenter · rounded panels on a quiet ground, visible conversation. */
.stage-open-form { background: var(--bg); }
/* 三列：幻灯片 | 拖拽把手 | 言林。右栏宽度由 --side-width 覆盖（拖动后写入），默认按视口给足。 */
.stage-open-form .stage-main {
  background: var(--ground);
  grid-template-columns: minmax(360px,1fr) 18px var(--side-width, clamp(340px, 34vw, 640px));
  gap: 0; padding: 16px 24px 20px;
}
.stage-open-form .stage-screen { gap: 10px; }
.stage-resizer { position: relative; display: grid; place-items: center; cursor: col-resize; touch-action: none; outline: none; }
.stage-resizer::before { content: ''; width: 4px; height: 44px; border-radius: 2px; background: var(--border-strong); transition: background 0.15s ease, height 0.15s ease; }
.stage-resizer:hover::before, .stage-resizer:focus-visible::before, .stage-main.is-resizing .stage-resizer::before { background: var(--brand); height: 72px; }
.stage-main.is-resizing { cursor: col-resize; user-select: none; }
.stage-main.is-resizing .stage-canvas img { animation: none; }
.stage-open-form .workspace-context { background: var(--bg); }
.stage-open-form .stage-canvas { border-radius: var(--radius-media); box-shadow: var(--shadow-card); background: var(--panel); }
.stage-open-form .stage-side { padding: 18px; gap: 12px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--panel); box-shadow: var(--shadow-card); }
/* 形象吃掉右栏全部剩余高度：container-type: size 让方形卡片同时受栏宽与剩余高度约束。 */
.stage-open-form .stage-avatar { flex: 1 1 0; min-height: 160px; display: grid; place-items: center; container-type: size; }
.stage-open-form .stage-avatar-card { width: min(100cqw, 100cqh); height: auto; aspect-ratio: 1; border-radius: var(--radius-media); box-shadow: none; }
.stage-open-form .portrait-scan { display: none; }
.stage-open-form .stage-presenter { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 10px; }
.stage-open-form .stage-presenter .latency { font-size: 10px; opacity: .75; }
.stage-open-form .stage-subtitle { min-height: 44px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 8px 14px; }
.stage-open-form .stage-subtitle-line { font-size: 0.95rem; }
.stage-open-form .stage-subtitle-tag { padding: 3px 10px; border-radius: var(--radius-pill); background: var(--brand-soft); }
/* 控制坞与提问坞并成一行；放不下时提问坞整体换到第二行。 */
.stage-open-form .stage-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stage-open-form .stage-dock { flex: 0 0 auto; gap: 8px; }
.stage-open-form .stage-dock .stage-button { min-width: 0; padding: 0 16px; }
.stage-open-form .stage-dock .stage-button.primary { min-width: 104px; }
.stage-open-form .stage-dock .stage-button.ghost { margin-left: 0; }
.stage-open-form .qa-dock { flex: 1 1 380px; min-width: 0; gap: 8px; padding: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.stage-open-form .qa-dock .stage-button { height: 40px; min-width: 0; padding: 0 14px; }
.stage-open-form .qa-dock .context-meta { font-size: 11px; white-space: nowrap; }
.stage-open-form .qa-input { flex: 1 1 140px; min-width: 0; height: 40px; padding: 0 12px; background: transparent; border: 0; border-radius: var(--radius-control); box-shadow: none; }
.stage-open-form .qa-voice-notice, .stage-open-form .qa-wake-window { margin: 0; font-size: 12px; }
.stage-open-form .qa-input:focus { outline: 2px solid var(--brand-ring); outline-offset: -2px; }
.stage-open-form .stage-dock .stage-button { height: 42px; }
.stage-open-form .qa-send { min-width: 76px; }
.stage-open-form .stage-badge { margin-top: 0; font-size: 10px; background: transparent; border: 0; padding: 0; color: var(--text-subtle); }
/* 问答区是固定份额，可收起；剩余高度归形象。 */
.presentation-conversation { position: relative; display: flex; flex-direction: column; flex: 0 1 200px; min-height: 120px; overflow: hidden; border-top: 1px solid var(--border); }
.presentation-conversation.is-collapsed { flex: 0 0 auto; min-height: 0; }
.conversation-heading { display: flex; align-items: center; gap: 10px; padding: 12px 0 10px; }
.conversation-heading > span { margin-left: auto; }
.section-toggle { flex: 0 0 auto; margin-left: 8px; padding: 3px 10px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--bg); color: var(--text-muted); font: inherit; font-size: 11px; line-height: 1.4; cursor: pointer; }
.section-toggle:hover { border-color: var(--brand); color: var(--brand-strong); }
.conversation-heading h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.025em; }
.conversation-heading > span { color: var(--text-subtle); font-size: 11px; }
.conversation-log { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 6px 22px 0; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.conversation-empty { padding: 22px 4px; color: var(--text-muted); font-size: 13px; line-height: 1.85; }
.conversation-empty > span { color: var(--text); font-size: 17px; }
.conversation-empty p { margin: 14px 0; }
.conversation-empty small { color: var(--text-subtle); font-size: 11px; }
.conversation-turn + .conversation-turn { margin-top: 26px; }
.conversation-user { display: flex; justify-content: flex-end; padding-left: 24px; }
.conversation-user p { margin: 0; padding: 12px 16px; border-radius: 16px 16px 4px 16px; background: var(--conversation-user); color: var(--text); font-size: 13px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.conversation-assistant { padding: 16px 3px 0; }
.conversation-speaker { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 11px; }
.conversation-speaker i { width: 9px; height: 9px; border: 2px solid var(--brand); border-radius: 50%; }
.conversation-assistant p { margin: 9px 0 0; color: var(--text); font-size: 14px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.conversation-assistant small { display: block; margin-top: 8px; color: var(--text-subtle); font-size: 11px; }
.conversation-assistant .conversation-error { color: var(--danger); }
.conversation-latest { position: absolute; bottom: 10px; align-self: center; border: 1px solid var(--border-strong); border-radius: 20px; padding: 7px 14px; background: var(--bg); color: var(--text); font-size: 12px; box-shadow: 0 2px 8px #0000000d; }
@media (max-width: 1024px) {
  .stage-open-form { height: auto; min-height: 100dvh; overflow: visible; }
  .stage-open-form .stage-main { display: flex; flex-direction: column; overflow: visible; padding: 18px; }
  .stage-open-form .stage-screen { min-height: 580px; }
  .stage-open-form .stage-canvas-slot { min-height: 300px; }
  .stage-resizer { display: none; }
  .stage-open-form .stage-side { display: grid; grid-template-columns: 84px minmax(0,1fr); padding: 16px; overflow: visible; }
  .stage-open-form .stage-avatar { flex: none; min-height: 0; container-type: normal; }
  .stage-open-form .stage-avatar-card { width: 84px; }
  .stage-open-form .stage-presenter { align-items: flex-start; justify-content: center; }
  .stage-open-form .presentation-conversation { grid-column: 1 / -1; height: 420px; }
  .stage-open-form .stage-badge { grid-column: 1 / -1; margin: 0; }
}
@media (max-width: 600px) {
  .stage-open-form .stage-main { padding: 12px; }
  .stage-open-form .stage-screen { min-height: 440px; }
  .stage-open-form .stage-canvas-slot { min-height: 210px; }
  .stage-open-form .qa-dock { flex-wrap: wrap; gap: 6px; }
  .stage-open-form .qa-input { min-width: 100px; width: 0; flex: 1 1 100px; }
}
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.workspace-open-form { background: var(--ground); }
.workspace-open-form .decks-hero { background:var(--bg); }
.workspace-open-form .decks-hero-inner { min-height:175px; padding-block:26px; }
.workspace-library-layout { display:grid; grid-template-columns:minmax(0,1fr) 460px; gap:32px; max-width:1680px; padding:0 32px; margin:auto; align-items:start; }
.workspace-library-layout > .decks-content { min-width:0; width:100%; padding-inline:0; }
.workspace-library-layout .decks-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:30px; }
.workspace-library-layout .library-toolbar { flex-wrap:wrap; }
.workspace-library-layout .library-search { width:100%; }
.workspace-assistant { position:sticky; top:100px; display:flex; flex-direction:column; height:min(960px,calc(100dvh - 125px)); min-height:520px; margin-top:36px; padding:20px; border:1px solid var(--border); border-radius:var(--radius-card); background:var(--panel); box-shadow:var(--shadow-card); }
/* 形象是面板的主角：宽度撑满面板，高度不够时缩成以剩余高度为边的正方形（container 单位取剩余空间）。 */
.workspace-avatar { flex:0 1 auto; width:100%; aspect-ratio:1; min-height:180px; display:grid; place-items:center; container-type:size; }
.workspace-avatar-card { width:min(100cqw,100cqh); height:auto; aspect-ratio:1; border-radius:var(--radius-media); box-shadow:none; }
.workspace-avatar-meta { flex:0 0 auto; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 0 8px; }
.workspace-avatar-meta h2 { margin:0; font-size:18px; letter-spacing:-.025em; }
.workspace-avatar-meta p { margin:2px 0 0; font-size:12px; color:var(--text-muted); }
.workspace-avatar-meta .status-pill { flex:0 0 auto; }
.workspace-assistant .presentation-conversation { flex:1 1 180px; }
.workspace-deck-select { font-size:11px; color:var(--text-subtle); display:grid; gap:6px; margin-bottom:12px; }
.workspace-deck-select select { width:100%; min-width:0; border:1px solid var(--border); background:var(--bg); border-radius:var(--radius-control); padding:10px; font-size:12px; }
.workspace-suggestions { display:flex; flex-wrap:wrap; gap:8px; padding:8px 0 12px; }
.workspace-suggestions button { text-align:left; background:transparent; color:var(--text-muted); border:1px solid var(--border); padding:9px 12px; border-radius:10px; font-size:12px; }
.workspace-suggestions button:hover { border-color:var(--brand); color:var(--brand); }
.workspace-chat-composer { display:flex; align-items:flex-end; gap:8px; padding:10px; border:1px solid var(--border-strong); background:var(--bg-muted); border-radius:14px; }
.workspace-chat-composer textarea { width:100%; min-width:0; resize:vertical; max-height:140px; border:0; background:transparent; padding:4px; font-size:13px; line-height:1.6; }
.workspace-chat-composer button { border:0; border-radius:10px; min-width:36px; height:36px; background:var(--brand); color:var(--bg); }
.workspace-assistant-note { font-size:10px; color:var(--text-subtle); padding:8px 0 0; text-align:center; }
@media(max-width:1150px) { .workspace-library-layout { grid-template-columns:minmax(0,1fr) 380px; padding-inline:20px; gap:22px; } .workspace-library-layout .decks-grid { grid-template-columns:1fr; } }
@media(max-width:760px) { .workspace-library-layout { display:flex; flex-direction:column; } .workspace-assistant { position:static; width:100%; height:auto; margin:0 0 24px; } .workspace-avatar { max-height:300px; } .workspace-assistant .presentation-conversation { flex:0 1 260px; } }

/* The attached live video is also the source of the Q&A snapshots. */
.stage-open-form .stage-side { overflow-y: auto; scrollbar-width: thin; }
.camera-preview { flex: 0 0 auto; min-width: 0; border-top: 1px solid var(--border); padding-top: 12px; }
.camera-preview-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.camera-preview-heading h2 { margin: 0; font-size: 13px; font-weight: 600; }
.camera-preview-heading > span { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--text-subtle); }
.camera-preview-heading i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.camera-preview-heading .camera-live { color: var(--brand); }
.camera-preview-feed { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 180px; overflow: hidden; border-radius: 8px; background: #101722; }
.camera-preview-feed video { display: block; width: 100%; height: 100%; object-fit: contain; }
.camera-preview-placeholder { position: absolute; inset: 0; display: grid; place-items: center; padding: 14px; background: #101722db; color: #ced8e6; font-size: 12px; line-height: 1.65; text-align: center; }
.camera-preview-device { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 6px 0; font-size: 10px; color: var(--text-subtle); }
.camera-preview-receipt { margin: 8px 0; font-size: 11px; color: var(--text-muted); }
.camera-preview-shots { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
.camera-preview-shots figure { margin: 0; min-width: 0; }
.camera-preview-shots img, .camera-preview-shots figure > div { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; border-radius: 4px; background: var(--bg-muted); }
.camera-preview-shots figure > div { display: grid; place-items: center; color: var(--text-subtle); font-size: 10px; }
.camera-preview-shots figcaption { margin-top: 4px; color: var(--text-subtle); font-size: 10px; text-align: center; }
.camera-preview > small { display: block; margin-top: 8px; color: var(--text-subtle); font-size: 10px; line-height: 1.6; }
@media (max-width: 1024px) {
  .stage-open-form .camera-preview { grid-column: 1 / -1; }
  .camera-preview-feed { max-height: 240px; }
}

/* 现场画面浮窗：默认收起，摄像头出画或点「现场画面」时浮在舞台右下角。
   隐藏用 visibility 而不是卸载，提问快照仍从同一个 video 取帧。 */
.camera-float {
  position: fixed; right: 24px; bottom: 24px; z-index: 40;
  width: min(320px, calc(100vw - 32px));
  padding: 14px 16px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-card);
  background: var(--panel); box-shadow: var(--shadow-card-hover);
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
}
.camera-float.is-open { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.camera-float .camera-preview { border-top: 0; padding-top: 0; }
.camera-preview-heading { justify-content: flex-start; gap: 8px; }
.camera-preview-heading > span { margin-left: auto; }
.camera-float-toggle[aria-pressed="true"] { border-color: var(--brand); color: var(--brand-strong); }
.camera-float-toggle.is-live::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--brand); vertical-align: 1px; }
@media (max-width: 1024px) { .camera-float { right: 12px; bottom: 12px; } }

/* Presenter mode keeps the existing live media nodes mounted. */
.stage-open-form.presenter-mode { position: fixed; inset: 0; z-index: 50; display: block; height: 100dvh; min-height: 0; overflow: hidden; background: #080b12; color: #f5f7ff; }
.presenter-mode > .workspace-header { display: none; }
.stage-open-form.presenter-mode .stage-main { display: block; width: 100%; height: 100%; padding: 0; overflow: hidden; background: #080b12; }
.stage-open-form.presenter-mode .stage-screen { position: relative; height: 100%; min-height: 0; }
.stage-open-form.presenter-mode .stage-canvas-slot { position: absolute; inset: 0; min-height: 0; }
.stage-open-form.presenter-mode .stage-canvas { width: 100%; height: 100%; aspect-ratio: auto; border: 0; border-radius: 0; box-shadow: none; background: #080b12; }
.presenter-mode .stage-canvas img { animation: none; }
.presenter-mode .stage-resizer, .presenter-mode .stage-rail, .presenter-mode .stage-side .presentation-conversation, .presenter-mode .latency, .presenter-mode .camera-float-toggle { display: none; }
.stage-open-form.presenter-mode .stage-side { position: absolute; top: 24px; right: 24px; width: clamp(104px, 12vw, 184px); display: flex; padding: 6px; gap: 6px; overflow: hidden; border: 1px solid #ffffff26; border-radius: 16px; background: #121722cf; box-shadow: 0 8px 36px #0005; backdrop-filter: blur(16px); z-index: 4; }
.presenter-mode[data-avatar-corner="left"] .stage-side { right: auto; left: 24px; }
.stage-open-form.presenter-mode .stage-avatar { display: block; flex: none; min-height: 0; container-type: normal; }
.stage-open-form.presenter-mode .stage-avatar-card { width: 100%; border-radius: 10px; }
.stage-open-form.presenter-mode .stage-presenter { justify-content: center; }
.presenter-mode .stage-presenter .status-pill { padding: 3px 6px; font-size: 10px; color: #e1e9ff; background: transparent; border: 0; }
.stage-open-form.presenter-mode .stage-badge { align-self: center; font-size: 9px; color: #acb5c8; padding-bottom: 3px; }
.stage-open-form.presenter-mode .stage-subtitle { position: absolute; z-index: 3; bottom: 28px; left: 50%; transform: translateX(-50%); width: min(84%, 1100px); min-height: 0; padding: 14px 24px; border-radius: 14px; border: 1px solid #ffffff18; background: #0b101cba; backdrop-filter: blur(16px); box-shadow: 0 4px 24px #0003; pointer-events: none; transition: bottom .18s ease; }
.presenter-mode .stage-subtitle-tag, .presenter-mode .stage-caret { display: none; }
.stage-open-form.presenter-mode .stage-subtitle-line { color: #fff; font-size: clamp(16px, 1.6vw, 26px); line-height: 1.65; white-space: normal; max-height: 3.3em; overflow-y: auto; text-align: center; scrollbar-width: none; mask-image: none; }
.presenter-mode .stage-subtitle-idle { color: #d9dfeb; font-size: inherit; }
.stage-open-form.presenter-mode .stage-controls { position: absolute; z-index: 6; bottom: 22px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 8px; border: 1px solid #ffffff20; border-radius: 14px; background: #141a27e8; backdrop-filter: blur(18px); justify-content: center; }
.presenter-mode .stage-controls, .presenter-mode .presenter-toolbar { opacity: 0; pointer-events: none; transition: opacity .18s ease; }
.presenter-controls-visible .stage-controls, .presenter-controls-visible .presenter-toolbar,
.presenter-mode .stage-controls:has(:focus-visible), .presenter-mode .presenter-toolbar:has(:focus-visible),
.presenter-qa-open .stage-controls { opacity: 1; pointer-events: auto; }
.stage-open-form.presenter-mode.presenter-controls-visible .stage-subtitle,
.stage-open-form.presenter-mode:has(.stage-controls :focus-visible) .stage-subtitle { bottom: 100px; }
.stage-open-form.presenter-mode .qa-dock { display: none; }
.stage-open-form.presenter-mode.presenter-qa-open .qa-dock { display: flex; flex-basis: 100%; background: #f5f6fa; color: #172033; }
.stage-open-form.presenter-mode.presenter-qa-open .stage-controls { width: min(940px, calc(100% - 32px)); }
.stage-open-form.presenter-mode.presenter-qa-open .stage-subtitle { bottom: 190px; }
.presenter-mode .stage-dock .stage-button { color: #e7edfa; border-color: #ffffff26; background: #ffffff0d; }
.presenter-mode .stage-dock .stage-button.primary { background: #3049ff; color: white; }
.presenter-mode .qa-voice-notice { display: none; }
.presenter-mode.presenter-qa-open .qa-voice-notice { display: block; position: absolute; bottom: 155px; left: 24px; z-index: 7; background: #161e30; padding: 8px 12px; border-radius: 8px; }
.presenter-mode .stage-alert { position: absolute; bottom: 180px; left: 10%; right: 10%; z-index: 8; }
.presenter-toolbar { position: absolute; top: 24px; left: 50%; transform: translateX(-50%); z-index: 10; display: flex; align-items: center; gap: 6px; max-width: calc(100% - 440px); padding: 7px; border-radius: 12px; border: 1px solid #ffffff20; background: #141a27e8; backdrop-filter: blur(18px); }
.presenter-toolbar-title { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: #b9c4d9; padding: 0 8px; }
.presenter-toolbar button, .presenter-notes button { flex-shrink: 0; border: 0; border-radius: 7px; padding: 9px 10px; background: #ffffff0d; color: #f5f7ff; cursor: pointer; font: inherit; font-size: 12px; white-space: nowrap; }
.presenter-toolbar button:hover, .presenter-toolbar button[aria-pressed="true"], .presenter-notes button:hover { background: #ffffff26; }
.presenter-mode button:focus-visible { outline: 2px solid #9daaff; outline-offset: 3px; }
.presenter-notes { position: absolute; z-index: 9; top: 84px; left: 50%; transform: translateX(-50%); width: min(640px, calc(100% - 32px)); max-height: calc(100dvh - 260px); overflow-y: auto; padding: 24px; border: 1px solid #ffffff26; border-radius: 16px; background: #131a29f2; backdrop-filter: blur(20px); box-shadow: 0 12px 60px #0008; }
.presenter-notes > div { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.presenter-notes p { color: #b4bed0; line-height: 1.9; padding: 12px; border-left: 2px solid transparent; }
.presenter-notes p.is-current { color: white; border-color: #8090ff; background: #8090ff12; }
.presenter-notice { position: absolute; z-index: 12; top: 80px; left: 50%; transform: translateX(-50%); background: #202a40; padding: 12px 20px; border-radius: 10px; }
@media (max-width: 1200px) { .presenter-toolbar-title { display: none; } .presenter-toolbar { max-width: calc(100% - 320px); } }
@media (max-width: 800px) {
  .stage-open-form.presenter-mode .stage-side { top: 12px; right: 12px; width: 104px; }
  .presenter-mode[data-avatar-corner="left"] .stage-side { left: 12px; right: auto; }
  .presenter-toolbar { top: auto; bottom: 94px; max-width: calc(100% - 24px); width: max-content; flex-wrap: wrap; justify-content: center; }
  .presenter-toolbar button { padding: 8px; font-size: 11px; }
  .stage-open-form.presenter-mode.presenter-controls-visible .stage-subtitle { bottom: 152px; }
  .stage-open-form.presenter-mode .stage-subtitle { width: calc(100% - 24px); padding: 10px 14px; }
  .presenter-mode .stage-dock .stage-button { font-size: 12px; padding: 0 12px; }
  .presenter-mode.presenter-qa-open .presenter-toolbar { bottom: auto; top: 12px; max-width: calc(100% - 150px); left: 12px; transform: none; }
  .presenter-mode.presenter-qa-open[data-avatar-corner="left"] .presenter-toolbar { left: auto; right: 12px; }
  .presenter-notes { top: 160px; max-height: calc(100dvh - 330px); padding: 16px; }
  .presenter-mode.presenter-qa-open .qa-dock .context-meta, .presenter-mode.presenter-qa-open .qa-mic-mode { display: none; }
}
@media (prefers-reduced-motion: reduce) { .presenter-mode .stage-subtitle, .presenter-mode .stage-controls, .presenter-mode .presenter-toolbar { transition: none; } }

.stage-open-form.presenter-mode .stage-side { width: var(--avatar-size, 260px); max-width: min(42vw, calc(100dvh - 170px)); }
.presenter-avatar-size { position: absolute; bottom: 30px; left: 12px; right: 12px; z-index: 5; display: flex; gap: 8px; align-items: center; padding: 8px; border-radius: 8px; background: #101725e8; color: #f5f7ff; font-size: 11px; opacity: 0; transition: opacity .15s; }
.presenter-avatar-size input { width: 0; min-width: 0; flex: 1; accent-color: #91a0ff; }
.presenter-resize-handle { position: absolute; bottom: 2px; left: 2px; width: 28px; height: 24px; border: 0; border-radius: 6px; background: #172033d9; color: #c9d3ea; cursor: nesw-resize; touch-action: none; opacity: 0; }
.presenter-mode[data-avatar-corner="left"] .presenter-resize-handle { left: auto; right: 2px; cursor: nwse-resize; }
.presenter-controls-visible .presenter-avatar-size, .presenter-controls-visible .presenter-resize-handle,
.presenter-mode .stage-side:hover .presenter-avatar-size, .presenter-mode .stage-side:hover .presenter-resize-handle,
.presenter-mode .stage-side:focus-within .presenter-avatar-size, .presenter-mode .stage-side:focus-within .presenter-resize-handle { opacity: 1; }
.presenter-page-count { padding: 0 10px; font-size: 12px; color: #c6d0e4; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (min-width: 801px) { .presenter-toolbar { max-width: calc(100% - 600px); flex-wrap: wrap; justify-content: center; } .presenter-toolbar-title { display: none; } }

/* Movable panels, docked layouts, captions and device readiness. */
.stage-open-form.presenter-mode .stage-main { position: relative; }
.stage-open-form.presenter-mode .stage-side { max-width: min(70vw, calc(100dvh - 150px)); }
.stage-open-form.presenter-mode .stage-side.is-positioned { right: auto; left: clamp(8px, var(--avatar-x), calc(100% - min(var(--avatar-size), 70vw, calc(100dvh - 150px)) - 8px)); top: clamp(8px, var(--avatar-y), calc(100dvh - min(var(--avatar-size), 70vw, calc(100dvh - 150px)) - 100px)); }
.presenter-avatar-grip { flex: none; padding: 4px 8px; color: #d9e2f4; font-size: 12px; cursor: grab; touch-action: none; user-select: none; }
.presenter-avatar-grip span { float: right; font-size: 10px; color: #9caac3; }
.presenter-mode[data-presenter-layout="float"] .stage-avatar { cursor: grab; touch-action: none; }
.stage-open-form.presenter-mode .stage-subtitle { pointer-events: auto; cursor: grab; touch-action: none; user-select: none; }
.caption-drag-grip { color: #b5c3db; font-size: 20px; flex: none; }
.stage-open-form.presenter-mode .stage-subtitle.is-positioned { bottom: auto !important; top: clamp(8px, var(--caption-y), calc(100% - 100px)); left: clamp(8px, var(--caption-x), calc(100% - min(84%, 1100px) - 8px)); transform: none; }
.stage-open-form.presenter-mode.presenter-captions-off .stage-subtitle { display: none; }
.presenter-mode .stage-side.is-positioned .presenter-resize-handle { left: auto; right: 2px; cursor: nwse-resize; }
.presenter-mode .presenter-toolbar { max-width: calc(100% - 360px); flex-wrap: wrap; justify-content: center; }
.presenter-toolbar select { padding: 8px; min-width: 0; border: 1px solid #ffffff26; border-radius: 7px; background: #1d2638; color: #f5f7ff; font: inherit; font-size: 12px; }
.stage-open-form.presenter-mode:is([data-presenter-layout="left"], [data-presenter-layout="right"]) .stage-main { display: grid; grid-template-columns: minmax(0, 1fr) 16px clamp(160px, var(--side-width, var(--avatar-size)), 50vw); gap: 0; }
.stage-open-form.presenter-mode[data-presenter-layout="left"] .stage-main { grid-template-columns: clamp(160px, var(--side-width, var(--avatar-size)), 50vw) 16px minmax(0, 1fr); }
.presenter-mode[data-presenter-layout="left"] .stage-side { grid-column: 1; grid-row: 1; }
.presenter-mode[data-presenter-layout="left"] .stage-resizer { grid-column: 2; grid-row: 1; }
.presenter-mode[data-presenter-layout="left"] .stage-screen { grid-column: 3; grid-row: 1; }
.stage-open-form.presenter-mode:is([data-presenter-layout="left"], [data-presenter-layout="right"]) .stage-side { position: relative; inset: auto; width: 100%; max-width: none; height: 100%; justify-content: center; padding: 14px; border-radius: 0; border: 0; background: #141a27; }
.presenter-mode:is([data-presenter-layout="left"], [data-presenter-layout="right"]) .stage-resizer { display: grid; z-index: 7; background: #141a27; }
.presenter-mode:is([data-presenter-layout="left"], [data-presenter-layout="right"]) .presenter-avatar-grip { cursor: default; }
.presenter-mode:is([data-presenter-layout="left"], [data-presenter-layout="right"]) .presenter-avatar-size { position: static; opacity: 1; margin-top: 12px; }
.presenter-mode:is([data-presenter-layout="left"], [data-presenter-layout="right"]) .presenter-resize-handle { display: none; }
.presenter-devices { position: absolute; z-index: 11; left: 16px; bottom: 14px; display: flex; flex-direction: column; gap: 4px; }
.presenter-devices button { display: flex; align-items: center; gap: 6px; width: fit-content; padding: 5px 8px; border: 1px solid #ffffff18; border-radius: 6px; background: #101725d9; color: #c9d3e7; font-size: 10px; cursor: pointer; }
.presenter-devices i, .preflight-device i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex: none; background: #dfa44e; }
.presenter-devices .is-ready i, .preflight-device i.ready { background: #59d68d; }
.presenter-preflight { width: min(480px, calc(100% - 32px)); padding: 28px; border: 1px solid var(--border); border-radius: 20px; color: var(--text); background: var(--panel); box-shadow: 0 24px 100px #0006; }
.presenter-preflight::backdrop { background: #080d19b3; backdrop-filter: blur(8px); }
.presenter-preflight h2 { margin: 0 0 10px; font-size: 22px; }
.presenter-preflight p { font-size: 13px; line-height: 1.8; color: var(--text-muted); }
.preflight-device { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0 8px; }
.preflight-device span { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.presenter-preflight button { padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); color: var(--text); cursor: pointer; font-size: 12px; }
.presenter-preflight button:disabled { opacity: .4; cursor: default; }
.presenter-preflight button.primary { background: var(--brand); color: white; border-color: var(--brand); }
.preflight-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
@media (max-width: 800px) {
  .presenter-mode .presenter-toolbar { max-width: calc(100% - 24px); }
  .presenter-mode.presenter-qa-open .presenter-toolbar { max-width: calc(100% - 150px); }
  .presenter-devices { left: 8px; bottom: 8px; }
  .presenter-devices button { font-size: 9px; }
  .stage-open-form.presenter-mode.presenter-controls-visible .stage-subtitle { bottom: 204px; }
  .stage-open-form.presenter-mode .stage-subtitle.is-positioned { width: 84%; }
  .stage-open-form.presenter-mode:is([data-presenter-layout="left"], [data-presenter-layout="right"]) .stage-dock { flex-wrap: wrap; justify-content: center; }
  .presenter-mode .stage-dock .stage-button.ghost { display: none; }
}

.stage-open-form.presenter-mode .stage-side { flex-direction: column; align-items: stretch; }
.stage-open-form.presenter-mode .stage-avatar { width: 100%; }
.stage-open-form.presenter-mode .stage-badge { display: inline-flex; }

/* Player controls reveal at the screen edges; moving across a slide stays quiet. */
.presenter-controls-reveal { position: absolute; left: 0; width: 100%; height: 20px; z-index: 8; border: 0; padding: 0; background: transparent; color: #e6edff; cursor: pointer; }
.presenter-controls-reveal.at-top { top: 0; }
.presenter-controls-reveal.at-bottom { bottom: 0; }
.presenter-controls-reveal span { display: inline-block; padding: 3px 12px; border-radius: 6px; background: #141a27ed; font-size: 10px; opacity: 0; }
.presenter-controls-reveal:focus-visible span { opacity: 1; }
.presenter-mode:not(.presenter-controls-visible) .presenter-controls-reveal.at-bottom::after { content: ''; position: absolute; width: 36px; height: 3px; background: #ffffff40; border-radius: 2px; bottom: 5px; left: calc(50% - 18px); }
.presenter-caption-transparency { display: flex; align-items: center; gap: 6px; padding: 5px 8px; color: #dbe3f5; font-size: 11px; white-space: nowrap; }
.presenter-caption-transparency input { width: 80px; accent-color: #9daaff; cursor: pointer; }
.presenter-caption-transparency output { min-width: 32px; font-variant-numeric: tabular-nums; }
.stage-open-form.presenter-mode .stage-subtitle { background: rgb(11 16 28 / var(--caption-opacity, .73)); backdrop-filter: blur(var(--caption-blur, 12px)); border-color: rgb(255 255 255 / calc(var(--caption-opacity, .73) * .1)); box-shadow: 0 4px 24px rgb(0 0 0 / calc(var(--caption-opacity, .73) * .2)); padding-right: 42px; }
.stage-open-form.presenter-mode .stage-subtitle-line { text-shadow: 0 1px 3px #000, 0 0 8px #0008; }
.presenter-caption-close { position: absolute; right: 7px; top: 7px; display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 7px; background: #111827b3; color: #fff; font-size: 19px; line-height: 1; cursor: pointer; opacity: 0; }
.stage-subtitle:hover .presenter-caption-close, .stage-subtitle:focus-within .presenter-caption-close { opacity: 1; }
@media (max-width: 800px) {
  .presenter-mode .stage-dock { flex-wrap: wrap; justify-content: center; }
  .stage-open-form.presenter-mode .stage-subtitle-line { max-height: 50dvh; }
  .presenter-caption-transparency input { width: 70px; }
  .presenter-mode .presenter-toolbar { max-height: calc(100dvh - 210px); overflow-y: auto; }
}
@media (hover: none) { .presenter-caption-close { opacity: 1; } }

.narration-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; pointer-events: none; z-index: 4; }
.narration-video.live { opacity: 1; }
.deck-narration-control { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.deck-narration-status { color: var(--muted); font-size: 12px; line-height: 1.5; }
.narration-badge { font-size: 12px; white-space: nowrap; color: var(--muted); }
.stage-dock { flex-wrap: wrap; }
