#incoming-call {
  position: fixed;
  z-index: 30;
  inset: auto 12px max(94px, calc(env(safe-area-inset-bottom) + 82px)) auto;
  width: min(380px, calc(100% - 24px));
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: 0 6px 24px #0004;
}
[data-phone-app] #incoming-call { inset: max(8px, env(safe-area-inset-top)) 12px auto; margin: 0 auto; }
.call-alert-copy { min-width: 0; }
.call-alert-copy > p { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.call-alert-actions { display: flex; gap: 8px; }
.call-control {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 50%;
  border: 0;
  color: #fff;
  background: #ffffff25;
}
.call-control:active { scale: .94; }
.call-hangup { background: #cd3448; }
.call-answer { background: #167b4f; }
.utility-shell .call-screen { width: 100%; padding: 0; }
.call-stage {
  position: relative;
  isolation: isolate;
  color: #fff;
  height: 100dvh;
  min-height: 420px;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: max(72px, env(safe-area-inset-top)) 20px 160px;
  background: linear-gradient(160deg, #9268d0 0%, #7c70d1 47%, #5e83d4 100%);
  overflow: hidden;
}
[data-phone-app] .utility-shell > .call-screen { padding: 0; }
.call-back {
  position: absolute;
  z-index: 2;
  inset: max(20px, env(safe-area-inset-top)) auto auto 10px;
  display: flex;
  align-items: center;
  gap: 2px;
  color: #fff;
  font-size: 18px;
  text-decoration: none;
  padding: 10px 4px;
}
.call-identity { position: relative; display: grid; justify-items: center; gap: 8px; width: 100%; text-align: center; }
.call-identity .avatar { width: clamp(120px, 35vw, 180px); height: clamp(120px, 35vw, 180px); margin-bottom: 32px; box-shadow: 0 0 0 10px #b69aff30, 0 0 0 17px #b69aff20; font-size: 48px; }
.call-identity h1 { margin: 0; max-width: 100%; font-size: clamp(25px, 7.2vw, 38px); line-height: 1.2; font-weight: 400; overflow-wrap: anywhere; }
#call-status { color: #fff; margin: 0; font-size: 17px; }
.call-screen[data-call-state="Ringing"] .call-identity .avatar { animation: call-halo 2.4s ease-in-out infinite; }
@keyframes call-halo { 50% { transform:scale(1.035); } }
@media (prefers-reduced-motion: reduce) { .call-screen[data-call-state="Ringing"] .call-identity .avatar { animation: none; } }
.call-screen video { object-fit: cover; background: #111a23; }
.call-screen #remote-media {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; visibility: hidden;
}
.call-screen #local-media {
  position: absolute;
  inset: max(16px, env(safe-area-inset-top)) 12px auto auto;
  width: clamp(84px, 26vw, 170px);
  aspect-ratio: 3 / 4;
  transform: scaleX(-1);
  border-radius: 14px;
  visibility: hidden;
}
.call-screen :is(#remote-media, #local-media)[data-playable] { visibility: visible; }
.call-stage:has(#remote-media[data-playable]) { align-content: start; background: #111a23; }
.call-stage:has(#remote-media[data-playable]) .call-identity { justify-self: start; text-align: start; justify-items: start; }
.call-stage:has(#remote-media[data-playable]) .call-identity .avatar { display: none; }
.call-stage:not(:has(#remote-media[data-playable])) #local-media[data-playable] { inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; z-index: -1; }
.call-stage:has(video[data-playable])::after { content: ''; position: absolute; z-index: -1; inset: 0; pointer-events: none; background: linear-gradient(#0005, transparent 35%, transparent 65%, #0006); }
.call-stage:has(#remote-media[data-playable]) .call-identity h1 { font-size: 24px; }
.call-stage:has(#remote-media[data-playable]) .call-identity { width: calc(100% - 115px); }
.call-stage:has(video[data-playable]).controls-hidden :is(.call-back,.call-identity,#media-actions,#local-media) { opacity: 0; pointer-events: none; }
.call-stage:not(:has(#remote-media[data-playable])).controls-hidden #local-media { opacity: 1; }
.call-stage :is(.call-back,.call-identity,#media-actions,#local-media) { transition: opacity .2s ease; }
.call-view-toggle { display: none; position: absolute; z-index: 2; right: 16px; top: max(210px, calc(env(safe-area-inset-top) + 190px)); width: 44px; height: 44px; border: 0; border-radius: 50%; background: #0004; color: #fff; }
.call-stage:has(video[data-playable]) .call-view-toggle { display: grid; place-items: center; }
.call-stage.controls-hidden .call-view-toggle { opacity: 0; }
.call-stage.controls-hidden .call-view-toggle:focus-visible { opacity: 1; }
.call-stage:has(video[data-playable]).controls-hidden::after { opacity: 0; }
#call-playback { position: absolute; bottom: 140px; }
.call-screen #media-actions {
  position: absolute;
  inset: auto 18px max(62px, calc(env(safe-area-inset-bottom) + 28px));
  display: flex;
  justify-content: center;
  flex-wrap: nowrap;
  gap: clamp(12px, 7vw, 38px);
}
.call-action { min-width: 0; display: grid; justify-items: center; gap: 7px; font-size: 14px; }
.call-action .call-control { width: clamp(52px, 14.4vw, 72px); height: clamp(52px, 14.4vw, 72px); background: #a0b3ff88; padding: 0; }
.call-action .call-control[aria-pressed="true"] { background: #fff; color: #7370cb; }
.call-action .call-control:disabled { opacity: .45; cursor: default; }
.call-action .call-hangup { background: #ff3835; }
.call-action .call-answer { background: #28bf59; }
.call-stage a:focus-visible,.call-stage button:focus-visible { outline:none; }
@media (min-width: 761px) { .call-stage { padding-bottom: 190px; } .call-identity .avatar { width: 180px; height: 180px; } }
@media (max-height: 540px) and (orientation: landscape) { .call-stage { padding: 44px 20px 110px; } .call-identity .avatar { width: 80px; height: 80px; margin-bottom: 12px; } .call-identity h1 { font-size: 24px; } .call-screen #media-actions { bottom: 20px; } }
#dialog[data-view="contact-profile"] .dialog-header { margin-bottom: 6px; }
.contact-profile-add-contact { display:flex; align-items:center; justify-content:center; gap:8px; width:100%; min-height:44px; margin-top:12px; padding:10px 14px; border:0; border-radius:14px; background:#ffffff26; color:white; font-size:16px; }
.contact-profile-add-contact:disabled { opacity:.75; cursor:default; }
[data-phone-app] #dialog[data-view="contact-profile"] .dialog-header { justify-content: start; }
[data-phone-app] #dialog[data-view="contact-profile"] {
  inset: 0; margin: 0; width: 100%; height: 100dvh; max-width: none; max-height: none;
  border: 0; border-radius: 0; padding: max(8px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
}
.contact-profile-hero {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 26px 14px 14px;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(155deg, #005e76, #244f8b);
}
.contact-profile-hero > p { font-size: 22px; }
.contact-profile-handle { color: #d1f4ff; }
.contact-profile-actions { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.profile-action {
  min-height: 54px; display: grid; place-items: center; gap: 2px;
  padding: 5px 2px; color: inherit; background: #ffffff24; border: 0; border-radius: 12px;
}
.profile-action:active { background: #ffffff3b; }
