/* ============================================================
 * 简约商品展示站 · 全局样式
 * 调色：米白 #fafafa / 近黑 #0a0a0c / 信号红 #d41d1f
 * ============================================================ */
:root {
  --bg: #fafafa;
  --ink: #0a0a0c;
  --ink-2: #6b6b70;
  --ink-3: #a8a8ad;
  --red: #d41d1f;
  --line: #e8e8ea;
  --card: #ffffff;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  max-width: 540px;
  margin: 0 auto;
  min-height: 100vh;
  line-height: 1.5;
}

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

::selection { background: var(--ink); color: #fff; }

/* ---------- 通用：顶部导航条 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 12px;
  background: rgba(250, 250, 250, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .back {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.topbar .back svg { width: 20px; height: 20px; stroke: var(--ink); }
.topbar .title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  max-width: 60%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar .home-link {
  margin-left: auto;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.topbar .home-link svg { width: 20px; height: 20px; stroke: var(--ink); }

/* ---------- 通用：商品卡片（2 列大卡） ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.card {
  background: var(--card);
  padding: 14px 14px 16px;
  display: block;
  transition: opacity 0.15s ease;
}
.card:active { opacity: 0.6; }
.card .pic {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f2f2f3;
  margin-bottom: 12px;
}
.card .pic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.card .name {
  font-size: 0.85rem;
  line-height: 1.4;
  height: 2.4em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 8px;
}
.card .price-row { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.card .sale {
  color: var(--red);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}
.card .sale::first-letter { font-size: 0.72em; font-weight: 600; }
.card .sale .yen { font-size: 0.72em; font-weight: 600; }
.card .orig {
  color: var(--ink-3);
  font-size: 0.72rem;
  text-decoration: line-through;
}
.card .tag {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.68rem;
  color: var(--red);
  border: 1px solid rgba(212, 29, 31, 0.35);
  padding: 1px 6px;
  border-radius: 2px;
  letter-spacing: 0.02em;
}

/* ---------- 通用：商品卡片（3 列小卡） ---------- */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--card);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.mini-card {
  background: var(--card);
  padding: 12px 10px 14px;
  display: block;
  border-right: 1px solid var(--line);
}
.mini-card:active { opacity: 0.6; }
.mini-card .pic {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f2f2f3;
  margin-bottom: 10px;
}
.mini-card .pic img { width: 100%; height: 100%; object-fit: cover; }
.mini-card .name {
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
  color: var(--ink);
}
.mini-card .sale { color: var(--red); font-weight: 700; font-size: 0.9rem; }
.mini-card .sale .yen { font-size: 0.72em; }
.mini-card .orig {
  color: var(--ink-3);
  font-size: 0.65rem;
  text-decoration: line-through;
  margin-left: 4px;
}

/* ---------- 通用：区块标题 ---------- */
.section { padding: 34px 0 0; }
.section-head {
  text-align: center;
  padding: 0 20px 18px;
}
.section-head .kicker {
  font-size: 0.68rem;
  letter-spacing: 0.35em;
  color: var(--ink-3);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.section-head h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.section-head.with-sub .sub {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--ink-2);
}

/* 探索更多按钮 */
.explore {
  display: flex;
  justify-content: center;
  padding: 20px 0 6px;
  background: var(--card);
}
.explore a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--ink);
  padding: 10px 26px;
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  color: var(--ink);
  transition: background 0.2s ease, color 0.2s ease;
}
.explore a:active { background: var(--ink); color: #fff; }
.explore a svg { width: 14px; height: 14px; }

/* ---------- 首页：轮播 ---------- */
.hero { position: relative; overflow: hidden; background: #ececee; }
.hero-track {
  display: flex;
  transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.hero-slide {
  position: relative;
  flex: 0 0 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}
.hero-slide img { width: 100%; height: 100%; object-fit: cover; }
.hero-slide .slogan {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 60px 20px 26px;
  background: linear-gradient(to top, rgba(10, 10, 12, 0.55), transparent);
  color: #fff;
}
.hero-slide .slogan .big {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin-bottom: 4px;
}
.hero-slide .slogan .small {
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  opacity: 0.85;
}
.hero-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}
.hero-dots i {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  transition: all 0.25s ease;
}
.hero-dots i.on { background: #fff; width: 14px; border-radius: 3px; }

/* ---------- 首页：分类速览 ---------- */
.quick-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}
.quick-nav a {
  background: var(--card);
  padding: 16px 6px 14px;
  text-align: center;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
}
.quick-nav a:active { opacity: 0.6; }
.quick-nav .qn-pic {
  width: 52px;
  height: 52px;
  margin: 0 auto 8px;
  border-radius: 50%;
  overflow: hidden;
  background: #f2f2f3;
}
.quick-nav .qn-pic img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- 首页：更多商品 ---------- */
.more-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 38px 24px 20px;
}
.more-head::before, .more-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.more-head span {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-indent: 0.25em;
}

/* ---------- 首页：页脚 ---------- */
.footer {
  padding: 34px 20px 44px;
  text-align: center;
  color: var(--ink-3);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}
.footer .f-logo {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  margin-bottom: 8px;
}

/* ---------- 详情页：轮播 ---------- */
.d-hero { position: relative; background: #fff; }
.d-hero .hero-slide { aspect-ratio: 1 / 1; }
.d-hero-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 14px 0;
  background: #fff;
}
.d-hero-dots i {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #d4d4d8;
  transition: all 0.25s ease;
}
.d-hero-dots i.on { background: var(--ink); width: 14px; border-radius: 3px; }

/* ---------- 详情页：信息区 ---------- */
.d-info { background: #fff; padding: 4px 16px 18px; border-top: 1px solid var(--line); }
.d-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 14px 0 6px;
}
.d-price {
  color: var(--red);
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1;
}
.d-price .yen { font-size: 0.55em; font-weight: 600; margin-right: 1px; }
.d-price-label {
  color: var(--red);
  font-size: 0.72rem;
  align-self: center;
}
.d-orig {
  color: var(--ink-3);
  font-size: 0.78rem;
  text-decoration: line-through;
  align-self: center;
}
.d-tag {
  display: inline-block;
  font-size: 0.7rem;
  color: var(--red);
  border: 1px solid rgba(212, 29, 31, 0.35);
  padding: 2px 8px;
  border-radius: 2px;
  margin-bottom: 10px;
}
.d-name-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.d-name {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  flex: 1;
}
.d-param-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.78rem;
  color: var(--ink-2);
  padding: 4px 0 4px 12px;
  border-left: 1px solid var(--line);
}
.d-param-btn svg { width: 12px; height: 12px; stroke: var(--ink-3); }
.d-meta {
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--ink-2);
  display: flex;
  gap: 14px;
}

