/* The same application fills the browser on desktop and on phones. */
html, body, #paddle-mobile-app {
  width: 100%;
  min-height: 100%;
}

.pm-stage {
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
  padding: 0;
  background: var(--pm-canvas);
}

.pm-stage::before,
.pm-stage::after,
.pm-device::before {
  display: none;
}

.pm-device,
.pm-phone {
  width: 100%;
  height: 100%;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.pm-phone {
  background: var(--pm-canvas);
  -webkit-user-select: text;
  user-select: text;
}

.pm-scroll {
  inset: 0;
}

.pm-onboarding {
  inset: 0;
}

.pm-chat-topbar,
.pm-editor-topbar {
  top: var(--safe-top);
}

.pm-chat-thread,
.pm-chat-thread::before {
  inset: calc(62px + var(--safe-top)) 0 0;
}

@media (min-width: 769px) {
  .pm-stage {
    display: grid;
    grid-template-columns: 276px minmax(0, 1fr);
    align-items: stretch;
  }

  .pm-route-rail {
    display: grid;
    position: relative;
    top: auto;
    right: auto;
    grid-column: 1;
    grid-row: 1;
    width: auto;
    min-width: 0;
    max-height: none;
    height: 100dvh;
    transform: none;
    padding: 24px 16px 18px;
    border: 0;
    border-right: 1px solid var(--pm-line);
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    backdrop-filter: none;
  }

  .pm-route-rail__head strong { font-size: 22px; }
  .pm-route-rail__head p { font-size: 11px; }
  .pm-role-rail button { min-height: 44px; }
  .pm-role-rail strong { font-size: 11px; }

  .pm-device {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .pm-tabbar {
    top: 0;
    right: 0;
    bottom: auto;
    left: 0;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    padding: 10px 24px;
    border: 0;
    border-bottom: 1px solid var(--pm-line);
    border-radius: 0;
    background: rgba(255,255,255,.94);
    box-shadow: none;
  }

  .pm-tab {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 13px;
    white-space: nowrap;
  }

  .pm-tab__icon { padding: 0; }
  .pm-tab small { font-size: 12px; }
  .pm-tab.is-active { background: var(--pm-blue-soft); }
  .pm-phone--tabbar .pm-screen { top: 72px; }

  .pm-screen > .pm-scroll {
    max-width: 1160px;
    margin-inline: auto;
    padding: 24px 36px 64px;
    scrollbar-width: auto;
  }

  .pm-header { min-height: 76px; }
  .pm-header__copy { text-align: left; }
  .pm-header__copy p { font-size: 10px; }
  .pm-header__copy h1 { font-size: 26px; }
  .pm-section-head { margin-top: 22px; }
  .pm-section-head h2 { font-size: 20px; }
  .pm-hero-card { min-height: 240px; }

  .pm-sheet {
    left: 50%;
    right: auto;
    bottom: 24px;
    width: min(520px, calc(100% - 48px));
    max-height: min(720px, calc(100% - 48px));
    transform: translateX(-50%);
    border-radius: 24px;
  }

  .pm-toast {
    left: 50%;
    right: auto;
    width: min(500px, calc(100% - 48px));
    transform: translateX(-50%);
  }
}

@media (min-width: 769px) and (max-width: 1000px) {
  .pm-tabbar { padding-inline: 12px; }
  .pm-tab { gap: 3px; padding-inline: 7px; }
  .pm-tab small { font-size: 10px; }
}

@media (min-width: 1200px) {
  .pm-home .pm-quick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pm-home .pm-quick-card { min-height: 104px; height: auto; }
}

@media (max-width: 768px) {
  html, body, #paddle-mobile-app { height: 100%; overflow: hidden; }
  /* Preserve scrolling while preventing page zoom from gestures inside the app. */
  .pm-stage { display: block; touch-action: pan-x pan-y; }
  .pm-route-rail { display: none; }
  .pm-device, .pm-phone { height: 100dvh; }
  .pm-scroll { inset: 0; padding-top: calc(6px + var(--safe-top)); }
  .pm-onboarding { padding-top: var(--safe-top); }
  .pm-chat-topbar, .pm-editor-topbar { top: var(--safe-top); }
  .pm-chat-thread, .pm-chat-thread::before { inset: calc(62px + var(--safe-top)) 0 0; }
}
