:root {
  --green: #008060;
  --green-dark: #004c3f;
  --ink: #1a1a1a;
  --gray: #6d7175;
  --line: #e3e3e3;
  --bg: #ffffff;
  --bg-soft: #f6f6f4;
  --bg-hero: #f0f7f3;
  --red: #d72c0d;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.08);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; font-size: 14px; }
img { display: block; }

/* ---------- 公告栏 ---------- */
.announcement {
  background: var(--green-dark);
  color: #fff;
  text-align: center;
  font-size: 13px;
  padding: 8px 16px;
  letter-spacing: .02em;
}

/* ---------- 头部 ---------- */
.header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 24px;
  padding: 14px 24px;
}
.logo { font-size: 20px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.logo span { color: var(--green); }
.nav { display: flex; gap: 20px; flex: 1; }
.nav a { color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 500; }
.nav a:hover { color: var(--green); }
.cart-btn {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 999px;
  background: var(--ink); color: #fff;
  font-size: 14px; font-weight: 600;
  transition: transform .15s, background .15s;
}
.cart-btn:hover { background: var(--green); transform: translateY(-1px); }
.cart-badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 20px; height: 20px; padding: 0 5px;
  background: var(--red); color: #fff;
  border-radius: 999px; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}
.cart-badge.hidden { display: none; }

/* ---------- Hero ---------- */
.hero {
  background: var(--bg-hero);
  overflow: hidden;
}
.hero-inner {
  max-width: 1200px; margin: 0 auto;
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px;
  padding: 72px 24px; align-items: center;
}
.hero h1 { font-size: 46px; line-height: 1.2; letter-spacing: -.03em; margin-bottom: 16px; }
.hero p { font-size: 17px; color: var(--gray); margin-bottom: 28px; }
.hero-cta {
  display: inline-block;
  background: var(--green); color: #fff;
  padding: 14px 32px; border-radius: 999px;
  font-size: 16px; font-weight: 700; text-decoration: none;
  transition: transform .15s, background .15s;
}
.hero-cta:hover { background: var(--green-dark); transform: translateY(-2px); }
.hero-visual { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.hero-visual img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.hero-visual img:nth-child(2) { transform: translateY(18px); }
.hero-visual img:nth-child(3) { transform: translateY(-10px); }
.trust-bar {
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: #fff;
}
.trust-inner {
  max-width: 1200px; margin: 0 auto; padding: 16px 24px;
  display: flex; justify-content: space-around; flex-wrap: wrap; gap: 12px;
}
.trust-item { font-size: 13px; color: var(--gray); font-weight: 500; }

/* ---------- 商品区 ---------- */
.section { max-width: 1200px; margin: 0 auto; padding: 56px 24px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.section-head h2 { font-size: 28px; letter-spacing: -.02em; }
.cats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px; }
.cat-pill {
  padding: 8px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff;
  font-size: 14px; font-weight: 500; color: var(--ink);
  transition: all .15s;
}
.cat-pill:hover { border-color: var(--green); color: var(--green); }
.cat-pill.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer;
  transition: transform .18s, box-shadow .18s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card-img { position: relative; aspect-ratio: 1; background: var(--bg-soft); }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-tags { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; }
.tag {
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--ink); color: #fff;
}
.tag.hot { background: var(--red); }
.tag.new { background: var(--green); }
.card-body { padding: 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-cat { font-size: 12px; color: var(--green); font-weight: 600; }
.card-name { font-size: 15px; font-weight: 700; line-height: 1.4; }
.card-sub { font-size: 13px; color: var(--gray); flex: 1; }
.card-price-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.price { font-size: 18px; font-weight: 800; }
.price s { font-size: 13px; color: var(--gray); font-weight: 400; margin-left: 6px; }
.add-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--green); color: #fff; font-size: 20px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .15s;
}
.add-btn:hover { background: var(--green-dark); transform: scale(1.08); }
.stock-out { font-size: 13px; color: var(--red); font-weight: 600; }

