/* App behaviour: offline notice, install button, standalone back button, safe areas. */

/* Offline / back-online notice */
.net-notice {
  position: fixed; z-index: 1000; left: 50%; top: calc(10px + env(safe-area-inset-top, 0px));
  max-width: min(92vw, 460px); padding: 11px 18px; border-radius: 999px;
  background: #0f1f45; color: #fff; font-size: 14px; font-weight: 600; line-height: 1.4; text-align: center;
  box-shadow: 0 8px 24px rgba(15, 31, 69, .3);
  transform: translate(-50%, -140%); opacity: 0; transition: transform .25s ease, opacity .25s ease;
  pointer-events: none;
}
.net-notice[data-kind="offline"] { background: #8a1226; }
.net-notice[data-kind="online"] { background: #146c43; }
.net-notice.is-visible { transform: translate(-50%, 0); opacity: 1; }

/* Install button */
.install-app { flex-basis: 100%; }
.install-app[hidden], .install-app__help[hidden] { display: none; }
.install-app__btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border: 1px solid rgba(255, 255, 255, .45); border-radius: 999px; background: transparent;
  color: #fff; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.install-app__btn:hover { background: rgba(255, 255, 255, .12); }
.install-app__btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.install-app__btn .i { width: 18px; height: 18px; }
.install-app__help { margin: 10px 0 0; font-size: 13px; }

/* Back button, shown only in the installed app */
.app-back {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; border: 1px solid #dfe5ee; border-radius: 12px;
  background: #fff; color: #0f1f45; cursor: pointer;
}
.app-back .i { width: 20px; height: 20px; transform: rotate(180deg); }
.app-back:hover { background: #f3f6fb; }
.app-back:focus-visible { outline: 3px solid #c20e37; outline-offset: 3px; }

/* Installed app: keep content clear of rounded corners and notches in landscape */
@media (display-mode: standalone) {
  body { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
  html { overscroll-behavior-y: contain; }
}

@media (prefers-reduced-motion: reduce) {
  .net-notice { transition: none; }
}
@media print {
  .net-notice, .install-app, .app-back { display: none !important; }
}
