:root {
  --pfs-pwa-navy-950: #050b14;
  --pfs-pwa-navy-900: #07111f;
  --pfs-pwa-navy-800: #0b1627;
  --pfs-pwa-navy-700: #17263e;
  --pfs-pwa-gold-300: #f8d979;
  --pfs-pwa-gold-400: #dcae37;
  --pfs-pwa-surface: #ffffff;
  --pfs-pwa-text: #182235;
  --pfs-pwa-muted: #637083;
  --pfs-pwa-danger: #9b341f;
  --pfs-pwa-danger-bg: #fff1eb;
  --pfs-pwa-success: #175d45;
  --pfs-pwa-success-bg: #e8f8f1;
  --pfs-pwa-shadow: 0 18px 50px rgba(5, 11, 20, 0.22);
}

html.pfs-standalone {
  min-height: 100%;
  background: var(--pfs-pwa-navy-900);
}

html.pfs-standalone body {
  min-height: 100vh;
  min-height: 100dvh;
}

/* Branded handoff between the operating-system launch screen and app startup. */
.pfs-app-boot {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
  color: #f8fafc;
  background:
    radial-gradient(circle at 42% 27%, rgba(43, 70, 111, 0.68), transparent 42%),
    linear-gradient(155deg, var(--pfs-pwa-navy-800), var(--pfs-pwa-navy-950));
  opacity: 1;
  visibility: visible;
  transition: opacity 240ms ease, visibility 240ms ease;
}

