:root {
  --bg: #fbf6f0;
  --card: #ffffff;
  --ink: #2b2622;
  --muted: #8a7f76;
  --line: #efe4d9;
  --accent: #e0664d;
  --accent-soft: #fde9e3;
  --good: #23855f;
  --good-soft: #e3f4ec;
  --warn: #a8670f;
  --warn-soft: #fdf1dc;
  --radius: 14px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, p { margin: 0; }
.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px 24px; }

/* header */
.top { position: sticky; top: 0; z-index: 10; background: rgba(251, 246, 240, .94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brandrow, .search { max-width: 640px; margin: 0 auto; padding: 0 16px; }
.brandrow { display: flex; align-items: baseline; gap: 10px; padding-top: 10px; }
.logo { font-weight: 800; font-size: 19px; letter-spacing: .5px; color: var(--accent); }
.tag { color: var(--muted); font-size: 12px; }
.back { font-size: 26px; line-height: 1; margin-right: -2px; color: var(--muted); padding: 0 4px 0 0; }
.search { display: flex; gap: 8px; padding-top: 8px; padding-bottom: 10px; }
.search input { flex: 1; min-width: 0; height: 40px; border: 1px solid var(--line); border-radius: 20px; padding: 0 16px; font-size: 15px; background: var(--card); outline: none; -webkit-appearance: none; }
.search input:focus { border-color: var(--accent); }
.search button { height: 40px; padding: 0 18px; border: 0; border-radius: 20px; background: var(--accent); color: #fff; font-weight: 600; }

/* categories */
.cats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 16px 0 6px; }
.cat { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0 10px; background: var(--card); border-radius: var(--radius); font-size: 13px; border: 1px solid var(--line); }
.cat svg { width: 28px; height: 28px; }
.cat-formula svg, .ph-formula { color: #d0694f; }
.cat-diapers svg, .ph-diapers { color: #4f86c6; }
.cat-food svg, .ph-food { color: #c9952e; }
.cat-care svg, .ph-care { color: #3f9a8a; }
.cat-feeding svg, .ph-feeding { color: #9a6fc0; }

.block { margin-top: 22px; }
.block h2, .pagetitle { font-size: 17px; margin-bottom: 10px; }
.block h2 small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 2px; }
.pagetitle { margin-top: 16px; }

/* cards */
.cards { display: flex; flex-direction: column; gap: 10px; }
.card { display: flex; gap: 12px; padding: 12px; background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); }
.card:active { background: #fffaf6; }
.thumb { flex: none; width: 56px; height: 56px; border-radius: 12px; object-fit: cover; background: #f6efe7; }
.thumb.ph { display: grid; place-items: center; }
.thumb.ph svg { width: 30px; height: 30px; }
.card-main { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.card-title { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-spec { color: var(--muted); font-size: 12px; }
.card-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 12px; color: var(--muted); }
.card-price em { font-style: normal; font-size: 18px; font-weight: 700; color: var(--accent); }
.save { color: var(--good); background: var(--good-soft); padding: 0 6px; border-radius: 6px; font-weight: 600; }
.muted { color: var(--muted); }

.promos { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.promos li { background: var(--accent-soft); border-radius: var(--radius); padding: 10px 12px; }
.promos p { font-size: 13px; margin-top: 2px; }
.promos small { color: var(--muted); font-size: 12px; }

.chip { display: inline-block; font-size: 11px; line-height: 18px; padding: 0 6px; border-radius: 6px; background: #f3ece4; color: #6b6058; margin-left: 4px; white-space: nowrap; }
.t-crossborder { background: #e7effa; color: #2f5f9e; }
.t-direct { background: #efe8f8; color: #6a46a0; }
.t-warehouse { background: #e6f3ef; color: #2c7a65; }
.t-daigou { background: var(--warn-soft); color: var(--warn); }

/* product */
.hero { display: flex; gap: 14px; margin-top: 16px; align-items: flex-start; }
.hero .thumb { width: 72px; height: 72px; }
.crumb { font-size: 12px; color: var(--muted); }
.hero h1 { font-size: 18px; line-height: 1.35; font-weight: 600; }
.spec { color: var(--muted); font-size: 13px; }
.summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; padding: 14px 16px; background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); }
.summary small { display: block; color: var(--muted); font-size: 12px; }
.summary strong { display: block; font-size: 30px; line-height: 1.15; color: var(--accent); letter-spacing: -.5px; }
.summary span { font-size: 13px; color: var(--muted); }
.save-big { text-align: right; color: var(--good); font-size: 12px; background: var(--good-soft); padding: 8px 10px; border-radius: 12px; }
.save-big b { font-size: 17px; }
.sorter { display: flex; gap: 6px; margin: 14px 0 8px; }
.sorter button { border: 1px solid var(--line); background: var(--card); border-radius: 16px; padding: 4px 14px; font-size: 13px; color: var(--muted); }
.sorter button.on { border-color: var(--ink); color: var(--ink); font-weight: 600; }

.offers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.offer { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); padding: 12px 14px; }
.offer.best { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.offer.best .offer-head::after { content: "最低"; margin-left: auto; font-size: 11px; color: #fff; background: var(--accent); border-radius: 6px; padding: 0 6px; line-height: 18px; }
.offer-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; }
.ch { font-weight: 600; }
.rel { font-size: 11px; color: var(--muted); margin-left: 8px; }
.r-daigou { color: var(--warn); }
.offer-price { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.final { font-size: 24px; font-weight: 700; color: var(--ink); }
.offer.best .final { color: var(--accent); }
.unit { font-size: 13px; color: var(--good); font-weight: 600; }
.offer-detail { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.promo { color: var(--accent); }
.warn { margin-top: 6px; font-size: 12px; color: var(--warn); background: var(--warn-soft); padding: 4px 8px; border-radius: 8px; }
.note { margin-top: 6px; font-size: 12px; color: var(--muted); }
.offer-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.meta { font-size: 11px; color: var(--muted); }
.ref, .stale { font-weight: 500; font-size: 11px; padding: 0 5px; border-radius: 5px; margin-right: 4px; }
.ref { background: #f1ebe4; color: #7d7067; }
.stale { background: var(--warn-soft); color: var(--warn); }
.go { flex: none; background: var(--ink); color: #fff; font-size: 13px; padding: 6px 14px; border-radius: 16px; font-weight: 600; }

.chart { margin: 18px 0 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 12px 8px; color: var(--accent); }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { font-size: 10px; fill: var(--muted); }
.chart .pt-real { fill: var(--accent); }
.chart .pt-sample { fill: #fff; stroke: var(--accent); stroke-width: 1.2; }
.chart figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.btn { display: inline-block; border: 0; background: var(--accent); color: #fff; padding: 9px 16px; border-radius: 20px; font-size: 14px; font-weight: 600; }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); font-weight: 500; }
.empty { text-align: center; padding: 40px 12px; color: var(--muted); }
.empty p { margin-bottom: 14px; }
.link { border: 0; background: none; padding: 0; color: var(--accent); }

.foot { max-width: 640px; margin: 8px auto 0; padding: 16px 16px 28px; color: var(--muted); font-size: 11px; border-top: 1px solid var(--line); }
.foot p + p { margin-top: 6px; }

.toast { position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 20px); background: rgba(43, 38, 34, .92); color: #fff; padding: 9px 16px; border-radius: 20px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; max-width: 86vw; text-align: center; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* feedback sheet */
.sheet-mask { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 640px; background: var(--card); border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet h3 { margin: 0 0 10px; font-size: 16px; }
.sheet label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.sheet select, .sheet textarea, .sheet input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; font: inherit; background: #fff; }
.sheet textarea { min-height: 90px; resize: vertical; }
.sheet .row { display: flex; gap: 8px; margin-top: 14px; }
.sheet .row .btn { flex: 1; }

@media (max-width: 360px) {
  .cats { grid-template-columns: repeat(3, 1fr); }
  .summary strong { font-size: 26px; }
}
