:root {
  --bg: #fbf7f0;
  --bg-warm: #f5ecdf;
  --card: #ffffff;
  --ink: #1e1a16;
  --muted: #7c6f64;
  --soft: #9c8f83;
  --line: #e9dfd1;
  --line-strong: #d8cbb9;
  --accent: #bf3f10;
  --accent-dark: #96300a;
  --accent-soft: #fdf0e7;
  --green: #0e6f47;
  --green-soft: #e8f6ee;
  --green-line: #b7e3c9;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(48, 34, 21, 0.05), 0 12px 28px -18px rgba(48, 34, 21, 0.35);
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

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

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  z-index: 50;
}
.skip:focus {
  left: 16px;
}

.wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 22px;
}

/* ---------------- Top bar ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(251, 247, 240, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(145deg, #d1531f, #a6350b);
  color: #fff6ec;
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: -0.5px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-text small {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.topbar-nav {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(14, 111, 71, 0.12);
}

/* ---------------- Hero ---------------- */

.hero {
  position: relative;
  padding: 58px 0 40px;
  background:
    radial-gradient(900px 380px at 12% -10%, #fdf1e2 0%, transparent 65%),
    radial-gradient(700px 320px at 92% 0%, #eef6ee 0%, transparent 60%);
  border-bottom: 1px solid var(--line);
}

.hero-inner {
  max-width: 860px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.1rem, 5.4vw, 3.6rem);
  line-height: 1.06;
  letter-spacing: -0.025em;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
}

.hero-sub {
  margin: 18px auto 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.02rem;
}

/* Search */

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 30px auto 0;
  max-width: 720px;
  padding: 7px 7px 7px 16px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(191, 63, 16, 0.13), var(--shadow);
}

.search-icon {
  color: var(--soft);
  display: grid;
  place-items: center;
  flex: none;
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  padding: 12px 6px;
  font-size: 1.03rem;
}

.search input::placeholder {
  color: var(--soft);
}

.search input::-webkit-search-cancel-button {
  cursor: pointer;
}

.btn-search {
  flex: none;
  border: 0;
  border-radius: 999px;
  padding: 13px 24px;
  background: linear-gradient(160deg, #cf4a17, #a8360a);
  color: #fff8f1;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.15s ease;
  box-shadow: 0 6px 16px -8px rgba(150, 48, 10, 0.9);
}

.btn-search:hover {
  filter: brightness(1.05);
}

.btn-search:active {
  transform: translateY(1px);
}

.btn-search:disabled {
  opacity: 0.65;
  cursor: progress;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.chip {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.72);
  color: #5b4f45;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.86rem;
  cursor: pointer;
  transition: all 0.14s ease;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: #fff;
  transform: translateY(-1px);
}

.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff7f0;
}

.hint {
  margin: 14px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.hint strong {
  color: var(--ink);
  font-weight: 600;
}

.trust {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
  margin: 26px 0 0;
  padding: 0;
  color: var(--soft);
  font-size: 0.82rem;
}

.trust li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.trust li::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--line-strong);
}

/* ---------------- Idle ---------------- */

.results {
  padding-top: 34px;
  padding-bottom: 70px;
}

.idle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.idle-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.idle-num {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.idle-card h3 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.12rem;
}

.idle-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.idle-card em {
  font-style: italic;
  color: var(--ink);
}

/* ---------------- Summary ---------------- */

.summary {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.summary h2 {
  margin: 6px 0 4px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  letter-spacing: -0.015em;
}

.summary .eyebrow {
  margin: 0;
}

.summary-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.summary-note b {
  color: var(--green);
  font-weight: 650;
}

.store-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.store-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fdfaf6;
  font-size: 0.85rem;
  color: #4e433a;
  white-space: nowrap;
}

.store-pill i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dot, #999);
  flex: none;
}

.store-pill small {
  color: var(--soft);
}

.store-pill.is-down {
  border-color: #efd4cb;
  background: #fdf3ef;
  color: #9a3c1d;
}

.store-pill.is-down i {
  background: #b4451c;
}

/* ---------------- Section headings ---------------- */

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 40px 0 16px;
}

.section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.25rem, 2.6vw, 1.6rem);
  letter-spacing: -0.015em;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 0.85rem;
  color: #594d43;
}

.control select {
  border: 0;
  background: transparent;
  outline: none;
  font-size: 0.85rem;
  cursor: pointer;
}

