:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --ink: #1c2321;
  --muted: #6b7471;
  --line: #e4e0d6;
  --brand: #0f5c4d;
  --brand-dark: #0a4439;
  --brand-soft: #e3f0ec;
  --price: #d93a1e;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(28, 35, 33, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* 顶栏 */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(246, 244, 239, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 12px; height: 60px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; white-space: nowrap; }
.logo-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 15px; }
.search { flex: 1; min-width: 0; }
.search input { width: 100%; height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.cart-btn { position: relative; height: 38px; padding: 0 16px; border: 1px solid var(--ink); border-radius: 999px; background: transparent; white-space: nowrap; }
.cart-btn:hover { background: var(--ink); color: #fff; }
.badge { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--price); color: #fff; font-size: 12px; line-height: 20px; text-align: center; }

/* 首屏 */
.hero { background: var(--brand); color: #fff; }
.hero-inner { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: end; padding-top: 56px; padding-bottom: 56px; }
.eyebrow { font-size: 13px; letter-spacing: .12em; opacity: .75; margin-bottom: 12px; }
.hero h1 { font-size: clamp(28px, 4.6vw, 46px); line-height: 1.25; letter-spacing: -.01em; }
.hero-sub { margin: 16px 0 24px; max-width: 30em; opacity: .85; }
.hero-points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: rgba(255, 255, 255, .2); border: 1px solid rgba(255, 255, 255, .2); border-radius: var(--radius); overflow: hidden; }
.hero-points li { background: var(--brand); padding: 18px 12px; text-align: center; }
.hero-points strong { display: block; font-size: 22px; }
.hero-points span { font-size: 13px; opacity: .8; }

/* 按钮 */
.btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 22px; border: 0; border-radius: 999px; font-weight: 600; }
.btn-primary { background: #ffd24a; color: var(--ink); }
.btn-primary:hover { background: #ffc61c; }
.btn-ghost { background: var(--brand-soft); color: var(--brand-dark); }
.btn-block { width: 100%; }
.btn:disabled { background: var(--line); color: var(--muted); cursor: default; }

/* 筛选 */
.shop { padding-top: 28px; padding-bottom: 48px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.chip { flex: none; height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.selects { display: flex; gap: 12px; color: var(--muted); font-size: 14px; }
.selects select { height: 34px; margin-left: 4px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); }
.result-info { margin: 16px 0 12px; color: var(--muted); font-size: 13px; }
.empty { padding: 48px 0; text-align: center; color: var(--muted); }

/* 商品卡片 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-align: left; padding: 0; transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card.sold { opacity: .6; }
.thumb { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; background: #efece4; }
.thumb svg { position: absolute; top: 11%; left: 0; width: 100%; height: 78%; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.grade { position: absolute; top: 10px; left: 10px; padding: 2px 9px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 600; }
.sold-mark { position: absolute; top: 10px; right: 10px; padding: 2px 9px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 12px; }
.card-body { padding: 12px 14px 14px; }
.card h3 { font-size: 15px; line-height: 1.4; }
.spec { margin-top: 2px; color: var(--muted); font-size: 13px; }
.price-row { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; }
.price { color: var(--price); font-size: 20px; font-weight: 700; }
.price small { font-size: 13px; }
.was { color: var(--muted); font-size: 12px; text-decoration: line-through; }

/* 购买流程 */
.steps { padding-bottom: 56px; }
.steps h2 { font-size: 22px; margin-bottom: 16px; }
.steps ol { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; counter-reset: s; }
.steps li { counter-increment: s; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.steps li::before { content: "0" counter(s); display: block; color: var(--brand); font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.steps b { display: block; }
.steps span { color: var(--muted); font-size: 13px; }

/* 页脚 */
.footer { background: var(--ink); color: #cfd6d3; font-size: 14px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px; padding-top: 32px; padding-bottom: 32px; }
.footer-name { color: #fff; font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.footer b { color: #fff; }

/* 弹窗 */
.dialog { width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 24px; border: 0; border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.dialog-narrow { width: min(440px, calc(100vw - 24px)); }
.dialog::backdrop { background: rgba(28, 35, 33, .5); }
.dialog-close { position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; font-size: 24px; line-height: 1; color: var(--muted); }
.dialog-close:hover { background: var(--bg); }
.detail { display: grid; grid-template-columns: 1fr 1.2fr; gap: 24px; }
.detail .thumb { border-radius: var(--radius); aspect-ratio: 1; overflow: hidden; }
.detail h2 { font-size: 22px; line-height: 1.3; padding-right: 28px; }
.detail .price { font-size: 28px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.facts div { padding: 8px 12px; background: var(--bg); border-radius: 10px; }
.facts dt { color: var(--muted); font-size: 12px; }
.facts dd { margin: 0; font-weight: 600; }
.desc { color: var(--muted); margin-bottom: 16px; }
.detail-actions { display: flex; gap: 10px; }
.detail-actions .btn { flex: 1; }

/* 购物车抽屉 */
.backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(28, 35, 33, .5); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 31; display: flex; flex-direction: column; width: min(400px, 100vw); background: var(--surface); box-shadow: var(--shadow); transform: translateX(100%); visibility: hidden; transition: transform .25s, visibility .25s; }
.drawer.open { transform: none; visibility: visible; }
.drawer-head { position: relative; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 18px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 20px; }
.drawer-foot { padding: 16px 20px; border-top: 1px solid var(--line); }
.total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.total strong { color: var(--price); font-size: 22px; }
.cart-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-item .thumb { flex: none; width: 64px; aspect-ratio: 1; border-radius: 10px; overflow: hidden; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-info b { display: block; font-size: 14px; }
.cart-item-info span { color: var(--price); font-weight: 600; }
.remove { border: 0; background: none; color: var(--muted); font-size: 13px; text-decoration: underline; }
.cart-empty { padding: 48px 0; text-align: center; color: var(--muted); }

/* 下单表单 */
.order-form h2, #orderDone h2 { font-size: 20px; margin-bottom: 14px; }
.order-form label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.order-form input, .order-form textarea, #orderText { display: block; width: 100%; margin-top: 4px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 15px; resize: vertical; }
#orderText { margin: 12px 0; background: var(--bg); font-size: 13px; }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 50; transform: translateX(-50%); padding: 10px 18px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; box-shadow: var(--shadow); }

@media (max-width: 720px) {
  .logo span:last-child { display: none; }
  .hero-inner { grid-template-columns: 1fr; padding-top: 36px; padding-bottom: 36px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .steps ol { grid-template-columns: 1fr 1fr; }
  .detail { grid-template-columns: 1fr; gap: 16px; }
  .detail .thumb { aspect-ratio: 16 / 10; }
  .dialog { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
