/* PWA update banner + modal */
.pwa-update-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(18, 18, 18, 0.9);
  color: #ffffff;
  border: 1px solid rgba(226, 34, 40, 0.5);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  z-index: 2105;
}

.pwa-update-banner.show {
  display: flex;
}

.pwa-update-banner .pwa-update-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .pwa-update-banner {
    align-items: flex-start;
  }

  .pwa-update-banner .pwa-update-actions {
    justify-content: flex-end;
  }
}

.pwa-update-modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 6, 12, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2110;
  padding: 16px;
}

.pwa-update-modal.show {
  display: flex;
}

.pwa-update-card {
  width: min(420px, 92vw);
  background: #ffffff;
  border-radius: 18px;
  padding: 20px 22px;
  box-shadow: 0 24px 50px rgba(226, 34, 40, 0.2);
  border: 1px solid rgba(226, 34, 40, 0.25);
  text-align: center;
}

.pwa-update-title {
  font-weight: 700;
  margin-bottom: 10px;
}

.pwa-update-status {
  font-size: 0.9rem;
  color: #6b7280;
  margin-bottom: 10px;
}

.pwa-update-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(226, 34, 40, 0.2);
  border-top-color: #e22228;
  margin: 0 auto 12px;
  animation: pwaSpin 1s linear infinite;
}

.pwa-update-progress {
  height: 10px;
  border-radius: 999px;
  background: #f1f1f1;
  overflow: hidden;
  margin-top: 8px;
}

.pwa-update-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(120deg, #e22228, #ff7b7f);
  transition: width 0.2s ease;
}

.pwa-update-percent {
  margin-top: 8px;
  font-size: 0.9rem;
  color: #6b7280;
}

@keyframes pwaSpin {
  to { transform: rotate(360deg); }
}

/* PWA install prompt */
.pwa-install-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  background: rgba(6, 6, 12, 0.58);
  z-index: 2108;
}

.pwa-install-modal.show {
  display: flex;
}

.pwa-install-sheet {
  position: relative;
  width: min(360px, 100%);
  padding: 18px 18px calc(16px + env(safe-area-inset-bottom));
  border-radius: 22px;
  border: 1px solid rgba(226, 34, 40, 0.18);
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.95), rgba(255, 241, 242, 0.88) 38%, rgba(255, 255, 255, 0.98) 100%);
  box-shadow:
    0 22px 44px rgba(15, 23, 42, 0.2),
    0 12px 26px rgba(226, 34, 40, 0.12);
  color: #111827;
}

.pwa-install-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: #4b5563;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.pwa-install-close:hover {
  background: rgba(226, 34, 40, 0.1);
  color: #b91c1c;
}

.pwa-install-close svg {
  width: 16px;
  height: 16px;
}

.pwa-install-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 10px;
}

.pwa-install-brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(226, 34, 40, 0.14), rgba(255, 107, 107, 0.22));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.pwa-install-brand-mark img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.pwa-install-eyebrow {
  margin-bottom: 2px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b91c1c;
}

.pwa-install-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.15;
}

.pwa-install-copy {
  margin: 0 0 14px;
  color: #4b5563;
  font-size: 0.88rem;
  line-height: 1.45;
}

.pwa-install-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.pwa-install-actions[hidden] {
  display: none !important;
}

.pwa-install-actions .btn {
  min-width: 0;
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
  justify-content: center;
}

.pwa-install-actions .btn-primary {
  min-width: 104px;
  box-shadow: 0 10px 18px rgba(226, 34, 40, 0.2);
}

.pwa-install-actions .btn-flat,
.pwa-install-actions .btn-outline {
  min-width: 86px;
}

.pwa-install-actions .btn-flat {
  background: rgba(15, 23, 42, 0.04);
  color: #4b5563;
}

.pwa-install-actions .btn-flat:hover {
  background: rgba(15, 23, 42, 0.08);
}

@media (min-width: 700px) {
  .pwa-install-modal {
    align-items: center;
  }

  .pwa-install-sheet {
    padding-bottom: 16px;
  }
}

@media (max-width: 699px) {
  .pwa-install-modal {
    padding:
      12px
      12px
      calc(12px + env(safe-area-inset-bottom));
  }

  .pwa-install-sheet {
    width: min(340px, 100%);
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
  }
}
