:root {
  --bg: #f6f7f4;
  --panel: #ffffff;
  --text: #1a1f1b;
  --muted: #5b6358;
  --accent: #2f6e4e;
  --accent-strong: #1b4d36;
  --accent-light: #e8f3ec;
  --success: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;
  --border: #dfe3dc;
  --shadow: 0 10px 30px rgba(30, 60, 40, 0.10);
  --radius: 14px;
  --max-width: 1200px;
  --header-h: 64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 20px;
}
.brand span { color: var(--accent); }
.nav { display: flex; gap: 6px; }
.nav a {
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
  transition: .2s background, .2s color;
}
.nav a:hover { background: #e9ece9; color: var(--text); }
.nav a.active { background: var(--accent-light); color: var(--accent); }

/* Layout */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* Hero */
.hero {
  background: linear-gradient(135deg,#2f6e4e,#1b4d36);
  color: white;
  border-radius: var(--radius);
  padding: 28px 28px 32px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}
.hero h1 {
  margin: 0 0 6px;
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}
.hero p { margin: 0; opacity: .9; font-size: 15px; }
.hero-actions { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.12);
  color: white;
  cursor: pointer;
  transition: transform .05s ease, background .2s;
}
.btn:hover { background: rgba(255,255,255,.22); }
.btn.primary { background: white; color: #1f2937; border-color: white; }
.btn.primary:hover { background: #f8fafc; }

/* Section */
.section { margin-top: 28px; }
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-title { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.section-link { color: var(--accent); font-weight: 700; font-size: 14px; }

/* Cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(15,23,42,.12); }
.card-img {
  height: 140px;
  border-radius: 10px;
  background: #f3f4f6;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-body { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.card-title {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  background: var(--accent-light);
  color: var(--accent);
}
.badge.success { background: #ecfdf5; color: #047857; }
.badge.warn { background: #fffbeb; color: #b45309; }
.badge.danger { background: #fef2f2; color: #b91c1c; }
.store { color: var(--muted); font-size: 13px; }
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.rating {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 13px;
  color: #f59e0b;
}
.rating-num { color: var(--muted); font-weight: 600; }
.code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f9fafb;
  border: 1px dashed var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  font-size: 13px;
}
.copy-btn {
  border: 1px solid var(--border);
  background: white;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
}
.copy-btn:hover { background: #f3f4f6; }

/* Filters */
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 700; font-size: 13px; color: var(--muted); }
.field input, .field select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: white;
  font-size: 14px;
  outline: none;
}
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }

/* Category chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: white;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); color: white; border-color: var(--accent); }

/* BrandList / brand cards */
.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.brand-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
  border-radius: 14px;
  padding: 20px 16px 16px;
  text-align: center;
  text-decoration: none;
  color: inherit;
  border: 1.5px solid #f0e8ff;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  transition: transform .15s, box-shadow .15s, border-color .15s;
  cursor: pointer;
}
.brand-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0,0,0,.1);
  border-color: #7c3aed;
}
.brand-logo {
  width: 60px;
  height: 60px;
  object-fit: contain;
  margin-bottom: 10px;
}
.brand-logo-fallback {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 900;
  color: white;
  margin-bottom: 10px;
}
.brand-body { width: 100%; }
.brand-name {
  font-weight: 800;
  font-size: 14px;
  color: #1a1a2e;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-summary {
  font-size: 12px;
  color: #e53e3e;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Stores list */
.store-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.store-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: transform .15s ease;
  text-decoration: none;
  color: inherit;
}
.store-card:hover { transform: translateY(-2px); }
.store-name { font-weight: 800; font-size: 15px; color: var(--text); }
.store-count { color: var(--muted); font-size: 13px; }

/* Deal detail */
.deal-detail {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  margin-bottom: 16px;
}
.back-link:hover { text-decoration: underline; }
.deal-hero {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 24px;
  align-items: start;
}
.deal-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: #f8fafc;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.deal-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.deal-main { min-width: 0; }
.deal-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.deal-title {
  font-size: 22px;
  font-weight: 900;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}
.deal-desc {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 14px;
}
.code-block {
  background: #fff8f0;
  border: 2px dashed #fdba74;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.code-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 6px;
}
.code-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.code-value {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: .05em;
  color: #c2410c;
  flex: 1;
  min-width: 0;
  word-break: break-all;
}
.deal-actions { margin-top: 4px; }
.go-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 800;
  border-radius: 999px;
  text-decoration: none;
}
.deal-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

@media (max-width: 640px) {
  .deal-hero { grid-template-columns: 1fr; }
  .deal-img { width: 120px; }
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}
.page-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: white;
  font-weight: 700;
  cursor: pointer;
}
.page-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* Empty state */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: white;
  padding: 24px 20px;
  color: var(--muted);
  font-size: 13px;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* Utility */
.tag { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

@media (max-width: 640px) {
  .hero h1 { font-size: 26px; }
  .grid { grid-template-columns: 1fr; }
}
