:root {
  --accent: #1565c0;
  --accent-dark: #0d47a1;
  --text: #1d2630;
  --muted: #5f6b76;
  --line: #e4e8ec;
  --bg-page: #eef1f5;
  --bg: #ffffff;
  --bg-soft: #f4f6f8;
  --good: #1e7e34;
  --bad: #b02a37;
  --footer-bg: #1b2734;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 2px 8px rgba(16, 24, 40, .06);
  --container: 1200px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg-page);
}

.container { max-width: var(--container); margin: 0 auto; padding: 0 1rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.45rem; line-height: 1.3; margin: 1.4rem 0 .6rem; }
h2 { font-size: 1.1rem; margin: 1.4rem 0 .4rem; }

.muted { color: var(--muted); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-top: .85rem;
  padding-bottom: .85rem;
}
.logo {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
  white-space: nowrap;
}
.logo span { color: var(--accent); }
.logo:hover { text-decoration: none; }

.site-footer { margin-top: 1.5rem; background: var(--footer-bg); color: #fff; }
.site-footer .container {
  padding-top: 2rem;
  padding-bottom: 2.5rem;
}

.footer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.5rem; }
.footer-grid h2 {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: rgba(255, 255, 255, .55);
  margin: 0 0 .7rem;
}
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin: 0 0 .4rem; break-inside: avoid; }
.footer-grid a { color: rgba(255, 255, 255, .85); font-size: .9rem; }
.footer-grid a:hover { color: #fff; }
.footer-cats { grid-column: span 2; }
.footer-cats ul { columns: 2; column-gap: 2.5rem; }
.footer-note { margin: 1.8rem 0 0; color: rgba(255, 255, 255, .6); font-size: .8rem; }
.footer-legal { margin: .5rem 0 0; color: rgba(255, 255, 255, .45); font-size: .75rem; }

.prose > :first-child { margin-top: 0; }
.prose h2 { margin-top: 1.6rem; }
.prose p { line-height: 1.6; }
.prose code { background: var(--bg-soft); padding: .1em .35em; border-radius: 4px; font-size: .9em; }

main.container { padding-top: .5rem; padding-bottom: 1rem; min-height: 60vh; }

.stack-form { margin-top: 1rem; }
.stack-form .field { margin: 0 0 1.1rem; }
.stack-form label { display: block; font-weight: 500; margin-bottom: .3rem; }
.stack-form .field.check label { font-weight: 400; }
.stack-form .req { color: var(--bad); }
.stack-form input[type=text],
.stack-form input[type=url],
.stack-form input[type=email],
.stack-form select,
.stack-form textarea {
  width: 100%;
  max-width: 32rem;
  padding: .55rem .7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
}
.stack-form textarea { max-width: 40rem; resize: vertical; }
.stack-form input:focus,
.stack-form select:focus,
.stack-form textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(21, 101, 192, .15); }
.stack-form .field.check label { display: flex; align-items: center; gap: .5rem; max-width: 40rem; }
.stack-form .field.check input { width: auto; flex: none; }
.stack-form .has-error input,
.stack-form .has-error select,
.stack-form .has-error textarea { border-color: var(--bad); }
.stack-form .field-error { display: block; margin-top: .3rem; color: var(--bad); font-size: .85rem; }
.stack-form button { border: 0; cursor: pointer; font: inherit; }
.form-error { color: var(--bad); font-weight: 500; }
.form-ok { color: var(--good); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.searchbar { display: flex; flex: 1; max-width: 560px; }
.search-field .search-go {
  flex: none;
  margin: .15rem;
  padding: .4rem 1.2rem;
  font: inherit;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.search-field .search-go:hover { background: var(--accent-dark); }

.hero {
  text-align: center;
  padding: 3.25rem 1.5rem 3rem;
  margin: .5rem 0 1rem;
  border-radius: 20px;
  color: #fff;
  background:
    radial-gradient(130% 130% at 82% 8%, rgba(33, 118, 214, .75), transparent 62%),
    linear-gradient(135deg, #3a4757 0%, #2a323d 100%);
  box-shadow: 0 10px 30px rgba(16, 24, 40, .14);
}
.hero h1 { font-size: 2rem; margin: 0 0 .35rem; }
.hero-break { display: none; }
.hero p { margin: 0; color: rgba(255, 255, 255, .72); }
.hero .searchbar {
  margin: 1.5rem auto 0;
  max-width: 640px;
}
.hero .search-field {
  background: var(--bg);
  box-shadow: var(--shadow);
}

.hero .search-field:focus-within {
  outline-color: #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(43, 138, 230, .35);
}
.hero .search-field input {
  padding: .8rem 1.4rem;
  font-size: 1.05rem;
}
.hero .search-field .scan-btn,
.hero .search-field .search-submit { padding: .55rem; }
.hero .search-field .search-go {
  margin: .3rem;
  padding: .55rem 1.5rem;
  font-size: 1.05rem;
}

.card {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
  margin: 1rem 0;
}
.card.pad { padding: 1.25rem 1.5rem; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--line); }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); white-space: nowrap; }
.card th { background: var(--bg-soft); border-bottom: 0; }
.card tr:last-child td { border-bottom: 0; }
.card th:first-child, .card td:first-child { padding-left: 1.25rem; }
.card th:last-child, .card td:last-child { padding-right: 1.25rem; }

