/* ===== 基础 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: #1a1a1a;
  color: #1d1d1f;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: inherit; }
svg { display: block; }

/* ===== 应用窗口外壳 ===== */
.meeting-window {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #f0f0f0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== 顶部标题栏 ===== */
.title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 14px;
  background: #f6f6f6;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  -webkit-app-region: drag;
  flex: 0 0 auto;
}
.title-left, .title-right { display: flex; align-items: center; gap: 12px; }

.traffic-lights {
  display: flex; gap: 8px;
  margin-right: 10px;
  -webkit-app-region: no-drag;
}
.tl {
  width: 12px; height: 12px; border-radius: 50%;
  display: inline-block;
  border: 0.5px solid rgba(0,0,0,0.12);
}
.tl-red    { background: #ff5f57; }
.tl-yellow { background: #febc2e; }
.tl-green  { background: #28c840; }

.title-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: #1d1d1f;
  -webkit-app-region: no-drag;
}
.title-btn:hover { background: rgba(0,0,0,0.05); }
.title-divider {
  width: 1px; height: 14px;
  background: rgba(0,0,0,0.15);
}
.duration {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: #1d1d1f;
}
.signal { color: #1d1d1f; }

.ic-10 { width: 10px; height: 10px; }
.ic-14 { width: 14px; height: 14px; }
.ic-16 { width: 16px; height: 16px; }
.ic-22 { width: 22px; height: 22px; }

/* ===== 视频主舞台 ===== */
.stage {
  position: relative;
  flex: 1 1 auto;
  background: #111;
  overflow: hidden;
  touch-action: none;
}
#pano-canvas, #vbg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  cursor: grab;
}
.stage.mode-pano #pano-canvas { display: block; }
.stage.mode-vbg  #vbg-canvas  { display: block; }
.stage.mode-pano .vbg-controls { display: none; }
.stage.mode-vbg  .pano-controls { display: none; }

#pano-canvas.dragging,  #vbg-canvas.dragging  { cursor: grabbing; }
#pano-canvas.calibrating { cursor: crosshair; }

#local-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #d9d9dc;
  transform: scaleX(-1);
  display: none;
}
.stage.live #pano-canvas { display: none; }
.stage.live #local-video { display: block; }
.stage.live .stage-placeholder { display: none; }
.stage.live .pano-controls { display: none; }

.stage-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #6b6b70;
}
.avatar-circle {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c0c4ce, #8e94a2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  font-weight: 500;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
}
.placeholder-hint { font-size: 13px; color: #6b6b70; }

/* 水印 */
.watermark {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='560' height='150'><g transform='rotate(-22 280 75)'><text x='-50' y='40' font-family='Helvetica,Arial,sans-serif' font-size='13' fill='%23000' fill-opacity='0.08'>%E5%88%98%E6%80%9D%E6%95%8F 7539 liusimin 7637</text><text x='-50' y='62' font-family='Helvetica,Arial,sans-serif' font-size='13' fill='%23000' fill-opacity='0.08'>2026%E5%B9%B45%E6%9C%8817%E6%97%A5 14:11 b9b8gg48</text></g></svg>");
  background-repeat: repeat;
  background-size: 320px auto;
}
.stage.live .watermark { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='560' height='150'><g transform='rotate(-22 280 75)'><text x='-50' y='40' font-family='Helvetica,Arial,sans-serif' font-size='13' fill='%23fff' fill-opacity='0.20'>%E5%88%98%E6%80%9D%E6%95%8F 7539 liusimin 7637</text><text x='-50' y='62' font-family='Helvetica,Arial,sans-serif' font-size='13' fill='%23fff' fill-opacity='0.20'>2026%E5%B9%B45%E6%9C%8817%E6%97%A5 14:11 b9b8gg48</text></g></svg>"); }

/* 左下名牌 */
.participant-tag {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 13px;
  border-radius: 6px;
  backdrop-filter: blur(8px);
}
.mic-off-mini { color: #fff; }

/* ===== 画幅遮罩 (letterbox / pillarbox) =====
   .viewing-area 用 box-shadow 在外圈涂黑，内部透明露出底层 canvas/video */
.viewing-area {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9;
  /* 默认无遮罩 */
}

.stage.mode-film .viewing-area {
  width: 100%;
  height: auto;
  /* Ultra Panavision 70 比例 2.76:1，上下黑边更厚更接近影厅 */
  aspect-ratio: 2.76 / 1;
  max-height: 100%;
  box-shadow: 0 0 0 9999px #000;
}

.stage.mode-drama .viewing-area {
  width: auto;
  height: 100%;
  aspect-ratio: 9 / 16;
  max-width: 100%;
  box-shadow: 0 0 0 9999px #000;
}

/* ===== 字幕 =====
   定位在 viewing-area 内，跟着画幅一起移动 */
.subtitles {
  position: absolute;
  left: 0;
  width: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  pointer-events: none;
}
.stage.mode-film .subtitles {
  display: flex;
  bottom: 8%;
}
.stage.mode-drama .subtitles {
  display: flex;
  top: 60%;
  transform: translateY(-50%);
}

.sub-foreign,
.sub-chinese {
  color: #fff;
  text-shadow:
    0 2px 4px rgba(0,0,0,0.85),
    0 0 8px rgba(0,0,0,0.55);
  padding: 1px 14px;
  max-width: 90%;
  line-height: 1.35;
  font-weight: 500;
  letter-spacing: 0.3px;
  /* 暂时占位防抖：没内容时不撑高度 */
  min-height: 0;
  /* 长字幕自动换行：中文按字断行、英文按词断 */
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.sub-foreign:empty,
.sub-chinese:empty { padding: 0; }

.stage.mode-film .sub-foreign  { font-size: 19px; font-weight: 400; opacity: 0.95; }
.stage.mode-film .sub-chinese  { font-size: 22px; }

.stage.mode-drama .sub-foreign { font-size: 28px; font-weight: 400; opacity: 0.95; }
.stage.mode-drama .sub-chinese { font-size: 34px; }

/* 全景控制叠层 */
.pano-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 5;
}
.pano-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  font-size: 12.5px;
  color: #fff;
  background: rgba(0,0,0,0.5);
  border-radius: 6px;
  backdrop-filter: blur(8px);
  transition: background 0.12s;
}
.pano-btn:hover { background: rgba(0,0,0,0.7); }
.pano-btn.active { background: #2eb6f0; }
.pano-hint {
  margin-left: 4px;
  font-size: 11.5px;
  color: rgba(255,255,255,0.85);
  padding: 5px 9px;
  background: rgba(0,0,0,0.35);
  border-radius: 6px;
  backdrop-filter: blur(8px);
  transition: opacity 0.4s;
}
.pano-hint.fade { opacity: 0; pointer-events: none; }

/* 模式切换条 */
.mode-switch {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  padding: 3px;
  background: rgba(0,0,0,0.5);
  border-radius: 8px;
  backdrop-filter: blur(8px);
  z-index: 6;
  gap: 2px;
}
.mode-btn {
  padding: 6px 14px;
  font-size: 12.5px;
  color: rgba(255,255,255,0.85);
  background: transparent;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.mode-btn:hover { color: #fff; }
.mode-btn.active {
  background: #2eb6f0;
  color: #fff;
}

/* 虚拟背景控制叠层 */
.vbg-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 5;
}
.vbg-status {
  padding: 6px 10px;
  font-size: 12.5px;
  color: rgba(255,255,255,0.85);
  background: rgba(0,0,0,0.5);
  border-radius: 6px;
  backdrop-filter: blur(8px);
}
.vbg-status.on { background: #28a745; color: #fff; }

/* ===== 底部工具栏 ===== */
.toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 64px;
  padding: 0 12px;
  background: #fafafa;
  border-top: 1px solid rgba(0,0,0,0.06);
  flex: 0 0 auto;
}
.tool-group { display: flex; align-items: center; }
.tool-left  { justify-self: start;  gap: 6px; }
.tool-center{ justify-self: center; gap: 4px; }
.tool-right { justify-self: end;    gap: 4px; }

/* 反应按钮（左侧） */
.reaction {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #4b4b50;
  transition: background 0.12s;
}
.reaction:hover { background: rgba(0,0,0,0.05); }
.ic-chat { color: #4b4b50; }
.badge-ok {
  background: #ffce3a;
  color: #3a2a00;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  width: 36px;
}
.badge-ok:hover { background: #ffc41a; }
.badge-plus1 {
  background: #ff5147;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  width: 36px;
}
.badge-plus1:hover { background: #f23a30; }

/* 控制按钮 */
.ctrl {
  position: relative;
  min-width: 68px;
  height: 50px;
  padding: 4px 10px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #1d1d1f;
  font-size: 12px;
  transition: background 0.12s;
}
.ctrl:hover { background: rgba(0,0,0,0.05); }
.ctrl-icon {
  position: relative;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4b4b50;
}
.ctrl-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #1d1d1f;
}
.ctrl-chev {
  position: absolute;
  right: 2px;
  top: 4px;
  color: #8a8a90;
}
.ctrl-chev .ic-10 { width: 11px; height: 11px; }

/* AI 总结里的开关 */
.toggle {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 14px;
  background: #cfcfd4;
  border-radius: 7px;
  transition: background 0.15s;
}
.toggle-knob {
  position: absolute;
  top: 1.5px;
  left: 1.5px;
  width: 11px;
  height: 11px;
  background: #fff;
  border-radius: 50%;
  transition: left 0.15s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.toggle.on { background: #2ec27e; }
.toggle.on .toggle-knob { left: 11.5px; }

/* AI 按钮里的 icon 颜色调成紫蓝色 */
.ai-summary .ctrl-icon { color: #5b8def; }

/* 挂断按钮 */
.ctrl-hangup {
  background: #ff4d4f;
  color: #fff;
  min-width: 48px;
  width: 48px;
  height: 38px;
  margin-left: 6px;
  border-radius: 8px;
}
.ctrl-hangup:hover { background: #ff3438; }
.ctrl-hangup .ic-22 { color: #fff; }
/* 挂断 png：黑色素材在红底按钮上反相显示成白色，与原 SVG 视觉一致 */
.ic-hangup {
  width: 22px;
  height: 22px;
  display: block;
  pointer-events: none;
  filter: brightness(0) invert(1);
}

/* 右侧参会人 badge */
.badge-num {
  position: absolute;
  top: -4px;
  right: -7px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: #ff4d4f;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #fafafa;
  line-height: 1;
}

.ctrl-more {
  min-width: 36px;
}

/* 电影 PNG 图标统一成 toolbar 灰度 */
.ic-film {
  width: 22px;
  height: 22px;
  display: block;
  filter: brightness(0.5);
  pointer-events: none;
}
/* 短剧图标本身已经深灰，不加 brightness 滤镜 */
.ic-drama {
  width: 22px;
  height: 22px;
  display: block;
  pointer-events: none;
}

/* 上班按钮图标：默认略压一点亮度与饱和，激活后还原橘色并加发光 */
.ic-work {
  width: 22px;
  height: 22px;
  display: block;
  pointer-events: none;
  filter: saturate(0.55) brightness(0.85);
  transition: filter 0.18s;
}
#btn-work[data-on="true"] .ic-work {
  filter: saturate(1.1) brightness(1) drop-shadow(0 0 6px rgba(255,120,40,0.85));
}
#btn-work[data-on="true"] .ctrl-label { color: #ff7a28; font-weight: 600; }

/* ===== 上班氛围模式叠层 ===== */
.work-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.work-overlay.active { opacity: 1; }

#work-aura-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* screen 混合让粒子发出科技感霓虹叠加；同时叠加多个粒子时不会过曝成纯白 */
  mix-blend-mode: screen;
}

.work-bubble-layer {
  position: absolute;
  inset: 0;
}

/* ===== 识别中：扫描线 + 状态文字 ===== */
.work-scan {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 2px;
  background: linear-gradient(90deg,
    rgba(78,195,255,0)   0%,
    rgba(78,195,255,0.85) 30%,
    rgba(255,255,255,1)  50%,
    rgba(78,195,255,0.85) 70%,
    rgba(78,195,255,0)  100%);
  box-shadow: 0 0 18px 2px rgba(78,195,255,0.85), 0 0 38px rgba(78,195,255,0.5);
  pointer-events: none;
  opacity: 0;
}
.work-scan::after {
  /* 扫描线后方的渐隐拖尾 */
  content: '';
  position: absolute;
  left: 0; right: 0; top: -120px;
  height: 120px;
  background: linear-gradient(to bottom,
    rgba(78,195,255,0) 0%,
    rgba(78,195,255,0.12) 70%,
    rgba(78,195,255,0.22) 100%);
  pointer-events: none;
}
.work-overlay.scanning .work-scan {
  animation: work-scan-anim 1.4s cubic-bezier(0.45, 0, 0.2, 1) forwards;
}
@keyframes work-scan-anim {
  0%   { top: 0;    opacity: 0; }
  8%   { opacity: 1; }
  92%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

.work-status {
  position: absolute;
  left: 50%;
  top: 56px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 12.5px;
  color: #eaf6ff;
  background: rgba(8, 24, 40, 0.55);
  border: 1px solid rgba(78,195,255,0.55);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  letter-spacing: 1px;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 0 6px rgba(78,195,255,0.55);
}
.work-status .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #4ec3ff;
  box-shadow: 0 0 8px rgba(78,195,255,0.95);
  animation: work-dot 0.9s ease-in-out infinite;
}
@keyframes work-dot {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50%      { opacity: 1;   transform: scale(1.2);  }
}
.work-overlay.scanning .work-status { opacity: 1; }
.work-overlay.done .work-status {
  opacity: 1;
  animation: work-status-fade 1.1s ease 0.4s forwards;
}
@keyframes work-status-fade {
  to { opacity: 0; transform: translateX(-50%) translateY(-4px); }
}

.work-bubble {
  position: absolute;
  width: 64px;
  height: 64px;
  transform: translate(-50%, -50%) scale(0.6);
  color: var(--c, #ff9a3c);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  will-change: left, top, opacity, transform;
}
.work-overlay.active .work-bubble.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.work-bubble .ring,
.work-bubble .ring-2 {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.work-bubble .ring   { animation: bubble-spin 9s linear infinite; }
.work-bubble .ring-2 { animation: bubble-spin 14s linear infinite reverse; opacity: 0.55; }
@keyframes bubble-spin { to { transform: rotate(360deg); } }

.work-bubble .core {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.18), rgba(0,0,0,0.55) 70%);
  border: 1px solid var(--c, #ff9a3c);
  box-shadow:
    inset 0 0 8px rgba(0,0,0,0.55),
    0 0 10px color-mix(in srgb, var(--c, #ff9a3c) 60%, transparent);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.7);
}
.work-bubble .val {
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: 0.5px;
}
.work-bubble .label {
  font-size: 8.5px;
  margin-top: 1px;
  opacity: 0.85;
  letter-spacing: 1.5px;
}

.work-bubble .tick {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}
.work-bubble .arc {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
  opacity: 0.85;
  filter: drop-shadow(0 0 3px color-mix(in srgb, currentColor 70%, transparent));
}

/* ===== 关闭/最小化按钮交互 ===== */
.tl:hover { filter: brightness(1.05); cursor: pointer; }
