/* ============================================================
   findyourpc — design tokens
   Black & white, rounded, minimal blue accent.
   ============================================================ */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f6f7;
  --text: #0a0a0b;
  --text-muted: #6b7280;
  --border: #ececed;
  --border-strong: #dcdcde;
  --accent: #2563eb;          /* used sparingly */
  --accent-soft: #eff4ff;
  --warn: #b45309;            /* estimated / incomplete price */
  --shadow-sm: 0 1px 2px rgba(10, 10, 11, 0.04), 0 1px 3px rgba(10, 10, 11, 0.06);
  --shadow-md: 0 8px 30px rgba(10, 10, 11, 0.08);
  --shadow-lg: 0 20px 60px rgba(10, 10, 11, 0.12);
  --radius: 22px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --radius-pill: 999px;
  --nav-h: 76px;
  --maxw: 1120px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #08090a;
  --surface: #101113;
  --surface-2: #17181b;
  --text: #f5f5f6;
  --text-muted: #9a9ba1;
  --border: #202226;
  --border-strong: #2c2e33;
  --accent: #3b82f6;
  --accent-soft: #121a2b;
  --warn: #fbbf24;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 34px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-top: var(--nav-h);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}
.container.narrow { max-width: 720px; }

/* ============================================================
   Bubble nav
   ============================================================ */
.navbar {
  position: fixed;
  top: 14px;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  pointer-events: none;
}
.nav-bubble {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 8px 8px 18px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  max-width: calc(100vw - 32px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 15px;
  padding-right: 8px;
  white-space: nowrap;
}
.brand-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color .18s ease, background .18s ease;
  white-space: nowrap;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.active {
  color: var(--bg);
  background: var(--text);
}
[data-theme="dark"] .nav-link.active { color: var(--bg); background: var(--text); }
.nav-discord svg { opacity: .9; }

.theme-toggle {
  width: 38px; height: 38px;
  margin-left: 4px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  display: grid;
  place-items: center;
  color: var(--text);
  transition: transform .18s ease, background .18s ease;
}
.theme-toggle:hover { transform: rotate(-15deg); }

/* ============================================================
   Buttons & tags
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--text);
  color: var(--bg);
}
.btn-primary:hover { box-shadow: var(--shadow-md); }
.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-2); }

.pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 15px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  letter-spacing: .01em;
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  padding: 70px 0 40px;
  text-align: center;
  max-width: 760px;
  margin: 0 auto;
}
.hero-title {
  font-size: clamp(40px, 7vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.04em;
  font-weight: 800;
  margin: 20px 0 18px;
}
.accent-text { color: var(--accent); }
.hero-sub {
  font-size: clamp(15px, 2.2vw, 18px);
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 30px;
}
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ============================================================
   Sections
   ============================================================ */
.section { margin: 56px 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 22px;
}
.section-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}
.section-link { font-size: 14px; color: var(--text-muted); font-weight: 500; }
.section-link:hover { color: var(--accent); }

.page-head { padding: 44px 0 26px; }
.page-title {
  font-size: clamp(30px, 5vw, 44px);
  letter-spacing: -0.03em;
  font-weight: 800;
  margin: 0 0 10px;
}
.page-sub { color: var(--text-muted); font-size: 16px; margin: 0; max-width: 560px; }

/* ============================================================
   Grid & cards
   ============================================================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 22px;
}
/* The builds page fits four cards per row instead of three — it carries the
   whole catalogue, so a shorter page beats a bigger card. 290px can only ever
   yield three inside a 1120px container; 230px lands on four and still steps
   down to 3/2/1 on the way to mobile. Everything inside the card scales down
   a notch with the column rather than reflowing at the old desktop type size. */
