:root {
  --accent: #0891b2;
  --accent-dark: #0e7490;
  --ink: #1a2331;
  --ink-soft: #4b5768;
  --bg: #f4f6f8;
  --card-bg: #ffffff;
  --border: #e2e6ea;
  --radius: 10px;

  --recency-last5: #16a34a;
  --recency-5to10: #65a30d;
  --recency-10to20: #d97706;
  --recency-20plus: #b45309;
  --recency-unknown: #6b7280;

  --style-adventure: #2f6f4f;
  --style-naked: #4a5568;
  --style-supersport: #c0392b;
  --style-cruiser: #7c5295;
  --style-scooter: #2b6cb0;
  --style-trail: #8a6d3b;
  --style-motocross: #b7791f;
  --style-supermoto: #d53f8c;
  --style-trials: #3182ce;
  --style-scrambler: #52606d;
  --style-touring: #276749;
  --style-classic: #92400e;
  --style-trike: #6b46c1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: white;
  padding: 28px 0;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
}
.logo {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: white;
  padding: 6px;
  flex-shrink: 0;
}
.site-header h1 {
  margin: 0 0 4px;
  font-size: 1.6rem;
}
.tagline {
  margin: 0;
  color: rgba(255,255,255,0.9);
  font-size: 0.95rem;
  max-width: 640px;
}

main.wrap { padding-top: 22px; padding-bottom: 60px; }

/* Panels */
.panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}

/* Rules toggle */
.rules-toggle {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  padding: 2px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chev { transition: transform 0.15s ease; color: var(--accent); }
.rules-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.rules-body { margin-top: 12px; font-size: 0.92rem; color: var(--ink-soft); }
.rules-body ul { padding-left: 20px; margin: 0 0 10px; }
.rules-body li { margin-bottom: 6px; }
.word-approved { color: var(--recency-last5); font-weight: 700; }
.word-except { color: var(--style-supersport); font-weight: 700; }
.source-line { margin: 0; font-size: 0.85rem; }
.source-line a { color: var(--accent-dark); }

/* Filters */
.filter-group { margin-bottom: 16px; }
.filter-group:last-child { margin-bottom: 0; }
.filter-label {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 8px;
}
.filter-hint {
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pill {
  border: 1px solid var(--border);
  background: #fafbfc;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
}
.pill:hover { border-color: var(--accent); color: var(--ink); }
.pill.active {
  background: var(--pill-color, var(--accent));
  border-color: var(--pill-color, var(--accent));
  color: white;
  font-weight: 600;
}

.dropdown-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.dropdown-field { display: flex; flex-direction: column; gap: 4px; }
.dropdown-field label { font-size: 0.78rem; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; }
.dropdown-field select, .dropdown-field input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  background: white;
  color: var(--ink);
  min-width: 160px;
}
.search-field { flex: 1; min-width: 200px; }
.search-field input { width: 100%; }
.clear-btn {
  border: 1px solid var(--border);
  background: white;
  color: var(--ink-soft);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  height: 37px;
}
.clear-btn:hover { border-color: var(--accent); color: var(--accent-dark); }

/* Results meta */
.results-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.88rem;
  color: var(--ink-soft);
  flex-wrap: wrap;
  gap: 10px;
}
.sort-field { display: flex; align-items: center; gap: 8px; }
.sort-field select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  font-size: 0.85rem;
}

/* Results grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
  margin-bottom: 10px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card-image {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #eef1f4;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.card-image.has-photo { background: #f4f6f8; }
.card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.card-make { font-size: 0.78rem; font-weight: 700; color: var(--accent-dark); text-transform: uppercase; letter-spacing: 0.03em; }
.card-model { font-size: 1.05rem; font-weight: 700; line-height: 1.25; }
.wiki-pill {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--accent);
  color: var(--accent-dark);
  background: #f0fbfd;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  text-decoration: none;
}
.wiki-pill:hover { background: var(--accent); color: white; }
.card-variant { font-size: 0.85rem; color: var(--ink-soft); }
.card-facts { display: flex; gap: 6px; flex-wrap: wrap; }
.fact-pill {
  background: #eef1f4;
  border: 1px solid var(--border);
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}
.card-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  color: white;
}
.badge-style { background: var(--badge-color, var(--style-naked)); }
.badge-recency { background: var(--badge-color, var(--recency-unknown)); }
.badge-production {
  background: transparent;
  border: 1px solid var(--recency-last5);
  color: var(--recency-last5);
}
.badge-electric { background: #0f766e; }

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  padding: 40px 0;
}

/* Videos panel */
.videos-body { margin-top: 12px; }
.videos-hint { margin: 0 0 14px; font-size: 0.85rem; color: var(--ink-soft); }
.videos-hint code { background: #eef1f4; border-radius: 4px; padding: 1px 5px; font-size: 0.82em; }

.shorts-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}
.full-videos-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.video-slot {
  position: relative;
  background: #0f1720;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.video-slot iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.video-slot-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  pointer-events: none;
}
.video-slot--short {
  flex: 0 0 160px;
  aspect-ratio: 9 / 16;
}
.video-slot--wide {
  aspect-ratio: 16 / 9;
}

@media (max-width: 640px) {
  .full-videos-row { grid-template-columns: 1fr; }
  .video-slot--short { flex: 0 0 130px; }
}

/* PDF panel */
.pdf-panel h2 { margin-top: 0; font-size: 1.1rem; }
.pdf-panel p { color: var(--ink-soft); font-size: 0.92rem; }
.download-link {
  display: inline-block;
  background: var(--accent);
  color: white;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 16px;
  border-radius: 6px;
  margin: 6px 0 16px;
}
.download-link:hover { background: var(--accent-dark); }

/* States panel */
.states-panel h2 { margin-top: 0; font-size: 1.1rem; }
.states-panel > p { color: var(--ink-soft); font-size: 0.92rem; }
.state-field select { min-width: 260px; }

.state-info {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fafbfc;
}
.state-info-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}
.state-info-status.own { background: rgba(22,163,74,0.12); color: var(--recency-last5); }
.state-info-status.adopts { background: rgba(217,119,6,0.12); color: var(--recency-10to20); }
.state-info-status.unclear { background: rgba(107,114,128,0.14); color: var(--ink-soft); }

.state-info-note { font-size: 0.9rem; color: var(--ink-soft); margin: 0 0 12px; }
.state-info-links { display: flex; flex-wrap: wrap; gap: 10px; }
.state-info-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: white;
  border: 1px solid var(--border);
  color: var(--accent-dark);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: 6px;
}
.state-info-links a:hover { border-color: var(--accent); background: #f0fbfd; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 0 40px;
}
.site-footer p {
  font-size: 0.8rem;
  color: var(--ink-soft);
  max-width: 760px;
}
.site-footer p a { color: var(--accent-dark); }

@media (max-width: 640px) {
  .header-inner { flex-direction: column; text-align: center; }
  .dropdown-field select, .dropdown-field input { min-width: 0; width: 100%; }
  .dropdown-row { flex-direction: column; align-items: stretch; }
  .clear-btn { width: 100%; }
}
