html { scrollbar-gutter: stable; }
/* GitPlain · 共享样式（所有页面引用，不再内联） */
/* 规范出处：DESIGN.md —— 颜色/字号/圆角/间距全部按 token，不写新值 */

:root {
  --primary: #0066cc;
  --primary-hover: #0071e3;
  --ink: #1d1d1f;
  --ink-muted: #6e6e73;
  --ink-faint: #86868b;
  --canvas: #ffffff;
  --canvas-alt: #f5f5f7;
  --card: #ffffff;
  --hairline: #e8e8ed;
  --star: #f5a623;
  --r-card: 14px;
  --r-btn: 8px;
  --r-pill: 9999px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--canvas);
  color: var(--ink);
  line-height: 1.5;
}
body.lock { overflow: hidden; }
a { color: var(--primary); text-decoration: none; }

/* ---------- 顶部 ---------- */
.topbar {
  padding: 16px 20px 0;
  background: transparent;
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 20px;
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
}
.brand-wrap { display: flex; align-items: center; gap: 9px; flex: 1; text-decoration: none; min-width: 0; }
.brand-mark svg { width: 15px; height: 15px; display: block; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-name {
  font-size: 17px; font-weight: 600; color: var(--ink); letter-spacing: -0.2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.nav-link {
  display: inline-flex; align-items: center;
  height: 36px; padding: 0 12px; border-radius: 9px;
  font-size: 14px; color: var(--ink-muted); text-decoration: none; white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}
.nav-link:hover { color: var(--ink); background: rgba(0, 0, 0, 0.04); }
/* 当前页面：半透明胶囊，和登录按钮同高同圆角 */
.nav-link.is-active {
  color: var(--ink); font-weight: 600;
  background: rgba(0, 0, 0, 0.06);
}
.nav-right { flex: 1; display: flex; justify-content: flex-end; }
.login-btn {
  display: inline-flex; align-items: center; height: 36px; padding: 0 18px;
  border-radius: 9px; background: var(--primary); color: #fff;
  font-size: 14px; font-weight: 500; text-decoration: none;
  transition: background 0.15s;
}
.login-btn:hover { background: #0055ad; }

.hero-meta { max-width: 1100px; margin: 20px auto 0; padding: 0 20px; text-align: center; }
.subtitle { color: var(--ink-muted); font-size: 15px; font-weight: 400; }
.updated { color: var(--ink-faint); font-size: 13px; font-weight: 400; margin-top: 6px; }

.search-wrap { margin: 0 auto; max-width: 520px; padding: 0 20px; }
.search-input {
  width: 100%;
  border: 1px solid var(--hairline);
  border-radius: var(--r-btn);
  box-sizing: border-box;
  height: 48px;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 400;
  font-family: inherit;
  color: var(--ink);
  background: var(--canvas);
  outline: none;
  transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--primary); }
.search-input::placeholder { color: var(--ink-faint); }

/* ---------- 列表（两列网格） ---------- */
.list {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 20px 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 320px;
  background: var(--card);
  border-radius: var(--r-card);
  border: 1px solid var(--hairline);
  padding: 20px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06); }

.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-cat {
  font-size: 13px; font-weight: 400; color: var(--ink-muted);
  background: var(--canvas-alt); border-radius: var(--r-pill); padding: 3px 10px;
}
.card-week {
  font-size: 15px; font-weight: 600; color: var(--star);
  font-variant-numeric: tabular-nums; white-space: nowrap;
  margin-left: auto;
}
.card-rank {
  font-size: 12px; font-weight: 600; color: var(--ink-faint);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

.card-repo-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; min-width: 0; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  object-fit: cover; background: var(--canvas-alt);
}
.card-repo {
  flex: 0 1 auto; min-width: 0;
  font-size: 17px; font-weight: 600; line-height: 1.35; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-owner { flex: 0 0 auto; font-size: 13px; font-weight: 400; color: var(--ink-faint); white-space: nowrap; }

.card-desc {
  font-size: 15px; font-weight: 400; line-height: 1.55; color: var(--ink-muted);
  margin-top: 12px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; min-height: calc(1.55em * 3);
  overflow-wrap: anywhere;
}
.card-who {
  font-size: 13px; font-weight: 400; line-height: 1.5; color: var(--ink-faint); margin-top: 8px;
  overflow-wrap: anywhere;
}

.card-foot { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 14px; }
.card-stars {
  font-size: 15px; font-weight: 600; color: var(--ink-muted);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.card-stars .star-ico { color: var(--star); font-size: 20px; line-height: 1; }
.spacer { flex: 1; }

.goto-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--primary); color: #fff; border: none;
  border-radius: var(--r-btn); padding: 9px 17px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.goto-btn:hover { background: var(--primary-hover); }

.empty { text-align: center; color: var(--ink-faint); padding: 60px 0; font-size: 16px; font-weight: 400; }
#emptyState { max-width: 720px; margin: 0 auto; padding: 64px 20px; }
.empty-title { font-size: 21px; font-weight: 600; line-height: 1.3; color: var(--ink); }
.empty-sub { font-size: 15px; font-weight: 400; line-height: 1.6; color: var(--ink-muted); margin-top: 10px; }
.empty-btn { display: inline-flex; margin-top: 20px; }

.loading-hint { text-align: center; color: var(--ink-faint); font-size: 13px; padding: 20px 0 40px; }

/* ---------- 搜索结果 ---------- */
.results-head {
  max-width: 1100px; margin: 0 auto; padding: 4px 20px 0;
  color: var(--ink-muted); font-size: 14px; font-weight: 400;
}
.results-head b { color: var(--ink); font-weight: 600; }
#searchResults .results-head { grid-column: 1 / -1; }
#searchResults .empty { grid-column: 1 / -1; }

/* ---------- 浮层 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: var(--canvas); overflow-y: auto;
  visibility: hidden;
  clip-path: circle(0% at var(--cx, 50%) var(--cy, 50%));
  transition: clip-path 0.45s ease, visibility 0s linear 0.45s;
}
.overlay.open {
  visibility: visible;
  clip-path: circle(150% at var(--cx, 50%) var(--cy, 50%));
  transition: clip-path 0.45s ease, visibility 0s;
}
.modal { max-width: 720px; margin: 0 auto; padding: 24px 24px 60px; }
.modal-top { display: flex; justify-content: flex-start; }
.close-btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--hairline); background: var(--canvas);
  border-radius: var(--r-btn); padding: 8px 14px;
  font-size: 14px; font-weight: 400; color: var(--ink-muted);
  cursor: pointer; font-family: inherit;
}
.close-btn:hover { background: var(--canvas-alt); }

/* ---------- 详情内容（浮层与独立详情页共用同一套） ---------- */
.detail-head { display: flex; align-items: center; gap: 14px; margin-top: 20px; }
.avatar-lg {
  width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0;
  object-fit: cover; background: var(--canvas-alt);
}
.detail-titles { min-width: 0; }
.detail-repo {
  font-size: 26px; font-weight: 600; line-height: 1.2; color: var(--ink);
  overflow-wrap: anywhere;
}
.detail-cat {
  display: inline-block; font-size: 13px; font-weight: 400; color: var(--ink-muted);
  background: var(--canvas-alt); border-radius: var(--r-pill); padding: 3px 10px; margin-top: 8px;
}
.detail-desc { font-size: 17px; font-weight: 400; line-height: 1.6; margin-top: 20px; color: var(--ink); }
.detail-who { font-size: 15px; font-weight: 400; color: var(--ink-muted); margin-top: 18px; }
.detail-who b { color: var(--ink); font-weight: 600; }
.detail-owner { font-size: 15px; font-weight: 400; color: var(--ink-muted); margin-top: 16px; }
.detail-sub { font-size: 16px; font-weight: 600; margin-top: 24px; color: var(--ink); }
.detail-steps { margin-top: 10px; padding-left: 22px; }
.detail-steps li { margin: 8px 0; font-size: 16px; font-weight: 400; }
.detail-stats {
  display: flex; gap: 0; margin-top: 24px; padding: 16px;
  justify-content: space-between;
  background: var(--canvas-alt); border-radius: var(--r-card);
}
.stat { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
.stat-num { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); overflow-wrap: anywhere; }
.stat-num.stat-gold { color: var(--star); }
.stat-lab { font-size: 13px; font-weight: 400; color: var(--ink-faint); }


/* ---------- 独立详情页 ---------- */
/* 详情页顶部：和首页同一套胶囊，左「返回榜单」右「首页/收藏/登录」 */
.detail-bar-left { flex: 1; display: flex; align-items: center; }
.detail-bar-right { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.back-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 14px; font-weight: 400; color: var(--ink-muted);
}
.back-link:hover { color: var(--primary); }
.detail-page { max-width: 720px; margin: 0 auto; padding: 24px 24px 60px; min-height: 100vh; box-sizing: border-box; }
.detail-page .detail-head { margin-top: 0; }

/* ---------- 顶部导航（所有页面都有） ---------- */
[hidden] { display: none !important; }
.detail-top-inner { max-width: 720px; margin: 0 auto; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- 分类筛选（单选胶囊） ---------- */
/* 留白区（将来放背景） */
.hero-band { height: 240px; }

/* 分类胶囊条：和顶部导航同一个视觉语言 */
.filters-wrap {
  max-width: 1060px;
  margin: 20px auto 0;
  padding: 16px 16px 12px;
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
}
.filters {
  display: flex; align-items: center; gap: 8px;
  overflow-x: auto; overflow-y: hidden;
  padding-bottom: 12px;         /* 按钮下沿到滚动条有间距，不挤压 */
  scroll-behavior: smooth;
  scrollbar-width: thin; scrollbar-color: #e2e2e6 transparent;
}
.filters::-webkit-scrollbar { height: 6px; }
.filters::-webkit-scrollbar-track { background: transparent; }
.filters::-webkit-scrollbar-thumb { background: #e2e2e6; border-radius: 3px; }
.filters::-webkit-scrollbar-thumb:hover { background: #c8c8cc; }
.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  flex: 0 0 auto; min-width: 84px; height: 32px; box-sizing: border-box;
  border: 1px solid var(--hairline); background: var(--canvas);
  border-radius: var(--r-pill); padding: 6px 12px;
  font-size: 13px; font-weight: 400; color: var(--ink-muted);
  font-family: inherit; cursor: pointer; white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.chip:hover { border-color: var(--ink-faint); color: var(--ink); }
.chip.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip-n { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-faint); }
.chip.is-active .chip-n { color: #fff; }

/* ---------- 收藏按钮 ---------- */
.fav-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--hairline); background: var(--canvas);
  border-radius: var(--r-btn); padding: 8px 12px;
  font-size: 13px; font-weight: 400; color: var(--ink-muted);
  font-family: inherit; cursor: pointer; white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.fav-btn svg { display: block; transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); }
.fav-btn:hover { border-color: var(--ink-faint); color: var(--ink); }
.fav-btn[aria-pressed="true"] { color: var(--star); border-color: #f5d9a8; }
.fav-btn[aria-pressed="true"] svg { transform: scale(1.15); }
.fav-btn:active svg { transform: scale(0.85); }
.detail-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.detail-actions .detail-fav,
.detail-actions .detail-goto {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 46px; padding: 0 22px; margin-top: 0;
  font-size: 15px; font-weight: 500; border-radius: 10px;
}
.detail-actions .detail-fav { border: 1px solid var(--hairline); background: #fff; color: var(--ink-muted); }
.detail-actions .detail-fav[aria-pressed="true"] { color: var(--star); border-color: #f5d9a8; background: #fffdf7; }

/* 收藏粒子 */
.particle {
  position: fixed;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--star);
  pointer-events: none;
  z-index: 999;
  animation: particle-burst 0.5s ease-out forwards;
}
@keyframes particle-burst {
  0%   { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.3); opacity: 0; }
}

/* 星星弹跳 */
@keyframes star-pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.35); }
  100% { transform: scale(1.15); }
}
.fav-btn[aria-pressed="true"] svg { animation: star-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* ---------- 分页条 ---------- */
.pager { max-width: 1100px; margin: 0 auto; padding: 24px 20px 20px; }
.page-foot { max-width: 1100px; margin: 0 auto; padding: 0 20px 33vh; text-align: center; }
.page-foot .updated { color: var(--ink-faint); font-size: 13px; }
.pager-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.pager-btn, .pager-num {
  border: 1px solid var(--hairline); background: var(--canvas); border-radius: var(--r-btn);
  padding: 7px 12px; font-size: 13px; font-weight: 400; font-family: inherit;
  color: var(--ink-muted); cursor: pointer; font-variant-numeric: tabular-nums;
}
.pager-btn:hover:not(:disabled), .pager-num:hover { border-color: var(--ink-faint); color: var(--ink); }
.pager-btn:disabled { opacity: 0.4; cursor: default; }
.pager-num.is-current { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pager-gap { color: var(--ink-faint); font-size: 13px; }
.pager-jump { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-faint); }
.pager-input {
  width: 64px; border: 1px solid var(--hairline); border-radius: var(--r-btn);
  padding: 6px 8px; font-size: 13px; font-family: inherit; color: var(--ink); text-align: center;
}
.pager-input:focus { outline: none; border-color: var(--primary); }
.pager-info { font-size: 13px; font-weight: 400; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

/* ---------- 关于页 / 404 页 ---------- */
.page-center { text-align: center; min-height: 96vh; box-sizing: border-box; }
.page-center .page-lead { margin-left: auto; margin-right: auto; }
.page { max-width: 720px; margin: 0 auto; padding: 32px 20px 80px; }
.page-title { font-size: 34px; font-weight: 600; line-height: 1.2; letter-spacing: -0.4px; color: var(--ink); }
.page-lead { font-size: 17px; font-weight: 400; line-height: 1.6; color: var(--ink); margin-top: 14px; }
.page-sub { font-size: 21px; font-weight: 600; line-height: 1.3; color: var(--ink); margin-top: 40px; }
.page p { font-size: 15px; font-weight: 400; line-height: 1.7; color: var(--ink-muted); margin-top: 10px; }
.page ul { margin: 12px 0 0 20px; }
.page li { font-size: 15px; font-weight: 400; line-height: 1.7; color: var(--ink-muted); margin: 6px 0; }
.page code { font-size: 14px; color: var(--ink); background: var(--canvas-alt); border-radius: var(--r-btn); padding: 1px 6px; }
.page-link-btn { display: inline-flex; margin-top: 20px; }
.notfound-code { font-size: 64px; font-weight: 600; line-height: 1; letter-spacing: -1px; color: var(--ink); }

/* ---------- 榜单页（周榜 / 月榜） ---------- */
.board-title {
  font-size: 28px; font-weight: 600; letter-spacing: -0.4px; color: var(--ink);
}
.board-sub { margin-top: 6px; color: var(--ink-muted); font-size: 15px; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .nav { gap: 2px; }
  .nav-link { padding: 0 8px; font-size: 13px; }
  .nav-link { font-size: 13px; }
  .brand-name { font-size: 15px; }
}
@media (max-width: 640px) {
  .topbar { padding: 16px 16px 0; }
  .hero-band { height: 56px; }
  .filters-wrap { padding: 6px 12px 6px; border-radius: 12px; }
  .search-input { height: 44px; padding: 0 14px; }
  .chip { height: 30px; min-width: 76px; }
  .filters { padding-bottom: 10px; }
  .filters { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 6px, #000 calc(100% - 10px), transparent 100%); mask-image: linear-gradient(to right, transparent 0, #000 6px, #000 calc(100% - 10px), transparent 100%); }
  .topbar-inner { flex-wrap: wrap; row-gap: 10px; }
  .brand { font-size: 28px; }
  .list { padding-left: 16px; padding-right: 16px; grid-template-columns: minmax(0, 1fr); }
  .results-head { padding-left: 16px; padding-right: 16px; }
  .search-wrap { padding: 0 16px; }
  .detail-stats { gap: 16px; flex-wrap: wrap; }
  .filters {
    padding: 14px 16px 0;
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .filters::-webkit-scrollbar { display: none; }
  .pager { padding: 20px 16px 4px; }
  .page { padding: 24px 16px 60px; }
  .page-title { font-size: 28px; }
  .nav { gap: 14px; flex-basis: 100%; order: 3; flex-wrap: wrap; row-gap: 8px; }
  .nav-link { font-size: 13px; }
  .brand-name { display: none; }
}

/* 收藏模式没有分类，整个胶囊一起隐藏（不然留个空壳） */
.filters-wrap:has(#filters[hidden]) { display: none; }

/* ---- 榜单页（周榜 / 月榜） ---- */
.board-head { max-width: 1100px; padding: 28px 20px 8px; min-height: 0; }
#weeklyList, #monthlyList { padding-top: 8px; grid-template-columns: 1fr; }
#weeklyList .card-top, #monthlyList .card-top { justify-content: flex-start; }
.card-rank {
  font-size: 13px; font-weight: 700; color: var(--ink-faint);
  font-variant-numeric: tabular-nums; min-width: 34px;
}
.card-week.is-hot { font-weight: 700; }
@media (max-width: 640px) {
  .board-head { padding: 20px 16px 4px; }
  .card-rank { min-width: 28px; font-size: 12px; }
}
