/* ============================================
   मेगा सेल —— 前台样式（移动优先，桌面增强）
   默认样式 = 手机版；≥768px 时升级为桌面布局
   ============================================ */
:root {
  --brand: #ff3d00;
  --brand-dark: #c62828;
  --brand-light: #ffe0b2;
  --bg: #fdf6ef;
  --surface: #ffffff;
  --text: #212121;
  --text-muted: #757575;
  --border: #eee0d0;
  --success: #2e7d32;
  --shadow: 0 3px 12px rgba(120, 60, 0, 0.08);
  --radius: 12px;
  --gap: 10px;
}

* { box-sizing: border-box; }

/* 关键修复：显式 display 会覆盖 HTML hidden 属性，这里强制让 hidden 元素隐藏 */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans", "Noto Sans Devanagari", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 14px;
}

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

a { color: var(--brand); }

/* ---------- 头部（手机：紧凑单行） ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding-top: 8px;
  padding-bottom: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo { font-size: 22px; }

.brand-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--brand);
  white-space: nowrap;
}

.header-nav { display: none; }

/* ---------- 宣传横幅（手机：单列居中） ---------- */
.hero {
  background:
    linear-gradient(rgba(20, 8, 30, 0.55), rgba(20, 8, 30, 0.55)),
    url('../images/hero-bg.jpg') center / cover no-repeat;
  background-color: #2a0a30;
  color: #fff;
  padding: 22px 0 24px;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}

.hero-badge {
  display: inline-block;
  background: var(--brand);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}

