:root {
  --paper: #f7f6f1;
  --paper-deep: #efece3;
  --card: #fffefa;
  --ink: #17161a;
  --ink-soft: #3b3833;
  --muted: #6f6b62;
  --line: #e0dbd0;
  --line-strong: #cfc8ba;
  --accent: #2b5c4c;
  --accent-soft: #e6efe9;
  --accent-ink: #1d4034;
  --warn: #a46b1e;
  --warn-soft: #f6ecda;
  --danger: #9e3f2e;
  --danger-soft: #f6e6e2;
  --blue: #2f4c72;
  --shadow: 0 1px 2px rgba(23, 22, 26, .05), 0 8px 24px -16px rgba(23, 22, 26, .28);
  --radius: 14px;
  --serif: "Songti SC", "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", "Noto Serif CJK", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  /* 横屏/微信里系统会自动放大文字，锁住它 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
/* 移动端：去掉双击缩放带来的 300ms 延迟和灰色高亮 */
button, .btn, .option, .tab, .link-btn, .steps button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }

/* 刘海屏 / 底部横条：viewport-fit=cover 之后必须自己让开安全区 */
.wrap {
  max-width: 760px; margin: 0 auto;
  padding: calc(24px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) calc(80px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left));
}
.wrap-wide {
  max-width: 1120px; margin: 0 auto;
  padding: calc(24px + env(safe-area-inset-top)) calc(24px + env(safe-area-inset-right)) calc(80px + env(safe-area-inset-bottom)) calc(24px + env(safe-area-inset-left));
}

/* ── 顶栏 ─────────────────────────────────────────── */
.topbar {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; padding: 18px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 22px;
}
.brand { font-family: var(--serif); font-size: 22px; letter-spacing: .12em; }
.brand small { font-family: var(--sans); font-size: 12px; letter-spacing: .08em; color: var(--muted); margin-left: 10px; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.who { color: var(--ink-soft); }
.link-btn { background: none; border: 0; color: var(--muted); padding: 4px; font-size: 13px; }
.link-btn:hover { color: var(--danger); }

/* ── 标题区 ───────────────────────────────────────── */
.eyebrow { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
h1.display { font-family: var(--serif); font-size: 30px; line-height: 1.25; margin: 0 0 6px; font-weight: 600; letter-spacing: .01em; }
h2.section { font-family: var(--serif); font-size: 18px; margin: 0 0 12px; font-weight: 600; }
.lede { color: var(--muted); margin: 0 0 24px; font-size: 14px; }

/* ── 卡片 ─────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title { font-family: var(--serif); font-size: 17px; margin: 0; }
.card-sub { font-size: 12px; color: var(--muted); }

/* ── 数字 ─────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stat { background: var(--card); padding: 16px 18px; }
.stat-num { font-family: var(--serif); font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; color: var(--muted); letter-spacing: .06em; margin-top: 4px; }

/* ── 按钮 ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--card); color: var(--ink); transition: .15s; font-size: 14px;
}
.btn:hover { border-color: var(--ink-soft); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fdfcf8; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 8px 10px; }
.btn-ghost:hover { color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ── 表单 ─────────────────────────────────────────── */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; letter-spacing: .04em; }
.input, .textarea, .select {
  width: 100%; padding: 11px 13px; background: var(--card);
  border: 1px solid var(--line-strong); border-radius: 10px; outline: none; transition: .15s;
  /* 16px 是 iOS 的红线：小于它，聚焦时 Safari/WKWebView 会自动放大页面，而且不缩回去 */
  font-size: 16px;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; font-size: 13px; }

/* ── 题卡 ─────────────────────────────────────────── */
.progress-strip { display: flex; gap: 6px; margin-bottom: 18px; }
.dot { height: 4px; flex: 1; background: var(--line); border-radius: 2px; transition: .2s; }
.dot.done { background: var(--accent); }
.dot.current { background: var(--ink); }
.dot.bad { background: var(--danger); }

.q-purpose { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.q-purpose.verify { color: var(--accent); }
.q-stem { font-family: var(--serif); font-size: 20px; line-height: 1.85; margin: 10px 0 18px; }
.options { display: grid; gap: 8px; margin-bottom: 16px; }
.option {
  text-align: left; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--card); font-size: 15px; transition: .12s;
}
.option:hover { border-color: var(--ink-soft); }
.option.chosen { border-color: var(--accent); background: var(--accent-soft); }
.steps-hint { margin: 14px 0 4px; }
.steps-hint summary { font-size: 12px; color: var(--muted); cursor: pointer; }
.steps { list-style: none; padding: 10px 0 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.steps button {
  border: 1px dashed var(--line-strong); background: transparent; color: var(--muted);
  padding: 5px 10px; border-radius: 20px; font-size: 12px;
}
.steps button.on { border-style: solid; border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ── 诊断结果 ─────────────────────────────────────── */
.verdict { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 17px; margin-bottom: 10px; }
.verdict-bad { color: var(--danger); }
.verdict-ok { color: var(--accent); }
.verdict-review { color: var(--warn); }
.verdict-note { font-size: 13px; color: var(--muted); margin: 0 0 16px; }
.cause-card {
  border-left: 3px solid var(--danger); background: var(--danger-soft);
  padding: 14px 16px; border-radius: 0 10px 10px 0; margin: 14px 0;
}
.cause-card.calm { border-left-color: var(--accent); background: var(--accent-soft); }
.cause-title { font-family: var(--serif); font-size: 16px; margin: 0 0 4px; }
.cause-symptom { font-size: 13px; color: var(--ink-soft); margin: 0 0 10px; }
.cause-fix { font-size: 13px; margin: 0; padding-left: 12px; border-left: 2px solid rgba(0,0,0,.12); }
.cause-fix b { display: block; font-size: 11px; letter-spacing: .08em; color: var(--muted); font-weight: 500; margin-bottom: 2px; }

/* ── 芯片 / 徽标 ──────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px;
  font-size: 11px; letter-spacing: .04em; border: 1px solid transparent;
}
.chip-open { background: var(--danger-soft); color: var(--danger); border-color: #ecd4ce; }
.chip-repairing { background: var(--warn-soft); color: var(--warn); border-color: #eddfc4; }
.chip-closed { background: var(--accent-soft); color: var(--accent-ink); border-color: #cfdfd4; }
.chip-untested { background: var(--paper-deep); color: var(--muted); border-color: var(--line); }
.chip-plain { background: var(--paper-deep); color: var(--ink-soft); border-color: var(--line); }

/* ── 进度条 ───────────────────────────────────────── */
.bar { height: 6px; background: var(--paper-deep); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }
.bar.warn > i { background: var(--warn); }
.bar.bad > i { background: var(--danger); }

/* ── 列表 ─────────────────────────────────────────── */
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row-main { min-width: 0; }
.row-title { font-size: 14px; margin: 0; }
.row-sub { font-size: 12px; color: var(--muted); margin: 2px 0 0; }
.row-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; font-variant-numeric: tabular-nums; }

.hole-list { display: grid; gap: 10px; }
.hole {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
.hole-title { font-size: 14px; }
.hole-meta { font-size: 12px; color: var(--muted); }
.hole-points { font-family: var(--serif); font-size: 18px; color: var(--danger); }
.hole-points small { font-size: 11px; color: var(--muted); font-family: var(--sans); }

/* ── 标签页 ───────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tab {
  background: none; border: 0; padding: 10px 14px; color: var(--muted); font-size: 14px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.on { color: var(--ink); border-bottom-color: var(--ink); }

/* ── 空状态 / 提示 ────────────────────────────────── */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 14px; }
.notice { padding: 12px 14px; border-radius: 10px; font-size: 13px; background: var(--warn-soft); color: var(--warn); border: 1px solid #eddfc4; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.right { text-align: right; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* ── 登录 ─────────────────────────────────────────── */
/* 微信里 100vh 会算上工具栏高度，用 dvh 兜底 */
.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid; place-items: center;
  padding: calc(24px + env(safe-area-inset-top)) calc(24px + env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) calc(24px + env(safe-area-inset-left));
}
.login-card { width: 100%; max-width: 420px; }
.login-card h1 { font-family: var(--serif); font-size: 32px; letter-spacing: .14em; margin: 0 0 6px; }
.login-card .tagline { color: var(--muted); font-size: 13px; margin: 0 0 26px; line-height: 1.7; }
.accounts { margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--line-strong); font-size: 12px; color: var(--muted); }
.accounts code { background: var(--paper-deep); padding: 1px 6px; border-radius: 4px; font-size: 11px; }
.err { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 20px; }

/* ── 落地页 ───────────────────────────────────────── */
.hero { padding: 64px 0 40px; }
.hero h1 { font-family: var(--serif); font-size: clamp(30px, 5vw, 46px); line-height: 1.3; margin: 0 0 18px; font-weight: 600; }
.hero p { color: var(--muted); font-size: 15px; max-width: 560px; }
.doors { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 32px 0; }
.door {
  display: block; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); transition: .15s;
}
.door:hover { border-color: var(--accent); transform: translateY(-2px); }
.door h3 { font-family: var(--serif); margin: 0 0 6px; font-size: 18px; }
.door p { margin: 0; font-size: 13px; color: var(--muted); }

