/* ============================================================
   Open Model Index — Lab Instrument Theme
   ============================================================
   Aesthetic: High-end test equipment UI. Dense data, phosphor
   green + amber readouts, dot-grid background, CRT grain.
   Fonts: Syne (display), JetBrains Mono (data), IBM Plex Sans (body)
   ============================================================ */

/* ── Tokens ─────────────────────────────────────────────────── */

:root {
  --bg:              #08090c;
  --bg-elevated:     #0e1015;
  --bg-card:         #12141b;
  --bg-card-hover:   #181b24;
  --border:          #1e2230;
  --border-bright:   #2a2f40;

  --text:            #c8cdd8;
  --text-secondary:  #7c8499;
  --text-dim:        #4e5568;
  --text-muted:      #353b4d;

  /* Phosphor green — primary accent */
  --green:           #39ff8a;
  --green-dim:       rgba(57, 255, 138, 0.12);
  --green-mid:       rgba(57, 255, 138, 0.25);
  --green-text:      #2ee077;

  /* Amber — secondary / warnings */
  --amber:           #ffb020;
  --amber-dim:       rgba(255, 176, 32, 0.12);
  --amber-text:      #e09b1a;

  /* Signal red — errors / weaknesses */
  --red:             #ff4d5a;
  --red-dim:         rgba(255, 77, 90, 0.10);

  /* Confidence */
  --conf-verified:   var(--green);
  --conf-reported:   var(--amber);
  --conf-unverified: var(--red);
  --conf-missing:    var(--text-dim);

  /* Fonts */
  --font-display:    'Syne', sans-serif;
  --font-body:       'IBM Plex Sans', -apple-system, sans-serif;
  --font-mono:       'JetBrains Mono', 'Fira Code', monospace;

  --radius:          8px;
  --radius-sm:       5px;
  --transition:      180ms ease;
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ──────────────────────────────────────────────────── */

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

html {
  font-size: 14px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a { color: var(--green-text); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--green); }
button { cursor: pointer; font-family: inherit; }

/* ── Grain overlay ──────────────────────────────────────────── */

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* Dot grid on main content area */
.main::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.04;
  background-image: radial-gradient(circle, var(--text-dim) 1px, transparent 1px);
  background-size: 24px 24px;
  z-index: 0;
}

.main { position: relative; }
.main > * { position: relative; z-index: 1; }

/* ── Scrollbar ──────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
* { scrollbar-width: thin; scrollbar-color: var(--border-bright) transparent; }

/* ── Header ─────────────────────────────────────────────────── */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.header-left { display: flex; flex-direction: column; gap: 2px; }
.header-right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.site-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.title-accent {
  color: var(--green);
  font-size: 12px;
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.6; text-shadow: 0 0 4px var(--green-dim); }
  50%      { opacity: 1;   text-shadow: 0 0 12px var(--green-mid); }
}

.site-tagline {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.3px;
  font-family: var(--font-mono);
  font-weight: 400;
}

/* Header stats */
.header-stats {
  display: flex;
  gap: 12px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.stat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stat-val {
  font-weight: 600;
  color: var(--text-secondary);
}

/* GitHub link */
.gh-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.gh-link:hover {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-dim);
  text-decoration: none;
}

/* ── Controls strip ─────────────────────────────────────────── */

.controls {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
}

.controls-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.controls-row--secondary {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* Search */
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 160px;
  max-width: 280px;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

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

.search-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim), 0 0 20px var(--green-dim);
}

/* Filter clusters */
.filter-cluster {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.filter-heading {
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-right: 2px;
}

/* Pills */
.pill {
  padding: 4px 11px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  transition: all var(--transition);
  white-space: nowrap;
}

.pill:hover {
  border-color: var(--green);
  color: var(--green-text);
}

.pill.active {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-dim);
  box-shadow: 0 0 8px var(--green-dim);
}

/* Sort select */
.sort-select {
  padding: 5px 28px 5px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  font-family: var(--font-body);
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%234e5568' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color var(--transition);
}

.sort-select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim);
}

.sort-select option { background: var(--bg-card); color: var(--text); }

/* VRAM control */
.vram-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vram-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}

.vram-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--bg-elevated);
  cursor: pointer;
  box-shadow: 0 0 6px var(--green-dim);
  transition: transform var(--transition), box-shadow var(--transition);
}

.vram-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 12px var(--green-mid);
}

