/* ═══════════════════════════════════════════════════
   站点样式表
   支持：深色 / 浅色 / 系统跟随 / 响应式 / 减弱动效
   ═══════════════════════════════════════════════════ */

/* ── 深色主题（兜底配色：无 data-theme 时的底座；手动深色与跟随深色系统同样落回这里。
    不是「默认主题」——有 JS 时首访默认是跟随系统（见 base.html head 脚本）；
    选深色兜底是品牌取舍：无 JS 场景受众极小且不挑主题，保 OG 图/图标一致的品牌调性。 ── */
:root {
  --bg: #0a0e14;
  --bg-grad: radial-gradient(1400px 700px at 50% -10%, #1b2a4a44, transparent 65%);
  --surface: #131920;
  --surface-2: #1a222d;
  --surface-3: #1f2937;
  --border: #252d38;
  --border-soft: #1c2430;
  --border-focus: #3b4a5e;
  --text: #e2e8f0;
  --text-secondary: #c0cad8;
  --muted: #7d8b9d;
  --accent: #0ea5c4;
  --accent-hover: #06b6d4;
  --accent-soft: #0ea5c426;
  --accent-glow: #0ea5c420;
  /* 按钮专用强调色：作实心底色时白字对比需 ≥4.5:1（AA），
     而 --accent 当链接/文字用时无需这么深。深色下 #0ea5c4 白字仅 ~2.9:1，
     故按钮另取更深一档，与文字强调色解耦，互不拖累。 */
  --accent-solid: #0b7590;
  --accent-solid-hover: #085e74;
  --star: #fbbf24;
  --star-soft: #fbbf2418;
  --hl: #fbbf24;
  --hl-bg: #fbbf2418;
  --up: #34d399;
  --up-soft: #34d39918;
  --up-border: #34d39940;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --maxw: 880px;
  --shadow-sm: 0 1px 2px #0004;
  --shadow: 0 1px 3px #0005, 0 4px 16px -4px #0006;
  --shadow-lg: 0 2px 8px #0005, 0 12px 32px -8px #0008;
  --shadow-glow: 0 0 20px var(--accent-glow);
  --transition: 180ms cubic-bezier(.4, 0, .2, 1);
  --transition-slow: 300ms cubic-bezier(.4, 0, .2, 1);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", "Cascadia Code", monospace;
  /* 原创品牌图标：递增柱状图 + 上升趋势箭头，寓意「榜单 + 上升热度」 */
  --brand-mark: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="2.5" y="14" width="4.4" height="7" rx="1.4"/><rect x="9.8" y="9.5" width="4.4" height="11.5" rx="1.4"/><rect x="17.1" y="5" width="4.4" height="16" rx="1.4"/><path d="M3 9.2 10 5l4 2.4 6.2-4.5-.2 3.4-1.9-.6-3.9 2.9L10 8.3 3.8 12z"/></svg>');
}

/* ── 浅色主题（手动选择；跟随系统浅色时由 JS 解析后同样写 data-theme） ── */
:root[data-theme="light"] {
  --bg: #f8fafc;
  --bg-grad: radial-gradient(1400px 700px at 50% -10%, #cffafe26, transparent 65%);
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e2e8f0;
  --border: #e2e8f0;
  --border-soft: #f1f5f9;
  --border-focus: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --accent: #0e7490;
  --accent-hover: #155e75;
  --accent-soft: #0e749012;
  --accent-glow: #0e749010;
  --accent-solid: #0e7490;
  --accent-solid-hover: #155e75;
  --star: #d97706;
  --star-soft: #d9770612;
  --hl: #d97706;
  --hl-bg: #d9770612;
  --up: #059669;
  --up-soft: #05966912;
  --up-border: #05966930;
  --shadow-sm: 0 1px 2px #0f172808;
  --shadow: 0 1px 3px #0f17280a, 0 4px 16px -4px #0f17280f;
  --shadow-lg: 0 2px 8px #0f17280a, 0 12px 32px -8px #0f172815;
  --shadow-glow: 0 0 20px var(--accent-glow);
}

/* ── 护眼主题（手动选择，暖黄纸张风，低蓝光） ── */
:root[data-theme="eye"] {
  --bg: #f3e9d2;
  --bg-grad: radial-gradient(1400px 700px at 50% -10%, #e9d8ab55, transparent 65%);
  --surface: #faf3e0;
  --surface-2: #f1e6c9;
  --surface-3: #e8dab7;
  --border: #e0cfa6;
  --border-soft: #ecdfc0;
  --border-focus: #cdb681;
  --text: #4a3f2a;
  --text-secondary: #6a5b3d;
  --muted: #726246;
  --accent: #8f5316;
  --accent-hover: #743f0e;
  --accent-soft: #8f531614;
  --accent-glow: #8f531612;
  --accent-solid: #8f5316;
  --accent-solid-hover: #743f0e;
  --star: #8a6208;
  --star-soft: #8a620814;
  /* 高亮令牌与星标解耦：星标棕在暖纸上几乎不可辨，护眼靠暖黄荧光笔色带承担信号 */
  --hl: var(--text);
  --hl-bg: #dcb15c73;
  --up: #556015;
  --up-soft: #55601516;
  --up-border: #55601533;
  --shadow-sm: 0 1px 2px #4a3f2a0a;
  --shadow: 0 1px 3px #4a3f2a0d, 0 4px 16px -4px #4a3f2a14;
  --shadow-lg: 0 2px 8px #4a3f2a0d, 0 12px 32px -8px #4a3f2a1c;
  --shadow-glow: 0 0 20px var(--accent-glow);
}

/* ── 基础重置 ── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

/* 滚动条美化：细滚动条 + 随主题变色，替换 Windows 上又宽又亮的默认样式。
   标准属性（Firefox / 新版 Chromium）与 ::-webkit-scrollbar（WebKit/Safari）双写，
   颜色引设计令牌，深/浅/护眼三套主题自动适配。thumb 用边框透出轨道形成留白，更细。 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: var(--border-focus); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }
/* 统一键盘焦点样式：所有可聚焦元素共用 accent 焦点环，避免逐个补样式导致遗漏。
   :where() 零特异性，个别元素需特殊焦点样式时可轻松覆盖。outline 会跟随 border-radius，圆形按钮也贴合。 */
:where(a, button, .tab, [tabindex], select):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.7;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

/* ── 链接 ── */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--accent-hover); }

/* ── 顶部导航栏 ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border-soft);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 20px;
}
.brand {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.02em;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  user-select: none;
}
.brand::before {
  content: "";
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--up) 100%);
  -webkit-mask: var(--brand-mark) center / contain no-repeat;
  mask: var(--brand-mark) center / contain no-repeat;
}

/* ── 右侧操作区：导航链接 + 主题切换 ── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ── 导航链接 ──
   使用传统文字链接样式，与首页真正的 Tab 切换形成区分。
   当前页面用下划线高亮，明确提示“这是链接、会跳转”。 */
.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}
.nav a {
  position: relative;
  padding: 4px 0;
  border-radius: 0;
  color: var(--text-secondary);
  font-size: .9rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color var(--transition);
  letter-spacing: .01em;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform var(--transition);
}
.nav a:hover {
  background: transparent;
  color: var(--accent);
  text-decoration: none;
}
.nav a:hover::after { transform: scaleX(1); }
.nav a.is-active {
  color: var(--accent);
  font-weight: 600;
}
.nav a.is-active::after { transform: scaleX(1); }

