:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --ink: #1f2a24;
  --muted: #66706a;
  --line: #e2ddd3;
  --green: #2f5d46;
  --green-soft: #e4efe8;
  --warn: #a8402b;
  --focus: #1b6bd6;
  --radius: 14px;
}

* { box-sizing: border-box; }

/* No visible scrollbars anywhere; the page and the example row still scroll. */
* { scrollbar-width: none; -ms-overflow-style: none; }
::-webkit-scrollbar { display: none; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---- top ---- */

.top { max-width: 1200px; margin: 0 auto; padding: 22px 16px 8px; }
h1 { margin: 0 0 4px; font-size: clamp(1.6rem, 4vw, 2.2rem); letter-spacing: -0.01em; }
.lead { margin: 0 0 14px; color: var(--muted); max-width: 46rem; }
.top__nav { margin: 0 0 10px; font-size: 0.9rem; }
.top__link { color: var(--green); font-weight: 600; text-decoration: none; }
.top__link:hover { text-decoration: underline; }

.search input {
  width: 100%;
  padding: 16px 18px;
  font: inherit; font-size: 1.15rem;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 2px 10px rgb(31 42 36 / 6%);
}
.search input:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 4px var(--green-soft); }

.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 14px 0 0; }
.examples__label { color: var(--muted); font-size: 0.9rem; }
.examples__list { display: flex; flex-wrap: wrap; flex: 1 1 100%; gap: 8px; margin: 0; padding: 0; list-style: none; }
.example {
  padding: 6px 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
}
.example:hover { border-color: var(--green); background: var(--green-soft); }

/* ---- interpretation ---- */

.interpretation { margin: 16px 0 0; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.interpretation__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.interpretation__row[hidden] { display: none; }
.interpretation__label { color: var(--muted); font-size: 0.9rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.chip {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px 4px 3px 12px;
  background: var(--green-soft);
  border: 1px solid #c3dccb;
  border-radius: 999px;
  color: var(--green);
  font-weight: 600;
  font-size: 0.95rem;
}
.chip--dropped { background: transparent; border-style: dashed; color: var(--muted); text-decoration: line-through; }
.chip--ai { border-style: dashed; }
.chip__remove {
  width: 28px; height: 28px;
  display: inline-grid; place-items: center;
  padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: inherit; font-size: 1.2rem; line-height: 1;
}
.chip__remove:hover { background: rgb(47 93 70 / 15%); }
.summary { margin: 10px 0 0; color: var(--muted); font-size: 0.95rem; }
.interpretation__row:not([hidden]) + .summary { margin-top: 8px; }
.summary[hidden] { display: none; }
.interpretation__row[hidden] + .summary { margin-top: 0; }

/* ---- results ---- */

main { max-width: 1200px; margin: 0 auto; padding: 8px 16px 32px; }

.tabs {
  display: none;
  position: sticky; top: 0; z-index: 2;
  gap: 8px; margin: 12px -16px 12px; padding: 8px 16px;
  background: var(--bg);
}
.tabs button {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 0;
  padding: 8px 10px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
}
.tabs button[aria-selected="true"] { border-color: var(--green); background: var(--green-soft); }
.tabs__title { font-size: 0.85rem; color: var(--muted); }
.tabs__count { font-size: 1.6rem; font-weight: 700; line-height: 1.1; min-height: 1.75rem; }

.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 16px; align-items: start; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 5px solid #b7b1a6;
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}
.panel--understanding { border-top-color: var(--green); }
.panel__head h2 { margin: 0; font-size: 1.15rem; }
.panel__hint { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }
.panel__count { margin: 8px 0 12px; min-height: 3.4rem; display: flex; align-items: baseline; gap: 8px; }
.panel__number { font-size: 2.8rem; font-weight: 800; line-height: 1; color: var(--green); }
.panel__number--zero { color: var(--warn); }
.panel__unit { color: var(--muted); font-size: 1.05rem; }

.notice { margin: 0 0 12px; padding: 8px 12px; background: #fbf3d9; border-radius: 10px; font-size: 0.92rem; }
.status { margin: 12px 0 0; color: var(--muted); font-size: 0.92rem; }

.cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px;
  margin: 0; padding: 0; list-style: none;
  transition: opacity 0.15s;
}
.is-loading .cards { opacity: 0.45; }

.card { display: flex; flex-direction: column; gap: 6px; height: 100%; color: inherit; text-decoration: none; }
.card:hover .card__title { text-decoration: underline; }
.card__picture {
  display: block; aspect-ratio: 1; overflow: hidden;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
}
.card__picture img { width: 100%; height: 100%; object-fit: contain; display: block; }
.card__title { font-size: 0.9rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card__price { font-weight: 700; margin-top: auto; }

.foot { max-width: 1200px; margin: 0 auto; padding: 0 16px 32px; color: var(--muted); font-size: 0.85rem; }
.foot p { margin: 0; }

/* ---- phones and small tablets: one column at a time, both counts always visible in the tabs ---- */

@media (max-width: 899px) {
  .tabs { display: flex; }
  .columns { display: block; margin-top: 0; }
  /* The tabs already carry the titles and counts; only the current search keeps its hint, because that column
     ignores the chips and that is the one thing the shopper must not misread. */
  .panel__head h2, .panel__count { display: none; }
  .panel--understanding .panel__head { display: none; }
  .panel__hint { margin: 0 0 10px; }
  .panel { padding: 12px; }
  main[data-active="current"] .panel--understanding,
  main[data-active="understanding"] .panel--current { display: none; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

  /* Header kept short so the counts and the first product row stay in the first screen. */
  .top { padding-top: 14px; padding-bottom: 0; }
  h1 { font-size: 1.5rem; }
  .lead { margin-bottom: 10px; font-size: 0.92rem; }
  .search input { padding: 12px 14px; font-size: 1.05rem; }
  .examples { margin-top: 10px; }
  .examples__label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  /* One swipeable row instead of a tall stack, so the results stay near the top. */
  .examples__list { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
  .example { white-space: nowrap; }
  .interpretation { margin-top: 10px; padding: 8px 10px; }
  .chips { gap: 6px; }
  .chip { font-size: 0.9rem; }
  .tabs { margin: 8px -16px 8px; padding: 6px 16px; }
  .tabs button { padding: 5px 10px; }
  .tabs__count { font-size: 1.4rem; min-height: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cards { transition: none; }
}
