@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrainsMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Backgrounds */
  --bg-base: #12121f;
  --bg-surface: #1a1a2e;
  --bg-elevated: #1e2340;
  --bg-hover: #222750;

  /* Borders */
  --border-subtle: #2a2a4a;
  --border-default: #33335a;
  --border-focus: #5a7abf;

  /* Text */
  --text-primary: #e8e8f0;
  --text-secondary: #a8a8c0;
  --text-muted: #6a6a88;
  --text-link: #7ba4e0;

  /* Status colors */
  --status-working: #5ec478;
  --status-working-bg: #162e1e;
  --status-broken: #e06060;
  --status-broken-bg: #2e1616;
  --status-needs-key: #d4c44a;
  --status-needs-key-bg: #2a2a14;
  --status-paid-only: #e0a040;
  --status-paid-only-bg: #2e2414;
  --status-pending: #4a4a6a;
  --status-pending-text: #8a8aaa;
  --status-skipped: #3a3a50;
  --status-skipped-text: #606078;

  /* Accent */
  --accent-green: #2a5a3a;
  --accent-green-hover: #357048;
  --accent-green-border: #3a7a4a;

  /* Hero */
  --hero-glow: rgba(94, 196, 120, 0.08);
  --hero-glow-border: rgba(94, 196, 120, 0.25);

  /* Misc */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --transition-fast: 120ms ease;
  --font-mono: "SF Mono", "Cascadia Code", "Fira Code", Consolas, monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

header {
  padding: 1.75rem 2rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

header h1 {
  font-family: "JetBrains Mono", var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0;
  letter-spacing: -0.01em;
}

#stats {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
}

#stats .stat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  background: var(--bg-base);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
}

#stats .stat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

#stats .stat-label {
  color: var(--text-muted);
}

#stats .stat-count {
  color: var(--text-primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stat-dot-pending { background: var(--status-pending); }
.stat-dot-working { background: var(--status-working); }
.stat-dot-broken { background: var(--status-broken); }
.stat-dot-paid-only { background: var(--status-paid-only); }
.stat-dot-needs-key { background: var(--status-needs-key); }
.stat-dot-skipped { background: var(--status-skipped); }

/* Hero */

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  margin-bottom: 1rem;
}

.hero-text {
  flex: 1;
  min-width: 0;
  animation: hero-fade-up 0.4s ease-out both;
}

.hero-tagline {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
}

.hero-accent {
  color: var(--status-working);
  font-weight: 700;
  font-family: "JetBrains Mono", var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.hero-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.hero-sub kbd {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--status-working);
  background: var(--accent-green);
  border: 1px solid var(--accent-green-border);
  border-radius: var(--radius-sm);
}

.hero-stats {
  display: flex;
  gap: 1rem;
  flex-shrink: 0;
  animation: hero-fade-up 0.4s ease-out 0.15s both;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.6rem 1rem;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  min-width: 90px;
}

.hero-stat-number {
  font-family: "JetBrains Mono", var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.hero-stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.15rem;
  white-space: nowrap;
}

.hero-stat-tryable {
  border-color: var(--hero-glow-border);
  background: var(--hero-glow);
  animation: hero-fade-up 0.4s ease-out 0.15s both, stat-glow 3s ease-in-out 1s 2;
}

.hero-stat-tryable .hero-stat-number {
  color: var(--status-working);
}

@keyframes hero-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes stat-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(94, 196, 120, 0); }
  50% { box-shadow: 0 0 12px 0 rgba(94, 196, 120, 0.1); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-text,
  .hero-stats,
  .hero-stat-tryable {
    animation: none;
  }
}

main {
  padding: 1rem 2rem 2rem;
}

#filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  position: sticky;
  top: 0;
  background: var(--bg-base);
  padding: 0.75rem 0;
  z-index: 10;
  border-bottom: 1px solid var(--border-subtle);
}

#filters input,
#filters select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.85rem;
  height: 36px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

#filters input {
  flex: 1;
  min-width: 200px;
}

#filters select {
  min-width: 150px;
  cursor: pointer;
}

#filters input:focus,
#filters select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(90, 122, 191, 0.15);
}

#filters input::placeholder {
  color: var(--text-muted);
}

#result-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-variant-numeric: tabular-nums;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

thead th {
  text-align: left;
  padding: 0.7rem 0.75rem;
  border-bottom: 2px solid var(--border-default);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: color var(--transition-fast);
}

thead th:hover {
  color: var(--text-secondary);
}

thead th.sorted {
  color: var(--text-primary);
}

thead th.sorted::after {
  content: " ▲";
  font-size: 0.65rem;
}

thead th.sorted[data-sort-dir="desc"]::after {
  content: " ▼";
}

