:root {
  color-scheme: light;
  --blue: #0066cc;
  --blue-focus: #0071e3;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #e0e0e0;
  --canvas: #ffffff;
  --parchment: #f5f5f7;
  --pearl: #fafafc;
  --danger: #d90429;
  --rewe: #f6d84b;
  --kaufland: #006eb8;
  font-family: "SF Pro Text", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--parchment);
  color: var(--ink);
}

h1,
h2,
p {
  margin: 0;
}

button,
input {
  font: inherit;
}

main {
  width: min(1440px, 100%);
  margin: 0 auto;
}

.sticky-panel {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 12px clamp(12px, 4vw, 32px) 10px;
  background: rgba(245, 245, 247, 0.86);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  backdrop-filter: saturate(180%) blur(20px);
}

.controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 18px;
  align-items: end;
  width: min(1120px, 100%);
  margin: 0 auto;
}

.search {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

.search input,
.watchlist-form input {
  width: 100%;
  height: 46px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  padding: 0 20px;
  background: var(--canvas);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: 0;
}

.search input:focus,
.watchlist-form input:focus {
  border-color: var(--blue-focus);
  outline: 2px solid var(--blue-focus);
  outline-offset: 2px;
}

.filter-side {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.updated {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  text-align: right;
}

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

.store-filters label,
.categories button,
.watchlist-form button,
.watchlist-tags button {
  min-height: 44px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  background: var(--canvas);
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
}

.store-filters label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
}

.store-filters input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

.categories {
  display: flex;
  gap: 8px;
  width: min(1120px, 100%);
  margin: 10px auto 0;
  overflow-x: auto;
  padding: 0 0 4px;
  scrollbar-width: thin;
}

.categories button {
  flex: 0 0 auto;
  padding: 0 16px;
  transition: transform 120ms ease, background-color 120ms ease, color 120ms ease;
}

.categories button:active,
.store-filters label:active,
.watchlist-form button:active,
.watchlist-tags button:active {
  transform: scale(0.95);
}

.categories button.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.watchlist-panel {
  width: min(1120px, 100%);
  margin: 8px auto 0;
}

.watchlist-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.watchlist-form button {
  padding: 0 18px;
  background: var(--ink);
  color: #ffffff;
}

.watchlist-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.watchlist-tags button {
  min-height: 36px;
  padding: 0 12px;
  background: #e8e8ed;
}

.results {
  display: grid;
  gap: 0;
}

.offer-section {
  padding: 36px clamp(12px, 4vw, 32px) 52px;
}

.offer-section:nth-child(odd) {
  background: var(--parchment);
}

.offer-section:nth-child(even) {
  background: var(--canvas);
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  width: min(1120px, 100%);
  margin: 0 auto 18px;
}

.section-header h2 {
  font-family: "SF Pro Display", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: clamp(28px, 7vw, 44px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0;
}

.section-header span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.29;
}

.offer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  align-items: stretch;
  gap: 18px;
  width: min(1120px, 100%);
  margin: 0 auto;
}

.standalone-grid {
  padding: 28px clamp(12px, 4vw, 32px) 52px;
}

.card {
  display: grid;
  grid-template-rows: 250px 1fr;
  overflow: hidden;
  height: 100%;
  min-height: 535px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--canvas);
}

.image-wrap {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  height: 250px;
  padding: 22px;
  background: var(--pearl);
}

.image-wrap img {
  position: absolute;
  inset: 22px;
  display: block;
  width: calc(100% - 44px);
  height: calc(100% - 44px);
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(3px 5px 22px rgba(0, 0, 0, 0.18));
}

.badge-row {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100% - 24px);
}

.badge {
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--danger);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.xtra-discount {
  background: var(--kaufland);
}

.card-body {
  display: grid;
  grid-template-rows: auto auto minmax(58px, auto) auto 1fr;
  gap: 9px;
  padding: 16px;
}

.meta-row,
.standard-price-row,
.xtra-price-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.meta-row {
  justify-content: space-between;
  align-items: center;
}

.store {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.store.rewe {
  background: var(--rewe);
}

.store.kaufland {
  background: var(--kaufland);
  color: #ffffff;
}

.category {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-align: right;
}

.card h2 {
  display: -webkit-box;
  min-height: 44px;
  overflow: hidden;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.24;
  letter-spacing: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.description {
  display: -webkit-box;
  min-height: 58px;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.43;
  letter-spacing: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.validity {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.price-block {
  display: grid;
  align-self: end;
  gap: 7px;
}

.price {
  color: var(--danger);
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.standard-price {
  font-size: 22px;
}

.old-price,
.xtra-old {
  color: var(--muted);
  font-size: 14px;
  text-decoration: line-through;
}

.xtra-price-row {
  flex-wrap: wrap;
  align-items: end;
  color: var(--kaufland);
}

.xtra-label {
  width: 100%;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.xtra-price {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
}

.xtra-old {
  color: var(--kaufland);
}

.empty {
  padding: 36px 20px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 760px) {
  .controls {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .filter-side {
    justify-items: stretch;
  }

  .updated {
    text-align: right;
  }

  .store-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .store-filters label {
    justify-content: center;
  }

  .watchlist-form {
    grid-template-columns: 1fr;
  }

  .offer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .section-header {
    align-items: start;
    flex-direction: column;
    gap: 4px;
  }

  .card {
    grid-template-rows: 180px 1fr;
    min-height: 470px;
    border-radius: 12px;
  }

  .image-wrap {
    height: 180px;
    padding: 14px;
  }

  .image-wrap img {
    inset: 14px;
    width: calc(100% - 28px);
    height: calc(100% - 28px);
  }

  .card-body {
    padding: 11px;
  }

  .card h2 {
    min-height: 60px;
    font-size: 15px;
    -webkit-line-clamp: 3;
  }

  .description {
    min-height: 58px;
    font-size: 13px;
  }

  .price,
  .xtra-price {
    font-size: 29px;
  }

  .standard-price {
    font-size: 20px;
  }
}

@media (max-width: 390px) {
  .offer-grid {
    grid-template-columns: 1fr;
  }
}
