/* ============================================================
   SpaceSlim 官网 / TestFlight 内测分发页
   手机优先：单列布局，375px 宽度下不横向溢出。
   ============================================================ */

:root {
  --accent: #0a84ff;
  --accent-press: #0774e0;
  --accent-weak: #e8f2ff;
  --green: #12a150;
  --red: #d70015;
  --red-weak: #ffe9ea;
  --fg: #14161c;
  --fg-sub: #5f6674;
  --fg-faint: #9aa1ad;
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e4e6eb;
  --line-strong: #d3d6dc;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow: 0 1px 2px rgba(16, 20, 30, .05), 0 4px 14px rgba(16, 20, 30, .05);
  --shadow-lift: 0 2px 6px rgba(16, 20, 30, .07), 0 12px 28px rgba(16, 20, 30, .08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #0a84ff;
    --accent-press: #3b9dff;
    --accent-weak: #16283d;
    --green: #32d074;
    --red: #ff6961;
    --red-weak: #3a1f21;
    --fg: #f2f3f5;
    --fg-sub: #a4abb8;
    --fg-faint: #78808d;
    --bg: #101216;
    --card: #1a1d23;
    --line: #2a2e36;
    --line-strong: #383d47;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lift: 0 12px 28px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;   /* iOS 横屏不放大字号 */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* 关键：任何元素都不许把页面撑宽（微信内置浏览器常见问题） */
img, svg, textarea, input { max-width: 100%; }

.wrap {
  /* 宽度交给各 .view：首页要放网格所以更宽，详情页保持单列好读 */
  width: 100%;
  /* 底部留出 iOS Home 指示条的安全区 */
  padding: 20px 18px calc(32px + env(safe-area-inset-bottom, 0px));
}

/* Safari 的 hidden 会被 display 规则覆盖，这里补一刀 */
[hidden] { display: none !important; }

.small { font-size: 14px; }
.muted { color: var(--fg-sub); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------------- noscript ---------------- */

.noscript {
  max-width: 560px;
  margin: 0 auto;
  padding: 40px 18px;
}
.noscript h1 { font-size: 24px; margin: 0 0 12px; }

/* ---------------- 首页 ---------------- */

.hero { padding: 8px 2px 22px; }

.hero-badge {
  width: 56px; height: 56px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 18px rgba(10, 132, 255, .28);
  margin-bottom: 16px;
}
.hero-badge svg { width: 28px; height: 28px; }

.hero h1 {
  font-size: 27px;
  line-height: 1.3;
  margin: 0 0 8px;
  letter-spacing: -.3px;
}
.hero-sub {
  margin: 0;
  color: var(--fg-sub);
  font-size: 16px;
}

.app-list { display: flex; flex-direction: column; gap: 12px; }

/* 首页卡片：整块可点（<a>），但绝不能有下划线/蓝字默认样式 */
.card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
a.card:active { transform: scale(.99); border-color: var(--line-strong); }

.card-row { display: flex; align-items: flex-start; gap: 14px; }

.card-body { min-width: 0; flex: 1; }

.card-name {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
}
.card-name-cn {
  margin: 3px 0 0;
  font-size: 14px;
  color: var(--fg-sub);
}
.card-tagline {
  margin: 7px 0 0;
  font-size: 15px;
  color: var(--fg-sub);
}
.card-meta {
  margin: 11px 0 0;
  font-size: 13px;
  color: var(--fg-faint);
}
.card-cta {
  margin: 14px 0 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
}
/* 邀请码已发完的卡片：CTA 收着点，别让人以为一定能领到 */
.card-cta.is-dim { color: var(--fg-faint); font-weight: 500; }

/* ---------------- App 图标 ---------------- */

.icon {
  flex: none;
  width: 64px; height: 64px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  position: relative;
}
.icon img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
/* icon_url 为空（或加载失败）时的纯 CSS 占位：渐变块 + 首字母 */
.icon-ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, var(--accent), #5aa9ff);
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: .5px;
}
.icon-ph-big {
  font-size: 40px;
  border-radius: 22px;
}
.icon-lg {
  width: 88px; height: 88px;
  border-radius: 21px;
  box-shadow: var(--shadow-lift);
}

/* ---------------- 状态提示 ---------------- */

.status {
  font-size: 15px;
  border-radius: var(--radius);
  margin: 0 0 14px;
}
.status:empty { display: none; }
.status[data-kind="info"],
.status[data-kind="ok"],
.status[data-kind="error"] {
  padding: 13px 15px;
  border: 1px solid transparent;
}
.status[data-kind="info"] {
  background: var(--accent-weak);
  color: var(--fg);
  border-color: rgba(10, 132, 255, .25);
}
.status[data-kind="ok"] {
  background: rgba(18, 161, 80, .1);
  color: var(--fg);
  border-color: rgba(18, 161, 80, .3);
}
.status[data-kind="error"] {
  background: var(--red-weak);
  color: var(--fg);
  border-color: rgba(215, 0, 21, .28);
}
.status .status-title { font-weight: 600; display: block; }
.status .status-actions { margin-top: 10px; }

/* ---------------- 分发页 ---------------- */

.crumb { margin-bottom: 16px; }
.crumb-link {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  font-size: 15px;
  padding: 4px 0;
}

.app-head { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 4px 0 24px; }
.app-head .icon { margin-bottom: 16px; }

.app-name {
  font-size: 28px;
  line-height: 1.25;
  margin: 0;
  letter-spacing: -.4px;
  font-weight: 700;
}
.app-name-cn {
  margin: 6px 0 0;
  font-size: 15px;
  color: var(--fg-sub);
  font-weight: 500;
}
.app-tagline {
  margin: 14px 0 0;
  font-size: 17px;
  color: var(--fg-sub);
  max-width: 30em;
}

/* ---------------- 按钮 ---------------- */

.btn {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 52px;
  padding: 13px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .12s ease, border-color .12s ease, opacity .12s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(10, 132, 255, .26);
}
.btn-primary:active { background: var(--accent-press); }

.btn-secondary {
  background: var(--card);
  color: var(--accent);
  border-color: var(--line-strong);
}

.btn-quiet {
  background: transparent;
  color: var(--fg-sub);
  border-color: transparent;
  box-shadow: none;
  font-weight: 500;
  font-size: 15px;
  min-height: 44px;
  padding: 10px 12px;
}

.btn-big {
  font-size: 19px;
  min-height: 58px;
  border-radius: var(--radius-lg);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  background: var(--line);
  color: var(--fg-faint);
  border-color: transparent;
  box-shadow: none;
  cursor: default;
}
.btn-secondary:disabled,
.btn-quiet:disabled {
  background: transparent;
  color: var(--fg-faint);
  border-color: var(--line);
}
.btn:disabled:active { transform: none; }

.btn-note {
  margin: 9px 0 0;
  font-size: 14px;
  color: var(--fg-sub);
  text-align: center;
}

/* ---------------- 区块 ---------------- */

.block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  margin: 0 0 14px;
  box-shadow: var(--shadow);
}
.block-flat {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 4px 2px;
}
.block-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.block-title .badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-weak);
  border-radius: 999px;
  padding: 3px 9px;
}

