:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #5a5a5a;
  --accent: #0b6b3a;
  --accent-fg: #ffffff;
  --border: #d0d0d0;
  --surface: #f5f5f2;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121412;
    --fg: #ececec;
    --muted: #a8a8a8;
    --accent: #5fd08e;
    --accent-fg: #0b1a10;
    --border: #3a3d3a;
    --surface: #1c1f1c;
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
}

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

.site-header, main, .site-footer {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0.75rem 1rem;
}

.site-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.site-name {
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.search { display: flex; gap: 0.5rem; }

.search input[type="search"] {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0 0.75rem;
  font: inherit;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
}

.search button {
  min-height: 44px;
  min-width: 44px;
  padding: 0 1rem;
  font: inherit;
  font-weight: 600;
  color: var(--accent-fg);
  background: var(--accent);
  border: 0;
  border-radius: 0.375rem;
  cursor: pointer;
}

.search button:hover { filter: brightness(1.1); }
.search button:active { filter: brightness(0.95); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.hero { padding: 1.5rem 0; }
.hero h1 { margin: 0 0 1rem; font-size: 1.5rem; }
.search-large input[type="search"] { font-size: 1.125rem; }

.category-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.category-list a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  text-decoration: none;
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  margin-top: 2rem;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

@media (min-width: 48rem) {
  .site-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .site-header .search { width: 24rem; }
  .hero { padding: 3rem 0 2rem; }
  .hero h1 { font-size: 2rem; }
  .category-list { grid-template-columns: repeat(3, 1fr); }
}

.filters { display: grid; gap: 0.75rem; margin: 1rem 0; padding: 0.75rem; background: var(--surface); border: 1px solid var(--border); border-radius: 0.375rem; }
.filters label, .settings label { display: flex; flex-direction: column; gap: 0.25rem; }
.filters label.check, .settings label { flex-direction: row; align-items: center; min-height: 44px; gap: 0.5rem; }
.filters select, .filters input[type="number"] { min-height: 44px; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: 0.375rem; padding: 0 0.5rem; }
.size-range { display: flex; align-items: flex-start; gap: 0.5rem; border: 0; padding: 0; margin: 0; }
.stores { border: 0; padding: 0; margin: 0; display: grid; }
.size-range input { flex: 1; min-width: 0; }
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.result { padding: 0.75rem; border: 1px solid var(--border); border-radius: 0.375rem; display: grid; gap: 0.25rem; }
.result-brand, .result-fine { color: var(--muted); font-size: 0.875rem; }
.result-meta { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.unit-price { font-weight: 700; }
.unknown { margin-left: 0.5rem; font-style: italic; color: var(--muted); }
.result a { display: inline-flex; align-items: center; min-height: 44px; }
.note { padding: 0.5rem 0.75rem; background: var(--surface); border-radius: 0.375rem; }
.empty { padding: 1rem 0; }
.site-footer { display: flex; gap: 1rem; }

.affiliate-banner { padding: .5rem .75rem; margin: 0 0 1rem; background: var(--surface); border-left: 3px solid var(--muted); font-size: .9rem; }
.amazon-note { margin: .25rem 0; }

.filters-drawer { margin: 1rem 0; }
.filters-drawer summary { display: flex; align-items: center; min-height: 44px; font-weight: 600; cursor: pointer; }
.filters-drawer summary::before { content: "\25B8"; margin-right: 0.5rem; }
.filters-drawer[open] summary::before { content: "\25BE"; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hint { color: var(--muted); font-size: 0.875rem; }
.size-range { min-width: 0; }
.filters-drawer .filters { margin-top: 0.5rem; }
.result-price { display: inline-flex; gap: 0.5rem; }
@media (min-width: 48rem) {
  .filters-drawer summary { display: none; }
  .filters-drawer:not([open])::details-content { content-visibility: visible; display: block; }
  .filters { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
}

/* Home page has no header search (hero search is primary): keep the bar compact. */
.site-header.no-search { flex-direction: row; justify-content: flex-start; }

.observed { margin-top: 1.5rem; display: grid; gap: 0.75rem; }
.observed h2, .observed h3 { margin: 0; }
.observed a { display: inline-flex; align-items: center; min-height: 44px; }
.attribution a { display: inline; min-height: 0; }
.sale { color: var(--accent); font-weight: 600; }
.near { margin: 0; }
.settings input[type="text"], .settings select { min-height: 44px; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: 0.375rem; padding: 0 0.5rem; max-width: 12rem; }
.settings fieldset { display: grid; gap: 0.25rem; }
.error { padding: 0.5rem 0.75rem; border-left: 3px solid currentColor; font-weight: 600; }

/* Feedback form */
.feedback-form { display: grid; gap: 0.5rem; max-width: 40rem; }
.feedback-form fieldset { display: grid; gap: 0.25rem; border: 1px solid var(--border); border-radius: 0.375rem; padding: 0.75rem; margin: 0; }
.feedback-form label.choice { display: flex; align-items: center; gap: 0.5rem; min-height: 44px; }
.feedback-form input[type="text"], .feedback-form input[type="email"], .feedback-form textarea { min-height: 44px; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: 0.375rem; padding: 0.5rem; width: 100%; box-sizing: border-box; }
.feedback-form button { justify-self: start; min-height: 44px; min-width: 44px; padding: 0 1rem; font: inherit; font-weight: 600; color: var(--accent-fg); background: var(--accent); border: 0; border-radius: 0.375rem; cursor: pointer; }
.feedback-form .hint { margin: 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.report-link { font-size: 0.875rem; color: var(--muted); }
