.chat-page .capture-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

.chat-page .call-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    width: 44px;
    min-height: 44px;
    padding: 5px;
    border: 1px solid #b8a8ad;
    border-radius: 10px;
    background: #fcfaf7;
    cursor: pointer;
}

.call-button span {
    font: 26px/1 "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

.call-button:disabled { opacity: .5; cursor: default; }
.call-button:focus-visible, .call-panel button:focus-visible { outline: 3px solid #b8a8ad; outline-offset: 2px; }

.call-notice {
    flex-shrink: 0;
    margin: 5px 0 0;
    color: #65414a;
    font-size: 17px;
    line-height: 1.2;
}

.call-panel {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    background: rgba(38, 34, 36, .78);
    overflow: auto;
    overscroll-behavior: contain;
}

.call-surface {
    width: 100%;
    max-width: 680px;
    max-height: 100%;
    overflow-y: auto;
    border: 1px solid #d6c4c5;
    border-radius: 18px;
    padding: 14px;
    color: #30363c;
    background: #fcfaf7;
    box-shadow: 0 8px 35px rgba(0, 0, 0, .2);
}

.call-panel h2 { margin: 0 0 5px; font-size: 28px; line-height: 1.1; overflow-wrap: anywhere; }
.call-picker-status, .call-status { margin: 5px 0 10px; font-size: 21px; line-height: 1.2; }
.call-peers { display: grid; gap: 7px; max-height: 50dvh; overflow-y: auto; }
.call-peer { min-height: 48px; width: 100%; text-align: left; overflow-wrap: anywhere; }
.call-panel button { min-height: 44px; padding: 6px 12px; border: 1px solid #b8a8ad; border-radius: 10px; font: inherit; font-size: 20px; color: #65414a; background: #f2e9e3; cursor: pointer; }
.call-panel button:disabled { opacity: .5; cursor: default; }
.call-picker-actions, .call-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-top: 12px; }
.call-picker-actions .call-picker-close { margin-left: auto; }
.call-panel .call-accept { background: #e0ecdf; color: #245533; border-color: #8caa8f; }
.call-panel .call-decline, .call-panel .call-end { background: #f5dddd; color: #8a263c; border-color: #c18f9a; }
.call-panel button[aria-pressed="true"] { background: #e1d5d9; border-color: #8f6573; }
.call-video-stage { position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 58dvh; min-height: 130px; border-radius: 12px; overflow: hidden; background: #292b30; }
.call-remote-video { display: block; width: 100%; height: 100%; object-fit: contain; }
.call-local-video { position: absolute; bottom: 10px; right: 10px; width: 25%; max-width: 150px; height: 30%; min-width: 75px; object-fit: cover; border: 1px solid rgba(255, 255, 255, .7); border-radius: 9px; background: #292b30; transform: scaleX(-1); }
.call-hint { margin: 10px 0 0; color: #667085; font-size: 17px; line-height: 1.2; }
.call-camera-status { margin: 5px 0 10px; font-size: 18px; line-height: 1.2; overflow-wrap: anywhere; }
.call-panel .call-expand {
    flex: 0 0 44px;
    width: 44px;
    padding: 0;
    font: 26px/1 system-ui, sans-serif;
}

@media (max-height: 500px) {
    .call-surface { max-width: 820px; padding: 9px; }
    .call-panel h2 { font-size: 22px; }
    .call-picker-status, .call-status { font-size: 18px; margin-bottom: 5px; }
    .call-video-stage { max-height: 45dvh; min-height: 100px; }
    .call-actions { gap: 5px; margin-top: 6px; }
    .call-panel button { font-size: 17px; padding: 4px 8px; }
    .call-hint { font-size: 15px; margin-top: 5px; }
}

/* Keep the call controls in our own viewport, including on iPhone. */
.call-panel.is-expanded {
    width: 100%;
    height: 100%;
    height: 100dvh;
    padding: 0;
    overflow: hidden;
    background: #18191d;
}

.call-panel.is-expanded .call-surface {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-width: none;
    max-height: none;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: #18191d;
}

.call-panel.is-expanded .call-view {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.call-panel.is-expanded .call-video-stage {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    aspect-ratio: auto;
    border-radius: 0;
}

.call-panel.is-expanded .call-remote-video { object-fit: cover; }

.call-panel.is-expanded .call-heading {
    position: absolute;
    z-index: 2;
    top: 0;
    left: 0;
    right: 0;
    min-width: 0;
    padding: max(12px, env(safe-area-inset-top))
        calc(clamp(76px, 24vw, 140px) + max(24px, env(safe-area-inset-right)))
        34px max(16px, env(safe-area-inset-left));
    color: #fff;
    background: linear-gradient(rgba(0, 0, 0, .65), transparent);
    text-shadow: 0 1px 3px #000;
    pointer-events: none;
}

.call-panel.is-expanded .call-status { margin-bottom: 0; }

.call-panel.is-expanded .call-local-video {
    z-index: 2;
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    bottom: auto;
    width: clamp(76px, 24vw, 140px);
    height: auto;
    max-width: 140px;
    min-width: 0;
    aspect-ratio: 4 / 3;
}

.call-panel.is-expanded .call-actions {
    position: absolute;
    z-index: 3;
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    margin: 0;
    padding: 8px;
    border-radius: 14px;
    background: rgba(24, 25, 29, .7);
}

.call-panel.is-expanded .call-hint { display: none; }

.call-remote-grid {position:absolute;inset:0;display:grid;grid-template-columns:1fr;gap:4px;background:#292b30;}
.call-remote-grid[hidden],.call-invite-view[hidden] {display:none;}
.call-remote-tile {position:relative;min-width:0;min-height:0;overflow:hidden;background:#292b30;}
.call-mesh-video {width:100%;height:100%;object-fit:contain;display:block;}
.call-mesh-video[hidden] {display:none;}
.call-remote-label {position:absolute;bottom:0;left:0;right:0;padding:5px 8px;color:#fff;font-size:18px;line-height:1.1;overflow-wrap:anywhere;background:linear-gradient(transparent,#000b);pointer-events:none;}
.call-video-stage.is-conference {--mesh-top:0px;--mesh-bottom:0px;}
.call-video-stage.is-conference .call-remote-grid {grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));padding:var(--mesh-top) 4px var(--mesh-bottom);gap:4px;}
.call-video-stage.is-conference .call-local-video {top:auto;bottom:var(--mesh-bottom);right:4px;max-width:none;min-width:0;width:calc(50% - 6px);height:calc((100% - var(--mesh-top) - var(--mesh-bottom) - 4px)/2);border-radius:0;object-fit:contain;}
.call-panel.is-expanded .call-video-stage.is-conference {--mesh-top:70px;--mesh-bottom:110px;}
.call-panel.is-expanded .call-video-stage.is-conference .call-mesh-video {object-fit:contain;}
.call-panel.is-expanded .call-video-stage.is-conference .call-local-video {top:auto;bottom:var(--mesh-bottom);right:4px;width:calc(50% - 6px);height:calc((100% - var(--mesh-top) - var(--mesh-bottom) - 4px)/2);max-width:none;aspect-ratio:auto;}
.call-invite-view {position:relative;margin-top:10px;padding:12px;border:1px solid #b8a8ad;border-radius:12px;background:#fcfaf7;z-index:5;}
.call-invite-view h3 {font-size:25px;margin:0 0 6px;}
.call-invite-status {font-size:20px;line-height:1.2;margin:6px 0;}
.call-invite-view .call-invite-close {margin-top:10px;}
.call-panel.is-expanded .call-invite-view {position:absolute;inset:70px 12px 100px;overflow:auto;max-width:500px;margin:0 auto;}
@media(orientation:landscape) and (max-height:600px){
 .call-panel.is-expanded .call-video-stage.is-conference {--mesh-top:42px;--mesh-bottom:78px;}
 .call-panel.is-expanded .call-invite-view {inset:40px 12px 72px;}
}
