:root {
  --ink: #121212;
  --muted: #6B665C;
  --body: #3A372F;
  --paper: #F2EEE5;
  --pos: #1F6B47;
  --neg: #A83A22;
  --row-hi: #E7E1D4;
  --hover: #EAE5DA;
  --rule: #D3CCBD;
  --off: #C9C2B3;
  --bar-bg: #E2DCCF;
  --serif: "Instrument Serif", "Noto Serif SC", serif;
  --sans: "IBM Plex Sans", "Noto Sans SC", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--pos); }
button { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }

.shell { min-height: 100vh; display: flex; flex-direction: column; }
.wrap { max-width: 1240px; width: 100%; margin: 0 auto; padding-left: 28px; padding-right: 28px; }

/* utilities */
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.body { color: var(--body); }
.ink { color: var(--ink); }
.pos { color: var(--pos); }
.small { font-size: 12px; }
.xs { font-size: 11px; }
.right { text-align: right; }
.code { font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--muted); margin-right: 6px; }
.serif-num { font-family: var(--serif); font-size: 40px; line-height: 1; color: var(--muted); }
.serif-num.sm { font-size: 24px; }

/* ---------- masthead ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px 16px; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--ink); font-family: var(--mono); font-size: 12px; color: var(--muted); }
.fx-pill { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 2px 0; cursor: pointer; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.fx-pill:hover { color: var(--ink); }
.dot { width: 6px; height: 6px; border-radius: 3px; background: var(--muted); flex-shrink: 0; }
.dot.live { background: var(--pos); }
.dot.cached { background: #B08A2E; }
.dot.busy { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.lang-btn { border: 1px solid var(--ink); background: transparent; padding: 4px 10px; cursor: pointer; font-family: var(--mono); font-size: 12px; }
.lang-btn:hover { background: var(--ink); color: var(--paper); }
.brand { display: flex; justify-content: center; padding: 22px 0 14px; }
.brand a { font-family: var(--serif); font-size: clamp(48px, 8vw, 96px); line-height: .9; letter-spacing: -.02em; }
.nav { display: flex; justify-content: center; gap: 36px; border-top: 3px double var(--ink); border-bottom: 1px solid var(--ink); padding: 10px 0; font-size: 14px; font-weight: 500; letter-spacing: .04em; }
.nav a { color: var(--muted); border-bottom: 2px solid transparent; padding-bottom: 2px; }
.nav a.active { color: var(--ink); border-bottom-color: var(--ink); }

.main { padding-top: 40px; padding-bottom: 80px; flex: 1; }
.footer { padding-top: 20px; padding-bottom: 32px; border-top: 1px solid var(--ink); font-size: 12px; line-height: 1.6; color: var(--muted); }

.page { display: flex; flex-direction: column; gap: 32px; }
.page.home { gap: 48px; }
.page.compare { gap: 28px; }

/* ---------- type ---------- */
.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; color: var(--muted); }
.display { font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 5.6vw, 72px); line-height: 1.02; letter-spacing: -.02em; text-wrap: balance; }
.display.md { font-size: clamp(40px, 5.4vw, 68px); }
.display em { color: var(--pos); }
.dek { font-size: 17px; line-height: 1.6; color: var(--body); max-width: 540px; text-wrap: pretty; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--ink); padding-bottom: 10px; }
.sec-head h2 { font-family: var(--serif); font-weight: 400; font-size: 34px; }
.sec-head > span { font-size: 12px; color: var(--muted); }

/* ---------- toggles & chips ---------- */
.toggles { display: flex; gap: 22px; flex-wrap: wrap; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; user-select: none; background: none; border: 0; padding: 0; }
.toggle .track { width: 30px; height: 18px; border-radius: 9px; background: var(--off); position: relative; transition: background .2s; flex-shrink: 0; }
.toggle .knob { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 7px; background: #fff; transition: left .2s; }
.toggle[aria-checked="true"] .track { background: var(--pos); }
.toggle[aria-checked="true"] .knob { left: 14px; }
.toggle:focus-visible, .chip:focus-visible, .fx-pill:focus-visible { outline: 2px solid var(--pos); outline-offset: 2px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-block; border: 1px solid var(--off); background: transparent; color: var(--ink); padding: 8px 14px; cursor: pointer; font-size: 14px; white-space: nowrap; }
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip.sm { padding: 6px 12px; font-size: 13px; }
.chip.mono { font-family: var(--mono); }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 40px; align-items: end; padding-bottom: 40px; border-bottom: 1px solid var(--ink); }
.hero-text { display: flex; flex-direction: column; gap: 16px; }
.hero-stat { display: flex; flex-direction: column; gap: 10px; border-left: 1px solid var(--ink); padding-left: 32px; }
.hs-name { font-size: 15px; font-weight: 500; }
.hs-pct { font-family: var(--serif); font-size: clamp(88px, 12vw, 150px); line-height: .85; letter-spacing: -.03em; color: var(--pos); }
.hero-stat .mono { font-size: 13px; }

.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 48px; align-items: start; }
.col { display: flex; flex-direction: column; }
.board-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.board-row:hover { background: var(--hover); color: var(--ink); }
.br-mid { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.br-name { font-size: 16px; font-weight: 600; }
.br-tier { font-weight: 400; color: var(--muted); font-size: 13px; }
.br-meta { display: flex; gap: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.br-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.br-pct { font-family: var(--serif); font-size: 30px; line-height: 1; color: var(--pos); }

.index-row { display: grid; grid-template-columns: 32px 130px minmax(0, 1fr) 56px; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--rule); }
.ix-name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ix-v { font-size: 14px; text-align: right; }
.bar { display: block; height: 8px; background: var(--bar-bg); }
.bar.thin { height: 6px; flex: 1; }
.bar > span { display: block; height: 100%; transition: width .4s; }

.fx-panel { display: flex; flex-direction: column; }
.fx-meta { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.link-btn { background: none; border: 0; padding: 0; cursor: pointer; font-family: var(--mono); font-size: 12px; color: var(--pos); text-decoration: underline; text-underline-offset: 3px; }
.link-btn:disabled { color: var(--muted); cursor: default; text-decoration: none; }
.fx-warn { margin-top: 12px; font-size: 13px; color: var(--neg); }
.fx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); border-left: 1px solid var(--rule); margin-top: -1px; }
.fx-cell { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); font-size: 12px; }
.fx-val { font-size: 18px; color: var(--ink); }
.fx-name { color: var(--muted); }