/* ── 全站搜索框 ──
   位于 header 中部（品牌 | 搜索 | 导航+主题），flex:1 撑起中段，仅桌面显示。
   ≤640px 时隐藏，改由正文顶部的 .mobile-search 承担搜索入口（见下方搜索页样式区），
   避免 sticky 头被搜索行撑高、常驻占屏。 */
.header-search {
  flex: 1;
  min-width: 150px;
  max-width: 260px;
  position: relative;
  display: flex;
  align-items: center;
}
.header-search .search-icon {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}
.header-search input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: .88rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.header-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.header-search input::placeholder { color: var(--muted); }

/* ── 主题切换 ── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition),
              box-shadow var(--transition);
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}
/* 无 popover 支持时 JS 隐藏按钮：display:inline-flex 会压过 UA 的 [hidden]，
   必须显式兜底（同 .repo-list[hidden] 的处理） */
.theme-toggle[hidden] { display: none; }
.theme-toggle svg {
  width: 16px;
  height: 16px;
  display: block;
  transition: transform var(--transition-slow);
}
.theme-toggle:hover svg { transform: rotate(15deg); }
/* 深色显示月亮，浅色显示太阳（语义映射：太阳=白天=浅色，月亮=夜晚=深色；
   注意与旧循环时代的「操作导向」相反——菜单化后图标表示当前生效配色而非点击动作）。
   跟随系统也显示解析后的太阳/月亮（head 脚本已把解析色写进 data-theme），
   半阳半阴图标仅用于菜单里带文字标签的「跟随系统」项，按钮上不出现。 */
