/*
 * In-app browser download guide.
 *
 * WeChat, QQ, Weibo, DingTalk and similar built-in WebViews refuse to download
 * installer files and show their own "copy the link and open it in a browser"
 * interstitial. When a Windows download is requested inside one of those
 * shells, platform-interest.js opens this overlay instead of navigating, and
 * points the visitor at the top-right "···" menu that exposes "Open in browser".
 *
 * Visual language follows the product book: Inter-style sans for UI text, the
 * italic serif accent used by chapter headings, capsule buttons, and a glass
 * card. The file is self-contained so download.html renders it the same way.
 */

.in-app-guide {
  --guide-accent: var(--page-accent, #f0b36a);
  --guide-accent-rgb: var(--page-accent-rgb, 240, 179, 106);
  --guide-sans: Inter, "Segoe UI", "Microsoft YaHei UI", "Noto Sans CJK SC", "PingFang SC", sans-serif;
  --guide-serif: "Iowan Old Style", Baskerville, "Songti SC", STSong, Georgia, serif;
  --guide-paper: #f3f7f7;
  --guide-muted: rgba(232, 241, 243, 0.66);
  --guide-line: rgba(224, 245, 246, 0.16);

  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  padding: max(14px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  overflow-y: auto;
  color: var(--guide-paper);
  background:
    radial-gradient(140% 70% at 100% 0%, rgba(var(--guide-accent-rgb), 0.16), transparent 58%),
    rgba(3, 7, 11, 0.9);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  font-family: var(--guide-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  animation: inAppGuideFade 240ms ease-out;
}

.in-app-guide[hidden] {
  display: none;
}

/* Pointer toward the host app's "···" menu. */
.in-app-guide-arrow {
  position: absolute;
  top: max(8px, calc(env(safe-area-inset-top) + 4px));
  right: 12px;
  width: 84px;
  height: 96px;
  color: var(--guide-accent);
  pointer-events: none;
  filter: drop-shadow(0 8px 20px rgba(var(--guide-accent-rgb), 0.32));
  animation: inAppGuideNudge 1.6s cubic-bezier(0.45, 0, 0.35, 1) infinite;
}

.in-app-guide-arrow svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.in-app-guide-menu {
  position: absolute;
  top: max(12px, calc(env(safe-area-inset-top) + 8px));
  right: 96px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 6px 0 12px;
  border: 1px solid rgba(var(--guide-accent-rgb), 0.55);
  border-radius: 999px;
  color: rgba(248, 251, 252, 0.94);
  background: rgba(3, 9, 13, 0.55);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  font-size: 10px;
  font-weight: 780;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.in-app-guide-menu b {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  color: #03110e;
  background: var(--guide-accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1;
  animation: inAppGuidePulse 1.6s ease-in-out infinite;
}

/* Glass card, same recipe as the product demos. */
.in-app-guide-sheet {
  width: min(420px, 100%);
  margin: 118px auto 0;
  padding: 22px 20px 18px;
  border: 1px solid rgba(229, 247, 247, 0.2);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(12, 28, 34, 0.82), rgba(4, 11, 16, 0.8)),
    rgba(4, 11, 16, 0.72);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.38),
    inset 0 1px rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(19px) saturate(1.16);
  animation: inAppGuideRise 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.in-app-guide-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  color: var(--guide-accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.in-app-guide-eyebrow i {
  display: inline-grid;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(var(--guide-accent-rgb), 0.5);
  border-radius: 50%;
  color: rgba(237, 248, 248, 0.92);
  font-style: normal;
  font-size: 12px;
  line-height: 1;
}

.in-app-guide-sheet h2 {
  margin: 0 0 10px;
  color: #f4f7f7;
  font-size: clamp(22px, 6vw, 27px);
  font-weight: 760;
  letter-spacing: -0.045em;
  line-height: 1.12;
}

.in-app-guide-sheet h2 em {
  display: block;
  font-family: var(--guide-serif);
  font-style: italic;
  font-weight: 500;
  letter-spacing: -0.04em;
  color: transparent;
  background: linear-gradient(110deg, #f8feff 0%, #bdeaff 38%, #cdbbff 68%, #ffd36f 100%);
  background-clip: text;
  -webkit-background-clip: text;
}

.in-app-guide-body {
  margin: 0 0 18px;
  color: var(--guide-muted);
  font-size: 12.5px;
  font-weight: 520;
  line-height: 1.8;
}

.in-app-guide-steps {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.in-app-guide-steps li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 0 12px 0 10px;
  border: 1px solid rgba(224, 244, 245, 0.12);
  border-radius: 12px;
  background: rgba(240, 248, 248, 0.05);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
}

.in-app-guide-steps li span:first-child {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  color: #03110e;
  background: var(--guide-accent);
  box-shadow: 0 0 12px rgba(var(--guide-accent-rgb), 0.5);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.02em;
}

.in-app-guide-steps kbd {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 9px;
  margin: 0 1px;
  border: 1px solid rgba(var(--guide-accent-rgb), 0.5);
  border-radius: 999px;
  color: var(--guide-accent);
  background: rgba(var(--guide-accent-rgb), 0.1);
  font: inherit;
  font-weight: 780;
  line-height: 1.5;
  vertical-align: 1px;
}

.in-app-guide-link {
  display: block;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px dashed rgba(236, 247, 247, 0.22);
  border-radius: 10px;
  color: rgba(237, 247, 247, 0.72);
  background: rgba(255, 255, 255, 0.035);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 10.5px;
  line-height: 1.55;
  word-break: break-all;
  -webkit-user-select: all;
  user-select: all;
}

.in-app-guide-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 18px;
  color: rgba(235, 246, 247, 0.54);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
}

.in-app-guide-note::before {
  content: "";
  flex: 0 0 auto;
  width: 4px;
  height: 4px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--guide-accent);
  box-shadow: 0 0 9px rgba(var(--guide-accent-rgb), 0.84);
}

/* Capsule buttons, mirroring .primary-action / .platform-action. */
.in-app-guide-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.in-app-guide-actions button {
  flex: 1 1 150px;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  border: 1px solid rgba(236, 247, 247, 0.34);
  border-radius: 999px;
  color: rgba(242, 249, 249, 0.92);
  background: rgba(3, 9, 13, 0.38);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
  font: inherit;
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0.02em;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 180ms ease-out,
    border-color 180ms ease-out,
    background 180ms ease-out,
    box-shadow 180ms ease-out;
}

.in-app-guide-actions button.is-primary {
  border-color: var(--guide-accent);
  color: #03110e;
  background: var(--guide-accent);
  font-weight: 820;
}

.in-app-guide-actions button:hover,
.in-app-guide-actions button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(var(--guide-accent-rgb), 0.22);
}

.in-app-guide-actions button:not(.is-primary):hover,
.in-app-guide-actions button:not(.is-primary):focus-visible {
  border-color: rgba(var(--guide-accent-rgb), 0.82);
  background: rgba(var(--guide-accent-rgb), 0.14);
}

.in-app-guide-actions button:focus-visible {
  outline: 2px solid var(--guide-accent);
  outline-offset: 3px;
}

.in-app-guide-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 18px;
  margin: 12px 0 0;
  color: #54f4d2;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-align: center;
}

.in-app-guide-status:not(:empty)::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

.in-app-guide-status.is-error {
  color: #ff9cba;
}

@keyframes inAppGuideFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes inAppGuideRise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes inAppGuideNudge {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(5px, -7px);
  }
}

@keyframes inAppGuidePulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(var(--guide-accent-rgb), 0.55);
  }
  60% {
    box-shadow: 0 0 0 7px rgba(var(--guide-accent-rgb), 0);
  }
}

@media (min-width: 900px) {
  /* Desktop in-app shells (e.g. WeChat for Windows) also keep the menu at the top-right. */
  .in-app-guide-sheet {
    margin-top: 136px;
    padding: 26px 24px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .in-app-guide,
  .in-app-guide-sheet,
  .in-app-guide-arrow,
  .in-app-guide-menu b {
    animation: none;
  }
}
