:root {
  --paper: #f3f5f2;
  --surface: #ffffff;
  --ink: #202623;
  --muted: #66706b;
  --line: #d6ddd8;
  --line-strong: #aeb9b2;
  --coral: #d85b42;
  --green: #39785d;
  --blue: #3e6f93;
  --gold: #a87924;
  --plum: #765d80;
  --cyan: #377f83;
  --max: 1260px;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --serif: "Iowan Old Style", "Noto Serif CJK SC", "Songti SC", Georgia, serif;
}

* { box-sizing: border-box; letter-spacing: 0; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); line-height: 1.55; -webkit-font-smoothing: antialiased; }
body[data-lang="zh"] .en, body[data-lang="en"] .zh { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.site-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 58px; padding: 8px max(20px, calc((100vw - var(--max)) / 2)); border-bottom: 1px solid rgba(214, 221, 216, .92); background: rgba(243, 245, 242, .94); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 7px; background: var(--ink); color: white; font-family: var(--serif); font-size: 19px; font-weight: 700; box-shadow: inset 0 -4px 0 #313a35; }
.brand > span:last-child { display: grid; line-height: 1.1; }
.brand b { font-size: 13px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 9px; text-transform: uppercase; }
nav { display: flex; align-items: center; gap: 3px; }
nav a, .icon-button { min-height: 34px; border: 0; border-radius: 6px; padding: 7px 10px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 650; cursor: pointer; }
nav a:hover, .icon-button:hover { background: #e5e9e5; color: var(--ink); }

main { min-height: calc(100vh - 135px); }
.shell { width: min(var(--max), calc(100% - 36px)); margin: 0 auto; padding: 30px 0 74px; }
.report-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 34px; padding: 24px 0 26px; border-bottom: 2px solid var(--ink); }
.eyebrow, .section-index { margin: 0 0 7px; color: var(--coral); font-size: 10px; font-weight: 800; text-transform: uppercase; }
h1, h2, h3 { margin: 0; font-family: var(--serif); font-weight: 650; letter-spacing: 0; }
h1 { overflow-wrap: anywhere; font-size: 54px; line-height: 1.03; }
.lede { max-width: 820px; margin: 11px 0 0; color: #4f5954; font-family: var(--serif); font-size: 19px; line-height: 1.5; }
.scope-stamp { display: grid; grid-template-columns: auto auto auto; align-items: center; gap: 8px; min-width: 240px; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); font-size: 12px; font-variant-numeric: tabular-nums; }
.scope-stamp b { color: var(--coral); }
.scope-stamp small { grid-column: 1 / -1; color: var(--muted); }

.metric-strip { display: grid; grid-template-columns: repeat(5, 1fr); border-bottom: 1px solid var(--line); }
.metric-strip > div { min-height: 94px; padding: 17px 18px 15px 0; border-right: 1px solid var(--line); }
.metric-strip > div:not(:first-child) { padding-left: 18px; }
.metric-strip > div:last-child { border-right: 0; }
.metric-strip small { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.metric-strip b { display: block; margin-top: 6px; font-family: var(--serif); font-size: 29px; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric-strip i { color: var(--line-strong); font-style: normal; }

.report-section, .repository-index { padding: 38px 0; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-heading h2 { font-size: 27px; line-height: 1.15; }
.section-index { margin-bottom: 4px; }
.section-note { max-width: 360px; color: var(--muted); font-size: 11px; text-align: right; }
.limit-check { display: flex; align-items: baseline; gap: 10px; }
.limit-check b { color: var(--green); font-family: var(--serif); font-size: 28px; }
.limit-check span { color: var(--muted); font-size: 11px; }

.category-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 30px; }
.bar-row { --series-color: var(--coral); display: grid; grid-template-columns: minmax(138px, .75fr) minmax(100px, 1.25fr) 54px 46px; align-items: center; gap: 10px; min-height: 42px; border: 0; border-bottom: 1px solid var(--line); padding: 0; background: transparent; text-align: left; cursor: pointer; }
.bar-row:hover, .bar-row.active { background: rgba(255, 255, 255, .62); }
.bar-row[style*="--series:1"] { --series-color: var(--green); }
.bar-row[style*="--series:2"] { --series-color: var(--blue); }
.bar-row[style*="--series:3"] { --series-color: var(--gold); }
.bar-row[style*="--series:4"] { --series-color: var(--plum); }
.bar-row[style*="--series:5"] { --series-color: var(--cyan); }
.bar-label { min-width: 0; overflow: hidden; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 7px; overflow: hidden; background: #e2e7e3; }
.bar-track i { display: block; height: 100%; background: var(--series-color); }
.bar-row b, .bar-row small { font-size: 11px; font-variant-numeric: tabular-nums; text-align: right; }
.bar-row small { color: var(--muted); }
.reconcile { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 10px 12px; border-left: 3px solid var(--green); background: #e7ede9; color: var(--muted); font-size: 10px; }
.reconcile span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reconcile b { margin-left: auto; color: var(--ink); font-size: 12px; white-space: nowrap; }
.reconcile em { color: var(--green); font-size: 10px; font-style: normal; font-weight: 800; }

.two-column { display: grid; grid-template-columns: .9fr 1.1fr; gap: 34px; border-bottom: 1px solid var(--line); }
.two-column .report-section { border-bottom: 0; }
.two-column .report-section + .report-section { padding-left: 34px; border-left: 1px solid var(--line); }
.year-chart { display: grid; grid-template-columns: repeat(7, minmax(38px, 1fr)); gap: 7px; height: 235px; }
.year-column { display: grid; grid-template-rows: 24px 1fr 22px; gap: 5px; min-width: 0; border: 0; padding: 0; background: transparent; cursor: pointer; }
.year-column b, .year-column small { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.year-column span { position: relative; display: flex; align-items: end; overflow: hidden; border-bottom: 1px solid var(--line-strong); background: rgba(255,255,255,.5); }
.year-column i { display: block; width: 100%; background: var(--blue); transition: height .2s ease; }
.year-column:nth-child(2n) i { background: var(--green); }
.year-column:hover i, .year-column.active i { background: var(--coral); }

.inline-select { display: grid; gap: 3px; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.inline-select select { min-height: 34px; max-width: 220px; border: 1px solid var(--line); border-radius: 5px; padding: 0 28px 0 8px; background: var(--surface); color: var(--ink); font-size: 11px; }
.subcat-head { display: flex; justify-content: space-between; gap: 15px; padding-bottom: 10px; border-bottom: 1px solid var(--line-strong); }
.subcat-head b { font-family: var(--serif); font-size: 20px; }
.subcat-head span { color: var(--muted); font-size: 11px; }
.subcat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.subcat-row { position: relative; display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 8px; min-height: 54px; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px 12px; background: var(--surface); text-align: left; cursor: pointer; }
.subcat-row:hover, .subcat-row.active { border-color: var(--ink); }
.subcat-row span { overflow: hidden; font-size: 11px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.subcat-row b { font-family: var(--serif); font-size: 18px; }
.subcat-row small { color: var(--muted); font-size: 9px; }
.subcat-row i { position: absolute; bottom: 0; left: 0; height: 3px; background: var(--green); }

.matrix-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.matrix { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 10px; font-variant-numeric: tabular-nums; }
.matrix th, .matrix td { height: 37px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0; text-align: center; }
.matrix thead th { height: 32px; background: #e8ece8; color: var(--muted); font-weight: 700; }
.matrix th:first-child { width: 210px; padding: 0 12px; text-align: left; }
.matrix th:last-child, .matrix td:last-child { border-right: 0; }
.matrix tbody tr:last-child th, .matrix tbody tr:last-child td { border-bottom: 0; }
.matrix td button { width: 100%; height: 36px; border: 0; background: rgba(62, 111, 147, calc(.06 + var(--heat) * .82)); color: var(--ink); font-size: 10px; cursor: pointer; }
.matrix td button:hover { outline: 2px solid var(--coral); outline-offset: -2px; }

.reconcile-total { color: var(--green); font-size: 11px; }
.cross-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.cross-block { --series-color: var(--coral); display: grid; gap: 5px; min-height: 110px; border: 1px solid var(--line); border-radius: 6px; padding: 13px; background: var(--surface); text-align: left; cursor: pointer; }
.cross-block[style*="--series:1"] { --series-color: var(--green); }
.cross-block[style*="--series:2"] { --series-color: var(--blue); }
.cross-block[style*="--series:3"] { --series-color: var(--gold); }
.cross-block:hover { border-color: var(--line-strong); }
.cross-block small { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.cross-block b { font-family: var(--serif); font-size: 27px; line-height: 1; }
.cross-block span { height: 4px; background: #e5e9e6; }
.cross-block i { display: block; height: 100%; background: var(--series-color); }
.cross-block em { color: var(--muted); font-size: 9px; font-style: normal; }
.language-line { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 14px; color: var(--muted); font-size: 10px; }
.language-line > span { margin-right: 5px; font-weight: 750; text-transform: uppercase; }
.language-line button { border: 1px solid var(--line); border-radius: 5px; padding: 4px 7px; background: transparent; color: var(--muted); font-size: 9px; cursor: pointer; }
.language-line button:hover { border-color: var(--coral); color: var(--ink); }

.repository-index { border-bottom: 0; scroll-margin-top: 68px; }
.result-count { display: flex; align-items: baseline; gap: 5px; }
.result-count b { font-family: var(--serif); font-size: 29px; }
.result-count span { color: var(--muted); font-size: 11px; }
.filter-panel { display: grid; grid-template-columns: minmax(190px, 1.45fr) repeat(5, minmax(110px, .75fr)) 62px 36px; gap: 7px; align-items: end; padding: 13px; border: 1px solid var(--line); border-radius: 6px; background: #e8ece8; }
.filter-panel label { display: grid; gap: 4px; min-width: 0; }
.filter-panel label > span { color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; }
.filter-panel input, .filter-panel select { width: 100%; min-width: 0; min-height: 38px; border: 1px solid #c6cec9; border-radius: 5px; padding: 0 9px; background: var(--surface); color: var(--ink); font-size: 11px; }
.filter-panel input:focus, .filter-panel select:focus { border-color: var(--green); outline: 2px solid rgba(57, 120, 93, .15); }
.submit-button, .reset-button { min-height: 38px; border: 1px solid var(--ink); border-radius: 5px; background: var(--ink); color: white; font-size: 11px; font-weight: 750; cursor: pointer; }
.reset-button { background: transparent; color: var(--ink); font-size: 18px; }
.submit-button:hover { background: var(--coral); border-color: var(--coral); }
.reset-button:hover { background: white; }
.active-summary { display: flex; flex-wrap: wrap; gap: 5px; min-height: 24px; padding: 9px 0 5px; }
.active-summary span { border-radius: 4px; padding: 3px 6px; background: #e3e8e4; color: var(--muted); font-size: 9px; }

.repo-list { display: grid; border-top: 1px solid var(--line-strong); }
.repo-row { display: grid; grid-template-columns: 52px minmax(0,1fr) 110px; gap: 14px; padding: 15px 8px 15px 0; border-bottom: 1px solid var(--line); background: transparent; }
.repo-row:hover { background: rgba(255,255,255,.55); }
.rank { padding-top: 4px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; text-align: center; font-variant-numeric: tabular-nums; }
.repo-copy { min-width: 0; }
.repo-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.repo-title > a:first-child { overflow: hidden; font-family: var(--serif); font-size: 17px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.repo-title > a:first-child:hover { color: var(--coral); }
.repo-title span { color: var(--muted); font-weight: 450; }
.external { color: var(--muted); font-size: 13px; }
.external:hover { color: var(--coral); }
.repo-copy p { display: -webkit-box; max-width: 900px; overflow: hidden; margin: 3px 0 7px; color: #59635e; font-size: 11px; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tags button, .tags span { min-height: 20px; border: 0; border-radius: 4px; padding: 3px 6px; background: #e3e8e4; color: #56615b; font-size: 8px; font-weight: 700; cursor: pointer; }
.tags button:first-child { background: #f0dfda; color: #833b2b; }
.tags button:hover { background: var(--ink); color: white; }
.repo-numbers { display: grid; align-content: start; justify-items: end; gap: 2px; padding-top: 3px; font-variant-numeric: tabular-nums; }
.repo-numbers b { font-size: 11px; }
.repo-numbers span, .repo-numbers small { color: var(--muted); font-size: 9px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 4px; margin-top: 22px; }
.pagination button { min-width: 33px; min-height: 33px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); font-size: 10px; cursor: pointer; }
.pagination button:hover:not(:disabled), .pagination button.active { border-color: var(--ink); background: var(--ink); color: white; }
.pagination button:disabled { opacity: .35; cursor: default; }
.pagination span { color: var(--muted); font-size: 10px; }
.empty { padding: 50px 20px; border: 1px dashed var(--line-strong); border-radius: 6px; color: var(--muted); text-align: center; }

.crumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 5px 0 30px; color: var(--muted); font-size: 10px; }
.crumbs a:hover { color: var(--coral); }
.entry-header { display: grid; grid-template-columns: minmax(0,1fr) 190px; gap: 40px; padding-bottom: 34px; border-bottom: 2px solid var(--ink); }
.entry-header h1 { font-size: 48px; }
.entry-header h1 span { color: var(--muted); font-weight: 450; }
.entry-actions { display: flex; gap: 8px; margin-top: 20px; }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; border: 1px solid var(--ink); border-radius: 5px; padding: 0 14px; background: var(--ink); color: white; font-size: 11px; font-weight: 750; }
.secondary-button { background: transparent; color: var(--ink); }
.primary-button:hover { background: var(--coral); border-color: var(--coral); }
.secondary-button:hover { background: white; }
.star-block { display: grid; align-content: center; justify-items: end; min-height: 145px; border-left: 1px solid var(--line); padding-left: 25px; }
.star-block small { color: var(--muted); font-size: 9px; }
.star-block b { font-family: var(--serif); font-size: 29px; }
.star-block span { color: var(--muted); font-size: 10px; }
.entry-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; padding: 34px 0; border-bottom: 1px solid var(--line); }
.entry-panel { padding-right: 30px; border-right: 1px solid var(--line); }
.entry-panel h2 { font-size: 27px; }
.entry-panel h3 { margin-top: 3px; color: var(--green); font-family: var(--sans); font-size: 13px; }
.entry-panel p { color: var(--muted); font-size: 12px; }
.confidence { height: 5px; margin: 16px 0 6px; background: #dce2de; }
.confidence span { display: block; height: 100%; background: var(--green); }
.entry-panel > small { color: var(--muted); font-size: 9px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--line); }
.facts div { min-width: 0; padding: 13px; background: var(--surface); }
.facts dt { color: var(--muted); font-size: 8px; font-weight: 750; text-transform: uppercase; }
.facts dd { overflow-wrap: anywhere; margin: 3px 0 0; font-size: 11px; font-weight: 650; }
.topic-section { padding: 34px 0; }
.topic-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.topic-cloud a, .topic-cloud span { border: 1px solid var(--line); border-radius: 5px; padding: 5px 8px; background: var(--surface); color: var(--muted); font-size: 9px; }
.topic-cloud a:hover { border-color: var(--coral); color: var(--ink); }

.method-shell { max-width: 980px; }
.method-shell > h1 { max-width: 760px; }
.prose { margin-top: 35px; font-family: var(--serif); font-size: 16px; }
.prose h2 { margin: 38px 0 8px; font-size: 25px; }
.prose p { color: #515b56; }
.prose code { border-radius: 4px; padding: 2px 5px; background: #e2e7e3; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.method-table { width: 100%; min-width: 700px; border-collapse: collapse; font-family: var(--sans); font-size: 10px; }
.method-table th, .method-table td { border-bottom: 1px solid var(--line); padding: 10px; text-align: left; }
.method-table th { background: #e8ece8; color: var(--muted); }
.method-table code { overflow-wrap: anywhere; }

.loading { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 60vh; color: var(--muted); font-size: 12px; }
.spinner { width: 21px; height: 21px; border: 2px solid var(--line); border-top-color: var(--coral); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

footer { display: flex; justify-content: space-between; gap: 20px; width: min(var(--max), calc(100% - 36px)); margin: 0 auto; padding: 24px 0 34px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px; }
.footer-links a:hover { color: var(--coral); }

@media (max-width: 1080px) {
  .filter-panel { grid-template-columns: 1.4fr repeat(3, 1fr); }
  .filter-panel .submit-button, .filter-panel .reset-button { min-height: 38px; }
}

@media (max-width: 820px) {
  h1 { font-size: 42px; }
  .report-head { grid-template-columns: 1fr; align-items: start; }
  .scope-stamp { width: max-content; }
  .metric-strip { grid-template-columns: repeat(3, 1fr); }
  .metric-strip > div { border-bottom: 1px solid var(--line); }
  .metric-strip > div:nth-child(3) { border-right: 0; }
  .category-bars { grid-template-columns: 1fr; }
  .two-column { grid-template-columns: 1fr; gap: 0; }
  .two-column .report-section + .report-section { padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
  .cross-grid { grid-template-columns: 1fr 1fr; }
  .filter-panel { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 560px) {
  .site-header { padding-inline: 12px; }
  nav a { display: none; }
  .shell { width: calc(100% - 24px); padding-top: 18px; }
  .report-head { gap: 22px; padding-top: 16px; }
  h1 { font-size: 34px; }
  .lede { font-size: 16px; }
  .scope-stamp { width: 100%; min-width: 0; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .metric-strip > div, .metric-strip > div:not(:first-child) { min-height: 78px; padding: 13px 10px; border-right: 1px solid var(--line); }
  .metric-strip > div:nth-child(2n) { border-right: 0; }
  .metric-strip b { font-size: 23px; }
  .report-section, .repository-index { padding: 30px 0; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .section-note { text-align: left; }
  .bar-row { grid-template-columns: minmax(115px, 1fr) minmax(70px, 1fr) 42px; gap: 7px; }
  .bar-row small { display: none; }
  .reconcile span { display: none; }
  .year-chart { height: 195px; gap: 3px; }
  .year-column b { font-size: 8px; }
  .subcat-grid { grid-template-columns: 1fr; }
  .cross-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .cross-block { min-height: 98px; padding: 10px; }
  .filter-panel { grid-template-columns: 1fr 1fr; padding: 10px; }
  .search-field { grid-column: 1 / -1; }
  .repo-row { grid-template-columns: 36px minmax(0,1fr); gap: 8px; }
  .repo-numbers { grid-column: 2; grid-template-columns: auto auto auto; justify-content: start; justify-items: start; gap: 10px; }
  .entry-header { grid-template-columns: 1fr; gap: 22px; }
  .entry-header h1 { font-size: 34px; }
  .star-block { min-height: 90px; align-content: center; justify-items: start; border-top: 1px solid var(--line); border-left: 0; padding: 16px 0 0; }
  .entry-grid { grid-template-columns: 1fr; }
  .entry-panel { padding: 0 0 25px; border-right: 0; border-bottom: 1px solid var(--line); }
  .facts { grid-template-columns: 1fr; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
