/* ═══ PWA Install Guide — Permanent Asset (do not overwrite) ═══ */

/* ── Nudge: floating pill at bottom center ─────────────── */
.pwa-nudge {
  position: fixed;
  bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
  left: 50%;
  z-index: 9400;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.6rem 0.6rem 0.7rem;
  background: rgba(10, 12, 18, 0.94);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid rgba(10, 132, 255, 0.15);
  border-radius: 100px;
  box-shadow:
    0 4px 28px rgba(0, 0, 0, 0.55),
    0 0 0 0 rgba(10, 132, 255, 0),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transform: translateX(-50%) translateY(80px);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.5s ease,
    box-shadow 0.3s ease,
    border-color 0.3s ease;
  will-change: transform, opacity;
  overflow: hidden;
}

.pwa-nudge--visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
  animation: pwa-nudge-glow 3.5s ease-in-out 2s infinite;
}

@keyframes pwa-nudge-glow {
  0%   { box-shadow: 0 4px 28px rgba(0,0,0,0.55), 0 0 0 0   rgba(10,132,255,0.00), inset 0 1px 0 rgba(255,255,255,0.06); }
  35%  { box-shadow: 0 4px 28px rgba(0,0,0,0.55), 0 0 0 8px  rgba(10,132,255,0.10), inset 0 1px 0 rgba(255,255,255,0.06); }
  60%  { box-shadow: 0 4px 28px rgba(0,0,0,0.55), 0 0 0 14px rgba(10,132,255,0.00), inset 0 1px 0 rgba(255,255,255,0.06); }
  100% { box-shadow: 0 4px 28px rgba(0,0,0,0.55), 0 0 0 0    rgba(10,132,255,0.00), inset 0 1px 0 rgba(255,255,255,0.06); }
}

.pwa-nudge:hover {
  border-color: rgba(10, 132, 255, 0.35);
  box-shadow:
    0 4px 28px rgba(0, 0, 0, 0.55),
    0 0 24px rgba(10, 132, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: none;
}

.pwa-nudge:active {
  transform: translateX(-50%) scale(0.96);
  transition-duration: 0.1s;
}

/* Shimmer sweep */
.pwa-nudge::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 35%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(10, 132, 255, 0.12) 50%,
    transparent 100%
  );
  transform: translateX(-200%);
  pointer-events: none;
  border-radius: inherit;
  opacity: 0;
}

.pwa-nudge--visible::after {
  opacity: 1;
  animation: pwa-shimmer 4s ease-in-out 1s infinite;
}

@keyframes pwa-shimmer {
  0%   { transform: translateX(-200%); }
  35%  { transform: translateX(500%); }
  100% { transform: translateX(500%); }
}

/* ── Nudge: download icon ──────────────────────────────── */
.pwa-nudge__icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: rgba(10, 132, 255, 0.12);
  border: 1px solid rgba(10, 132, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pwa-nudge__icon svg {
  width: 17px;
  height: 17px;
  color: #0A84FF;
  display: block;
}

.pwa-nudge--visible .pwa-nudge__icon svg {
  animation: pwa-download-bounce 2.4s ease-in-out 1s infinite;
}

@keyframes pwa-download-bounce {
  0%, 100% { transform: translateY(0); }
  20%      { transform: translateY(3px); }
  40%      { transform: translateY(-1px); }
  55%      { transform: translateY(2px); }
  70%      { transform: translateY(0); }
}

/* ── Nudge: text block ─────────────────────────────────── */
.pwa-nudge__body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.pwa-nudge__text {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: #eaeaf0;
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1;
}

.pwa-nudge__sub {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  font-size: 0.65rem;
  font-weight: 400;
  color: #0A84FF;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1;
  opacity: 0.8;
}

/* ── Nudge: dismiss button ─────────────────────────────── */
.pwa-nudge__dismiss {
  width: 26px;
  height: 26px;
  min-height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  margin-left: 0.2rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.pwa-nudge__dismiss:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #999;
}

.pwa-nudge__dismiss svg {
  width: 10px;
  height: 10px;
}

/* ═══ Social Corner: Install Button ════════════════════ */

.sc-btn--install svg {
  color: #0A84FF;
}

.sc-btn--install:hover {
  border-color: rgba(10, 132, 255, 0.48);
  box-shadow:
    0 0 0 1px rgba(10, 132, 255, 0.14),
    0 0 20px rgba(10, 132, 255, 0.28),
    0 6px 22px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.sc-wrap--open .sc-btn:nth-child(3) { transition-delay: 0.18s; }

/* ═══ Guide: Bottom Sheet Overlay ═══════════════════════ */

.pwa-guide {
  position: fixed;
  inset: 0;
  z-index: 9650;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  transition: background 0.35s ease;
}

.pwa-guide--open {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: auto;
}

/* ── Guide: bottom sheet ───────────────────────────────── */
.pwa-guide__sheet {
  width: 100%;
  max-width: 400px;
  background: rgba(14, 16, 22, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  padding: 0.75rem 1.5rem calc(1.75rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.6);
  transform: translateY(100%);
  transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1);
  position: relative;
  overflow: hidden;
}

.pwa-guide--open .pwa-guide__sheet {
  transform: translateY(0);
}

/* Top edge glow */
.pwa-guide__sheet::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(10, 132, 255, 0.5), transparent);
}

