*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 16px;
  background: #f5f5f5;
  color: #222;
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

.screen {
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.muted {
  color: #666;
  font-size: 0.9em;
}

.error {
  color: #c62828;
  margin-top: 12px;
}

.loading-text {
  text-align: center;
  padding: 80px 24px;
  color: #666;
}

.pick-card,
.error-card {
  max-width: 420px;
  margin: 0 auto;
  padding: 48px 24px;
}

.pick-card h1,
.error-card h2 {
  margin: 0 0 8px;
  color: #1a7f37;
}

.field {
  display: block;
  margin: 16px 0;
}

.field span {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.field input {
  width: 100%;
  padding: 14px 16px;
  font-size: 18px;
  border: 1px solid #ccc;
  border-radius: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: #1a7f37;
  color: #fff;
  width: 100%;
}

.btn-secondary {
  background: #fff;
  color: #1a7f37;
  border: 1px solid #1a7f37;
}

.btn-lg {
  min-height: 52px;
  font-size: 18px;
}

.shop-banner-wrap {
  margin: 0 12px 8px;
}

.shop-banner-wrap[hidden] {
  display: none !important;
}

.shop-banner-static {
  margin: 0 auto 12px;
  max-width: 960px;
  padding: 0 16px;
}

.shop-banner-static .shop-banner-img {
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.shop-banner-img,
.banner-slide .banner-img {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: #e8f5e9;
}

.shop-banner {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.banner-slides {
  display: flex;
  transition: transform 0.45s ease;
  will-change: transform;
}

.banner-slide {
  flex: 0 0 100%;
  min-height: 200px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.banner-slide .banner-img {
  min-height: 200px;
}

.banner-slide.no-img {
  background: linear-gradient(135deg, #1a7f37, #3cb371);
}

.banner-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 28px 16px 14px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
}

.banner-title {
  display: block;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.banner-price {
  display: block;
  color: #ffeb3b;
  font-size: 18px;
  font-weight: 700;
  margin-top: 4px;
}

.banner-hint {
  display: block;
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
  margin-top: 4px;
}

.banner-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 0;
  pointer-events: none;
}

.banner-dot {
  width: 8px;
  height: 8px;
  border: none;
  border-radius: 50%;
  padding: 0;
  background: rgba(255, 255, 255, 0.45);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  pointer-events: auto;
}

.banner-dot.on {
  background: #fff;
  transform: scale(1.15);
}

/* SSR 菜单页仍用 hero */
.shop-hero {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  background-size: cover;
  background-position: center;
}

.card {
  background: #fff;
  margin: 12px 12px 0;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.shop-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.shop-logo {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f0f0f0;
}

.shop-meta h1 {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.3;
}

.promo-tag {
  margin: 0 0 8px;
  font-size: 14px;
  color: #e65100;
  font-weight: 500;
}

.hours-line {
  margin: 0 0 6px;
  font-size: 14px;
}

.hours-line .open {
  color: #1a7f37;
  font-weight: 600;
}

.hours-line .closed {
  color: #e65100;
  font-weight: 600;
}

.shop-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.link-btn {
  color: #1a7f37;
  font-weight: 600;
  text-decoration: none;
  font-size: 14px;
}

.hint {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.5;
}

.menu-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.menu-head h2 {
  margin: 0;
  font-size: 18px;
}

.lang-toggle {
  display: flex;
  gap: 4px;
  background: #f0f0f0;
  border-radius: 8px;
  padding: 3px;
}

.lang-btn {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: #666;
}

.lang-btn.on {
  background: #fff;
  color: #1a7f37;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.cat-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.cat-nav::-webkit-scrollbar {
  display: none;
}

/* 平板及以上：分类换行展示，无需横向滚动 */
@media (min-width: 640px) {
  #screen-shop {
    max-width: 800px;
    margin: 0 auto;
    padding-left: 16px;
    padding-right: 16px;
  }

  .shop-public .shop-main {
    max-width: 800px;
    margin: 0 auto;
    padding-left: 16px;
    padding-right: 16px;
  }

  .shop-hero {
    border-radius: 0 0 16px 16px;
  }

  .cat-nav {
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 4px;
    margin-bottom: 16px;
  }

  .cat-btn {
    flex-shrink: 0;
    white-space: normal;
    text-align: center;
    line-height: 1.3;
  }
}

/* 电脑：加宽页面，商品多列网格 */
@media (min-width: 900px) {
  #screen-shop {
    max-width: 960px;
  }

  .shop-public .shop-main {
    max-width: 960px;
  }

  #screen-shop {
    padding-top: 20px;
  }

  .shop-banner-wrap,
  .shop-banner-static {
    margin-left: 0;
    margin-right: 0;
  }

  .shop-banner {
    border-radius: 16px;
  }

  .shop-banner-img,
  .banner-slide .banner-img {
    height: 260px;
  }

  .shop-hero {
    height: 220px;
    border-radius: 0 0 20px 20px;
  }

  .menu-section > .product-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .menu-section > .product-list .product-card {
    flex-direction: column;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 12px;
    border-bottom: none;
    height: 100%;
  }

  .menu-section > .product-list .product-thumb {
    width: 100%;
    height: 140px;
  }

  .shop-public .cat-section .product-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .shop-public .cat-section .product-card {
    flex-direction: column;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 12px;
    border-bottom: none;
  }

  .shop-public .cat-section .product-thumb {
    width: 100%;
    height: 140px;
  }
}

@media (min-width: 1200px) {
  #screen-shop,
  .shop-public .shop-main {
    max-width: 1080px;
  }

  .menu-section > .product-list,
  .shop-public .cat-section .product-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.cat-btn {
  flex-shrink: 0;
  border: 1px solid #ddd;
  background: #fff;
  color: #444;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.cat-btn.on {
  background: #1a7f37;
  border-color: #1a7f37;
  color: #fff;
}

.cat-btn.promo {
  border-color: #ff9800;
  color: #e65100;
}

.cat-btn.promo.on {
  background: #ff9800;
  border-color: #ff9800;
  color: #fff;
}

.product-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-card {
  display: flex;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
}

.product-card:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.product-thumb {
  width: 88px;
  height: 88px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f0f0f0;
}

.product-thumb.empty {
  display: block;
}

.product-info {
  flex: 1;
  min-width: 0;
}

.product-name {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.35;
  margin-bottom: 6px;
}

.product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #fff3e0;
  color: #e65100;
}

.tag.promo {
  background: #ffebee;
  color: #c62828;
}

.product-desc {
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.price {
  color: #1a7f37;
  font-weight: 700;
  font-size: 18px;
}

.price::before {
  content: '$';
  font-size: 14px;
}

.origin {
  text-decoration: line-through;
  font-size: 14px;
}

.stock-note {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}

.stock-note.sold {
  color: #c62828;
}

.empty {
  text-align: center;
  padding: 32px 16px;
}

.footer {
  text-align: center;
  padding: 24px 16px 32px;
  font-size: 13px;
}

.footer-id {
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.7;
}

.link-btn-primary {
  background: #1a7f37;
  color: #fff !important;
  padding: 8px 16px;
  border-radius: 8px;
  display: inline-block;
}

.btn-add {
  margin-top: 8px;
  padding: 6px 16px;
  border: none;
  border-radius: 8px;
  background: #1a7f37;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.cart-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0));
  background: linear-gradient(transparent, rgba(245, 245, 245, 0.95) 20%);
  z-index: 50;
}

.cart-bar-btn {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  display: block;
  min-height: 52px;
  border: none;
  border-radius: 12px;
  background: #1a7f37;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(26, 127, 55, 0.35);
}

.checkout-screen {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.checkout-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  z-index: 10;
}

.checkout-head h2 {
  margin: 0;
  flex: 1;
  font-size: 18px;
}

.btn-text {
  border: none;
  background: none;
  color: #1a7f37;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  padding: 8px 0;
}

.checkout-body {
  margin: 12px;
}

.checkout-items {
  margin-bottom: 12px;
}

.checkout-line {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 15px;
}

.checkout-totals {
  margin-bottom: 16px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

.total-row.total-bold {
  font-weight: 700;
  font-size: 18px;
  color: #1a7f37;
  margin-top: 8px;
}

.field-block {
  border: none;
  margin: 0 0 16px;
  padding: 0;
}

.field-block legend {
  font-weight: 600;
  margin-bottom: 8px;
}

.radio-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 15px;
}

.field-block textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
}

.address-field {
  position: relative;
}

.address-suggest {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  border: 1px solid #ccc;
  border-radius: 10px;
  background: #fff;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.address-suggest li {
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.35;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

.address-suggest li:last-child {
  border-bottom: none;
}

.address-suggest li:hover,
.address-suggest li:focus {
  background: #f0f7f2;
}

.order-status {
  font-size: 18px;
  font-weight: 700;
  color: #1a7f37;
  margin: 0 0 8px;
}

#screen-shop {
  padding-top: 16px;
  padding-bottom: 80px;
}

/* 公开网店 SSR（Google 收录） */
body.shop-public {
  margin: 0;
  padding-top: 16px;
  background: #f5f5f5;
}

.shop-public .shop-main {
  max-width: 100%;
  margin: 0 auto;
  padding-bottom: 24px;
}

.shop-public .menu-page-title {
  margin: 0 0 12px;
  font-size: 18px;
}

.shop-public .cat-section {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}

.shop-public .cat-section:first-of-type {
  border-top: none;
  margin-top: 0;
}

.shop-public .cat-title {
  margin: 0 0 12px;
  font-size: 17px;
  color: #1a7f37;
}

.shop-public .product-card h3.product-name {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
}

.shop-index-list {
  list-style: none;
  padding: 0;
  margin: 20px 0;
}

.shop-index-list li {
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}

.shop-index-list a {
  color: #1a7f37;
  font-weight: 600;
  text-decoration: none;
  font-size: 17px;
}
