/* 全站共用 X 默认与暗黑色板，赞助粉彩和媒体背景独立保留。 */
:root {
  --bg: #ffffff; --surface: #ffffff; --band: #f7f9f9; --band-soft: #f7f9f9; --soft: var(--band-soft);
  --fg: #0f1419; --muted: #536471; --line: #eff3f4; --link: #1d9bf0;
  --accent: #0f1419; --accent-fg: #ffffff;
  --site-content-width: 1634px; --site-header-left: 8px; --site-header-right: 8px; --site-header-top: 24px;
  --site-content-side-space: calc(clamp(112px, 12vw, 190px) + 16px);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #000000; --band: #16181c; --band-soft: #16181c;
  --fg: #e7e9ea; --muted: #71767b; --line: #2f3336;
  --accent: #eff3f4; --accent-fg: #0f1419;
  color-scheme: dark;
}
/* 赞助卡共用（精选页、开源榜）：上传的 Logo 图片与 Sponsored 标记。 */
:is(.sponsor-logo, .ranking-sponsor-logo) img { display: block; width: 100%; height: 100%; object-fit: contain; }
.sponsor-tag { font-size: 10px; line-height: 1.2; letter-spacing: .04em; opacity: .72; }
/* 分享页与列表卡片共用质量胶囊和翻译按钮，深浅主题保持一致。 */
.q { font-size: 12px; line-height: 24px; font-variant-numeric: tabular-nums; border-radius: 999px; padding: 0 9px; background: #1d9bf01f; color: #075985; }
:root[data-theme="dark"] .q { color: #8dccf7; }
/* 列表与分享页共用评分浮层，五档保持单行，挂在 body 下避免卡片裁切。 */
.quality-trigger { position: relative; border: 0; font-family: inherit; cursor: pointer; }
.quality-tooltip { position: fixed; z-index: 101; width: 300px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow: auto; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--fg); box-shadow: 0 4px 14px rgb(0 0 0 / .14); font-size: 12px; line-height: 19px; font-variant-numeric: tabular-nums; }
.quality-tooltip[hidden] { display: none; }
.quality-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.quality-head b { font-size: 13px; font-weight: 500; }
.quality-head span { white-space: nowrap; }
.quality-intro { margin: 3px 0 7px; color: var(--muted); font-size: 11px; }
.quality-intro strong { color: var(--fg); font-weight: 500; }
.quality-table { width: 100%; border-collapse: collapse; font: inherit; }
.quality-table th { padding: 0 0 3px; color: var(--muted); font-size: 11px; font-weight: 400; text-align: left; }
.quality-table td { padding: 2px 0; font: inherit; white-space: nowrap; }
.quality-table th:not(:first-child), .quality-table td:not(:first-child) { padding-left: 7px; }
.quality-table th:last-child, .quality-table td:last-child { text-align: right; }
/* 热度胶囊配色：精选 .q.heat-score、榜单 .heat-badge、分享页共用；尺寸各页自己定。 */
.q.heat-score, .heat-badge { background: #fff3e7; color: #995016; }
:root[data-theme="dark"] .q.heat-score, :root[data-theme="dark"] .heat-badge { background: #35291e; color: #ffc38e; }
.heat-table td:nth-child(2) { color: var(--muted); text-align: right; }
.heat-sum { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 8px; margin-top: 6px; color: var(--muted); font-size: 11px; }
.tip-rules { display: flex; justify-content: flex-end; margin-top: 6px; }
.tip-rules a { font-size: 12px; font-weight: 500; }
/* 质量浮层底部：说明文字与规则链接同一行 */
.quality-relevance-foot { display: flex; align-items: baseline; gap: 8px; }
.quality-relevance-foot .quality-relevance-note { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tip-rules-inline { flex: none; margin-top: 0; white-space: nowrap; }
.quality-points { display: inline-block; min-width: 3.6em; padding-right: 4px; }
.quality-level { color: var(--muted); font-size: 11px; }
.quality-voters { display: flex; align-items: center; gap: 3px; }
.quality-voters svg { flex: none; width: 13px; height: 13px; color: var(--link); }
.quality-math { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line); }
.quality-math > span:first-child, .quality-difference { color: var(--muted); font-size: 11px; }
.quality-difference { margin: 4px 0 0; line-height: 16px; }
.quality-relevance { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.quality-relevance-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.quality-relevance-head strong { font-weight: 500; }
.quality-relevance-track { height: 3px; margin: 6px 0 4px; border-radius: 2px; overflow: hidden; background: var(--band-soft); }
.quality-relevance-fill { height: 100%; background: var(--link); }
.quality-relevance-note { margin: 0; color: var(--muted); font-size: 11px; }
/* 触屏不把胶囊撑高（会和分类、热度高低不齐）：视觉保持 24px，透明伪元素把点按区扩到 36px。 */
@media (pointer: coarse) { .quality-trigger::after { content: ""; position: absolute; inset: -6px -3px; } }
.translate-post { position: relative; align-self: flex-start; min-height: 28px; padding: 0; border: 0; background: transparent; color: var(--link); font: inherit; font-size: 13px; font-weight: 500; line-height: 20px; cursor: pointer; }
.translate-post:disabled { color: var(--muted); cursor: wait; }
.translate-post[hidden], .translation-meta[hidden], .translation-status[hidden] { display: none; }
/* 同理：触屏按钮仍占 28px 行高，点按区上下各扩 6px，避免译文说明与正文之间空出一大段。 */
@media (pointer: coarse) { .translate-post::after { content: ""; position: absolute; inset: -6px -4px; } }
/* 官方名称、卡片正文与分享正文共用关键词配色。 */
.jev-keyword { background: #1d9bf01f; color: #075985; font-weight: 500; border-radius: 3px; }
:root[data-theme="dark"] .jev-keyword { color: #8dccf7; }
/* 按主站中栏对齐所有页头，正文仍保留各页自己的阅读宽度。 */
html { scrollbar-gutter: stable; }
/* 中栏按布局实际宽度独立限宽，广告开关不改变阅读宽度，滚动条也计入可用空间。 */
.page-layout, .ranking-layout { container-type: inline-size; }
.page-layout > .content, .page-layout > .rules-shell, .ranking-layout > .page-shell { max-width: min(var(--site-content-width), calc(100cqw - 2 * var(--site-content-side-space))); }
.site-header.site-chrome, .header-inner.site-chrome { width: min(var(--site-content-width), calc(100% - var(--site-header-left) - var(--site-header-right))); margin: var(--site-header-top) auto 0; margin-left: max(var(--site-header-left), calc((100% - var(--site-content-width) + var(--site-header-left) - var(--site-header-right)) / 2)); }
/* 桌面页头按左右赞助是否开启预留空间，与精选中栏的网格位置一致。 */
@media (min-width: 901px) {
  :root[data-sponsor-left="true"] { --site-header-left: calc(clamp(112px, 12vw, 190px) + 24px); }
  :root[data-sponsor-right="true"] { --site-header-right: calc(clamp(112px, 12vw, 190px) + 24px); }
}
/* 页头使用系统字体，避免网络字体加载和不同正文行高造成跳动。 */
.site-chrome { box-sizing: border-box; display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; min-height: 55px; padding: 0 0 10px; border-bottom: 1px solid var(--line); font: 15px/1.7 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
.site-chrome .site-brand { display: inline-flex; align-items: center; gap: 9px; flex: none; color: var(--fg); font-size: 20px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.site-wordmark { margin: 0; font: inherit; }
/* 全站复用矢量徽标，保留原有尺寸，避免影响页头布局。 */
.site-logo { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 6px; background: url("/logo.svg") center / contain no-repeat; font-size: 0; }
.site-chrome .site-nav { display: flex; flex-wrap: nowrap; align-items: center; gap: 18px; width: auto; }
.site-chrome .site-nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); font-size: 15px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.site-chrome .site-nav a:hover { color: var(--link); }
.site-chrome .site-nav a[aria-current="page"] { color: var(--link); }
.site-chrome .language { display: flex; align-items: center; flex: none; gap: 2px; margin-left: auto; padding: 3px; border-radius: 999px; background: color-mix(in srgb, var(--link) 8%, var(--surface)); }
.site-chrome .language button, .site-chrome .language a { box-sizing: border-box; display: grid; place-items: center; min-width: 34px; height: 24px; padding: 0 6px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: 11px; text-decoration: none; }
.site-chrome .language [aria-pressed="true"], .site-chrome .language [aria-current="page"] { background: var(--surface); color: var(--link); font-weight: 700; }
.site-chrome .site-actions { display: flex; align-items: center; flex: none; gap: 8px; margin-left: auto; }
.site-chrome .site-actions .language { margin-left: 0; }
.theme-toggle { display: grid; place-items: center; flex: none; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.theme-toggle:hover, .theme-toggle:active { background: var(--band); color: var(--fg); }
.theme-toggle:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .theme-sun, :root[data-theme="dark"] .theme-toggle .theme-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-sun { display: block; }
@media (max-width: 900px) {
  :root { --site-header-left: 24px; --site-header-right: 24px; --site-content-side-space: 0px; }
}
@media (max-width: 650px) {
  :root { --site-header-left: 12px; --site-header-right: 12px; --site-header-top: 12px; }
  /* 手机首行放品牌与设置，导航独占第二行，英文和 320px 小屏也不挤压触区。 */
  .site-chrome { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; padding-bottom: 0; }
  .site-chrome .site-brand { gap: 7px; font-size: 18px; }
  .site-chrome .site-logo { width: 26px; height: 26px; }
  .site-chrome .site-actions { grid-column: 2; grid-row: 1; }
  .site-chrome .site-nav { grid-column: 1 / -1; grid-row: 2; gap: 24px; }
  .site-chrome .site-nav a { font-size: 14px; }
  .theme-toggle { width: 44px; height: 44px; }
}
@media (pointer: coarse) {
  .site-chrome { min-height: 61px; }
  .theme-toggle { width: 44px; height: 44px; }
}
/* 手机和触屏：语言切换保持紧凑胶囊（28px 高），不再撑成 44px 的大圆块；透明伪元素把点按区上下补到 44px。 */
@media (max-width: 650px), (pointer: coarse) {
  .site-chrome .language button, .site-chrome .language a { position: relative; min-width: 40px; height: 28px; font-size: 12px; }
  .site-chrome .language button::after, .site-chrome .language a::after { content: ""; position: absolute; inset: -8px 0; }
}
/* 全站页脚复用品牌与三列导航，按实际中栏宽度换行，保留各页正文布局。 */
.site-footer { margin-top: 40px; padding-top: 40px; border-top: 1px solid var(--line); color: var(--muted); font: 13px/1.7 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; container-type: inline-size; }
.site-footer-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 40px; }
.site-footer-brand-link { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); font-size: 20px; font-weight: 700; text-decoration: none; }
.site-footer .site-logo { width: 30px; height: 30px; }
.site-footer-intro { max-width: 34ch; margin: 16px 0 0; font-size: 15px; }
.site-footer-links { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.site-footer-group h2 { margin: 0 0 12px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.site-footer-group nav { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.site-footer-group a { display: inline-flex; align-items: center; min-height: 32px; color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--link); text-decoration: none; }
.site-footer-bottom { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; margin-top: 48px; padding: 20px 0 4px; border-top: 1px solid var(--line); }
.site-footer-bottom p { margin: 0; font-size: 11px; }
.site-footer-copyright { flex: none; }
.site-footer-disclaimer { max-width: 80ch; text-align: right; }
@container (max-width: 760px) {
  .site-footer-main { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .site-footer-links { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .site-footer-bottom { flex-direction: column; gap: 8px; margin-top: 28px; }
  .site-footer-disclaimer { text-align: left; }
}
/* 没有容器的页面（工具页等）按视口兜底，避免 4 列在手机上过挤。 */
@media (max-width: 760px) {
  .site-footer-links { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}
@media (pointer: coarse) {
  .site-footer-group a { min-height: 44px; }
}

/* 精选、榜单、博客共用的署名行「策展人 · 来源 · 订阅」：三页结构与高度一致，切换页面时标题不再上下跳动。
   行高由 24px 的订阅按钮决定，上下各 8px 内边距，共 40px。 */
.site-byline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 8px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.site-byline > span { white-space: nowrap; }
.site-byline-source { margin-left: auto; }
.site-byline a { color: inherit; text-decoration: none; }
.site-byline .curator-link { color: var(--link); }
/* 手机上策展人链接字小，只扩大点击区域，不改外观。 */
@media (pointer: coarse) { .site-byline .curator-link { position: relative; } .site-byline .curator-link::after { content: ""; position: absolute; inset: -10px -4px; } }
@media (max-width: 650px) {
  /* 手机署名行：一行不换行；来源去掉标签、放不下时截断，订阅始终完整靠右。 */
  .site-byline { flex-wrap: nowrap; gap: 10px; }
  .site-byline-source { flex: 1 1 auto; min-width: 0; margin-left: 0; overflow: hidden; text-overflow: ellipsis; }
  .site-byline-label { display: none; }
  .site-byline .newsletter-entry { flex: none; margin-left: auto; }
}
/* 邮件订阅入口与弹窗：从榜单页移来，精选、榜单、博客共用。各页按钮默认字体不同，这里统一继承正文字体。 */
.newsletter-entry, .newsletter-dialog button { font-family: inherit; cursor: pointer; }
.newsletter-dialog input { font-family: inherit; }
.newsletter-entry { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 24px; padding: 0 10px; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-fg); font-size: 11px; font-weight: 500; white-space: nowrap; }
.newsletter-entry svg { width: 12px; height: 12px; }
.newsletter-entry:hover { opacity: .85; }
/* 弹窗跟随共享配色；高度随可见视口限制，软键盘下可在框内滚动。 */
.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 20px 0; color: var(--muted); font: 11px/1.7 var(--mono, ui-monospace, monospace); letter-spacing: .05em; }
.newsletter-icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--soft); color: var(--link); }
.newsletter-icon svg { width: 22px; height: 22px; }
.newsletter-dialog h2 { margin: 0 0 10px; font-size: 24px; line-height: 1.35; }
.newsletter-description { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
/* 订阅内容：打勾列表（原来的蓝色话题行看起来像链接） */
.newsletter-points { display: grid; gap: 8px; margin: 16px 0 24px; padding: 0; list-style: none; color: color-mix(in srgb, var(--fg) 85%, var(--muted)); font-size: 13px; line-height: 1.5; }
.newsletter-points li { display: flex; gap: 8px; }
.newsletter-points li::before { content: "✓"; flex: none; color: var(--link); font-weight: 700; }
.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: 52px; 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: 52px; margin-top: 14px; 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: 16px 0 0; color: var(--muted); font-size: 12px; line-height: 1.8; text-align: center; }
body.newsletter-open { overflow: hidden; }
/* 手机：订阅窗改成底部弹出的面板，贴底、全宽，留出 Home 指示条的安全区 */
@media (max-width: 480px) {
  .newsletter-dialog { width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0; padding: 22px 20px calc(18px + env(safe-area-inset-bottom)); border-width: 1px 0 0; border-radius: 20px 20px 0 0; }
  .newsletter-close { top: 8px; right: 8px; }
  .newsletter-mark { margin-bottom: 14px; }
  .newsletter-dialog h2 { font-size: 20px; }
  .newsletter-description { font-size: 13px; }
  .newsletter-points { margin: 12px 0 18px; }
  .newsletter-note { margin-top: 12px; }
}
@media (pointer: coarse) { .newsletter-entry { position: relative; } .newsletter-entry::after { content: ""; position: absolute; inset: -8px -4px; } }