.pfs-app-boot[hidden],
html.pfs-boot-ready .pfs-app-boot {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.pfs-app-boot-inner {
  display: grid;
  justify-items: center;
  gap: 16px;
  width: min(82vw, 360px);
  text-align: center;
}

.pfs-app-boot-mark {
  width: clamp(92px, 25vw, 142px);
  height: auto;
  filter: drop-shadow(0 16px 22px rgba(0, 0, 0, 0.4));
}

.pfs-app-boot-name {
  margin: 0;
  font: 700 clamp(18px, 5vw, 26px)/1.15 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.02em;
}

.pfs-app-boot-tagline {
  margin: -6px 0 0;
  color: rgba(248, 250, 252, 0.7);
  font: 500 clamp(11px, 3vw, 13px)/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pfs-app-boot-progress {
  width: 112px;
  height: 2px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.pfs-app-boot-progress::after {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pfs-pwa-gold-400), #fff0bd);
  animation: pfs-boot-progress 1.2s ease-in-out infinite;
  content: "";
}

@keyframes pfs-boot-progress {
  0% { transform: translateX(-115%); }
  55%, 100% { transform: translateX(240%); }
}

/* Connection banner: informational only; it never claims a request was saved. */
.pfs-pwa-connection {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  z-index: 2147482000;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(calc(100vw - 24px), 680px);
  padding: 11px 14px;
  border: 1px solid rgba(155, 52, 31, 0.22);
  border-radius: 12px;
  color: #762714;
  background: var(--pfs-pwa-danger-bg);
  background: color-mix(in srgb, var(--pfs-pwa-danger-bg) 96%, transparent);
  box-shadow: 0 12px 34px rgba(80, 27, 15, 0.18);
  font: 650 13px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -12px);
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
}

.pfs-pwa-connection[data-visible="true"] {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.pfs-pwa-connection-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #c4472c;
  box-shadow: 0 0 0 4px rgba(196, 71, 44, 0.13);
}

.pfs-pwa-connection-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.pfs-pwa-connection-retry {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(118, 39, 20, 0.25);
  border-radius: 8px;
  color: inherit;
  background: rgba(255, 255, 255, 0.72);
  font: inherit;
  cursor: pointer;
}

/* App updates use a centered modal so the release action is clear on every device. */
.pfs-pwa-prompt {
  position: fixed;
  inset: 0;
  z-index: 2147482600;
  display: grid;
  place-items: center;
  padding:
    max(20px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
  color: var(--pfs-pwa-text);
  background: rgba(5, 11, 20, 0.62);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  font-family: "Sora", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.pfs-pwa-prompt[hidden] {
  display: none;
}

.pfs-pwa-prompt-card {
  position: relative;
  width: min(100%, 440px);
  overflow: hidden;
  border: 1px solid rgba(11, 22, 39, 0.12);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.99);
  box-shadow: 0 28px 80px rgba(5, 11, 20, 0.34);
  animation: pfs-update-prompt-enter 180ms ease-out both;
}

.pfs-pwa-prompt-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, #dcae37, #f8d979);
  content: "";
}

.pfs-pwa-prompt-visual {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 30px auto 0;
  border: 1px solid rgba(220, 174, 55, 0.24);
  border-radius: 17px;
  background: #f8f4e8;
  box-shadow: 0 10px 28px rgba(23, 38, 62, 0.1);
}

.pfs-pwa-prompt-mark {
  width: 50px;
  height: 50px;
  border-radius: 12px;
}

.pfs-pwa-prompt-content {
  padding: 18px 30px 26px;
  text-align: center;
}

.pfs-pwa-prompt-kicker {
  margin: 0 0 7px;
  color: #9b6c08;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1.2;
  text-transform: uppercase;
}

.pfs-pwa-prompt-title {
  margin: 0;
  color: #101a2a;
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.pfs-pwa-prompt-copy {
  max-width: 340px;
  margin: 10px auto 0;
  color: var(--pfs-pwa-muted);
  font-size: 13px;
  line-height: 1.55;
}

.pfs-pwa-prompt-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 22px 22px;
}

.pfs-pwa-prompt-actions button {
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid #ccd3dd;
  border-radius: 11px;
  color: #233147;
  background: #fff;
  font: 700 13px/1 "Sora", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease,
    transform 150ms ease;
}

.pfs-pwa-prompt-actions button:hover:not(:disabled) {
  border-color: #aeb8c6;
  background: #f6f8fb;
}

.pfs-pwa-prompt-actions button:active:not(:disabled) {
  transform: translateY(1px);
}

.pfs-pwa-prompt-actions button[data-primary] {
  border-color: #075fcc;
  color: #fff;
  background: linear-gradient(180deg, #1671e8, #075fcc);
  box-shadow: 0 8px 20px rgba(7, 95, 204, 0.22);
}

.pfs-pwa-prompt-actions button[data-primary]:hover:not(:disabled) {
  border-color: #0756b8;
  background: linear-gradient(180deg, #1169d8, #0756b8);
}

.pfs-pwa-prompt-actions button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.pfs-pwa-prompt-actions button:focus-visible,
.pfs-pwa-connection-retry:focus-visible,
.pfs-pwa-dialog button:focus-visible,
.pfs-offline-actions button:focus-visible {
  outline: 3px solid rgba(220, 174, 55, 0.55);
  outline-offset: 2px;
}

.pfs-pwa-toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 2147480500;
  max-width: min(calc(100vw - 32px), 520px);
  padding: 10px 14px;
  border: 1px solid rgba(23, 93, 69, 0.18);
  border-radius: 999px;
  color: var(--pfs-pwa-success);
  background: rgba(232, 248, 241, 0.98);
  box-shadow: 0 12px 30px rgba(23, 93, 69, 0.17);
  font: 700 12px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.pfs-pwa-toast[data-visible="true"] {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.pfs-pwa-dialog {
  position: fixed;
  inset: 0;
  z-index: 2147482500;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 11, 20, 0.64);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.pfs-pwa-dialog[hidden] {
  display: none;
}

.pfs-pwa-dialog-card {
  width: min(100%, 430px);
  padding: 22px;
  border: 1px solid rgba(220, 174, 55, 0.24);
  border-radius: 18px;
  color: #e9eef6;
  background: linear-gradient(155deg, #132138, #07111f);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

.pfs-pwa-dialog-mark {
  width: 58px;
  height: 58px;
  margin-bottom: 14px;
  border-radius: 13px;
}

.pfs-pwa-dialog h2 {
  margin: 0;
  color: #fff;
  font-size: 21px;
}

.pfs-pwa-dialog p,
.pfs-pwa-dialog ol {
  color: #bdc8d9;
  font-size: 14px;
  line-height: 1.55;
}

.pfs-pwa-dialog ol {
  padding-left: 20px;
}

.pfs-pwa-dialog button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid rgba(248, 217, 121, 0.34);
  border-radius: 9px;
  color: #172033;
  background: var(--pfs-pwa-gold-300);
  font: 750 13px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
}

/* The standalone offline document is intentionally independent of the app shell. */
body.pfs-offline-page {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  display: grid;
  place-items: center;
  padding:
    max(24px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
  box-sizing: border-box;
  color: #eef3fa;
  background:
    radial-gradient(circle at 42% 24%, rgba(43, 70, 111, 0.72), transparent 40%),
    linear-gradient(155deg, var(--pfs-pwa-navy-800), var(--pfs-pwa-navy-950));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.pfs-offline-shell {
  width: min(100%, 520px);
  text-align: center;
}

.pfs-offline-mark {
  width: clamp(92px, 24vw, 132px);
  height: auto;
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.38));
}

.pfs-offline-kicker {
  margin: 24px 0 4px;
  color: var(--pfs-pwa-gold-300);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pfs-offline-shell h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(32px, 9vw, 48px);
  line-height: 1.08;
}

.pfs-offline-copy {
  margin: 18px auto 0;
  max-width: 450px;
  color: #bbc7d8;
  font-size: 15px;
  line-height: 1.65;
}

.pfs-offline-actions {
  display: grid;
  justify-items: center;
  gap: 13px;
  margin-top: 28px;
}

.pfs-offline-actions button {
  min-width: 124px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid rgba(248, 217, 121, 0.48);
  border-radius: 10px;
  color: #182235;
  background: linear-gradient(135deg, #fff0bd, #dcae37);
  box-shadow: 0 10px 26px rgba(5, 11, 20, 0.3);
  font: 800 14px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
}

.pfs-offline-actions button:disabled {
  opacity: 0.64;
  cursor: wait;
}

#pfsOfflineStatus {
  min-height: 18px;
  color: #9eacbf;
  font-size: 12px;
}

.pfs-offline-privacy {
  margin: 34px 0 0;
  color: #7e8ca1;
  font-size: 11px;
}

@media (max-width: 540px) {
  .pfs-pwa-prompt {
    padding:
      max(18px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      max(18px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }

  .pfs-pwa-prompt-card {
    border-radius: 18px;
  }

  .pfs-pwa-prompt-visual {
    margin-top: 26px;
  }

  .pfs-pwa-prompt-content {
    padding: 17px 22px 23px;
  }

  .pfs-pwa-prompt-title {
    font-size: 20px;
  }

  .pfs-pwa-prompt-actions {
    padding: 0 16px 16px;
  }

  .pfs-pwa-connection {
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pfs-app-boot,
  .pfs-pwa-connection,
  .pfs-pwa-prompt-actions button,
  .pfs-pwa-toast {
    transition: none;
  }

  .pfs-pwa-prompt-card {
    animation: none;
  }

  .pfs-app-boot-progress::after {
    animation: none;
    transform: translateX(70%);
  }
}

@keyframes pfs-update-prompt-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