/* iOS-style drag handle */
.pwa-guide__handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 auto 1.2rem;
}

/* ── Guide: header ─────────────────────────────────────── */
.pwa-guide__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.pwa-guide__title {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #eaeaf0;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.2;
}

.pwa-guide__subtitle {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  font-size: 0.72rem;
  color: #7c7c8a;
  margin: 0.2rem 0 0;
  line-height: 1;
}

.pwa-guide__close {
  width: 30px;
  height: 30px;
  min-height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.04);
  color: #7c7c8a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.pwa-guide__close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #eaeaf0;
}

.pwa-guide__close svg {
  width: 12px;
  height: 12px;
}

/* ── Guide: Safari notice ──────────────────────────────── */
.pwa-guide__safari {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  margin-bottom: 1.25rem;
  opacity: 0;
  transform: translateY(10px);
}

.pwa-guide--open .pwa-guide__safari {
  animation: pwa-step-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.08s forwards;
}

.pwa-guide__safari--ok {
  background: rgba(10, 132, 255, 0.06);
  border: 1px solid rgba(10, 132, 255, 0.12);
}

.pwa-guide__safari--warn {
  background: rgba(251, 191, 36, 0.06);
  border: 1px solid rgba(251, 191, 36, 0.15);
}

.pwa-guide__safari-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pwa-guide__safari--ok .pwa-guide__safari-icon {
  background: rgba(10, 132, 255, 0.1);
}

.pwa-guide__safari--warn .pwa-guide__safari-icon {
  background: rgba(251, 191, 36, 0.1);
}

.pwa-guide__safari-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.pwa-guide__safari--ok .pwa-guide__safari-icon svg {
  color: #0A84FF;
}

.pwa-guide__safari--warn .pwa-guide__safari-icon svg {
  color: #fbbf24;
}

.pwa-guide__safari-body {
  min-width: 0;
}

.pwa-guide__safari-label {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  margin: 0 0 0.1rem;
  line-height: 1.3;
}

.pwa-guide__safari--ok .pwa-guide__safari-label {
  color: #0A84FF;
}

.pwa-guide__safari--warn .pwa-guide__safari-label {
  color: #fbbf24;
}

.pwa-guide__safari-desc {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  font-size: 0.68rem;
  color: #7c7c8a;
  margin: 0;
  line-height: 1.3;
}

/* ── Guide: steps ──────────────────────────────────────── */
.pwa-guide__steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 1.5rem;
}

.pwa-guide__step {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  position: relative;
  padding-bottom: 1.25rem;
  opacity: 0;
  transform: translateY(14px);
}

.pwa-guide__step:last-child {
  padding-bottom: 0;
}

.pwa-guide--open .pwa-guide__step {
  animation: pwa-step-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.pwa-guide--open .pwa-guide__step:nth-child(1) { animation-delay: 0.2s; }
.pwa-guide--open .pwa-guide__step:nth-child(2) { animation-delay: 0.35s; }
.pwa-guide--open .pwa-guide__step:nth-child(3) { animation-delay: 0.5s; }

@keyframes pwa-step-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Step connector line */
.pwa-guide__step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 19px;
  top: 42px;
  width: 1px;
  height: 0;
  background: linear-gradient(180deg, rgba(10, 132, 255, 0.25), rgba(10, 132, 255, 0.05));
}