.listing tr:hover td { background: #f8fafc; }
.listing td a { color: var(--text); font-weight: 500; }
.listing td a:hover { color: var(--accent); }

.price { font-weight: 650; white-space: nowrap; }

.thumb { width: 64px; }

.thumb-figure {
  display: inline-flex;
  width: 52px;
  height: 52px;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}
.thumb-figure img { max-width: 100%; max-height: 100%; object-fit: contain; }

.product-strip-wrap { position: relative; }
.product-strip {
  display: flex;
  gap: .9rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;

  scrollbar-width: none;

  padding: .25rem .25rem .9rem;

  scroll-padding: 0 .25rem;
  margin: 1rem -.25rem;
}
.product-strip::-webkit-scrollbar { display: none; }

.strip-arrow {
  position: absolute;

  top: calc(50% - .35rem);
  transform: translateY(-50%);
  z-index: 1;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 2px 4px rgba(16, 24, 40, .1), 0 6px 16px rgba(16, 24, 40, .14);
  cursor: pointer;

  -webkit-tap-highlight-color: transparent;
}
.strip-arrow:hover { color: var(--accent); border-color: var(--accent); }
.strip-arrow[hidden] { display: none; }
.strip-prev { left: -13px; }
.strip-next { right: -13px; }
.product-card {
  flex: 0 0 180px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
}
.product-card:hover {
  text-decoration: none;
  box-shadow: 0 2px 4px rgba(16, 24, 40, .08), 0 6px 16px rgba(16, 24, 40, .12);
}
.product-card:hover .product-card-name { color: var(--accent); }
.product-card-img {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .7rem;
}
.product-card-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.product-card-name {
  font-weight: 500;
  font-size: .9rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card-offers { font-size: .8rem; margin: auto 0 .15rem; padding-top: .4rem; }

.price-drop-row { display: flex; align-items: center; gap: .35rem; margin-bottom: .1rem; white-space: nowrap; }
.price-was { color: var(--muted); text-decoration: line-through; font-weight: 400; font-size: .8rem; }
.price-drop { color: #fff; background: var(--good); font-weight: 600; font-size: .72rem; line-height: 1.4; padding: 0 .32rem; border-radius: 6px; }

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  background: var(--bg-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  margin: 1rem 0;
}

.breadcrumb { font-size: .85rem; margin: 1rem 0 .2rem; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.breadcrumb span[aria-hidden] { color: var(--line); }

.category-chips { list-style: none; padding: 0; margin: .6rem 0 1.2rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.category-chips a {
  display: inline-block;
  padding: .35rem .8rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: .9rem;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}

.category-chips a:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  text-decoration: none;
}
.category-chips .muted { font-size: .8rem; color: var(--accent); }
.category-chips a:hover .muted { color: #fff; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin: .5rem 0 1rem;
}
.product-grid .product-card { flex: initial; }

.pager { margin: 1.5rem 0; display: flex; gap: 1rem; align-items: center; }

.meta { color: var(--muted); font-size: .85rem; margin-bottom: 1rem; }

.intro {
  display: flex;
  gap: 1.75rem;
  align-items: flex-start;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin: 1rem 0;
}

.intro-figure {
  flex: none;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.intro-figure img { max-width: 100%; max-height: 100%; object-fit: contain; }
.description-col { flex: 1; min-width: 0; }
.description { margin: 0; min-width: 0; }

.description > :first-child { margin-top: 0; }
.description > :last-child { margin-bottom: 0; }
.description p { margin: .5rem 0; }
.description ul, .description ol { margin: .5rem 0; padding-left: 1.25rem; }
.description li { margin: .2rem 0; }

.description.clamped { max-height: var(--desc-max, 200px); overflow: hidden; position: relative; }
.description.clamped::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2.5rem;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}
.description-more {
  background: none; border: 0; padding: 0; margin: .35rem 0 0;
  color: var(--accent); font: inherit; cursor: pointer;
}
.description-more:hover { text-decoration: underline; }

.oos { color: var(--bad); }
.instock { color: var(--good); }

.shipping { color: var(--muted); white-space: nowrap; }
.shipping.free { color: var(--good); }

.merchant-logo {
  height: 22px;
  max-width: 90px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: .45rem;
}

.buy {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: .45rem 1.1rem;
  border-radius: 999px;
  font-weight: 500;
  white-space: nowrap;
}
.buy:hover { background: var(--accent-dark); text-decoration: none; }

.pager { margin: 1.25rem 0; color: var(--muted); }

.search-field {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--bg-soft);
}
.search-field:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  background: var(--bg);
}
.search-field input {
  flex: 1;
  min-width: 0;
  padding: .55rem 1.1rem;
  font: inherit;
  border: 0;
  background: transparent;
}
.search-field input:focus { outline: 0; }

.search-field .scan-btn,
.search-field .search-submit {
  flex: none;
  display: flex;
  padding: .45rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.search-field .scan-btn[hidden] { display: none; }
.search-field .scan-btn:hover { color: var(--text); background: var(--line); }

.search-field .search-submit { display: none; }
.search-field svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

#scan-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(13, 18, 25, .94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem;
}
#scan-overlay[hidden] { display: none; }
#scan-overlay video {
  width: min(100%, 440px);
  max-height: 60vh;
  border-radius: var(--radius);
  background: #000;
}
.scan-hint { margin: 0; color: #cbd5e1; text-align: center; }
.scan-close {
  position: absolute;
  top: .9rem;
  right: .9rem;
  width: 42px;
  height: 42px;
  font-size: 1.5rem;
  line-height: 1;
  color: #fff;
  background: rgba(255, 255, 255, .14);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.scan-close:hover { background: rgba(255, 255, 255, .25); }

@media (max-width: 640px) {

  .site-header .container {
    flex-wrap: wrap;
    gap: .6rem;
    padding-top: .6rem;
    padding-bottom: .6rem;
  }
  .searchbar { flex-basis: 100%; max-width: none; }

  .search-field { padding-right: .35rem; }
  .search-field .search-go { display: none; }
  .search-field .search-submit {
    display: flex;
    color: #fff;
    background: var(--accent);
  }
  .search-field .scan-btn { margin-right: .25rem; }

  .hero { padding-top: 1.75rem; padding-bottom: 1.75rem; }
  .hero h1 { font-size: 1.5rem; }
  .hero-break { display: inline; }

  th, td { padding: .55rem .5rem; }
  .card th:first-child, .card td:first-child { padding-left: .9rem; }
  .card th:last-child, .card td:last-child { padding-right: .9rem; }

  .category-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    margin: .6rem -.25rem 1rem;
    padding: .25rem .25rem .4rem;
    scroll-padding: 0 .25rem;
  }
  .category-chips::-webkit-scrollbar { display: none; }
  .category-chips li { flex: 0 0 auto; }
  .category-chips a { scroll-snap-align: start; }

  .footer-grid { grid-template-columns: 1fr; gap: 1.6rem; }
  .footer-cats { grid-column: auto; }
  .footer-cats ul { columns: 1; }

  .product-card { flex-basis: 150px; }
  .product-card-img { height: 100px; }
  .strip-arrow { display: none; }

  .listing th:nth-child(3), .listing td:nth-child(3) { display: none; }
  .thumb { width: 48px; }
  .thumb-figure { width: 40px; height: 40px; }

  .intro { flex-direction: column; gap: 1rem; }
  .intro-figure { align-self: center; }

  .offers, .offers tbody { display: block; }
  .offers tr:first-child { display: none; }
  .offers tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .1rem .9rem;
    align-items: center;
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--line);
  }
  .offers tr:last-child { border-bottom: 0; }
  .offers td { display: block; padding: 0; border: 0; }

  .card .offers td:first-child { padding-left: 0; }
  .card .offers td:last-child { padding-right: 0; }
  .offers td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .offers td:nth-child(2) { grid-column: 1; grid-row: 2; font-size: .85rem; }
  .offers td:nth-child(3) { grid-column: 2; grid-row: 1; text-align: right; }
  .offers .shipping { grid-column: 2; grid-row: 2; text-align: right; font-size: .85rem; }
  .offers td:last-child { grid-column: 1 / -1; grid-row: 3; margin-top: .55rem; }
  .offers .buy { display: block; text-align: center; }
}

.price-chart svg { display: block; width: 100%; height: auto; }
.price-chart .band { fill: var(--accent); opacity: .1; }
.price-chart .line { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.price-chart .line-bound { stroke: var(--accent); stroke-width: 1; opacity: .45; }
.price-chart .line-avg { stroke: var(--accent); stroke-width: 2; }
.price-chart .y-label,
.price-chart .x-label { fill: var(--muted); font-size: 12px; }
.price-chart .x-label.end { text-anchor: end; }
.price-chart p { margin: .6rem 0 0; font-size: .85rem; }
.price-chart .chart-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; }
.price-chart .key { display: inline-flex; align-items: center; }
.price-chart .key::before {
  content: ""; display: inline-block; width: 1.1rem; height: .55rem;
  margin-right: .4rem; border-radius: 2px;
}
.price-chart .key-band::before { background: var(--accent); opacity: .25; }
.price-chart .key-avg::before { height: 0; border-top: 2px solid var(--accent); border-radius: 0; }
.price-chart .key-note::before { content: "·"; margin-right: .4rem; }
