:root {
  color-scheme: dark;
  --bg: #070b12;
  --surface: #0d131d;
  --surface-raised: #111a27;
  --surface-hover: #152235;
  --border: #1c2a3b;
  --border-bright: #2a3c53;
  --text: #f4f7fb;
  --muted: #8c9aab;
  --dim: #56677b;
  --blue: #5d8cff;
  --blue-soft: #9bb7ff;
  --blue-bg: #12234a;
  --green: #57d99b;
  --amber: #f2b35d;
  --red: #fb7f85;
  --shadow: 0 16px 50px rgba(0, 0, 0, 0.24);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
.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; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 100; padding: 10px 14px; border-radius: 6px; background: var(--blue); color: white; transform: translateY(-150%); transition: transform 180ms ease-out; }
.skip-link:focus { transform: translateY(0); }

.app-shell { width: min(1440px, 100%); margin: 0 auto; padding: 0 56px; }
.topbar { display: flex; min-height: 76px; align-items: center; justify-content: space-between; padding: 0 32px; border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); font-size: 12px; font-weight: 700; letter-spacing: .16em; text-decoration: none; }
.brand-mark { display: inline-flex; width: 25px; height: 22px; align-items: end; gap: 3px; }
.brand-mark i { display: block; width: 5px; border-radius: 1px 1px 0 0; background: var(--blue); }
.brand-mark i:nth-child(1) { height: 10px; opacity: .55; }
.brand-mark i:nth-child(2) { height: 17px; opacity: .8; }
.brand-mark i:nth-child(3) { height: 22px; }
.topbar-meta { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; letter-spacing: .02em; }
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(87, 217, 155, .1); }
.meta-separator { color: var(--dim); }

.hero-section { display: flex; min-height: 300px; align-items: end; justify-content: space-between; gap: 40px; padding: 76px 0 65px; }
.eyebrow, .section-kicker, .metric-kicker, .drawer-kicker { margin: 0; color: var(--blue-soft); font-size: 10px; font-weight: 700; letter-spacing: .17em; }
.eyebrow { display: flex; align-items: center; gap: 10px; }
.eyebrow-line { display: inline-block; width: 25px; height: 1px; background: var(--blue); }
h1 { max-width: 660px; margin: 17px 0 15px; font-size: clamp(42px, 5.5vw, 76px); font-weight: 600; letter-spacing: -.055em; line-height: .98; }
h1 em { color: var(--blue-soft); font-style: normal; }
.hero-description { max-width: 520px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.75; }
.hero-metric { min-width: 170px; padding-bottom: 4px; text-align: right; }
.metric-value { margin: 7px 0 0; color: var(--text); font-size: 54px; font-weight: 600; letter-spacing: -.06em; line-height: 1; }
.metric-label { color: var(--muted); font-size: 12px; }

.control-panel { display: flex; min-height: 66px; align-items: center; gap: 16px; padding: 11px 14px; border: 1px solid var(--border); background: rgba(13, 19, 29, .8); }
.control-group, .category-scroll, .limit-control { display: flex; align-items: center; gap: 4px; }
.segmented-button, .filter-button, .limit-button { min-height: 40px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; transition: color 180ms ease-out, background 180ms ease-out, border-color 180ms ease-out; }
.segmented-button { min-width: 54px; padding: 0 13px; }
.segmented-button:hover, .filter-button:hover, .limit-button:hover { color: var(--text); }
.segmented-button.is-active { border-color: var(--border-bright); background: var(--surface-raised); color: var(--text); }
.filter-button { padding: 0 11px; white-space: nowrap; }
.filter-button.is-active { background: var(--blue-bg); color: var(--blue-soft); }
.control-divider { width: 1px; height: 23px; background: var(--border); }
.control-spacer { flex: 1; }
.search-field { display: flex; width: min(260px, 28vw); min-height: 40px; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--border); border-radius: 5px; color: var(--dim); }
.search-field:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(93, 140, 255, .13); }
.search-field svg { width: 15px; height: 15px; }
.search-field input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 12px; }
.search-field input::placeholder { color: var(--dim); }
.search-field kbd { padding: 1px 5px; border: 1px solid var(--border-bright); border-radius: 3px; color: var(--dim); font-size: 10px; }

