/**
 * 应用下载 — 前台下载页样式
 * 仅作用于 .ad-page，套用站点布局，不覆盖全站样式。
 */

/* 本页隐藏论坛左栏（仅下载页生效，不改核心布局；中栏自动占满腾出的宽度） */
body:has(.ad-page) .mn-left { display: none; }

.ad-page {
  --ad-accent: #4f6ef7;
  --ad-ink: #0f172a;
  --ad-muted: #64748b;
  --ad-line: rgba(15, 23, 42, .08);
  --ad-card: #ffffff;
  --ad-radius: 20px;
  color: var(--ad-ink);
  padding-bottom: 24px;
}

.ad-page * { box-sizing: border-box; }
.ad-page a { text-decoration: none; }
.ad-page img { max-width: 100%; display: block; }
.ad-page button { font: inherit; }

.ad-page :focus-visible {
  outline: 2px solid var(--ad-accent);
  outline-offset: 3px;
}

.ad-wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
}

/* ---------------- Hero ---------------- */
.ad-hero {
  position: relative;
  margin-top: 0;
  border-radius: var(--mn-radius-lg, 10px);
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(900px 520px at 88% -10%, rgba(79, 110, 247, .5), transparent 62%),
    linear-gradient(135deg, #0b1020 0%, #131a33 55%, #0b1020 100%);
  box-shadow: 0 30px 80px rgba(15, 23, 42, .26);
}
.ad-hero::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -220px;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: var(--ad-accent);
  filter: blur(140px);
  opacity: .35;
  pointer-events: none;
}
.ad-hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 32px;
  align-items: center;
  padding: 32px;
}
.ad-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .82);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
}
.ad-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, .16);
}
.ad-app-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 22px;
}
.ad-icon {
  width: 78px;
  height: 78px;
  border-radius: var(--mn-radius-lg, 10px);
  object-fit: cover;
  flex: 0 0 auto;
  box-shadow: 0 18px 36px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.ad-icon-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--ad-accent), #7c3aed);
  color: #fff;
  font-size: 34px;
  font-weight: 800;
}
.ad-app-title h1 {
  margin: 0;
  font-size: clamp(24px, 1.8vw, 32px);
  line-height: 1.12;
  letter-spacing: -.025em;
  color: #fff;
}
.ad-app-title p {
  margin: 6px 0 0;
  font-size: 16px;
  color: rgba(255, 255, 255, .66);
}
.ad-desc {
  margin: 22px 0 0;
  max-width: 560px;
  font-size: 15px;
  line-height: 1.85;
  color: rgba(255, 255, 255, .66);
}
.ad-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}

/* 按钮文字始终与按钮底色保持对比，避免站点 a:hover 覆盖后“看不见字” */
.ad-page .ad-btn,
.ad-page .ad-btn:hover,
.ad-page .ad-btn:focus { text-decoration: none; }
.ad-page .ad-btn-primary,
.ad-page .ad-btn-primary:hover,
.ad-page .ad-btn-primary:focus { color: #fff; }
.ad-page .ad-btn-ghost,
.ad-page .ad-btn-ghost:hover { color: #fff; }
.ad-page .ad-btn-small:not(.ad-btn-disabled),
.ad-page .ad-btn-small:not(.ad-btn-disabled):hover { color: #fff; }

/* 下载二维码 */
.ad-qr {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--mn-radius, 8px);
  background: rgba(255, 255, 255, .08);
  color: #fff;
}
.ad-qr[hidden] { display: none; }
.ad-qr canvas {
  display: block;
  flex: 0 0 auto;
  width: 140px;
  height: 140px;
  border-radius: var(--mn-radius-sm, 4px);
  background: #fff;
}
.ad-qr-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-right: 4px;
}
.ad-qr-copy b {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.ad-qr-copy span {
  font-size: 11.5px;
  color: rgba(255, 255, 255, .6);
}
.ad-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: var(--mn-radius, 8px);
  font-size: 15px;
  font-weight: 700;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.ad-btn:hover { transform: translateY(-1px); }
.ad-btn-primary {
  background: var(--ad-accent);
  color: #fff;
  box-shadow: 0 14px 30px rgba(79, 110, 247, .4);
}
.ad-btn-primary:hover {
  box-shadow: 0 18px 36px rgba(79, 110, 247, .5);
}
.ad-btn-sub {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  font-size: 12px;
  font-weight: 600;
}
.ad-btn-ghost {
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .07);
  color: #fff;
  backdrop-filter: blur(8px);
}
.ad-btn-ghost:hover { background: rgba(255, 255, 255, .12); }
.ad-btn-disabled {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
}
.ad-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 22px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, .56);
}
.ad-meta b { color: rgba(255, 255, 255, .86); font-weight: 700; }
.ad-meta span { position: relative; }
.ad-meta span + span::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  transform: translateY(-50%);
}
.ad-note {
  margin: 16px 0 0;
  font-size: 12.5px;
  color: rgba(255, 255, 255, .5);
}
.ad-trust {
  margin: 8px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, .38);
  letter-spacing: .02em;
}