.builds-grid {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}
.builds-grid .card-body { padding: 15px 15px 17px; gap: 8px; }
.builds-grid .card-name { font-size: 15.5px; }
.builds-grid .card-desc { font-size: 12.5px; }
.builds-grid .variant-flag { font-size: 10.5px; }
.builds-grid .card-specs { gap: 5px; margin: 1px 0 3px; }
.builds-grid .spec-chip { font-size: 11px; padding: 3px 8px; }
.builds-grid .tag-chip { font-size: 10.5px; padding: 3px 8px; }
.builds-grid .badge-tier { top: 10px; left: 10px; font-size: 11px; padding: 4px 10px; }
.builds-grid .badge-type { bottom: 10px; left: 10px; font-size: 10px; padding: 3px 9px; }
.builds-grid .badge-new,
.builds-grid .badge-limited { top: 10px; right: 10px; font-size: 10.5px; padding: 4px 9px; }
.builds-grid .card-foot { padding-top: 12px; gap: 8px; }
.builds-grid .price { font-size: 19px; }
.builds-grid .price-source { font-size: 11.5px; padding: 7px 11px; }
.builds-grid .card-skeleton { height: 300px; }
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .22s cubic-bezier(.2,.7,.3,1), box-shadow .22s ease, border-color .22s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}
.card-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--surface-2);
  overflow: hidden;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-thumb .placeholder {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  color: var(--text-muted);
  font-size: 13px;
  background:
    radial-gradient(120% 120% at 100% 0%, var(--surface-2), var(--surface));
}
.badge-tier {
  position: absolute;
  top: 12px; left: 12px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  color: var(--text);
}
.badge-new {
  position: absolute;
  top: 12px; right: 12px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  background: var(--accent);
  color: #fff;
}
.card-body { padding: 18px 18px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-name { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.card-desc { font-size: 13.5px; color: var(--text-muted); margin: 0; }
.card-specs {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 2px 0 4px;
}
.spec-chip {
  font-size: 11.5px;
  padding: 4px 9px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.card-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}
.price-block { display: flex; flex-direction: column; }
.price-line { display: flex; align-items: center; gap: 6px; }
.price { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.price.pending { color: var(--text-muted); font-size: 15px; font-weight: 600; }
.price-updated { font-size: 11px; color: var(--text-muted); }
/* Marks a total that includes an estimate for a part the shop has no offers
   for. Small and muted — it should register without competing with the price,
   and it rides along on every surface a price is rendered on. */
.price-estimated { font-size: 13px; line-height: 1; color: var(--warn); cursor: help; }
.price-source {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  transition: background .15s ease, color .15s ease;
  white-space: nowrap;
}
.price-source:hover { background: var(--text); color: var(--bg); }

/* ============================================================
   Featured
   ============================================================ */
.featured-wrap { }
.featured {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.featured .card-thumb { aspect-ratio: auto; height: 100%; min-height: 300px; }
.featured-body { padding: 34px; display: flex; flex-direction: column; gap: 14px; }
.featured-body .card-name { font-size: 27px; letter-spacing: -0.02em; }
.featured-body .price { font-size: 30px; }

/* ============================================================
   Filters
   ============================================================ */
.filters { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin-top: 22px; }
.filter-chip {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s ease;
}
.filter-chip:hover { color: var(--text); }
.filter-chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ============================================================
   Info strip
   ============================================================ */
.info-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 70px 0 40px;
  padding: 40px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.info-num {
  font-size: 13px; font-weight: 700; color: var(--accent);
  letter-spacing: .1em; margin-bottom: 10px;
}
.info-item h3 { margin: 0 0 6px; font-size: 16px; letter-spacing: -0.01em; }
.info-item p { margin: 0; font-size: 14px; color: var(--text-muted); }

/* ============================================================
   Build lists
   ============================================================ */
.lists-wrap { display: flex; flex-direction: column; gap: 36px; }
.list-block { }
.list-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.list-name { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.list-count {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  padding: 3px 9px; border: 1px solid var(--border); border-radius: var(--radius-pill);
}
.list-desc { color: var(--text-muted); font-size: 13px; margin: 6px 0 14px; }

/* ============================================================
   Form (add page)
   ============================================================ */
.form-card, .output-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
}
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field label { font-size: 13px; font-weight: 600; }
.field .hint { font-weight: 400; color: var(--text-muted); font-size: 12px; }
.field input, .field select, .field textarea {
  font-family: inherit;
  font-size: 14px;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: var(--bg);
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
  resize: vertical;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 4px 0 10px; cursor: pointer; }
.checkbox + .form-actions { margin-top: 20px; }
.source-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
  background: var(--surface-2);
}
.source-block .field:last-child { margin-bottom: 0; }
.source-title {
  font-size: 12px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 12px;
}
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Sub-versions editor (admin form) */
.subversions {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin: 4px 0 18px;
}
.subversions > .source-title { margin-bottom: 8px; }
.block-hint {
  display: block;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 16px;
}
.block-hint strong { color: var(--text); }
.block-hint code { font-size: 11.5px; }
.variant-block { position: relative; background: var(--bg); }
/* Spec overrides nested inside a sub-version block. The block itself sits on
   --bg, so this steps back to the panel colour to read as a group within it. */
.variant-specs {
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 14px;
  margin-bottom: 16px;
  background: var(--surface-2);
}
.variant-specs > .source-title { margin-bottom: 8px; }
.variant-specs .block-hint { margin-bottom: 14px; }
.variant-specs .field-row:last-child .field { margin-bottom: 0; }
.variant-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.variant-block-head .source-title { margin-bottom: 0; }
.btn-remove {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn-remove:hover { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-add-variant { padding: 9px 18px; font-size: 13.5px; }
#variants:empty + .btn-add-variant { margin-top: 0; }
.output-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.batch-count { color: var(--accent); }
.output-pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 16px;
  font-size: 12.5px;
  font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  overflow-x: auto;
  white-space: pre;
  color: var(--text);
  margin: 0 0 16px;
  max-height: 340px;
  line-height: 1.5;
}
code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .9em;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* ============================================================
   Footer, states, skeletons
   ============================================================ */
.footer {
  max-width: var(--maxw);
  margin: 60px auto 40px;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}
.footer-muted { color: var(--text-muted); font-weight: 500; }
.footer-muted:hover { color: var(--accent); }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

.skeleton {
  border-radius: var(--radius);
  background: linear-gradient(100deg, var(--surface-2) 30%, var(--border) 50%, var(--surface-2) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
}
.card-skeleton { height: 340px; }
.featured-skeleton { height: 340px; }
.list-skeleton { height: 260px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.toast {
  position: fixed;
  bottom: 26px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   Clickable cards + featured blue ring
   ============================================================ */
.card, .featured { cursor: pointer; }
.card:focus-visible, .featured:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.is-featured {
  box-shadow: 0 0 0 2px var(--accent), var(--shadow-md);
  border-color: transparent;
}
.card.is-featured:hover {
  box-shadow: 0 0 0 2px var(--accent), var(--shadow-lg);
  border-color: transparent;
}

/* ============================================================
   Region toggle (nav)
   ============================================================ */
.region-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 13px;
  margin-left: 4px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  cursor: pointer;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  transition: background .15s ease;
}
.region-toggle:hover { background: var(--border); }
.region-toggle svg { opacity: .8; }

/* ============================================================
   Expandable faceted filters
   ============================================================ */
.filter-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.filter-toggle:hover { background: var(--surface-2); }
.filter-toggle[aria-expanded="true"] { border-color: var(--text); }
.filter-ico { font-size: 15px; line-height: 1; }
.filter-count:empty { display: none; }
.filter-count {
  min-width: 20px; height: 20px; padding: 0 6px;
  display: inline-grid; place-items: center;
  background: var(--accent); color: #fff;
  border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 700;
}
.filter-clear {
  border: none; background: none; cursor: pointer;
  color: var(--text-muted); font: inherit; font-size: 13px; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px;
}
.filter-clear:hover { color: var(--accent); }
/* Sort — a listbox of our own rather than a native <select>. A <select> can
   be styled down to its trigger and no further: the list it drops is drawn by
   the OS as a square, system-coloured panel that ignores both the pill shape
   and the dark theme. Same shape as the variant picker in the modal. */
.sort-picker { position: relative; }
.sort-picker.open { z-index: 7; }
.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  /* Matches .filter-toggle exactly so the two pills sit on one line. */
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.sort-btn:hover { background: var(--surface-2); }
.sort-btn:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sort-picker.open .sort-btn { background: var(--surface-2); border-color: var(--text); }
.sort-key { font-size: 13px; color: var(--text-muted); }
.sort-chev {
  font-size: 13px;
  line-height: 1;
  color: var(--text-muted);
  transition: transform .2s ease;
}
.sort-picker.open .sort-chev { transform: rotate(180deg); }

.sort-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 7;
  display: none;
  min-width: 250px;
  max-width: min(320px, 82vw);
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  /* Sized so all eight modes fit unscrolled even when every one of them is
     idle and showing its note — the scrollbar is a short-viewport fallback,
     not the normal state. */
  max-height: min(60vh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sort-picker.open .sort-menu { display: block; }
.sort-opt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 9px 11px;
  border: none;
  background: none;
  border-radius: var(--radius-xs);
  font: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.sort-opt:hover { background: var(--surface-2); }
.sort-opt:focus-visible { outline: none; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--accent); }
.sort-opt.active { background: var(--accent-soft); color: var(--accent); }
.sort-opt-name { font-size: 13px; font-weight: 600; }
.sort-opt-note { font-size: 11.5px; color: var(--text-muted); }
/* Only an idle mode carries a note. Collapsing the empty span (rather than
   leaving it to contribute the flex gap) keeps a live row one line tall, which
   is what fits all eight modes in the menu without it scrolling. */
.sort-opt-note:empty { display: none; }
.sort-opt.active .sort-opt-note {
  color: color-mix(in srgb, var(--accent) 65%, var(--text-muted));
}
/* A mode whose data the scraper hasn't filled in yet — still selectable, but
   it says why picking it won't move anything. */
.sort-opt.is-idle .sort-opt-name { color: var(--text-muted); }
.filter-result { font-size: 13px; color: var(--text-muted); margin-left: auto; }

.filter-panel {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 4px 20px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: max-height .28s ease, opacity .22s ease, padding .28s ease;
}
.filter-panel.open {
  /* Enough facets now that a narrow screen stacks them past any fixed height,
     so the panel scrolls rather than clipping the last few. */
  max-height: min(72vh, 1400px);
  overflow-y: auto;
  opacity: 1;
  padding: 18px 22px;
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.facet { padding: 8px 0; border-bottom: 1px solid var(--border); }
.filter-panel .facet:last-child,
.filter-panel .facet:nth-last-child(2):nth-child(odd) { border-bottom: none; }
.facet-head {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  background: none; border: none; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 700; color: var(--text);
  padding: 4px 0;
}
.facet-chev { color: var(--text-muted); transition: transform .2s ease; }
.facet.collapsed .facet-chev { transform: rotate(-90deg); }
.facet-body {
  display: flex; flex-wrap: wrap; gap: 7px;
  padding-top: 10px;
}
.facet.collapsed .facet-body { display: none; }
.filter-chip.toggle.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ============================================================
   Build-list item cards (Good CPUs, Good AIOs, …)
   ============================================================ */
/* Four per row instead of three — 250px is the widest minmax that still
   leaves room for a fourth column inside the 1072px container, with the gap
   trimmed to match (mirrors the same trade-off .builds-grid makes). Card
   internals scale down a notch with it, same as .builds-grid does for .card. */
.items-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.item-card {
  display: grid;
  grid-template-columns: 66px 1fr;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.item-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.item-thumb {
  width: 66px; height: 66px;
  border-radius: var(--radius-xs);
  overflow: hidden;
  background: var(--surface-2);
}
.item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-thumb .placeholder { font-size: 9px; height: 100%; }
.item-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.item-top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.item-name { font-size: 14px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.brand-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .03em;
  padding: 3px 7px; border-radius: var(--radius-pill);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-muted); white-space: nowrap;
}
.item-note { font-size: 11.5px; color: var(--text-muted); margin: 0; }
.item-foot {
  margin-top: auto; padding-top: 7px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 8px;
}
.item-foot .price { font-size: 15.5px; }
.item-foot .price-source { padding: 5px 9px; font-size: 10.5px; }

/* ============================================================
   Detail modal
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 20px;
  background: color-mix(in srgb, #000 46%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .18s ease;
}
.modal-overlay.show { opacity: 1; }
.modal {
  position: relative;
  width: min(680px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  transform: translateY(14px) scale(.98);
  transition: transform .2s cubic-bezier(.2,.7,.3,1);
}
.modal-overlay.show .modal { transform: translateY(0) scale(1); }
.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  z-index: 2;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(6px);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s ease;
}
.modal-close:hover { background: var(--surface-2); }
.modal-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
}
.modal-thumb img { width: 100%; height: 100%; object-fit: cover; }
.modal-thumb .placeholder { height: 100%; }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.modal-title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.modal-desc { color: var(--text-muted); font-size: 14.5px; margin: 0; }
.modal-price-row {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.modal-price-row .price { font-size: 28px; }

.comp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.comp-table td { padding: 9px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.comp-table tr:last-child td { border-bottom: none; }
.comp-type {
  width: 24%; color: var(--text-muted); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em; padding-right: 16px;
}
.comp-name { font-weight: 500; }

.modal-section-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 4px;
}
.modal-secondary {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  align-self: flex-start;
  margin-top: -4px;
}
.modal-secondary:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Price chart */
.price-chart { display: flex; flex-direction: column; gap: 6px; }
.spark-head {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text-muted); font-weight: 600;
}
.spark-range { font-weight: 500; }

.chart-frame { position: relative; }
.chart-svg { width: 100%; height: 130px; display: block; cursor: crosshair; touch-action: pan-y; }
.spark-stroke { stroke: var(--text); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark-fill { fill: color-mix(in srgb, var(--text) 8%, transparent); }
.chart-down .spark-stroke { stroke: var(--accent); }
.chart-down .spark-fill { fill: var(--accent-soft); }

.chart-crosshair {
  stroke: var(--border-strong);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0;
  transition: opacity .12s ease;
}
.chart-hover-dot {
  fill: var(--surface);
  stroke: var(--text);
  stroke-width: 2;
  opacity: 0;
  transition: opacity .12s ease;
}
.chart-down .chart-hover-dot { stroke: var(--accent); }
.price-chart.is-hovering .chart-crosshair,
.price-chart.is-hovering .chart-hover-dot { opacity: 1; }

.chart-tooltip {
  position: absolute;
  top: 0; left: 50%;
  margin-top: -8px;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  font-size: 11.5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
  z-index: 2;
}
.chart-tooltip.align-start { transform: translate(0, -100%); }
.chart-tooltip.align-end { transform: translate(-100%, -100%); }
.price-chart.is-hovering .chart-tooltip { opacity: 1; }
.chart-tooltip-date { color: var(--text-muted); font-weight: 600; }
.chart-tooltip-price { color: var(--text); font-weight: 800; font-size: 13px; }

/* ============================================================
   Limited builds — purple/pink frame, pinned above everything
   ============================================================ */
:root {
  --limited-a: #a855f7;
  --limited-b: #ec4899;
  --limited-c: #f0abfc;
}

.featured { position: relative; }

.card.is-limited,
.featured.is-limited {
  border-color: transparent;
  box-shadow: 0 10px 34px color-mix(in srgb, var(--limited-b) 15%, transparent), var(--shadow-sm);
}
.card.is-limited:hover,
.featured.is-limited:hover {
  border-color: transparent;
  box-shadow: 0 18px 52px color-mix(in srgb, var(--limited-b) 26%, transparent), var(--shadow-lg);
}
/* Gradient ring that follows the card's own rounded corners. */
.card.is-limited::after,
.featured.is-limited::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(135deg, var(--limited-a), var(--limited-b) 55%, var(--limited-c));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
          mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

.badge-limited {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 5;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  color: #fff;
  background: linear-gradient(135deg, var(--limited-a), var(--limited-b));
  box-shadow: 0 4px 14px color-mix(in srgb, var(--limited-b) 40%, transparent);
}
.pill-tag.pill-limited {
  color: #fff;
  background: linear-gradient(135deg, var(--limited-a), var(--limited-b));
}

/* The modal scrolls, so it uses a real gradient border instead of an overlay. */
.modal.is-limited {
  border: 2px solid transparent;
  background-image:
    linear-gradient(var(--surface), var(--surface)),
    linear-gradient(135deg, var(--limited-a), var(--limited-b) 55%, var(--limited-c));
  background-origin: border-box;
  background-clip: padding-box, border-box;
}
.modal.is-limited .modal-thumb {
  border-radius: calc(var(--radius) - 3px) calc(var(--radius) - 3px) 0 0;
}

/* ============================================================
   Build type switch (All · Gaming · Workstation · AI · Homeserver)
   ============================================================ */
/* Its own row above the filter bar rather than a pill inside it: five segments
   is too much to sit beside Filters and Sort, and this is the coarsest cut in
   the catalogue — it deserves to read as a set of tabs, not a control. */
.type-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  margin-bottom: 14px;
  max-width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  /* Five labels outrun a narrow viewport long before they outrun a phone's
     ability to swipe them. Scrolling keeps every type reachable without
     stacking the switch into a wall of buttons. */
  overflow-x: auto;
  scrollbar-width: none;
}
.type-switch::-webkit-scrollbar { display: none; }
.type-opt {
  padding: 7px 17px;
  border: none;
  background: none;
  border-radius: var(--radius-pill);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}
.type-opt:hover { color: var(--text); }
.type-opt.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.type-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  max-width: 620px;
}
/* Which case-color parts to show on the Build Lists page — same pill switch
   as .type-switch, under its own class since it filters by `color`, not
   `type`. */
.finish-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  margin-bottom: 22px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}
.finish-opt {
  padding: 7px 17px;
  border: none;
  background: none;
  border-radius: var(--radius-pill);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}
.finish-opt:hover { color: var(--text); }
.finish-opt.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
/* What a build is for, on the picture. Bottom-left so it never collides with
   the tier badge above it or the NEW/LIMITED corner opposite. */
.badge-type {
  position: absolute;
  bottom: 12px; left: 12px;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* ============================================================
   Clickable components (modal)
   ============================================================ */
/* One line per part: the name is the link to this region's shop, and the ↗
   sitting in the text next to it is a separate control that opens the
   availability dialog. Two targets, two jobs — following the part and asking
   about it are never the same click. */
.comp-item { display: block; }
.comp-item + .comp-item { margin-top: 7px; }
.comp-link {
  font-weight: 500;
  color: var(--text);
  border-bottom: 1px solid transparent;
  transition: color .14s ease, border-color .14s ease;
}
.comp-link:hover,
.comp-link:focus-visible {
  color: var(--accent);
  border-bottom-color: color-mix(in srgb, var(--accent) 45%, transparent);
  outline: none;
}
/* Dashed = the link is a search for the part name, not a pinned product page. */
.comp-link.is-search { border-bottom-color: var(--border-strong); border-bottom-style: dashed; }
.comp-more {
  margin-left: 6px;
  padding: 0 3px;
  border: none;
  background: none;
  font: inherit;
  font-size: 10px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  vertical-align: 1px;
  transition: color .14s ease;
}
.comp-more:hover,
.comp-more:focus-visible { color: var(--accent); outline: none; }

/* [DDR4], [B550], [AM5] — the platform-critical fact, in its own column so
   the footnotes line up down the table instead of crowding each link. */
.comp-meta {
  width: 17%;
  text-align: center;
  padding-left: 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: .01em;
}
.modal-hint {
  margin: 6px 0 -4px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================================
   Sub-version dropdown (modal)
   ============================================================ */
.modal-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.modal-title-row .modal-title { flex: 1 1 auto; min-width: 0; }

.variant-picker { position: relative; flex: 0 0 auto; }
.variant-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 210px;
  padding: 7px 13px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-pill);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.variant-btn:hover { background: var(--surface-2); border-color: var(--text); }
.variant-current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.variant-chev {
  font-size: 13px;
  line-height: 1;
  color: var(--text-muted);
  transition: transform .2s ease;
}
.variant-picker.open .variant-chev { transform: rotate(180deg); }

.variant-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 6;
  display: none;
  min-width: 240px;
  max-width: min(320px, 78vw);
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}
.variant-picker.open .variant-menu { display: block; }
.variant-opt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 9px 11px;
  border: none;
  background: none;
  border-radius: var(--radius-xs);
  font: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.variant-opt:hover { background: var(--surface-2); }
.variant-opt.active { background: var(--accent-soft); color: var(--accent); }
.variant-opt-name { font-size: 13px; font-weight: 600; }
.variant-opt-note { font-size: 11.5px; color: var(--text-muted); }
.variant-opt.active .variant-opt-note {
  color: color-mix(in srgb, var(--accent) 65%, var(--text-muted));
}

/* Rank weight. Inset shadows rather than real borders so switching weight
   never shifts the row by a pixel. */
.variant-opt.rank-top { box-shadow: inset 0 0 0 2px var(--text); }
.variant-opt.rank-main { box-shadow: inset 0 0 0 1px var(--border-strong); }
.variant-opt.rank-other { box-shadow: none; }
.variant-opt.rank-top.active { box-shadow: inset 0 0 0 2px var(--accent); }
.variant-opt.rank-main.active { box-shadow: inset 0 0 0 1px var(--accent); }

.variant-group {
  padding: 10px 11px 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.variant-menu > .variant-group:first-child { padding-top: 4px; }
/* Twenty iterations has to scroll rather than run off the screen. */
.variant-menu { max-height: min(52vh, 380px); overflow-y: auto; overscroll-behavior: contain; }
.variant-count {
  min-width: 17px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 16px;
  text-align: center;
}

/* ============================================================
   Price range — two native sliders stacked on one track
   ============================================================ */
.facet-range { grid-column: 1 / -1; }
.facet-range .facet-body { display: block; padding-top: 6px; }
.range-slider {
  position: relative;
  height: 52px;
  margin: 4px 13px 2px;
  --a: 0%;
  --b: 100%;
}
.range-track,
.range-fill {
  position: absolute;
  top: 22px;
  height: 10px;
  border-radius: 5px;
  transform: translateY(-50%);
  pointer-events: none;
}
.range-track { left: -13px; right: -13px; background: var(--surface-2); border: 1px solid var(--border-strong); }
.range-fill { left: var(--a); right: calc(100% - var(--b)); background: var(--accent); }

/* One mark per stop — makes the notched, non-linear scale legible. */
.range-ticks { position: absolute; inset: 0; pointer-events: none; }
.range-ticks span {
  position: absolute;
  top: 34px;
  width: 2px; height: 6px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--border-strong);
}

.range-input {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 44px;
  margin: 0;
  background: none;
  -webkit-appearance: none;
  appearance: none;
  /* Only the thumbs are interactive, so the two inputs don't block each other. */
  pointer-events: none;
}
.range-input:focus { outline: none; }
.range-min { z-index: 3; }
.range-max { z-index: 4; }
.range-input::-webkit-slider-runnable-track { height: 44px; background: transparent; }
.range-input::-moz-range-track { height: 44px; background: transparent; }
.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent);
  box-shadow: var(--shadow-md);
  cursor: grab;
  transition: transform .12s ease;
}
.range-input::-moz-range-thumb {
  pointer-events: auto;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent);
  box-shadow: var(--shadow-md);
  cursor: grab;
}
.range-input:hover::-webkit-slider-thumb { transform: scale(1.08); }
.range-input:active::-webkit-slider-thumb { cursor: grabbing; transform: scale(1.16); }
.range-input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-soft); }
.range-input:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px var(--accent-soft); }

