:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f3f7;
  --border: #e3e6ec;
  --text: #14181f;
  --text-dim: #5c6472;
  --accent: #2563eb;
  --accent-soft: #eaf1ff;
  --good: #d93025;
  --warn: #b45309;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 24, 31, .05), 0 4px 16px rgba(20, 24, 31, .04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #161b22;
    --surface-2: #1c222b;
    --border: #2a323d;
    --text: #e6e9ef;
    --text-dim: #98a1af;
    --accent: #4b8bf5;
    --accent-soft: #16243c;
    --good: #f0554a;
    --warn: #d99b4a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .2);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }

/* ---------- header ---------- */
.site-head {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 12px;
}
.logo {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.logo-mark {
  width: 26px; height: 26px;
  background: var(--accent);
  color: #fff;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
}
.nav-links { display: flex; gap: 16px; }
.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
}
.nav-links a:hover { color: var(--accent); }
@media (max-width: 640px) { .nav-links { display: none; } }

/* ---------- hero ---------- */
.hero { padding: 32px 0 20px; }
.hero h1 { font-size: 26px; line-height: 1.3; font-weight: 750; letter-spacing: -.01em; }
.hero p { color: var(--text-dim); margin-top: 10px; font-size: 15px; }
@media (max-width: 640px) { .hero { padding: 22px 0 14px; } .hero h1 { font-size: 21px; } }

/* ---------- tool grid ---------- */
.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
  margin: 28px 0 12px;
}
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}
.tool-card h3 { font-size: 15px; font-weight: 650; margin-bottom: 5px; }
.tool-card p { font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}

/* ---------- calculator ---------- */
.calc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin: 20px 0;
}
.calc-body { display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 700px) { .calc-body { grid-template-columns: 1fr; } }
.calc-inputs { padding: 18px; border-right: 1px solid var(--border); }
@media (max-width: 700px) { .calc-inputs { border-right: none; border-bottom: 1px solid var(--border); } }
.calc-results { padding: 18px; background: var(--surface-2); }

.calc-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.field { margin-bottom: 13px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
}
.field .hint { font-weight: 400; color: var(--text-dim); font-size: 12px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .pfx {
  position: absolute; left: 11px; color: var(--text-dim); font-size: 14px; pointer-events: none;
}
.input-wrap .sfx {
  position: absolute; right: 11px; color: var(--text-dim); font-size: 13px; pointer-events: none;
}
.field input, .field select {
  width: 100%;
  padding: 9px 12px;
  font-size: 15px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.field input.has-pfx { padding-left: 28px; }
.field input.has-sfx { padding-right: 40px; }
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
  gap: 12px;
}
.result-row:last-child { border-bottom: none; }
.result-row .rl { font-size: 13px; color: var(--text-dim); }
.result-row .rv { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.result-row.primary {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.result-row.primary .rl { font-size: 13px; color: var(--text); font-weight: 600; }
.result-row.primary .rv { font-size: 24px; font-weight: 750; color: var(--accent); }

/* html 型结果（如渠道对比表）：占满整行 */
.result-row.html-block { display: block; border-bottom: none; padding: 4px 0; }
.result-row.html-block .rv { display: block; width: 100%; font-weight: 400; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.cmp-table th, .cmp-table td {
  padding: 7px 6px; text-align: right; border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.cmp-table th:first-child, .cmp-table td:first-child { text-align: left; }
.cmp-table thead th { color: var(--text-dim); font-weight: 600; font-size: 11.5px; }
.cmp-table tr.best td { background: var(--accent-soft); font-weight: 650; }
.cmp-table td.cost-neg { color: var(--good); }

.note {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  line-height: 1.55;
}

.btn-row { display: flex; gap: 8px; margin-top: 14px; }
.btn {
  flex: 1;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--accent); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { opacity: .9; background: var(--accent); }

/* ---------- content blocks ---------- */
.prose { margin: 26px 0; }
.prose h2 {
  font-size: 19px;
  font-weight: 700;
  margin: 30px 0 12px;
  letter-spacing: -.01em;
}
.prose p { margin-bottom: 12px; color: var(--text); }
.prose ul, .prose ol { margin: 0 0 14px 20px; }
.prose li { margin-bottom: 7px; }
.prose strong { font-weight: 680; }

.answer-box {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  padding: 14px 16px;
  margin: 18px 0;
  font-size: 15px;
  line-height: 1.6;
}
.answer-box .ab-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
  margin-bottom: 5px;
}

.faq-item { border-bottom: 1px solid var(--border); padding: 14px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-item h3 { font-size: 15px; font-weight: 650; margin-bottom: 6px; }
.faq-item p { font-size: 14px; color: var(--text-dim); }

/* ---------- affiliate slot ---------- */
.affiliate {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px;
  margin: 22px 0;
}
.affiliate .af-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--warn);
  margin-bottom: 6px;
}
.affiliate h3 { font-size: 15px; font-weight: 680; margin-bottom: 6px; }
.affiliate p { font-size: 13px; color: var(--text-dim); margin-bottom: 12px; }
.affiliate .af-btn {
  display: inline-block;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
}

/* ---------- ad slot ---------- */
.ad-slot {
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  margin: 20px 0;
  min-height: 60px;
  display: grid;
  place-items: center;
}

/* ---------- footer ---------- */
.site-foot {
  margin-top: 48px;
  padding: 24px 0 32px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-dim);
}
.site-foot a { color: var(--text-dim); text-decoration: none; margin-right: 14px; }
.site-foot a:hover { color: var(--accent); }

/* ---------- misc ---------- */
.breadcrumb { font-size: 13px; color: var(--text-dim); padding: 14px 0 0; }
.breadcrumb a { color: var(--text-dim); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.related { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.related a {
  font-size: 13px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
.related a:hover { border-color: var(--accent); color: var(--accent); }
