/* KeyVitals 下载站 (download.keyvitals.ai) —— 纯静态, 不引外部字体/脚本/样式。
 *
 * 颜色: 与 App 图标 (黑底白条纹) 一致的中性黑白灰; 只有「可以下载 / 准备中」两种状态带颜色,
 * 「读取中 / 暂时读不到」(还不知道有没有包) 是灰色的。
 * 深浅色跟随系统 (这一页没有手动切换, 所以只有两态: 裸 :root = 浅, 媒体查询 = 深)。
 * 文字色的对比度 (WCAG, 对各自的底色) 写在令牌旁边, 改色要两个模式一起量。
 *
 * 间距: 每一摞东西的上下间距只有一个出处 —— 容器的 gap, 子元素不带外边距
 * (docs/standards/ui-pitfalls.md 第 42 条)。手机上能点的东西不小于 44px (第 6 条)。
 */
:root {
  --canvas: #f4f4f2;
  --paper: #ffffff;
  --soft: #f1f1ee;
  --ink: #141414;          /* 18.4:1 对 paper, 16.7:1 对 canvas */
  --muted: #5a5a56;        /* 6.9:1 对 paper, 6.3:1 对 canvas, 6.1:1 对 soft */
  --line: rgba(20, 20, 20, 0.12);
  --action-bg: #141414;
  --action-ink: #ffffff;   /* 18.4:1 */
  --disabled-bg: #e7e7e3;
  --disabled-ink: #55554f; /* 6.1:1 对 disabled-bg */
  --ready-bg: #e2f2e7;
  --ready-ink: #155f36;    /* 6.7:1 对 ready-bg */
  --waiting-bg: #faeed6;
  --waiting-ink: #6e4600;  /* 7.2:1 对 waiting-bg */
  --error-bg: #fdeceb;
  --error-line: #efc4be;
  --error-ink: #87201a;    /* 8.2:1 对 error-bg */
  --focus: #2458d6;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 14px 36px rgba(0, 0, 0, 0.06);
  color-scheme: light dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

html:lang(ja) {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Noto Sans CJK JP", "Noto Sans JP", "Yu Gothic UI", "Meiryo", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #0f0f0f;
    --paper: #1a1a1a;
    --soft: #222221;
    --ink: #f1f1ee;          /* 15.4:1 对 paper, 16.9:1 对 canvas */
    --muted: #a9a9a3;        /* 7.4:1 对 paper, 8.1:1 对 canvas, 6.7:1 对 soft */
    --line: rgba(255, 255, 255, 0.13);
    --action-bg: #f1f1ee;
    --action-ink: #121212;   /* 16.6:1 */
    --disabled-bg: #282827;
    --disabled-ink: #a9a9a3; /* 6.3:1 对 disabled-bg */
    --ready-bg: #163020;
    --ready-ink: #7fd8a3;    /* 8.3:1 对 ready-bg */
    --waiting-bg: #352710;
    --waiting-ink: #f3c164;  /* 8.7:1 对 waiting-bg */
    --error-bg: #3a1c19;
    --error-line: #6c3832;
    --error-ink: #ffb8b0;    /* 9.4:1 对 error-bg */
    --focus: #8fb2ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 36px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
/* 行高写死: 默认的 normal 按字体算, 中文 (「安卓」) 和拉丁字母 (「iPhone」) 的行高不一样,
 * 并排的两张卡标题行差 2px、下面每一块都跟着错开 (2026-09-27 在 1366 上量到 424 vs 420)。 */
body { min-height: 100vh; margin: 0; background: var(--canvas); color: var(--ink); line-height: 1.5; }
h1, h2, p, dl, dd, ol, ul { margin: 0; }
button { font: inherit; color: inherit; }
a { color: inherit; }

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---- 页面外壳: 一列, 间距只由 gap 决定 ---- */
.page-shell {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(32px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ---- 顶栏: 左品牌, 右语言 ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  text-decoration: none;
}

.brand__icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--line);
}

.brand__name { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }

.lang-switch {
  display: inline-flex;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
}

.lang-switch__option {
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.lang-switch__option[aria-pressed="true"] { background: var(--action-bg); color: var(--action-ink); }

/* ---- 标题区 ---- */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

html:lang(en) .eyebrow { text-transform: uppercase; }

.hero__title { display: flex; flex-direction: column; align-items: center; gap: 8px; }

.hero h1 {
  font-size: clamp(44px, 12vw, 76px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.035em;
}

.hero__subtitle { color: var(--muted); font-size: clamp(18px, 4.8vw, 22px); font-weight: 600; }

.hero__intro { max-width: 40em; font-size: clamp(16px, 4.2vw, 18px); line-height: 1.6; text-wrap: balance; }

/* ---- 出错提示 ---- */
.notice {
  width: 100%;
  max-width: 760px;
  align-self: center;
  padding: 12px 16px;
  border: 1px solid var(--error-line);
  border-radius: 12px;
  color: var(--error-ink);
  background: var(--error-bg);
  font-size: 14px;
  line-height: 1.5;
}

/* ---- 两张平台卡 ---- */
.downloads { display: grid; gap: 16px; }

/* 卡片 = 主体 + 底部的「安装说明 / 常见问题」一行。并排时两张卡等高 (grid 拉伸), 这一行
 * 贴底 —— 两张卡的内容高度不一样, 富余落在主体和底行之间, 两边的底行对齐;
 * 不贴底的话, 矮的那张卡底部会空出一截 (2026-09-27 在 1366 上看到, iOS 卡底下空约 70px)。 */
.platform-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.platform-card__body { display: flex; flex-direction: column; gap: 18px; }

.platform-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.platform-name { font-size: 22px; font-weight: 750; line-height: 1.3; letter-spacing: -0.02em; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--waiting-ink);
  background: var(--waiting-bg);
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.platform-card[data-state="ready"] .status-pill { color: var(--ready-ink); background: var(--ready-bg); }
/* 还没读到 config (读取中 / 读不到): 不知道有没有包, 不用「准备中」的琥珀色。muted 对 soft 6.1:1 / 深色 6.7:1 */
.platform-card[data-state="unknown"] .status-pill { color: var(--muted); background: var(--soft); }

.release-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--line);
}

.release-meta > div { min-width: 0; padding: 11px 13px; background: var(--paper); }
.release-meta__wide { grid-column: 1 / -1; }
.release-meta dt { color: var(--muted); font-size: 12px; font-weight: 600; }
.release-meta dd {
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* 320 宽的手机上按钮里只剩 197px: 卡片内边距 18、按钮内边距 16、间距 10 是为了让
 * 「Android 版をダウンロード」(194) 和「iOS version coming soon」(190) 一行放下 (2026-09-27 实测)。 */
.primary-action {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 16px;
  border-radius: 14px;
  color: var(--action-ink);
  background: var(--action-bg);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 120ms ease, opacity 160ms ease;
}

.primary-action:hover { opacity: 0.92; }
.primary-action:active { transform: scale(0.985); }
.primary-action[aria-disabled="true"] {
  color: var(--disabled-ink);
  background: var(--disabled-bg);
  cursor: not-allowed;
  pointer-events: none;
}
.primary-action__glyph { flex: 0 0 auto; font-size: 18px; }

.checksum,
.card-note {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--soft);
}

.checksum__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.checksum__label { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; }
.checksum code {
  display: block;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
}
.checksum__hint { color: var(--muted); font-size: 13px; line-height: 1.65; text-wrap: pretty; }
.card-note__title { font-size: 14px; font-weight: 700; }
.card-note__steps { padding-left: 1.3em; color: var(--muted); font-size: 13px; line-height: 1.65; text-wrap: pretty; }

.text-button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.install-help { border-top: 1px solid var(--line); }
.install-help summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
  font-size: 15px;
  font-weight: 650;
  list-style: none;
  cursor: pointer;
}
.install-help summary::-webkit-details-marker { display: none; }
.install-help summary::after { content: "+"; flex: 0 0 auto; color: var(--muted); font-size: 20px; font-weight: 500; }
.install-help[open] summary::after { content: "−"; }
.install-help ol,
.install-help ul {
  padding: 4px 0 2px 1.3em;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  text-wrap: pretty;
}

/* ---- 登录说明 / 页脚 ---- */
.login-note {
  width: 100%;
  max-width: 640px;
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}
.login-note__title { font-size: 16px; font-weight: 700; }
.login-note__text { color: var(--muted); font-size: 15px; line-height: 1.65; text-wrap: balance; }

.site-footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
  text-align: center;
  text-wrap: balance;
}

@media (min-width: 760px) {
  .page-shell {
    padding-left: max(32px, env(safe-area-inset-left));
    padding-right: max(32px, env(safe-area-inset-right));
    gap: 48px;
  }
  .downloads { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
  .platform-card { padding: 28px; }
}

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