/* Existing compact call chrome, bounded by the mobile page that owns it. */
@media (max-width: 768px) {
  /* Home stays mounted to preserve its state; its widget must leave with it. */
  ._pageFlightPanel_7kyn7_34[data-active="false"] [data-call-widget="true"] {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  /* Calls/Contacts: match their 24px page inset, 44px controls and 10px gap. */
  html[data-rm-call-header-route] [data-call-widget="true"][data-placement="global"] {
    top: calc(env(safe-area-inset-top, 0px) + 17px) !important;
    left: 78px !important;
    width: calc(100% - 156px) !important;
  }

  /* Settings has no flanking controls: reuse the same header chrome once. */
  [data-call-widget="true"][data-placement="settings"] {
    position: fixed;
    z-index: 2200;
    top: calc(env(safe-area-inset-top, 0px) + 17px);
    left: 24px;
    width: calc(100% - 48px);
    height: 44px;
  }
  html:has([data-call-widget="true"][data-placement="settings"])
    ._pageFlightPanel_7kyn7_34[data-active="true"] [data-mobile-page-title] {
    visibility: hidden;
    opacity: 0 !important;
    pointer-events: none;
  }

  /* Reserve space above pins/history, including when the keyboard is open. */
  ._chatSheet_12xvp_316 > [data-mobile-chat-call-widget-host] {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    height: 44px;
    flex: 0 0 44px;
    margin: 8px 14px;
  }
  [data-mobile-chat-call-widget-host]:empty { display: none; }
}

/* Preserve the original title behind the frosted search during a call. */
@media (max-width: 768px) {
  html[data-rm-call-header-search-open]
    ._pageFlightPanel_7kyn7_34[data-active="true"] [data-mobile-page-title] {
    opacity: 1 !important;
  }
}

/* Keep the original search backdrop inside its moving glass, not on the call. */
@media (max-width: 768px) {
  [data-call-search-backdrop] {
    position: absolute;
    inset: 0;
    pointer-events: none;
    clip-path: inset(0 calc(100% - 44px) 0 0 round 22px);
    transition: clip-path .36s cubic-bezier(.2, .82, .2, 1);
  }
  [data-search-open="true"] > [data-call-search-backdrop] {
    clip-path: inset(0 56px 0 0 round 22px);
  }
}
@media (prefers-reduced-motion: reduce) {
  [data-call-search-backdrop] { transition-duration: 1ms; }
}

/* Settings pages: the last row must stop just above the floating tab bar
   (63px from the bottom: 48px bar + 15px gap) with ~15px air, not a white void.
   The pane itself gets no extra room; the content block carries one measured gap. */
@media (max-width: 768px) {
  main[data-mobile-page-flight-sheet="true"] > [class*="viewPane"] {
    padding-bottom: 0 !important;
  }
  main[data-mobile-page-flight-sheet="true"] > [class*="viewPane"] > [class*="_panelContent_"],
  main[data-mobile-page-flight-sheet="true"] > [class*="viewPane"] > [class*="_mainContent_"] {
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)) !important;
  }
  /* A bare button as the last item has no row padding of its own. */
  main[data-mobile-page-flight-sheet="true"] > [class*="viewPane"] > [class*="_panelContent_"]:has(> button:last-child) {
    padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* Native iOS: preserve the existing Back control on nested Settings pages. */
@media (max-width: 768px) {
  html:has(._pageFlightPanel_7kyn7_34[data-active="true"] [data-native-ios="true"]:not([data-view="main"]) [data-mobile-page-action])
    [data-call-widget="true"][data-placement="settings"] {
      left: 78px;
      width: calc(100% - 102px);
  }
}

/* ios-runtime-v228 owns the normal dark status-area backing. A full call
   already paints that area and reserves its own safe inset for controls. */
html[data-rm-native-ios="true"]:has([data-call-surface="true"])
  #rm-ios-auth-status-surface {
  visibility: hidden !important;
}