/* 手机预览 */
.ad-hero-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.ad-phone {
  position: relative;
  width: min(430px, 100%);
  height: 844px;
  border-radius: calc(var(--mn-radius-lg, 10px) * 4.8);
  background: #05070f;
  border: 8px solid #05070f;
  box-shadow:
    0 40px 80px rgba(0, 0, 0, .5),
    0 0 0 1px rgba(255, 255, 255, .08),
    inset 0 0 0 1px rgba(255, 255, 255, .06);
  overflow: hidden;
}
.ad-phone iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.ad-phone-shot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ad-phone-notch {
  position: absolute;
  top: 10px;
  left: 50%;
  z-index: 3;
  width: 126px;
  height: 26px;
  border-radius: 0 0 calc(var(--mn-radius, 8px) * 2) calc(var(--mn-radius, 8px) * 2);
  background: #05070f;
  transform: translateX(-50%);
  pointer-events: none;
}
.ad-phone-bar {
  position: absolute;
  bottom: 8px;
  left: 50%;
  z-index: 3;
  width: 96px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .28);
  transform: translateX(-50%);
  pointer-events: none;
}
.ad-phone-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: rgba(255, 255, 255, .5);
  font-size: 13px;
  background: linear-gradient(160deg, #111827, #1f2937);
}
.ad-phone-empty-icon {
  width: 54px;
  height: 54px;
  border-radius: var(--mn-radius, 8px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .1);
  font-weight: 800;
  color: rgba(255, 255, 255, .7);
}
.ad-preview-link {
  font-size: 12.5px;
  color: rgba(255, 255, 255, .6);
  border-bottom: 1px dashed rgba(255, 255, 255, .25);
  padding-bottom: 2px;
}
.ad-preview-link:hover { color: #fff; }

/* ---------------- 数据条 ---------------- */
.ad-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.ad-stat {
  background: var(--ad-card);
  border: 1px solid var(--ad-line);
  border-radius: var(--mn-radius-lg, 10px);
  padding: 18px 20px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .04);
}
.ad-stat b {
  display: block;
  font-size: 24px;
  letter-spacing: -.02em;
}
.ad-stat span {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--ad-muted);
}

/* ---------------- 区块 ---------------- */
.ad-section { margin-top: 56px; }
.ad-section-head { margin-bottom: 20px; }
.ad-section-head h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -.02em;
}
.ad-section-head p {
  margin: 6px 0 0;
  color: var(--ad-muted);
  font-size: 14px;
}

/* 截图 */
.ad-shots {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 2px 2px 12px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.ad-shot {
  flex: 0 0 auto;
  width: 168px;
  height: 300px;
  padding: 0;
  border: 1px solid var(--ad-line);
  border-radius: var(--mn-radius-lg, 10px);
  overflow: hidden;
  background: #e2e8f0;
  cursor: zoom-in;
  scroll-snap-align: start;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
  transition: transform .18s ease, box-shadow .18s ease;
}
.ad-shot:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 34px rgba(15, 23, 42, .14);
}
.ad-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 特性 */
.ad-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.ad-feature {
  background: var(--ad-card);
  border: 1px solid var(--ad-line);
  border-radius: var(--mn-radius-lg, 10px);
  padding: 24px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .04);
}
.ad-feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--mn-radius, 8px);
  background: rgba(79, 110, 247, .12);
  background: color-mix(in srgb, var(--ad-accent) 12%, #fff);
  color: var(--ad-accent);
}
.ad-feature h3 {
  margin: 16px 0 6px;
  font-size: 16px;
}
.ad-feature p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ad-muted);
}

