.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
  z-index: 3;
}

#chatView .chat-call-menu-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  flex: none;
  border: 1px solid #ffffffb5;
  border-radius: 50%;
  background: #ffffff65;
  color: #514575;
  box-shadow: inset 0 1px 2px #fff;
  cursor: pointer;
}

#chatView .chat-call-menu-btn svg { width: 22px; height: 22px; }
#chatView .chat-call-menu-btn[aria-expanded="true"] { background: #8b56c5; color: #fff; }
#chatView .chat-call-menu-btn:focus-visible { outline: 3px solid #e6b6f7; outline-offset: 2px; }

#chatView[data-chat-background="midnight"] .chat-call-menu-btn {
  width: 44px;
  height: 44px;
  background: rgba(37, 49, 66, .7);
  border-color: rgba(255, 255, 255, .1);
  color: #fff;
  box-shadow: inset 0 1px rgba(255, 255, 255, .08);
  -webkit-backdrop-filter: blur(22px) saturate(1.25);
  backdrop-filter: blur(22px) saturate(1.25);
}

#chatView .chat-call-choices {
  position: absolute;
  z-index: 30;
  top: calc(100% + 7px);
  right: 52px;
  width: 175px;
  padding: 6px;
  border: 1px solid #ffffff70;
  border-radius: 16px;
  background: #f4f0f9f7;
  box-shadow: 0 16px 36px #10132350;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

#chatView .chat-call-choices button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #29263d;
  font: 700 13px system-ui, sans-serif;
  text-align: left;
  cursor: pointer;
}

#chatView .chat-call-choices button:active,
#chatView .chat-call-choices button:focus-visible { background: #e5d8f4; }
#chatView .chat-call-choices button span { display: grid; place-items: center; width: 25px; }
#chatView .chat-call-choices button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

#chatView[data-chat-background="midnight"] .chat-call-choices {
  border-color: #ffffff30;
  background: #263448f2;
}

#chatView[data-chat-background="midnight"] .chat-call-choices button { color: #fff; }
#chatView[data-chat-background="midnight"] .chat-call-choices button:active,
#chatView[data-chat-background="midnight"] .chat-call-choices button:focus-visible { background: #ffffff24; }

.chat-call-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: grid;
  place-items: center;
  background: #101728;
  color: #fff;
  overscroll-behavior: contain;
}

body.chat-call-open { overflow: hidden; }

.chat-call-stage {
  position: relative;
  width: min(100%, 720px);
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 70% 20%, #754e9a 0, transparent 38%),
    radial-gradient(circle at 15% 75%, #354d80 0, transparent 42%), #101728;
}

.chat-call-stage::before {
  position: absolute;
  inset: 0;
  content: '';
  background: linear-gradient(180deg, #ffffff08, transparent 45%, #070a18b8);
  pointer-events: none;
  z-index: 1;
}

#chatCallRemoteVideo {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #101728;
}

.chat-call-overlay.remote-video-on #chatCallRemoteVideo { display: block; }

#chatCallLocalVideo {
  display: none;
  position: absolute;
  top: calc(24px + env(safe-area-inset-top, 0px));
  right: 18px;
  z-index: 3;
  width: min(27vw, 150px);
  aspect-ratio: 3 / 4;
  object-fit: cover;
  transform: scaleX(-1);
  border: 1px solid #ffffff8f;
  border-radius: 20px;
  box-shadow: 0 12px 35px #0007;
  background: #26344b;
}

.chat-call-overlay.local-video-on #chatCallLocalVideo { display: block; }

.chat-call-info {
  position: absolute;
  z-index: 2;
  top: max(18%, calc(110px + env(safe-area-inset-top, 0px)));
  right: 20px;
  left: 20px;
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
  text-shadow: 0 2px 12px #0009;
}

.chat-call-overlay.remote-video-on .chat-call-info {
  top: auto;
  bottom: calc(164px + env(safe-area-inset-bottom, 0px));
}

.chat-call-avatar {
  display: grid;
  place-items: center;
  width: 108px;
  height: 108px;
  margin-bottom: 8px;
  border: 1px solid #ffffff70;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffd8ef, #a9caff);
  box-shadow: 0 16px 50px #0007, 0 0 35px #e9a9ff5c;
  font-size: 56px;
}

.chat-call-overlay.remote-video-on .chat-call-avatar { display: none; }
.chat-call-info h2 { max-width: 100%; margin: 0; overflow: hidden; font-size: clamp(23px, 6vw, 32px); text-overflow: ellipsis; white-space: nowrap; }
.chat-call-info p { margin: 0; color: #e1e8f5; font-size: 15px; }
.chat-call-info time { min-height: 20px; color: #cfd9e8; font-size: 14px; }

.chat-call-actions {
  position: absolute;
  right: 12px;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  left: 12px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: min(7vw, 28px);
}

.chat-call-action {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  padding: 8px;
  border: 1px solid #ffffff68;
  border-radius: 50%;
  background: #ffffff35;
  color: #fff;
  box-shadow: 0 8px 24px #0005;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  font-family: inherit;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.chat-call-action .chat-call-icon {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-call-action .icon-hangup { width: 31px; height: 31px; fill: currentColor; stroke: none; }
.chat-call-action .icon-slash { display: none; stroke-width: 2.4; }
.chat-call-action#chatCallMute[aria-pressed="true"] .icon-slash,
.chat-call-action#chatCallCamera[aria-pressed="false"] .icon-slash { display: block; }

.chat-call-action span {
  position: absolute;
  margin-top: 101px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  text-shadow: 0 2px 8px #000;
}

.chat-call-action[aria-pressed="true"] { background: #fff; color: #253650; }
.chat-call-action.danger { background: #ed4164; border-color: #ffadc0; }
.chat-call-action.answer { background: #31b879; border-color: #9ce9c2; }
.chat-call-action:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }

@media (max-height: 580px) {
  .chat-call-info { top: max(13%, calc(70px + env(safe-area-inset-top, 0px))); }
  .chat-call-avatar { width: 78px; height: 78px; font-size: 42px; }
}