.vram-slider::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--bg-elevated);
  cursor: pointer;
}

.vram-slider::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
}

.vram-readout {
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--green-text);
  min-width: 40px;
}

/* View toggle */
.view-toggle {
  display: flex;
  gap: 2px;
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-btn {
  padding: 5px 8px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.view-btn:hover { color: var(--text-secondary); }

.view-btn.active {
  background: var(--green-dim);
  color: var(--green);
}

/* ── Main content ───────────────────────────────────────────── */

.main {
  flex: 1;
  padding: 20px 24px 80px;
  overflow-y: auto;
}

/* ── Card grid ──────────────────────────────────────────────── */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
}

/* ── Model card ─────────────────────────────────────────────── */

.model-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition-slow), transform var(--transition);
  position: relative;
  overflow: hidden;
  animation: card-in 0.4s ease both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.model-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px;
  height: 100%;
  background: var(--green);
  opacity: 0;
  transition: opacity var(--transition);
}

.model-card:hover {
  border-color: var(--border-bright);
  box-shadow: 0 0 0 1px var(--green-dim), 0 8px 32px rgba(0, 0, 0, 0.5);
  transform: translateY(-2px);
}

.model-card:hover::before { opacity: 1; }

/* Card header */
.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.card-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.card-provider {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-top: 2px;
}

/* Tier indicator */
.tier-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.tier-reviewed {
  background: var(--green-dim);
  color: var(--green-text);
  border: 1px solid var(--green-mid);
}

.tier-data-only {
  background: var(--amber-dim);
  color: var(--amber-text);
  border: 1px solid rgba(255, 176, 32, 0.2);
}

/* Card tags */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
}

.tag {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-mono);
}

.tag-arch {
  background: rgba(200, 205, 216, 0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.tag-quant {
  background: var(--green-dim);
  color: var(--green-text);
  border: 1px solid rgba(57, 255, 138, 0.15);
}

/* Card metrics grid */
.card-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  margin-bottom: 14px;
  background: var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.metric {
  background: var(--bg);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-label {
  font-size: 9px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.metric-value {
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #fff;
  line-height: 1;
}

.metric-value.dim { color: var(--text-dim); font-size: 13px; }

/* Capability bars */
.capability-bars {
  margin-bottom: 12px;
}

.cap-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.cap-bar:last-child { margin-bottom: 0; }

.cap-label {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-dim);
  width: 48px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.cap-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.cap-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--green);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px var(--green-dim);
}

.cap-fill.amber { background: var(--amber); box-shadow: 0 0 8px var(--amber-dim); }
.cap-fill.red   { background: var(--red);   box-shadow: 0 0 8px var(--red-dim); }

.cap-coverage {
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-left: 2px;
  flex-shrink: 0;
}

.cap-score {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-secondary);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

/* Benchmark readout on card */
.card-benchmarks {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 12px;
  font-family: var(--font-mono);
}

.bench-item {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-secondary);
}

.conf-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

/* Summary */
.card-summary {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Quant badges */
.card-quants {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.quant-badge {
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  letter-spacing: 0.3px;
}

.quant-fit { font-weight: 700; margin-left: 2px; }

/* Stub missing-data badges */
.stub-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--text-secondary);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  letter-spacing: 0.3px;
  margin-right: 4px;
}

.stub-intro {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 16px;
  max-width: 720px;
}

.stub-name-link {
  color: var(--text);
  text-decoration: none;
}
.stub-name-link:hover {
  text-decoration: underline;
  color: var(--accent);
}

.stub-wrap {
  padding: 0 4px;
  margin-top: 16px;
}

/* Compare row */
.card-compare-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
}

.compare-chk { accent-color: var(--green); cursor: pointer; }
.compare-label { cursor: pointer; display: flex; align-items: center; gap: 4px; }

/* ── Table view ─────────────────────────────────────────────── */

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

.model-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.model-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 2;
}

.model-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
  transition: background var(--transition);
}

.model-table tbody tr {
  cursor: pointer;
  transition: background var(--transition);
}

.model-table tbody tr:hover td {
  background: var(--bg-card);
}

.model-table td.td-name {
  font-family: var(--font-display);
  font-weight: 600;
  color: #fff;
  font-size: 13px;
}

.model-table td.td-highlight {
  color: var(--green-text);
  font-weight: 600;
}

.th-name { min-width: 180px; }

