:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --ink: #23201c;
  --ink-2: #6b6459;
  --ink-3: #9b9388;
  --line: #e8e2d9;
  --accent: #8a6f4e;
  --accent-soft: #f2ece3;
  --danger: #b4432f;
  --ok: #4a7c59;
  --warn: #b58900;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(35, 32, 28, 0.04), 0 8px 24px rgba(35, 32, 28, 0.05);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* ---------- 顶部 ---------- */
.hero {
  padding: 30px 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.hero h1 { margin: 0 0 6px; font-size: 23px; font-weight: 600; letter-spacing: -0.01em; }
.hero p { margin: 0; color: var(--ink-2); font-size: 14px; }
.hero-note { margin-top: 10px; color: var(--ink-3); font-size: 13px; }
.lang-btn {
  flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: 5px 13px; font-size: 13px;
}
.lang-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 筛选 ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(250, 248, 245, 0.94);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 11px 0;
}
.filters { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: 6px 15px; font-size: 13.5px; white-space: nowrap;
  transition: all .15s;
}
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .n { opacity: .55; margin-left: 4px; font-size: 12px; }

.search-row { display: flex; gap: 8px; margin-top: 10px; }
.search-row input {
  flex: 1; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
  padding: 8px 13px; font-size: 14px; color: var(--ink); font-family: inherit; outline: none;
}
.search-row input:focus { border-color: var(--accent); }

/* ---------- 商品网格 ---------- */
.grid {
  display: grid; gap: 14px; padding: 20px 0 90px;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; text-align: left; padding: 0; display: flex; flex-direction: column;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s;
  width: 100%;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #ddd5c8; }
.card:active { transform: translateY(0); }
.card-img {
  position: relative; aspect-ratio: 3 / 4; background: var(--accent-soft); overflow: hidden;
}
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-img .ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); font-size: 12px; letter-spacing: .08em;
}
.badge {
  position: absolute; top: 8px; left: 8px; border-radius: 999px;
  padding: 3px 9px; font-size: 11.5px; font-weight: 500; letter-spacing: .02em;
  background: rgba(35, 32, 28, .82); color: #fff; backdrop-filter: blur(4px);
}
.badge.sold { background: rgba(107, 100, 89, .9); }
.badge.reserved { background: rgba(181, 137, 0, .92); }
.badge.tier { left: auto; right: 8px; background: rgba(255, 255, 255, .92); color: var(--accent); }

