/* ---------- 设计变量 ---------- */
:root {
  --bg: #f8f5f0;
  --card: #ffffff;
  --ink: #1b1a1f;
  --ink-soft: #3d3a45;
  --muted: #726d7b;
  --line: #e9e3da;
  --line-soft: #f1ece5;
  --accent: #6b4bff;
  --accent-deep: #5a37f0;
  --purple-bg: #efeaff;
  --purple-ink: #5b3ce0;
  --orange-bg: #fff2e4;
  --orange-ink: #b1680f;
  --red-bg: #ffe9ec;
  --red-ink: #d63a4c;
  --green-bg: #e8f7ee;
  --green-ink: #1c7a4c;
  --gray-bg: #f1efec;
  --gray-ink: #837e8b;
  --radius: 22px;
  --shadow-sm: 0 1px 2px rgba(28, 25, 20, .04), 0 10px 26px -18px rgba(28, 25, 20, .35);
  --shadow-lg: 0 30px 70px -30px rgba(28, 25, 20, .45);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 560px at 10% -12%, #fdf1e4 0%, rgba(253, 241, 228, 0) 62%),
    radial-gradient(900px 520px at 94% -4%, #efeafd 0%, rgba(239, 234, 253, 0) 58%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 34px 24px 90px;
}

/* ---------- 顶部栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 10px 9px 8px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px 7px 12px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  background: #fbf9f6;
  border: 1px solid var(--line-soft);
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.back:hover { background: #fff; color: var(--accent-deep); transform: translateX(-1px); }
.back svg { width: 15px; height: 15px; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding-right: 12px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}
.status i {
  width: 7px; height: 7px; border-radius: 50%;
  background: #22b573;
  box-shadow: 0 0 0 3px rgba(34, 181, 115, .16);
}

/* ---------- 标题区 ---------- */
.hero { padding: 34px 4px 26px; }
.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(26px, 3.4vw, 36px);
  line-height: 1.25;
  letter-spacing: -.02em;
  font-weight: 800;
}
.hero p {
  margin: 0;
  font-size: 14.5px;
  color: var(--muted);
  max-width: 640px;
}

/* ---------- 卡片网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 20px 20px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform .22s cubic-bezier(.2, .8, .3, 1), box-shadow .22s ease, border-color .22s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: #ded5f6;
  box-shadow: 0 18px 44px -22px rgba(60, 40, 120, .35);
}
.card.is-featured {
  border-color: #d9d0fb;
  background: linear-gradient(180deg, #fdfcff 0%, #ffffff 42%);
}
.card.is-featured::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(150deg, rgba(107, 75, 255, .5), rgba(107, 75, 255, 0) 55%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.pill {
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.pill.purple { background: var(--purple-bg); color: var(--purple-ink); }
.pill.orange { background: var(--orange-bg); color: var(--orange-ink); }
.pill.red { background: var(--red-bg); color: var(--red-ink); }
.pill.green { background: var(--green-bg); color: var(--green-ink); }
.pill.gray { background: var(--gray-bg); color: var(--gray-ink); }

.card h2 {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -.01em;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.tag {
  font-size: 11.5px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 7px;
  background: #f7f4ff;
  color: #6a5c96;
  border: 1px solid #ece6fb;
}
.tag.stock {
  background: var(--green-bg);
  color: var(--green-ink);
  border-color: #d6efe1;
}

.desc {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}

.features {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: grid;
  gap: 9px;
}
.features li {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 8px;
  align-items: start;
  font-size: 12.8px;
  color: var(--ink-soft);
  line-height: 1.55;
}
.features svg {
  width: 14px;
  height: 14px;
  margin-top: 3px;
  fill: currentColor;
  color: #a996f8;
}
.card.is-out .features li { color: #8e8996; }
.card.is-out .features svg { color: #d6d1dc; }

.bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.price {
  display: flex;
  align-items: baseline;
  gap: 3px;
  line-height: 1;
}
.price .cur {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  transform: translateY(-1px);
}
.price .num {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.price .unit {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 2px;
}
.card.is-out .price .cur,
.card.is-out .price .num { color: #a29daa; }

.btn {
  flex: none;
  border: 0;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 650;
  padding: 10px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.btn-order {
  color: #fff;
  background: linear-gradient(160deg, #7a5cff 0%, var(--accent-deep) 100%);
  box-shadow: 0 10px 22px -12px rgba(90, 55, 240, .95);
}
.btn-order:hover { transform: translateY(-1px); filter: brightness(1.05); box-shadow: 0 14px 26px -12px rgba(90, 55, 240, 1); }
.btn-order:active { transform: translateY(0) scale(.985); }
.btn-order[disabled] { opacity: .7; cursor: progress; transform: none; filter: none; }
.btn-sold {
  color: #a8a3b0;
  background: var(--gray-bg);
  cursor: not-allowed;
}

/* ---------- 说明条 ---------- */
.note {
  margin: 26px 4px 0;
  padding: 18px 20px;
  display: grid;
  gap: 6px;
  font-size: 12.8px;
  color: var(--muted);
  background: rgba(255, 255, 255, .6);
  border: 1px dashed var(--line);
  border-radius: 16px;
}
.note strong { color: var(--ink-soft); font-weight: 650; }

