:root {
  --bg: #ffffff;
  --surface: #f4f5f7;
  --text: #14161a;
  --muted: #5b616b;
  --border: #dfe2e7;
}

:root[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #181b21;
  --text: #eceef2;
  --muted: #9aa1ad;
  --border: #2a2e37;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --surface: #181b21;
    --text: #eceef2;
    --muted: #9aa1ad;
    --border: #2a2e37;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}

.topbar nav { display: flex; gap: 16px; flex: 1; }
.topbar nav a { color: var(--muted); text-decoration: none; }
.topbar nav a:hover { color: var(--text); }

#theme-toggle {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font: inherit;
}

main { max-width: 1100px; margin: 0 auto; padding: 24px; }

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.card-image {
  height: 140px;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.card-body { padding: 16px; }
.card-brand { color: var(--muted); font-size: 0.85rem; margin: 0; }
.card-name { margin: 2px 0 8px; font-size: 1.1rem; }
.card-price { font-weight: 600; margin: 0 0 12px; }

.card-specs { list-style: none; padding: 0; margin: 0; font-size: 0.9rem; }
.card-specs li { display: flex; justify-content: space-between; padding: 3px 0; }
.card-specs span:first-child { color: var(--muted); }

.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
}

.filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.filters h2 { margin: 0 0 12px; font-size: 1.1rem; }
.filters fieldset { border: 0; padding: 0; margin: 0 0 16px; }
.filters legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.filters label { display: block; margin: 12px 0 6px; font-weight: 600; }
.filters #brand-filters label { font-weight: 400; margin: 4px 0; }
.filters input[type="range"], .filters select { width: 100%; }
.filters select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  font: inherit;
}

#result-count { color: var(--muted); margin: 0 0 12px; }

@media (max-width: 700px) {
  .layout { grid-template-columns: 1fr; }
}

.filters #platform-filters label { font-weight: 400; margin: 4px 0; }

#reset-filters {
  margin-top: 16px;
  width: 100%;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  font: inherit;
}

.breadcrumb { color: var(--muted); margin: 0 0 8px; }
.breadcrumb a { color: var(--muted); }

.spec-table { width: 100%; max-width: 700px; border-collapse: collapse; margin-top: 16px; }
.spec-table th, .spec-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.spec-table th { width: 40%; color: var(--muted); font-weight: 500; }

.card-name a { color: var(--text); text-decoration: none; }
.card-name a:hover { text-decoration: underline; }

.search { position: relative; }

.search input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font: inherit;
  width: 220px;
}

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  z-index: 10;
  overflow: hidden;
}

.search-results a, .search-results span {
  display: block;
  padding: 8px 12px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.search-results a:hover { background: var(--border); }
.search-results[hidden] { display: none; }

.topbar nav { flex: 0 0 auto; }

.search {
  flex: 1;
  max-width: 520px;
  margin: 0 auto;
}

.search input {
  width: 100%;
  padding: 10px 16px 10px 42px;
  border-radius: 999px;
}

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

@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; max-width: none; margin: 0; }
}

.filters input[type="range"] + fieldset { margin-top: 16px; }

html { scroll-behavior: smooth; }

#theme-toggle { margin-left: auto; }

.hero { text-align: center; padding: 32px 0 40px; }
.hero h1 { margin: 0 0 8px; font-size: 2rem; }
.hero p { color: var(--muted); margin: 0 0 24px; }

.search-hero { max-width: 640px; margin: 0 auto; }
.search-hero input { padding: 14px 20px 14px 52px; font-size: 1.1rem; }
.search-hero .search-icon { left: 20px; }
.search-hero .search-results { text-align: left; }

.browse-link { display: inline-block; margin-top: 16px; color: var(--muted); }

#all-headsets { margin: 0 0 4px; scroll-margin-top: 16px; }

.hero-home { padding: 80px 0 100px; }
.hero-home h1 { font-size: 2.4rem; }

.button-link {
  display: inline-block;
  margin-top: 20px;
  padding: 10px 22px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
.button-link:hover { border-color: var(--muted); }