/* pwa-ui.css: the kit's COMPONENTS only (offline banner, install + push strips, button-only
   dialogs, toast, pull-to-refresh disc, ?__vp=1 readout). Every selector is .pwa- prefixed and
   nothing here touches body, html, button or input, so it drops into an existing site safely.
   pwa.css is the separate SCREEN recipe (frame, safe areas, 16px floor) for a from-scratch app.
   Theme with --pwa-brand, --pwa-font, --pwa-card, --pwa-ink, --pwa-mut, --pwa-line. */
:root { --pwa-brand: #4f46e5; --pwa-ink: #26262a; --pwa-mut: #70717a; --pwa-card: #fff; --pwa-line: #e8e8ec; }
/* ---- offline banner (prepended into the frame by pwa.js) ---- */
.pwa-offline { flex: none; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 14px; background: #fdf6e7; color: #7a4d06; border-bottom: 1px solid #f0dfb8;
  font: 600 13px/1.3 var(--pwa-font, system-ui, sans-serif); }

/* ---- install strip + push strip ---- */
.pwa-install, .pwa-pushstrip { display: flex; align-items: center; gap: 12px; margin: 12px 14px; padding: 12px 12px 12px 14px;
  border-radius: 14px; background: #17161f; color: #fff; font: 14px/1.35 var(--pwa-font, system-ui, sans-serif); }
.pwa-pushstrip { background: var(--pwa-card); color: var(--pwa-ink); border: 1px solid var(--pwa-line); }
.pwa-tap { cursor: pointer; }
.pwa-ai { flex: none; width: 40px; height: 40px; border-radius: 10px; overflow: hidden; background: var(--pwa-brand);
  display: grid; place-items: center; font-weight: 700; }
.pwa-ai img { width: 100%; height: 100%; object-fit: cover; }
.pwa-txt, .pwa-pt { flex: 1; min-width: 0; }
.pwa-it { font-weight: 700; }
.pwa-is { font-size: 12px; opacity: .8; margin-top: 2px; }
.pwa-ic svg { display: inline-block; vertical-align: -2px; }
.pwa-bell { flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--pwa-brand) 14%, transparent); color: var(--pwa-brand); }
.pwa-install .pwa-act, .pwa-pushstrip .pwa-act, .pwa-act { flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; background: var(--pwa-brand); color: #fff; font-weight: 700; }
.pwa-x { flex: none; width: 36px; height: 36px; display: grid; place-items: center; opacity: .6; }
.pwa-spin { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff; animation: pwa-spin 1s linear infinite; vertical-align: -2px; }
@keyframes pwa-spin { to { transform: rotate(360deg); } }

/* ---- dialogs: close ONLY through their buttons ---- */
.pwa-scrim { position: fixed; left: 0; right: 0; top: var(--appvtop, 0px); height: var(--appvh, 100dvh); z-index: 90;
  background: rgba(16,15,15,.45); display: grid; place-items: center; padding: 20px; }
.pwa-dlg { width: 100%; max-width: 380px; max-height: calc(100% - 20px); overflow-y: auto; background: var(--pwa-card);
  color: var(--pwa-ink); border-radius: 18px; padding: 22px 20px 18px; font: 15px/1.5 var(--pwa-font, system-ui, sans-serif);
  box-shadow: 0 18px 50px rgba(0,0,0,.3); }
.pwa-dlg h3 { margin: 0 0 10px; font-size: 18px; line-height: 1.3; }
.pwa-dlg button { font: inherit; cursor: pointer; }
.pwa-install button, .pwa-pushstrip button { font: inherit; border: 0; cursor: pointer; color: inherit; background: none; }
.pwa-dlg p { margin: 0 0 10px; }
.pwa-dlg-ic img { width: 56px; height: 56px; border-radius: 13px; margin-bottom: 12px; }
.pwa-note { color: var(--pwa-mut); }
.pwa-steps { margin: 4px 0 14px; padding-left: 20px; }
.pwa-steps li { margin-bottom: 8px; }
.pwa-why { font-size: 13px; color: var(--pwa-mut); }
.pwa-have { margin: 14px 0 0; }
.pwa-link { background: none; border: 0; padding: 0; font: inherit; font-size: 13.5px; font-weight: 600; color: inherit; opacity: .75; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.pwa-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.pwa-btn { background: var(--pwa-card); color: var(--pwa-ink); min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--pwa-line); font-weight: 600; }
.pwa-dlg .pwa-btn.pri { background: var(--pwa-brand); border-color: var(--pwa-brand); color: #fff; }

.pwa-toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--appvbot, 0px) + 90px); z-index: 95;
  background: #17161f; color: #fff; padding: 10px 16px; border-radius: 12px; font: 600 14px var(--pwa-font, system-ui, sans-serif); max-width: 90vw; }

/* ---- installed app on an ordinary scrolling document: no rubber-band. In the iOS home screen app the
   bounce past the end moves position:fixed and sticky bars WITH the page (tab bar floating mid-screen,
   header gone off the top; RCMarket 2026-10-04, on screens with no keyboard). html.standalone is set by
   pwa.js. Pull-to-refresh reads touches itself and does not need the bounce. ---- */
html.standalone, html.standalone body { overscroll-behavior-y: none; }

/* ---- pull to refresh: a brand disc with a ring that fills as you pull, spins while refreshing ---- */
.pwa-ptr { position: fixed; top: calc(var(--appvtop, 0px) + var(--sat, env(safe-area-inset-top, 0px)) + 6px); left: 50%; transform: translate(-50%, -58px); opacity: 0; z-index: 39;
  width: 46px; height: 46px; border-radius: 50%; background: var(--pwa-brand); box-shadow: 0 4px 14px rgba(0,0,0,.22);
  display: grid; place-items: center; pointer-events: none; will-change: transform, opacity; }
.pwa-ptr-spin { width: 26px; height: 26px; border: 3px solid var(--pwa-ptr-track, rgba(255,255,255,.34)); border-top-color: var(--pwa-ptr-fg, #fff); border-radius: 50%; }
.pwa-ptr.ready .pwa-ptr-spin { border-color: var(--pwa-ptr-fg, #fff); }
.pwa-ptr.spin .pwa-ptr-spin { animation: pwa-spin .7s linear infinite; }

/* ---- ?__vp=1 readout ---- */
#pwa-vp { position: fixed; right: 6px; top: calc(var(--sat, env(safe-area-inset-top, 0px)) + 6px); z-index: 99; display: grid; grid-template-columns: auto auto;
  gap: 1px 8px; padding: 8px; border-radius: 8px; background: rgba(0,0,0,.82); color: #fff; font: 11px/1.3 ui-monospace, monospace; }
#pwa-vp .bad { color: #ff6b6b; font-weight: 700; }
#pwa-vpprobe { position: fixed; visibility: hidden; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
