:root {
  --bg: #f6f4f0;
  --surface: #ffffff;
  --ink: #151519;
  --ink-muted: #5d606b;
  --border: #e6e2da;
  --hero-bg: #121216;
  --hero-text: #f7f4ee;
  --shopee: #ee4d2d;
  --shopee-hover: #d73c1e;
  --ml-bg: #ffe600;
  --ml-text: #1c244b;
  --ml-hover: #f2da00;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(20, 20, 25, 0.05);
  --shadow-hover: 0 10px 26px rgba(20, 20, 25, 0.11);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.debug-banner {
  background: #1d4ed8;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 8px 12px;
}

/* Hero */
.hero {
  background: radial-gradient(circle at top right, rgba(238, 77, 45, 0.22), transparent 52%), var(--hero-bg);
  color: var(--hero-text);
  padding: 20px 0 18px;
}

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

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-avatar {
  flex-shrink: 0;
  border-radius: 18px;
  box-shadow: 0 6px 20px rgba(238, 77, 45, 0.28);
  line-height: 0;
}

.brand-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.brand-copy h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.verified-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(238, 77, 45, 0.18);
  color: #ff9c87;
  border: 1px solid rgba(238, 77, 45, 0.4);
  padding: 2px 8px;
  border-radius: 999px;
}

.brand-sub {
  font-size: 0.86rem;
  color: #c2c4cc;
  margin-top: 2px;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stat-chip {
  font-size: 0.78rem;
  color: #d8dae2;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 5px 10px;
  border-radius: 999px;
  text-decoration: none;
}

.stat-chip strong {
  color: #ffffff;
}

.stat-social:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* Sticky Controls */
.controls-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(246, 244, 240, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 12px 0 10px;
}

.search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-box {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--ink-muted);
  pointer-events: none;
}

#search-input {
  width: 100%;
  height: 42px;
  padding: 0 36px 0 38px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#search-input:focus {
  border-color: var(--shopee);
  box-shadow: 0 0 0 3px rgba(238, 77, 45, 0.12);
}

.clear-btn {
  position: absolute;
  right: 8px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 999px;
  background: #ece9e3;
  color: var(--ink);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sort-select {
  height: 42px;
  padding: 0 10px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  max-width: 138px;
}

.pills-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 4px 2px 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.pills-scroll::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-muted);
  padding: 7px 13px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cat-pill:hover {
  border-color: #cfc9bd;
  color: var(--ink);
}

.cat-pill.active {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
}

/* Main Grid */
.main-content {
  flex: 1;
  padding-top: 16px;
  padding-bottom: 36px;
}

.results-meta {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-bottom: 12px;
  font-weight: 500;
}

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

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

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

.card-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #ffffff;
  overflow: hidden;
  border-bottom: 1px solid #f0ede7;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.28s ease;
}

.card:hover .card-media img {
  transform: scale(1.03);
}

.img-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f8f5ef 0%, #ede8df 100%);
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  padding: 12px;
}

.img-fallback span {
  font-size: 2rem;
}

.card-num {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(18, 18, 22, 0.78);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

.card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--shopee);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
}

.card-body {
  padding: 11px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 6px;
}

.card-cat {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

.card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-desc {
  font-size: 0.76rem;
  color: var(--ink-muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.73rem;
  color: var(--ink-muted);
  margin-top: auto;
  padding-top: 2px;
}

.rating-pill {
  color: #b45309;
  font-weight: 700;
}

.card-price {
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.card-price small {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin-right: 3px;
}

.card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.1s ease, background-color 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-shopee {
  background: var(--shopee);
  color: #ffffff;
}

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

.btn-ml {
  background: var(--ml-bg);
  color: var(--ml-text);
  border: 1px solid #ead300;
}

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

/* Skeleton */
.skeleton-card {
  height: 300px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, #ece8e0 25%, #f5f2ec 50%, #ece8e0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}

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

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

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

.empty-state h2 {
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.empty-state p {
  font-size: 0.86rem;
  color: var(--ink-muted);
  margin-bottom: 14px;
}

.btn-reset {
  border: none;
  background: var(--ink);
  color: #ffffff;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
}

/* Footer */
.site-footer {
  background: #141418;
  color: #a9acb6;
  padding: 24px 0 64px;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.social-links {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 600;
}

.social-links a {
  color: #ffffff;
  text-decoration: none;
}

.social-links a:hover {
  color: #ff8c73;
}

.disclaimer {
  font-size: 0.74rem;
  max-width: 680px;
  line-height: 1.5;
  color: #8c909c;
}

.copyright {
  font-size: 0.75rem;
  color: #6d717d;
}

/* Responsive */
@media (min-width: 640px) {
  .container {
    padding: 0 20px;
  }
  .pills-scroll {
    flex-wrap: wrap;
    overflow-x: visible;
  }
  .products-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
  .card-body {
    padding: 14px;
  }
  .card-title {
    font-size: 0.96rem;
  }
}

@media (min-width: 960px) {
  .products-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
  }
  .brand-copy h1 {
    font-size: 1.55rem;
  }
}