/* ---------- 详情页：板块 ---------- */
.d-section { margin-top: 10px; background: #fff; padding: 18px 16px 20px; }
.d-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.d-section-head h3 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding-left: 10px;
  border-left: 3px solid var(--red);
  line-height: 1.1;
}
.d-section-head h3 .count {
  font-size: 0.72rem;
  color: var(--ink-3);
  font-weight: 400;
  margin-left: 6px;
}
.d-section-head .all-btn {
  font-size: 0.78rem;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.d-section-head .all-btn svg { width: 12px; height: 12px; stroke: var(--ink-3); }

/* 相关推荐：横向滑动 */
.rel-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  margin: 0 -16px;
  padding: 0 16px 4px;
}
.rel-scroll::-webkit-scrollbar { display: none; }
.rel-card { flex: 0 0 31%; min-width: 108px; display: block; }
.rel-card:active { opacity: 0.6; }
.rel-card .pic {
  aspect-ratio: 1 / 1;
  background: #f2f2f3;
  overflow: hidden;
  margin-bottom: 8px;
}
.rel-card .pic img { width: 100%; height: 100%; object-fit: cover; }
.rel-card .name {
  font-size: 0.7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.rel-card .sale { color: var(--red); font-weight: 700; font-size: 0.88rem; }
.rel-card .sale .yen { font-size: 0.72em; }

/* 图文详情 */
.d-detail-imgs img { width: 100%; margin-bottom: 0; }
.d-detail-imgs img + img { margin-top: 2px; }

/* 猜你喜欢标题 */
.guess-head { text-align: center; margin-bottom: 16px; }
.guess-head .line {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
}
.guess-head .line::before, .guess-head .line::after {
  content: "";
  width: 42px;
  height: 1px;
  background: var(--line);
}
.guess-head .sub {
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--ink-3);
  letter-spacing: 0.1em;
}
.guess-grid { margin: 0 -16px; }

/* ---------- 参数弹层 ---------- */
.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 12, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 90;
  max-width: 540px;
  margin: 0 auto;
}
.sheet-mask.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-width: 540px;
  margin: 0 auto;
  background: #fff;
  border-radius: 14px 14px 0 0;
  transform: translateY(100%);
  visibility: hidden;
  transition: transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1),
              visibility 0s 0.32s;
  z-index: 95;
  max-height: 78vh;
  display: flex;
  flex-direction: column;
}
.sheet.open {
  transform: translateY(0);
  visibility: visible;
  transition: transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.sheet-title {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 16px 0 12px;
}
.sheet-body { overflow-y: auto; padding: 0 20px 10px; flex: 1; }
.sheet-row {
  display: flex;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}
.sheet-row:last-child { border-bottom: none; }
.sheet-row .k { flex: 0 0 64px; color: var(--ink-3); }
.sheet-row .v { flex: 1; color: var(--ink); line-height: 1.55; word-break: break-all; }
.sheet-confirm {
  margin: 8px 16px calc(14px + env(safe-area-inset-bottom));
  background: var(--ink);
  color: #fff;
  text-align: center;
  padding: 13px 0;
  border-radius: 24px;
  font-size: 0.9rem;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  width: calc(100% - 32px);
}
.sheet-confirm:active { opacity: 0.85; }

/* ---------- 列表页 ---------- */
.sort-bar {
  position: sticky;
  top: 48px;
  z-index: 40;
  display: flex;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.sort-bar button {
  flex: 1;
  padding: 12px 0;
  font-size: 0.85rem;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.sort-bar button.on { color: var(--red); font-weight: 600; }
.sort-bar .arrow { display: inline-flex; flex-direction: column; gap: 1px; }
.sort-bar .arrow i {
  width: 0; height: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
}
.sort-bar .arrow .up { border-bottom: 4.5px solid #c8c8cd; }
.sort-bar .arrow .down { border-top: 4.5px solid #c8c8cd; }
.sort-bar button.asc .arrow .up { border-bottom-color: var(--red); }
.sort-bar button.desc .arrow .down { border-top-color: var(--red); }
.list-count {
  padding: 12px 16px;
  font-size: 0.72rem;
  color: var(--ink-3);
  letter-spacing: 0.05em;
}
.empty-tip {
  padding: 80px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
}
