/* Mobile shop H5 */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    "Microsoft YaHei", sans-serif;
  background: #e8e8e8;
  color: #222;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.page {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100%;
  background: #f5f5f5;
  position: relative;
}

/* ===== Home: banner 60% / products 40% ===== */
.home-page {
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.home-page .loading-tip {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  padding: 0;
}

.banner {
  flex: 0 0 60%;
  height: 60%;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #f5f5f5;
}

.banner-track,
.banner-slide,
.banner-slide a {
  display: block;
  width: 100%;
  height: 100%;
}

.banner-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.banner-dots {
  display: none;
}

.product-grid {
  flex: 0 0 40%;
  height: 40%;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 6px;
  padding: 6px;
}

.product-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.product-card .thumb {
  width: 100%;
  flex: 0 0 auto;
  height: auto;
  aspect-ratio: 206 / 105;
  object-fit: contain;
  object-position: center;
  background: #fff;
}

.product-card .info {
  padding: 3px 6px 4px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  justify-content: center;
}

.product-card .name {
  font-size: 12px;
  line-height: 1.3;
  color: #222;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 2px;
}

.product-card .meta {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
}

.product-card .price-wrap {
  min-width: 0;
}

.product-card .price {
  color: #ff2d2d;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.product-card .price::before {
  content: "\FFE5";
  font-size: 11px;
  margin-right: 1px;
}

.product-card .sold {
  color: #999;
  font-size: 10px;
  margin-top: 1px;
}

.btn-buy {
  flex-shrink: 0;
  border: none;
  background: #8a5cf5;
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 14px;
  cursor: pointer;
  line-height: 1.2;
}

.btn-buy:active {
  opacity: 0.85;
}

.empty-tip,
.loading-tip {
  text-align: center;
  color: #999;
  padding: 40px 16px;
  font-size: 14px;
}

/* ===== Pay page ===== */
.pay-page {
  min-height: 100%;
  background: #f3f4f6;
  padding-bottom: 120px;
}

.pay-header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  font-size: 17px;
  font-weight: 600;
}

.pay-back {
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 28px;
  color: #333;
  line-height: 1;
}

.pay-amount-card {
  margin: 8px 16px 20px;
  padding: 28px 20px 24px;
  border-radius: 16px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 55%, #1d4ed8 100%);
  color: #fff;
  text-align: center;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.pay-amount-card .label {
  font-size: 13px;
  opacity: 0.9;
  margin-bottom: 10px;
}

.pay-amount-card .amount {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.pay-amount-card .amount span {
  font-size: 22px;
  margin-right: 4px;
  font-weight: 600;
}

.pay-amount-card .desc {
  font-size: 13px;
  opacity: 0.9;
  line-height: 1.4;
  padding: 0 8px;
  word-break: break-all;
}

.pay-methods {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pay-method {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: 999px;
  padding: 14px 18px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: border-color 0.15s ease;
}

.pay-method.selected {
  border-color: #3b82f6;
}

.pay-method .pay-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
}

.pay-method .pay-icon img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: block;
}

.pay-method .method-name {
  flex: 1;
  font-size: 15px;
  color: #222;
}

.radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid #c5c5c5;
  position: relative;
  flex-shrink: 0;
}

.pay-method.selected .radio {
  border-color: #3b82f6;
}

.pay-method.selected .radio::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #3b82f6;
}

.pay-footer {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 430px;
  padding: 12px 20px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, #f3f4f6 70%, rgba(243, 244, 246, 0));
}

.btn-pay {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 999px;
  background: #3b82f6;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
}

.btn-pay:active {
  opacity: 0.9;
}

.pay-agree {
  text-align: center;
  color: #9ca3af;
  font-size: 12px;
  margin-top: 10px;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  padding: 16px 20px;
  border-radius: 10px;
  font-size: 15px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  width: 78%;
  max-width: 320px;
  text-align: center;
  line-height: 1.45;
}

.toast-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.toast-msg {
  font-size: 12px;
  color: #f3f4f6;
  word-break: break-word;
  text-align: left;
}

.toast.show {
  opacity: 1;
}
