/* Match the installed home screen to its paper palette. Call headings keep
   their shared contrast surfaces; installed mode only adds the safe inset. */
@media (display-mode: standalone) {
  :root { --app-safe-top: env(safe-area-inset-top, 0px); }
  /* iOS 26 (WebKit 301108) can hand an installed app a viewport shorter than
     the screen by the status bar, often after coming back from another app,
     leaving a strip under the tab bar and call controls. It only does this
     while the page is shorter than the screen, so the page is made screen
     tall. The lvh cap keeps the page from scrolling when the top inset is
     0 but lvh still reads as the whole screen (WebKit 316008). */
  html { min-height: min(100lvh, calc(100% + var(--app-safe-top))); }
  html::before {
    content: "";
    position: fixed;
    inset: 0 0 auto;
    height: var(--app-safe-top);
    background: #f4f3ee;
    z-index: 50;
    pointer-events: none;
  }
  html:has(body.in-call)::before { display: none; }
  body:not(.in-call) .topbar {
    height: calc(80px + var(--app-safe-top));
    padding-top: var(--app-safe-top);
    background: #f4f3ee;
  }
  :root body .modal {
    max-height: min(90dvh, calc(100dvh - 2 * var(--app-safe-top) - 24px));
  }
  :root body.in-call .call[data-companion-theme] .call-heading {
    padding-top: calc(var(--app-safe-top) + 14px);
  }
}