/* ---------------- 邀请码 ---------------- */

.code-reveal { text-align: center; }

.code-label {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--fg-sub);
}

.code-value {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* 375px 下 40px × 6 字 + 字间距仍然放得下；窄屏自动缩 */
  --code-size: clamp(30px, 12vw, 42px);
  --code-gap: clamp(3px, 2.1vw, 9px);
  font-size: var(--code-size);
  font-weight: 700;
  letter-spacing: var(--code-gap);
  line-height: 1.25;
  text-indent: var(--code-gap);  /* 抵消最后一个字的字间距，视觉居中 */
  color: var(--fg);
  margin: 0 0 6px;
  user-select: all;
  -webkit-user-select: all;
}

.code-hint {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--fg-sub);
}

.code-actions { display: flex; flex-direction: column; gap: 10px; }
.code-actions-row { display: flex; gap: 10px; }
.code-actions-row .btn { flex: 1; }

/* 复制降级用：让用户自己长按选中的 textarea */
.copy-fallback {
  display: none;
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 17px;
  line-height: 1.4;
  text-align: center;
  resize: none;
  overflow: hidden;
}
.copy-fallback.is-shown { display: block; }

/* ---------------- 激活步骤 ---------------- */

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.steps li {
  counter-increment: step;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 16px;
  line-height: 1.55;
}
.steps li::before {
  content: counter(step);
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent-weak);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-top: 2px;
}

