:root {
  --yellow: #ffb800;
  --yellow-dark: #e5a600;
  --ink: #1a1a1a;
  --ink-soft: #444;
  --paper: #fff9e8;
  --white: #ffffff;
  --border: rgba(26, 26, 26, 0.12);
  --shadow: 0 8px 24px rgba(26, 26, 26, 0.08);
  --radius: 16px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #ffe082 0%, transparent 40%),
    linear-gradient(180deg, var(--paper) 0%, #fff 40%, #f6f6f6 100%);
}

a {
  color: var(--ink);
}

.header {
  background: var(--yellow);
  border-bottom: 3px solid var(--ink);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.crank {
  width: 52px;
  height: 52px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--white) 18%, transparent 19%),
    conic-gradient(from 0deg, var(--ink) 0 24deg, transparent 24deg 360deg);
  flex-shrink: 0;
}

h1 {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
  max-width: 42rem;
  line-height: 1.45;
}

.subtitle a {
  color: inherit;
}

.header-actions button,
.toolbar input {
  font: inherit;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.filter-group {
  display: inline-flex;
  border: 2px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.45);
}

.filter-btn,
.header-actions > button {
  border: 2px solid var(--ink);
  background: var(--white);
  color: var(--ink);
  padding: 0.65rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.15s ease, background 0.15s ease;
}

.filter-btn {
  border: none;
  border-radius: 0;
  background: transparent;
}

.filter-btn + .filter-btn {
  border-left: 2px solid var(--ink);
}

.filter-btn.is-active {
  background: var(--ink);
  color: var(--white);
}

.filter-btn:hover:not(.is-active),
.header-actions > button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #fff;
}

.filter-btn.is-active:hover {
  transform: none;
  background: var(--ink);
}

.header-actions > button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.stat-wide {
  grid-column: 1 / -1;
}

.stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
}

.stat-label {
  display: block;
  margin-top: 0.25rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.stat-meta {
  display: block;
  margin-top: 0.25rem;
  font-weight: 600;
}

.toolbar {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.search-wrap {
  flex: 1 1 280px;
}

.toolbar input {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--white);
}

.toolbar input:focus {
  outline: none;
  border-color: var(--yellow-dark);
  box-shadow: 0 0 0 3px rgba(255, 184, 0, 0.25);
}

.result-count {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.status,
.error {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.error {
  border-color: #f3b4b4;
  background: #fff5f5;
  color: #8a1f1f;
  margin-bottom: 1rem;
}

.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 1rem;
  border: 3px solid rgba(26, 26, 26, 0.12);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.progress-bar {
  width: min(420px, 100%);
  height: 8px;
  margin: 1rem auto 0;
  background: rgba(26, 26, 26, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--yellow);
  transition: width 0.25s ease;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(26, 26, 26, 0.12);
}

.card-image {
  aspect-ratio: 5 / 3;
  background-color: #ddd;
  background-size: cover;
  background-position: center;
}

.card-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.card-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.25;
}

.card-developer {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.card-disclosure {
  margin: 0.35rem 0 0;
  color: #8a1f1f;
  font-size: 0.82rem;
  line-height: 1.45;
}

.card-meta {
  margin-top: auto;
  padding-top: 0.5rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #e8f8ea;
  color: #1f6b2d;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-ai {
  background: #fde8e8;
  color: #8a1f1f;
}

.badge-unsure {
  background: #fff3d6;
  color: #7a5b00;
}

.footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.5;
}

.footer-credit {
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
  opacity: 0.75;
}

.footer-credit a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  h1 {
    font-size: 1.35rem;
  }

  .crank {
    width: 42px;
    height: 42px;
  }
}