tbody tr {
  border-bottom: 1px solid rgba(42, 42, 74, 0.5);
}

tbody tr:hover {
  background: var(--bg-elevated);
}

tbody td {
  padding: 0.6rem 0.75rem;
  vertical-align: middle;
}

tbody td:nth-child(2) {
  max-width: 400px;
  color: var(--text-secondary);
}

tbody td a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--transition-fast);
}

tbody td a:hover {
  color: #93b8eb;
  text-decoration: underline;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.01em;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-pending {
  background: var(--status-pending);
  color: var(--status-pending-text);
}

.badge-working {
  background: var(--status-working-bg);
  color: var(--status-working);
  border: 1px solid rgba(94, 196, 120, 0.2);
}

.badge-broken {
  background: var(--status-broken-bg);
  color: var(--status-broken);
  border: 1px solid rgba(224, 96, 96, 0.2);
}

.badge-paid-only {
  background: var(--status-paid-only-bg);
  color: var(--status-paid-only);
  border: 1px solid rgba(224, 160, 64, 0.2);
}

.badge-needs-key {
  background: var(--status-needs-key-bg);
  color: var(--status-needs-key);
  border: 1px solid rgba(212, 196, 74, 0.2);
}

.badge-skipped {
  background: var(--status-skipped);
  color: var(--status-skipped-text);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 0.75rem;
  font-size: 0.85rem;
}

.notes-icon {
  cursor: help;
  color: var(--text-link);
  margin-left: 0.3rem;
  font-size: 0.75rem;
}

/* Expandable detail rows */

tr.api-row {
  cursor: pointer;
  transition: background var(--transition-fast);
}

tr.api-row.expanded {
  background: var(--bg-elevated);
}

.detail-row td {
  padding: 0 0.75rem 0.75rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-default);
}

.detail-row:hover {
  background: transparent;
}

.detail-panel {
  padding: 0.75rem 0;
  max-width: 800px;
}

.detail-notes {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

/* Try It */

.try-it-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.75rem;
  margin-top: 0.25rem;
}

.try-it-params {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.proxy-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(94, 196, 120, 0.12);
  color: #5ec478;
  border: 1px solid rgba(94, 196, 120, 0.25);
}

.try-it-params label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.try-it-input {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 0.8rem;
  width: 80px;
  font-family: var(--font-mono);
  transition: border-color var(--transition-fast);
}

.try-it-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.try-it-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.try-it-url {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-link);
  word-break: break-all;
  padding: 0.35rem 0.6rem;
  background: var(--bg-base);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.try-it-btn {
  padding: 0.35rem 0.9rem;
  background: var(--accent-green);
  color: var(--status-working);
  border: 1px solid var(--accent-green-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--transition-fast);
}

.try-it-btn:hover {
  background: var(--accent-green-hover);
}

.try-it-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.try-it-response {
  margin-top: 0.5rem;
}

.try-it-json {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: #c9d1d9;
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.try-it-image {
  max-width: 300px;
  max-height: 300px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.try-it-loading {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.try-it-error {
  color: var(--status-broken);
  font-size: 0.8rem;
  background: var(--status-broken-bg);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(224, 96, 96, 0.2);
}

.try-it-error code {
  background: var(--bg-base);
  padding: 0.15rem 0.3rem;
  border-radius: 2px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

/* Responsive */

@media (max-width: 768px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .hero-stats {
    width: 100%;
    justify-content: flex-start;
  }

  .hero-stat {
    flex: 1;
    min-width: 0;
    padding: 0.4rem 0.5rem;
  }

  .hero-stat-number {
    font-size: 1.2rem;
  }

  .hero-stat-label {
    font-size: 0.55rem;
    letter-spacing: 0.02em;
    white-space: normal;
    text-align: center;
  }

  header {
    padding: 1.25rem 1rem 1rem;
  }

  header h1 {
    font-size: 1.2rem;
  }

  main {
    padding: 0.75rem 1rem 1.5rem;
  }

  #filters {
    gap: 0.5rem;
    padding: 0.5rem 0;
  }

  #filters input,
  #filters select {
    font-size: 0.8rem;
    height: 34px;
    min-width: 0;
  }

  #filters input {
    min-width: 100%;
  }

  #filters select {
    flex: 1;
    min-width: 0;
  }

  table {
    font-size: 0.8rem;
  }

  thead th {
    padding: 0.5rem;
    font-size: 0.7rem;
  }

  tbody td {
    padding: 0.45rem 0.5rem;
  }

  tbody td:nth-child(2) {
    max-width: 200px;
  }

  .detail-panel {
    max-width: 100%;
  }

  .try-it-controls {
    flex-direction: column;
    align-items: flex-start;
  }
}