.control input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.control:has(input:checked) {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

/* ---------------- Match cards ---------------- */

.matches {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.match {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.35fr);
  gap: 22px;
  align-items: center;
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.match-main {
  display: flex;
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.thumb {
  width: 58px;
  height: 58px;
  border-radius: 13px;
  object-fit: contain;
  background: #faf6ef;
  border: 1px solid var(--line);
  flex: none;
  padding: 4px;
}

.thumb.placeholder {
  display: grid;
  place-items: center;
  color: var(--line-strong);
  font-size: 22px;
  padding: 0;
}

.match-title {
  min-width: 0;
}

.match-title h3 {
  margin: 0 0 3px;
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-meta {
  margin: 0 0 5px;
  color: var(--soft);
  font-size: 0.82rem;
}

.verdict {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.verdict b {
  color: var(--green);
  font-weight: 650;
}

.verdict.flat b {
  color: var(--muted);
}

.verdict.dear b {
  color: #a4451f;
}

.offers {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.offer {
  position: relative;
  flex: 1 1 170px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fdfaf6;
  transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.offer:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px -16px rgba(48, 34, 21, 0.6);
  border-color: var(--line-strong);
}

.offer.is-best {
  background: var(--green-soft);
  border-color: var(--green-line);
}

.offer.is-best:hover {
  border-color: var(--green);
}

.offer-store {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.offer-store i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot, #999);
  flex: none;
}

.offer-price {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.offer-price .from {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--soft);
  letter-spacing: 0;
  text-transform: uppercase;
}

.offer-unit {
  font-size: 0.8rem;
  color: var(--muted);
}

.offer-unit .was {
  color: var(--soft);
  text-decoration: line-through;
}

.offer-delivery {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed rgba(120, 101, 84, 0.22);
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--soft);
}

.offer.is-best .offer-delivery {
  border-top-color: var(--green-line);
  color: #43705a;
}

.offer-title {
  font-size: 0.76rem;
  color: var(--soft);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.offer-cta {
  margin-top: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-dark);
}

.offer.is-best .offer-cta {
  color: var(--green);
}

.offer .badge {
  position: absolute;
  top: -9px;
  right: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.offer .oos {
  margin-top: 2px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #a4451f;
}

/* ---------------- Delivery table ---------------- */

.delivery-wrap {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.delivery-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 900px;
}

.delivery-table thead th {
  text-align: left;
  padding: 13px 16px;
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--soft);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  background: #fdfaf5;
  white-space: nowrap;
}

.delivery-table tbody th,
.delivery-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid #f2ebe0;
  text-align: left;
  vertical-align: top;
  font-weight: 400;
}

.delivery-table tbody tr:last-child th,
.delivery-table tbody tr:last-child td {
  border-bottom: 0;
}

.delivery-table tbody td:nth-child(3) b {
  color: var(--accent-dark);
  font-weight: 700;
  white-space: nowrap;
}

.d-store {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  white-space: nowrap;
}

.d-store i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dot, #999);
  flex: none;
}

.d-other {
  color: #4e433a;
  font-size: 0.82rem;
  max-width: 320px;
}

.d-note {
  color: var(--muted);
  font-size: 0.82rem;
  max-width: 320px;
}

.d-note a {
  color: var(--accent-dark);
  font-weight: 600;
  white-space: nowrap;
}

.d-note a:hover {
  text-decoration: underline;
}

@media (max-width: 760px) {
  .delivery-wrap {
    background: transparent;
    border: 0;
    box-shadow: none;
    overflow: visible;
  }

  .delivery-table {
    min-width: 0;
    display: block;
  }

  .delivery-table thead {
    display: none;
  }

  .delivery-table tbody,
  .delivery-table tr {
    display: block;
  }

  .delivery-table tbody tr {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px 14px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
  }

  .delivery-table tbody th,
  .delivery-table tbody td {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    border: 0;
    padding: 5px 0;
  }

  .delivery-table tbody td::before {
    content: attr(data-label);
    color: var(--soft);
    font-size: 0.78rem;
    flex: none;
  }

  .delivery-table tbody tr th {
    border-bottom: 1px solid var(--line);
    margin-bottom: 6px;
    padding-bottom: 8px;
  }

  .d-note {
    max-width: none;
    display: block !important;
    color: var(--muted);
  }

  .d-note::before {
    display: block;
    margin-bottom: 3px;
  }
}

/* ---------------- Store result grids ---------------- */

.store-block {
  margin-top: 26px;
}

.store-block-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.store-block-name {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 600;
}

.store-block-name i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dot, #999);
}

.store-block-head a {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--accent-dark);
}

.store-block-head a:hover {
  text-decoration: underline;
}

.store-block-head .count {
  color: var(--soft);
  font-size: 0.84rem;
  font-weight: 400;
  font-family: var(--sans);
  margin-left: 4px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 12px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 14px 26px -20px rgba(48, 34, 21, 0.65);
}

.card-img {
  height: 118px;
  background: #faf6ef;
  display: grid;
  place-items: center;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.card-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.card-img .placeholder {
  color: var(--line-strong);
  font-size: 26px;
}

.card-body {
  padding: 12px 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.card-title {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 550;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.3em;
}

.card-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.card-price s {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--soft);
}

.card-sub {
  font-size: 0.77rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.tag.matched {
  background: #eef1fb;
  color: #454fa8;
}

.tag.oos {
  background: #fbeee9;
  color: #a4451f;
}

/* ---------------- States ---------------- */

.state {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
  color: var(--muted);
  box-shadow: var(--shadow);
}

.state h3 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
}

.state p {
  margin: 0 auto;
  max-width: 52ch;
}

.state .btn-retry {
  margin-top: 16px;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.state.error {
  border-color: #efd4cb;
  background: #fdf6f2;
}

.skeleton {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sk {
  height: 96px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(90deg, #f7f1e7 25%, #fcf8f2 37%, #f7f1e7 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}

.sk.tall {
  height: 140px;
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

/* ---------------- Footer ---------------- */

.footer {
  border-top: 1px solid var(--line);
  background: #f7f1e7;
  padding: 26px 0 34px;
}

.footer-inner p {
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
  max-width: 78ch;
}

.footer-meta {
  margin-top: 8px !important;
  color: var(--soft) !important;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 860px) {
  .match {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .idle-grid {
    grid-template-columns: 1fr;
  }

  .topbar-nav {
    display: none;
  }

  .summary {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .hero {
    padding: 36px 0 30px;
  }

  .search {
    flex-wrap: wrap;
    border-radius: 20px;
    padding: 10px;
  }

  .search-icon {
    margin-left: 4px;
  }

  .search input {
    padding: 8px 4px;
  }

  .btn-search {
    flex: 1 1 100%;
    padding: 12px 18px;
  }

  .trust {
    gap: 6px 14px;
  }

  .results {
    padding-top: 22px;
  }

  .offer {
    flex: 1 1 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
