/* OST · Apps viewer — full-screen in-page window for apps deployed from OST Studio (#app=<slug>).
   Above every site layer (appbar 99500, sheets ~1000500, microfx 2000000), below toasts (2147483000).
   Selectors start with #ostAppsViewer so mobile-shell.css's global `body.ost-mobile-shell *`
   (min-width:0 / max-width:100% / overflow-wrap:anywhere) cannot squash the bar. */
html.oav-lock, html.oav-lock body { overflow: hidden !important; overscroll-behavior: none; }

#ostAppsViewer {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100%; max-width: none; height: 100%; height: 100dvh;
  z-index: 2147482000; display: flex; flex-direction: column;
  background: #05070d; color: #e6eaf2;
  font: 14px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; isolation: isolate; text-align: left;
}
#ostAppsViewer[hidden] { display: none !important; }
#ostAppsViewer:focus { outline: none; }
#ostAppsViewer *, #ostAppsViewer *::before, #ostAppsViewer *::after { box-sizing: border-box; overflow-wrap: normal; }

#ostAppsViewer .oav-bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px; min-width: 0; margin: 0;
  padding: calc(8px + env(safe-area-inset-top, 0px)) calc(10px + env(safe-area-inset-right, 0px)) 8px calc(12px + env(safe-area-inset-left, 0px));
  background: #0b1020; border-bottom: 1px solid rgba(255, 255, 255, .09);
}
#ostAppsViewer .oav-ico {
  flex: 0 0 auto; width: 32px; min-width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-size: 18px; line-height: 1;
  background: linear-gradient(135deg, rgba(109, 159, 255, .25), rgba(167, 139, 250, .25)); border: 1px solid rgba(109, 159, 255, .3);
}
#ostAppsViewer .oav-meta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
#ostAppsViewer .oav-name { margin: 0; font-weight: 800; font-size: 15px; line-height: 1.25; color: #f5f7fb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#ostAppsViewer .oav-by { font-size: 12px; color: #93a0b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#ostAppsViewer .oav-acts { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; min-width: max-content; }
#ostAppsViewer .oav-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; min-width: 34px; max-width: none; padding: 0 12px; margin: 0;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06);
  color: #e6eaf2; font: 600 13px/1 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; text-decoration: none; text-transform: none; letter-spacing: 0;
  cursor: pointer; white-space: nowrap; flex: 0 0 auto; box-shadow: none; -webkit-tap-highlight-color: transparent;
}
/* mobile.css / ost-mobile-scale.css force every <button> to min-height 48px, 12px radius and
   11px 15px padding with !important — the viewer's pills must look the same as its links */
#ostAppsViewer .oav-btn { min-height: 0 !important; border-radius: 999px !important; padding: 0 12px !important; font-size: 13px !important; line-height: 1 !important; }
#ostAppsViewer .oav-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
#ostAppsViewer .oav-btn:focus-visible { outline: 2px solid #6d9fff; outline-offset: 2px; }
#ostAppsViewer .oav-btn.oav-primary { background: #4c7dff; border-color: #4c7dff; color: #fff; }
#ostAppsViewer .oav-btn[hidden] { display: none !important; }

#ostAppsViewer .oav-stage { flex: 1 1 auto; position: relative; min-height: 0; background: #0b1020; overflow: hidden; }
/* the app fills the stage except the home-indicator strip, which keeps the bar colour */
#ostAppsViewer .oav-frame {
  position: absolute; top: 0; left: 0; display: block; width: 100%; min-width: 0; max-width: none;
  height: calc(100% - env(safe-area-inset-bottom, 0px)); border: 0; margin: 0; background: #fff; color-scheme: normal;
}

#ostAppsViewer .oav-status {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 24px 24px calc(24px + env(safe-area-inset-bottom, 0px)); text-align: center; background: #05070d; color: #c9d1e0;
}
#ostAppsViewer .oav-status[hidden] { display: none !important; }
#ostAppsViewer .oav-status.oav-slow { inset: auto 0 0 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); flex-direction: row; flex-wrap: wrap; gap: 10px; background: rgba(5, 7, 13, .92); border-top: 1px solid rgba(255, 255, 255, .1); }
#ostAppsViewer .oav-status h3 { margin: 0; font-size: 17px; color: #f5f7fb; }
#ostAppsViewer .oav-status p { margin: 0; max-width: 440px; color: #93a0b8; font-size: 13.5px; line-height: 1.5; }
#ostAppsViewer .oav-status .oav-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
#ostAppsViewer .oav-spin { flex: 0 0 auto; width: 28px; min-width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(109, 159, 255, .25); border-top-color: #6d9fff; animation: oav-spin .8s linear infinite; }
#ostAppsViewer .oav-slow .oav-spin { width: 18px; min-width: 18px; height: 18px; border-width: 2px; }
@keyframes oav-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #ostAppsViewer .oav-spin { animation-duration: 2.4s; } }

/* phones: icon-only buttons, tighter bar */
@media (max-width: 600px) {
  #ostAppsViewer .oav-bar { gap: 8px; padding-left: calc(10px + env(safe-area-inset-left, 0px)); padding-right: calc(8px + env(safe-area-inset-right, 0px)); }
  #ostAppsViewer .oav-ico { width: 28px; min-width: 28px; height: 28px; font-size: 16px; }
  #ostAppsViewer .oav-name { font-size: 14px; }
  #ostAppsViewer .oav-acts { gap: 4px; }
  #ostAppsViewer .oav-bar .oav-btn { padding: 0 !important; height: 42px; min-width: 42px; width: 42px; font-size: 16px !important; }
  #ostAppsViewer .oav-bar .oav-btn .oav-txt { display: none; }
}
