:root {
  --ink: #1f1d1a;
  --ink-2: #57534d;
  --ink-3: #8d8780;
  --line: #e8e5e0;
  --bg: #f6f5f2;
  --panel: #fff;
  --accent: #b03a2e;
  --accent-soft: #f9ece9;
  --radius: 12px;
  --max: 720px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

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

.wrap { max-width: var(--max); margin: 0 auto; background: #fff; min-height: 100vh; box-shadow: 0 0 40px rgba(31, 29, 26, 0.05); }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}
.topbar-inner { display: flex; align-items: center; gap: 10px; }
.logo { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; background: var(--bg); }
.logo-ph { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; }
.shop-name { font-size: 15px; font-weight: 600; line-height: 1.2; }
.shop-slogan { font-size: 11.5px; color: var(--ink-3); }

.searchbar { margin-top: 10px; position: relative; }
.searchbar input {
  width: 100%; padding: 8px 12px 8px 32px;
  border: 1px solid var(--line); border-radius: 20px; background: var(--bg);
  font-size: 13.5px; color: var(--ink); outline: none; font-family: inherit;
}
.searchbar::before {
  content: ""; position: absolute; left: 12px; top: 50%; width: 12px; height: 12px;
  margin-top: -7px; border: 1.5px solid var(--ink-3); border-radius: 50%;
}
.searchbar::after {
  content: ""; position: absolute; left: 22px; top: 50%; width: 5px; height: 1.5px;
  background: var(--ink-3); transform: rotate(45deg);
}

.banner { margin: 14px 16px 0; border-radius: var(--radius); overflow: hidden; position: relative; background: var(--bg); }
.banner img { width: 100%; aspect-ratio: 750 / 400; object-fit: cover; }
.banner-ph {
  width: 100%; aspect-ratio: 750 / 340;
  background: linear-gradient(135deg, #efe9e1, #e3dbd1);
  display: flex; align-items: center; justify-content: center;
  color: #9a9188; font-size: 13px; letter-spacing: 0.08em;
}
.dots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; justify-content: center; gap: 5px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,0.55); }
.dots i.on { background: #fff; width: 14px; border-radius: 3px; }

.notice {
  margin: 12px 16px 0; padding: 8px 12px;
  background: var(--accent-soft); color: #8c3327;
  border-radius: 8px; font-size: 12.5px;
  display: flex; gap: 6px; align-items: flex-start;
}
.notice b { flex: 0 0 auto; font-weight: 600; }

.cats { display: flex; gap: 8px; overflow-x: auto; padding: 14px 16px 4px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 20px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: 13px; cursor: pointer; transition: all 0.15s;
}
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; padding: 16px 16px 8px; }
.section-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.section-head span { font-size: 12px; color: var(--ink-3); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 16px 16px; }
@media (min-width: 620px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.card { background: #fff; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.card .cover { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--bg); }
.cover-ph {
  width: 100%; aspect-ratio: 1; background: repeating-linear-gradient(45deg, #f7f5f2, #f7f5f2 10px, #efece7 10px, #efece7 20px);
  display: flex; align-items: center; justify-content: center; color: #b3aba1; font-size: 12px;
}
.card .info { padding: 9px 10px 11px; }
.card .name { font-size: 13.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 39px; }
.card .sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.price-row { display: flex; align-items: baseline; gap: 5px; margin-top: 6px; }
.price { color: var(--accent); font-size: 15px; font-weight: 600; }
.price small { font-size: 11px; font-weight: 400; }
.price-old { font-size: 11px; color: var(--ink-3); text-decoration: line-through; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.tag { font-size: 10.5px; color: #8c3327; background: var(--accent-soft); padding: 1px 6px; border-radius: 4px; }

.empty-state { padding: 60px 20px; text-align: center; color: var(--ink-3); font-size: 13.5px; }

.footer { padding: 24px 16px 40px; text-align: center; color: var(--ink-3); font-size: 11.5px; line-height: 1.9; border-top: 1px solid var(--line); margin-top: 8px; }
.footer a { color: var(--ink-2); }

/* detail */
.gallery { position: relative; background: #f2f0ec; }
.gallery-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-track img { width: 100%; flex: 0 0 100%; aspect-ratio: 1; object-fit: cover; scroll-snap-align: start; }
.gallery-count { position: absolute; right: 12px; bottom: 12px; background: rgba(0,0,0,0.45); color: #fff; font-size: 11.5px; padding: 2px 9px; border-radius: 20px; }

.detail-body { padding: 16px 16px 0; }
.detail-title { font-size: 17px; font-weight: 600; line-height: 1.45; margin: 0; }
.detail-sub { color: var(--ink-3); font-size: 13px; margin: 4px 0 0; }
.detail-price { display: flex; align-items: baseline; gap: 8px; margin-top: 12px; }
.detail-price .price { font-size: 24px; }
.detail-price .price-old { font-size: 13px; }
.detail-price .unit { font-size: 12px; color: var(--ink-3); }

.block { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.block h3 { font-size: 13.5px; margin: 0 0 8px; font-weight: 600; color: var(--ink-2); }
.params { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13px; }
.params dt { color: var(--ink-3); }
.params dd { margin: 0; color: var(--ink); }
.desc p { margin: 0 0 10px; font-size: 14px; line-height: 1.85; color: var(--ink-2); white-space: pre-wrap; }
.detail-imgs img { width: 100%; margin-bottom: 6px; }

.detail-actions {
  position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: flex; gap: 10px; align-items: center;
}
.btn-main {
  flex: 1; background: var(--ink); color: #fff; border: none; border-radius: 24px;
  padding: 12px 0; font-size: 15px; font-weight: 500; cursor: pointer;
}
.btn-ghost {
  background: #fff; border: 1px solid var(--line); color: var(--ink-2);
  border-radius: 24px; padding: 11px 18px; font-size: 13.5px; cursor: pointer;
}
.btn-main:active, .btn-ghost:active { opacity: 0.85; }

.back { display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.back::before { content: ""; width: 7px; height: 7px; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); margin-right: 2px; }

/* about */
.about-card { padding: 18px 16px; }
.about-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.about-row:last-child { border-bottom: none; }
.about-row span:first-child { color: var(--ink-3); flex: 0 0 auto; }
.about-row span:last-child { text-align: right; color: var(--ink); word-break: break-all; }
.qr { width: 168px; height: 168px; object-fit: contain; margin: 12px auto 0; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; }

.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: flex-end; justify-content: center; z-index: 100; }
.modal { background: #fff; width: 100%; max-width: 480px; border-radius: 16px 16px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); text-align: center; }
.modal h3 { margin: 0 0 6px; font-size: 15px; }
.modal p { margin: 0 0 16px; color: var(--ink-3); font-size: 13px; }
.modal .value { font-size: 20px; font-weight: 600; letter-spacing: 0.04em; margin: 10px 0 18px; }
.modal .row { display: flex; gap: 10px; }
.modal button { flex: 1; padding: 11px 0; border-radius: 22px; border: 1px solid var(--line); background: #fff; font-size: 14px; cursor: pointer; }
.modal button.primary { background: var(--ink); color: #fff; border-color: var(--ink); }

.toast {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.78); color: #fff; padding: 9px 16px; border-radius: 8px;
  font-size: 13.5px; opacity: 0; transition: opacity 0.2s; pointer-events: none; z-index: 200;
}
.toast.show { opacity: 1; }

.loading { padding: 48px; text-align: center; color: var(--ink-3); font-size: 13px; }