.insight-strip { display: grid; grid-template-columns: minmax(260px, 1.3fr) minmax(170px, .8fr) minmax(170px, .8fr) minmax(280px, 1.1fr); gap: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); }
.insight-item { display: flex; align-items: center; gap: 12px; min-height: 82px; padding: 16px 18px; border-right: 1px solid var(--border); }
.insight-icon { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 6px; }
.insight-icon svg { width: 15px; height: 15px; }
.insight-icon.blue { background: rgba(93, 140, 255, .13); color: var(--blue-soft); }
.insight-icon.amber { background: rgba(242, 179, 93, .13); color: var(--amber); }
.insight-icon.green { background: rgba(87, 217, 155, .12); color: var(--green); }
.insight-label { display: block; margin-bottom: 2px; color: var(--dim); font-size: 10px; letter-spacing: .04em; }
.insight-item > div { min-width: 0; }
.insight-item strong { display: block; max-width: none; color: var(--text); font-size: 13px; font-weight: 600; }
.insight-item strong.leader-name { display: grid; gap: 1px; overflow: visible; line-height: 1.25; overflow-wrap: anywhere; white-space: normal; }
.leader-owner { color: var(--muted); font-size: 11px; font-weight: 500; }
.leader-repo { color: var(--text); overflow-wrap: anywhere; }
.insight-note { display: flex; min-width: 180px; align-items: center; justify-content: end; gap: 7px; padding: 16px 18px; color: var(--dim); font-size: 10px; }
.insight-note svg { width: 14px; height: 14px; }

