/* 知匙加速器官网：颜色与 App 的 Theme.swift 保持一致 */
:root {
  --brand: #4f7bff;
  --brand-2: #6b4fff;
  --brand-gradient: linear-gradient(135deg, #4f7bff 0%, #6b4fff 100%);
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-muted: #eef1fa;
  --border: #e3e7f2;
  --text: #1b2140;
  --text-2: #6a7394;
  --text-3: #9aa1bc;
  --todo-bg: #fff3d6;
  --todo-text: #8a5a00;
  --shadow: 0 10px 30px rgba(27, 33, 64, 0.08);
  --radius: 16px;
  --radius-lg: 24px;
  --gutter: 16px;
  --readable: 760px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0f1a;
    --surface: #171a2b;
    --surface-muted: #22263a;
    --border: #2c3048;
    --text: #f2f4ff;
    --text-2: #9aa2c2;
    --text-3: #6b7291;
    --todo-bg: #3a2c0c;
    --todo-text: #ffcf70;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0d0f1a;
  --surface: #171a2b;
  --surface-muted: #22263a;
  --border: #2c3048;
  --text: #f2f4ff;
  --text-2: #9aa2c2;
  --text-3: #6b7291;
  --todo-bg: #3a2c0c;
  --todo-text: #ffcf70;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.7 -apple-system, BlinkMacSystemFont, "PingFang SC", "PingFang TC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }

.nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav a {
  color: var(--text-2);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 15px;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--surface-muted); text-decoration: none; }

.lang-switch { position: relative; }
.lang-switch select {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: 14px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 26px 5px 10px;
  cursor: pointer;
}
.lang-switch::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--text-3);
  border-bottom: 1.5px solid var(--text-3);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

@media (max-width: 560px) {
  .nav .nav-optional { display: none; }
  .brand span { font-size: 15px; }
}

/* ---------- 首页 ---------- */
.hero {
  padding: 56px 0 40px;
  overflow: hidden;
}
.hero .container {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 40px;
}
.hero-eyebrow {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 16px;
}
.hero h1 {
  font-size: clamp(32px, 6vw, 52px);
  line-height: 1.15;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
}
.hero h1 .grad {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p.lead {
  font-size: 18px;
  color: var(--text-2);
  margin: 0 0 28px;
  max-width: 34em;
}
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 16px;
  border: 1px solid transparent;
}
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn-primary { background: var(--brand-gradient); color: #fff; box-shadow: 0 8px 20px rgba(79, 123, 255, 0.35); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn svg { width: 20px; height: 20px; }
.btn[aria-disabled="true"] { opacity: 0.6; pointer-events: none; }

.hero-note { margin-top: 14px; font-size: 13px; color: var(--text-3); }

.phone {
  justify-self: center;
  width: min(300px, 78vw);
  aspect-ratio: 1206 / 2622;
  border-radius: 44px;
  padding: 10px;
  background: #0b0d16;
  box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  position: relative;
}
.phone img, .phone .screen {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 34px;
}
.phone .screen { background: var(--brand-gradient); }
.hero-visual { position: relative; display: grid; place-items: center; }
.hero-visual::before {
  content: "";
  position: absolute;
  width: 120%;
  aspect-ratio: 1;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--brand) 22%, transparent), transparent);
  z-index: -1;
}

@media (max-width: 820px) {
  .hero { padding-top: 36px; }
  .hero .container { grid-template-columns: 1fr; text-align: center; }
  .hero p.lead { margin-left: auto; margin-right: auto; }
  .cta-row { justify-content: center; }
}

.section { padding: 48px 0; }
.section-title { text-align: center; margin-bottom: 32px; }
.section-title h2 { font-size: clamp(24px, 4vw, 32px); margin: 0 0 8px; }
.section-title p { color: var(--text-2); margin: 0; }

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 900px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .features { grid-template-columns: 1fr; } }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.card .icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--brand);
  margin-bottom: 14px;
}
.card .icon svg { width: 24px; height: 24px; }
.card h3 { margin: 0 0 6px; font-size: 18px; }
.card p { margin: 0; color: var(--text-2); font-size: 15px; }

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  counter-reset: step;
}
.step { position: relative; padding-top: 52px; }
.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  top: 20px;
  left: 24px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: grid;
  place-items: center;
}

.contact-card {
  text-align: center;
  background: var(--brand-gradient);
  color: #fff;
  border: 0;
}
.contact-card h2 { margin: 0 0 8px; }
.contact-card p { color: rgba(255, 255, 255, 0.85); margin: 0 0 20px; }
.contact-card .btn-secondary { background: #fff; color: #1b2140; border-color: transparent; }

/* ---------- 协议与帮助页 ---------- */
.doc {
  max-width: var(--readable);
  margin: 0 auto;
  padding: 32px var(--gutter) 56px;
}
.doc-header h1 { font-size: clamp(26px, 5vw, 34px); line-height: 1.25; margin: 0 0 8px; }
.doc-meta { color: var(--text-3); font-size: 14px; margin: 0 0 24px; }
.doc-meta span + span::before { content: "·"; margin: 0 8px; }

.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 16px;
  margin-bottom: 28px;
}
.toc summary {
  cursor: pointer;
  font-weight: 600;
  padding: 10px 0;
  list-style: none;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: "+"; float: right; color: var(--text-3); font-weight: 400; }
.toc[open] summary::after { content: "−"; }
.toc ol { margin: 0 0 12px; padding-left: 1.4em; }
.toc li { margin: 4px 0; font-size: 15px; }
.toc a { color: var(--text-2); }

.prose h2 {
  font-size: 21px;
  line-height: 1.4;
  margin: 36px 0 12px;
  padding-top: 8px;
  scroll-margin-top: 72px;
}
.prose h3 { font-size: 17px; margin: 24px 0 8px; scroll-margin-top: 72px; }
.prose p, .prose ul, .prose ol { margin: 0 0 14px; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 4px 0; }
.prose strong { font-weight: 600; }
.prose blockquote {
  margin: 0 0 16px;
  padding: 12px 16px;
  background: var(--surface-muted);
  border-radius: 12px;
  color: var(--text-2);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.table-wrap {
  overflow-x: auto;
  margin: 0 0 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  -webkit-overflow-scrolling: touch;
}
.prose table { border-collapse: collapse; width: 100%; font-size: 14px; min-width: 520px; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.prose th { background: var(--surface-muted); font-weight: 600; white-space: nowrap; }
.prose tr:last-child td { border-bottom: 0; }

mark.todo {
  background: var(--todo-bg);
  color: var(--todo-text);
  border-radius: 4px;
  padding: 0 4px;
}

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0 40px;
  color: var(--text-3);
  font-size: 14px;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 14px; }
.footer-links a { color: var(--text-2); }
.footer-meta p { margin: 4px 0; }
.footer-meta a { color: var(--text-3); }

/* ---------- App 内显示（?app=1）：去掉导航和页脚，贴合 App 的阅读样式 ---------- */
html.in-app .site-header,
html.in-app .site-footer,
html.in-app .app-hide { display: none !important; }
html.in-app .doc { padding-top: 20px; padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
html.in-app body { background: var(--surface); }
html.in-app .toc { background: var(--bg); }