/* Sortable headers */
.th-sortable {
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
}

.th-sortable:hover {
  color: var(--green-text);
}

.th-sortable.th-active {
  color: var(--green);
}

.sort-arrow {
  font-size: 8px;
  color: var(--green);
}

/* Table inline score bars */
.table-score-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 80px;
}

.table-score-bar .table-score-fill {
  height: 4px;
  border-radius: 2px;
  background: var(--green);
  flex: 0 0 auto;
  max-width: 60px;
  transition: width 0.4s ease;
}

.table-score-bar .table-score-fill.amber { background: var(--amber); }
.table-score-bar .table-score-fill.red { background: var(--red); }

.table-score-label {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 20px;
}

.table-provider {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Quant recommendation */
.quant-recommendation {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin-bottom: 8px;
  background: var(--green-dim);
  border: 1px solid var(--green-mid);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-mono);
}

.quant-rec-label {
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.quant-rec-value {
  color: var(--green);
  font-weight: 700;
}

.quant-rec-headroom {
  color: var(--text-dim);
  font-size: 10px;
  margin-left: auto;
}

.quant-no-fit {
  padding: 6px 10px;
  margin-bottom: 8px;
  background: var(--red-dim);
  border: 1px solid rgba(255, 77, 90, 0.2);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--red);
}

.quant-fits {
  border-color: var(--green-mid) !important;
  color: var(--green-text) !important;
}

.quant-no {
  border-color: rgba(255, 77, 90, 0.2) !important;
  color: var(--text-muted) !important;
  opacity: 0.6;
}

/* Quant more badge */
.quant-more {
  color: var(--text-dim);
  border-style: dashed;
}

/* ── Loading ────────────────────────────────────────────────── */

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text-dim);
  font-size: 13px;
  font-family: var(--font-mono);
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Reset button ──────────────────────────────────────────── */

.btn--sm {
  padding: 4px 10px;
  font-size: 11px;
}

/* ── No results ─────────────────────────────────────────────── */

.no-results {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}

.no-results-icon {
  display: block;
  font-size: 32px;
  margin-bottom: 8px;
  color: var(--text-muted);
}

/* ── Modal ──────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  animation: fade-in 0.2s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-panel {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 860px;
  width: 92%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), 0 0 1px var(--green-dim);
  animation: modal-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
  position: absolute;
  top: 16px; right: 18px;
  width: 32px; height: 32px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  z-index: 2;
}

.modal-close:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-dim);
}

/* Modal sections */
.modal-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
  padding-right: 48px;
  letter-spacing: -0.5px;
}

.modal-provider {
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  margin-bottom: 16px;
}

.modal-section { margin-top: 24px; }

.modal-section-title {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--green-text);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-section-title::before {
  content: '//';
  color: var(--text-muted);
}

.modal-specs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 2px;
  background: var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.modal-spec {
  background: var(--bg);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.modal-spec-label {
  font-size: 9px;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.modal-spec-value {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-mono);
}

/* Modal summary box */
.modal-summary-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
}

/* Modal benchmark table */
.benchmark-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.benchmark-table th {
  text-align: left;
  padding: 7px 10px;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
}

.benchmark-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.benchmark-table tr:last-child td { border-bottom: none; }

.benchmark-table td.bench-label {
  font-family: var(--font-body);
  color: var(--text);
  font-weight: 500;
}

.benchmark-table td.bench-score {
  color: var(--green-text);
  font-weight: 700;
}

.benchmark-table td.bench-missing {
  color: var(--text-muted);
}

/* Modal tags */
.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.modal-tag {
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.modal-tag-good {
  background: var(--green-dim);
  color: var(--green-text);
  border: 1px solid var(--green-mid);
}

.modal-tag-bad {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(255, 77, 90, 0.2);
}

/* Modal links */
.modal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.modal-link:hover {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-dim);
  text-decoration: none;
}

/* Approval badge */
.approval-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.approval-badge.approved {
  background: var(--green-dim);
  color: var(--green-text);
  border: 1px solid var(--green-mid);
}

