:root {
  color-scheme: light;
  --ink: #17202c;
  --muted: #5d6b7c;
  --line: #cbd4df;
  --paper: #ffffff;
  --ground: #eef2f6;
  --blue: #2857ee;
  --blue-dark: #173fb9;
  --blue-soft: #e9efff;
  --green: #118467;
  --green-soft: #e8f7f2;
  --amber: #9a6500;
  --amber-soft: #fff4d6;
  --coral: #c64c3d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--ground); }
a { color: inherit; }
button, input, select { font: inherit; }
.discovery-shell { width: min(1540px, calc(100% - 48px)); margin: 0 auto; }
.discovery-skip { position: fixed; left: 12px; top: -80px; z-index: 20; padding: 10px 14px; background: var(--ink); color: white; }
.discovery-skip:focus { top: 12px; }

.discovery-header { height: 68px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.97); }
.discovery-header .discovery-shell { height: 100%; display: flex; align-items: center; gap: 34px; }
.discovery-brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 800; font-size: 21px; white-space: nowrap; }
.discovery-brand b { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 6px; color: white; background: var(--blue); font-size: 15px; }
.discovery-nav { display: flex; align-items: center; gap: 26px; margin-left: auto; }
.discovery-nav a { color: #435164; text-decoration: none; font-weight: 680; }
.discovery-nav a[aria-current="page"] { color: var(--blue-dark); }
.language-link { min-width: 68px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 4px; background: white; text-align: center; text-decoration: none; font-weight: 760; }

.discovery-hero { padding: 46px 0 30px; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(360px, .55fr); gap: 72px; align-items: end; }
.eyebrow { margin: 0 0 12px; color: var(--blue-dark); font: 750 13px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; }
.discovery-hero h1 { max-width: 900px; margin: 0; font-size: 48px; line-height: 1.02; letter-spacing: 0; }
[lang="zh-CN"] .discovery-hero h1 { font-size: 44px; }
.discovery-hero-copy > p:last-child { max-width: 800px; margin: 18px 0 0; color: var(--muted); font-size: 18px; line-height: 1.6; }
.discovery-metrics { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 3px solid var(--ink); border-bottom: 1px solid var(--line); }
.discovery-metrics div { min-width: 0; padding: 16px 10px 14px 0; }
.discovery-metrics dt { color: var(--muted); font-size: 12px; font-weight: 720; }
.discovery-metrics dd { margin: 5px 0 0; color: var(--blue); font: 800 26px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }

.evidence-note { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 24px; padding: 14px 16px; border-left: 4px solid var(--amber); background: var(--amber-soft); color: #624a16; line-height: 1.5; }
.evidence-note strong { color: #483400; white-space: nowrap; }

.discovery-toolbar { display: grid; grid-template-columns: minmax(280px, 2fr) repeat(4, minmax(150px, 1fr)); gap: 12px; padding: 16px; border: 1px solid var(--line); border-top: 5px solid var(--blue); border-radius: 5px; background: var(--paper); }
.discovery-field { min-width: 0; }
.discovery-field span { display: block; margin: 0 0 7px; color: #536174; font-size: 12px; font-weight: 760; }
.discovery-field input, .discovery-field select { width: 100%; height: 44px; border: 1px solid #b8c4d2; border-radius: 4px; background: white; color: var(--ink); padding: 0 12px; }
.discovery-field input:focus, .discovery-field select:focus { outline: 3px solid rgba(40,87,238,.18); border-color: var(--blue); }
.discovery-results-head { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; padding: 28px 0 12px; }
.discovery-results-head h2 { margin: 0; font-size: 28px; }
.discovery-results-head p { margin: 0; color: var(--muted); }

.project-list { margin: 0; padding: 0; list-style: none; border-top: 2px solid var(--ink); }
.project-row { display: grid; grid-template-columns: 54px minmax(260px, 1.55fr) minmax(260px, 1.6fr) minmax(170px, .7fr) 160px; gap: 18px; align-items: center; min-height: 112px; padding: 16px 12px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.65); }
.project-row:hover { background: white; }
.project-rank { color: var(--coral); font: 800 17px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.project-name { min-width: 0; }
.project-name strong { display: block; overflow-wrap: anywhere; font-size: 17px; }
.project-name small { display: block; margin-top: 4px; color: var(--muted); }
.project-description { margin: 0; color: #4f5e70; line-height: 1.45; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.project-signals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.project-signals span { min-width: 0; }
.project-signals strong { display: block; font: 780 15px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; }
.project-signals small { color: var(--muted); font-size: 11px; }
.project-actions { display: grid; gap: 7px; }
.project-actions a { display: block; padding: 9px 10px; border: 1px solid #aebdce; border-radius: 4px; background: white; text-align: center; text-decoration: none; font-weight: 730; }
.project-actions a:first-child { border-color: var(--blue); color: var(--blue-dark); }
.project-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 7px; border-radius: 3px; background: #e7ebf0; color: #465466; font-size: 11px; font-weight: 740; }
.badge.curated { background: var(--green-soft); color: #08634d; }
.badge.candidate { background: var(--amber-soft); color: #745000; }
.badge.official-core { background: var(--blue-soft); color: var(--blue-dark); }
.load-more { display: block; min-width: 190px; margin: 24px auto 44px; padding: 12px 18px; border: 1px solid var(--blue); border-radius: 4px; background: white; color: var(--blue-dark); font-weight: 760; cursor: pointer; }
.load-more[hidden] { display: none; }

.ranking-intro { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.ranking-anchor-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.ranking-anchor-nav a { padding: 8px 11px; border: 1px solid var(--line); border-radius: 4px; background: white; text-decoration: none; font-weight: 700; }
.ranking-section { padding: 34px 0 10px; }
.ranking-section header { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 14px; }
.ranking-section h2 { margin: 0; font-size: 30px; }
.ranking-section header p { max-width: 620px; margin: 0; color: var(--muted); line-height: 1.5; }
.ranking-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 2px solid var(--ink); }
.ranking-item { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px; align-items: center; min-height: 92px; padding: 14px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.65); }
.ranking-item:nth-child(odd) { border-right: 1px solid var(--line); }
.ranking-item > b { color: var(--coral); font: 800 16px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.ranking-item strong { display: block; overflow-wrap: anywhere; }
.ranking-item small { display: block; margin-top: 5px; color: var(--muted); }
.ranking-item > a { padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; background: white; text-decoration: none; font-weight: 720; }
.baseline-panel { padding: 26px; border: 1px dashed #9aa9ba; background: white; color: var(--muted); }
.baseline-panel strong { display: block; margin-bottom: 7px; color: var(--ink); }

.discovery-footer { margin-top: 44px; border-top: 1px solid var(--line); background: #e5eaf0; }
.discovery-footer .discovery-shell { min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 24px; color: var(--muted); font-size: 13px; }
.discovery-footer nav { display: flex; flex-wrap: wrap; gap: 16px; }
.cookie-banner { position: fixed; right: 18px; bottom: 18px; z-index: 30; width: min(430px, calc(100% - 36px)); padding: 16px; border: 1px solid var(--line); border-top: 4px solid var(--blue); background: white; box-shadow: 0 16px 42px rgba(21,32,47,.2); }
.cookie-banner p { margin: 0 0 12px; }
.cookie-banner div { display: flex; gap: 8px; }
.cookie-banner button { padding: 8px 12px; border: 1px solid var(--line); background: white; cursor: pointer; }

@media (max-width: 1100px) {
  .discovery-toolbar { grid-template-columns: minmax(260px, 2fr) repeat(2, minmax(150px, 1fr)); }
  .project-row { grid-template-columns: 46px minmax(220px, 1fr) minmax(230px, 1.2fr) 150px; }
  .project-actions { grid-column: 2 / -1; grid-template-columns: repeat(2, 150px); }
}

@media (max-width: 760px) {
  .discovery-shell { width: min(100% - 28px, 1540px); }
  .discovery-header { height: auto; }
  .discovery-header .discovery-shell { min-height: 64px; gap: 12px; flex-wrap: wrap; padding: 10px 0; }
  .discovery-nav { order: 3; width: 100%; margin: 0; gap: 18px; overflow: hidden; }
  .language-link { margin-left: auto; }
  .discovery-hero { grid-template-columns: 1fr; gap: 24px; padding-top: 32px; }
  .discovery-hero h1 { font-size: 38px; }
  [lang="zh-CN"] .discovery-hero h1 { font-size: 38px; }
  .discovery-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .discovery-metrics dd { font-size: 20px; }
  .evidence-note { display: block; }
  .evidence-note strong { display: block; margin-bottom: 5px; }
  .discovery-toolbar { grid-template-columns: 1fr; }
  .project-row { grid-template-columns: 36px minmax(0, 1fr); gap: 10px 12px; padding: 16px 6px; }
  .project-description, .project-signals, .project-actions { grid-column: 2; }
  .project-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ranking-grid { grid-template-columns: 1fr; }
  .ranking-item:nth-child(odd) { border-right: 0; }
  .ranking-section header, .discovery-results-head { align-items: flex-start; flex-direction: column; }
  .discovery-footer .discovery-shell { align-items: flex-start; flex-direction: column; padding: 22px 0; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
