:root {
  --bg: #f5f5f3;
  --surface: #ffffff;
  --text: #1d1f21;
  --muted: #6b7280;
  --accent: #1d1f21;
  --accent-hover: #333;
  --border: #e5e7eb;
  --success: #059669;
  --sale: #dc2626;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

img { max-width: 100%; display: block; }

button, input, select { font: inherit; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.logo img { width: 36px; height: 36px; border-radius: 6px; }

.logo span { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; }

.cart-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s;
}

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

.cart-count {
  background: #fff;
  color: var(--accent);
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Hero / Trust */
.hero {
  padding: 32px 0 24px;
}

.hero h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin-bottom: 8px;
}

.hero p {
  color: var(--muted);
  margin-bottom: 20px;
}

.trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.trust-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
}

.trust-item .icon { font-size: 1.5rem; margin-bottom: 4px; }

.trust-item strong { display: block; font-size: 0.9rem; }

.trust-item span { font-size: 0.78rem; color: var(--muted); }

.tracking-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 28px;
}

.tracking-section h2 {
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.tracking-section .sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 16px;
}

.tracking-list {
  display: grid;
  gap: 10px;
}

.tracking-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 0.85rem;
}

.tracking-item .status {
  background: #dcfce7;
  color: #166534;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.tracking-item .info { flex: 1; min-width: 0; }

.tracking-item .product-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tracking-item .meta { color: var(--muted); font-size: 0.78rem; }

/* Filters */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  align-items: center;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.filter-select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.product-count {
  font-size: 0.85rem;
  color: var(--muted);
  margin-left: auto;
}

/* Products */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 28px 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s;
}

.product-card:hover { box-shadow: var(--shadow); }

.product-img {
  aspect-ratio: 1;
  background: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12px;
}

.product-img .placeholder,
.cart-item-img.placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 2rem;
  background: #f9fafb;
}

.cart-item-img.placeholder {
  width: 64px;
  height: 64px;
  font-size: 1.5rem;
  border-radius: 8px;
}

.product-body { padding: 14px; flex: 1; display: flex; flex-direction: column; }

.product-brand {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.product-title {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-rating {
  font-size: 0.78rem;
  color: #f59e0b;
  margin-bottom: 8px;
}

.product-price {
  margin-bottom: 10px;
}

.price-current {
  font-size: 1.05rem;
  font-weight: 700;
}

.price-original {
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: line-through;
  margin-left: 6px;
}

.variant-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 10px;
  font-size: 0.82rem;
  background: var(--surface);
}

.add-btn {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  margin-top: auto;
  transition: background 0.15s;
}

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

/* Cart drawer */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.overlay.open { opacity: 1; visibility: visible; }

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100vw);
  height: 100vh;
  background: var(--surface);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
}

.cart-drawer.open { transform: translateX(0); }

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.cart-header h2 { font-size: 1.1rem; }

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 4px;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.cart-empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
}

.cart-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.cart-item-img {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: var(--bg);
  object-fit: contain;
  flex-shrink: 0;
}

.cart-item-info { flex: 1; min-width: 0; }

.cart-item-title {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.cart-item-variant {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.cart-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.qty-control button {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg);
  cursor: pointer;
  font-size: 1rem;
}

.qty-control span {
  width: 32px;
  text-align: center;
  font-size: 0.85rem;
}

.cart-item-price { font-weight: 700; font-size: 0.9rem; }

.remove-btn {
  background: none;
  border: none;
  color: var(--sale);
  font-size: 0.78rem;
  cursor: pointer;
  margin-top: 4px;
}

.cart-footer {
  padding: 16px 20px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.cart-total {
  display: flex;
  justify-content: space-between;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.copy-btn {
  width: 100%;
  padding: 14px;
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 8px;
  transition: opacity 0.15s;
}

.copy-btn:hover { opacity: 0.9; }

.copy-hint {
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--accent);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 300;
  opacity: 0;
  transition: transform 0.25s, opacity 0.25s;
  pointer-events: none;
}

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

.footer {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
  font-size: 0.82rem;
}

@media (max-width: 600px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .product-body { padding: 10px; }
  .trust-grid { grid-template-columns: repeat(2, 1fr); }
}
