@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,600;1,400&family=DM+Mono:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #F7F7F5;
  --surface:  #FFFFFF;
  --border:   rgba(0,0,0,0.08);
  --border-md:rgba(0,0,0,0.13);
  --text-1:   #1A1A18;
  --text-2:   #6B6B67;
  --text-3:   #A3A39E;
  --green:    #1D9E75;
  --green-dk: #0F6E56;
  --green-lt: #E1F5EE;
  --green-t:  #9FE1CB;
  --red:      #E24B4A;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
}

/* ── header ── */
.site-header {
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.header-brand .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--green);
}

.header-brand span {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.2px;
}

.header-meta {
  font-size: 12px;
  color: var(--text-3);
  font-family: 'DM Mono', monospace;
}

/* ── hero bar ── */
.hero-bar {
  background: var(--green);
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-bar h1 {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.3px;
}

.hero-bar .sub {
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  margin-top: 2px;
}

.result-pill {
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 20px;
  font-family: 'DM Mono', monospace;
}

/* ── main layout ── */
.page-body {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

/* ── grid ── */
.offers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

/* ── card ── */
.offer-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, transform 0.12s;
}

.offer-card:hover {
  border-color: var(--border-md);
  transform: translateY(-2px);
}

.card-image {
  background: #F4F4F2;
  height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.card-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  padding: 14px;
}

.img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.img-placeholder svg {
  opacity: 0.18;
}

/* ── card body ── */
.card-body {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-name {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text-1);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price-block {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.price-int {
  font-size: 24px;
  font-weight: 600;
  color: var(--green);
  font-family: 'DM Mono', monospace;
  letter-spacing: -1px;
  line-height: 1;
}

.price-dec {
  font-size: 14px;
  font-weight: 500;
  color: var(--green);
  font-family: 'DM Mono', monospace;
  align-self: flex-start;
  margin-top: 3px;
}

.price-currency {
  font-size: 12px;
  color: var(--text-3);
  margin-left: 2px;
  align-self: flex-end;
  margin-bottom: 2px;
}

.shop-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

.shop-logo-wrap {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 0.5px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  padding: 2px;
}

.shop-logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.shop-initials {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--green-lt);
  border: 0.5px solid var(--green-t);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  color: var(--green-dk);
  flex-shrink: 0;
}

.shop-name {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shipping-tag {
  font-size: 11px;
  color: var(--text-3);
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── cta button ── */
.btn-deal {
  display: block;
  text-align: center;
  background: var(--green);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  text-decoration: none;
  padding: 11px 16px;
  border-top: 0.5px solid var(--border);
  transition: background 0.15s;
}

.btn-deal:hover { background: var(--green-dk); }

/* ── states ── */
.state-wrap {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-2);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2.5px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.state-wrap h2 { font-size: 17px; font-weight: 500; margin-bottom: 6px; color: var(--text-1); }
.state-wrap p  { font-size: 13px; color: var(--text-3); }

.error-box {
  background: #fff0f0;
  border: 0.5px solid #ffc5c5;
  border-radius: 10px;
  padding: 20px 24px;
  max-width: 480px;
  margin: 0 auto;
  text-align: left;
}

.error-box .err-title { font-weight: 600; color: var(--red); font-size: 14px; margin-bottom: 6px; }
.error-box .err-detail { font-size: 12px; color: var(--text-2); font-family: 'DM Mono', monospace; line-height: 1.6; }

/* ── responsive ── */
@media (max-width: 500px) {
  .hero-bar { padding: 14px 16px; }
  .page-body { padding: 18px 12px 48px; }
  .offers-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .card-image { height: 140px; }
}

.price-int {
  font-size: 22px;
  font-weight: 600;
  color: var(--green);
  font-family: 'DM Mono', monospace;
  letter-spacing: -0.5px;
  line-height: 1;
}

.price-dec {
  font-size: 13px;
  font-weight: 400;
  color: var(--green);
  font-family: 'DM Mono', monospace;
  opacity: 0.7;
  align-self: flex-end;
  margin-bottom: 1px;
}