:root {
  --yellow: #ffd84d;
  --orange: #ff9f1c;
  --coral: #ff6b6b;
  --teal: #20c7b5;
  --blue: #4facfe;
  --purple: #8b5cf6;
  --ink: #272343;
  --muted: #6b6f8a;
  --cream: #fff8e7;
  --white: #ffffff;
  --green: #38c172;
  --red: #ef4444;
  --shadow: 0 18px 40px rgba(83, 73, 136, 0.14);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 216, 77, 0.32), transparent 28rem),
    radial-gradient(circle at 90% 10%, rgba(32, 199, 181, 0.24), transparent 26rem),
    linear-gradient(180deg, #fffaf0 0%, #f5f8ff 100%);
  min-height: 100vh;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  position: relative;
  min-height: 480px;
  margin-top: 20px;
  padding: 22px clamp(20px, 4vw, 48px) 46px;
  overflow: hidden;
  border-radius: 0 0 42px 42px;
  background:
    linear-gradient(135deg, rgba(255, 216, 77, 0.95), rgba(255, 159, 28, 0.84) 45%, rgba(255, 107, 107, 0.86)),
    var(--yellow);
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -80px -150px;
  height: 260px;
  border-radius: 50% 50% 0 0;
  background: rgba(255, 255, 255, 0.35);
}

.topbar,
.hero-content {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.08rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: var(--white);
  background: linear-gradient(135deg, var(--purple), var(--blue));
  box-shadow: 0 8px 18px rgba(83, 65, 170, 0.28);
}

.topbar-link {
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.82);
}

.hero-content {
  max-width: 690px;
  padding-top: 72px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  color: #7c4a00;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  line-height: 1.12;
  letter-spacing: -0.04em;
}

.hero-text {
  max-width: 560px;
  margin: 20px 0 0;
  color: rgba(39, 35, 67, 0.76);
  font-size: 1.05rem;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 30px;
}

.primary-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  padding: 13px 24px;
  border-radius: 999px;
  font-weight: 800;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-link {
  color: var(--white);
  background: linear-gradient(135deg, var(--purple), var(--blue));
  box-shadow: 0 12px 24px rgba(79, 103, 255, 0.28);
}

.secondary-link {
  background: rgba(255, 255, 255, 0.82);
}

.primary-link:hover,
.secondary-link:hover {
  transform: translateY(-3px);
}

.hero-balloon {
  position: absolute;
  z-index: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.28);
  border: 2px solid rgba(255, 255, 255, 0.42);
  animation: float 5s ease-in-out infinite;
}

.balloon-one {
  right: 10%;
  top: 34%;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  font-size: 2rem;
}

.balloon-two {
  right: 23%;
  top: 68%;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  animation-delay: -1.5s;
}

.balloon-three {
  right: 6%;
  top: 62%;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  animation-delay: -3s;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-14px) rotate(5deg); }
}

.load-more-btn,
.cancel-btn,
.confirm-btn,
.redeem-btn {
  cursor: pointer;
  border: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.products-section {
  padding: 8px 0 70px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  letter-spacing: -0.03em;
}

.product-count {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 28px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  flex: 0 0 auto;
  cursor: pointer;
  padding: 11px 18px;
  border: 2px solid transparent;
  border-radius: 999px;
  color: var(--ink);
  font-weight: 800;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 18px rgba(83, 73, 136, 0.08);
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.filter-btn:hover {
  transform: translateY(-2px);
}

.filter-btn.active {
  color: var(--white);
  border-color: var(--purple);
  background: linear-gradient(135deg, var(--purple), var(--blue));
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: 22px;
}

.product-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 3px solid var(--white);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: 0 14px 30px rgba(83, 73, 136, 0.1);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.product-card:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: 0 22px 42px rgba(83, 73, 136, 0.18);
}

.product-image-wrap {
  position: relative;
  aspect-ratio: 1 / 0.82;
  overflow: hidden;
  background: linear-gradient(135deg, #fff4c7, #e6fff9);
}

.product-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.product-card:hover .product-image-wrap img {
  transform: scale(1.07);
}

.stock-badge {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #087f5b;
  font-size: 0.76rem;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.9);
}

.stock-badge.low {
  color: #b45309;
}

.stock-badge.out {
  color: #991b1b;
}

.category-badge {
  position: absolute;
  right: 12px;
  top: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 900;
  background: rgba(39, 35, 67, 0.72);
}

.product-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 17px;
}

.product-body h3 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.4;
}

.product-description {
  min-height: 44px;
  margin: 8px 0 9px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.65;
}

.product-spec {
  margin: 0 0 14px;
  padding: 8px 10px;
  border-radius: 12px;
  color: #4b5563;
  font-size: 0.78rem;
  font-weight: 700;
  background: #f6f7fb;
}

.cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.cost {
  display: grid;
  gap: 1px;
}

.cost strong {
  color: var(--coral);
  font-size: 1.35rem;
}

.cost span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.redeem-btn {
  padding: 10px 14px;
  border-radius: 14px;
  color: var(--white);
  font-weight: 900;
  background: linear-gradient(135deg, var(--coral), var(--orange));
  box-shadow: 0 10px 18px rgba(255, 107, 107, 0.22);
}

.redeem-btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

.redeem-btn:disabled {
  cursor: not-allowed;
  opacity: 0.52;
  box-shadow: none;
}

.buy-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 12px;
  color: #2563eb;
  font-size: 0.82rem;
  font-weight: 800;
}

.buy-link::after {
  content: "↗";
}

.load-more-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  margin-top: 34px;
}

.load-more-btn {
  padding: 13px 28px;
  border-radius: 999px;
  color: var(--white);
  font-weight: 900;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  box-shadow: 0 12px 24px rgba(32, 199, 181, 0.22);
}

#sentinel {
  position: absolute;
  bottom: 0;
  width: 1px;
  height: 1px;
}

.all-loaded {
  margin: 22px 0 0;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

.footer {
  padding: 24px 0 42px;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(39, 35, 67, 0.48);
  backdrop-filter: blur(6px);
}

.modal {
  position: relative;
  width: min(460px, 100%);
  padding: 24px;
  border-radius: 28px;
  background: var(--white);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
  animation: modalIn 0.22s ease both;
}

@keyframes modalIn {
  from { transform: translateY(18px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-close {
  position: absolute;
  right: 14px;
  top: 12px;
  cursor: pointer;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 2rem;
  line-height: 1;
}

.modal-product {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-right: 28px;
}

.modal-product img {
  flex: 0 0 auto;
  width: 112px;
  height: 112px;
  border-radius: 20px;
  object-fit: cover;
  background: #f3f4f6;
}

.modal-tag {
  margin: 0 0 6px;
  color: var(--purple);
  font-size: 0.78rem;
  font-weight: 900;
}

.modal-product h3 {
  margin: 0 0 7px;
  font-size: 1.12rem;
  line-height: 1.35;
}

.modal-product p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.modal-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 22px;
  padding: 16px;
  border-radius: 18px;
  background: #fff7dd;
}

.modal-summary span {
  color: var(--muted);
  font-weight: 700;
}

.modal-summary strong {
  color: var(--coral);
  font-size: 1.3rem;
}

.modal-tip {
  margin: 12px 2px 20px;
  color: var(--muted);
  font-size: 0.84rem;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.cancel-btn,
.confirm-btn {
  padding: 13px 16px;
  border-radius: 16px;
  font-weight: 900;
}

.cancel-btn {
  background: #f1f3f9;
}

.confirm-btn {
  color: var(--white);
  background: linear-gradient(135deg, var(--coral), var(--orange));
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 60;
  max-width: calc(100% - 40px);
  padding: 13px 20px;
  border-radius: 999px;
  color: var(--white);
  font-weight: 900;
  background: rgba(39, 35, 67, 0.92);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.24);
  transform: translate(-50%, 20px);
  animation: toastIn 0.22s ease both;
}

.toast.success {
  background: linear-gradient(135deg, #16a34a, #22c55e);
}

.toast.error {
  background: linear-gradient(135deg, #dc2626, #f97316);
}

@keyframes toastIn {
  to { transform: translate(-50%, 0); }
}

@media (max-width: 680px) {
  .page-shell {
    width: min(100% - 20px, 1180px);
  }

  .hero {
    min-height: 430px;
    margin-top: 10px;
    padding: 18px 18px 42px;
    border-radius: 0 0 30px 30px;
  }

  .hero-content {
    padding-top: 58px;
  }

  .topbar-link {
    padding: 9px 14px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .product-card {
    border-width: 2px;
    border-radius: 18px;
  }

  .product-body {
    padding: 12px;
  }

  .product-description {
    min-height: 58px;
    font-size: 0.78rem;
  }

  .product-spec {
    padding: 7px 8px;
    font-size: 0.72rem;
  }

  .cost-row {
    align-items: stretch;
    flex-direction: column;
  }

  .cost strong {
    font-size: 1.15rem;
  }

  .redeem-btn {
    width: 100%;
    padding: 9px 10px;
  }

  .buy-link {
    font-size: 0.76rem;
  }

  .modal {
    padding: 20px;
    border-radius: 24px;
  }

  .modal-product img {
    width: 86px;
    height: 86px;
  }

  .modal-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .products-grid {
    grid-template-columns: 1fr;
  }

  .cost-row {
    align-items: center;
    flex-direction: row;
  }

  .redeem-btn {
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
