:root {
  --primary: #2f7bff;
  --primary-2: #4f8dff;
  --primary-grad: linear-gradient(135deg, #3f86ff 0%, #5b9bff 60%, #6aa4ff 100%);
  --bg: #f3f5f8;
  --card: #ffffff;
  --text: #1b1f2a;
  --text-2: #8a91a3;
  --border: #eef0f4;
  --price: #ff4d3a;
  --ok: #16a34a;
  --warn: #f59e0b;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(24, 39, 75, 0.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ============ PC 顶部导航 ============ */
.pc-nav { display: none; }

/* ============ 店铺头部 / Hero ============ */
.hero {
  background: var(--primary-grad);
  color: #fff;
  padding: 20px 16px 22px;
  position: relative;
}
.hero .order-query-btn {
  position: absolute; top: 16px; right: 16px;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35);
  color: #fff; border-radius: 20px; padding: 6px 14px; font-size: 13px; font-weight: 600;
}
.hero .shop-top { display: flex; align-items: center; gap: 12px; }
.hero .avatar {
  width: 56px; height: 56px; border-radius: 50%; background: #fff; overflow: hidden;
  display: grid; place-items: center; flex: 0 0 auto; font-size: 26px;
}
.hero .avatar img { width: 100%; height: 100%; object-fit: cover; }
.hero .shop-name { font-size: 20px; font-weight: 800; }
.hero .shop-count { font-size: 12px; opacity: .9; margin-top: 2px; }
.hero .tagline { font-size: 12.5px; margin-top: 14px; opacity: .95; }
.hero .delivered { font-size: 12.5px; margin-top: 4px; opacity: .9; }
.hero .cs-btn {
  margin-top: 14px; float: right;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.4);
  color: #fff; border-radius: 20px; padding: 7px 16px; font-size: 13px; font-weight: 600;
}
.hero::after { content: ''; display: block; clear: both; }

/* ============ 主体容器 ============ */
.wrap { max-width: 480px; margin: 0 auto; padding: 0 0 40px; }
.panel { background: transparent; }

.section-title {
  margin: 16px 14px 10px; font-size: 16px; font-weight: 800;
  display: flex; align-items: center; gap: 8px;
}
.section-title .search {
  margin-left: auto; display: none;
}

