:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #6b6b70;
  --border: #e2e2e0;
  --accent: #1f5fbf;
  --buy: #1e7a3c;
  --buy-bg: #e3f4e8;
  --consider: #8a5a00;
  --consider-bg: #fdf1d8;
  --skip: #a3261f;
  --skip-bg: #fbe5e3;
  --unknown: #55565c;
  --unknown-bg: #ececef;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141416;
    --surface: #1e1e21;
    --text: #ececef;
    --muted: #a0a0a8;
    --border: #33333a;
    --accent: #7aa7ff;
    --buy: #7fd99a;
    --buy-bg: #183823;
    --consider: #f2c46b;
    --consider-bg: #3a2d10;
    --skip: #ff9a90;
    --skip-bg: #43201d;
    --unknown: #c4c4cc;
    --unknown-bg: #2c2c31;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); }

main, .site-header {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

/* main takes the free height between header and footer. */
main { flex: 1; display: flex; flex-direction: column; }

.demo-banner {
  background: var(--consider-bg);
  color: var(--consider);
  text-align: center;
  padding: 8px 16px;
  font-size: 0.9rem;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  padding-bottom: 20px;
}

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

.lang-switch { font-size: 0.9rem; }

.hero {
  padding: 24px 0 8px;
  text-align: center;
}

/* Tagline, search box and results sit together in the middle of the window;
   a long result list simply grows past it and scrolls. */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: 80px;
}

.tagline {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0 0 16px;
}

.search { display: flex; gap: 8px; }

.search input {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

.search button {
  font: inherit;
  font-weight: 600;
  padding: 12px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.results h2 { font-size: 1rem; color: var(--muted); font-weight: 500; text-align: center; }
.results .empty { text-align: center; }

.result-list { list-style: none; padding: 0; margin: 0; }

.result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.result a { text-decoration: none; color: inherit; min-width: 0; }
.result-name { display: block; font-weight: 600; }
.result-meta { display: block; font-size: 0.9rem; color: var(--muted); }

.verdict {
  flex-shrink: 0;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.verdict-buy { color: var(--buy); background: var(--buy-bg); }
.verdict-consider { color: var(--consider); background: var(--consider-bg); }
.verdict-skip { color: var(--skip); background: var(--skip-bg); }
.verdict-not_enough_data { color: var(--unknown); background: var(--unknown-bg); }

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

main { padding-bottom: 32px; }

.product { padding: 8px 0 24px; }
.back { font-size: 0.9rem; }
.category { color: var(--muted); margin: 16px 0 0; }
.product h1 { margin: 4px 0 16px; font-size: 1.6rem; }

.score {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.score-label, .score-count { display: block; font-size: 0.9rem; color: var(--muted); }
.score-value { display: block; font-size: 1.8rem; font-weight: 700; }
.score-value small { font-size: 1rem; color: var(--muted); font-weight: 500; }

.pros-cons { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 520px) { .pros-cons { grid-template-columns: 1fr; } }

.result-price { display: block; font-size: 0.9rem; font-weight: 600; margin-top: 2px; }

.share { display: flex; gap: 8px; margin: 16px 0 8px; }
.share-button {
  flex-shrink: 0;
  font: inherit;
  font-weight: 600;
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
}
.share-link {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 0.85rem;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--muted);
}

.offer-list, .source-list { list-style: none; padding: 0; margin: 0; }
.offer {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.offer-best { border-color: var(--buy); }
.offer-out { opacity: 0.6; }
.offer-store { font-weight: 600; min-width: 0; }
.offer-price { font-weight: 700; white-space: nowrap; }
.offer-badge, .offer-stock {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 6px;
}
.offer-badge { color: var(--buy); background: var(--buy-bg); }
.offer-stock { color: var(--unknown); background: var(--unknown-bg); }
.offer-link { font-size: 0.9rem; white-space: nowrap; }
@media (max-width: 520px) {
  .offer { grid-template-columns: 1fr auto; }
  .offer-link { grid-column: 1 / -1; }
}

.sources-note, .gtin { font-size: 0.85rem; color: var(--muted); }
.source-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.site-footer { padding: 8px 16px 32px; }
.social {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
}
.social a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}
.social a:hover, .social a:focus-visible { color: var(--accent); }
.social svg { width: 20px; height: 20px; }

.pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.9rem;
}
.pager a:last-child { justify-self: end; }
.pager-info { color: var(--muted); }