.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun,
.theme-toggle .icon-eye { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="eye"] .theme-toggle .icon-sun,
:root[data-theme="eye"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="eye"] .theme-toggle .icon-eye { display: block; }
/* 眼睛图标不旋转，hover 时轻微放大（像「聚焦」），比旋转更贴合语义 */
.theme-toggle:hover .icon-eye { transform: scale(1.18); }

/* ── 主题菜单（原生 popover 弹层，按钮 popovertarget 声明式开合；
    位置由 JS 在打开时按按钮实际坐标设置，见 base.html 的 toggle 事件） ── */
.theme-menu {
  min-width: 160px;
  max-width: calc(100vw - 24px);
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  /* UA 的 [popover] 规则带 inset:0 + margin:auto：JS 设了 top/right 后
     UA 锚定定位不再介入，但这条规则会把弹层拉伸并在剩余空间居中。
     显式清零 margin 与 left/bottom，让 top/right 定位真正生效。 */
  margin: 0;
  left: auto;
  bottom: auto;
}
/* display 不能直接写在 .theme-menu 上：会覆盖 UA 的 [popover] 隐藏规则，
   导致菜单永远显示。只在打开态才切 flex。 */
.theme-menu:popover-open {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.theme-option:hover,
.theme-option:focus-visible {
  background: var(--surface-3);
  color: var(--text);
}
.theme-option.is-active {
  color: var(--accent);
  font-weight: 600;
}
.theme-option svg {
  width: 15px;
  height: 15px;
  flex: none;
}

/* ── 回到顶部 ── */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity var(--transition), transform var(--transition),
              visibility var(--transition), color var(--transition),
              border-color var(--transition), box-shadow var(--transition);
}
.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}
.back-to-top svg {
  width: 18px;
  height: 18px;
  display: block;
  transition: transform var(--transition);
}
.back-to-top:hover svg { transform: translateY(-2px); }

/* ── 意见反馈：悬浮按钮 + 弹窗 ── */
/* 悬浮按钮堆叠在「回到顶部」之上（bottom 更大），复用其边框/背景/hover 辉光。
   与 back-to-top 不同：始终可见，不随滚动显隐。 */
.feedback-fab {
  position: fixed;
  right: 24px;
  bottom: 80px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: color var(--transition), border-color var(--transition),
              box-shadow var(--transition), transform var(--transition);
}
.feedback-fab:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}
.feedback-fab svg {
  width: 18px;
  height: 18px;
  display: block;
}

.feedback-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.feedback-dialog::backdrop {
  background: #0009;
  backdrop-filter: blur(2px);
}
.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 22px 22px;
}
.feedback-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.feedback-form-head h2 {
  margin: 0;
  font-size: 1.05rem;
}
.feedback-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: -6px -8px -6px 0;
  padding: 0;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}
