/* ── SPARK PWA UI ─────────────────────────────────────────────────────────── */

/* ── Install banner (floating, above mobile nav) ─────────────────────────── */
#pwaInstallBanner {
  position: fixed;
  bottom: calc(64px + env(safe-area-inset-bottom, 0px) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 8800;
  width: calc(100% - 32px);
  max-width: 420px;
  background: linear-gradient(135deg, rgba(15,20,40,0.92) 0%, rgba(18,24,52,0.95) 100%);
  border: 1px solid rgba(123,92,250,0.35);
  border-radius: 18px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.55), 0 0 0 1px rgba(123,92,250,0.12) inset;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

#pwaInstallBanner.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 769px) {
  #pwaInstallBanner {
    bottom: 24px;
    left: auto;
    right: 24px;
    transform: translateX(0) translateY(20px);
    width: 340px;
  }
  #pwaInstallBanner.visible {
    transform: translateX(0) translateY(0);
  }
}

.pwa-banner__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #9B5FFF, #E85AA0);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 18px rgba(155,95,255,0.4);
}

.pwa-banner__icon svg {
  width: 22px;
  height: 22px;
}

.pwa-banner__text {
  flex: 1;
  min-width: 0;
}

.pwa-banner__title {
  font-family: var(--fh, 'Syne', sans-serif);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.pwa-banner__sub {
  font-family: var(--fb, 'DM Sans', sans-serif);
  font-size: 0.79rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.4;
}

.pwa-banner__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.pwa-banner__btn {
  padding: 8px 14px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-family: var(--fh, 'Syne', sans-serif);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  white-space: nowrap;
}

.pwa-banner__btn--install {
  background: linear-gradient(135deg, #7B5CFA, #9B5FFF);
  color: #fff;
  box-shadow: 0 0 16px rgba(123,92,250,0.4);
}

.pwa-banner__btn--install:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(123,92,250,0.6);
}

.pwa-banner__btn--dismiss {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.45);
  border: 1px solid rgba(255,255,255,0.08);
}

.pwa-banner__btn--dismiss:hover {
  color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.1);
}

/* ── Update toast ─────────────────────────────────────────────────────────── */
#pwaUpdateToast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  z-index: 9900;
  background: linear-gradient(135deg, rgba(15,20,40,0.96) 0%, rgba(18,24,52,0.98) 100%);
  border: 1px solid rgba(123,92,250,0.4);
  border-radius: 14px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(123,92,250,0.15) inset;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
  min-width: 260px;
  max-width: calc(100vw - 32px);
}

#pwaUpdateToast.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.pwa-toast__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7B5CFA;
  box-shadow: 0 0 8px rgba(123,92,250,0.8);
  flex-shrink: 0;
  animation: pwaToastPulse 1.4s ease infinite;
}

@keyframes pwaToastPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.8); }
}

.pwa-toast__msg {
  flex: 1;
  font-family: var(--fb, 'DM Sans', sans-serif);
  font-size: 0.93rem;
  color: rgba(255,255,255,0.85);
}

.pwa-toast__msg strong {
  color: #fff;
  font-family: var(--fh, 'Syne', sans-serif);
  font-weight: 700;
}

#pwaUpdateBtn {
  padding: 7px 13px;
  border: none;
  border-radius: 9px;
  background: linear-gradient(135deg, #7B5CFA, #9B5FFF);
  color: #fff;
  font-family: var(--fh, 'Syne', sans-serif);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 0 12px rgba(123,92,250,0.4);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  flex-shrink: 0;
}

#pwaUpdateBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(123,92,250,0.6);
}

#pwaToastClose {
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.18s ease, background 0.18s ease;
  flex-shrink: 0;
  padding: 0;
}

#pwaToastClose:hover {
  color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.08);
}