.hero h1 {
  font-size: clamp(1.9rem, 8vw, 2.6rem);
  margin: 0 0 4px;
  line-height: 1.12;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

.hero-subtitle {
  font-size: clamp(1rem, 4.5vw, 1.2rem);
  margin: 0 0 2px;
  font-weight: 700;
}

.hero-banner {
  font-size: 0.9rem;
  margin: 0 0 10px;
  opacity: 0.95;
}

.hero-art { display: none; }

/* 倒计时（手机：全宽单行） */
.countdown-wrap {
  background: rgba(0, 0, 0, 0.18);
  border-radius: var(--radius);
  padding: 10px 12px;
  width: 100%;
  max-width: 360px;
}

.countdown-label {
  margin: 0 0 6px;
  font-weight: 700;
  font-size: 12.5px;
}

.countdown {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.cd-box {
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  min-width: 52px;
  padding: 6px 4px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  flex: 1;
  max-width: 64px;
}

.cd-box span {
  display: block;
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.cd-box small {
  font-size: 10.5px;
  color: var(--text-muted);
}

.cd-sep { font-weight: 800; font-size: 16px; }

/* ---------- 商品区（手机：双列卡片） ---------- */
.offers { padding: 18px 0 4px; }

.section-title {
  font-size: 1.2rem;
  margin: 0 0 12px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.product-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 22px rgba(120, 60, 0, 0.14);
}

.product-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #f7f2ea;
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.discount-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
}

/* 已抢光：图片上的遮罩 */
.soldout-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1px;
}

/* 直降标签：抢按钮旁 */
.price-drop {
  display: inline-block;
  align-self: flex-start;
  background: #ffecb3;
  color: #b26500;
  font-size: 12px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  margin-top: 2px;
}

/* 已抢光商品的抢按钮（禁用态） */
.buy-btn.is-disabled {
  background: #bdbdbd;
  cursor: not-allowed;
  box-shadow: none;
}

.buy-btn.is-disabled:hover { filter: none; }
.buy-btn.is-disabled:active { transform: none; }

.product-card.is-soldout .product-media img {
  filter: grayscale(0.7);
}

.product-body {
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.product-name {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.3;
}

.product-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.offer-price {
  font-size: 18px;
  font-weight: 800;
  color: var(--success);
}

.orig-price {
  color: var(--text-muted);
  text-decoration: line-through;
  font-size: 12.5px;
}

.buy-btn {
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--brand) 0%, #ff6d00 100%);
  color: #fff;
  font-size: 14.5px;
  font-weight: 800;
  padding: 11px 12px;
  border-radius: 10px;
  letter-spacing: 0.3px;
  margin-top: 6px;
  width: 100%;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.buy-btn:hover { filter: brightness(1.08); }
.buy-btn:active { transform: scale(0.97); }

.empty-tip {
  text-align: center;
  color: var(--text-muted);
  padding: 20px 0;
}

/* ---------- 流程说明（手机：纵向步骤） ---------- */
.how { padding: 18px 0; }

.steps {
  margin: 0;
  padding: 0 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.steps li {
  background: var(--surface);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  list-style-position: inside;
  font-weight: 600;
  font-size: 13.5px;
}

/* ---------- 页脚 ---------- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 14px 0;
  color: var(--text-muted);
  font-size: 12.5px;
  text-align: center;
}

.site-footer p { margin: 0; }

/* ============================================
   优惠领取页（手机：全屏卡片 + 底部粘性按钮）
   ============================================ */
.offer-page {
  background: linear-gradient(160deg, #fff3e6 0%, #ffe0b2 100%);
  min-height: 100vh;
}

.offer-close {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
  z-index: 30;
  transition: background 0.15s ease, transform 0.1s ease;
}

.offer-close:hover { background: var(--brand); color: #fff; }
.offer-close:active { transform: scale(0.92); }

.offer-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px 12px 90px;
}

.offer-card {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 14px 44px rgba(120, 60, 0, 0.20);
  max-width: 420px;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.offer-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #f7f2ea;
}

.offer-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.offer-content {
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.offer-tag {
  align-self: flex-start;
  background: var(--brand-light);
  color: var(--brand-dark);
  font-weight: 800;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
}

.offer-content h1 {
  margin: 0;
  font-size: 22px;
}

.offer-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.offer-price-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.offer-price {
  font-size: 28px;
  font-weight: 800;
  color: var(--success);
}

.offer-notice {
  background: #fff8e1;
  border: 1px dashed var(--brand);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
}

.offer-notice p { margin: 3px 0; }

/* 底部粘性领取按钮（手机转化利器） */
.claim-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--border);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
}

.claim-bar .btn-claim {
  width: 100%;
  font-size: 17px;
  padding: 14px 16px;
  border-radius: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-size: 15px;
  font-weight: 800;
  padding: 12px 16px;
  border-radius: 11px;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.btn:hover { filter: brightness(1.07); }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--brand) 0%, #ff6d00 100%);
  color: #fff;
}

.btn-claim {
  background: linear-gradient(135deg, #2e7d32 0%, #43a047 100%);
  color: #fff;
  font-size: 17px;
  padding: 13px 16px;
  box-shadow: 0 6px 18px rgba(46, 125, 50, 0.35);
}

.btn-claim.is-disabled {
  background: #bdbdbd;
  box-shadow: none;
  cursor: not-allowed;
  pointer-events: none;
}

.offer-footnote {
  margin: 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.offer-empty {
  padding: 36px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.offer-empty-emoji { font-size: 44px; margin: 0; }
.offer-empty h1 { margin: 0; }
.offer-empty p { margin: 0; color: var(--text-muted); }

/* ============================================
   网站欢迎弹窗（移动优先）
   ============================================ */
.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: popup-fade 0.25s ease;
}

.popup-card {
  position: relative;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  max-width: 400px;
  width: 100%;
  padding: 26px 22px 24px;
  text-align: center;
  animation: popup-pop 0.3s cubic-bezier(0.18, 0.9, 0.32, 1.2);
}

.popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: #f1ece4;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.popup-close:hover { background: var(--brand); color: #fff; }
.popup-close:active { transform: scale(0.92); }

.popup-icon {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 10px;
}

/* 弹窗图片（可选，有图时显示） */
.popup-image {
  margin: -26px -22px 14px;
  border-radius: 18px 18px 0 0;
  overflow: hidden;
  height: 150px;
  background: #f5f0e8;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.popup-image .img-fallback {
  font-size: 44px;
}

.popup-title {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 800;
  color: var(--text);
}

.popup-message {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 14.5px;
  line-height: 1.6;
}

.btn-popup {
  background: linear-gradient(135deg, var(--brand) 0%, #ff6d00 100%);
  color: #fff;
  width: 100%;
  font-size: 16px;
  padding: 13px 16px;
  box-shadow: 0 6px 18px rgba(255, 61, 0, 0.35);
}

@keyframes popup-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popup-pop {
  from { opacity: 0; transform: scale(0.9) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---------- 右下角悬浮按钮（弹窗关闭后可重新打开） ---------- */
.popup-fab {
  position: fixed;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--brand) 0%, #ff6d00 100%);
  color: #fff;
  font-size: 13.5px;
  font-weight: 800;
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(255, 61, 0, 0.4);
  transition: transform 0.15s ease, filter 0.15s ease;
  animation: fab-in 0.3s ease;
}

.popup-fab:hover { filter: brightness(1.08); transform: translateY(-2px); }
.popup-fab:active { transform: scale(0.95); }

.fab-icon { font-size: 18px; line-height: 1; }

@keyframes fab-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   桌面增强（≥768px）
   ============================================ */
@media (min-width: 768px) {
  .container {
    max-width: 1080px;
    padding: 0 20px;
  }

  .header-nav {
    display: flex;
    gap: 18px;
  }

  .header-nav a {
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    font-size: 14.5px;
  }

  .header-nav a:hover { color: var(--brand); }

  .hero { padding: 40px 0 44px; }

  .hero-inner {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
    align-items: center;
    gap: 28px;
  }

  .hero-art {
    display: none;
  }

  .hero-badge { margin-bottom: 10px; }

  .hero-banner { margin-bottom: 14px; }

  .countdown-wrap {
    max-width: none;
    width: auto;
    padding: 10px 14px;
  }

  .countdown { justify-content: flex-start; }

  .cd-box { flex: 0 0 auto; max-width: none; }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
  }

  .product-media { aspect-ratio: 4 / 3; }

  .product-body { padding: 12px 14px 14px; gap: 5px; }

  .product-name { font-size: 16px; }

  .product-desc { font-size: 12.5px; }

  .offer-price { font-size: 20px; }

  .buy-btn {
    width: auto;
    font-size: 14.5px;
    padding: 10px 14px;
  }

  .steps {
    flex-direction: row;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
  }

  .offer-main { padding: 40px 20px; }

  .offer-media { aspect-ratio: 16 / 9; }

  .claim-bar { display: none; }
}

/* 更小屏（≤360px 极小手机）微调 */
@media (max-width: 360px) {
  .cd-box { min-width: 46px; }
  .cd-box span { font-size: 17px; }
  .product-body { padding: 8px 8px 10px; }
  .offer-price { font-size: 16px; }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