.feedback-close:hover {
  color: var(--text);
  background: var(--surface-2);
}
.feedback-close svg { width: 18px; height: 18px; display: block; }
.feedback-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.feedback-field em {
  font-style: normal;
  color: var(--accent);
}
.feedback-field textarea,
.feedback-field input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.feedback-field textarea {
  resize: vertical;
  min-height: 120px;
  padding-bottom: 26px; /* 给右下角字数计数留出空间，避免文字压到计数上 */
}
/* 字数计数：绝对定位在 textarea 内右下角，随 textarea 拖高始终贴底。 */
.feedback-textarea-wrap {
  position: relative;
  display: flex; /* 让内部 textarea 撑满，便于 resize */
}
.feedback-counter {
  position: absolute;
  right: 10px;
  bottom: 8px;
  padding: 1px 4px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
  pointer-events: none; /* 不挡住 textarea 右下角的拖拽把手 */
}
.feedback-counter.is-near { color: var(--star); }
.feedback-field textarea:focus,
.feedback-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
/* 状态提示：平时为空，用 :empty 完全不占位；有提示文字时才显示。
   避免弹窗底部常驻一条空白行。 */
.feedback-status {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.feedback-status:empty { display: none; }
.feedback-status.is-ok { color: var(--up); }
.feedback-actions {
  display: flex;
  justify-content: flex-end;
}
.feedback-submit {
  padding: 9px 18px;
  border: 1px solid var(--accent-solid);
  border-radius: var(--radius-sm);
  background: var(--accent-solid);
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), opacity var(--transition);
}
.feedback-submit:hover { background: var(--accent-solid-hover); border-color: var(--accent-solid-hover); }
.feedback-submit:disabled { opacity: 0.6; cursor: default; }

/* ── 主容器 ── */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px 20px 32px;
}

/* ── 榜单头部 ── */
.board-head {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.board-head h1 {
  margin: 0 0 10px;
  font-size: 1.6rem;
  line-height: 1.3;
  letter-spacing: -.03em;
  font-weight: 800;
  color: var(--text);
}
.meta {
  color: var(--muted);
  font-size: .82rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 4px 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.meta::-webkit-scrollbar { display: none; }
.meta .sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted);
  opacity: .5;
}

/* ── 详情页相邻期次导航 ──
   胶囊按钮样式与 ai-daily 项目保持一致：单行纯日期、边框 + 圆角 + hover 光晕。
   日期双格式：默认（移动端）显示 ISO 短格式（全角中文日期在 ≤400px 窄屏会溢出），
   桌面端（min-width: 640px）切换为中文格式——与 home.html 的 tab-label-full/short
   同一套断点切换模式。 */
.board-pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
}
.pager-link {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: .85rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition),
              box-shadow var(--transition);
}
.pager-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
  text-decoration: none;
}
.pager-date-full { display: none; }

/* ── 首页周期 Tab ── */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 1 0;
  min-width: max-content;
  padding: 9px 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: .9rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--transition), background-color var(--transition),
              box-shadow var(--transition);
}
/* 标签文案：移动优先，默认窄屏显示短名（日榜），≥640px 宽屏显示完整名（每日热点项目） */
.tab-label-full { display: none; }
.tab:hover { color: var(--text-secondary); }
.tab[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.tab-panel[hidden] { display: none; }
/* repo-list 用 display:flex，会压过 UA 的 [hidden] { display:none }，必须显式兜底。
   首页/详情页的 repo-list 从不设 hidden，此规则只影响搜索页的空态/无结果隐藏。 */
.repo-list[hidden] { display: none; }
/* 无 JS：三榜平铺，各面板间留出间隔并用 h2 小标题分隔 */
.tab-panel + .tab-panel { margin-top: 40px; }
.panel-title {
  margin: 0 0 12px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}
/* 有 JS（.js-tabs）：Tab 已表明当前周期，隐藏面板内冗余的 h2 标题与面板间距 */
.js-tabs .panel-title { display: none; }
.js-tabs .tab-panel + .tab-panel { margin-top: 0; }
.panel-meta {
  color: var(--muted);
  font-size: .82rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 4px 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.panel-meta::-webkit-scrollbar { display: none; }
.panel-meta .sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted);
  opacity: .5;
}

