/* ===================== CUỘC GỌI (.cl-) ===================== */
.cl-root { position: fixed; inset: 0; z-index: 1250; display: flex; align-items: center; justify-content: center; background: rgba(215, 235, 248, .55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); animation: cl-in .22s var(--ease); }
@keyframes cl-in { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
.cl-stage {
  position: relative; width: min(980px, 100%); height: min(640px, 100%); overflow: hidden; touch-action: manipulation; color: #1d3557; border-radius: 28px;
  background: linear-gradient(160deg, #f6feff 0%, #e8f7fd 50%, #d9ecfb 100%); box-shadow: 0 30px 90px rgba(40, 90, 150, .25), 0 0 0 1px rgba(80, 140, 200, .15);
  display: flex; flex-direction: column; user-select: none; -webkit-user-select: none;
}
.cl-stage.has-video { background: #0b1020; }
/* Video: luôn nằm trong DOM để vẫn phát tiếng khi chưa hiện hình (không dùng display:none, iOS sẽ ngắt tiếng). */
.cl-vid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #0b1020; opacity: 0; pointer-events: none; }
.cl-vid.cl-main { z-index: 0; }
.cl-vid.cl-main.is-shown { opacity: 1; }
.cl-vid.is-front { transform: scaleX(-1); }
.cl-veil { position: absolute; inset: 0; pointer-events: none; display: none; background: linear-gradient(180deg, rgba(10, 30, 70, .5), transparent 28%, transparent 62%, rgba(10, 30, 70, .55)); }
.cl-stage.has-video .cl-veil { display: block; }
.cl-top { position: relative; z-index: 2; text-align: center; padding: calc(28px + env(safe-area-inset-top, 0px)) 20px 0; display: flex; flex-direction: column; gap: 6px; }
.cl-name { font-size: clamp(22px, 4vw, 30px); font-weight: 800; letter-spacing: -.02em; }
.cl-status { font-size: var(--fs-md); color: #4a6a8e; font-variant-numeric: tabular-nums; }
.cl-status.is-warn { color: #d97706; }
.cl-center { position: relative; z-index: 1; flex: 1; display: grid; place-items: center; min-height: 0; }
.cl-center .kit-avatar { box-shadow: 0 0 0 5px #fff, 0 14px 36px rgba(40, 90, 150, .25); }
.cl-ring { position: absolute; width: 132px; height: 132px; border-radius: 50%; border: 2px solid rgba(74, 140, 210, .45); opacity: 0; }
.cl-center.is-pulse .cl-ring { animation: cl-pulse 2.2s ease-out infinite; }
.cl-center.is-pulse .cl-ring--2 { animation-delay: 1.1s; }
@keyframes cl-pulse { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(2.4); opacity: 0; } }
.cl-pip { position: absolute; z-index: 3; width: 112px; aspect-ratio: 3 / 4; border-radius: 18px; overflow: hidden; background: #151735; border: 2px solid rgba(255, 255, 255, .7); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; transition: bottom .25s var(--ease), top .25s var(--ease); }
.cl-pip.is-drag { cursor: grabbing; transition: none; box-shadow: 0 16px 40px rgba(0, 0, 0, .5); transform: scale(1.04); }
.cl-pip .cl-vid { opacity: 1; z-index: 0; object-fit: cover; }
.cl-pip__off { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: linear-gradient(160deg, #2a3a63, #151735); color: #fff; }
.pip-br { right: 14px; bottom: calc(140px + env(safe-area-inset-bottom, 0px)); }
.pip-bl { left: 14px; bottom: calc(140px + env(safe-area-inset-bottom, 0px)); }
.pip-tr { right: 14px; top: calc(92px + env(safe-area-inset-top, 0px)); }
.pip-tl { left: 14px; top: calc(92px + env(safe-area-inset-top, 0px)); }
/* Khi nút điều khiển ẩn, khung nhỏ trượt xuống sát đáy */
.cl-stage.is-hide-ui .pip-br, .cl-stage.is-hide-ui .pip-bl { bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
.cl-stage.is-hide-ui .pip-tr, .cl-stage.is-hide-ui .pip-tl { top: calc(20px + env(safe-area-inset-top, 0px)); }
.cl-top, .cl-bar, .cl-veil { transition: opacity .25s var(--ease); }
.cl-stage.is-hide-ui .cl-top, .cl-stage.is-hide-ui .cl-bar, .cl-stage.is-hide-ui .cl-veil { opacity: 0; pointer-events: none; }
.cl-flags { display: flex; justify-content: center; gap: 8px; }
.cl-flag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: var(--r-pill); font-size: var(--fs-xs); background: rgba(0, 0, 0, .35); color: #fff; }
.cl-camoff { position: absolute; top: calc(50% + 86px); left: 50%; transform: translateX(-50%); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: var(--r-pill); font-size: var(--fs-sm); background: rgba(255, 255, 255, .75); color: #1d3557; }
.cl-center .kit-avatar { position: relative; }
.cl-note { position: absolute; z-index: 2; left: 50%; bottom: 122px; transform: translateX(-50%); max-width: 90%; display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .8); color: #1d3557; font-size: var(--fs-sm); text-align: center; box-shadow: 0 4px 14px rgba(40, 90, 150, .15); }
.cl-bar { margin-top: auto; position: relative; z-index: 4; display: flex; justify-content: center; align-items: flex-start; gap: 22px; padding: 16px 16px calc(30px + env(safe-area-inset-bottom, 0px)); }
.cl-act { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: var(--fs-sm); min-width: 84px; }
.cl-btn { width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; color: #2a5aa8; background: rgba(255, 255, 255, .85); box-shadow: 0 6px 18px rgba(40, 90, 150, .18); transition: transform var(--dur-fast), background var(--dur-fast); }
.cl-btn:hover { background: #fff; }
.cl-btn:active { transform: scale(.92); }
.cl-btn.is-off { background: #2a5aa8; color: #fff; }
.cl-btn--red { color: #fff; background: #ef4444; box-shadow: 0 8px 22px rgba(239, 68, 68, .45); }
.cl-btn--red:hover { background: #dc2626; }
.cl-btn--green { color: #fff; background: #22c55e; box-shadow: 0 8px 22px rgba(34, 197, 94, .5); }
.cl-btn--green:hover { background: #16a34a; }
/* Khi đang xem video của đối phương: chữ trắng, nút kính mờ */
.cl-stage.has-video { color: #fff; }
.cl-stage.has-video .cl-status { color: rgba(255, 255, 255, .92); }
.cl-stage.has-video .cl-btn:not(.cl-btn--red):not(.cl-btn--green) { color: #fff; background: rgba(255, 255, 255, .22); backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; }
.cl-stage.has-video .cl-btn.is-off { background: #fff; color: #2a5aa8; }
.cl-hang svg { transform: rotate(135deg); }
.cl-shake { animation: cl-shake 1.6s ease-in-out infinite; }
@keyframes cl-shake { 0%, 60%, 100% { transform: none; } 65% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } 85% { transform: rotate(-8deg); } 92% { transform: rotate(6deg); } }
.cl-stage.is-ended .cl-bar { display: none; }
html.cl-open body { overflow: hidden; }

/* Nút gọi trên đầu khung chat */
.ch-header__call { color: var(--accent); }

@media (max-width: 820px) {
  .cl-root { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .cl-stage { width: 100%; height: 100%; height: 100dvh; border-radius: 0; }
  .cl-root { height: 100dvh; bottom: auto; }
  .cl-pip { width: 96px; }
}
@media (prefers-reduced-motion: reduce) { .cl-center.is-pulse .cl-ring, .cl-shake { animation: none; } }

/* ===================== GỌN KIỂU ZALO ===================== */
/* Toàn màn hình nền tối, không khung bo góc, không hiệu ứng thừa; chỉ tên, thời gian và vài nút tròn. */
.cl-root { background: #0b0d12; backdrop-filter: none; -webkit-backdrop-filter: none; animation: none; }
.cl-stage, .cl-stage.has-video { width: 100%; height: 100%; border-radius: 0; box-shadow: none; color: #fff; background: linear-gradient(180deg, #2b3347 0%, #12151d 100%); }
.cl-stage.has-video { background: #000; }
.cl-root { height: 100dvh; bottom: auto; }
.cl-stage { height: 100dvh; }
.cl-vid { background: #000; }
.cl-status, .cl-stage.has-video .cl-status { color: rgba(255, 255, 255, .8); font-size: var(--fs-sm); }
.cl-status.is-warn { color: #fbbf24; }
.cl-name { font-size: clamp(20px, 5vw, 26px); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.cl-muted { display: inline-flex; padding: 4px; border-radius: 50%; background: rgba(255, 255, 255, .2); }
.cl-center .kit-avatar { box-shadow: none; }
/* Khi đang xem hình: tên và thời gian nhỏ ở góc trên trái, nền mờ nhẹ */
.cl-stage.has-video .cl-top { align-items: flex-start; text-align: left; padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 0; gap: 2px; }
.cl-stage.has-video .cl-name { font-size: 16px; font-weight: 600; justify-content: flex-start; }
.cl-veil { background: linear-gradient(180deg, rgba(0, 0, 0, .45), transparent 18%, transparent 78%, rgba(0, 0, 0, .5)); }
/* Nút điều khiển: tròn nhỏ, kính mờ, không nhãn; cúp máy đỏ */
.cl-bar { gap: 18px; align-items: center; padding: 12px 16px calc(26px + env(safe-area-inset-bottom, 0px)); }
.cl-btn { width: 56px; height: 56px; color: #fff; background: rgba(255, 255, 255, .18); box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.cl-btn:hover { background: rgba(255, 255, 255, .28); }
.cl-btn.is-off, .cl-stage.has-video .cl-btn.is-off { background: #fff; color: #12151d; }
.cl-btn--red { background: #ef4444; box-shadow: none; }
.cl-btn--green { background: #22c55e; box-shadow: none; }
.cl-act { min-width: 72px; color: #fff; }
.cl-pip { width: 92px; border-radius: 12px; border: 0; box-shadow: 0 6px 18px rgba(0, 0, 0, .4); }
.cl-pip.is-drag { transform: scale(1.03); }
.cl-note { background: rgba(0, 0, 0, .55); color: #fff; box-shadow: none; font-size: var(--fs-xs); }
@media (max-width: 820px) { .cl-pip { width: 88px; } }

.cl-diag { margin-top: 6px; padding: 6px 10px; border-radius: 10px; font-size: 12px; line-height: 1.4; color: #fde68a; background: rgba(0, 0, 0, .35); align-self: center; max-width: 92%; }
