:root { --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; --mono: "IBM Plex Mono", ui-monospace, monospace; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.7 var(--font); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }
.page-shell { width: 100%; max-width: var(--site-content-width); min-width: 0; margin: 0 auto; padding: 0 0 24px; container-type: inline-size; }
.page-shell .site-header.site-chrome { width: 100%; margin: var(--site-header-top) 0 0; }
.ranking-byline { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.ranking-byline > span { white-space: nowrap; }
.ranking-byline-source { margin-left: auto; }
.ranking-byline a { color: inherit; }
.ranking-byline .curator-link { color: var(--link); }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 26px 0 20px; }
.page-head > div { min-width: 0; flex: 1 1 430px; }
h1 { margin: 0 0 5px; font-size: 26px; line-height: 1.4; }
.intro { margin: 0; color: var(--muted); font-size: 14px; max-width: 52ch; }
.newsletter-entry { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 13px; border: 1px solid var(--accent); border-radius: 999px; background: var(--accent); color: var(--accent-fg); font-size: 12px; font-weight: 500; white-space: nowrap; }
.newsletter-entry svg { width: 16px; height: 16px; }
.newsletter-entry:hover { opacity: .85; }
/* 榜单保留整页滚动；赞助关闭时不留侧栏占位，中栏与精选页共用宽度上限。 */
.ranking-layout { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; padding: 0 8px; }
.ranking-layout[data-sponsors-enabled="true"] { grid-template-columns: clamp(112px, 12vw, 190px) minmax(0, 1fr) clamp(112px, 12vw, 190px); gap: 16px; padding: 0 8px; }
.ranking-layout[data-sponsors-enabled="false"] :is(.ranking-sponsor-rail, .ranking-mobile-sponsors, .ranking-mobile-sponsor, .ranking-mobile-sponsor-link) { display: none; }
.ranking-sponsor-rail { position: sticky; top: 24px; max-height: calc(100dvh - 48px); display: flex; flex-direction: column; gap: 12px; min-width: 0; padding-top: 84px; overflow-y: auto; scrollbar-width: thin; }
.ranking-sponsor-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-width: 0; min-height: 143px; padding: 20px 10px; border: 1px solid #dce3ed; border-radius: 10px; background: #fff7e5; color: #172235; text-align: center; overflow-wrap: anywhere; }
.ranking-sponsor-logo { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border: 1px solid #dce3ed; border-radius: 6px; background: #fff; color: #172235; font: 16px var(--mono); overflow: hidden; white-space: nowrap; line-height: 1; }
.ranking-sponsor-card b, .ranking-mobile-sponsor b { font-size: 12px; }
.ranking-sponsor-card p, .ranking-mobile-sponsor p { margin: 0; color: #5b6a80; font-size: 11px; }
.ranking-sponsor-link { display: block; min-height: 32px; color: var(--muted); font-size: 12px; text-align: center; }
.ranking-mobile-sponsors, .ranking-mobile-sponsor, .ranking-mobile-sponsor-link { display: none; }
.ranking-info { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 24px; margin-bottom: 16px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.ranking-info p { margin: 0; }
/* 中栏按实际可用宽度排卡片，广告开启后也不会挤成过窄的三列。 */
.projects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; margin: 0; padding: 0; list-style: none; }
.projects:empty { display: none; }
.project { width: 100%; max-width: 534px; min-width: 0; justify-self: center; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.project:hover { border-color: var(--muted); }
.position { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 8px; background: var(--band-soft); color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
/* 奖牌只强调前三名，中央数字仍沿用服务端排名，不改变排序依据。 */
.position.medal { position: relative; width: 40px; height: 40px; background: transparent; }
.medal-gold { --medal-edge: #ad7417; --medal-face: #f8dfa0; --medal-ink: #754706; }
.medal-silver { --medal-edge: #7c8a99; --medal-face: #e5ebf1; --medal-ink: #3b4b5d; }
.medal-bronze { --medal-edge: #ad6a40; --medal-face: #eed0b8; --medal-ink: #754423; }
.medal svg { width: 40px; height: 40px; stroke-width: 1.6; }
.medal-ribbon { stroke: #7590aa; }
.medal-face { fill: var(--medal-face); stroke: var(--medal-edge); }
.medal-number { position: absolute; left: 50%; top: 70.833%; transform: translate(-50%, -50%); color: var(--medal-ink); font-size: 12px; line-height: 1; font-weight: 700; }
html[data-theme="dark"] .medal-gold { --medal-edge: #e9b44c; --medal-face: #a66a0a; --medal-ink: #fff3cf; }
html[data-theme="dark"] .medal-silver { --medal-edge: #b9c7d5; --medal-face: #516271; --medal-ink: #f6f8fa; }
html[data-theme="dark"] .medal-bronze { --medal-edge: #dc986e; --medal-face: #88502f; --medal-ink: #fff0e5; }
html[data-theme="dark"] .medal-ribbon { stroke: #7f9dbb; }
.project-heading { display: flex; align-items: flex-start; gap: 10px; }
.project-name { min-width: 0; flex: 1; }
.project-owner { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.project h2 { min-width: 0; margin: 0; font-size: 17px; line-height: 1.4; font-weight: 700; overflow-wrap: anywhere; }
.project h2 a { color: var(--fg); }
.repository-link { display: grid; place-items: center; flex: none; min-width: 28px; min-height: 28px; color: var(--muted); font-size: 18px; }
.repository-link:hover { color: var(--link); text-decoration: none; }
.summary { margin: 14px 0 12px; min-height: 74px; font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; }
.project-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.project-tag { padding: 1px 7px; border-radius: 5px; background: var(--band-soft); }
.github-metrics { display: flex; flex-wrap: wrap; gap: 12px 30px; margin: 16px 0 12px; padding: 12px 0; border-block: 1px solid var(--line); }
.github-metric { display: flex; align-items: center; gap: 7px; min-width: 0; white-space: nowrap; }
.metric-icon { display: flex; flex: none; color: var(--muted); }
.metric-icon svg { width: 16px; height: 16px; }
.github-metrics b { display: block; color: var(--fg); font-size: 20px; line-height: 1.25; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric-label { display: block; color: var(--muted); font-size: 11px; }
.project-metrics { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 16px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.project-metrics b { color: var(--fg); font-weight: 500; font-variant-numeric: tabular-nums; }
.github-status { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.github-status.stale { color: #936c16; }
/* 暗黑下提高状态色亮度，避免旧数据提示和表单错误难以辨认。 */
html[data-theme="dark"] .github-status.stale { color: #d9a441; }
.project-links { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 7px; font-size: 12px; }
.project-links a { display: inline-flex; align-items: center; min-height: 32px; }
/* 次要字段收进原生详情，保留完整数据和键盘操作，时间戳在窄卡片内换行。 */
.project-details { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.project-details summary { width: fit-content; cursor: pointer; }
.project-details-data { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; margin: 12px 0 0; }
.project-details-data dt { margin: 0; }
.project-details-data dd { margin: 0; color: var(--fg); overflow-wrap: anywhere; }
.list-state { margin: 32px 0; color: var(--muted); text-align: center; }
.retry { display: block; margin: 0 auto 32px; padding: 8px 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--link); }
footer { margin-top: 32px; padding: 22px 0 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
footer p { margin: 0 0 8px; }
/* 弹窗跟随共享配色；高度随可见视口限制，软键盘下可在框内滚动。 */
.newsletter-dialog { width: min(540px, calc(100% - 32px)); max-width: calc(100% - 32px); max-height: calc(100dvh - 32px); padding: 36px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--fg); box-shadow: 0 24px 80px #00000040; overflow-y: auto; overscroll-behavior: contain; }
.newsletter-dialog::backdrop { background: #00000080; backdrop-filter: blur(4px); }
.newsletter-close { position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.newsletter-close:hover { background: var(--soft); }
.newsletter-close svg { width: 20px; height: 20px; }
.newsletter-mark { display: flex; align-items: center; gap: 12px; margin: 0 40px 24px 0; color: var(--muted); font: 11px/1.7 var(--mono); letter-spacing: .05em; }
.newsletter-icon { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 14px; background: var(--soft); color: var(--link); }
.newsletter-icon svg { width: 25px; height: 25px; }
.newsletter-dialog h2 { margin: 0 0 12px; font-size: 28px; line-height: 1.4; }
.newsletter-description { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
.newsletter-topics { margin: 14px 0 26px; color: var(--link); font-size: 12px; }
.newsletter-dialog label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 500; }
.newsletter-field { display: flex; align-items: center; gap: 12px; padding: 0 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.newsletter-field:focus-within { border-color: var(--link); outline: 3px solid var(--soft); }
.newsletter-field:has([aria-invalid="true"]) { border-color: #bd3949; }
.newsletter-field > svg { width: 20px; height: 20px; flex: none; color: var(--muted); }
.newsletter-field input { width: 100%; min-width: 0; height: 56px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--fg); font-size: 16px; border-radius: 0; }
.newsletter-status { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.newsletter-status[data-error="true"] { color: #bd3949; }
html[data-theme="dark"] .newsletter-field:has([aria-invalid="true"]) { border-color: #ff6b76; }
html[data-theme="dark"] .newsletter-status[data-error="true"] { color: #ff6b76; }
.newsletter-submit { width: 100%; min-height: 54px; margin-top: 16px; padding: 12px 16px; border: 1px solid var(--accent); border-radius: 12px; background: var(--accent); color: var(--accent-fg); font-size: 15px; font-weight: 500; }
.newsletter-submit:hover { opacity: .88; }
.newsletter-submit:disabled { opacity: .65; cursor: default; }
.newsletter-note { margin: 20px 0 0; color: var(--muted); font-size: 12px; line-height: 1.8; text-align: center; }
body.newsletter-open { overflow: hidden; }
@media (max-width: 900px) {
  .ranking-layout { padding: 0; }
  .ranking-layout[data-sponsors-enabled="true"] { display: block; padding: 0; }
  .page-shell { padding: 0 24px 24px; }
  .ranking-sponsor-rail { display: none; }
  .ranking-mobile-sponsors { display: grid; gap: 8px; margin-top: 16px; }
  .ranking-mobile-sponsor { display: grid; grid-template-columns: 25px minmax(0, 1fr); align-items: center; gap: 2px 10px; padding: 10px 12px; border: 1px solid #dce3ed; border-radius: 9px; color: #172235; overflow-wrap: anywhere; }
  .ranking-mobile-sponsor .ranking-sponsor-logo { grid-row: span 2; width: 25px; height: 25px; font-size: 13px; }
  .ranking-mobile-sponsor-link { display: block; margin-top: 8px; text-align: left; }
}
@media (max-width: 650px) { .page-shell { padding: 0 12px 24px; } .ranking-byline-source { margin-left: 0; } }
@media (max-width: 480px) { .page-shell { padding-bottom: 18px; } .project { padding: 14px; } .newsletter-dialog { padding: 28px 22px; border-radius: 18px; } .newsletter-dialog h2 { font-size: 24px; } .newsletter-mark { margin-bottom: 20px; } }
@container (max-width: 990px) { .projects { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 655px) { .projects { grid-template-columns: minmax(0, 1fr); } .summary { min-height: 0; } h1 { font-size: 24px; } }
@media (pointer: coarse) { .language button, .newsletter-entry, .project-details summary { min-height: 44px; } .project-links a { min-height: 44px; } .repository-link { min-width: 44px; min-height: 44px; } }
