/* Desktop-only height constraint — keeps phone frame from overflowing short viewports */
@media (min-width: 521px) and (max-height: 720px) {
  .phone-frame {
    height: calc(100vh - 24px);
    min-height: 620px;
  }

  header {
    padding-top: 34px;
  }
}

/* Smartphone: strip the frame, fill the screen natively */
@media (max-width: 520px) {
  html, body {
    height: 100%;
    /* Prevents elastic bounce that can reveal the page background behind the app */
    overscroll-behavior: none;
  }

  body {
    padding: 0;
    background: var(--bg-color);
    align-items: flex-start;
  }

  /* Fill the full dynamic viewport — adjusts as browser chrome shows/hides */
  .phone-frame {
    position: fixed;
    inset: 0;
    /* dvh adjusts dynamically as the iOS toolbar shows/hides */
    height: 100dvh;
    width: 100%;
    min-height: unset;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }

  .notch {
    display: none;
  }

  header {
    border-radius: 0;
    /* Gradient bleeds behind translucent status bar */
    padding-top: calc(env(safe-area-inset-top, 44px) + 10px);
  }

  header.collapsed {
    padding-top: calc(env(safe-area-inset-top, 44px) + 8px);
    padding-bottom: 14px;
  }

  .content {
    padding-bottom: calc(env(safe-area-inset-bottom, 20px) + 80px);
    scroll-padding-bottom: calc(env(safe-area-inset-bottom, 20px) + 80px);
  }

  nav {
    border-radius: 0;
    /* Home indicator safe area */
    padding-bottom: calc(env(safe-area-inset-bottom, 20px) + 8px);
  }
}
