*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --star: #f0c14b;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

.container {
  width: min(960px, 100% - 2rem);
  margin-inline: auto;
}

.header {
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0;
}

.status {
  color: var(--muted);
  font-size: 0.875rem;
}

.btn {
  padding: 0.4rem 0.85rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.btn:hover:not(:disabled) {
  border-color: var(--muted);
  background: #21262d;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.error {
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  background: #3d1f1f;
  border: 1px solid #8b2929;
  border-radius: var(--radius);
  color: #ffa198;
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}

.repo-list {
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.repo-card {
  display: block;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.1s;
}

.repo-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.repo-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.repo-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
}

.repo-desc {
  margin: 0.35rem 0 0.65rem;
  font-size: 0.9rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.repo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.repo-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.star-count {
  color: var(--star);
  font-weight: 500;
}

.topic {
  padding: 0.1rem 0.45rem;
  background: #21262d;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.72rem;
}

.footer {
  margin-top: auto;
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.footer p + p {
  margin-top: 0.5rem;
}

.footer-copy {
  font-size: 0.75rem;
  opacity: 0.85;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 1.45rem;
  }

  .repo-card {
    padding: 0.85rem 1rem;
  }
}

.sentinel {
  height: 1px;
}

.load-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.5rem 0 2rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.end-tip {
  margin: 0 0 2rem;
  padding: 1rem 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
}

.back-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.back-to-top:hover {
  border-color: var(--accent);
  background: #21262d;
  transform: translateY(-2px);
}

.back-to-top:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .back-to-top {
    right: 1rem;
    bottom: 1rem;
    width: 2.5rem;
    height: 2.5rem;
  }
}
