/*
 * AptaPilot 门户样式 —— 对齐 zxiaohan.com 与 web-portal-design.md §2。
 * 浅色极简：白/米底、近黑字、干净无衬线、克制强调色、白底细边小圆角卡片、
 * "→" 文字 CTA、中英双语、跟随系统深浅色。
 */

:root {
  /* §2 tokens —— 浅色 */
  --bg: #ffffff;
  --bg-2: #fafafa;
  --text: #111111;
  --text-muted: #666666;
  --border: #e5e5e5;
  /* 克制强调色：仅链接/主 CTA 用低饱和蓝 */
  --accent: #2563eb;
  --accent-contrast: #ffffff;

  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --radius: 3px;
  --maxw: 880px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e10;
    --bg-2: #17171a;
    --text: #ededed;
    --text-muted: #9a9a9f;
    --border: #2a2a2e;
    --accent: #6ea3ff;
    --accent-contrast: #0e0e10;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── 布局 ──────────────────────────────────────────────── */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 56px 0;
  border-top: 1px solid var(--border);
}
.section:first-of-type { border-top: 0; }

/* 编号分区标签，如 "/ 001 — 你拥有什么" */
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 20px;
}

/* ── 排版 ──────────────────────────────────────────────── */
h1, h2, h3 { font-weight: 400; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 40px; line-height: 1.12; font-weight: 300; }
h2 { font-size: 24px; line-height: 1.2; }
h3 { font-size: 17px; }

p { margin: 0 0 14px; }
.muted { color: var(--text-muted); }
.zh { color: var(--text-muted); font-size: 0.95em; }        /* 中文副行 */
.lead { font-size: 19px; line-height: 1.5; }

a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }

/* ── 顶栏 / 页脚 ───────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0; border-bottom: 1px solid var(--border);
}
.brand { font-weight: 500; letter-spacing: -0.01em; text-decoration: none; color: var(--text); }
.brand:hover { color: var(--text); }
.topnav { display: flex; gap: 22px; align-items: center; font-size: 14px; }
.topnav a { text-decoration: none; color: var(--text-muted); }
.topnav a:hover { color: var(--accent); }

.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0 56px;
  color: var(--text-muted);
  font-size: 13px;
  display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; justify-content: space-between;
}
.footer a { color: var(--text-muted); text-decoration: none; }
.footer a:hover { color: var(--accent); text-decoration: underline; }
.footer nav { display: flex; gap: 20px; flex-wrap: wrap; }

/* ── CTA ───────────────────────────────────────────────── */
.cta-row { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; margin-top: 26px; }

/* "→" 文字 CTA（默认黑字） */
.cta {
  text-decoration: none; color: var(--text); font-size: 15px;
  border-bottom: 1px solid var(--text); padding-bottom: 2px;
}
.cta:hover { color: var(--accent); border-color: var(--accent); }
.cta .arrow { margin-left: 6px; }

/* 主按钮：实心，仅主 CTA 用强调色 */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-size: 15px; cursor: pointer;
  padding: 11px 18px; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-contrast);
  border: 1px solid var(--accent); text-decoration: none;
}
.btn:hover { color: var(--accent-contrast); opacity: 0.9; }
.btn.secondary {
  background: transparent; color: var(--text); border-color: var(--border);
}
.btn.secondary:hover { color: var(--text); border-color: var(--text); opacity: 1; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ── 卡片 / 网格 ───────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 620px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.card .num { font-size: 12px; color: var(--text-muted); letter-spacing: 0.08em; }
.card h3 { margin: 8px 0 6px; }
.card p { font-size: 14px; margin: 0 0 6px; }

/* 权益 / 授权行 */
.ent {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 14px 0; border-top: 1px solid var(--border);
}
.ent:first-child { border-top: 0; }
.ent .name { font-weight: 500; }
.ent .feat { color: var(--text-muted); font-size: 13px; }
.badge {
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 2px 9px; color: var(--text-muted); white-space: nowrap;
}
.badge.plan { border-color: var(--accent); color: var(--accent); }

/* ── 表单 ──────────────────────────────────────────────── */
.panel {
  max-width: 400px; margin: 48px auto;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-2); padding: 28px;
}
.tabs { display: flex; gap: 4px; margin-bottom: 22px; border-bottom: 1px solid var(--border); }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent;
  font: inherit; font-size: 15px; color: var(--text-muted);
  padding: 8px 4px; margin-bottom: -1px; cursor: pointer;
}
.tab.active { color: var(--text); border-bottom-color: var(--text); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.field input {
  width: 100%; font: inherit; font-size: 15px;
  padding: 10px 12px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.field input:focus { outline: none; border-color: var(--accent); }

.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: 12px; margin: 18px 0;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.oauth-btn {
  width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: inherit; font-size: 15px; cursor: pointer;
  padding: 11px 16px; border-radius: var(--radius);
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  text-decoration: none;
}
.oauth-btn:hover { border-color: var(--text); color: var(--text); }

.msg { font-size: 13px; margin: 12px 0 0; min-height: 18px; }
.msg.err { color: #c0392b; }
.msg.ok { color: var(--text-muted); }
@media (prefers-color-scheme: dark) { .msg.err { color: #ff8f80; } }

.link-btn {
  background: none; border: 0; font: inherit; font-size: 13px; color: var(--text-muted);
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px; padding: 0;
}
.link-btn:hover { color: var(--accent); }

/* 全局配置缺失横幅（占位 anon key 时提示部署者） */
.config-warn {
  background: #fff8e1; border: 1px solid #ffe082; color: #7a5c00;
  border-radius: var(--radius); padding: 12px 16px; font-size: 13px; margin: 18px 0;
}
@media (prefers-color-scheme: dark) {
  .config-warn { background: #241f10; border-color: #4d4324; color: #d9c88a; }
}

.hidden { display: none !important; }
.stack > * + * { margin-top: 10px; }
.center { text-align: center; }
