/* ═══════ WebRTC 通话 POC v1（2026-08-11）═══════ */
.msg-chat-head { position: relative; } /* 按钮定位兜底 */

/* 头部注入按钮（44px 热区） */
.csr-call-inject {
  flex: 0 0 auto; width: 44px; height: 44px; margin-left: 6px;
  border: none; background: rgba(0, 0, 0, 0.05); border-radius: 12px;
  font-size: 18px; line-height: 1; cursor: pointer;
}
.csr-call-inject:hover { background: rgba(0, 0, 0, 0.1); }
.csr-call-inject:active { transform: scale(0.92); }

/* 通话遮罩 */
#csrCallOverlay {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}
#csrCallOverlay.hidden { display: none; }

/* 音频/来电卡片 */
.csr-call-card {
  background: #fff; border-radius: 20px; padding: 28px 32px;
  width: 300px; text-align: center; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.csr-call-face {
  font-size: 52px; width: 96px; height: 96px; line-height: 96px;
  border-radius: 50%; background: rgba(92, 130, 255, 0.12);
}
.csr-call-title {
  font-size: 17px; font-weight: 600; color: #222;
  max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.csr-call-state { font-size: 13px; color: #888; min-height: 18px; }
.csr-call-actions { display: flex; gap: 24px; margin-top: 10px; align-items: center; }
.csr-call-btn {
  width: 56px; height: 56px; border-radius: 50%; border: none;
  font-size: 22px; line-height: 1; cursor: pointer;
}
.csr-call-hangup { background: #ff4d4f; color: #fff; }
.csr-call-accept { background: #3ddc84; color: #fff; }
.csr-call-decline { background: #ff4d4f; color: #fff; }
.csr-call-mini {
  width: 48px; height: 48px; background: rgba(255, 255, 255, 0.92);
  font-size: 20px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.csr-call-mini.off { opacity: 0.45; }

/* 视频视图：全屏 remote + 右上 local 小窗 */
#csrCallOverlay.csr-call-video { flex-direction: column; background: #000; }
#csrCallOverlay.csr-call-video #csrCallRemote {
  width: 100%; height: 100%; object-fit: contain; background: #000;
}
#csrCallOverlay.csr-call-video #csrCallLocal {
  position: absolute; right: 16px; top: 16px; width: 104px; height: 140px;
  object-fit: cover; border-radius: 12px; border: 2px solid rgba(255, 255, 255, 0.7);
}
.csr-call-vtop {
  position: absolute; left: 0; right: 0; bottom: 24px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); z-index: 2;
}
.csr-call-vtop .csr-call-state { color: #ddd; }
.csr-call-vtop .csr-call-title { color: #fff; max-width: 70vw; }
.csr-call-vacts {
  position: absolute; bottom: 76px; left: 0; right: 0;
  justify-content: center; gap: 28px; z-index: 2;
}
#csrCallOverlay.csr-call-video .csr-call-mini { background: rgba(255, 255, 255, 0.18); color: #fff; }
#csrCallOverlay.csr-call-video .csr-call-mini.off { opacity: 0.45; }

/* 迷你 toast */
#csrCallToast {
  position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%) translateY(10px);
  background: rgba(0, 0, 0, 0.75); color: #fff; font-size: 13px;
  padding: 9px 16px; border-radius: 999px; z-index: 400;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
#csrCallToast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 移动端收窄 */
@media (max-width: 600px) {
  #csrCallOverlay.csr-call-video #csrCallLocal { width: 76px; height: 104px; right: 8px; top: 8px; }
  .csr-call-card { width: min(300px, calc(100vw - 48px)); }
}

/* 通话入口按钮 SVG(2026-08-11 用户:emoji 图标太丑→线条 SVG) */
.csr-call-inject svg { width:22px; height:22px; display:block; margin:auto; }