.pwa-guide--open .pwa-guide__step:not(:last-child)::after {
  animation: pwa-line-draw 0.4s ease forwards;
}

.pwa-guide--open .pwa-guide__step:nth-child(1)::after { animation-delay: 0.55s; }
.pwa-guide--open .pwa-guide__step:nth-child(2)::after { animation-delay: 0.7s; }

@keyframes pwa-line-draw {
  to { height: calc(100% - 42px); }
}

/* ── Step: icon container ──────────────────────────────── */
.pwa-guide__step-icon {
  position: relative;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 12px;
  background: rgba(10, 132, 255, 0.07);
  border: 1px solid rgba(10, 132, 255, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pwa-guide__step-icon svg {
  width: 17px;
  height: 17px;
  color: #0A84FF;
  display: block;
}

/* Step number badge */
.pwa-guide__step-num {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #0A84FF;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 1;
  box-shadow: 0 1px 4px rgba(10, 132, 255, 0.3);
}

/* Pulse ring on Step 1 icon */
.pwa-guide--open .pwa-guide__step:first-child .pwa-guide__step-icon::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 14px;
  border: 1.5px solid rgba(10, 132, 255, 0.2);
  opacity: 0;
  animation: pwa-ring-pulse 2.8s ease-in-out 0.8s infinite;
}

@keyframes pwa-ring-pulse {
  0%, 100% { transform: scale(1); opacity: 0; }
  15%      { opacity: 0.6; }
  50%      { transform: scale(1.22); opacity: 0; }
}

/* ── Step: text ────────────────────────────────────────── */
.pwa-guide__step-body {
  padding-top: 0.3rem;
}

.pwa-guide__step-label {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  font-size: 0.86rem;
  font-weight: 500;
  color: #eaeaf0;
  margin: 0 0 0.15rem;
  line-height: 1.3;
}

.pwa-guide__step-label strong {
  font-weight: 700;
}

.pwa-guide__step-desc {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  font-size: 0.74rem;
  color: #7c7c8a;
  margin: 0;
  line-height: 1.5;
}

/* Inline share icon in step description text */
.pwa-guide__inline-icon {
  display: inline-flex;
  vertical-align: middle;
  width: 14px;
  height: 14px;
  position: relative;
  top: -1px;
}

.pwa-guide__inline-icon svg {
  width: 14px;
  height: 14px;
  color: #0A84FF;
}

/* ── Guide: done button ────────────────────────────────── */
.pwa-guide__done {
  width: 100%;
  min-height: 48px;
  border: none;
  border-radius: 12px;
  background: #0A84FF;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 14px rgba(10, 132, 255, 0.25);
  opacity: 0;
  transition:
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.2s ease;
}

.pwa-guide--open .pwa-guide__done {
  animation: pwa-step-in 0.4s ease forwards;
  animation-delay: 0.65s;
}

.pwa-guide__done:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 22px rgba(10, 132, 255, 0.35);
}

.pwa-guide__done:active {
  transform: scale(0.97);
  transition-duration: 0.1s;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 480px) {
  .pwa-nudge {
    bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
    gap: 0.55rem;
    padding: 0.55rem 0.5rem 0.55rem 0.6rem;
  }

  .pwa-nudge__icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
  }

  .pwa-nudge__icon svg {
    width: 15px;
    height: 15px;
  }

  .pwa-nudge__text {
    font-size: 0.76rem;
  }

  .pwa-nudge__sub {
    font-size: 0.62rem;
  }

  .pwa-guide__sheet {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    padding: 0.65rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
  }

  .pwa-guide__step-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
  }

  .pwa-guide__step:not(:last-child)::after {
    left: 17px;
    top: 38px;
  }

  .pwa-guide--open .pwa-guide__step:not(:last-child)::after {
    animation-name: pwa-line-draw-sm;
  }

  @keyframes pwa-line-draw-sm {
    to { height: calc(100% - 38px); }
  }

  .pwa-guide--open .pwa-guide__step:first-child .pwa-guide__step-icon::before {
    inset: -3px;
    border-radius: 12px;
  }
}