/* ---------- 悬浮客服 ---------- */
.fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(160deg, #7a5cff, var(--accent-deep));
  box-shadow: 0 16px 34px -14px rgba(90, 55, 240, .9);
  cursor: pointer;
  transition: transform .18s ease;
}
.fab:hover { transform: translateY(-2px) scale(1.03); }
.fab svg { width: 24px; height: 24px; fill: currentColor; }

/* ---------- 下单弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.open { display: flex; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 20, 32, .46);
  backdrop-filter: blur(7px);
  animation: fade .2s ease both;
}

.modal-card {
  position: relative;
  width: min(372px, 100%);
  padding: 26px 24px 22px;
  background: #fff;
  border-radius: 26px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: pop .26s cubic-bezier(.2, .9, .3, 1.15) both;
}

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.96); } }

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #f5f3ef;
  color: #7b7684;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}
.modal-close:hover { background: #ece9e3; color: var(--ink); }

.modal-card h3 {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -.01em;
}
.modal-sub {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
}
.modal-sub b { color: var(--accent-deep); font-weight: 700; }

.order-chip {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 auto 14px;
  padding: 7px 12px;
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  background: #f7f4ff;
  border: 1px dashed #ddd2ff;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.order-chip.show { display: inline-flex; }
.order-chip b { font-weight: 700; letter-spacing: .02em; color: var(--accent-deep); }
.order-chip span { font-size: 11.5px; color: #8b80b5; }

.qr-frame {
  position: relative;
  width: 216px;
  height: 216px;
  margin: 0 auto 16px;
  padding: 10px;
  border-radius: 20px;
  background: #fbf9f6;
  border: 1px dashed #ded7cd;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.qr-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
}
.qr-placeholder {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 0 10px;
  color: #a49e9a;
}
.qr-placeholder svg { width: 34px; height: 34px; fill: none; stroke: #c3bbb2; stroke-width: 1.6; }
.qr-placeholder span { font-size: 11.5px; line-height: 1.7; }
.qr-placeholder code {
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 5px;
  background: #f1ece5;
  color: #8d8579;
}

.modal-tip {
  margin: 0 0 14px;
  font-size: 12.8px;
  color: var(--muted);
  line-height: 1.7;
}
.modal-tip b { color: var(--ink-soft); font-weight: 650; }

.copy-btn {
  width: 100%;
  padding: 11px 16px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 650;
  color: #fff;
  background: linear-gradient(160deg, #7a5cff, var(--accent-deep));
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: filter .16s ease;
}
.copy-btn:hover { filter: brightness(1.06); }

/* ---------- 骨架屏 / 错误提示 ---------- */
.skeleton {
  height: 330px;
  border-radius: var(--radius);
  background: linear-gradient(100deg, #fff 30%, #f6f2ec 50%, #fff 70%);
  background-size: 220% 100%;
  animation: shimmer 1.4s infinite linear;
  border: 1px solid var(--line);
}
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -80% 0; } }

.banner {
  display: none;
  margin-bottom: 18px;
  padding: 11px 16px;
  border-radius: 14px;
  font-size: 12.8px;
  background: var(--orange-bg);
  color: var(--orange-ink);
  border: 1px solid #f6e0c7;
}
.banner.show { display: block; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .wrap { padding: 20px 16px 84px; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .hero { padding: 24px 2px 20px; }
  .status { display: none; }
  .card h2 { font-size: 18.5px; }
  .price .num { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; transition-duration: .001s !important; }
}
