:root {
  --brand: #4f6ef7;
  --brand-dark: #3b57d8;
  --wx: #07c160;
  --ali: #1677ff;
  --text: #1f2430;
  --sub: #6b7280;
  --line: #ececf1;
  --bg: #f5f6fa;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(24, 32, 66, 0.07);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #4f6ef7, #6f8bff);
  color: #fff;
  box-shadow: 0 2px 10px rgba(79, 110, 247, .25);
}
.brand { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.top-actions { display: flex; gap: 8px; }
.btn-ghost {
  border: 1px solid rgba(255, 255, 255, .6);
  background: rgba(255, 255, 255, .14);
  color: #fff;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
}

/* ---------- 公告（大厅） ---------- */
.hall-wrap {
  margin: 12px 16px 0;
  background: #fff8e6;
  border: 1px solid #ffe6ad;
  color: #8a6100;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hall-wrap .hall-icon { flex: 0 0 auto; font-weight: 700; }
.hall-viewport { overflow: hidden; flex: 1; height: 20px; }
.hall-track { transition: transform .45s ease; }
.hall-track > div { height: 20px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 商品 ---------- */
.container { padding: 14px 16px 96px; }

.goods-card {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 14px;
}

/* v1.1.5：热卖角标（卡片右上角） */
.hot-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  background: linear-gradient(135deg, #ff3d3d, #ff7a18);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 5px 10px;
  border-radius: 999px;
  box-shadow: 0 3px 8px rgba(255, 61, 61, .35);
}
/* 热卖标记（款式 A）：右上角橙色斜角丝带 */
.spec-btn .hot-ribbon {
  position: absolute;
  top: 0;
  right: 0;
  width: 64px;
  height: 64px;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}
.spec-btn .hot-ribbon::before {
  content: 'HOT';
  position: absolute;
  top: 14px;
  right: -20px;
  width: 86px;
  transform: rotate(45deg);
  background: #ff6b4a;
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .5px;
  text-align: center;
  line-height: 17px;
}

.goods-cover { width: 100%; height: 168px; object-fit: cover; display: block; background: #eef1f8; }
.goods-body { padding: 14px; }
.goods-name { font-size: 16px; font-weight: 700; margin: 0 0 6px; }
.goods-desc { font-size: 13px; color: var(--sub); margin: 0 0 12px; white-space: pre-wrap; }

.spec-list { display: flex; flex-wrap: wrap; gap: 10px; }
.spec-btn {
  position: relative;
  overflow: hidden;
  flex: 1 1 46%;
  min-width: 140px;
  text-align: left;
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  transition: .15s;
}
.spec-btn:active { transform: scale(.98); }
/* 热卖规格按钮（款式 A）：白底 + 淡橙描边，靠右上角丝带识别 */
.spec-btn.hot {
  background: #fff;
  border: 1.5px solid #f3c9bd;
  box-shadow: none;
}
.spec-btn.hot:hover { border-color: #eeae9b; }
.spec-btn.hot .s-name { color: #2d3748; }
.spec-btn.hot .s-meta { color: #6b7280; }
.spec-btn.hot .s-price { color: #e5533d; }
.spec-btn .s-name { display: block; font-size: 14px; font-weight: 600; }
.spec-btn .s-meta { display: block; margin-top: 4px; font-size: 12px; color: var(--sub); }
.spec-btn .s-price { color: #ff5722; font-weight: 700; font-size: 15px; }
.spec-btn .s-stock { margin-left: 6px; }
.spec-btn.disabled {
  background: #f3f4f7; color: #9aa1ad; border-color: #e7e8ee;
}
.spec-btn.disabled .s-price { color: #9aa1ad; }

.empty { text-align: center; color: var(--sub); padding: 60px 0; }

.footer { text-align: center; color: #9aa1ad; font-size: 12px; padding: 0 0 90px; }

/* ---------- 浮动客服 ---------- */
.fab {
  position: fixed;
  right: 16px;
  bottom: 20px;
  z-index: 30;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(79, 110, 247, .38);
}

/* ---------- 弹层 ---------- */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 20, 32, .5);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.mask[hidden] { display: none; }
.modal {
  width: 100%;
  max-width: 420px;
  max-height: 86vh;
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  padding: 18px;
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.94); opacity: .6; } to { transform: scale(1); opacity: 1; } }

.modal-title { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
.modal-sub { font-size: 13px; color: var(--sub); margin: 0 0 14px; }

/* 弹窗公告富文本自适应：
   公告内容可能是 wangEditor 插入的 base64 大图，编辑器自带的 inline max-width 会被
   前端白名单过滤掉，这里用 CSS 统一兜住，避免图片撑破 420px 的弹窗、出现横向滚动条。 */
#popupContent { word-break: break-word; overflow-wrap: anywhere; }
#popupContent p { margin: 0 0 8px; }
#popupContent img {
  max-width: 100%;
  width: auto;
  height: auto;
  display: block;
  margin: 10px auto;
  border-radius: 8px;
}
/* 表格、视频之类也一并收进弹窗宽度 */
#popupContent table { max-width: 100%; display: block; overflow-x: auto; }
#popupContent iframe,
#popupContent video { max-width: 100%; height: auto; }

/* 公告里的链接：自动画成可点徽章（胶囊 + 外链箭头），一眼能看出可跳转 */
#popupContent a[href],
#popupContent a.notice-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  margin: 3px 2px;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(79, 105, 246, .10);
  border: 1px solid rgba(79, 105, 246, .30);
  color: #3550c9;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  text-decoration: none;
  word-break: break-all;
  vertical-align: middle;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
#popupContent a[href]:hover,
#popupContent a.notice-link:hover {
  background: rgba(79, 105, 246, .18);
  border-color: rgba(79, 105, 246, .55);
  transform: translateY(-1px);
}
/* 外链箭头；页内锚点不显示 */
#popupContent a[href]::after {
  content: '\2197';
  font-size: 12px;
  opacity: .8;
  line-height: 1;
}
#popupContent a[href^="#"]::after { content: ''; }
#popupContent a[href]:active { transform: translateY(0); }

.field { margin-bottom: 14px; }
.field-label { font-size: 13px; color: var(--sub); margin-bottom: 6px; }
.input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  outline: none;
  background: #fbfbfd;
  color: var(--text);
}
.input:focus { border-color: var(--brand); background: #fff; }

.qty { display: flex; align-items: center; gap: 12px; }
.qty button {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1.5px solid var(--line); background: #fff; font-size: 18px; color: var(--text);
}
.qty button:disabled { color: #c6c9d2; }
.qty input {
  width: 64px; text-align: center; border: 1.5px solid var(--line);
  border-radius: 10px; padding: 8px 0; font-size: 15px; outline: none;
}

.pay-methods { display: flex; gap: 10px; }
.pay-item {
  flex: 1;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  background: #fff;
}
.pay-item .dot { width: 16px; height: 16px; border-radius: 50%; }
.pay-item.wx .dot { background: var(--wx); }
.pay-item.ali .dot { background: var(--ali); }
.pay-item.active { border-color: var(--brand); background: #f2f5ff; font-weight: 600; }
.pay-item[hidden] { display: none; }
.pay-empty {
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  padding: 11px;
  font-size: 13px;
  color: var(--sub);
  background: #fafbfe;
  line-height: 1.5;
}

.summary {
  display: flex; justify-content: space-between; align-items: center;
  background: #f7f8fc; border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px;
}
.summary .total { color: #ff5722; font-weight: 700; font-size: 18px; }

.btn-main {
  width: 100%; border: none; border-radius: 12px; padding: 13px;
  background: var(--brand); color: #fff; font-size: 16px; font-weight: 600;
}
.btn-main:disabled { background: #b9c2e8; }
/* 复制全部卡密：突出主要操作，尤其是未开启一键兑换时。 */
.btn-copy {
  background: var(--brand); color: #fff; border: 1.5px solid var(--brand);
  font-size: 16px; font-weight: 600;
  box-shadow: 0 4px 12px rgba(79, 105, 246, .22);
}
.btn-copy:hover:not(:disabled) { filter: brightness(.94); }
.btn-copy:focus-visible { outline: 3px solid #98a9ff; outline-offset: 3px; }
.btn-copy:disabled { background: #b9c2e8; border-color: #b9c2e8; color: #fff; box-shadow: none; }
.btn-line {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 11px;
  background: #fff; color: var(--text); font-size: 15px;
}
.btn-row { display: flex; gap: 10px; margin-top: 10px; }
.btn-row > * { flex: 1; min-width: 0; width: auto !important; }

/* 金额突出展示 */
.pay-amount-box { text-align: center; margin: 2px 0 8px; }
.pay-amount-label { font-size: 13px; color: var(--sub); letter-spacing: 1px; }
.pay-amount-val {
  font-size: 34px; font-weight: 800; color: #e01b1b; line-height: 1.25;
  letter-spacing: 0.5px; margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.pay-amount-hint {
  font-size: 13.5px; font-weight: 700; color: #e0533d;
  text-align: center; line-height: 1.65; margin: 0 0 14px;
}

/* 二维码 */
.qr-box { text-align: center; padding: 6px 0 2px; }
.qr-actions { margin-bottom: 10px; }
.btn-save-qr {
  display: inline-block; min-width: 130px; height: 38px; line-height: 38px;
  font-size: 14px; border-radius: 20px;
  background: #07c160; color: #fff; border: none;
  cursor: pointer;
}
.btn-save-qr:active { background: #06ad56; }
#qrCanvasWrap[hidden] { display: none !important; }
#qrImgWrap[hidden] { display: none !important; }
.qr-img {
  display: block; margin: 0 auto; width: 210px; height: 210px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  -webkit-touch-callout: default;
}
.qr-tip { font-size: 13px; color: var(--sub); margin-top: 10px; }
@media (min-width: 768px) {
  .qr-actions { display: none; }
  .qr-box canvas, .qr-box img { display: block; margin: 0 auto; }
}
/* 二维码放大层（手机端长按保存） */
#qrZoomMask { background: rgba(0, 0, 0, .86); padding: 0; }
.qr-zoom-inner { text-align: center; padding: 20px; }
.qr-zoom-inner img {
  display: block; margin: 0 auto; width: 76vw; max-width: 320px; height: auto;
  background: #fff; border-radius: 12px; padding: 10px;
  -webkit-touch-callout: default;
}
.qr-zoom-tip { color: #fff; font-size: 14px; font-weight: 600; margin: 16px 0 0; }
.qr-zoom-close { color: rgba(255, 255, 255, .6); font-size: 12px; margin: 8px 0 0; }
.countdown { margin-top: 8px; font-size: 13px; color: #ff9800; font-weight: 600; }
.pay-status { margin-top: 6px; font-size: 13px; color: var(--sub); }
.wx-tip {
  margin-top: 12px; background: #fff7e6; border: 1px solid #ffe0a3; color: #96610a;
  border-radius: 10px; padding: 9px 11px; font-size: 12.5px; text-align: left;
}

/* 卡密 */
.code-list { margin: 6px 0 12px; }
.code-row {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 8px; background: #fafbff;
}
.code-row .txt { flex: 1; word-break: break-all; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; }
.code-row .copy {
  flex: 0 0 auto; border: 1px solid var(--brand); color: var(--brand);
  background: #fff; border-radius: 8px; padding: 5px 10px; font-size: 12.5px;
}

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: rgba(24, 28, 42, .92); color: #fff; padding: 10px 16px;
  border-radius: 10px; font-size: 13.5px; z-index: 99; max-width: 86vw; text-align: center;
  opacity: 0; transition: opacity .2s;
}
.toast.show { opacity: 1; }

/* ---------- Third-party card redemption ---------- */
.redeem-btn {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 12px 14px;
  background: #0b8f55;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.redeem-btn:hover { background: #087747; }
.redeem-btn:disabled { cursor: not-allowed; opacity: .68; }
.redeem-btn.is-success { background: #edf8f2; color: #087747; border: 1px solid #b9e4cd; }
/* 支付成功页主按钮：字号与 .btn-main 对齐 */
.redeem-btn.redeem-hero { font-size: 16px; font-weight: 700; }
.redeem-result {
  margin: 9px 0 0;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.55;
  text-align: left;
}
.redeem-result.is-success { background: #edf8f2; color: #087747; }
.redeem-result.is-error { background: #fff2f0; color: #b43d2d; }
.redeem-confirm-mask {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(16, 20, 32, .56);
}
.redeem-confirm-dialog {
  width: min(400px, 100%);
  max-height: 86vh;
  overflow: auto;
  padding: 20px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 20px 55px rgba(16, 20, 32, .2);
}
.redeem-confirm-dialog h3 { margin: 0; font-size: 18px; color: var(--text); }
.redeem-confirm-question { margin: 9px 0 14px; color: var(--sub); font-size: 13.5px; line-height: 1.6; }
.redeem-confirm-user {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f9fc;
  font-size: 13px;
}
.redeem-confirm-user span { color: var(--sub); flex: 0 0 auto; }
.redeem-confirm-user strong { color: var(--text); text-align: right; overflow-wrap: anywhere; }
.redeem-confirm-warning {
  margin: 12px 0 0;
  padding: 9px 11px;
  border-radius: 8px;
  background: #fff7e6;
  color: #8f5d09;
  font-size: 12.5px;
  line-height: 1.55;
}
.redeem-confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.redeem-confirm-actions .btn-line,
.redeem-confirm-actions .redeem-btn { margin: 0; min-height: 42px; }

@media (max-width: 420px) {
  .redeem-confirm-dialog { padding: 17px; }
  .redeem-confirm-actions { grid-template-columns: 1fr; }
}

/* 结果页按钮组：三个按钮纵向均匀排列，"复制全部卡密"再向下偏移拉开间距 */
.result-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}
.result-actions .btn-copy { margin-top: 8px; }

/* ==========================================================================
   头部卡片（替代原蓝色顶栏）
   ========================================================================== */
.head-card {
  margin: 12px 16px 0;
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(120deg, #4f6ef7, #6a83ff 55%, #8a7bfb);
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(79, 110, 247, .30);
}
.head-card::after {
  content: '';
  position: absolute;
  right: -40px;
  top: -60px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  pointer-events: none;
}
.hc-logo {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, .2);
  border: 1px solid rgba(255, 255, 255, .42);
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -.5px;
}
.hc-lead { flex: 1; min-width: 0; position: relative; z-index: 1; }
.hc-title {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.2px;
  line-height: 1.3;
}
.hc-slogan { margin: 0 0 8px; font-size: 12px; opacity: .88; }
.hc-feats { display: flex; gap: 6px; flex-wrap: wrap; }
.hc-feat {
  font-size: 11px;
  line-height: 1.5;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .26);
  border-radius: 6px;
  padding: 3px 8px;
}
.hc-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
}
.hc-btn {
  border-radius: 9px;
  padding: 8px 16px;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
  border: 0;
  transition: .15s;
  white-space: nowrap;
}
.hc-btn.primary { background: #fff; color: #3b57d8; }
.hc-btn.primary:active { background: #eef2ff; }
.hc-btn.plain {
  background: rgba(255, 255, 255, .16);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .3);
}
.hc-btn.plain:active { background: rgba(255, 255, 255, .26); }

@media (max-width: 520px) {
  .head-card { flex-wrap: wrap; align-items: flex-start; gap: 10px; padding: 14px; }
  .hc-logo { width: 38px; height: 38px; border-radius: 10px; font-size: 14px; }
  .hc-lead { flex: 1 1 60%; }
  .hc-title { font-size: 17px; }
  .hc-slogan { font-size: 11.5px; margin-bottom: 7px; }
  .hc-feat { font-size: 10.5px; padding: 2px 7px; }
  .hc-btns { flex-direction: row; width: 100%; margin-top: 2px; }
  .hc-btns .hc-btn { flex: 1; padding: 9px 8px; }
}
/* ==========================================================================
   下单弹层（sheet）：手机从底部升起，桌面居中
   ========================================================================== */
.sheet-mask {
  align-items: flex-end;
  padding: 0;
}
.modal.sheet {
  max-width: 480px;
  width: 100%;
  max-height: 92vh;
  border-radius: 20px 20px 0 0;
  padding: 6px 18px calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sheet-grip {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: #dfe3ee;
  margin: 8px auto 10px;
  flex: 0 0 auto;
}
.sheet-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f2f4f9;
  flex: 0 0 auto;
}
.sheet-head-main { flex: 1; min-width: 0; }
.sheet-head .modal-title { margin: 0 0 3px; font-size: 17px; }
.sheet-head .modal-sub { margin: 0; font-size: 12.5px; color: var(--sub); }
.sheet-close {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 0;
  background: #f3f5fa;
  color: #6b7280;
  font-size: 18px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.sheet-close:active { background: #e8ebf4; }

.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 0 4px;
  -webkit-overflow-scrolling: touch;
}
.sheet-body .field { margin-bottom: 14px; }
.sheet-body .field:last-child { margin-bottom: 4px; }

.sheet-foot {
  flex: 0 0 auto;
  padding-top: 12px;
  border-top: 1px solid #f2f4f9;
  background: #fff;
}
.sheet-foot .summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 10px;
}
.sheet-foot .summary .total { font-size: 22px; color: #ff5722; font-weight: 800; }
.sheet-foot .btn-main { height: 46px; border-radius: 12px; }
.sheet-cancel {
  width: 100%;
  height: 38px;
  margin-top: 4px;
  border: 0;
  background: transparent;
  color: #8b90a0;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.sheet-stock { font-size: 12px; color: #6b7280; margin-left: 4px; }

/* 支付方式：SVG 图标 + 右侧单选点 */
.pay-item {
  justify-content: flex-start;
  gap: 8px;
  padding: 12px;
  cursor: pointer;
  transition: .15s;
}
.pay-ico { display: inline-flex; flex: 0 0 auto; }
.pay-ico svg { display: block; border-radius: 6px; }
.pay-name { font-size: 13.5px; }
.pay-radio {
  margin-left: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid #d5d9e6;
  box-sizing: border-box;
  transition: .15s;
}
.pay-item.active .pay-radio {
  border-color: var(--brand);
  background: var(--brand);
  box-shadow: inset 0 0 0 3.5px #fff;
}
.pay-item .dot { display: none; }

/* 桌面端：居中卡片（只有手机端才是底部弹层） */
@media (min-width: 720px) {
  .sheet-mask { align-items: center; padding: 20px; }
  .modal.sheet {
    max-width: 480px;
    margin: 0 auto;
    border-radius: 18px;
    padding: 6px 20px 18px;
    max-height: 86vh;
  }
  .sheet-grip { display: none; }
  .sheet-head { padding-top: 14px; }
}
/* ==========================================================================
   全站响应式适配（断点：900 / 768 / 520 / 420 / 360）
   目标：375×667、390×844 无横向滚动、无文字溢出、无按钮重叠
   ========================================================================== */

/* 兜底：任何情况下都不出现横向滚动条 */
html, body { max-width: 100%; overflow-x: hidden; }

@media (max-width: 900px) {
  .head-card { margin: 10px 12px 0; }
  .hall-wrap { margin: 10px 12px 0; }
  .container { padding-left: 12px; padding-right: 12px; }
}

@media (max-width: 520px) {
  /* 头部卡片：logo + 标题占一行，按钮整行平分 */
  .head-card { padding: 13px; gap: 9px; }
  .hc-title { font-size: 16.5px; }
  .hc-slogan { font-size: 11px; }

  /* 公告条：单行省略，不撑破 */
  .hall-wrap { padding: 8px 10px; border-radius: 9px; font-size: 11.5px; }
  .hall-wrap .hall-icon { font-size: 11.5px; }
  .hall-viewport { height: 18px; }
  .hall-track > div { height: 18px; line-height: 18px; }

  /* 商品卡 */
  .goods-body { padding: 12px; }
  .goods-name { font-size: 15.5px; }
  .goods-desc { font-size: 12.5px; margin-bottom: 10px; }

  /* 规格按钮：稳定两列，长名字省略 */
  .spec-list { gap: 8px; }
  .spec-btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    padding: 9px 10px;
    border-radius: 10px;
  }
  .spec-btn .s-name {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .spec-btn .s-meta { font-size: 11.5px; }
  .spec-btn .s-price { font-size: 14px; }
  .spec-btn .s-stock { font-size: 11px; }
  .spec-btn .hot-tag { font-size: 10px; padding: 3px 7px; }

  /* 底部留白，避免最后一行被悬浮客服挡住 */
  .container { padding-bottom: 28px; }
  .footer { font-size: 11.5px; padding-bottom: 28px; }

  /* 悬浮客服：手机端隐藏，避免压住规格按钮（头部卡片已有「联系客服」入口） */
  .fab { display: none; }

  /* 弹层 */
  .modal { max-width: 100%; }
  .modal.sheet { padding-left: 14px; padding-right: 14px; }
  .sheet-head .modal-title { font-size: 16px; }
  .sheet-body .field { margin-bottom: 12px; }

  /* 支付方式：图标 + 文字，窄屏不换行 */
  .pay-item { gap: 6px; padding: 10px 8px; }
  .pay-name { font-size: 12.5px; white-space: nowrap; }
  .pay-ico svg { width: 18px; height: 18px; }

  /* 数量步进器 */
  .qty { gap: 8px; }
  .qty button { width: 32px; height: 32px; }
  .qty input { width: 56px; height: 32px; }
  .sheet-stock { font-size: 11px; }
}

@media (max-width: 420px) {
  .head-card { padding: 12px; }
  .hc-title { font-size: 16px; }
  .hc-feat { font-size: 10px; padding: 2px 6px; }
  .hc-btns .hc-btn { padding: 8px 6px; font-size: 12px; }

  .spec-btn { flex: 1 1 calc(50% - 4px); padding: 8px 9px; }
  .spec-btn .s-name { font-size: 12.5px; }
  .spec-btn .s-price { font-size: 13.5px; }

  .pay-item { padding: 9px 7px; }
  .pay-name { font-size: 12px; }
  .pay-ico svg { width: 17px; height: 17px; }
  .pay-radio { width: 16px; height: 16px; }

  .sheet-foot .btn-main { height: 44px; font-size: 15px; }
}

@media (max-width: 360px) {
  .hc-title { font-size: 15px; }
  .hc-feat:nth-child(n+3) { display: none; }
  .spec-btn .s-price { font-size: 13px; }
  .pay-name { font-size: 11.5px; }
}
/* ==========================================================================
   公告弹窗：固定头尾 + 正文区内滚动（解决横向溢出与滑动生硬）
   ========================================================================== */
.modal.popup-modal {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  max-width: 440px;
  max-height: 78vh;
}
.popup-head {
  flex: 0 0 auto;
  padding: 16px 18px 10px;
  border-bottom: 1px solid #f1f3f8;
}
.popup-head .modal-title { margin: 0; }

.popup-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 18px 16px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #ccd3e3 transparent;
}
.popup-body::-webkit-scrollbar { width: 6px; height: 6px; }
.popup-body::-webkit-scrollbar-track { background: transparent; }
.popup-body::-webkit-scrollbar-thumb {
  background: #ccd3e3;
  border-radius: 3px;
}
.popup-body::-webkit-scrollbar-thumb:hover { background: #b6bfd4; }

.popup-foot {
  flex: 0 0 auto;
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #f1f3f8;
  background: #fff;
}
.popup-foot .btn-main { margin: 0; }

/* 正文内的任何元素都不允许宽过容器 */
#popupContent { font-size: 13px; line-height: 1.65; color: var(--sub); }
#popupContent * { max-width: 100% !important; box-sizing: border-box; }
#popupContent img {
  display: block;
  width: auto;
  height: auto;
  max-height: 240px;
  object-fit: contain;
  margin: 8px auto;
  border-radius: 8px;
  cursor: zoom-in;
}
#popupContent table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}
#popupContent pre {
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
#popupContent blockquote { margin: 8px 0; padding-left: 10px; border-left: 3px solid #e3e8f3; }

/* 弹窗打开时锁住背后页面滚动 */
body.modal-open { overflow: hidden; }

@media (max-width: 520px) {
  .mask { padding: 12px; }
  .modal.popup-modal { max-width: 100%; max-height: 88vh; }
  .popup-head { padding: 14px 16px 9px; }
  .popup-body { padding: 12px 16px 14px; }
  .popup-foot { padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
  #popupContent img { max-height: 50vh; }
}
/* 公告图片点击放大 */
.popup-img-viewer {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(12, 16, 28, .86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  cursor: zoom-out;
}
.popup-img-viewer[hidden] { display: none; }
.popup-img-viewer img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
}
.popup-img-viewer .piv-hint {
  position: absolute;
  bottom: 22px;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255, 255, 255, .72);
  font-size: 12px;
}

@media (max-width: 520px) {
  .modal.popup-modal { max-height: 84vh; }
  #popupContent img { max-height: 190px; }
  .popup-img-viewer { padding: 12px; }
}
/* ==========================================================================
   规格按钮：库存徽章（价格右侧、蓝色胶囊）
   ========================================================================== */
.spec-btn .s-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.spec-btn .s-head .s-name { flex: 0 1 auto; min-width: 0; }
.spec-btn .s-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 5px;
}
/* 款式 F：方形小标签 + 浅蓝渐变 */
.spec-btn .s-stock {
  flex: 0 0 auto;
  margin: 0;
  padding: 1px 8px;
  border-radius: 5px;
  background: linear-gradient(180deg, #f4f8ff, #e9f0ff);
  border: 1px solid #d5e2ff;
  color: #2f6bff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
}
.spec-btn.disabled .s-stock {
  background: #f4f5f8;
  border-color: #e6e9f1;
  color: #9aa1ad;
}
@media (max-width: 520px) {
  .spec-btn .s-stock { font-size: 10.5px; padding: 0 6px; }
  .spec-btn .s-head { gap: 5px; }
  .spec-btn .s-meta { gap: 6px; }
}
/* ==========================================================================
   联系客服弹窗（款式 A：纵向卡片）
   ========================================================================== */
.modal.service-modal {
  max-width: 360px;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 86vh;
}
.sm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 8px;
  flex: 0 0 auto;
}
.sm-head .modal-title { margin: 0; font-size: 16.5px; }
.sm-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 16px 4px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.sm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f2f4f9;
}
.sm-row:last-child { border-bottom: none; }
.sm-ico {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}
.sm-ico.qq { background: #12b7f5; }
.sm-ico.wx { background: #07c160; font-size: 12px; }
.sm-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sm-col b { font-size: 13px; font-weight: 600; }
.sm-val { font-size: 13.5px; color: #2d3748; word-break: break-all; }
.sm-copy {
  flex: 0 0 auto;
  border: 1px solid #dbe4ff;
  background: #eef3ff;
  color: #4169ff;
  font-size: 11.5px;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
}
.sm-copy:active { transform: scale(.96); }
.sm-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 0 4px;
}
.sm-qr img {
  width: 150px;
  height: 150px;
  object-fit: contain;
  border-radius: 10px;
  background: #f7f9fd;
  border: 1px solid #eef1f8;
}
.sm-qr-tip { margin: 0; font-size: 11.5px; color: #9aa1ad; }
.sm-note {
  margin: 10px 0 4px;
  padding: 9px 11px;
  border-radius: 9px;
  background: #f7f9fd;
  color: #5b6474;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
}
.sm-foot {
  flex: 0 0 auto;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px));
}
.sm-foot .btn-main { margin: 0; }

@media (max-width: 520px) {
  .modal.service-modal { max-width: 100%; }
  .sm-qr img { width: 130px; height: 130px; }
  .sm-head { padding: 13px 14px 6px; }
  .sm-body { padding: 2px 14px 4px; }
  .sm-foot { padding: 8px 14px calc(12px + env(safe-area-inset-bottom, 0px)); }
}

/* hidden 属性优先级：避免 display:flex 覆盖 [hidden] */
.sm-row[hidden],
.sm-qr[hidden],
.sm-note[hidden] { display: none !important; }