/* ── iOS install hint ─────────────────────────────────────────────────────── */
#pwaIOSHint {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9800;
  background: linear-gradient(180deg, rgba(12,16,36,0.97) 0%, rgba(8,12,28,0.99) 100%);
  border-top: 1px solid rgba(123,92,250,0.25);
  border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.34,1.2,0.64,1);
}

#pwaIOSHint.visible {
  transform: translateY(0);
}

.pwa-ios__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.pwa-ios__title {
  font-family: var(--fh, 'Syne', sans-serif);
  font-size: 1.14rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
}

#pwaIOSClose {
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.07);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, color 0.18s;
  padding: 0;
}

#pwaIOSClose:hover {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.8);
}

.pwa-ios__steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pwa-ios__step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
}

.pwa-ios__step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7B5CFA, #9B5FFF);
  color: #fff;
  font-family: var(--fh, 'Syne', sans-serif);
  font-size: 0.86rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(123,92,250,0.4);
}

.pwa-ios__step-text {
  font-family: var(--fb, 'DM Sans', sans-serif);
  font-size: 0.93rem;
  color: rgba(255,255,255,0.8);
  line-height: 1.45;
}

.pwa-ios__step-text .pwa-ios__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  vertical-align: middle;
  margin: 0 2px;
}

.pwa-ios__arrow {
  display: inline-block;
  margin: 0 3px;
  color: rgba(255,255,255,0.45);
}

/* ── OEM browser warning state ────────────────────────────────────────────── */
#pwaInstallBanner[data-mode="oem"] {
  border-color: rgba(232, 197, 90, 0.35);
  box-shadow: 0 8px 40px rgba(0,0,0,0.55), 0 0 0 1px rgba(232,197,90,0.08) inset;
}

.pwa-banner__icon--warn {
  background: linear-gradient(135deg, #C87A10, #E8C55A) !important;
  box-shadow: 0 0 18px rgba(232,197,90,0.45) !important;
  color: #080C1C;
}

.pwa-banner__icon--warn svg {
  stroke: #080C1C;
  width: 20px;
  height: 20px;
}

.pwa-banner__btn--copy {
  background: rgba(232,197,90,0.1);
  color: #E8C55A;
  border: 1px solid rgba(232,197,90,0.3);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--fh, 'Syne', sans-serif);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: background 0.18s ease, border-color 0.18s ease;
  white-space: nowrap;
}

.pwa-banner__btn--copy:hover {
  background: rgba(232,197,90,0.18);
  border-color: rgba(232,197,90,0.45);
}

/* ── Android WebView hint (same structure as iOS hint) ────────────────────── */
#pwaWebViewHint {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9800;
  background: linear-gradient(180deg, rgba(12,16,36,0.97) 0%, rgba(8,12,28,0.99) 100%);
  border-top: 1px solid rgba(232,197,90,0.25);
  border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.34,1.2,0.64,1);
}

#pwaWebViewHint.visible {
  transform: translateY(0);
}

.pwa-wv__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.pwa-wv__title {
  font-family: var(--fh, 'Syne', sans-serif);
  font-size: 1.14rem;
  font-weight: 800;
  color: #E8C55A;
  letter-spacing: -0.01em;
}

#pwaWebViewClose {
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.07);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, color 0.18s;
  padding: 0;
}

#pwaWebViewClose:hover {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.8);
}

.pwa-wv__steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pwa-wv__step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(232,197,90,0.04);
  border: 1px solid rgba(232,197,90,0.1);
  border-radius: 12px;
}

.pwa-wv__step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #C87A10, #E8C55A);
  color: #080C1C;
  font-family: var(--fh, 'Syne', sans-serif);
  font-size: 0.86rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(232,197,90,0.35);
}

.pwa-wv__step-text {
  font-family: var(--fb, 'DM Sans', sans-serif);
  font-size: 0.93rem;
  color: rgba(255,255,255,0.8);
  line-height: 1.5;
  padding-top: 3px;
}

.pwa-wv__step-text strong {
  color: #fff;
}