.approval-badge.not-approved {
  background: rgba(78, 85, 104, 0.1);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

/* ── Compare bar ────────────────────────────────────────────── */

.compare-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg-elevated);
  border-top: 1px solid var(--green-mid);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 999;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5), 0 -1px 0 var(--green-dim);
  animation: slide-up 0.25s ease;
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.compare-label-text {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.compare-names {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Buttons */
.btn {
  padding: 7px 18px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-body);
  transition: all var(--transition);
  border: none;
  white-space: nowrap;
}

.btn--primary {
  background: var(--green);
  color: var(--bg);
}

.btn--primary:hover {
  background: #2ee077;
  box-shadow: 0 0 16px var(--green-dim);
  transform: translateY(-1px);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn--ghost:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ── Footer ─────────────────────────────────────────────────── */

footer {
  padding: 16px 24px;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 11px;
  color: var(--text-dim);
}

footer a { color: var(--text-secondary); }
footer a:hover { color: var(--green); }

.footer-sub {
  margin-top: 4px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* ── Utility ────────────────────────────────────────────────── */

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

/* ── Responsive ─────────────────────────────────────────────── */

@media (max-width: 768px) {
  header { padding: 12px 16px; gap: 10px; }
  .site-title { font-size: 17px; }
  .site-tagline { display: none; }
  .header-stats { display: none; }
  .controls { padding: 8px 16px; }
  .controls-row { gap: 8px; }
  .search-wrap { max-width: none; min-width: 0; flex: 1 1 100%; }
  .main { padding: 14px 16px 80px; }
  .card-grid { grid-template-columns: 1fr; gap: 10px; }
  .model-card { padding: 14px; }
  .card-metrics { grid-template-columns: repeat(2, 1fr); }
  .modal-panel { padding: 16px; width: 96%; max-height: 95vh; }
  .modal-title { font-size: 18px; padding-right: 36px; }
  .modal-specs-grid { grid-template-columns: repeat(2, 1fr); }
  .compare-bar { padding: 10px 16px; gap: 6px; flex-wrap: wrap; }
  .compare-names { font-size: 11px; }
  footer { padding: 12px 16px; }
  .vram-slider { width: 80px; }
  /* Table responsive: horizontal scroll with sticky first column */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .model-table { min-width: 800px; }
  .model-table td.td-name,
  .model-table th.th-name {
    position: sticky;
    left: 0;
    background: var(--bg);
    z-index: 1;
  }
  .model-table td.td-name { background: var(--bg-card); }
  /* Benchmark table in modal */
  .benchmark-table { font-size: 11px; }
  .benchmark-table td, .benchmark-table th { padding: 6px 8px; }
}

@media (max-width: 480px) {
  .filter-cluster { gap: 3px; }
  .pill { padding: 3px 8px; font-size: 11px; }
  .card-metrics { grid-template-columns: 1fr 1fr; }
  .modal-specs-grid { grid-template-columns: 1fr; }
  .sort-select { max-width: 120px; font-size: 11px; }
  .cap-label { width: 38px; font-size: 9px; }
}

.card-speed-badge {
  display: inline-block;
  background: #1a2233;
  border: 1px solid #2d3a4d;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.78rem;
  color: #39ff8a;
  margin-bottom: 6px;
  cursor: help;
}

/* ── Sources section ────────────────────────────────────────────────── */
.sources-section {
  max-width: 1200px;
  margin: 3rem auto 0;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
}
.sources-heading {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: 0.25rem;
}
.sources-intro {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}
.sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.source-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  scroll-margin-top: 100px;
}
.source-card h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  margin: 0 0 0.4rem;
}
.source-card h3 a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dashed var(--text-dim);
}
.source-card h3 a:hover { color: var(--accent); border-color: var(--accent); }
.source-card p {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 0 0 0.6rem;
}
.source-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 3px;
  background: rgba(57, 255, 138, 0.15);
  color: #39ff8a;
}
.source-tag.tag-reported {
  background: rgba(255, 180, 50, 0.15);
  color: #ffb432;
}

.confidence-legend {
  border-top: 1px solid var(--border);
  padding-top: 1.2rem;
}
.confidence-legend h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  margin: 0 0 0.6rem;
}
.confidence-legend p {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin: 0.3rem 0;
}
.conf-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.conf-dot.conf-verified { background: #39ff8a; }
.conf-dot.conf-reported { background: #ffb432; }
.conf-dot.conf-missing  { background: #555; }
.confidence-rule {
  margin-top: 0.6rem;
  font-style: italic;
  font-size: 0.75rem;
}

/* Source links in benchmark tables */
.source-link {
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 1px dotted var(--text-dim);
}
.source-link:hover { color: var(--accent); border-color: var(--accent); }
