.voice-call-dialog {
    position: fixed;
    inset: 0;
    inline-size: 100%;
    max-inline-size: none;
    block-size: 100%;
    block-size: 100dvh;
    max-block-size: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    padding: 0;
    overflow: auto;
    scrollbar-width: none;
    animation: none;
    background: #160e1b;
    color: #fff8fe;
    color-scheme: dark;
}

.voice-call-dialog:modal,
.voice-call-dialog::backdrop {
    overscroll-behavior: contain;
}

.voice-call-dialog::backdrop {
    overflow: hidden;
    animation: none;
    background: #160e1b;
}

.voice-call-screen {
    min-block-size: 100%;
    position: relative;
    isolation: isolate;
    overflow: clip;
    display: grid;
    grid-template-rows: minmax(auto, 1.25fr) minmax(auto, 1fr) auto;
    justify-items: center;
    row-gap: clamp(16px, 3dvh, 34px);
    padding-block: max(28px, env(safe-area-inset-top)) max(38px, calc(env(safe-area-inset-bottom) + 18px));
    padding-inline: max(20px, env(safe-area-inset-left)) max(20px, env(safe-area-inset-right));
    background: radial-gradient(ellipse at 50% 78%, #56334b, #1c1324 75%);
}

.voice-call-background,
.voice-call-shade {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    z-index: -1;
}

.voice-call-background {
    object-fit: cover;
    object-position: center;
    filter: blur(64px) saturate(.85);
    opacity: .7;
    transform: scale(1.3);
}

.voice-call-shade {
    background: linear-gradient(180deg, #211927c9, #251a2966 54%, #211322b3);
}

.voice-call-identity {
    display: grid;
    align-self: center;
    justify-items: center;
    inline-size: min(100%, 30rem);
    min-inline-size: 0;
    text-align: center;
}

.voice-call-avatar {
    position: relative;
    display: grid;
    place-items: center;
    inline-size: clamp(76px, 13dvh, 112px);
    aspect-ratio: 1;
    margin-block-end: 18px;
    overflow: clip;
    border-radius: 50%;
    background: #70486a;
    color: #ffe0f5;
    font-size: 2rem;
}

.voice-call-avatar img {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
    object-position: 50% 28%;
}

.voice-call-identity h2 {
    max-inline-size: 100%;
    margin: 0;
    font-size: clamp(2rem, 8vw, 2.7rem);
    line-height: 1.08;
    font-weight: 600;
    letter-spacing: -.045em;
    overflow-wrap: anywhere;
}

.voice-call-timer {
    margin-block-start: 9px;
    color: #f3dfee;
    font-variant-numeric: tabular-nums;
    font-size: 1.3rem;
    line-height: 1.15;
}

.voice-call-status-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-inline-size: 100%;
    min-block-size: 1.35rem;
    margin-block-start: 8px;
}

.voice-call-status {
    min-inline-size: 0;
    max-inline-size: 36ch;
    margin: 0;
    color: #dfcadc;
    font-size: .87rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.voice-call-dialog[data-call-state="ended"] .voice-call-status { color: #ffb1cc; }

.voice-call-wave {
    display: none;
    align-items: center;
    gap: 2px;
    color: #ff9dd1;
}

.voice-call-wave i {
    inline-size: 2px;
    block-size: 6px;
    border-radius: 9px;
    background: currentColor;
}

.voice-call-wave i:nth-child(2) { block-size: 11px; }

.voice-call-dialog[data-call-state="speaking"] .voice-call-wave { display: flex; }
.voice-call-dialog[data-call-state="speaking"] .voice-call-wave i { animation: voice-call-pulse .66s ease-in-out infinite alternate; }
.voice-call-dialog[data-call-state="speaking"] .voice-call-wave i:nth-child(2) { animation-delay: .18s; }

@keyframes voice-call-pulse {
    from { transform: scaleY(.65); opacity: .65; }
    to { transform: scaleY(1.5); opacity: 1; }
}

.voice-call-controls {
    display: flex;
    align-self: center;
    align-items: start;
    justify-content: center;
    gap: clamp(28px, 9vw, 50px);
}

.voice-call-action {
    background: transparent;
    color: #fff7fc;
    padding: 0;
    display: grid;
    justify-items: center;
    gap: 8px;
    text-align: center;
    line-height: 1.2;
    font-size: .88rem;
    font-weight: 500;
}

.voice-call-action:disabled { cursor: default; opacity: .45; }

.voice-call-control-icon {
    position: relative;
    display: grid;
    place-items: center;
    inline-size: clamp(58px, 10dvh, 76px);
    aspect-ratio: 1;
    border-radius: 50%;
    background: #ffe9fc29;
}

.voice-call-control-icon .icon { inline-size: 26px; block-size: 26px; }

.voice-call-action[aria-pressed="true"] .voice-call-control-icon {
    background: #ffe4f5;
    color: #43243d;
}

.voice-call-action[aria-pressed="true"] .voice-call-control-icon::after {
    content: "";
    position: absolute;
    inline-size: 27px;
    block-size: 2px;
    border-radius: 99px;
    background: currentColor;
    box-shadow: 0 -2px #ffe4f5;
    transform: rotate(47deg);
}

.voice-call-hangup {
    margin-block-end: clamp(0px, 5dvh, 45px);
}

.voice-call-hangup .voice-call-control-icon {
    inline-size: clamp(64px, 11dvh, 82px);
    background: #f44561;
    color: #fff;
}

.voice-call-hangup .icon {
    inline-size: 30px;
    block-size: 30px;
    transform: rotate(135deg);
}

.chat-voice-actions {
    position: absolute;
    inset: 50% 6px auto auto;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
}

body[data-page="chat"] .chat-header:has(.chat-voice-actions) { padding-inline: 90px; }
.chat-voice-actions .icon-button { width: 42px; height: 44px; background: transparent; color: #ff93ce; }
.chat-voice-actions .icon-button .icon { width: 20px; height: 20px; }
body[data-page="chat"] .chat-identity span { text-align: center; overflow-wrap: anywhere; }

.chat-reply-dialog {
    width: min(92vw, 390px);
    padding: 24px;
    border: none;
    border-radius: 24px;
    background: #211427;
    color: #fbeefa;
}

.chat-reply-dialog::backdrop { background: #100816a6; }
.chat-reply-dialog h2 { margin: 0 32px 18px 0; font-size: 1.25rem; }
.reply-choice {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    color: #fceafa;
    background: #f0b0e710;
    border-radius: 12px;
    text-align: start;
}

.reply-choice + .reply-choice { margin-top: 8px; }
.reply-choice[aria-pressed="true"] { background: #e465b23a; }
.reply-choice-check,
.reply-choice-premium { margin-inline-start: auto; }
.reply-choice-check { display: none; color: #ffa0d3; }
.reply-choice[aria-pressed="true"] .reply-choice-check { display: inline; }
.reply-choice-premium { color: #f2a3d0; font-size: .75rem; }
.reply-choice .icon { width: 19px; height: 19px; }

.profile-actions > .profile-call-button { flex: 0 0 46px; width: 46px; padding-inline: 0; }
.profile-call-button .icon { width: 18px; height: 18px; }

body[data-page="chat"] .message-group .message-voice {
    width: min(18rem, 100%);
    min-width: min(15rem, 100%);
    padding: 5px 8px;
    border-radius: 18px;
    background: var(--im-incoming, #2b2133);
}

.message-voice audio {
    display: block;
    width: 100%;
    height: 38px;
    color-scheme: dark;
}

.message-voice-transcript { padding: 3px 7px 6px; font-size: .82rem; color: #e4c9e5; }
.message-voice-transcript summary { cursor: pointer; width: fit-content; }
.message-voice-transcript p { margin: .45em 0 0; }

@media (max-height: 530px) {
    .voice-call-screen {
        padding-block: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-bottom));
        row-gap: 12px;
    }

    .voice-call-avatar { inline-size: 62px; margin-block-end: 10px; }
    .voice-call-identity h2 { font-size: 1.8rem; }
    .voice-call-hangup { margin-block-end: 0; }
}

@media (orientation: landscape) and (max-height: 530px) {
    .voice-call-screen {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-rows: minmax(auto, 1fr) minmax(auto, 1fr);
        align-items: center;
    }

    .voice-call-identity { grid-row: span 2; }
    .voice-call-controls { align-self: end; }
    .voice-call-hangup { align-self: start; }
}

@media (prefers-reduced-motion: reduce) {
    .voice-call-dialog[data-call-state="speaking"] .voice-call-wave i { animation: none; }
}