.range-readout {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Tags (#woodgrain, #fishtank, …)
   ============================================================ */
.card-tags, .modal-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.modal-tags { margin: -4px 0 2px; }
.tag-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}
.tag-chip.is-more { background: var(--surface-2); color: var(--text-muted); }
.tag-chip.is-link { transition: background .14s ease, color .14s ease; }
.tag-chip.is-link:hover { background: var(--accent); color: #fff; }
.filter-chip.toggle.is-tag { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.filter-chip.toggle.is-tag.active { color: #fff; }

/* Marks a card that is a sub-version surfaced by search, not a build. */
.variant-flag {
  align-self: flex-start;
  margin-top: -4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ============================================================
   Search
   ============================================================ */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 520px;
}
.search-ico {
  position: absolute;
  left: 16px;
  font-size: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 12px 40px 12px 40px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  transition: border-color .15s ease, box-shadow .15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.search-input::-webkit-search-cancel-button { display: none; }
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-clear {
  position: absolute;
  right: 8px;
  width: 26px; height: 26px;
  display: grid;
  place-items: center;
  border: none;
  background: var(--surface-2);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.search-clear:hover { background: var(--text); color: var(--bg); }
.spec-chip.is-versions {
  border-color: var(--border-strong);
  color: var(--text);
  font-weight: 600;
}

/* ============================================================
   Build-list shop link
   ============================================================ */
.list-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}
.list-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.list-link:hover {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* ============================================================
   Missing region link (opens the notice below; 404.html is the fallback href)
   ============================================================ */
.price-source.is-missing,
.list-link.is-missing {
  border-style: dashed;
  border-color: var(--border-strong);
  color: var(--text-muted);
  opacity: .8;
}
.price-source.is-missing:hover,
.list-link.is-missing:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--text-muted);
  opacity: 1;
}
.modal-missing {
  margin: -4px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ============================================================
   "Currently unavailable" notice
   Its own overlay rather than the detail modal's, because it stacks on top of
   one — hence the z-index above .modal-overlay and the lighter scrim.
   ============================================================ */
.notice-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  place-items: center;
  padding: 20px;
  background: color-mix(in srgb, #000 38%, transparent);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .16s ease;
}
.notice-overlay.show { opacity: 1; }
.notice {
  position: relative;
  width: min(400px, 100%);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(.97);
  transition: transform .18s cubic-bezier(.2,.7,.3,1);
}
.notice-overlay.show .notice { transform: none; }
.notice-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s ease, color .15s ease;
}
.notice-close:hover { background: var(--surface-2); color: var(--text); }
.notice-title {
  margin: 0;
  padding-right: 32px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.notice-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-muted);
}
.notice-body strong { color: var(--text); font-weight: 700; }
/* One row per shop, the visitor's own region ringed. A shop with nothing to
   open is still listed — "Amazon · none yet" is an answer. */
.notice-sources { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.notice-source {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  transition: background .14s ease, border-color .14s ease;
}
a.notice-source:hover,
a.notice-source:focus-visible { background: var(--surface-2); border-color: var(--text-muted); outline: none; }
.notice-source.is-current { border-color: var(--accent); }
.notice-source.is-none { border-style: dashed; opacity: .65; }
.notice-source-shop { font-size: 13.5px; font-weight: 700; }
.notice-source-note { font-size: 11.5px; color: var(--text-muted); }
.notice-source-go { margin-left: auto; font-size: 11px; color: var(--text-muted); }
.notice-fineprint {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}
.notice-actions { display: flex; justify-content: flex-end; margin-top: 4px; }
.notice-actions .btn { padding: 9px 18px; font-size: 13.5px; }

/* ============================================================
   404
   ============================================================ */
.notfound {
  max-width: 620px;
  margin: 0 auto;
  padding: 90px 0 60px;
  text-align: center;
}
.notfound-code {
  font-size: clamp(72px, 16vw, 140px);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--surface-2);
  -webkit-text-stroke: 1px var(--border-strong);
}
[data-theme="dark"] .notfound-code { color: var(--surface-2); }
.notfound-title {
  font-size: clamp(26px, 5vw, 38px);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 8px 0 12px;
}
.notfound-sub {
  font-size: 16px;
  color: var(--text-muted);
  margin: 0 auto 12px;
  max-width: 460px;
}
.notfound-sub strong { color: var(--text); font-weight: 700; }
.notfound-note {
  font-size: 13.5px;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 0 auto 26px;
  max-width: 480px;
  text-align: left;
}
.notfound-note strong { color: var(--text); font-weight: 700; }
.notfound .hero-actions { justify-content: center; }

/* ============================================================
   Under construction
   ============================================================ */
.soon {
  max-width: 620px;
  margin: 0 auto;
  padding: 90px 0 60px;
  text-align: center;
}
/* Four bars filling at a stagger — a progress hint rather than a spinner,
   since nothing here is actually loading. */
.soon-bars {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-bottom: 26px;
}
.soon-bars span {
  width: 34px;
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  animation: soon-fill 2.4s ease-in-out infinite;
}
.soon-bars span:nth-child(2) { animation-delay: .2s; }
.soon-bars span:nth-child(3) { animation-delay: .4s; }
.soon-bars span:nth-child(4) { animation-delay: .6s; }
@keyframes soon-fill {
  0%, 70%, 100% { background: var(--surface-2); }
  25%, 45% { background: var(--accent); border-color: var(--accent); }
}
@media (prefers-reduced-motion: reduce) {
  .soon-bars span { animation: none; }
  .soon-bars span:first-child { background: var(--accent); border-color: var(--accent); }
}
.soon-title {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 16px 0 12px;
}
.soon-sub {
  font-size: 16px;
  color: var(--text-muted);
  margin: 0 auto 12px;
  max-width: 460px;
}
.soon-sub strong { color: var(--text); font-weight: 700; }
.soon-link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.soon-note {
  font-size: 13.5px;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 0 auto 26px;
  max-width: 480px;
  text-align: left;
}
.soon .hero-actions { justify-content: center; }

/* ============================================================
   Resources
   ============================================================ */
.res-block + .res-block { margin-top: 46px; }
.res-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.res-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.res-card:not(.is-flat):hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.res-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  overflow: hidden;
}
.res-thumb img { width: 100%; height: 100%; object-fit: cover; }
.res-thumb .placeholder {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  color: var(--text-muted);
  font-size: 13px;
  background: radial-gradient(120% 120% at 100% 0%, var(--surface-2), var(--surface));
}
.res-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text) 78%, transparent);
  color: var(--bg);
  font-size: 15px;
  padding-left: 3px; /* optical centring — the ▶ glyph sits left of its box */
  transition: transform .18s ease;
}
.res-card:hover .res-play { transform: scale(1.08); }
.res-body { padding: 16px 17px 18px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.res-title { font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.res-note { font-size: 13px; color: var(--text-muted); margin: 0; }
.res-meta {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.res-dot { opacity: .5; }

/* ============================================================
   PC Builder
   ============================================================ */
/* Slots on the left, the running total on the right and sticky — the total is
   what every click is aimed at, so it shouldn't scroll away while you're eight
   slots down choosing a case. */
/* Sized a notch below its original spacing so the whole builder reads a bit
   more "zoomed out" — more of the slot list and the summary panel visible
   at once without scrolling. */
.bld-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 22px;
  padding-bottom: 40px;
}
.bld-slots { display: flex; flex-direction: column; gap: 8px; }

.bld-slot {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color .16s ease, box-shadow .16s ease;
}
/* A slot in a compatibility problem is ringed rather than tinted: the row still
   has to be readable, and the reason is written underneath it either way. */
.bld-slot.has-error { border-color: color-mix(in srgb, #ef4444 55%, var(--border)); }
.bld-slot.has-warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }

/* Flex rather than grid: an empty slot renders no price and no ✕, and fixed
   grid columns would leave the chevron stranded mid-row on those. */
.bld-slot-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: none;
  background: none;
  font: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .14s ease;
}
.bld-slot-head:hover { background: var(--surface-2); }
.bld-slot-label {
  flex: none;
  width: 108px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.bld-slot-value { flex: 1; min-width: 0; }
.bld-slot-name {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bld-slot-empty { font-size: 12.5px; color: var(--text-muted); }
.bld-clear {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 11px;
  transition: background .14s ease, color .14s ease;
}
.bld-clear:hover { background: var(--surface-2); color: var(--text); }
.bld-chev {
  flex: none;
  color: var(--text-muted);
  font-size: 15px;
}

/* The warnings/errors box in the summary panel — see .bld-summary below.
   Reuses .bld-issue, which used to live inline under each slot; now the
   slot border (.has-error / .has-warn above) is the only per-slot pointer,
   and this box is the one place the actual text shows up. */
.bld-issues {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 11px 13px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.bld-issue {
  margin: 0;
  display: flex;
  gap: 8px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-muted);
}
.bld-issue span { font-weight: 700; flex: none; }
.bld-issue.is-error span { color: #ef4444; }
.bld-issue.is-warn span { color: var(--warn); }

.bld-opt {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border: none;
  background: none;
  font: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .14s ease;
}
.bld-opt + .bld-opt { border-top: 1px solid var(--border); }
.bld-opt:hover { background: var(--surface-2); }
.bld-opt.active { background: var(--accent-soft); }
.bld-opt-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bld-opt-top { display: flex; align-items: center; gap: 8px; }
.bld-opt-name { font-size: 14px; font-weight: 600; }
.bld-opt.active .bld-opt-name { color: var(--accent); }
.bld-opt-note { font-size: 12.5px; color: var(--text-muted); }
.bld-opt-facts {
  font-size: 11.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  opacity: .85;
}
.bld-pick-thumb {
  flex: none;
  align-self: center;
  width: 52px; height: 52px;
  border-radius: var(--radius-xs);
  overflow: hidden;
  background: var(--surface-2);
}
.bld-pick-thumb img { width: 100%; height: 100%; object-fit: cover; }
.bld-pick-thumb .placeholder { font-size: 9px; height: 100%; }

/* ---------- Picker modal ----------
   The large modal used to choose a part for a slot — search, sort and a
   brand filter over one slot's curated options. Shares .modal/.modal-overlay
   chrome with the build detail modal in app.js. */
.bld-picker { width: min(760px, 100%); max-height: 88vh; display: flex; flex-direction: column; padding: 0; }
.bld-pick-head {
  flex: none;
  padding: 24px 48px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.bld-pick-title { font-size: 18px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.bld-pick-search {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
}
.bld-pick-search:focus { outline: none; border-color: var(--accent); }
.bld-pick-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bld-pick-sort {
  flex: none;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.bld-pick-brands { display: flex; flex-wrap: wrap; gap: 6px; }
.bld-pick-brand {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s ease, color .14s ease, border-color .14s ease;
}
.bld-pick-brand:hover { color: var(--text); }
.bld-pick-brand.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.bld-pick-list { overflow-y: auto; flex: 1; }
.bld-pick-empty { padding: 32px 24px; }

.bld-price {
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.bld-price.is-pending { color: var(--text-muted); font-weight: 500; }

/* --- Summary --- */
.bld-summary {
  position: sticky;
  top: calc(var(--nav-h) + 14px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 17px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.bld-summary-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bld-summary-title { font-size: 15px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.bld-verdict {
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .03em;
  white-space: nowrap;
}
.bld-verdict.is-ok { background: var(--accent-soft); color: var(--accent); }
.bld-verdict.is-idle { background: var(--surface-2); color: var(--text-muted); }
.bld-verdict.is-warn {
  background: color-mix(in srgb, var(--warn) 14%, transparent);
  color: var(--warn);
}
.bld-verdict.is-error {
  background: color-mix(in srgb, #ef4444 14%, transparent);
  color: #ef4444;
}

.bld-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.bld-total-label { font-size: 11.5px; color: var(--text-muted); }
.bld-total-part { opacity: .8; }
.bld-total-value {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.bld-hint { margin: 0; font-size: 11px; line-height: 1.5; color: var(--text-muted); }
.bld-hint code {
  font-size: 10.5px;
  background: var(--surface-2);
  padding: 1px 4px;
  border-radius: 4px;
}
.bld-fetch { justify-content: center; width: 100%; }
.bld-fetch[disabled] { opacity: .6; cursor: default; }
.bld-stat {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.bld-missing { margin: 0; font-size: 11.5px; line-height: 1.5; color: var(--text-muted); }
.bld-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bld-actions .btn { padding: 8px 12px; font-size: 11.5px; flex: 1; justify-content: center; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 860px) {
  .featured { grid-template-columns: 1fr; }
  .featured .card-thumb { min-height: 220px; }
  .info-strip { grid-template-columns: 1fr; padding: 28px; gap: 26px; }
  /* The total moves above the slots rather than below them: on a phone the
     bottom of a nine-slot list is a long way from the top. */
  .bld-wrap { grid-template-columns: 1fr; }
  .bld-summary { position: static; order: -1; }
}
@media (max-width: 640px) {
  .brand { display: none; }
  .nav-bubble { padding: 8px; }
  .nav-link { padding: 9px 12px; }
  .field-row { grid-template-columns: 1fr; }
  .hero { padding-top: 48px; }
  /* Five destinations plus Discord outgrow the bubble well before they outgrow
     a swipe. Scrolling keeps every link reachable without a hamburger. */
  .nav-links {
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  /* Two lines: the label above the part, so a long name gets the full width. */
  .bld-slot-head { flex-wrap: wrap; row-gap: 2px; }
  .bld-slot-label { width: 100%; }
}
@media (max-width: 480px) {
  .nav-link[data-nav="discord"] span, .nav-discord { font-size: 0; }
  .nav-discord svg { width: 18px; height: 18px; }
  .nav-link { padding: 9px 11px; font-size: 13px; }
  .region-code { display: none; }
  .region-toggle { padding: 0 10px; }
  .filter-result { width: 100%; margin-left: 0; }
  .type-switch { width: 100%; }
  .type-opt { padding: 8px 13px; }
  .sort-picker { width: 100%; }
  .sort-btn { width: 100%; }
  .sort-chev { margin-left: auto; }
  .sort-menu { width: 100%; max-width: none; }
  .variant-picker { width: 100%; }
  .variant-btn { max-width: none; width: 100%; justify-content: space-between; }
  .variant-menu { right: auto; left: 0; width: 100%; max-width: none; }
}