/* ── 榜单工具行（meta 描述 + 排序下拉）──
   桌面端一行两段：左 meta、右排序；移动端在 @media 里改为上下两行（见底部）。
   排序控件默认带 hidden 属性，JS 可用后移除才显示——无 JS 不留死控件。 */
.board-toolbar,
.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}
.panel-toolbar { margin-bottom: 16px; }
.sort-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  position: relative;
}
.sort-control[hidden] { display: none; }
.sort-label {
  color: var(--muted);
  font-size: .82rem;
  white-space: nowrap;
}
.sort-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 7px 32px 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: .85rem;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.sort-select:hover { border-color: var(--border-focus); }
/* 鼠标点击 select 时抑制焦点环：Chrome/Safari 对 select 在指针点击下也会匹配
   :focus-visible（因为展开的列表框可键盘操作），与站内「只有键盘才显示焦点环」的
   观感不一致。base.html 的脚本在 pointerdown 时打上 data-pointer-focus，
   键盘介入或失焦即清除，所以 Tab 聚焦仍有完整焦点环。仅描边收敛，边框色照常提示。 */
.sort-select[data-pointer-focus]:focus-visible { outline: none; }
.sort-select:focus { border-color: var(--border-focus); }
/* 下拉箭头：内联 SVG + currentColor，颜色自动跟随各主题的 --muted，
   无需按主题重复 data URI（background-image 里的 SVG 无法解析 currentColor，故不能走捷径）。
   right:10px 锚在 .sort-control 右缘：桌面端 select 是最后一个子元素、移动端 flex:1 填满，
   两处右缘都与 select 对齐。 */
.sort-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  color: var(--muted);
  pointer-events: none;
}
.more-link {
  display: inline-flex;
  align-items: center;
  margin-top: 18px;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  font-size: .88rem;
  font-weight: 600;
  transition: border-color var(--transition), background-color var(--transition),
              box-shadow var(--transition);
}
.more-link:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: var(--shadow-glow);
}

/* ── 项目列表 ── */
.repo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* 整个列表作为一个整体淡入一次，不逐卡错峰（避免 AI 感的 cascade） */
  animation: list-in 0.4s ease both;
}
@keyframes list-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── 项目卡片 ── */
.repo-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  scroll-margin-top: 80px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

/* 卡片 hover（仅触屏以上设备） */
@media (hover: hover) {
  .repo-card:hover {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-lg);
  }
}

.repo-body { min-width: 0; }

/* ── 被屏蔽仓库（就地模糊行）──
   保留排名 + 仓库名 + 语言/官方数值，不展示描述/简介/链接（见 _blocklist.py）。
   整卡半透明弱化，避免与正常卡片同级抢眼；也不随 hover 高亮。
   数值是官榜公开事实、不带观点，保留它读者才能看清该行排名的依据。 */
.repo-card-blocked {
  opacity: .6;
}
@media (hover: hover) {
  .repo-card-blocked:hover {
    border-color: var(--border);
    box-shadow: none;
  }
}
.repo-name-blocked {
  font-family: var(--font-mono);
  letter-spacing: -.01em;
  word-break: break-word;
  color: var(--text);
}
.repo-card-blocked .repo-owner {
  font-weight: 400;
}
.repo-blocked-tag {
  margin: 6px 0 0;
  font-size: .78rem;
  color: var(--muted);
}