/* 版本 */
.ad-versions {
  background: var(--ad-card);
  border: 1px solid var(--ad-line);
  border-radius: var(--mn-radius-lg, 10px);
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .04);
}
.ad-version {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  border-top: 1px solid var(--ad-line);
}
.ad-version:first-child { border-top: 0; }
.ad-version.is-current {
  background: rgba(79, 110, 247, .05);
  background: color-mix(in srgb, var(--ad-accent) 5%, #fff);
}
.ad-version-main { flex: 1; min-width: 0; }
.ad-version-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.ad-version-top strong {
  font-size: 15px;
  letter-spacing: -.01em;
}
.ad-chip {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--ad-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.ad-version-date {
  font-size: 12px;
  color: var(--ad-muted);
}
.ad-version-meta {
  margin-top: 5px;
  font-size: 12px;
  color: var(--ad-muted);
}
.ad-version-log {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ad-muted);
}
.ad-version-log summary {
  cursor: pointer;
  color: var(--ad-ink);
  font-weight: 600;
  font-size: 12.5px;
}
.ad-version-log p {
  margin: 6px 0 0;
  line-height: 1.7;
  white-space: normal;
}
.ad-btn-small {
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--mn-radius, 8px);
  background: var(--ad-ink);
  color: #fff;
  font-size: 13px;
}
.ad-btn-small:hover { background: #1e293b; }
.ad-btn-small.ad-btn-disabled {
  background: #e2e8f0;
  color: #94a3b8;
}
.ad-empty {
  padding: 34px;
  text-align: center;
  color: var(--ad-muted);
  background: var(--ad-card);
  border: 1px dashed var(--ad-line);
  border-radius: var(--mn-radius-lg, 10px);
  font-size: 14px;
}

/* ---------------- 灯箱 ---------------- */
.ad-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 6, 23, .86);
  backdrop-filter: blur(6px);
}
.ad-lightbox[hidden] { display: none; }
body.ad-lock { overflow: hidden; }
.ad-lightbox img {
  max-width: min(92vw, 520px);
  max-height: 88vh;
  border-radius: var(--mn-radius-lg, 10px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}
.ad-lightbox-close {
  position: absolute;
  top: 18px;
  right: 20px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.ad-lightbox-close:hover { background: rgba(255, 255, 255, .2); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 960px) {
  .ad-hero-inner {
    grid-template-columns: 1fr;
    gap: 34px;
    padding: 40px;
  }
  .ad-hero-preview { margin-top: 4px; }
  .ad-stats { grid-template-columns: repeat(2, 1fr); }
  .ad-features { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .ad-wrap { width: 100%; }
  .ad-hero { margin-top: 0; border-radius: var(--mn-radius-lg, 10px); }
  .ad-hero-inner { padding: 26px 22px 30px; gap: 28px; }
  .ad-app-head { gap: 14px; }
  .ad-icon { width: 64px; height: 64px; border-radius: var(--mn-radius-lg, 10px); }
  .ad-app-title h1 { font-size: 26px; }
  .ad-app-title p { font-size: 14px; }
  .ad-desc { font-size: 14px; margin-top: 18px; }
  .ad-actions { gap: 10px; }
  .ad-btn { flex: 1 1 auto; min-height: 46px; padding: 0 16px; font-size: 14px; }
  .ad-phone { width: min(430px, 100%); height: 844px; border-radius: calc(var(--mn-radius-lg, 10px) * 4.8); }
  .ad-phone-notch { width: 120px; height: 24px; }
  .ad-section { margin-top: 44px; }
  .ad-section-head h2 { font-size: 21px; }
  .ad-stat { padding: 15px 16px; }
  .ad-stat b { font-size: 20px; }
  .ad-shot { width: 138px; height: 248px; border-radius: var(--mn-radius-lg, 10px); }
  .ad-version { padding: 15px 16px; gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .ad-page *,
  .ad-page *::before,
  .ad-page *::after {
    transition: none !important;
    animation: none !important;
  }
}
