@import url('https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --bg: #0d0f14;
  --bg-surface: #141720;
  --bg-elevated: #1a1d28;
  --border: #1e2232;
  --border-strong: #262b3e;
  --text: #c4c7d4;
  --text-bright: #e2e4ef;
  --text-muted: #545a72;
  --text-dim: #333849;
  --accent: #00e5c3;
  --accent-dim: rgba(0, 229, 195, 0.06);
  --score-great: #4ade80;
  --score-great-bg: rgba(74, 222, 128, 0.1);
  --score-good: #22d3ee;
  --score-good-bg: rgba(34, 211, 238, 0.1);
  --score-ok: #fbbf24;
  --score-ok-bg: rgba(251, 191, 36, 0.1);
  --score-poor: #f87171;
  --score-poor-bg: rgba(248, 113, 113, 0.1);
  --font-ui: 'Onest', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --radius: 10px;
  --radius-sm: 6px;
}

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

body {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 2.5rem;
  padding: .8rem 2rem;
  background: rgba(13, 15, 20, 0.9);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}
.logo {
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  color: var(--text-bright);
  letter-spacing: -.02em;
  transition: color .12s;
}
.logo:hover { color: var(--accent); }
nav { display: flex; gap: 1.25rem; }
nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  padding: .25rem .5rem;
  border-radius: var(--radius-sm);
  transition: color .12s, background .12s;
}
nav a:hover { color: var(--text-bright); background: var(--accent-dim); }

/* ── Main ── */
main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}
h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -.03em;
  margin-bottom: 1.5rem;
  line-height: 1.25;
}

/* ── Filters ── */
.ratings-toolbar {
  margin-bottom: 1.5rem;
  position: relative;
}
.filters {
  display: flex;
  gap: .625rem;
  flex-wrap: wrap;
  align-items: center;
}
select, input[type=text] {
  font-family: var(--font-ui);
  font-size: .875rem;
  padding: .5rem .875rem;
  height: 38px;
  background: var(--bg-surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
select {
  padding-right: 2.25rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23545a72' d='M5 7L0.67 2h8.66z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
}
select:focus, input[type=text]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 229, 195, .08);
}
input[type=text]::placeholder { color: var(--text-dim); }

/* ── Search results ── */
#search-results { position: relative; }
.search-results {
  position: absolute;
  top: .375rem;
  left: 0;
  min-width: 400px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 20px 48px rgba(0, 0, 0, .65), 0 0 0 1px rgba(0, 229, 195, .05);
  list-style: none;
  overflow: hidden;
  animation: fadeSlide .12s ease;
}
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}
.search-results li {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.search-results li:last-child { border-bottom: none; }
.search-results li:hover { background: var(--accent-dim); }
.search-results a {
  flex: 1;
  display: flex;
  align-items: center;
  gap: .375rem;
  text-decoration: none;
  color: var(--text-bright);
  font-size: .875rem;
  font-weight: 500;
  min-width: 0;
}
.search-results .brand {
  color: var(--text-muted);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-results .score-badge {
  font-size: .75rem;
  padding: .15rem .45rem;
  flex-shrink: 0;
}
.search-results .niche {
  font-size: .72rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: .2rem .5rem;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.search-empty {
  padding: 1rem 1.25rem;
  color: var(--text-muted);
  font-size: .875rem;
}

/* ── Ratings table ── */
#ratings-table { overflow-x: auto; }
.ratings-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}
.ratings-table thead tr { background: var(--bg-surface); }
.ratings-table th {
  padding: .6rem 1rem;
  text-align: left;
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
  user-select: none;
}
.ratings-table th a {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .2rem;
  transition: color .12s;
  cursor: pointer;
}
.ratings-table th a:hover { color: var(--text); }
.ratings-table th.sort-active { color: var(--accent); }
.ratings-table th.sort-active a { color: var(--accent); }

.ratings-table td {
  padding: .625rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
  vertical-align: middle;
}
.ratings-table tbody tr:last-child td { border-bottom: none; }
.ratings-table tbody tr:hover td { background: var(--accent-dim); }

/* Columns */
.col-rank {
  width: 54px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--text-dim);
  padding-right: 1.25rem;
}
.col-site { min-width: 200px; }
.col-site a {
  color: var(--text-bright);
  text-decoration: none;
  font-weight: 500;
  transition: color .12s;
}
.col-site a:hover { color: var(--accent); }
.niche-tag {
  display: inline-block;
  margin-left: .5rem;
  font-size: .68rem;
  font-weight: 500;
  padding: .15rem .45rem;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  vertical-align: middle;
  letter-spacing: .02em;
}

/* Score */
.col-score { width: 88px; }
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  font-family: var(--font-mono);
  font-size: .875rem;
  font-weight: 600;
  padding: .25rem .6rem;
  border-radius: var(--radius-sm);
  letter-spacing: -.02em;
}
.score-great { color: var(--score-great); background: var(--score-great-bg); }
.score-good  { color: var(--score-good);  background: var(--score-good-bg); }
.score-ok    { color: var(--score-ok);    background: var(--score-ok-bg); }
.score-poor  { color: var(--score-poor);  background: var(--score-poor-bg); }