.card-body { padding: 10px 11px 12px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.card-title {
  font-size: 14px; font-weight: 500; line-height: 1.45; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { font-size: 12.5px; color: var(--ink-3); display: flex; gap: 7px; flex-wrap: wrap; }
.card-price { margin-top: auto; display: flex; align-items: baseline; gap: 7px; padding-top: 3px; }
.price-now { font-size: 17px; font-weight: 600; color: var(--danger); letter-spacing: -0.01em; }
.price-was { font-size: 12.5px; color: var(--ink-3); text-decoration: line-through; }
.dim { opacity: .5; }

.card.sold .card-img img { filter: grayscale(.85); opacity: .55; }
.card.reserved { opacity: .78; }

/* ---------- 空态 ---------- */
.empty { text-align: center; padding: 70px 20px; color: var(--ink-3); }
.empty .big { font-size: 15px; color: var(--ink-2); margin-bottom: 6px; }

/* ---------- 抽屉 / 弹层 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(35, 32, 28, .45); z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.mask.on { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed; z-index: 101; right: 0; top: 0; bottom: 0; width: min(460px, 100%);
  background: var(--surface); box-shadow: -8px 0 40px rgba(0,0,0,.13);
  transform: translateX(100%); transition: transform .26s cubic-bezier(.32,.72,0,1);
  display: flex; flex-direction: column;
}
.sheet.on { transform: translateX(0); }
.sheet-head {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; flex: none;
}
.sheet-head h2 { margin: 0; font-size: 16px; font-weight: 500; }
.x-btn {
  border: 0; background: transparent; font-size: 22px; line-height: 1; color: var(--ink-3);
  padding: 2px 6px;
}
.sheet-body { padding: 18px; overflow-y: auto; flex: 1; }
.sheet-foot { padding: 14px 18px; border-top: 1px solid var(--line); flex: none; background: var(--surface); }

.detail-img {
  border-radius: var(--radius); overflow: hidden; background: var(--accent-soft);
  aspect-ratio: 3/4; margin-bottom: 14px;
}
.detail-img img { width: 100%; height: 100%; object-fit: cover; }
.thumbs { display: flex; gap: 8px; margin: -6px 0 14px; overflow-x: auto; }
.thumbs img {
  width: 54px; height: 68px; object-fit: cover; border-radius: 7px;
  border: 1.5px solid transparent; flex: none; cursor: pointer;
}
.thumbs img.on { border-color: var(--accent); }

.detail-title { font-size: 19px; font-weight: 600; margin: 0 0 10px; line-height: 1.4; }
.detail-price { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.detail-price .now { font-size: 27px; font-weight: 600; color: var(--danger); }
.detail-price .was { font-size: 14px; color: var(--ink-3); text-decoration: line-through; }
.detail-price .off {
  font-size: 12px; background: var(--accent-soft); color: var(--accent);
  padding: 2px 8px; border-radius: 999px;
}

.specs { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px 0; margin-bottom: 14px; }
.spec { display: flex; padding: 7px 0; font-size: 14px; }
.spec dt { width: 76px; color: var(--ink-3); flex: none; }
.spec dd { margin: 0; }
.detail-desc { color: var(--ink-2); font-size: 14px; white-space: pre-wrap; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 14.5px; font-family: inherit; color: var(--ink);
  background: var(--surface); outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 62px; }
.hint { font-size: 12.5px; color: var(--ink-3); margin-top: 5px; }

.btn {
  display: block; width: 100%; border: 0; border-radius: var(--radius-sm);
  padding: 12px 18px; font-size: 15px; font-weight: 500; transition: opacity .15s;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover:not(:disabled) { opacity: .88; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-sm { width: auto; padding: 7px 14px; font-size: 13.5px; display: inline-block; }
.btn-danger { background: transparent; border: 1px solid #e6d5d0; color: var(--danger); }

/* ---------- 提示条 ---------- */
.alert {
  border-radius: var(--radius-sm); padding: 10px 13px; font-size: 13.5px; margin-bottom: 13px;
  border: 1px solid;
}
.alert-info { background: #f4f1ea; border-color: #e3dbcd; color: var(--ink-2); }
.alert-warn { background: #fdf6e3; border-color: #f0e0b0; color: #7a5c00; }
.alert-err { background: #fdf0ed; border-color: #f0d0c8; color: var(--danger); }
.alert-ok { background: #f0f6f1; border-color: #cfe3d4; color: var(--ok); }

/* ---------- 支付区 ---------- */
.pay-box { text-align: center; padding: 6px 0 4px; }
.pay-amount { font-size: 32px; font-weight: 600; color: var(--danger); margin: 4px 0 2px; }
.pay-sub { color: var(--ink-3); font-size: 13.5px; margin-bottom: 16px; }
.qr-wrap {
  display: inline-block; padding: 12px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 12px;
}
.qr-wrap img, .qr-wrap canvas { display: block; width: 208px; height: 208px; }
.pay-order-no {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 15px;
  background: var(--accent-soft); color: var(--accent); border-radius: 6px;
  padding: 3px 10px; letter-spacing: .06em; display: inline-block;
}
.spinner {
  width: 17px; height: 17px; border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block;
  vertical-align: -3px; margin-right: 7px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 底部 ---------- */
.foot {
  border-top: 1px solid var(--line); padding: 24px 0 34px; margin-top: 20px;
  color: var(--ink-3); font-size: 13px; text-align: center;
}
.foot a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line); }

/* ---------- 订单行 ---------- */
.o-row {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 13px;
  margin-bottom: 10px; background: var(--surface);
}
.o-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.o-title { font-size: 14.5px; font-weight: 500; }
.o-amt { font-size: 15px; font-weight: 600; color: var(--danger); flex: none; }
.o-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; display: flex; gap: 9px; flex-wrap: wrap; }
.pill {
  display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.pill.PAID { background: #eef5f0; color: var(--ok); }
.pill.DONE { background: #eef5f0; color: var(--ok); }
.pill.PENDING { background: #fdf6e3; color: var(--warn); }
.pill.CLOSED, .pill.EXPIRED { background: #f2f0ec; color: var(--ink-3); }
.pill.RESERVED { background: #eef2f8; color: #3a5f8a; }

@media (max-width: 560px) {
  .hero { padding: 22px 0 14px; }
  .hero h1 { font-size: 20px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 11px; }
  .sheet { top: auto; height: 92vh; border-radius: 18px 18px 0 0; transform: translateY(100%); }
  .sheet.on { transform: translateY(0); }
}
