*, *::before, *::after { box-sizing: border-box; }
html { font-size: var(--fs-base); }
body {
  margin: 0; font-family: var(--font-family); color: var(--color-text);
  background: var(--color-bg); line-height: 1.5;
  padding-bottom: calc(var(--contact-footer-h) + var(--bottom-nav-h) + var(--safe-area-bottom));
}
img { max-width: 100%; height: auto; display: block; }
.container { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.field-hint { font-size: 12px; color: var(--color-text-secondary); }
.section-title { font-size: 1.25rem; margin: 0 0 8px; font-weight: 700; }
.section-desc { font-size: 14px; color: var(--color-text-secondary); margin: 0 0 16px; }

.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--color-bg-card); border-bottom: 1px solid var(--color-border);
  padding-top: env(safe-area-inset-top, 0);
}
.navbar-inner {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; max-width: 720px; margin: 0 auto;
}
.navbar-title { font-weight: 700; flex: 1; font-size: 15px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14px; cursor: pointer; text-decoration: none; font-family: inherit;
  background: var(--color-bg-card); color: var(--color-text);
}
.btn-primary { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn-secondary { border-color: var(--color-border); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

.bottom-nav {
  position: fixed; bottom: var(--contact-footer-h); left: 0; right: 0; z-index: 90;
  display: flex; background: var(--color-bg-card); border-top: 1px solid var(--color-border);
  height: var(--bottom-nav-h); padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav__item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 11px; color: var(--color-text-secondary); text-decoration: none; gap: 2px;
}
.bottom-nav__item.active { color: var(--color-primary); font-weight: 600; }

.hero-banner { border-radius: 14px; overflow: hidden; margin-bottom: 16px; position: relative; display: block; }
.hero-banner .r163-visual--banner { width: 100%; aspect-ratio: 16/7; }
.hero-banner__title {
  position: absolute; bottom: 12px; left: 12px; right: 12px;
  color: #fff; font-weight: 700; font-size: 18px; text-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.banner-scroll { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
.banner-scroll .hero-banner { flex: 0 0 85%; scroll-snap-align: start; }

.season-banner {
  display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 14px;
  margin-bottom: 20px; background: var(--color-accent); color: var(--color-text);
}
.season-banner strong { font-size: 18px; }

.category-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 24px;
}
.category-chip {
  display: block; text-align: center; padding: 14px 8px; border-radius: 12px;
  background: var(--color-bg-card); border: 1px solid var(--color-border);
  text-decoration: none; color: inherit; font-size: 13px;
}
.category-chip span { display: block; font-size: 24px; margin-bottom: 4px; }

.product-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.product-grid.list-mode { grid-template-columns: 1fr; }
.product-card {
  background: var(--color-bg-card); border-radius: 14px; border: 1px solid var(--color-border);
  overflow: hidden;
}
.product-card--list { display: flex; gap: 12px; }
.product-card--list .product-card__img-wrap { width: 100px; flex-shrink: 0; }
.product-card__img-wrap { position: relative; display: block; background: var(--color-border); }
.product-card__img-wrap img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.product-card--list .product-card__img-wrap img { aspect-ratio: 1; }
.product-card__body { padding: 10px 12px; flex: 1; }
.product-card__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.price { color: #B45309; font-weight: 700; font-size: 16px; }
.price small { font-size: 11px; color: var(--color-text-secondary); font-weight: 400; }

.tag {
  position: absolute; top: 8px; left: 8px; padding: 2px 8px; border-radius: 6px;
  font-size: 11px; color: #fff; background: rgba(0,0,0,.5);
}
.tag-hot { background: #DC2626; }
.tag-season.in-season { background: var(--color-primary); }
.tag-season.off-season { background: #9CA3AF; }

.farmer-tag {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px;
  text-decoration: none; color: inherit; font-size: 12px;
}
.farmer-tag__avatar { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; }
.cert-badge {
  display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 10px;
  background: rgba(45,106,79,.12); color: var(--color-primary); margin-right: 4px;
}

.origin-row { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--color-text-secondary); margin: 12px 0; }

.tab-row { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 4px; }
.tab-row button, .tab-row a {
  flex-shrink: 0; padding: 8px 14px; border-radius: 20px; border: 1px solid var(--color-border);
  background: var(--color-bg-card); font-size: 13px; text-decoration: none; color: inherit; cursor: pointer;
}
.tab-row .active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.detail-gallery { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

.r163-visual {
  width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 12px; overflow: hidden;
}
.r163-visual__icon { font-size: 48px; line-height: 1; }
.r163-visual__icon--lg { font-size: 64px; }
.r163-visual__icon--xl { font-size: 80px; }
.r163-visual--banner { aspect-ratio: 16/7; border-radius: 14px; }
.r163-visual--gallery { aspect-ratio: 4/3; }
.r163-visual--cart { width: 56px; height: 56px; aspect-ratio: auto; border-radius: 8px; flex-shrink: 0; }
.r163-visual--cart .r163-visual__icon { font-size: 28px; }

.r163-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; font-weight: 700; font-family: PingFang SC, sans-serif;
}
.farmer-hero__avatar { width: 88px; height: 88px; font-size: 32px; margin: 0 auto 12px; }
.r163-avatar.farmer-tag__avatar { width: 22px; height: 22px; font-size: 11px; }

.cart-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--color-border); align-items: flex-start; }
.cart-item__thumb { flex-shrink: 0; }
.hgf-block {
  padding: 16px; border-radius: 14px; background: var(--color-bg-card);
  border: 1px solid var(--color-border); margin-bottom: 16px;
}
.hgf-block h3 { margin: 0 0 12px; font-size: 15px; }
.spec-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.spec-chip {
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--color-border);
  background: var(--color-bg); cursor: pointer; font-size: 13px;
}
.spec-chip.active { border-color: var(--color-primary); background: rgba(45,106,79,.1); }
.detail-actions {
  display: flex; gap: 8px; flex-wrap: wrap; padding: 16px 0;
  position: sticky; bottom: calc(var(--contact-footer-h) + var(--bottom-nav-h));
  background: var(--color-bg); border-top: 1px solid var(--color-border);
}
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0; border-left: 2px solid var(--color-accent); padding-left: 12px; margin-left: 4px; font-size: 13px; }

