:root {
  color-scheme: dark;
  --bg: #0d1117;
  --surface: #161b22;
  --surface-muted: #21262d;
  --border: #30363d;
  --text: #f0f6fc;
  --muted: #8c959f;
  --blue: #2f81f7;
  --green: #3fb950;
  --red: #f85149;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
}

button,
input {
  font: inherit;
}

a {
  color: var(--blue);
}

.container {
  width: min(calc(100% - 32px), 1012px);
  margin: 0 auto;
  padding: 64px 0;
}

.page-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 32px;
}

.repo-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 14px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.description {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.source-link {
  display: inline-flex;
  min-height: 32px;
  padding: 5px 12px;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.source-link:hover,
.source-link:focus-visible {
  background: #292e36;
  border-color: #8b949e;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 32px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.summary-item {
  display: flex;
  min-height: 94px;
  padding: 20px 24px;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--border);
}

.summary-item:first-child {
  padding-left: 0;
}

.summary-item:last-child {
  border-right: 0;
}

.summary-value {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.summary-value.success {
  color: var(--green);
}

.summary-label {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.leaderboard {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.leaderboard-heading {
  display: flex;
  min-height: 76px;
  padding: 16px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--border);
}

.leaderboard-heading h2 {
  margin-bottom: 3px;
  font-size: 16px;
  font-weight: 600;
}

.leaderboard-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.search-field {
  position: relative;
  width: min(100%, 280px);
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 13px;
  height: 13px;
  border: 1.5px solid var(--muted);
  border-radius: 50%;
  transform: translateY(-58%);
  pointer-events: none;
}

.search-icon::after {
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 6px;
  height: 1.5px;
  content: "";
  background: var(--muted);
  transform: rotate(45deg);
  transform-origin: left center;
}

.search-field input {
  width: 100%;
  height: 34px;
  padding: 5px 12px 5px 34px;
  color: var(--text);
  outline: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.search-field input::placeholder {
  color: var(--muted);
}

.search-field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 129, 247, 0.25);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0 16px;
  text-align: left;
}

th {
  height: 40px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  background: rgba(13, 17, 23, 0.35);
  border-bottom: 1px solid var(--border);
}

td {
  height: 72px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: rgba(177, 186, 196, 0.04);
}

.rank-column {
  width: 56px;
  text-align: center;
}

.number-column {
  width: 88px;
  text-align: right;
}

.rank {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.rank-highlighted {
  color: var(--green);
  font-weight: 600;
}

.project-cell {
  display: flex;
  min-width: 240px;
  align-items: center;
  gap: 12px;
}

.project-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  object-fit: cover;
  background: var(--surface-muted);
  border-radius: 6px;
}

.project-name {
  display: block;
  max-width: 320px;
  overflow: hidden;
  color: #58a6ff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-name:hover,
.project-name:focus-visible {
  text-decoration: underline;
}

.project-meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.progress-cell {
  min-width: 160px;
}

.progress-label {
  display: flex;
  margin-bottom: 7px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 6px;
  overflow: hidden;
  background: var(--surface-muted);
  border-radius: 999px;
}

.progress-value {
  height: 100%;
  background: var(--green);
  border-radius: inherit;
}

.metric-number {
  text-align: right;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.metric-number-open {
  color: var(--muted);
}

.table-state {
  display: flex;
  min-height: 150px;
  padding: 24px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.table-state[hidden] {
  display: none;
}

.table-state-error {
  flex-direction: column;
  color: var(--red);
}

.table-state-error span {
  color: var(--muted);
}

.loader {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.leaderboard-footer {
  min-height: 48px;
  padding: 15px 16px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  white-space: nowrap;
  border: 0;
  clip: rect(0, 0, 0, 0);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 680px) {
  .container {
    width: min(calc(100% - 24px), 1012px);
    padding: 36px 0;
  }

  .page-intro {
    margin-bottom: 24px;
    flex-direction: column;
    gap: 18px;
  }

  h1 {
    font-size: 28px;
  }

  .summary {
    grid-template-columns: repeat(2, 1fr);
    margin-bottom: 24px;
  }

  .summary-item {
    min-height: 76px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
  }

  .summary-item:first-child {
    padding-left: 16px;
  }

  .summary-item:nth-child(2) {
    border-right: 0;
  }

  .summary-item:nth-child(n + 3) {
    border-bottom: 0;
  }

  .leaderboard-heading {
    padding: 16px;
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .search-field {
    width: 100%;
  }

  .progress-cell,
  th:nth-child(3),
  td:nth-child(5),
  th:nth-child(5) {
    display: none;
  }

  th,
  td {
    padding-right: 10px;
    padding-left: 10px;
  }

  .project-cell {
    min-width: 205px;
  }

  .project-name {
    max-width: 190px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