/* ── 项目名称 + 排名 ── */
.repo-name {
  margin: 0 0 6px;
  font-size: 1.05rem;
  line-height: 1.4;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.repo-name a {
  word-break: break-word;
  color: var(--text);
  font-family: var(--font-mono);
  letter-spacing: -.01em;
  transition: color var(--transition);
}
/* owner 与项目名同色，仅用字重区分（对齐 GitHub Trending） */
.repo-owner {
  font-weight: 400;
}
.repo-repo {
  font-weight: 750;
}
.repo-name a:hover .repo-owner,
.repo-name a:hover .repo-repo { color: var(--accent); }

/* 排名徽章 */
.repo-rank {
  flex: 0 0 auto;
  min-width: 1.65em;
  padding: 0 .45em;
  height: 1.65em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 800;
  line-height: 1;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  letter-spacing: .02em;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
/* ── 项目描述 ── */
.repo-desc-zh {
  margin: 4px 0 2px;
  font-size: .92rem;
  line-height: 1.65;
  color: var(--text-secondary);
}
.repo-desc-en {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.6;
}

/* ── 统计行 ── */
.repo-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 14px 0 0;
  font-size: .8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
/* 语言圆点 */
.repo-stats .lang {
  color: var(--text-secondary);
  font-weight: 550;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-right: 12px;
  position: relative;
  font-size: .8rem;
}
.repo-stats .lang::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dot, #8b949e);
  flex: 0 0 auto;
  box-shadow: 0 0 6px color-mix(in srgb, var(--dot, #8b949e) 40%, transparent);
}
.repo-stats .lang::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 1px;
  height: 13px;
  transform: translateY(-50%);
  background: var(--border);
}
/* 语言颜色映射 */
.lang[data-lang="JavaScript"] { --dot: #f1e05a; }
.lang[data-lang="TypeScript"] { --dot: #3178c6; }
.lang[data-lang="Python"] { --dot: #3572a5; }
.lang[data-lang="Go"] { --dot: #00add8; }
.lang[data-lang="Rust"] { --dot: #dea584; }
.lang[data-lang="Java"] { --dot: #b07219; }
.lang[data-lang="C++"] { --dot: #f34b7d; }
.lang[data-lang="C"] { --dot: #555; }
.lang[data-lang="C#"] { --dot: #178600; }
.lang[data-lang="Ruby"] { --dot: #701516; }
.lang[data-lang="PHP"] { --dot: #4f5d95; }
.lang[data-lang="Swift"] { --dot: #f05138; }
.lang[data-lang="Kotlin"] { --dot: #a97bff; }
.lang[data-lang="Dart"] { --dot: #00b4ab; }
.lang[data-lang="Shell"] { --dot: #89e051; }
.lang[data-lang="HTML"] { --dot: #e34c26; }
.lang[data-lang="CSS"] { --dot: #563d7c; }
.lang[data-lang="Vue"] { --dot: #41b883; }
.lang[data-lang="Jupyter Notebook"] { --dot: #da5b0b; }
.lang[data-lang="Lua"] { --dot: #000080; }
.lang[data-lang="Zig"] { --dot: #ec915c; }

/* Star / Fork 统计 */
.repo-stats .stat {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.repo-stats .stat .ic {
  fill: currentColor;
  flex: 0 0 auto;
  opacity: .7;
}
/* 仅数字用等宽体：中文标签（今日新增等）保持无衬线，避免中西字体割裂 */
.repo-stats .stat .num {
  font-family: var(--font-mono);
}

/* 周期新增 Star：与总 star / fork 保持一致的普通样式 */
.repo-stats .period-star {
  margin-left: auto;
}
/* 移动优先：窄屏默认显示简写（+N），桌面（≥640px）再显示完整文案 */
.period-full { display: none; }
.period-short { display: inline; }

/* ── AI 讲解 ── */
.repo-explain {
  margin-top: 16px;
  padding: 14px 16px 15px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
@media (hover: hover) {
  .repo-card:hover .repo-explain {
    background: var(--surface-3);
  }
}
.repo-explain p {
  margin: 8px 0 0;
  font-size: .9rem;
  line-height: 1.75;
  color: var(--text-secondary);
}
.explain-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--accent);
}
.explain-label::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--accent);
  opacity: .2;
  flex: 0 0 auto;
}

/* ── 归档页 ── */
.archive h1 {
  font-size: 1.4rem;
  letter-spacing: -.02em;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--text);
}
/* 顶部年份锚点导航条 */
.archive-years {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 4px;
  padding: 0;
}
.archive-years a {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color var(--transition), color var(--transition);
}
.archive-years a:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.archive-list {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
}
/* 双级折叠容器的外层锚点（滚动定位参考点） */
.archive-year {
  scroll-margin-top: 12px;
}
.archive-months,
.archive-daylist {
  list-style: none;
  margin: 0;
  padding: 0;
}
/* summary 通用折叠头 */
.archive-year summary,
.archive-month summary {
  cursor: pointer;
  user-select: none;
  color: var(--text);
  font-weight: 600;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 10px 0;
  background: var(--surface);
  list-style: none; /* 去掉默认三角，用自定义旋转箭头 */
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  transition: border-color var(--transition), color var(--transition);
}
.archive-year summary { font-size: 1.02rem; }
.archive-month summary { font-size: .95rem; }
.archive-year summary::-webkit-details-marker,
.archive-month summary::-webkit-details-marker {
  display: none;
}
.archive-year summary::before,
.archive-month summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform var(--transition);
  flex: 0 0 auto;
}
.archive-year[open] > summary::before,
.archive-month[open] > summary::before {
  transform: rotate(45deg);
}
.archive-year summary:hover,
.archive-month summary:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.archive-year summary:focus-visible,
.archive-month summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* 月组头右侧的日期范围（次要信息） */
.archive-range {
  margin-left: auto;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.archive-month summary:not([open]) .archive-range { display: none; }
/* 日列表：紧凑分隔行，不带卡片边框（分组已承担视觉层级） */
.archive-daylist li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 8px 12px;
  margin: 0 0 2px 12px;
  border-left: 1px solid var(--border);
}
.archive-daylist a {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
}
.archive-daylist a:hover { color: var(--accent); }
.archive-meta {
  color: var(--muted);
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
}
.empty {
  color: var(--muted);
  padding: 40px 0;
  text-align: center;
  font-size: .92rem;
}

/* ── 搜索页 ── */
.search-form {
  display: flex;
  gap: 10px;
  margin: 4px 0 20px;
}
.search-box {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
/* 移动端正文顶部搜索框：默认隐藏，≤640px 时在 sticky 头部搜索框隐藏后显示。
   样式与搜索页 .search-box 对齐（全宽、图标绝对定位），置于正文内容最上方。 */
.mobile-search {
  display: none;
  position: relative;
  align-items: center;
  margin-bottom: 14px;
}
.mobile-search .search-icon {
  position: absolute;
  left: 13px;
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}
.mobile-search input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: .95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.mobile-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.mobile-search input::placeholder { color: var(--muted); }
.search-box .search-icon {
  position: absolute;
  left: 13px;
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}
.search-box input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: .95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-box input::placeholder { color: var(--muted); }
.search-submit {
  flex: 0 0 auto;
  padding: 11px 22px;
  border: 1px solid var(--accent-solid);
  border-radius: var(--radius-sm);
  background: var(--accent-solid);
  color: #fff;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.search-submit:hover { background: var(--accent-solid-hover); border-color: var(--accent-solid-hover); }

/* 搜索状态 + 排序下拉一行：状态文本在左、排序控件在右；窄屏 flex-wrap 让
   排序控件自然折行独占一行（.sort-control 在 ≤640px 时已设为 width:100%）。 */
.search-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  margin: 0 0 16px;
}
.search-status {
  margin: 0;
  font-size: .85rem;
  color: var(--muted);
}
.search-status.is-empty { color: var(--muted); }
.search-status.is-error { color: var(--star); }

/* 搜索词高亮：独立 --hl/--hl-bg 令牌，不与星标变量耦合（星标在护眼下偏低调）。
   护眼主题靠暖黄「荧光笔」色带承担信号，文字保持正文深棕保证可读性。 */
.search-result mark {
  background: var(--hl-bg);
  color: var(--hl);
  border-radius: 2px;
  padding: 0 1px;
}

/* 搜索结果卡片：复用 .repo-card 样式，补充「最新上榜/共上榜」元信息行 */
.search-result .search-meta-line {
  margin-top: 12px;
}
.search-appears {
  margin: 8px 0 0;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.search-appears summary {
  padding: 9px 14px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.search-appears summary::-webkit-details-marker { display: none; }
.search-appears summary::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-right: 8px;
  border-left: 5px solid var(--muted);
  border-top: 3.5px solid transparent;
  border-bottom: 3.5px solid transparent;
  transition: transform var(--transition);
}
.search-appears[open] summary::before { transform: rotate(90deg); }
.search-appears ul {
  margin: 0;
  padding: 2px 14px 10px;
  list-style: none;
}
.search-appears li { padding: 3px 0; }
.search-appears a {
  font-size: .84rem;
  color: var(--text-secondary);
}
.search-appears a:hover { color: var(--accent); }

/* ── 关于 / 内容页 ── */
.prose section {
  margin-top: 28px;
}
.prose h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text);
  margin: 0 0 10px;
}
.prose p {
  color: var(--text-soft, var(--text));
  line-height: 1.8;
  margin: 0 0 12px;
}
.prose a {
  color: var(--accent);
}
.prose a:hover {
  text-decoration: underline;
}
.prose .steps,
.prose .notes {
  margin: 0;
  padding-left: 1.3em;
  color: var(--text-soft, var(--text));
  line-height: 1.8;
}
.prose .steps li,
.prose .notes li {
  margin-bottom: 8px;
}

/* ── 页脚 ── */
.footer-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 8px;
}
.footer-links a {
  color: var(--muted);
}
.footer-links a:hover {
  color: var(--accent);
}
.footer-links .sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted);
  opacity: .5;
}
.site-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 20px 48px;
  border-top: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.7;
}
.site-footer p { margin: 0; }

/* ── 响应式：平板及以上 ── */
@media (min-width: 640px) {
  .header-inner { padding: 16px 24px; }
  .container { padding: 24px 24px 40px; }
  .board-head h1 { font-size: 1.8rem; }
  .board-head { margin-bottom: 32px; padding-bottom: 24px; }
  .archive h1 { font-size: 1.6rem; }
  .repo-card { padding: 20px 24px; }
  .repo-name { font-size: 1.1rem; }
  .repo-list { gap: 12px; }
  .repo-desc-zh { font-size: .94rem; }
  body { font-size: 16px; }
  .tab-label-full { display: inline; }
  .tab-label-short { display: none; }
  .period-full { display: inline; }
  .period-short { display: none; }
  .pager-date-full { display: inline; }
  .pager-date-short { display: none; }
}

/* 移动端适配 */
@media (max-width: 640px) {
  .back-to-top {
    right: 16px;
    bottom: 16px;
    width: 40px;
    height: 40px;
  }
  .feedback-fab {
    right: 16px;
    bottom: 72px;
    width: 40px;
    height: 40px;
  }
  .timezone,
  .nav-about { display: none; }
  .meta-extra { display: none; }
  /* 头部搜索框移出 sticky 头部：改由正文顶部的 .mobile-search 承担搜索入口，
     避免 sticky 头被搜索行撑高、常驻占屏；头部回归紧凑单行。 */
  .header-search { display: none; }
  .mobile-search { display: flex; }
  /* 工具行改为上下两行：meta 描述仍横滚，排序下拉独占一行全宽（触控友好） */
  .board-toolbar,
  .panel-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .sort-control { width: 100%; }
  .sort-select { flex: 1; min-width: 0; }
}

/* ── 响应式：窄屏 ── */
@media (max-width: 400px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 16px;
    gap: 10px;
  }
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
  .container { padding: 14px 14px 28px; }
  .repo-card { padding: 14px 16px; }
  .repo-explain { padding: 12px 14px; }
  .board-head h1 { font-size: 1.35rem; }
  .repo-stats .period-star { margin-left: 0; }
}

/* ── 减弱动效 ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0s !important;
    animation-duration: 0s !important;
    scroll-behavior: auto !important;
  }
}