/* ---------- 页脚 ---------- */
.footer { background: var(--ink); color: #b5b5b5; margin-top: 40px; }
.footer-inner {
  max-width: 1200px; margin: 0 auto; padding: 48px 24px 32px;
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px;
}
.footer h4 { color: #fff; font-size: 15px; margin-bottom: 12px; }
.footer p, .footer a { font-size: 13px; color: #b5b5b5; text-decoration: none; display: block; margin-bottom: 8px; }
.footer a:hover { color: #fff; }
.footer-bottom { text-align: center; font-size: 12px; color: #777; padding: 16px; border-top: 1px solid #333; }

/* ---------- 抽屉 / 弹窗通用 ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 90;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 92vw);
  background: #fff; z-index: 100; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .3s cubic-bezier(.2,.8,.2,1);
  box-shadow: -8px 0 32px rgba(0,0,0,.12);
}
.drawer.show { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--line);
}
.drawer-head h3 { font-size: 17px; }
.close-x { font-size: 22px; color: var(--gray); width: 36px; height: 36px; border-radius: 50%; }
.close-x:hover { background: var(--bg-soft); color: var(--ink); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px; }
.drawer-foot { border-top: 1px solid var(--line); padding: 16px 20px; }

.ship-progress { margin-bottom: 14px; }
.ship-progress p { font-size: 13px; margin-bottom: 6px; }
.ship-bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.ship-bar i { display: block; height: 100%; background: var(--green); border-radius: 999px; transition: width .3s; }

.cart-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-item img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: var(--bg-soft); }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 14px; font-weight: 600; }
.cart-item-price { font-size: 13px; color: var(--gray); }
.qty-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.qty-ctl { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; }
.qty-ctl button { width: 28px; height: 28px; font-size: 16px; color: var(--ink); }
.qty-ctl span { min-width: 28px; text-align: center; font-size: 14px; font-weight: 600; }
.remove-btn { font-size: 13px; color: var(--gray); text-decoration: underline; }
.remove-btn:hover { color: var(--red); }
.cart-empty { text-align: center; color: var(--gray); padding: 60px 0; font-size: 14px; }

.total-row { display: flex; justify-content: space-between; font-size: 15px; margin-bottom: 4px; }
.total-row.grand { font-size: 17px; font-weight: 800; margin: 10px 0 14px; }
.btn-primary {
  width: 100%; padding: 14px; border-radius: 999px;
  background: var(--green); color: #fff; font-size: 16px; font-weight: 700;
  transition: background .15s;
}
.btn-primary:hover { background: var(--green-dark); }
.btn-primary:disabled { background: #b3d5cc; cursor: not-allowed; }
.btn-dark { background: var(--ink); }
.btn-dark:hover { background: #333; }

/* ---------- 商品详情弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.modal.show { opacity: 1; pointer-events: auto; }
.modal-box {
  background: #fff; border-radius: 20px; max-width: 860px; width: 100%;
  max-height: 88vh; overflow-y: auto; position: relative;
  transform: translateY(14px); transition: transform .25s;
}
.modal.show .modal-box { transform: translateY(0); }
.modal-close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 38px; height: 38px; border-radius: 50%; background: #fff;
  box-shadow: var(--shadow); font-size: 20px; color: var(--gray);
}
.modal-close:hover { color: var(--ink); }
.pd { display: grid; grid-template-columns: 1fr 1fr; }
.pd-img { background: var(--bg-soft); }
.pd-img img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1; }
.pd-body { padding: 32px; }
.pd-cat { font-size: 13px; color: var(--green); font-weight: 700; }
.pd-name { font-size: 24px; letter-spacing: -.02em; margin: 6px 0 4px; }
.pd-sub { color: var(--gray); font-size: 14px; margin-bottom: 14px; }
.pd-price { font-size: 26px; font-weight: 800; margin-bottom: 6px; }
.pd-price s { font-size: 15px; color: var(--gray); font-weight: 400; margin-left: 8px; }
.pd-stock { font-size: 13px; color: var(--gray); margin-bottom: 18px; }
.pd-desc { font-size: 14px; color: #444; white-space: pre-line; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.pd-actions { display: flex; gap: 12px; align-items: center; margin-top: 18px; }
.pd-actions .btn-primary { width: auto; flex: 1; }

/* ---------- 结账弹窗 ---------- */
.co-box { max-width: 480px; }
.co-body { padding: 28px; }
.co-body h3 { font-size: 20px; margin-bottom: 4px; }
.co-tip { font-size: 13px; color: var(--gray); margin-bottom: 18px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field input, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  outline: none; transition: border .15s;
}
.field input:focus, .field textarea:focus { border-color: var(--green); }
.field textarea { resize: vertical; min-height: 64px; }
.co-summary { background: var(--bg-soft); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; font-size: 14px; }
.co-summary .row { display: flex; justify-content: space-between; margin-bottom: 4px; }
.co-summary .row.grand { font-weight: 800; font-size: 16px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 24px; border-radius: 999px;
  font-size: 14px; z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--red); }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .hero-inner { grid-template-columns: 1fr; padding: 48px 24px; }
  .hero h1 { font-size: 34px; }
  .hero-visual { max-width: 420px; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .nav { display: none; }
  .pd { grid-template-columns: 1fr; }
  .pd-body { padding: 20px; }
  .section { padding: 36px 16px; }
  .hero h1 { font-size: 28px; }
}