/* LCP / INP */
.col-lcp, .col-inp { width: 88px; }
td.perf-good { color: var(--score-great); font-family: var(--font-mono); font-size: .8rem; }
td.perf-ok   { color: var(--score-ok);    font-family: var(--font-mono); font-size: .8rem; }
td.perf-poor { color: var(--score-poor);  font-family: var(--font-mono); font-size: .8rem; }
td.perf-none { color: var(--text-dim);    font-family: var(--font-mono); font-size: .8rem; }

/* Delta */
.col-delta { width: 100px; font-family: var(--font-mono); font-size: .8rem; }
.delta-up   { color: var(--score-great); }
.delta-down { color: var(--score-poor); }
.delta-flat { color: var(--text-dim); }

/* ── Load more ── */
#load-more {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
}
button {
  font-family: var(--font-ui);
  font-size: .875rem;
  font-weight: 500;
  padding: .55rem 1.75rem;
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(0, 229, 195, .3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  letter-spacing: .01em;
  transition: background .15s, border-color .15s, color .15s;
}
button:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: .8rem;
}
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--text); }

/* ── Site detail page ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .375rem;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--text-muted); text-decoration: none; transition: color .12s; }
.breadcrumb a:hover { color: var(--text); }
.brand { font-size: .95rem; color: var(--text-muted); margin-top: .25rem; margin-bottom: 1.5rem; }
.site-stats {
  display: flex;
  gap: 1rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}
.stat-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  min-width: 150px;
  flex: 1;
  max-width: 220px;
}
.stat-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: .625rem;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1.1;
  margin-bottom: .35rem;
}
.stat-value.score-badge { font-size: 2rem; padding: .5rem .75rem; display: inline-flex; }
.stat-sub { font-size: .75rem; color: var(--text-muted); }
h2 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-bright);
  margin: 2rem 0 .875rem;
  letter-spacing: -.02em;
}
.cta-block { margin-top: 2rem; }
.cta-block a {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .625rem 1.25rem;
  background: var(--bg-surface);
  color: var(--accent);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  transition: border-color .15s, background .15s;
}
.cta-block a:hover { border-color: rgba(0, 229, 195, .4); background: var(--accent-dim); }

/* ── Mobile ── */
@media (max-width: 720px) {
  main { padding: 1.5rem 1rem 3rem; }
  h1 { font-size: 1.3rem; }
  .filters { flex-direction: column; align-items: stretch; }
  select, input[type=text] { width: 100%; }
  .search-results { min-width: calc(100vw - 2rem); }
  .col-lcp, .col-inp, .col-delta { display: none; }
  .niche-tag { display: none; }
  .site-stats { flex-direction: column; }
  .stat-block { max-width: 100%; }
}
