:root {
  --page-bg: #ffffff;
  --ink: #1f2430;
  --muted: #647087;
  --accent: #ff3d00;
  --sale: #6b492f;
  --tab: #f2f3f5;
  --line: #e7e2da;
  --page-width: 1300px;
  --topbar-height: 68px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--page-bg);
  color: var(--ink);
  font-family: Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
}

.hero-preview {
  display: flex;
  justify-content: center;
  padding: 28px 14px 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.preview-frame {
  position: relative;
  overflow: hidden;
  width: min(460px, 70vw);
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  background: #f2f2f2;
}

.preview-base,
.preview-overlay {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-frame.empty .preview-base {
  display: none;
}

.preview-overlays {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  height: var(--topbar-height);
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.nav,
.option-panel,
.product-grid {
  max-width: var(--page-width);
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: center;
}

.nav-divider {
  width: 1px;
  height: 28px;
  margin: 0 10px;
  background: var(--line);
}

.nav-item {
  min-width: 0;
  height: 38px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: #444b58;
  font-size: 15px;
  cursor: pointer;
}

.nav-item.active {
  background: transparent;
  color: #1f232b;
  font-weight: 700;
}

.page {
  padding: 18px 14px 28px;
}

.option-panel {
  position: sticky;
  top: var(--topbar-height);
  z-index: 9;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  min-height: 50px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  margin: 0 auto;
}

.option-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.option-row-sub {
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.option-chip,
.option-clear {
  height: 30px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: #434a56;
  font-size: 14px;
  cursor: pointer;
}

.option-chip.active {
  background: transparent;
  color: #1f232b;
  font-weight: 700;
}

.option-clear {
  color: #8a6470;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  gap: 26px 16px;
  max-width: var(--page-width);
  margin: 0 auto;
}

.product-card {
  min-width: 0;
  cursor: pointer;
}

.image-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  background: #eee9df;
}

.product-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-image-empty {
  background: #f2f2f2;
}

.overlay-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.swatches {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 42px;
  padding: 10px 4px 0;
}

.swatch {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  object-fit: cover;
  background: #eee;
}

.more {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border: 1px solid #e3e5ea;
  border-radius: 50%;
  background: #fff;
  color: #8b92a0;
  font-size: 22px;
  line-height: 24px;
}

.product-title {
  display: -webkit-box;
  margin: 10px 8px 0;
  min-height: 46px;
  overflow: hidden;
  color: #232936;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.tmall-logo {
  display: inline-block;
  width: 58px;
  height: 17px;
  margin-right: 4px;
  object-fit: contain;
  vertical-align: -2px;
}

.rank-line {
  margin: 6px 8px 0;
  min-height: 22px;
  overflow: hidden;
  color: #d87a23;
  font-size: 14px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 8px 8px 0;
}

.price {
  color: var(--accent);
  letter-spacing: 0;
}

.currency {
  margin-right: 1px;
  font-size: 14px;
  font-weight: 600;
}

.amount {
  font-size: 24px;
  font-weight: 650;
}

.buyers {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .product-grid {
    grid-template-columns: repeat(4, minmax(160px, 1fr));
  }
}

@media (max-width: 940px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    height: auto;
    gap: 10px;
    padding: 12px;
  }

  .option-panel {
    top: 59px;
  }

  .nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-item {
    flex: 0 0 auto;
    min-width: 76px;
    height: 34px;
    padding: 0 12px;
    font-size: 14px;
  }

  .page {
    padding: 12px 10px 22px;
  }

  .option-panel {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 8px 10px;
  }

  .option-row {
    flex: 0 0 auto;
    flex-wrap: nowrap;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 10px;
  }

  .product-title {
    margin-inline: 4px;
    font-size: 14px;
  }

  .rank-line {
    margin-inline: 4px;
    font-size: 12px;
  }

  .price-row {
    margin-inline: 4px;
  }

  .price {
    line-height: 1;
  }

  .currency {
    font-size: 12px;
  }

  .amount {
    font-size: 21px;
  }

  .buyers {
    font-size: 12px;
  }
}
