:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #475569;
  --accent: #059669;
  --accent-hover: #047857;
  --accent-soft: #ecfdf5;
  --badge-full: #047857;
  --badge-official: #1d4ed8;
  --badge-coupon: #b45309;
  --badge-coupon-bg: #fffbeb;
  --radius: 14px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

.hidden {
  display: none !important;
}

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 14px;
  padding-bottom: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--text);
  color: #10b981;
  font-size: 1.25rem;
  font-weight: 800;
  flex-shrink: 0;
}

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

.brand-text strong {
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.brand-text small {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.search-wrap {
  width: 100%;
}

.search-wrap input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.search-wrap input:focus {
  border-color: var(--accent);
  background: var(--surface);
}

/* Niche Tabs */
.niche-nav {
  border-top: 1px solid #f1f5f9;
  background: var(--surface);
}

.niche-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-top: 10px;
  padding-bottom: 10px;
  scrollbar-width: none;
}

.niche-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  border-color: #cbd5e1;
  color: var(--text);
}

.tab-btn.active {
  background: var(--text);
  border-color: var(--text);
  color: #ffffff;
}

/* Main */
.main-content {
  padding-top: 20px;
  padding-bottom: 48px;
  min-height: 60vh;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.results-count {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.sort-wrap select {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  cursor: pointer;
}

/* Offers Grid */
.offers-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.offer-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.offer-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-bottom: 1px solid #f1f5f9;
}

.card-media img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.discount-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 999px;
  letter-spacing: 0.01em;
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 14px 16px 16px;
  gap: 10px;
}

.badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  color: var(--text-muted);
}

.pill-full {
  background: var(--accent-soft);
  color: var(--badge-full);
}

.pill-official {
  background: #eff6ff;
  color: var(--badge-official);
}

.card-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price-block {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.price-original {
  font-size: 0.82rem;
  color: #94a3b8;
  text-decoration: line-through;
}

.price-current {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.coupon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: 1px dashed #f59e0b;
  border-radius: 8px;
  background: var(--badge-coupon-bg);
  color: var(--badge-coupon);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.coupon-btn:hover {
  background: #fef3c7;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 42px;
  border-radius: 10px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s ease;
}

.cta-btn:hover {
  background: var(--accent-hover);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 56px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.empty-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.empty-state p {
  margin: 0 auto 16px;
  max-width: 480px;
  color: var(--text-muted);
  font-size: 0.94rem;
}

.btn-secondary {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 9px;
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--bg);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 24px 0 32px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.disclaimer {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.footer-meta {
  margin: 0;
  font-size: 0.78rem;
  color: #94a3b8;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 640px) {
  .header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .search-wrap {
    max-width: 380px;
  }

  .offers-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .offers-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
  }
}
