/* Экраны звонка: входящий вызов и активный разговор. */

.call {
  position: fixed;
  inset: 0;
  z-index: 890;
  display: flex;
  flex-direction: column;
  background: #08080f;
  color: #fff;
  animation: fade-in var(--normal) var(--ease);
}

/* --- Входящий и исходящий вызов --- */
.call--ringing {
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 40px 24px calc(40px + var(--safe-bottom));
  background:
    radial-gradient(700px 480px at 50% 22%, rgba(108, 92, 231, 0.24), transparent 70%),
    #08080f;
}

.call__who {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.call__name {
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.4px;
}

.call__state {
  font-size: 14.5px;
  color: rgba(255, 255, 255, 0.62);
}

/* Пульсирующие кольца вокруг аватара во время дозвона. */
.call__avatar {
  position: relative;
  margin: 10px 0 18px;
}

.call__avatar::before,
.call__avatar::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: pulse-ring 2s var(--ease) infinite;
}

.call__avatar::after {
  animation-delay: 1s;
}

.call--connected .call__avatar::before,
.call--connected .call__avatar::after {
  display: none;
}

.call__answer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 56px;
}

.call__round {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.72);
}

.call__round > span:first-child {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: transform var(--fast) var(--ease);
}

.call__round:active > span:first-child {
  transform: scale(0.92);
}

.call__round--accept > span:first-child {
  background: var(--success);
  box-shadow: 0 8px 26px rgba(34, 197, 94, 0.4);
}

.call__round--decline > span:first-child {
  background: var(--danger);
  box-shadow: 0 8px 26px rgba(239, 68, 68, 0.4);
}

.call__round .icon {
  width: 27px;
  height: 27px;
  color: #fff;
}

/* --- Активный разговор --- */
.call__stage {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #000;
  overflow: hidden;
}

.call__remote {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

/* Пока удалённое видео не пришло, показываем аватар — чёрный экран
   выглядит как поломка, даже когда всё в порядке. */
.call__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background:
    radial-gradient(600px 400px at 50% 40%, rgba(108, 92, 231, 0.2), transparent 70%),
    #08080f;
}

.call__local {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 108px;
  aspect-ratio: 3 / 4;
  border-radius: var(--r-md);
  overflow: hidden;
  background: #101018;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.call__local video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.call__local--off {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.4);
}

.call__topbar {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(14px + var(--safe-top)) 16px 14px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
}

.call__timer {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  padding: 4px 11px;
  border-radius: var(--r-full);
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.call__quality {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.call__quality-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}

.call__quality-dot--weak { background: var(--warning); }
.call__quality-dot--bad { background: var(--danger); }

.call__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 18px 16px calc(22px + var(--safe-bottom));
  background: #08080f;
  flex: none;
}

.call__btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.11);
  color: #fff;
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease);
}

.call__btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.call__btn:active {
  transform: scale(0.92);
}

/* Выключенное состояние микрофона и камеры показывается инверсией:
   белая кнопка = устройство отключено. */
.call__btn[aria-pressed="true"] {
  background: #fff;
  color: #08080f;
}

.call__btn--hangup {
  background: var(--danger);
  width: 62px;
  height: 62px;
}

.call__btn--hangup:hover {
  background: #dc2626;
}

@media (max-width: 700px) {
  .call__local {
    width: 92px;
  }

  .call__answer {
    gap: 44px;
  }
}
