/* Group calls (call.js). Separate from style.css so calls can't disturb the chat UI. */

.call-btn:hover { color: var(--accent); }
.call-alert-btn.on { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 8px 18px -8px rgba(234, 88, 12, 0.9); }
.call-alert-btn.on:hover { color: #fff; background: var(--grad); }

/* "Call going on — Join" strip under the room bar */
.call-banner {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 12px 0;
  padding: 6px 6px 6px 14px;
  border-radius: 12px;
  background: rgba(220, 252, 231, 0.9);
  border: 1px solid #bbf7d0;
  color: #166534;
  font-size: 13px;
  font-weight: 600;
  animation: rise 0.4s var(--ease) both;
}
.cb-dot { width: 8px; height: 8px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.6); animation: cb-pulse 1.6s infinite; }
@keyframes cb-pulse { 70% { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); } 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); } }
.cb-text { flex: 1; }
.cb-join { border: 0; border-radius: 9px; padding: 7px 16px; font: inherit; font-weight: 700; color: #fff; background: #16a34a; }
.cb-join:hover { background: #15803d; }

/* Incoming call */
.call-ring {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(31, 26, 23, 0.55);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  animation: fade-in 0.25s var(--ease);
}
.cr-card { text-align: center; color: #fff; animation: pop-in 0.4s var(--spring); }
.cr-avatar { position: relative; width: 104px; height: 104px; margin: 0 auto 18px; }
.cr-avatar .avatar { width: 104px; height: 104px; font-size: 34px; position: relative; z-index: 1; }
.cr-avatar::before, .cr-avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(251, 146, 60, 0.8);
  animation: cr-wave 2s var(--ease) infinite;
}
.cr-avatar::after { animation-delay: 1s; }
@keyframes cr-wave { from { transform: scale(1); opacity: 0.9; } to { transform: scale(1.8); opacity: 0; } }
.cr-name { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.cr-sub { margin-top: 4px; font-size: 14px; opacity: 0.8; }
.cr-actions { display: flex; justify-content: center; gap: 56px; margin-top: 44px; }
.cr-btn {
  width: 66px; height: 66px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 14px 30px -10px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s var(--spring);
}
.cr-btn .i { width: 28px; height: 28px; }
.cr-btn:active { transform: scale(0.9); }
.cr-btn.decline { background: #ef4444; }
.cr-btn.accept { background: #22c55e; animation: cr-nudge 1.2s ease-in-out infinite; }
@keyframes cr-nudge { 0%, 100% { transform: none; } 15% { transform: rotate(-12deg); } 30% { transform: rotate(12deg); } 45% { transform: none; } }

/* In-call screen */
.call-screen {
  position: fixed;
  inset: 0;
  z-index: 70;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  padding: max(12px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom));
  gap: 12px;
  color: #fff;
  background:
    radial-gradient(60% 40% at 10% 0%, rgba(234, 88, 12, 0.35), transparent 70%),
    radial-gradient(50% 40% at 100% 100%, rgba(194, 65, 12, 0.3), transparent 70%),
    #1c1410;
  animation: fade-in 0.25s var(--ease);
}
.cs-top { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px; font-size: 14px; font-weight: 600; }
.cs-time { font-variant-numeric: tabular-nums; opacity: 0.8; }
.cs-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  grid-auto-rows: 1fr;
}
.cs-grid[data-count="2"] { grid-template-columns: 1fr; }
.cs-grid[data-count="3"], .cs-grid[data-count="4"] { grid-template-columns: 1fr 1fr; }
@media (min-width: 760px) {
  .cs-grid[data-count="2"] { grid-template-columns: 1fr 1fr; }
}
.cs-tile {
  position: relative;
  min-height: 0;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: pop-in 0.35s var(--spring);
}
.cs-grid[data-count="3"] .cs-tile:first-child { grid-column: 1 / -1; }
.cs-tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.cs-tile.self video { transform: scaleX(-1); }
.cs-face { position: absolute; inset: 0; display: none; place-items: center; }
.cs-face .avatar { width: 84px; height: 84px; font-size: 28px; }
.cs-tile.no-video video { opacity: 0; }
.cs-tile.no-video .cs-face { display: grid; }
.cs-label {
  position: absolute;
  left: 10px; bottom: 10px;
  display: flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.cs-label .i { width: 14px; height: 14px; color: #fca5a5; }
.cs-status {
  position: absolute;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.cs-status[hidden] { display: none; }
.cs-q { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.cs-q.good { background: #22c55e; }
.cs-q.fair { background: #f59e0b; }
.cs-q.bad { background: #ef4444; }
.cs-audio { display: none; }
.cs-unlock {
  position: absolute;
  top: 54px; left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  border: 0;
  border-radius: 999px;
  padding: 10px 20px;
  font: inherit;
  font-weight: 700;
  color: #1c1410;
  background: #fff;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
  animation: pop-in 0.3s var(--spring);
}
.cs-unlock[hidden] { display: none; }
.cs-bar { display: flex; justify-content: center; gap: 16px; }
.cs-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: transform 0.2s var(--spring), background 0.2s;
}
.cs-btn .i { width: 24px; height: 24px; }
.cs-btn:active { transform: scale(0.9); }
.cs-btn.off { background: #fff; color: #1c1410; }
.cs-btn.end { background: #ef4444; border-color: transparent; }
body.in-call { overflow: hidden; }

@media (max-width: 600px) {
  .call-banner { font-size: 12px; margin: 8px 12px 0; }
  .cs-btn { width: 52px; height: 52px; }
  .cr-actions { gap: 64px; }
}

/* Pocket mode: pure black so an OLED screen looks switched off */
.cs-blackout {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: #000;
  cursor: none;
  touch-action: manipulation;
  display: grid;
  place-items: center;
}
.cs-blackout[hidden] { display: none; }
.cs-wake { color: rgba(255, 255, 255, 0.35); font-size: 13px; transition: opacity 0.8s; }
.cs-wake.gone { opacity: 0; }

/* Dim mode: almost pure black to save battery and cut glare; a small red "camera on" dot always stays */
.cs-dim {
  position: fixed;
  inset: 0;
  z-index: 94;
  background: rgba(0, 0, 0, 0.998);
  touch-action: manipulation;
}
.cs-dim[hidden] { display: none; }
.cs-dim-badge {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  padding: 6px;
}
.cs-dim-badge[hidden] { display: none; }
.cs-rec {
  display: block;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 10px 2px rgba(239, 68, 68, 0.55);
  animation: cs-rec-pulse 1.6s ease-in-out infinite;
}
@keyframes cs-rec-pulse { 50% { opacity: 0.45; box-shadow: 0 0 4px 0 rgba(239, 68, 68, 0.3); } }
.cs-dim-hint { position: absolute; bottom: max(28px, env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; color: rgba(255, 255, 255, 0.22); font-size: 12px; transition: opacity 0.8s; }
.cs-dim-hint.gone { opacity: 0; }

@media (max-width: 600px) {
  .cs-bar { gap: 10px; }
  .cs-btn { width: 48px; height: 48px; }
  .cs-btn .i { width: 22px; height: 22px; }
}