@media (max-width: 768px) {
  /* Native sheets use their existing sizes and list scrolling. */
  [data-rm-motion-sheet] {
    --rm-sheet-curve: cubic-bezier(.22, 1, .36, 1);
    --rm-sheet-duration: 260ms;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  [data-rm-motion-sheet] > .rm-motion-veil {
    position: absolute;
    inset: 0;
    background: rgb(0 0 0 / .36);
    pointer-events: none;
    opacity: 1;
    transition: opacity var(--rm-sheet-duration) var(--rm-sheet-curve);
  }
  [data-rm-motion-sheet] > section {
    position: relative;
    opacity: 1;
    transform: translate3d(0, 0, 0);
    transition: transform var(--rm-sheet-duration) var(--rm-sheet-curve), opacity 145ms ease-out;
  }
  [data-rm-motion-sheet="closing"] { pointer-events: none; --rm-sheet-duration: 215ms; }
  [data-rm-motion-sheet="closing"] > .rm-motion-veil { opacity: 0; }
  [data-rm-motion-sheet="closing"] > section {
    transform: translate3d(0, calc(100% + 20px), 0);
    opacity: .92;
  }
  @starting-style {
    [data-rm-motion-sheet="open"] > .rm-motion-veil { opacity: 0; }
    [data-rm-motion-sheet="open"] > section { transform: translate3d(0, calc(100% + 20px), 0); opacity: .92; }
  }
  .rm-motion-handle-zone {
    display: grid;
    place-items: center;
    min-height: 28px;
    margin-top: -3px;
    margin-bottom: -3px;
    touch-action: none;
  }
  .rm-motion-handle-zone > span { margin: 0; pointer-events: none; }

  /* The provisional bubble rises toward the scroll edge next to the composer. */
  ._room_12xvp_216 [data-sent-entry="true"] ._ownMessage_12xvp_973 {
    transform-origin: calc(100% - 9px) 100%;
    animation: rm-mobile-own-arrival 215ms cubic-bezier(.22,.82,.22,1) backwards;
    will-change: auto;
  }
  @keyframes rm-mobile-own-arrival {
    from { transform: translate3d(3px, 19px, 0) scale(.94,.91); opacity: .63; }
    62% { transform: translate3d(0,-1px,0) scale(1.006,1); opacity: 1; }
    to { transform: translate3d(0,0,0) scale(1); opacity: 1; }
  }

  [data-mobile-chat-composer] ._recordLiveWave_12xvp_3584 i { transition: transform 100ms cubic-bezier(.22,1,.36,1); }
  [data-mobile-chat-composer] ._recordingState_12xvp_3517[data-starting="true"] ._recordLiveWave_12xvp_3584 i,
  [data-mobile-chat-composer] ._recordingState_12xvp_3517[data-intro="true"]:not([data-starting="true"]) ._recordLiveWave_12xvp_3584 i { animation: none; }
  [data-mobile-chat-composer] ._recordingState_12xvp_3517[data-starting="true"] ._recordDot_12xvp_3567 {
    background: none;
    border: 1.5px solid currentColor;
    animation: none;
  }
  [data-mobile-chat-composer] ._recordingState_12xvp_3517[data-starting="true"] ._recordTimer_12xvp_3577 {
    width: auto;
    flex: none;
    font-variant-numeric: tabular-nums;
  }
  [data-mobile-chat-composer] ._recordingState_12xvp_3517[data-phase="discarding"] {
    transform-origin: 15px 50%;
    animation: rm-mobile-voice-discard 135ms cubic-bezier(.22,1,.36,1) both;
  }
  @keyframes rm-mobile-voice-discard {
    to { transform: translate3d(-9px,0,0) scale(.95,.88); opacity: 0; }
  }

  [data-rm-settings-icon] { flex: none; width: 23px; height: 23px; }
  [class*="_rowIcon_ese6i_"] > [data-rm-settings-icon] { width: 21px; height: 21px; }

  /* Call controls share one reflective surface, with solid semantic end
     controls. The call canvas and native camera frame geometry stay stable. */
  [data-call-surface] {
    --rm-call-material: linear-gradient(152deg, #555a5c 0%, #363b3d 36%, #252a2b 100%);
    --rm-call-edge: #ffffff42;
    --rm-call-dark: #171c1e;
  }
  [data-call-surface] ._callControls_ojzbx_493,
  [data-call-surface] ._groupControls_ojzbx_1108 {
    gap: clamp(7px, 2.5vw, 12px);
  }
  [data-call-surface] :is(._voiceScreen_ojzbx_490, ._videoScreen_ojzbx_735, ._groupScreen_ojzbx_872) ._glassControl_ojzbx_581,
  [data-call-widget][data-placement] ._glassControl_ojzbx_581 {
    color: #fff;
    background: var(--rm-call-material, linear-gradient(152deg,#5c6264,#2d3335 70%));
    border: 1px solid var(--rm-call-edge, #ffffff40);
    box-shadow: inset 0 1px 0 #ffffff30, inset 0 -1px 0 #00000036, 0 3px 9px #00000039;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    transition: transform 155ms cubic-bezier(.22,1,.36,1);
  }
  [data-call-surface] :is(._voiceScreen_ojzbx_490, ._videoScreen_ojzbx_735, ._groupScreen_ojzbx_872) ._glassControl_ojzbx_581:active,
  [data-call-widget][data-placement] ._glassControl_ojzbx_581:active {
    transform: scale(.92);
    transition-duration: 75ms;
  }
  [data-call-surface] :is(._voiceScreen_ojzbx_490, ._videoScreen_ojzbx_735, ._groupScreen_ojzbx_872) ._glassControl_ojzbx_581[aria-pressed="true"]:not([data-icon="microphone"], [data-icon="chat"]),
  [data-call-widget][data-placement] ._glassControl_ojzbx_581[aria-pressed="true"] {
    background: linear-gradient(145deg, #fff, #dce5e5);
    color: #151918;
    box-shadow: inset 0 1px 0 #fff, 0 2px 8px #0004;
  }
  [data-call-surface] :is(._voiceScreen_ojzbx_490, ._videoScreen_ojzbx_735, ._groupScreen_ojzbx_872) ._glassControl_ojzbx_581[aria-pressed="true"]:not([data-icon="microphone"], [data-icon="chat"]) img,
  [data-call-widget][data-placement] ._glassControl_ojzbx_581[aria-pressed="true"] img {
    filter: brightness(0) saturate(100%);
  }
  [data-call-surface] :is(._voiceScreen_ojzbx_490, ._videoScreen_ojzbx_735, ._groupScreen_ojzbx_872) ._dangerControl_ojzbx_652,
  [data-call-widget][data-placement] ._dangerControl_ojzbx_652 {
    background: linear-gradient(150deg,#e24a53,#be2535 68%,#a61e2d);
    border-color: #ff919956;
    box-shadow: inset 0 1px 0 #ffffff27, 0 4px 10px #35000870;
  }
  [data-call-widget][data-placement] ._activeCallChrome_ojzbx_1227 {
    background: linear-gradient(164deg,#313b3de8,#1e2829ed);
    border: 1px solid #ffffff24;
    box-shadow: inset 0 1px 0 #ffffff16, 0 3px 12px #00000030;
  }
  [data-call-widget][data-placement] ._activeCallMain_ojzbx_1246 strong {
    color: #f5f8f9 !important;
  }
  [data-call-widget][data-placement] ._activeCallMain_ojzbx_1246 small {
    color: #cedbdd !important;
  }
  [data-call-surface] ._callControls_ojzbx_493:focus-within ._glassControl_ojzbx_581:focus-visible,
  [data-call-widget][data-placement] ._glassControl_ojzbx_581:focus-visible { outline: 2px solid #f5fafb; outline-offset: 2px; }

  [data-call-surface] :is(._voiceScreen_ojzbx_490, ._videoScreen_ojzbx_735, ._groupScreen_ojzbx_872) ._backButton_ojzbx_539 {
    border: 1px solid var(--rm-call-edge);
    background: var(--rm-call-material);
    box-shadow: inset 0 1px 0 #ffffff28, 0 4px 11px #0004;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  [data-call-surface] :is(._voiceScreen_ojzbx_490, ._videoScreen_ojzbx_735, ._groupScreen_ojzbx_872) ._backButton_ojzbx_539 img {
    filter: brightness(0) invert(1);
  }

  .rm-motion-call-arrival {
    display: block;
    position: absolute;
    z-index: 8;
    left: 0;
    right: 0;
    background: var(--rm-call-sheet-flash, #f4f3f0);
    border-radius: 24px 24px 0 0;
    pointer-events: none;
    transform-origin: 50% 0;
    animation: rm-mobile-call-arrival 245ms cubic-bezier(.22,.86,.31,1) both;
  }
  html[data-theme="dark"] .rm-motion-call-arrival { --rm-call-sheet-flash: #242627; }
  @keyframes rm-mobile-call-arrival {
    from { opacity: .92; transform: translate3d(0,0,0) scale(1); }
    55% { opacity: .34; }
    to { opacity: 0; transform: translate3d(0,-90px,0) scale(1,.3); }
  }
  [data-call-surface] ._videoStatus_ojzbx_776 {
    display: grid;
    justify-items: center;
    gap: 2px;
    max-width: calc(100% - 136px);
    min-width: 0;
    overflow: hidden;
    border: 1px solid #ffffff24;
    border-radius: 18px;
    padding: 7px 12px;
    background: rgb(13 18 20 / .82);
    color: #f1f5f6;
  }
  [data-call-surface] ._videoStatus_ojzbx_776 :is(strong, small) {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  [data-call-surface] ._videoStatus_ojzbx_776 strong { font-size: 13px; font-weight: 650; }
  [data-call-surface] ._videoStatus_ojzbx_776 small { font-size: 11px; color: #c6ccce; }
  [data-call-surface] ._localPip_ojzbx_792 {
    top: calc(var(--call-safe-top) + 71px);
    right: 14px;
    width: clamp(94px, 28vw, 132px);
    border: 1px solid #ffffff48;
    border-radius: 17px;
    box-shadow: 0 9px 28px #0007;
    will-change: auto;
  }
  [data-call-surface] ._localPip_ojzbx_792[data-dragging="true"] { will-change: transform; }
  [data-call-surface] ._groupScreen_ojzbx_872 {
    background: #141a1c;
  }
  [data-call-surface] ._participantTray_ojzbx_1112 {
    background: #1b2224;
    color: #f5f8f9;
  }
  [data-call-surface] ._participantName_ojzbx_1173 {
    color: #edf3f4;
  }
  [data-call-surface] ._groupMediaTile_ojzbx_930 {
    border-radius: 17px;
    background-color: #202829;
    box-shadow: inset 0 0 0 1px #ffffff26;
  }
  [data-call-surface] ._groupTileLabel_ojzbx_983 {
    border-radius: 10px;
    background-color: #111719d9;
    color: #f8fafb;
  }
}
@media (max-width: 768px) and (prefers-reduced-transparency: reduce),
       (max-width: 768px) and (prefers-contrast: more) {
  [data-call-widget][data-placement] ._activeCallChrome_ojzbx_1227 {
    background: #252b2d;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-color: #ffffff67;
  }
  [data-call-surface] ._videoStatus_ojzbx_776,
  [data-call-surface] ._groupTileLabel_ojzbx_983 { background: #161b1e; }
}
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  [data-rm-motion-sheet] { --rm-sheet-duration: 55ms; }
  [data-rm-motion-sheet] > section { transform: none !important; transition: opacity 55ms linear; }
  [data-rm-motion-sheet="closing"] > section { opacity: 0; }
  [data-mobile-chat-composer] ._recordLiveWave_12xvp_3584 i,
  [data-call-surface] ._glassControl_ojzbx_581,
  [data-call-widget] ._glassControl_ojzbx_581 { transition: none; }
  .rm-motion-call-arrival { display: none; }
  ._room_12xvp_216 [data-sent-entry="true"] ._ownMessage_12xvp_973,
  [data-mobile-chat-composer] ._recordingState_12xvp_3517[data-phase="discarding"] { animation: none; }
}

@media (max-width: 768px) {
  [data-rm-settings-motion] ._bodyForward_ese6i_169 {
    animation: rm-settings-pane-forward 205ms cubic-bezier(.22,1,.36,1) both;
  }
  [data-rm-settings-motion] ._bodyBack_ese6i_173 {
    animation: rm-settings-pane-back 195ms cubic-bezier(.22,1,.36,1) both;
  }
  @keyframes rm-settings-pane-forward {
    from { transform: translate3d(26px,0,0); opacity: .64; }
    to { transform: translate3d(0,0,0); opacity: 1; }
  }
  @keyframes rm-settings-pane-back {
    from { transform: translate3d(-23px,0,0); opacity: .75; }
    to { transform: translate3d(0,0,0); opacity: 1; }
  }
}
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  [data-rm-settings-motion] :is(._bodyForward_ese6i_169, ._bodyBack_ese6i_173) {
    animation: none;
  }
}
