:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #14171f;
  --muted: #666d7a;
  --border: #e6e8ec;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --discount: #d92d20;
  --success: #16a34a;
  --gold: #b45309;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 28px rgba(16, 24, 40, 0.10);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }

.page { max-width: 1160px; margin: 0 auto; padding: 0 1.5rem 4rem; flex: 1; width: 100%; }

/* ── Header ─────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.brand-icon { font-size: 1.4rem; }
.brand-accent { color: var(--accent); }
.breadcrumb { font-size: 0.85rem; color: var(--muted); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { margin: 0 0.4rem; }

/* ── Hero ───────────────────────────────── */
.hero, .landing-hero {
  background: linear-gradient(180deg, #eef2ff 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}
.hero-inner, .landing-hero-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 3rem 1.5rem 2.5rem;
}
.landing-hero-inner { padding: 2rem 1.5rem; }
.hero h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 0.6rem;
  max-width: 40ch;
}
.landing-hero h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}
.hero p, .landing-hero p { color: var(--muted); margin: 0; font-size: 1.05rem; }

/* ── Landing list (home) ───────────────── */
.landing-grid {
  list-style: none;
  padding: 0;
  margin: 2.5rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}
.landing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.landing-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.landing-card-link { display: block; padding: 1.5rem; }
.landing-card-icon { font-size: 1.75rem; margin-bottom: 0.6rem; }
.landing-card-title { font-size: 1.1rem; font-weight: 700; margin: 0 0 0.35rem; letter-spacing: -0.01em; }
.landing-card-count { color: var(--muted); font-size: 0.9rem; margin: 0 0 1rem; }
.landing-card-cta { color: var(--accent); font-weight: 700; font-size: 0.9rem; }

.empty { color: var(--muted); margin-top: 2.5rem; font-size: 1.05rem; }

/* ── Controls bar ───────────────────────── */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0 1.5rem;
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.control-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.control-checkbox input { width: 1rem; height: 1rem; accent-color: var(--accent); }
.control-select {
  margin-left: auto;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
}

/* ── Product grid ───────────────────────── */
.product-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.1rem;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.product-link { display: flex; flex-direction: column; height: 100%; position: relative; }

.discount-badge {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  background: var(--discount);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  z-index: 1;
  box-shadow: var(--shadow-sm);
}

.product-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.product-image img { max-width: 85%; max-height: 85%; object-fit: contain; }
.no-image { color: var(--muted); font-size: 0.8rem; }

.product-body { padding: 0.9rem 1rem 1.1rem; display: flex; flex-direction: column; flex: 1; }

.product-title {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}

.sales-rank { font-size: 0.72rem; color: var(--gold); font-weight: 700; margin: 0 0 0.4rem; }

.product-price-row { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.price { color: var(--text); font-weight: 800; font-size: 1.05rem; }
.price-muted { color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.original-price { color: var(--muted); font-size: 0.82rem; text-decoration: line-through; }

.cta-button {
  margin-top: auto;
  text-align: center;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
  transition: background 0.15s ease;
}
.product-link:hover .cta-button { background: var(--accent-dark); }

/* ── Footer ─────────────────────────────── */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.site-footer-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}
.site-footer-inner p { margin: 0 0 0.4rem; }
.site-footer-inner .copy { margin: 0; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a21;
    --text: #eceef1;
    --muted: #9aa1ac;
    --border: #262a33;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.35);
    --shadow-lg: 0 12px 28px rgba(0,0,0,0.4);
  }
  .hero, .landing-hero { background: linear-gradient(180deg, #1a1f2e 0%, var(--bg) 100%); }
  .product-image { background: #fff; }
}