/* ---------- product ---------- */
.p-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 40px; align-items: end; border-top: 1px solid var(--ink); padding-top: 32px; }
.p-hero-text { display: flex; flex-direction: column; gap: 14px; }
.p-hero-text .chips { gap: 6px; }
.price-box { display: grid; grid-template-columns: 1fr 1fr; border-top: 3px double var(--ink); border-bottom: 1px solid var(--ink); }
.pb-main { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: end; gap: 12px; padding: 18px 0; border-bottom: 1px solid var(--rule); }
.pb-big { font-family: var(--serif); font-size: 64px; line-height: .9; letter-spacing: -.02em; }
.pb-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 12px; color: var(--muted); }
.pb-side .pos { font-size: 14px; }
.pb-cell { padding: 14px 0 14px 18px; display: flex; flex-direction: column; gap: 4px; }
.pb-cell.first { padding-left: 0; border-right: 1px solid var(--rule); }
.mono.lg { font-size: 18px; }
.pb-note { grid-column: 1 / -1; padding: 10px 0; border-top: 1px solid var(--rule); }

.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ptable { min-width: 860px; }
.prow { display: grid; grid-template-columns: 44px minmax(150px, 1.3fr) 110px 120px minmax(180px, 1.6fr) 96px 110px; gap: 14px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--rule); }
.prow.hi { background: var(--row-hi); }
.prow.head { padding: 0 0 10px; border-bottom-color: var(--ink); font-family: var(--mono); font-size: 11px; letter-spacing: .06em; color: var(--muted); }
.prow .mono { font-size: 13px; }
.pr-region { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pr-name { font-size: 15px; font-weight: 600; }
.pr-spec { font-size: 11px; color: var(--muted); }
.pr-cny { display: flex; align-items: center; gap: 12px; }
.pr-cny .mono { font-size: 15px; font-weight: 500; width: 80px; flex-shrink: 0; }

.notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 32px; border-top: 3px double var(--ink); padding-top: 24px; }
.notes > div { display: flex; flex-direction: column; gap: 8px; }
.notes h3 { font-family: var(--serif); font-weight: 400; font-size: 24px; }
.notes p { font-size: 14px; line-height: 1.65; color: var(--body); text-wrap: pretty; }

/* ---------- compare ---------- */
.c-hero { display: flex; flex-direction: column; gap: 12px; padding-bottom: 28px; border-bottom: 1px solid var(--ink); }
.c-hero .dek { font-size: 16px; }
.pickers { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 14px 20px; align-items: start; }
.pickers > span { padding-top: 7px; font-size: 13px; }
.pickers .chips { gap: 6px; }
.cmp-wrap { border-top: 3px double var(--ink); }
.cmp { display: grid; min-width: fit-content; }
.cmp .ch { padding: 14px 12px; border-bottom: 1px solid var(--ink); display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.cmp .ch.right { align-items: flex-end; }
.cmp .first { padding-left: 0; }
.cmp .cc { padding: 10px 12px; border-bottom: 1px solid var(--rule); display: flex; flex-direction: column; gap: 2px; justify-content: center; }
.cmp .cc.first { flex-direction: row; align-items: center; font-size: 14px; padding: 14px 10px 14px 0; justify-content: flex-start; }
.cmp .hi { background: var(--row-hi); }
.cmp .cell .v { font-size: 15px; font-weight: 500; }
.cmp .cell .sub { color: var(--muted); }
.cmp .cell.best { background: var(--pos); color: #fff; }
.cmp .cell.best .sub { color: #fff; }
.cmp .total { align-items: flex-end; }
.cmp .total .tv { font-family: var(--serif); font-size: 24px; line-height: 1; }
.cmp .total.best { background: var(--ink); color: var(--paper); }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .main { padding-top: 28px; }
  .nav { gap: 24px; }
  .hero-stat { border-left: 0; padding-left: 0; border-top: 1px solid var(--ink); padding-top: 20px; }
  .board-row { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; }
  .serif-num { font-size: 30px; }
  .index-row { grid-template-columns: 24px 110px minmax(0, 1fr) 48px; gap: 10px; }
  .pb-big { font-size: 52px; }
  .pickers { grid-template-columns: 1fr; gap: 8px; }
  .pickers > span { padding-top: 6px; }
}

/* ---------- category filters & grouped pickers ---------- */
.filters { display: flex; flex-direction: column; gap: 18px; }
.cat-chips { gap: 6px; }
.pgroups { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 8px 16px; align-items: start; }
.pg-label { font-size: 11px; letter-spacing: .06em; color: var(--muted); padding-top: 8px; }
.pgroups .chips { gap: 6px; }
@media (max-width: 760px) {
  .pgroups { grid-template-columns: 1fr; gap: 4px; }
  .pg-label { padding-top: 8px; }
}

/* ---------- data provenance ---------- */
a.src { text-decoration: underline dotted var(--off); text-underline-offset: 3px; }
a.src:hover { color: var(--pos); text-decoration-color: currentColor; }
a.src sup { font-size: 9px; margin-left: 1px; }