table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th { text-align: left; font-weight: 500; color: var(--muted); font-size: 11px; letter-spacing: .06em; padding: 8px 10px; border-bottom: 1px solid var(--line-strong); }
table.grid td { padding: 10px; border-bottom: 1px solid var(--line); }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tr:hover td { background: #fff; }

/* ── 添加到桌面提示条 ─────────────────────────────── */
.install-bar {
  position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 60; max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 14px;
  background: rgba(23, 22, 26, .95); color: #f7f6f1;
  box-shadow: 0 12px 40px -12px rgba(0, 0, 0, .55);
  transform: translateY(160%); transition: transform .28s ease;
}
.install-bar.on { transform: translateY(0); }
body.has-install-bar { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.install-text { display: flex; flex-direction: column; line-height: 1.35; flex: 1; min-width: 0; }
.install-text b { font-size: 14px; font-weight: 600; }
.install-text span { font-size: 12px; color: rgba(247, 246, 241, .72); margin-top: 2px; }
.install-bar .link-btn { color: rgba(247, 246, 241, .65); font-size: 20px; line-height: 1; padding: 4px 8px; flex-shrink: 0; }
.install-bar .btn-primary { background: #f7f6f1; border-color: #f7f6f1; color: #17161a; flex-shrink: 0; }
.install-bar .btn-primary:hover { background: #fff; border-color: #fff; color: #17161a; }

@media (max-width: 640px) {
  .wrap, .wrap-wide { padding: 16px 14px 64px; }
  .card { padding: 18px; border-radius: 12px; }
  h1.display { font-size: 24px; }
  .q-stem { font-size: 18px; }
  .stat-num { font-size: 22px; }
  .hero { padding: 36px 0 24px; }
}
