/* ==========================================================================
   TierCliff — stylesheet
   Light-first, with a dark mode that follows the OS and can be toggled.
   No framework, no build step: this ships as-is to Cloudflare Pages.
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f7fa;
  --bg-card: #ffffff;
  --bg-inset: #f1f3f7;
  --text: #12161d;
  --text-soft: #59616f;
  --text-faint: #878f9c;
  --line: #e2e6ee;
  --line-strong: #cbd2de;
  --accent: #2f5bea;
  --accent-soft: #eef2ff;
  --accent-line: #c9d5fb;
  --good: #16794a;
  --good-soft: #e9f7ef;
  --warn: #9a5b0d;
  --warn-soft: #fdf4e6;
  --danger: #b42318;
  --danger-soft: #fef1f0;
  --danger-line: #f6c9c5;
  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .05);
}

html[data-theme="dark"] {
  --bg: #0e1117;
  --bg-soft: #13171e;
  --bg-card: #161b23;
  --bg-inset: #1d232c;
  --text: #e7ecf4;
  --text-soft: #a1abba;
  --text-faint: #798394;
  --line: #242c37;
  --line-strong: #35404f;
  --accent: #7d96ff;
  --accent-soft: #141a2e;
  --accent-line: #26314f;
  --good: #4cc38a;
  --good-soft: #12241b;
  --warn: #d8ab4e;
  --warn-soft: #251d10;
  --danger: #f2857c;
  --danger-soft: #2a1512;
  --danger-line: #4a2320;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

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

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

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 20px; height: 60px; }
.brand {
  font-weight: 650; font-size: 16px; letter-spacing: -.01em;
  color: var(--text); display: flex; align-items: center; gap: 8px;
}
.brand:hover { text-decoration: none; }
.brand-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); flex: none;
}
.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav a {
  color: var(--text-soft); font-size: 14px; padding: 7px 11px;
  border-radius: var(--radius-sm);
}
.nav a:hover { background: var(--bg-inset); color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--text); font-weight: 550; }

.theme-toggle {
  background: none; border: 1px solid var(--line); color: var(--text-soft);
  width: 34px; height: 34px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 15px; line-height: 1; display: grid; place-items: center; padding: 0;
}
.theme-toggle:hover { background: var(--bg-inset); color: var(--text); }

/* ---------- hero ---------- */

.hero { padding: 56px 0 34px; }
.hero h1 {
  font-size: clamp(28px, 4.4vw, 42px);
  line-height: 1.16; letter-spacing: -.025em; font-weight: 680;
  margin: 0 0 14px; max-width: 22ch;
}
.hero p.lede { font-size: 17px; color: var(--text-soft); max-width: 64ch; margin: 0 0 20px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent-line);
  font-size: 12.5px; font-weight: 550; letter-spacing: .01em;
  padding: 4px 11px; border-radius: 100px; margin-bottom: 18px;
}
.pill .live { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* ---------- layout ---------- */

.tool {
  display: grid; grid-template-columns: 390px 1fr; gap: 22px;
  align-items: start; padding-bottom: 8px;
}
@media (max-width: 880px) { .tool { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card + .card { margin-top: 18px; }

.card h2, .card h3 { margin: 0 0 4px; }
.card h2 { font-size: 16px; font-weight: 620; letter-spacing: -.01em; }
.card h3 { font-size: 14.5px; font-weight: 600; }
.card .sub { font-size: 13px; color: var(--text-faint); margin: 0 0 16px; }

/* ---------- form controls ---------- */

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--text-soft); margin-bottom: 6px;
  letter-spacing: .02em; text-transform: uppercase;
}
select, input[type="number"], input[type="text"] {
  width: 100%; padding: 9px 11px; font-size: 14.5px; font-family: inherit;
  color: var(--text); background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23878f9c' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 32px;
}
select:focus, input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.range-val {
  font-family: var(--mono); font-size: 13px; color: var(--text-soft);
  min-width: 58px; text-align: right;
}

/* switch (regional processing) */
.switch-row {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  padding: 11px 13px; background: var(--bg-inset); border-radius: var(--radius-sm);
}
.switch-row .sw-label { font-size: 13.5px; color: var(--text-soft); }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track {
  position: absolute; inset: 0; background: var(--line-strong);
  border-radius: 100px; transition: .15s ease; pointer-events: none;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: .15s ease;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- chips ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line-strong); background: var(--bg);
  color: var(--text-soft); font-family: var(--mono); font-size: 12.5px;
  padding: 6px 12px; border-radius: 100px; cursor: pointer;
  transition: .12s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 600;
}
.chip[disabled] { opacity: .35; cursor: not-allowed; text-decoration: line-through; }
.chip[disabled]:hover { border-color: var(--line-strong); color: var(--text-soft); }

/* ---------- verdict ---------- */

.verdict {
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  border-radius: var(--radius); padding: 18px 20px;
}
.verdict .kicker {
  font-size: 11.5px; font-weight: 650; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 8px;
}
.verdict .pick { font-size: 21px; font-weight: 660; letter-spacing: -.02em; }
.verdict .pick .sep { color: var(--text-faint); font-weight: 400; }
.verdict .why { font-size: 14px; color: var(--text-soft); margin-top: 8px; }

