:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #1d1d1f;
  --ink-soft: #6b6b70;
  --line: #e6e3dc;
  --accent: #1d1d1f;
  --price: #c0392b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
  --maxw: 1080px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(251, 250, 247, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}
.brand {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.brand .tagline {
  font-weight: 400;
  font-size: 12px;
  color: var(--ink-soft);
}
.header-nav {
  display: flex;
  gap: 20px;
  font-size: 14px;
  color: var(--ink-soft);
}
.header-nav a:hover { color: var(--ink); }

/* ---------- hero ---------- */
.hero {
  padding: 56px 0 36px;
}
.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.hero p {
  margin: 0;
  color: var(--ink-soft);
  max-width: 46em;
}
.hero .meta {
  margin-top: 18px;
  font-size: 13px;
  color: var(--ink-soft);
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

/* ---------- filters ---------- */
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 0 22px;
}
.chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px;
  transition: all 0.15s ease;
}
.chip:hover { border-color: #c9c5bb; color: var(--ink); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- product grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
  padding-bottom: 72px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.card .thumb {
  /* 球衣是竖版，用 4:5 而不是正方形，避免把衣服裁断 */
  aspect-ratio: 4 / 5;
  background: #fff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}
.card .thumb img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.card .body {
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.card .name {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.4;
}
.card .sub {
  font-size: 13px;
  color: var(--ink-soft);
  min-height: 1.4em;
}
.card .price-row {
  margin-top: auto;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-top: 8px;
}
.price {
  color: var(--price);
  font-weight: 600;
  font-size: 18px;
}
.price-was {
  color: var(--ink-soft);
  font-size: 13px;
  text-decoration: line-through;
}
.badge {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 6px;
  background: #f0eee8;
  color: var(--ink-soft);
}

/* ---------- product detail ---------- */
.detail {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 48px;
  padding: 36px 0 80px;
}
@media (max-width: 840px) {
  .detail { grid-template-columns: 1fr; gap: 28px; }
}
.gallery .main {
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  /* 商品图多为竖版球衣照（约 1:2），不能锁死正方形，
     否则 cover 会把上下裁掉一半。这里用容器固定高度 + contain 完整显示。 */
  height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.gallery .main img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
@media (max-width: 840px) {
  .gallery .main { height: 420px; }
}
.img-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-soft);
  background: #fcfaf4;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
}
.thumbs {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.thumbs button {
  width: 72px;
  height: 72px;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f2f0eb;
}
.thumbs button[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 1px; }
.thumbs img { width: 100%; height: 100%; object-fit: contain; background: #fff; }

.detail h1 {
  margin: 0 0 8px;
  font-size: clamp(24px, 3.4vw, 32px);
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.detail .subtitle { color: var(--ink-soft); margin: 0 0 18px; }
.detail .price-row { margin: 0 0 22px; }
.detail .price { font-size: 28px; }

/* ---------- 颜色选择器 ---------- */
.variant-picker {
  padding-bottom: 16px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.variant-label {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 12px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.variant-label strong {
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
}
.variant-count {
  font-size: 12px;
  color: var(--ink-soft);
  margin-left: auto;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 2px;
}
.swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 5px 5px 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}
.swatch img {
  width: 100%;
  /* 竖版球衣用 4:5，contain 保证整件衣服都能看见 */
  aspect-ratio: 4 / 5;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
  padding: 2px;
}
.swatch span {
  font-size: 11px;
  line-height: 1.3;
  color: var(--ink-soft);
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-all;
}
.swatch:hover {
  border-color: #b9b4a8;
}
.swatch[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.swatch[aria-pressed="true"] span {
  color: var(--ink);
  font-weight: 600;
}

.highlights {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
}
.highlights li {
  padding-left: 22px;
  position: relative;
}
.highlights li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #2e7d32;
  font-weight: 700;
}

.buy-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- 下单表单：尺码 / 数量 / 备注 ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}
.field-label {
  font-size: 13px;
  color: var(--ink-soft);
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.field-hint {
  font-size: 12px;
  color: #b0aca2;
}

/* 多尺码：每行一个尺码 + 独立数量 */
.size-qty-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.size-qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fdfcfa;
}
.size-qty-row.is-picked {
  border-color: #c9c5bb;
  background: #faf8f3;
}
.size-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  min-width: 44px;
}

/* 尺码行里的小号数量步进器 */
.qty-stepper.mini button {
  width: 32px;
  height: 32px;
  font-size: 15px;
}
.qty-stepper.mini input {
  width: 44px;
  height: 32px;
  font-size: 14px;
}

.qty-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.qty-stepper button {
  width: 38px;
  height: 38px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 17px;
  line-height: 1;
  transition: background 0.15s ease;
}
.qty-stepper button:hover:not(:disabled) { background: #f4f2ec; }
.qty-stepper button:disabled { color: #cfcabf; cursor: not-allowed; }
.qty-stepper input {
  width: 56px;
  height: 38px;
  border: none;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  -moz-appearance: textfield;
  appearance: textfield;
}
.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.qty-tip {
  font-size: 12px;
  color: var(--ink-soft);
}

#order-remark {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  min-height: 60px;
}
#order-remark:focus {
  outline: none;
  border-color: var(--accent);
}

/* 下单提示：告诉客户把订单信息粘到淘宝备注 */
.order-hint {
  font-size: 12px;
  line-height: 1.6;
  color: #7a6a3a;
  background: #fdf8ea;
  border: 1px solid #f0e3bf;
  border-radius: 8px;
  padding: 10px 12px;
}
.order-hint strong {
  color: #5f4f1f;
  font-weight: 600;
}

.total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 12px 0 4px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink-soft);
}
.total-price {
  color: var(--price);
  font-weight: 700;
  font-size: 22px;
}

/* ---------- 详情页：全部配色图片墙 ---------- */
.color-gallery {
  border-top: 1px solid var(--line);
  margin-top: 48px;
  padding: 36px 0 80px;
}
.color-gallery h2 {
  font-size: 20px;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.color-gallery-tip {
  margin: 0 0 24px;
  font-size: 13px;
  color: var(--ink-soft);
}
.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}
@media (max-width: 640px) {
  .color-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
}
.color-card {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  cursor: pointer;
}
.color-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: #c9c5bb;
}
.color-card[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.color-card-img {
  aspect-ratio: 4 / 5;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}
.color-card-img img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.color-card-name {
  padding: 10px 10px 12px;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  color: var(--ink);
  border-top: 1px solid var(--line);
}
.buy-box .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  color: var(--ink-soft);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 22px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  width: 100%;
  transition: opacity 0.15s ease;
}
.btn:hover { opacity: 0.86; }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #fcfbf9;
}
.qr img { width: 200px; height: 200px; object-fit: contain; }
.qr .cap { font-size: 13px; color: var(--ink-soft); }

.specs {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.specs h2, .desc h2 {
  font-size: 15px;
  margin: 0 0 12px;
  letter-spacing: 0.02em;
}
.specs dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px 24px;
  margin: 0;
  font-size: 14px;
}
.specs dt { color: var(--ink-soft); }
.specs dd { margin: 0; }

.desc {
  margin-top: 32px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  font-size: 15px;
  color: #333;
}
.desc p { margin: 0 0 14px; }

/* ---------- misc ---------- */
.notice {
  background: #fff8e6;
  border: 1px solid #f0e0b8;
  color: #7a5c15;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  margin: 0 0 24px;
}
.empty {
  padding: 80px 0;
  text-align: center;
  color: var(--ink-soft);
}
.crumbs {
  padding: 20px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}
.crumbs a:hover { color: var(--ink); }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 32px 0 48px;
  font-size: 13px;
  color: var(--ink-soft);
}
.site-footer .row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 36px;
  transform: translateX(-50%) translateY(20px);
  background: #1d1d1f;
  color: #fff;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s ease;
  z-index: 50;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