/* ---------------- 详细介绍 ---------------- */

/* 隐私优势清单。
   文案必须和 App 内 Support/PrivacyPoints.swift 一字不差 ——
   用户在 App 里、分享页上、隐私政策里、App Store 隐私标签上看到的
   是同一套说法，对不上就是信任问题。 */
.privacy-list {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.privacy-list li {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  font-size: 15px;
  line-height: 1.5;
  color: var(--fg-sub);
}
.privacy-list li::before {
  content: "✓";
  flex: none;
  font-weight: 700;
  color: var(--green);
}

.desc {
  white-space: pre-wrap;     /* 保留后端 description 里的换行 */
  margin: 0;
  font-size: 16px;
  line-height: 1.7;
  color: var(--fg);
}

/* 分享链接 */

.share-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.share-url {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--fg-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: ltr;
}
.share-row .btn { width: auto; flex: none; min-height: 40px; font-size: 15px; padding: 8px 16px; }

/* ---------------- 页脚 ---------------- */

.page-foot {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.page-foot p { margin: 0 0 6px; }

/* ---------------- 404 ---------------- */

.missing { text-align: center; padding: 56px 4px 24px; }
.missing-code {
  font-size: 52px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--line-strong);
  line-height: 1;
  margin-bottom: 14px;
}
.missing h1 { font-size: 23px; margin: 0 0 10px; }
.missing p { margin: 0 0 22px; font-size: 16px; }
.missing .btn { width: auto; display: inline-flex; padding: 13px 32px; }

/* ---------------- 响应式：手机优先，逐级放大 ---------------- */

/* 默认（手机）：单列，560px 以内自适应 */
.view { max-width: 560px; margin: 0 auto; }

/* 平板 / 小笔记本 */
@media (min-width: 700px) {
  .wrap { padding: 40px 32px 56px; }
  .view { max-width: 640px; }
  #view-home { max-width: 940px; }          /* 首页更宽，放得下两列 */

  .hero { padding-bottom: 30px; text-align: center; }
  .hero-badge { margin: 0 auto; }
  .hero h1 { font-size: 34px; }
  .hero-sub { font-size: 17px; max-width: 34em; margin: 0 auto; }

  /* 卡片改成网格。
     用 auto-fit + 上限 380px + 居中：只有 1 个 App 时卡片居中而不是挤在左列，
     多个 App 时按可用宽度自动排 2~3 列。 */
  .app-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 380px));
    justify-content: center;
    gap: 16px;
    align-items: stretch;
  }
  .card { height: 100%; padding: 18px; }

  .block { padding: 24px 22px; }
  .app-head { padding-bottom: 30px; }
  .crumb { margin-bottom: 4px; }
}

/* 桌面 */
@media (min-width: 1040px) {
  .wrap { padding: 56px 40px 72px; }
  #view-home { max-width: 1140px; }
  .view { max-width: 700px; }

  .app-list { gap: 18px; }   /* 列数由 auto-fit 决定，这里只调间距 */
  .hero { padding: 12px 0 36px; }
  .hero-badge { width: 64px; height: 64px; border-radius: 18px; }
  .hero-badge svg { width: 32px; height: 32px; }
  .hero h1 { font-size: 42px; letter-spacing: -.6px; }
  .hero-sub { font-size: 18px; }

  .block { padding: 26px 24px; }
  .btn { max-width: 520px; margin-left: auto; margin-right: auto; }
  .btn-note { max-width: 520px; margin-left: auto; margin-right: auto; }
}

/* 鼠标设备才加悬停效果，触屏不会「粘住」 */
@media (hover: hover) and (pointer: fine) {
  .card { transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
  .card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lift);
    border-color: var(--line-strong);
  }
  .btn { transition: filter .16s ease, background-color .16s ease; }
  .btn:not(:disabled):hover { filter: brightness(1.06); }
  .btn-quiet:not(:disabled):hover { filter: none; background: var(--bg); }
}