.ranking-section { padding: 68px 0 50px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 21px; }
.section-kicker { color: var(--dim); }
.section-kicker span { color: var(--blue-soft); }
h2 { margin: 8px 0 0; color: var(--text); font-size: 26px; font-weight: 600; letter-spacing: -.035em; }
.limit-control { gap: 4px; color: var(--dim); font-size: 11px; }
.limit-button { min-width: 34px; min-height: 32px; padding: 0 9px; }
.limit-button.is-active { background: var(--surface-raised); color: var(--text); }
.table-wrap { overflow: hidden; border: 1px solid var(--border); }
.ranking-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.ranking-table th { height: 42px; padding: 0 16px; border-bottom: 1px solid var(--border); color: var(--dim); font-size: 10px; font-weight: 600; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
.ranking-table th.rank-column { width: 60px; text-align: center; }
.ranking-table th.project-column { width: 23%; }
.ranking-table th.purpose-column { width: 46%; }
.ranking-table th.language-column { width: 6%; }
.ranking-table th.numeric-column { width: 100px; text-align: right; }
.ranking-table th.action-column { width: 112px; }
.ranking-table td { height: auto; min-height: 87px; padding: 15px 16px; border-bottom: 1px solid rgba(28, 42, 59, .75); vertical-align: middle; }
.ranking-table tbody tr { transition: background 180ms ease-out; }
.ranking-table tbody tr:hover { background: var(--surface-hover); }
.ranking-table tbody tr:last-child td { border-bottom: 0; }
.rank-cell { color: var(--dim); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; text-align: center; }
.rank-cell.is-top { color: var(--blue-soft); font-size: 15px; font-weight: 600; }
.rank-cell.is-second { color: #cad4df; }
.project-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.project-avatar { display: grid; width: 35px !important; height: 35px !important; max-width: 35px; max-height: 35px; min-width: 35px; min-height: 35px; flex: 0 0 35px; place-items: center; overflow: hidden; border: 1px solid var(--border-bright); border-radius: 7px; background: var(--surface-raised); color: var(--blue-soft); font-size: 12px; font-weight: 700; }
.project-cell > span:last-child { min-width: 0; flex: 1 1 auto; }
.project-name { display: block; overflow: hidden; color: var(--text); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.project-owner { display: block; margin-top: 2px; overflow: hidden; color: var(--dim); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.purpose-cell { max-width: none; overflow: visible; color: var(--muted); font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; text-overflow: clip; white-space: normal; }
.language-cell { color: var(--muted); font-size: 11px; white-space: normal; }
.language-cell::before { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--blue); content: ""; vertical-align: 1px; }
.language-cell[data-language="Python"]::before { background: #f2c55c; }
.language-cell[data-language="Rust"]::before { background: #e77b47; }
.numeric-cell { color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.growth-value { color: var(--green); font-weight: 600; }
.growth-value::before { margin-right: 5px; content: "+"; color: var(--green); }
.repo-link { display: inline-flex; min-height: 40px; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--border-bright); border-radius: 5px; color: var(--blue-soft); font-size: 11px; font-weight: 600; text-decoration: none; transition: background 180ms ease-out, border-color 180ms ease-out; }
.repo-link:hover { border-color: var(--blue); background: var(--blue-bg); }
.repo-link svg { width: 14px; height: 14px; }
.mobile-list { display: none; min-width: 0; width: 100%; }
.empty-state { display: grid; min-height: 220px; place-items: center; align-content: center; gap: 6px; border: 1px solid var(--border); color: var(--muted); text-align: center; }
.empty-state svg { width: 25px; height: 25px; margin-bottom: 4px; color: var(--dim); }
.empty-state strong { color: var(--text); font-size: 14px; }
.empty-state span { font-size: 12px; }

.footer { display: flex; min-height: 70px; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); color: var(--dim); font-size: 10px; letter-spacing: .07em; }

.drawer-backdrop { position: fixed; z-index: 30; inset: 0; background: rgba(0, 0, 0, .62); }
.detail-drawer { position: fixed; z-index: 40; top: 0; right: 0; display: flex; width: min(490px, 100%); height: 100dvh; flex-direction: column; border-left: 1px solid var(--border-bright); background: var(--surface); box-shadow: var(--shadow); transform: translateX(100%); transition: transform 240ms ease-out; }
.detail-drawer.is-open { transform: translateX(0); }
.drawer-header { display: flex; min-height: 82px; align-items: center; justify-content: space-between; padding: 0 27px; border-bottom: 1px solid var(--border); }
.drawer-kicker { color: var(--dim); }
.icon-button { display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid var(--border); border-radius: 5px; background: transparent; color: var(--muted); transition: color 180ms ease-out, background 180ms ease-out; }
.icon-button:hover { background: var(--surface-hover); color: var(--text); }
.icon-button svg { width: 18px; height: 18px; }
.drawer-body { overflow-y: auto; padding: 30px 27px 45px; }
.drawer-project-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.drawer-project-name { margin: 0; color: var(--text); font-size: 24px; font-weight: 600; letter-spacing: -.04em; }
.drawer-owner { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.drawer-summary { margin: 21px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.drawer-link { display: inline-flex; min-height: 40px; align-items: center; gap: 7px; margin-top: 19px; padding: 0 12px; border: 1px solid var(--blue); border-radius: 5px; background: var(--blue-bg); color: var(--blue-soft); font-size: 11px; font-weight: 600; text-decoration: none; }
.drawer-link svg { width: 14px; height: 14px; }
.drawer-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 31px; }
.drawer-stat { padding: 13px; border: 1px solid var(--border); background: var(--surface-raised); }
.drawer-stat span { display: block; color: var(--dim); font-size: 10px; }
.drawer-stat strong { display: block; margin-top: 3px; color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; font-weight: 600; }
.drawer-section { margin-top: 32px; }
.drawer-section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.drawer-section h3 { margin: 0; color: var(--text); font-size: 12px; font-weight: 600; }
.drawer-section-label { color: var(--dim); font-size: 10px; }
.trend-chart { height: 128px; padding: 10px 10px 0; border-bottom: 1px solid var(--border); background: var(--surface-raised); }
.trend-chart svg { display: block; width: 100%; height: 100%; overflow: visible; color: #24292f; }
.trend-line { fill: none; stroke: currentColor; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.trend-point { fill: var(--surface-raised); stroke: currentColor; stroke-width: 3; vector-effect: non-scaling-stroke; }
.trend-caption { display: flex; justify-content: space-between; margin-top: 7px; color: var(--dim); font-size: 10px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 4px 8px; border: 1px solid var(--border-bright); border-radius: 4px; color: var(--muted); font-size: 10px; }
.wechat-box { padding: 14px; border: 1px solid rgba(93, 140, 255, .35); background: rgba(18, 35, 74, .35); }
.wechat-box p { margin: 0; color: var(--blue-soft); font-size: 12px; line-height: 1.7; }
.copy-button { display: inline-flex; min-height: 38px; align-items: center; gap: 7px; margin-top: 12px; padding: 0 11px; border: 1px solid var(--border-bright); border-radius: 5px; background: transparent; color: var(--muted); font-size: 11px; }
.copy-button:hover { color: var(--text); }
.copy-button svg { width: 14px; height: 14px; }

button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--blue-soft); outline-offset: 2px; }
@media (max-width: 1100px) {
  .app-shell { padding: 0 32px; }
  .topbar { padding-inline: 24px; }
  .insight-strip { grid-template-columns: repeat(3, 1fr); }
  .insight-note { display: none; }
  .purpose-cell { max-width: none; }
}
@media (max-width: 760px) {
  .app-shell { padding: 0 18px; }
  .topbar { min-height: 66px; padding-inline: 18px; }
  .topbar-meta { font-size: 10px; }
  .topbar-meta time { display: none; }
  .hero-section { min-height: 0; align-items: start; flex-direction: column; gap: 33px; padding: 56px 0 44px; }
  h1 { font-size: clamp(42px, 12vw, 58px); }
  .hero-description { max-width: 430px; font-size: 14px; }
  .hero-metric { padding: 0; text-align: left; }
  .metric-value { font-size: 43px; }
  .control-panel { align-items: stretch; flex-wrap: wrap; gap: 10px; padding: 10px; }
  .period-group { width: 100%; }
  .segmented-button { flex: 1; }
  .control-divider { display: none; }
  .category-scroll { width: calc(100% + 2px); overflow-x: auto; padding-bottom: 2px; }
  .control-spacer { display: none; }
  .search-field { width: 100%; }
  .insight-strip { grid-template-columns: 1fr 1fr; }
  .insight-item { min-height: 72px; padding: 13px; }
  .insight-item:nth-child(2) { border-right: 0; }
  .insight-item:nth-child(3) { border-top: 1px solid var(--border); }
  .ranking-section { padding-top: 48px; }
  .section-heading { align-items: start; flex-direction: column; gap: 16px; }
  .table-wrap { display: none; }
  .mobile-list { display: grid; gap: 8px; }
  .mobile-card { width: 100%; min-width: 0; max-width: 100%; padding: 17px; border: 1px solid var(--border); background: var(--surface); }
  .mobile-card-top { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
  .mobile-card .project-cell { flex: 1; }
  .mobile-card .repo-link { width: 40px; min-width: 40px; justify-content: center; padding: 0; }
  .mobile-card .repo-link span { display: none; }
  .mobile-purpose { margin: 15px 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
  .mobile-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 11px; padding-top: 12px; border-top: 1px solid var(--border); }
  .mobile-card-meta .language-cell { font-size: 11px; }
  .mobile-growth { margin-left: auto; color: var(--green); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; font-weight: 600; }
  .footer { align-items: start; flex-direction: column; justify-content: center; gap: 4px; min-height: 78px; }
  .drawer-body { padding: 24px 20px 38px; }
  .drawer-header { padding: 0 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* GitHub-inspired light theme */
:root {
  color-scheme: light;
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-raised: #f6f8fa;
  --surface-hover: #f6f8fa;
  --border: #d0d7de;
  --border-bright: #8c959f;
  --text: #1f2328;
  --muted: #57606a;
  --dim: #6e7781;
  --blue: #24292f;
  --blue-soft: #24292f;
  --blue-bg: #eaeef2;
  --green: #24292f;
  --amber: #57606a;
  --red: #57606a;
  --shadow: 0 12px 30px rgba(31, 35, 40, .12);
}

body { background: var(--bg); }
.topbar { background: var(--surface); }
.brand { color: var(--text); letter-spacing: .1em; }
.brand-logo { display: block; width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 7px; object-fit: cover; }
.status-dot { background: #24292f; box-shadow: 0 0 0 4px rgba(36, 41, 47, .1); }
.hero-section { padding-top: 64px; }
h1 { color: var(--text); letter-spacing: -.045em; }
h1 em { color: var(--blue); }
.hero-description { color: var(--muted); }
.control-panel, .insight-strip, .table-wrap, .mobile-card { background: var(--surface); }
.control-panel { box-shadow: 0 1px 0 rgba(31, 35, 40, .02); }
.segmented-button, .filter-button, .limit-button { color: var(--muted); }
.segmented-button.is-active, .limit-button.is-active { border-color: var(--border); background: var(--surface-raised); color: var(--text); }
.search-field { background: var(--surface); }
.search-field kbd { border-color: var(--border); color: var(--dim); background: var(--surface-raised); }
.insight-icon.blue { background: #eaeef2; color: var(--blue); }
.insight-icon.amber { background: #f6f8fa; color: var(--amber); }
.insight-icon.green { background: #ffffff; color: var(--green); }
.insight-item strong { color: var(--text); }
.ranking-table th { color: var(--dim); background: var(--surface-raised); }
.ranking-table td { border-bottom-color: var(--border); }
.ranking-table tbody tr:hover { background: #f6f8fa; }
.rank-cell.is-top { color: var(--blue); }
.project-avatar { border-color: var(--border); background: var(--surface-raised); color: var(--blue); }
.project-name { color: var(--text); }
.project-owner, .purpose-cell, .language-cell { color: var(--muted); }
.numeric-cell { color: var(--text); }
.repo-link { border-color: var(--border); background: var(--surface); color: var(--blue); }
.repo-link:hover { border-color: var(--blue); background: var(--blue-bg); }
.drawer-backdrop { background: rgba(31, 35, 40, .42); }
.detail-drawer { border-left-color: var(--border); background: var(--surface); }
.drawer-header { border-bottom-color: var(--border); }
.icon-button { border-color: var(--border); color: var(--muted); }
.icon-button:hover { background: var(--surface-raised); color: var(--text); }
.drawer-summary { color: var(--muted); }
.drawer-link { border-color: var(--blue); background: var(--blue); color: #fff; }
.drawer-stat { border-color: var(--border); background: var(--surface-raised); }
.drawer-stat span, .drawer-section-label { color: var(--dim); }
.drawer-stat strong, .drawer-section h3 { color: var(--text); }
.trend-chart { border-bottom-color: var(--border); background: var(--surface-raised); }
.tag { border-color: var(--border); background: var(--surface); color: var(--muted); }
.wechat-box { border-color: var(--border); background: var(--surface-raised); }
.wechat-box p { color: var(--text); }
.copy-button { border-color: var(--border); color: var(--muted); background: var(--surface); }
.copy-button:hover { color: var(--text); background: var(--surface-raised); }
.eyebrow, .section-kicker, .metric-kicker, .drawer-kicker,
.section-kicker span, h1 em, .rank-cell.is-top, .project-avatar,
.repo-link, .drawer-link, .detail-list li::marker { color: #24292f; }
.drawer-link { color: #ffffff; }
.eyebrow-line, .brand-mark i, .language-cell::before { background: #24292f; }
.language-cell[data-language="Python"]::before,
.language-cell[data-language="Rust"]::before { background: #57606a; }
.insight-icon.blue, .insight-icon.amber, .insight-icon.green { background: #f6f8fa; color: #24292f; }
.growth-value, .growth-value::before, .mobile-growth { color: #24292f; }
.detail-list { display: grid; gap: 8px; margin: 0; padding-left: 19px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.detail-list li::marker { color: var(--blue); }
.detail-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-columns h3 { margin: 0 0 7px; color: var(--text); font-size: 11px; }
.detail-columns p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }

@media (max-width: 760px) {
  .detail-columns { grid-template-columns: 1fr; gap: 18px; }
}
