:root {
  --bg: #fafafa;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #6b7280;
  --border: #e5e7eb;
  --brand: #2563eb;
  --brand-soft: #eff6ff;
  --accent: #f59e0b;
  --up: #16a34a;
  --down: #dc2626;
  --code-bg: #f1f5f9;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  background: var(--code-bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.92em;
}
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.up { color: var(--up); font-weight: 600; }
.down { color: var(--down); font-weight: 600; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .container {
  display: flex; align-items: center; gap: 18px;
  height: 56px;
}
.brand { font-weight: 700; font-size: 1.05rem; color: var(--text); }
.nav { display: flex; gap: 16px; flex: 1; }
.nav a {
  color: var(--muted); font-size: 0.95rem; padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.nav a.active, .nav a:hover { color: var(--text); text-decoration: none; border-color: var(--brand); }
.search-inline { display: flex; gap: 6px; }
.search-inline input {
  padding: 6px 10px; border: 1px solid var(--border);
  border-radius: 6px; width: 180px; font-size: 0.9rem;
}
.search-inline button {
  padding: 6px 12px; border: 0; border-radius: 6px;
  background: var(--brand); color: white; cursor: pointer;
}

main.container { padding-top: 24px; padding-bottom: 48px; }

.hero { margin-bottom: 24px; }
.hero h1 { font-size: 1.6rem; margin: 0 0 6px; }
.hero p { margin: 4px 0; }

.empty {
  background: var(--card); border: 1px dashed var(--border);
  padding: 36px; text-align: center; border-radius: 10px;
}

.day-block { margin-bottom: 36px; }
.day-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.day-header h2 { margin: 0; font-size: 1.2rem; }
.day-header h2 a { color: var(--text); }

.card-list { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  padding: 14px 16px;
  gap: 16px;
  transition: box-shadow 0.15s, transform 0.15s;
}
.card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.rank {
  font-size: 1.4rem; font-weight: 700; color: var(--muted);
  min-width: 36px; text-align: right; line-height: 1;
  padding-top: 2px;
}
.card-body { flex: 1; min-width: 0; }
.repo-title {
  margin: 0 0 6px; font-size: 1.02rem;
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
}
.repo-title a { color: var(--text); font-weight: 600; }
.history-link { font-weight: normal; }
.lang {
  font-size: 0.78rem; padding: 1px 8px;
  background: var(--brand-soft); color: var(--brand);
  border-radius: 10px;
}
.stars-today {
  font-size: 0.82rem; color: var(--accent); font-weight: 600;
}
.summary { margin: 4px 0 6px; font-weight: 500; }
.desc { margin: 4px 0 6px; color: #374151; }
.tags { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 0.78rem; padding: 2px 8px;
  background: #f3f4f6; color: #4b5563;
  border-radius: 10px; border: 1px solid var(--border);
}
.tag:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }

.day-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px;
}
.day-nav h1 { margin: 0; font-size: 1.4rem; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.agg-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.agg-table th, .agg-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.agg-table th { background: #f9fafb; font-weight: 600; color: var(--muted); }
.agg-table tr:last-child td { border-bottom: 0; }
.summary-cell { font-size: 0.88rem; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px;
  display: flex; flex-direction: column; gap: 4px;
  min-width: 160px;
}
.tag-card:hover { border-color: var(--brand); text-decoration: none; }
.tag-name { font-weight: 600; }
.tag-count {
  font-size: 1.3rem; font-weight: 700; color: var(--brand);
}
.tag-sample { font-size: 0.78rem; }

.search-form {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin: 8px 0;
}
.search-form input, .search-form select {
  padding: 6px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 0.95rem;
}
.search-form input[type="search"] { min-width: 220px; }
.search-form button {
  padding: 6px 16px; border: 0; border-radius: 6px;
  background: var(--brand); color: white; cursor: pointer;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  display: flex; justify-content: space-between;
  font-size: 0.85rem; color: var(--muted);
  margin-top: 24px;
}

@media (max-width: 640px) {
  .topbar .container { flex-wrap: wrap; height: auto; padding: 10px 16px; }
  .nav { order: 3; width: 100%; }
  .search-inline input { width: 120px; }
  .card { flex-direction: column; gap: 6px; }
  .rank { text-align: left; }
}

.readme-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 24px;
}
.readme-block h2 { margin: 0 0 10px; font-size: 1.05rem; }
.readme {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.55;
  color: #374151;
  max-height: 480px;
  overflow-y: auto;
  margin: 0;
}