/* pantalla call — llamada simulada a pantalla completa */

.call-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  background: var(--glass);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  animation: call-in .28s var(--ease) both;
}

@keyframes call-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Fondo de video simulado ------------------------------ */
/* Estático y sin filter: un blur animado detrás de los controles de vidrio
   recalcula todos los backdrop-filter por frame y congela la app sin GPU. */
.call-videobg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(120% 90% at 20% 15%, var(--blob-1) 0%, transparent 60%),
    radial-gradient(110% 90% at 85% 80%, var(--blob-2) 0%, transparent 60%),
    radial-gradient(90% 80% at 60% 40%, var(--blob-3) 0%, transparent 65%);
  opacity: .55;
}

/* ---- Nota de cifrado --------------------------------------- */
.call-encrypted {
  position: relative;
  z-index: 1;
  margin: 6px 0 0;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: var(--glass);
  border: 1px solid var(--edge);
  color: var(--ink-dim);
  font-size: 12.5px;
  text-align: center;
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
}

/* ---- Centro: avatar / nombre / estado ---------------------- */
.call-center {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 24px;
  text-align: center;
}

.call-avatar-wrap {
  position: relative;
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}
.call-avatar { --sz: 112px; }

.call-waves { position: absolute; inset: 0; pointer-events: none; }
.call-waves i {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--edge-hi);
  opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .call-waves i { animation: call-wave 2.2s var(--ease) infinite; }
  .call-waves i:nth-child(2) { animation-delay: .5s; }
  .call-waves i:nth-child(3) { animation-delay: 1s; }
}
@keyframes call-wave {
  0% { transform: scale(.78); opacity: .5; }
  100% { transform: scale(1.55); opacity: 0; }
}
.call-screen[data-phase="active"] .call-waves {
  opacity: 0;
  transition: opacity .4s var(--ease);
}

.call-name {
  margin: 4px 0 0;
  font-size: 25px;
  font-weight: 650;
  line-height: 1.2;
}
.call-status {
  margin: 0;
  color: var(--ink-dim);
  font-size: 15px;
}
.call-timer {
  margin: 2px 0 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.call-hint {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--danger);
}

/* ---- PiP (cámara propia simulada) -------------------------- */
.call-pip {
  position: fixed;
  z-index: 2;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  width: 84px;
  height: 112px;
  border-radius: 18px;
  overflow: hidden;
  display: grid;
  place-items: center;
  /* El segundo stop era un verde-azulado frío; ahora es plum, la temperatura
     del fondo nuevo (el primero ya sigue al acento vía --bubble-me). */
  background: linear-gradient(160deg, var(--bubble-me), rgba(122, 58, 96, .4));
  border: 1px solid var(--edge-hi);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .35);
  transition: opacity .2s var(--ease);
}
.call-pip-avatar { --sz: 44px; transition: opacity .2s var(--ease); }
.call-pip.is-off .call-pip-avatar { opacity: .2; }
.call-pip-off {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  color: var(--ink-dim);
}
.call-pip-off svg { width: 22px; height: 22px; stroke: var(--ink-dim); fill: none; stroke-width: 1.6; }
.call-pip.is-off .call-pip-off { display: grid; }

/* ---- Controles flotantes ------------------------------------ */
.call-controls {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 14px 10px 4px;
  flex-wrap: wrap;
}
.call-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--glass);
  border: 1px solid var(--edge);
  color: var(--ink);
  cursor: pointer;
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
  transition: transform .12s var(--ease), background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.call-btn svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.call-btn:hover { background: var(--glass-strong); border-color: var(--edge-hi); }
.call-btn:active { transform: scale(.97); }
.call-btn:focus-visible { outline: 2px solid var(--edge-hi); outline-offset: 2px; }

.call-btn.state-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.call-btn.state-off { background: rgba(255, 107, 125, .16); border-color: rgba(255, 107, 125, .5); color: var(--danger); }

.call-btn-end {
  background: #e24b4a;
  border-color: #e24b4a;
  color: #fff;
}
.call-btn-end svg { fill: currentColor; stroke: none; }
.call-btn-end:hover { filter: brightness(1.08); }
.call-btn-end:active { transform: scale(.97); }

/* ---- Pantallas chicas --------------------------------------- */
@media (max-height: 620px) {
  .call-avatar-wrap { width: 104px; height: 104px; }
  .call-avatar { --sz: 88px; }
  .call-name { font-size: 21px; }
  .call-btn { width: 52px; height: 52px; }
}

/* ---- Reduced motion ------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .call-screen { animation: none; }
  .call-videobg { animation: none; }
  .call-waves i { animation: none; }
}