/* ---------- cliff banner ---------- */

.cliff {
  border-radius: var(--radius); padding: 16px 18px; margin: 18px 0 0;
  border: 1px solid var(--danger-line); background: var(--danger-soft);
}
.cliff--near { border-color: var(--accent-line); background: var(--accent-soft); }
.cliff-kicker {
  font-size: 11.5px; font-weight: 680; letter-spacing: .08em;
  text-transform: uppercase; color: var(--danger); margin-bottom: 7px;
}
.cliff--near .cliff-kicker { color: var(--accent); }
.cliff-body { margin: 0; font-size: 14.5px; color: var(--text-soft); }
.cliff-fix {
  margin-top: 11px; padding-top: 11px; border-top: 1px dashed var(--danger-line);
  font-size: 14.5px; color: var(--text-soft);
}
.cliff strong { color: var(--text); font-weight: 620; }

/* ---------- numbers ---------- */

.big-num {
  font-size: 34px; font-weight: 660; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.big-num .unit { font-size: 15px; font-weight: 500; color: var(--text-faint); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 700px) { .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.stat { background: var(--bg-inset); border-radius: var(--radius-sm); padding: 13px 14px; }
.stat .k {
  font-size: 11.5px; font-weight: 600; color: var(--text-faint);
  letter-spacing: .04em; text-transform: uppercase; margin-bottom: 5px;
}
.stat .v {
  font-family: var(--mono); font-size: 18px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stat .v small { font-size: 12px; color: var(--text-faint); font-weight: 400; }

/* ---------- table ---------- */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th {
  font-size: 11.5px; font-weight: 620; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .04em;
}
td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: none; }
tr.is-best td { background: var(--good-soft); }
tr.is-best td:first-child { font-weight: 600; }
/* 长上下文档位是「更贵」的那一档，不能用绿色最优样式误导读者 */
tr.is-over td { background: var(--danger-soft); }
tr.is-over td:first-child { font-weight: 620; color: var(--danger); }
.badge {
  display: inline-block; font-size: 11px; font-weight: 620;
  padding: 2px 7px; border-radius: 100px; margin-left: 7px;
  background: var(--good); color: #fff; vertical-align: 1px;
}

/* ---------- bars ---------- */

.bar-row { margin-bottom: 11px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-head {
  display: flex; justify-content: space-between; font-size: 13px;
  margin-bottom: 5px; color: var(--text-soft);
}
.bar-head b { color: var(--text); font-weight: 600; }
.bar-head span { font-family: var(--mono); }
.bar-track { height: 7px; background: var(--bg-inset); border-radius: 100px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 100px; transition: width .3s ease; }
.bar-row.is-best .bar-fill { background: var(--good); }

/* ---------- prose (SEO pages) ---------- */

.prose { max-width: 74ch; padding: 8px 0 40px; }
.prose h2 { font-size: 24px; font-weight: 650; letter-spacing: -.02em; margin: 42px 0 12px; }
.prose h3 { font-size: 18px; font-weight: 620; margin: 28px 0 8px; }
.prose p, .prose li { color: var(--text-soft); }
.prose strong { color: var(--text); font-weight: 620; }
.prose code {
  font-family: var(--mono); font-size: .89em; background: var(--bg-inset);
  padding: 2px 5px; border-radius: 5px; color: var(--text);
}
.prose pre {
  background: var(--bg-inset); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 14px 16px; overflow-x: auto;
}
.prose pre code { background: none; padding: 0; font-size: 13px; line-height: 1.55; }
.prose ul, .prose ol { padding-left: 20px; }
.prose li { margin-bottom: 6px; }
.callout {
  border-left: 3px solid var(--accent); background: var(--bg-soft);
  padding: 13px 17px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 20px 0; font-size: 14.5px;
}
.callout p { margin: 0; }
.warn-box {
  border-left: 3px solid var(--warn); background: var(--warn-soft);
  padding: 13px 17px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 20px 0; font-size: 14.5px;
}
.warn-box p { margin: 0; color: var(--text-soft); }

/* ---------- FAQ ---------- */

details { border-bottom: 1px solid var(--line); padding: 14px 0; }
details summary {
  cursor: pointer; font-weight: 600; font-size: 15.5px; color: var(--text);
  list-style: none; display: flex; justify-content: space-between; gap: 14px;
}
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; color: var(--text-faint); font-weight: 400; }
details[open] summary::after { content: "–"; }
details p { margin: 10px 0 0; font-size: 14.5px; color: var(--text-soft); }

/* ---------- ad slots ---------- */

/* Ad containers ship hidden while the ad unit ID is still a placeholder
   (see assets/ads.js). A visible "paste your ad unit here" box on a live site
   looks unfinished and is a common reason AdSense applications get rejected. */
.ad-slot { margin: 26px 0; text-align: center; }
.ad-slot--pending { display: none !important; }
.ad-slot ins.adsbygoogle { display: block; }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line); margin-top: 56px;
  padding: 30px 0 46px; font-size: 13.5px; color: var(--text-faint);
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 18px; }
.site-footer nav { margin-left: auto; display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--text-soft); }
.footnote { margin-top: 18px; font-size: 12.5px; line-height: 1.6; max-width: 92ch; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