/* 分类卡片 */
.cat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 12px;
}
.cat-card {
  background: #f3f5fb; border: 1.5px solid transparent; border-radius: 12px;
  padding: 14px; cursor: pointer; position: relative; transition: .15s;
}
.cat-card .cat-name { font-weight: 700; font-size: 14px; }
.cat-card .cat-sub { color: var(--text-2); font-size: 12px; margin-top: 4px; }
.cat-card.active {
  background: linear-gradient(135deg, #eaf1ff, #dbe8ff);
  border-color: var(--primary);
}
.cat-card.active .cat-name { color: var(--primary); }
.cat-card.active::after {
  content: '✓'; position: absolute; top: 10px; right: 12px;
  color: var(--primary); font-weight: 800;
}

/* 商品网格 */
.sub-label { margin: 18px 14px 10px; font-size: 15px; font-weight: 800; }
.product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 12px; }
.product-card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--border); cursor: pointer;
  display: flex; flex-direction: column; transition: transform .12s;
}
.product-card:active { transform: scale(.99); }
.product-thumb {
  height: 132px; background: var(--primary-grad); position: relative;
  display: grid; place-items: center; color: #fff; overflow: hidden;
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-thumb .ph-title {
  font-size: 22px; font-weight: 900; text-align: center; padding: 0 10px;
  text-shadow: 0 2px 8px rgba(0,0,0,.15); line-height: 1.2;
}
.product-body { padding: 10px 12px 12px; display: flex; flex-direction: column; flex: 1; }
.product-name {
  font-size: 13px; font-weight: 600; line-height: 1.4; min-height: 36px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.product-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.product-price { color: var(--price); font-weight: 800; font-size: 17px; }
.product-price .cur { font-size: 12px; }
.product-stock { color: var(--primary); font-size: 12px; font-weight: 600; }
.product-card.sold-out { cursor: not-allowed; opacity: .72; }
.product-card.sold-out .product-stock { color: #9aa3b5; }

.list-end { text-align: center; color: var(--text-2); font-size: 12px; padding: 20px 0 6px; }
.load-more {
  display: block; margin: 14px auto 0; background: #fff; border: 1px solid var(--border);
  border-radius: 20px; padding: 8px 22px; font-size: 13px; color: var(--primary); font-weight: 700;
}
.empty { text-align: center; color: var(--text-2); padding: 40px 0; font-size: 13px; }

/* ============ 弹窗 / bottom sheet ============ */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; display: none; pointer-events: none; }
.mask.show { display: block; pointer-events: auto; }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%) translateY(100%);
  width: 100%; max-width: 480px; background: #fff; border-radius: 18px 18px 0 0;
  z-index: 60; transition: transform .28s cubic-bezier(.2,.8,.2,1);
  max-height: 90vh; display: flex; flex-direction: column;
  visibility: hidden; pointer-events: none;
}
.sheet.show { transform: translateX(-50%) translateY(0); visibility: visible; pointer-events: auto; }
.sheet-header {
  padding: 16px 16px 12px; display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; border-bottom: 1px solid var(--border);
}
.sheet-title { font-size: 16px; font-weight: 800; line-height: 1.4; }
.sheet-close { border: none; background: #f1f2f6; width: 28px; height: 28px; border-radius: 50%; font-size: 16px; color: #888; flex: 0 0 auto; }
.sheet-body { padding: 14px 16px; overflow-y: auto; flex: 1; }

/* 详情弹窗 */
.detail-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.detail-tag { background: #eaf7ee; color: var(--ok); border-radius: 6px; padding: 3px 10px; font-size: 12px; font-weight: 600; }
.detail-text { white-space: pre-wrap; font-size: 13.5px; line-height: 1.7; color: #333; }
.hr { height: 1px; background: var(--border); margin: 16px 0; }

.field-label { font-size: 13px; font-weight: 700; margin: 6px 0 8px; }
.field-label .req { color: var(--price); margin-right: 3px; }
.contact-input {
  width: 100%; border: 1.5px solid var(--border); border-radius: 10px;
  padding: 12px 14px; font-size: 14px;
}

.pay-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.pay-method {
  border: 1.5px solid var(--border); border-radius: 12px; padding: 11px; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
}
.pay-method.active { border-color: var(--primary); background: #f0f6ff; }
.pm-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; flex: 0 0 auto; }
.pm-trc20 { background: #26a17b; }
.pm-erc20 { background: #6d7bcb; }
.pm-btc { background: #f7931a; }
.pm-eth { background: #627eea; }
.pm-name { font-weight: 700; font-size: 13px; }
.pm-sub { font-size: 11px; color: var(--text-2); }

/* 详情底部购买栏 */
.buy-bar {
  border-top: 1px solid var(--border); padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}
.buy-bar .bb-price { color: var(--price); font-weight: 800; font-size: 22px; white-space: nowrap; }
.buy-bar .bb-price .cur { font-size: 13px; }
.qty { display: flex; align-items: center; border: 1.5px solid var(--border); border-radius: 10px; overflow: hidden; }
.qty button { width: 36px; height: 36px; border: none; background: #f5f6fa; font-size: 18px; color: var(--text); }
.qty input { width: 46px; height: 36px; border: none; text-align: center; font-size: 15px; font-weight: 700; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.buy-now { margin-left: auto; background: var(--primary-grad); color: #fff; border: none; border-radius: 22px; padding: 12px 26px; font-size: 15px; font-weight: 800; }

/* 付款弹窗 */
.pay-amount { text-align: center; padding: 8px 0 4px; }
.pay-amount .num { font-size: 32px; font-weight: 900; color: var(--price); }
.pay-amount .num .cur { font-size: 16px; }
.pay-amount .lbl { font-size: 12px; color: var(--text-2); }
.order-meta { background: #f6f7fb; border-radius: 12px; padding: 12px 14px; margin-top: 12px; }
.order-meta .row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 4px 0; }
.order-meta .row .k { color: var(--text-2); flex: 0 0 auto; }
.order-meta .row .v { font-weight: 700; text-align: right; word-break: break-all; }
.order-meta .row .v.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }

.addr-box { margin-top: 14px; background: #f6f7fb; border-radius: 12px; padding: 12px 14px; }
.addr-box .lbl { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.addr-row { display: flex; gap: 8px; align-items: center; }
.addr-val { flex: 1; font-family: ui-monospace, Menlo, monospace; font-size: 12px; word-break: break-all; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.copy-btn { border: none; background: var(--primary); color: #fff; border-radius: 8px; padding: 8px 12px; font-size: 12px; font-weight: 700; white-space: nowrap; }

.pay-actions { display: flex; gap: 10px; margin-top: 18px; padding-bottom: env(safe-area-inset-bottom); }
.pay-actions button { flex: 1; border-radius: 12px; padding: 14px; font-size: 15px; font-weight: 800; border: none; }
.btn-cancel { background: #f1f2f6; color: var(--text); }
.btn-paid { background: var(--primary-grad); color: #fff; }

/* ============ 订单查询页 ============ */
.query-hero { background: var(--primary-grad); color: #fff; padding: 16px; position: relative; }
.query-hero .back { position: absolute; left: 12px; top: 14px; font-size: 20px; }
.query-hero .qh-title { text-align: center; font-size: 16px; font-weight: 700; }
.query-main { max-width: 480px; margin: 0 auto; padding: 24px 16px 40px; }
.query-main h1 { font-size: 24px; font-weight: 800; margin: 20px 0 10px; }
.query-main .qsub { color: var(--text-2); font-size: 13px; margin-bottom: 20px; }
.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1; border: 1.5px solid var(--border); border-radius: 10px; padding: 13px 14px; font-size: 14px; background: #fff; }
.search-row button { border: none; background: var(--primary-grad); color: #fff; border-radius: 10px; padding: 0 20px; font-weight: 800; white-space: nowrap; }
.disclaim { color: var(--warn); font-size: 12.5px; margin-top: 14px; line-height: 1.7; }
.tip-box {
  background: #fffbeb;
  background-image: radial-gradient(rgba(0,0,0,.04) 1px, transparent 1px);
  background-size: 8px 8px;
  border: 1px solid #fde8c8;
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 16px;
  font-size: 13px;
  color: #4b5563;
  line-height: 1.75;
}
.tip-box p { margin: 6px 0 0; }
.tip-box b { color: #1f2937; font-weight: 800; }
.tip-box .tip-head {
  font-weight: 800; color: #f59e0b; margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.tip-box .tip-ico {
  width: 16px; height: 16px; border-radius: 50%; background: #f59e0b; color: #fff;
  font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; line-height: 1;
}

.order-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-top: 12px; border: 1px solid var(--border); }
.oc-top { display: flex; justify-content: space-between; align-items: center; }
.oc-no { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--text-2); }
.status-badge { font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 20px; }
.status-pending { background: #fff7ed; color: var(--warn); }
.status-confirming { background: #eff6ff; color: #2563eb; }
.status-completed { background: #ecfdf5; color: var(--ok); }
.oc-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; margin-top: 4px; }
.oc-row .k { color: var(--text-2); }

/* ============ Toast ============ */
.toast {
  position: fixed; left: 50%; top: 42%; transform: translateX(-50%);
  background: rgba(0,0,0,.82); color: #fff; padding: 12px 18px; border-radius: 10px;
  font-size: 14px; z-index: 999; max-width: 80%; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }

.lang-switch { position: relative; display: inline-block; }
.lang-globe {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border);
  background: #fff; font-size: 18px; cursor: pointer; line-height: 1;
}
.lang-menu {
  display: none; position: absolute; left: 0; right: auto; top: calc(100% + 6px);
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 148px; z-index: 120; overflow: hidden;
}
.lang-menu.open { display: block; }
.lang-item {
  display: block; width: 100%; text-align: left; border: none; background: #fff;
  padding: 10px 14px; font-size: 13px; cursor: pointer; color: #1f2937;
}
.lang-item:hover { background: #f4f6fb; color: #1f2937; }
.lang-item.active { color: var(--primary); font-weight: 800; background: #f0f6ff; }
.hero .lang-switch { margin-top: 12px; z-index: 120; }
.hero .lang-globe { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.4); color: #fff; }
.query-hero .lang-switch { position: absolute; right: 12px; top: 8px; z-index: 120; }
.query-hero .lang-globe { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.4); color: #fff; }
.query-hero .lang-menu { left: auto; right: 0; }

.qr-wrap { text-align: center; margin: 18px 0 8px; }
.qr-wrap img {
  width: 200px; height: 200px; object-fit: contain; margin: 0 auto;
  border-radius: 12px; background: #fff; padding: 10px; border: 1px solid var(--border);
}
.qr-wrap img.zoomable { cursor: zoom-in; }
.qr-zoom {
  display: none; position: fixed; inset: 0; z-index: 220;
  background: rgba(0,0,0,.78); place-items: center; padding: 20px; cursor: zoom-out;
}
.qr-zoom.show { display: grid; }
.qr-zoom img {
  max-width: min(420px, 86vw); max-height: 86vh; width: auto; height: auto;
  background: #fff; padding: 16px; border-radius: 14px; object-fit: contain;
}

.dlg-mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 80; display: none; }
.dlg-mask.show { display: grid; place-items: center; }
.dlg {
  background: #fff; border-radius: 16px; width: 360px; max-width: 90vw; padding: 22px 20px 16px;
  box-shadow: 0 16px 40px rgba(0,0,0,.18);
}
.dlg h3 { margin: 0 0 10px; font-size: 17px; }
.dlg p { margin: 0 0 18px; color: #444; font-size: 14px; line-height: 1.6; }
.dlg-actions { display: flex; gap: 10px; }
.dlg-actions button { flex: 1; border: none; border-radius: 10px; padding: 12px; font-weight: 800; font-size: 14px; }
.dlg-ok { background: var(--primary-grad); color: #fff; }
.dlg-cancel { background: #f1f2f6; color: var(--text); }

.card-group { background: #f6f7fb; border-radius: 12px; padding: 12px; margin-top: 10px; }
.card-group .cg-title { font-size: 12px; color: var(--text-2); margin-bottom: 6px; font-weight: 700; }
.card-group .cg-row { display: flex; align-items: center; gap: 8px; }
.card-group .cg-val { flex: 1; font-family: ui-monospace, Menlo, monospace; font-size: 13px; word-break: break-all; }
.oc-actions { display: flex; gap: 8px; margin-top: 12px; }
.oc-actions button { flex: 1; border: none; border-radius: 10px; padding: 9px; font-weight: 800; font-size: 13px; }
.btn-view { background: #ecfdf5; color: var(--ok); }
.btn-pay { background: var(--primary-grad); color: #fff; }

/* ============ 桌面端适配 (PC) ============ */
@media (min-width: 768px) {
  body { background: #eef1f5; }
  .pc-nav {
    display: flex; align-items: center; gap: 24px;
    background: #fff; border-bottom: 1px solid var(--border);
    padding: 0 32px; height: 58px; position: sticky; top: 0; z-index: 70;
  }
  .pc-nav .nav-logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; }
  .pc-nav .nav-logo .bus {
    width: 28px; height: 28px; border-radius: 7px; overflow: hidden; font-size: 22px;
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  }
  .pc-nav .nav-logo .bus.has-img { font-size: 0; background: #f4f6fb; }
  .pc-nav .nav-logo .bus img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .pc-nav .nav-links { display: flex; gap: 22px; font-size: 14px; color: #555; }
  .pc-nav .nav-links a.active, .pc-nav .nav-links a:hover { color: var(--primary); }
  .pc-nav .nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
  .pc-nav .nav-right a { background: var(--primary); color: #fff; border-radius: 20px; padding: 8px 18px; font-size: 13px; font-weight: 700; }
  .pc-nav .lang-globe { background: #f4f6fb; }
  .pc-nav .lang-menu { left: auto; right: 0; }

  .hero {
    background: #fff; color: var(--text);
    max-width: 1000px; margin: 24px auto 0; border-radius: 16px 16px 0 0;
    padding: 24px 28px 18px; border: 1px solid var(--border); border-bottom: none;
  }
  .hero .order-query-btn { display: none; }
  .hero .avatar { background: #f0f3f9; }
  .hero .shop-name { color: var(--text); }
  .hero .shop-count { color: var(--text-2); }
  .hero .tagline { color: #444; }
  .hero .delivered { color: var(--text-2); }
  .hero .cs-btn {
    float: none; margin: 0; background: #f0f6ff; border: 1px solid #d5e6ff; color: var(--primary);
  }
  .hero .hero-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
  .hero .hero-meta > div:first-child { flex: 1; }

  .wrap {
    max-width: 1000px; margin: 0 auto;
    background: #fff; border-radius: 0 0 16px 16px; border: 1px solid var(--border); border-top: none;
    padding: 0 28px 40px;
  }
  .section-title { margin: 8px 0 14px; padding-top: 8px; border-top: 1px solid var(--border); }
  .section-title .search { display: flex; }
  .section-title .search input { border: 1px solid var(--border); border-radius: 20px; padding: 7px 14px; font-size: 13px; width: 220px; }

  .cat-grid { grid-template-columns: repeat(3, 1fr); padding: 0; gap: 14px; }
  .sub-label { margin: 22px 0 14px; }
  .product-grid { grid-template-columns: repeat(3, 1fr); padding: 0; gap: 16px; }
  .product-thumb { height: 150px; }
  .product-name { font-size: 14px; }

  /* 桌面端：弹窗改为居中 modal（未打开时完全不占点击层） */
  .sheet {
    left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%) scale(.96);
    width: 460px; max-width: 92vw; border-radius: 16px; max-height: 86vh;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity .2s, transform .2s, visibility .2s;
  }
  .sheet.show { transform: translate(-50%, -50%) scale(1); opacity: 1; visibility: visible; pointer-events: auto; }

  .query-hero { display: none; }
  .query-main { max-width: 720px; padding-top: 60px; }
  .hero .lang-switch { display: none; }
}
