:root {
  --bg: #f6f4ee;
  --bg-soft: #efece4;
  --card: #fffdf8;
  --ink: #23211c;
  --ink-soft: #4d4a42;
  --muted: #7b766b;
  --line: #e2ddd2;
  --accent: #0f766e;
  --accent-soft: #d9f0eb;
  --danger: #b42318;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(35, 33, 28, 0.04), 0 8px 24px rgba(35, 33, 28, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15140f;
    --bg-soft: #1c1a14;
    --card: #1d1b15;
    --ink: #ece7db;
    --ink-soft: #c9c3b5;
    --muted: #938d7f;
    --line: #322f27;
    --accent: #5eead4;
    --accent-soft: #10312d;
    --danger: #ff8a80;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 500px at 15% -10%, var(--bg-soft), transparent 70%),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.wrap {
  width: min(920px, calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
}

.brand {
  color: var(--ink);
  font-family: "Iowan Old Style", "Songti SC", "Noto Serif SC", Georgia, serif;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.brand:hover { text-decoration: none; color: var(--accent); }

.nav { display: flex; gap: 6px; }

.nav a {
  color: var(--ink-soft);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
}
.nav a:hover { background: var(--bg-soft); text-decoration: none; }
.nav a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

.main { padding: 48px 0 72px; }

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 10px;
  font-family: "Iowan Old Style", "Songti SC", "Noto Serif SC", Georgia, serif;
  font-size: clamp(30px, 4.5vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.lede {
  margin: 0;
  max-width: 560px;
  color: var(--muted);
  font-size: 15px;
}

.stats { display: flex; gap: 28px; flex-shrink: 0; }

.stat { display: flex; flex-direction: column; gap: 2px; }

.stat-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }

.stat-label { color: var(--muted); font-size: 12px; letter-spacing: 0.04em; }

.feed { display: flex; flex-direction: column; gap: 18px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px 24px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }

.meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 12.5px;
}

.pill {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 600;
}

.category { color: var(--muted); }
.time { color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.score { color: var(--accent); font-variant-numeric: tabular-nums; }

.card-title {
  margin: 0 0 10px;
  font-size: 20px;
  line-height: 1.4;
  font-weight: 650;
}
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--accent); text-decoration: none; }

.summary {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14.5px;
  white-space: pre-wrap;
  word-break: break-word;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 36px;
  font-size: 14px;
}

.page-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 18px;
  color: var(--ink-soft);
  background: var(--card);
}
.page-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.page-link.disabled { color: var(--muted); opacity: 0.55; pointer-events: none; }
.page-info { color: var(--muted); }

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 52px 24px;
  text-align: center;
  background: color-mix(in srgb, var(--card) 60%, transparent);
}
.empty-title { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.empty .muted { margin: 0; font-size: 14px; }

.search-head { margin-bottom: 28px; }
.search-head h1 { margin: 0 0 18px; font-size: 28px; letter-spacing: -0.01em; }

.search-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.search-form input[type="search"] {
  flex: 1 1 280px;
  min-width: 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font-size: 15px;
  outline: none;
}
.search-form input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}
.checkbox input { accent-color: var(--accent); width: 15px; height: 15px; }

.search-form button {
  border: 0;
  border-radius: 10px;
  padding: 12px 22px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
@media (prefers-color-scheme: dark) {
  .search-form button { color: #06231f; }
}
.search-form button:hover { filter: brightness(1.06); }

.result-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  font-size: 14px;
  color: var(--ink-soft);
}

.notice {
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 14px;
}
.notice.error {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--danger);
}

.status-head { margin-bottom: 28px; }
.status-head h1 { margin: 0 0 6px; font-size: 28px; }
.status-head .muted { margin: 0; font-size: 14px; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.metric {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.metric-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.metric-label { color: var(--muted); font-size: 13px; letter-spacing: 0.04em; }
.metric-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }

.bar {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  overflow: hidden;
}
.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #7cc7ff));
  transition: width 0.6s ease;
}
.queue-bar span { background: linear-gradient(90deg, #d97706, #fbbf24); }

.metric-foot { margin: 10px 0 0; color: var(--muted); font-size: 12.5px; }

.status-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 14px; font-size: 16px; letter-spacing: 0.01em; }

.kv { margin: 0; display: grid; grid-template-columns: 88px 1fr; gap: 9px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink-soft); word-break: break-word; }

.failure-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.failure-list li { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.failure-title { font-weight: 600; }
.failure-error { color: var(--danger); font-size: 12.5px; word-break: break-word; }

.footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 40px;
  color: var(--muted);
  font-size: 13px;
}
.footer p { margin: 0 0 4px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }

@media (max-width: 720px) {
  .main { padding: 30px 0 56px; }
  .hero { flex-direction: column; align-items: flex-start; gap: 22px; }
  .stats { gap: 22px; }
  .metric-grid, .status-columns { grid-template-columns: 1fr; }
  .card { padding: 18px 18px 20px; }
  .card-title { font-size: 18px; }
  .time { margin-left: 0; width: 100%; }
  .header-inner { min-height: 58px; }
  .nav a { padding: 6px 9px; font-size: 13px; }
}

/* ---------- Trending leaderboard ---------- */

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.tab {
  padding: 8px 20px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
}
.tab:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}
.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
@media (prefers-color-scheme: dark) {
  .tab.active { color: #06231f; }
}

.snapshot { margin: -4px 0 22px; }

.repo-card {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.rank {
  flex: 0 0 44px;
  font-size: 25px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

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

.desc {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14.5px;
  word-break: break-word;
}

.intro {
  margin-top: 14px;
  padding: 13px 16px;
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: color-mix(in srgb, var(--accent-soft) 45%, transparent);
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.gain {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  .repo-card { gap: 10px; }
  .rank { flex-basis: 32px; font-size: 20px; }
  .tab { padding: 7px 16px; }
}
