/* Calls. The layer is always dark, as a call screen is in the app. */
.call-layer { position: fixed; inset: 0; z-index: 45; display: flex; flex-direction: column; color: #fff; background: #10181f; animation: fade 0.16s ease; }
.call-layer[hidden] { display: none; }
.call-layer.mini { inset: 0 0 auto 0; height: auto; background: none; animation: none; }
.call-sounds[hidden] { display: none; }

.call-name { font-size: 18px; font-weight: 600; max-width: 100%; }
.call-status { font-size: 14px; color: rgba(255, 255, 255, 0.72); font-variant-numeric: tabular-nums; min-height: 18px; }

/* Incoming */
.call-incoming { margin: auto; width: min(100%, 360px); padding: 24px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.call-incoming .call-name { font-size: 24px; margin-top: 16px; }
.call-pulse { position: relative; border-radius: 50%; }
.call-pulse::before { content: ""; position: absolute; inset: -14px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.28); animation: call-pulse 1.6s ease-out infinite; }
@keyframes call-pulse { from { transform: scale(0.9); opacity: 1; } to { transform: scale(1.25); opacity: 0; } }
.call-answer-row { display: flex; justify-content: center; gap: 56px; margin-top: 28px; }
.call-no-cam { color: rgba(255, 255, 255, 0.8); margin-top: 8px; }

/* In a call */
.call-top { flex: none; display: flex; align-items: center; gap: 8px; padding: 12px 16px; }
.call-top-text { min-width: 0; flex: 1; text-align: center; padding-inline-end: 40px; }
.call-top-btn { color: #fff; }
.call-top-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }
.call-grid { flex: 1; min-height: 0; display: grid; gap: 8px; padding: 0 16px; grid-template-columns: 1fr; grid-auto-rows: minmax(0, 1fr); }
.call-grid[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.call-grid[data-count="3"], .call-grid[data-count="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.call-grid[data-count="5"], .call-grid[data-count="6"], .call-grid[data-count="7"], .call-grid[data-count="8"], .call-grid[data-count="9"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.call-tile { position: relative; min-width: 0; min-height: 0; overflow: hidden; border-radius: 14px; background: #1b2730; display: flex; align-items: center; justify-content: center; }
.call-video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.call-video.contain { object-fit: contain; }
.call-video[hidden], .call-face[hidden], .call-self[hidden], .call-label[hidden] { display: none; }
.call-face { display: flex; align-items: center; justify-content: center; }
.call-face.wait { height: 100%; }
.call-label { position: absolute; inset-inline-start: 8px; bottom: 8px; max-width: calc(100% - 16px); display: flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 8px; font-size: 13px; background: rgba(0, 0, 0, 0.5); }
.call-label .icon { fill: #fff; }
.call-self { position: absolute; inset-inline-end: 28px; top: 72px; width: 200px; max-width: 34vw; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 12px; background: #000; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45); z-index: 2; }
.call-self.mirror { transform: scaleX(-1); }

.call-controls { flex: none; display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; padding: 16px 12px max(16px, env(safe-area-inset-bottom)); }
.call-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 84px; color: #fff; }
.call-btn-round { width: 54px; height: 54px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.14); transition: background 0.15s, transform 0.1s; }
.call-btn-round .icon { width: 26px; height: 26px; fill: #fff; }
.call-btn:hover .call-btn-round { background: rgba(255, 255, 255, 0.24); }
.call-btn:active .call-btn-round { transform: scale(0.95); }
.call-btn.on .call-btn-round { background: #fff; }
.call-btn.on .call-btn-round .icon { fill: #10181f; }
.call-btn.on.share .call-btn-round { background: var(--primary); }
.call-btn.on.share .call-btn-round .icon { fill: #fff; }
.call-btn.hang .call-btn-round { background: #e53935; }
.call-btn.hang:hover .call-btn-round { background: #c62828; }
.call-btn.answer .call-btn-round { background: #2e9e5b; }
.call-btn.answer:hover .call-btn-round { background: #26884d; }
.call-btn-label { font-size: 12px; line-height: 1.25; text-align: center; color: rgba(255, 255, 255, 0.86); overflow-wrap: anywhere; }

/* The bar while the layer is minimized */
.call-bar { display: flex; align-items: center; gap: 4px; height: 36px; padding-inline: 12px 4px; background: #2e9e5b; color: #fff; }
.call-bar-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 100%; color: #fff; font-size: 14px; }
.call-bar-main .icon { fill: #fff; flex: none; }
.call-bar-name { font-weight: 600; }
.call-bar-status { font-variant-numeric: tabular-nums; opacity: 0.85; flex: none; }
.call-bar-btn { flex: none; width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.call-bar-btn:hover { background: rgba(0, 0, 0, 0.16); }
.call-bar-btn .icon { fill: #fff; width: 20px; height: 20px; }

/* Group chats */
.group-call-bar { flex: none; display: flex; align-items: center; gap: 10px; padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--border); color: var(--text); font-size: 14px; }
.group-call-bar[hidden] { display: none; }
.group-call-bar .icon { fill: var(--good); flex: none; }

.call-devices { z-index: 60; }
.modal-back:has(.call-devices) { z-index: 60; }
.call-device-row { display: flex; align-items: center; gap: 12px; }
.call-device { max-width: 62%; min-width: 0; }

@media (max-width: 560px) {
  .call-controls { gap: 8px; }
  .call-btn { width: 68px; }
  .call-btn-round { width: 48px; height: 48px; }
  .call-self { top: 64px; inset-inline-end: 20px; width: 110px; }
  .call-answer-row { gap: 40px; }
}