.farmer-hero { text-align: center; padding: 24px 16px; }
.farmer-story { padding: 16px; background: var(--color-bg-card); border-radius: 14px; margin: 16px 0; }

.month-scroll { display: flex; gap: 10px; overflow-x: auto; padding: 8px 0 16px; scroll-snap-type: x mandatory; }
.month-card {
  flex: 0 0 88px; scroll-snap-align: center; text-align: center; padding: 12px 8px;
  border-radius: 12px; border: 2px solid transparent; cursor: pointer; background: var(--color-bg-card);
}
.month-card.active { border-color: var(--color-primary); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.month-card__icon { font-size: 28px; display: block; }

.search-box input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--color-border);
  font-size: 15px; margin-bottom: 16px;
}
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.tag-cloud button {
  padding: 6px 12px; border-radius: 16px; border: 1px solid var(--color-border);
  background: var(--color-bg-card); font-size: 13px; cursor: pointer;
}

.cart-drawer { position: fixed; inset: 0; z-index: 200; pointer-events: none; }
.cart-drawer.open { pointer-events: auto; }
.cart-drawer__backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,.45); opacity: 0; transition: opacity .2s;
}
.cart-drawer.open .cart-drawer__backdrop { opacity: 1; }
.cart-drawer__panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 70vh;
  background: var(--color-bg-card); border-radius: 16px 16px 0 0;
  transform: translateY(100%); transition: transform .25s; padding: 16px;
}
.cart-drawer.open .cart-drawer__panel { transform: none; }
.cart-drawer__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.cart-drawer__body { max-height: 45vh; overflow-y: auto; }
.cart-drawer__foot { display: flex; gap: 8px; margin-top: 12px; }
.cart-item__info { flex: 1; min-width: 0; }
.cart-total { text-align: right; margin-top: 12px; font-size: 15px; }
.cart-fab {
  position: fixed; right: 16px; bottom: calc(var(--contact-footer-h) + var(--bottom-nav-h) + 16px);
  z-index: 95; width: 52px; height: 52px; border-radius: 50%; border: none;
  background: var(--color-primary); color: #fff; font-size: 22px; cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
.cart-fab__badge {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px;
  background: #DC2626; color: #fff; font-size: 11px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

.poster-preview { max-width: 280px; margin: 16px auto; border-radius: 12px; }
.tpl-row { display: flex; gap: 8px; margin-bottom: 16px; }
.tpl-row button.active { border-color: var(--color-primary); }

.contact-footer {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 80;
  padding: 8px 12px calc(8px + var(--safe-area-bottom));
  background: var(--color-bg-card); border-top: 1px solid var(--color-border);
}
.contact-footer__btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.contact-footer__cta, .contact-footer__btn {
  padding: 8px 14px; border-radius: 8px; font-size: 13px; text-decoration: none;
  border: 1px solid var(--color-border); background: var(--color-bg-card); color: var(--color-text); cursor: pointer;
}
.contact-footer__cta { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.contact-footer__brand { text-align: center; font-size: 11px; color: var(--color-text-secondary); margin: 6px 0 0; }

.r163-toast {
  position: fixed; left: 50%; bottom: calc(var(--contact-footer-h) + var(--bottom-nav-h) + 80px);
  transform: translateX(-50%); background: rgba(0,0,0,.85); color: #fff;
  padding: 10px 18px; border-radius: 8px; z-index: 9999; opacity: 0; transition: opacity .2s;
}
.r163-toast.show { opacity: 1; }
