/* PWA Standard core - the "a new version is ready" banner styles (gate R1).
 *
 * ONE file, byte-identical in every app, so the banner cannot look different on
 * two apps that took the same core. It is written against CSS custom properties
 * with fallbacks, so an app gets a sane banner with NO per-app CSS at all, and
 * an app that wants its own colours only has to define the --ub-* properties
 * (or --color-primary / --accent, which most of the fleet already defines).
 *
 * Bottom-anchored, safe-area aware and phone-first: the reader is holding a
 * phone, and the banner must not cover the thing they were typing in. The host
 * element is inert until the module puts a banner inside it, so an app that
 * never sees an update renders exactly as before.
 */

#pwa-update-host {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  pointer-events: none;
  padding: 0 max(8px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-right));
}

#pwa-update-banner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 640px;
  margin: 0 auto;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--ub-bg, #16202c);
  color: var(--ub-fg, #f2f6fa);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .28);
  font: 500 14px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#pwa-update-banner .ub-txt { flex: 1; min-width: 0; }
#pwa-update-banner .ub-title { font-weight: 800; }
#pwa-update-banner .ub-sub {
  color: var(--ub-muted, rgba(242, 246, 250, .72));
  font-size: 12px;
}

#pwa-update-banner .ub-btn {
  flex: none;
  background: var(--ub-accent, var(--color-primary, #2f6fed));
  color: var(--ub-on-accent, #fff);
  border: 0;
  border-radius: 9px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#pwa-update-banner .ub-link {
  flex: none;
  background: none;
  border: 0;
  color: var(--ub-link, var(--color-primary-strong, #8fb8ff));
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

#pwa-update-banner .ub-x {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

/* A light app keeps a light banner unless it says otherwise. */
@media (prefers-color-scheme: light) {
  #pwa-update-banner {
    background: var(--ub-bg, #ffffff);
    color: var(--ub-fg, #14202b);
    box-shadow: 0 6px 20px rgba(20, 32, 43, .18);
  }
  #pwa-update-banner .ub-sub { color: var(--ub-muted, rgba(20, 32, 43, .68)); }
}
