:root {
  --bg: #faf9f7;
  --surface: #ffffff;
  --ink: #1c1a17;
  --muted: #6f6a63;
  --line: #e7e2da;
  --accent: #c8481f;
  --accent-dark: #a63a17;
  --gold: #b98a2f;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(28, 26, 23, .08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background:
  radial-gradient(900px 420px at 12% 0%, rgba(232, 121, 30, .07), transparent 60%),
  radial-gradient(900px 420px at 88% 12%, rgba(124, 58, 237, .08), transparent 60%),
  linear-gradient(180deg, #faf7f0 0%, #f8f4fa 55%, #f6f1f8 100%);
  color: var(--ink); }

/* 万圣节左右装饰栏 */
.hw-side {
  position: fixed; top: 17%; width: 66px; display: flex; flex-direction: column;
  align-items: center; gap: 40px; pointer-events: none; z-index: 1;
}
.hw-side-l { left: 14px; }
.hw-side-r { right: 14px; }
.hw-mini { width: 52px; height: auto; opacity: .85; }
.hw-ghost { width: 44px; }
.hw-batrow { width: 60px; }
.hw-spider { height: 64px; }
.hw-side .hw-mini { animation: hwFloat 5s ease-in-out infinite alternate; }
.hw-side .hw-mini:nth-child(2) { animation-delay: -1.6s; }
.hw-side .hw-mini:nth-child(3) { animation-delay: -3.2s; }
.hw-side .hw-mini:nth-child(4) { animation-delay: -4.4s; }
@keyframes hwFloat { from { transform: translateY(-4px) } to { transform: translateY(5px) } }
@media (max-width: 1360px) { .hw-side { display: none; } }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* Header */
.header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { font-weight: 800; font-size: 20px; letter-spacing: .5px; }
.logo span { color: var(--accent); }
.logo-flame { margin-right: 2px; }
.nav { display: flex; gap: 28px; font-size: 14px; color: var(--muted); }
.nav a:hover { color: var(--ink); }
.cart-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 16px; cursor: pointer; font-size: 14px; font-weight: 600; }
.cart-btn:hover { border-color: var(--ink); }
.cart-count { background: var(--accent); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; margin-left: 4px; }

/* Hero */
.hero { background: linear-gradient(135deg, #20130b 0%, #3a1d0e 55%, #5a2c10 100%); color: #fdf6ee; text-align: center; padding: 96px 24px 104px; }
/* Hero (Halloween edition, compact decorations) */
.hero-halloween {
  position: relative; overflow: hidden; text-align: left;
  background:
    radial-gradient(1100px 560px at 82% -12%, rgba(124, 58, 237, .38), transparent 62%),
    radial-gradient(900px 520px at 6% 112%, rgba(232, 121, 30, .30), transparent 56%),
    linear-gradient(135deg, #180d26 0%, #2c1440 48%, #46205e 100%);
  padding: 84px 24px 96px;
}
.halloween-bg { position: absolute; inset: 0; pointer-events: none; }
.hw-moon {
  position: absolute; top: 26px; right: 5%; width: 58px; height: 58px; border-radius: 50%;
  background: radial-gradient(circle at 34% 34%, #fff8dc, #ffeeb0 58%, #f3c76b);
  box-shadow: 0 0 36px 12px rgba(255, 224, 130, .3); opacity: .9;
}
.hw-bats { position: absolute; top: 34px; left: 4%; width: 118px; opacity: .85; animation: batsFly 9s ease-in-out infinite alternate; }
@keyframes batsFly { from { transform: translate(0, 0) } to { transform: translate(20px, -9px) } }
.hw-web { position: absolute; top: 0; width: 82px; opacity: .5; }
.hw-web-l { left: 0; }
.hw-web-r { right: 0; transform: scaleX(-1); }
.hw-pumpkin {
  position: absolute; bottom: 14px; left: 3%; width: 50px;
  animation: pumpkinGlow 3.2s ease-in-out infinite alternate;
}
@keyframes pumpkinGlow {
  from { filter: drop-shadow(0 0 6px rgba(255, 140, 0, .3)) }
  to   { filter: drop-shadow(0 0 16px rgba(255, 165, 0, .7)) }
}
.hero-inner { position: relative; z-index: 2; display: flex; align-items: center; gap: 48px; }
.hero-text { flex: 1.15; }
.hero-text .hero-sub { margin-left: 0; margin-right: 0; }
.hero-3d { flex: 1; display: flex; flex-direction: column; align-items: center; perspective: 1200px; }
.spinner {
  width: min(300px, 68%); aspect-ratio: 1; position: relative;
  transform-style: preserve-3d; animation: spin3d 14s linear infinite;
}
.hero-3d:hover .spinner { animation-play-state: paused; }
.face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.face.back { transform: rotateY(180deg); }
@keyframes spin3d { from { transform: rotateY(0deg) } to { transform: rotateY(360deg) } }
.spinner-shadow {
  width: 58%; height: 18px; margin-top: 30px; border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, .55), transparent 70%);
}
@media (max-width: 900px) {
  .hero-halloween { text-align: center; }
  .hero-inner { flex-direction: column; gap: 20px; }
  .hero-text .hero-sub { margin-left: auto; margin-right: auto; }
  .hero-3d { width: 100%; }
  .hw-moon { width: 42px; height: 42px; right: 4%; }
  .hw-pumpkin { width: 36px; left: 3%; }
}
.hero-eyebrow { font-size: 12px; letter-spacing: 3px; color: #e8b96f; margin-bottom: 18px; }
.hero h1 { font-size: clamp(34px, 5vw, 56px); line-height: 1.15; font-weight: 800; }
.hero-sub { max-width: 620px; margin: 20px auto 32px; color: #d9c6b4; font-size: 16px; line-height: 1.7; }

/* Buttons */
.btn { display: inline-block; border: none; border-radius: 999px; padding: 14px 32px; font-size: 15px; font-weight: 700; cursor: pointer; transition: .15s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-block { display: block; width: 100%; margin-top: 10px; }
.side-nav { position: fixed; top: 50%; transform: translateY(-50%); z-index: 40; width: 46px; height: 46px; border-radius: 50%; border: 1px solid #e5e7eb; background: #ffffff; color: #111827; font-size: 26px; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,0.14); display: flex; align-items: center; justify-content: center; padding: 0; }
.side-nav:hover { background: #111827; color: #ffffff; }
.side-nav-prev { left: 12px; }
.side-nav-next { right: 12px; }
@media (max-width: 860px) { .side-nav { width: 38px; height: 38px; font-size: 22px; } .side-nav-prev { left: 6px; } .side-nav-next { right: 6px; } }

/* Products */
.search-bar { display: flex; align-items: center; gap: 10px; margin-top: 48px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; padding: 12px 20px; transition: .15s; }
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(200, 72, 31, .1); }
.search-icon { font-size: 15px; }
.search-bar input { flex: 1; border: none; outline: none; background: transparent; font-size: 15px; color: var(--ink); }
.no-results { grid-column: 1 / -1; text-align: center; color: var(--muted); font-size: 15px; padding: 60px 0; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 24px 0 24px; }
.section-head h2 { font-size: 26px; }
.section-note { color: var(--muted); font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 24px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: .18s; display: flex; flex-direction: column; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card-img { position: relative; aspect-ratio: 1/1; background: #f1ede7; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.badge { position: absolute; top: 12px; left: 12px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 1px; padding: 4px 10px; border-radius: 999px; }
.badge.hot { background: var(--accent); }
.card-no { position: absolute; top: 12px; right: 12px; background: rgba(18, 14, 10, .82); color: #ffd9a8; font-size: 12px; font-weight: 800; letter-spacing: .5px; padding: 4px 10px; border-radius: 999px; z-index: 2; }
.detail-tags { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.detail-no { background: var(--ink); color: #ffd9a8; font-size: 14px; font-weight: 800; padding: 4px 12px; border-radius: 999px; letter-spacing: .5px; }
.card-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-size: 14px; font-weight: 600; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 40px; }
.card-title-cn { font-size: 12px; color: var(--muted); }
.price-row { display: flex; align-items: baseline; gap: 8px; margin-top: auto; }
.price { font-size: 20px; font-weight: 800; color: var(--accent); }
.price-compare { font-size: 13px; color: var(--muted); text-decoration: line-through; }
.stock-note { font-size: 12px; color: var(--gold); font-weight: 600; }
.card-views { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }

/* Features & info */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin: 64px 0; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; text-align: center; }
.feature-icon { font-size: 26px; margin-bottom: 10px; }
.feature h3 { font-size: 16px; margin-bottom: 6px; }
.feature p { font-size: 13px; color: var(--muted); line-height: 1.6; }
.info { max-width: 760px; margin: 40px auto; padding-bottom: 24px; }
.info h2 { font-size: 20px; margin-bottom: 12px; }
.info p { color: var(--muted); font-size: 14px; line-height: 1.8; }

/* Detail */
.back-link { display: inline-block; margin: 28px 0 20px; color: var(--muted); font-size: 14px; }
.back-link:hover { color: var(--ink); }
.detail-layout { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; margin-bottom: 64px; }
.gallery-main { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #f1ede7; aspect-ratio: 1/1; }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.gallery-thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.gallery-thumbs img.active { border-color: var(--accent); }
.detail-info h1 { font-size: 24px; line-height: 1.4; margin: 8px 0 4px; }
.detail-title-cn { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.detail-price { font-size: 32px; font-weight: 800; color: var(--accent); }
.detail-price-compare { font-size: 16px; color: var(--muted); text-decoration: line-through; margin-left: 10px; }
.detail-label { font-size: 13px; font-weight: 700; margin: 24px 0 10px; letter-spacing: .5px; }
.sku-list { display: flex; flex-direction: column; gap: 8px; }
.sku-item { display: flex; justify-content: space-between; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; font-size: 14px; background: var(--surface); }
.sku-item:hover { border-color: var(--ink); }
.sku-item.active { border-color: var(--accent); background: #fdf1ec; }
.sku-item .sku-price { font-weight: 700; color: var(--accent); }
.qty-row { display: flex; align-items: center; gap: 14px; margin: 20px 0; }
.qty-btn { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 18px; cursor: pointer; }
.qty-num { font-size: 16px; font-weight: 700; min-width: 28px; text-align: center; }
.detail-desc { color: var(--muted); font-size: 14px; line-height: 1.8; margin-top: 20px; border-top: 1px solid var(--line); padding-top: 18px; }
.next-btn { margin-top: 6px; color: var(--ink); }
.next-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Cart drawer */
.cart-overlay { position: fixed; inset: 0; background: rgba(28,26,23,.45); z-index: 90; }
.cart-drawer { position: fixed; top: 0; right: -420px; width: 400px; max-width: 92vw; height: 100%; background: var(--surface); z-index: 100; display: flex; flex-direction: column; transition: right .25s ease; box-shadow: -8px 0 30px rgba(0,0,0,.12); }
.cart-drawer.open { right: 0; }
.cart-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.cart-head h3 { font-size: 18px; }
.close-btn { border: none; background: none; font-size: 18px; cursor: pointer; color: var(--muted); }
.cart-items { flex: 1; overflow-y: auto; padding: 14px 22px; }
.cart-item { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cart-item img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; }
.cart-item-name { font-size: 13px; font-weight: 600; line-height: 1.4; }
.cart-item-sku { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cart-item-price { font-size: 14px; font-weight: 800; color: var(--accent); margin-top: 4px; }
.cart-item-qty { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.mini-qty { display: flex; align-items: center; gap: 8px; }
.mini-qty button { width: 24px; height: 24px; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; cursor: pointer; font-size: 14px; }
.cart-remove { font-size: 12px; color: var(--muted); background: none; border: none; cursor: pointer; text-decoration: underline; }
.cart-empty { text-align: center; color: var(--muted); padding: 60px 0; font-size: 14px; }
.cart-foot { border-top: 1px solid var(--line); padding: 18px 22px 22px; }
.cart-total-row { display: flex; justify-content: space-between; font-size: 16px; }
.cart-note { font-size: 12px; color: var(--muted); margin: 6px 0 4px; }

/* Checkout modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(28,26,23,.5); z-index: 120; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { position: relative; background: var(--surface); border-radius: 18px; padding: 30px; width: 420px; max-width: 100%; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow); }
.modal-close { position: absolute; top: 12px; right: 14px; font-size: 18px; z-index: 2; }
.modal h3 { font-size: 20px; }
.modal-sub { color: var(--muted); font-size: 13px; margin: 8px 0 14px; }
.modal label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 4px; }
.modal input { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 13px; font-size: 14px; margin-top: 4px; }
.modal input:focus { outline: none; border-color: var(--accent); }
.modal select { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 13px; font-size: 14px; margin-top: 4px; background: #fff; color: inherit; }
.modal select:focus { outline: none; border-color: var(--accent); }
.success-icon { font-size: 40px; text-align: center; margin-bottom: 8px; }
#checkoutSuccess { text-align: center; }

/* Footer */
.footer { border-top: 1px solid var(--line); margin-top: 60px; padding: 28px 0; color: var(--muted); font-size: 13px; text-align: center; }
.footer .admin-link { margin-top: 6px; }
.footer .admin-link a { color: var(--muted); text-decoration: none; border-bottom: 1px dashed var(--line); font-size: 12px; }
.footer .admin-link a:hover { color: var(--ink); }

/* 语言切换器 */
.header-actions { display: flex; align-items: center; gap: 10px; }
.lang-wrap { position: relative; }
.lang-btn { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; cursor: pointer; font-size: 13px; font-weight: 600; }
.lang-btn:hover { border-color: var(--ink); }
.lang-caret { font-size: 10px; color: var(--muted); }
.lang-menu { position: absolute; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 190px; max-height: 330px; overflow-y: auto; z-index: 60; }
.lang-item { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 9px 12px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.lang-item:hover { background: #f5f1ea; }
.lang-item.active { color: var(--accent); font-weight: 700; }
.lang-code { font-size: 11px; color: var(--muted); }
.lang-item.active .lang-code { color: var(--accent); }

@media (max-width: 860px) {
  .detail-layout { grid-template-columns: 1fr; gap: 28px; }
  .nav { display: none; }
}

/* ---------- 移动端适配（手机竖屏优先） ---------- */
@media (max-width: 700px) {
  html, body { overflow-x: hidden; }
  .container { padding: 0 14px; }

  /* 顶部栏压缩：logo + 语言 + 购物车 一行放得下 */
  .header-inner { height: 56px; gap: 8px; }
  .logo { font-size: 17px; }
  .header-actions { gap: 6px; }
  .lang-btn { padding: 6px 10px; font-size: 12px; }
  .cart-btn { padding: 7px 12px; font-size: 13px; }
  .lang-menu { min-width: 168px; right: -6px; max-height: 60vh; }

  /* 首屏 */
  .hero, .hero-halloween { padding: 54px 16px 58px; }
  .hero-inner { gap: 18px; }
  .hero-eyebrow { margin-bottom: 12px; letter-spacing: 2px; }
  .hero-sub { font-size: 14px; margin: 14px auto 22px; }
  .btn { padding: 12px 24px; font-size: 14px; }
  .spinner { width: min(230px, 72%); }
  .spinner-shadow { margin-top: 18px; }

  /* 商品区：手机双列 */
  .search-bar { margin-top: 24px; padding: 10px 14px; }
  .search-bar input { font-size: 16px; } /* 防 iOS 聚焦缩放 */
  .section-head { margin: 18px 0 14px; flex-wrap: wrap; gap: 4px; }
  .section-head h2 { font-size: 21px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card-body { padding: 12px; gap: 6px; }
  .card-title { font-size: 13px; min-height: 34px; }
  .card-title-cn { font-size: 11px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
  .price { font-size: 17px; }
  .price-compare { font-size: 12px; }
  .badge { top: 8px; left: 8px; font-size: 10px; padding: 3px 8px; }
  .card-no { top: 8px; right: 8px; font-size: 11px; padding: 3px 8px; }

  /* 特色 & 信息 */
  .features { grid-template-columns: 1fr; gap: 12px; margin: 40px 0; }
  .feature { padding: 20px; }
  .info { margin: 28px auto; }
  .info h2 { font-size: 18px; }

  /* 详情页 */
  .back-link { margin: 18px 0 12px; }
  .detail-layout { gap: 20px; margin-bottom: 40px; }
  .detail-info h1 { font-size: 19px; }
  .detail-title-cn { font-size: 13px; }
  .detail-price { font-size: 27px; }
  .detail-price-compare { font-size: 14px; }
  .gallery-thumbs { gap: 8px; }
  .gallery-thumbs img { width: 58px; height: 58px; }
  .sku-item { padding: 11px 12px; font-size: 13px; }
  .qty-row { margin: 16px 0; }
  .detail-desc { font-size: 13px; margin-top: 16px; padding-top: 14px; }
  .side-nav { width: 34px; height: 34px; font-size: 20px; }
  .side-nav-prev { left: 4px; }
  .side-nav-next { right: 4px; }

  /* 购物车抽屉 & 结算弹窗 */
  .cart-drawer { width: 100%; max-width: 100%; }
  .cart-head { padding: 16px; }
  .cart-items { padding: 12px 16px; }
  .cart-foot { padding: 14px 16px 18px; }
  .cart-item img { width: 60px; height: 60px; }
  .modal { padding: 22px 18px; border-radius: 14px; max-height: 88vh; }
  .modal h3 { font-size: 18px; }
  .modal input, .modal select { font-size: 16px; } /* 防 iOS 聚焦缩放 */

  .footer { margin-top: 40px; padding: 22px 0; }

  /* 触控友好：放大过小的点击区域 */
  .logo { padding: 6px 0; }
  .search-bar input { min-height: 26px; padding: 6px 0; }
  .close-btn { min-width: 34px; min-height: 34px; display: flex; align-items: center; justify-content: center; }
  .lang-btn, .cart-btn { min-height: 34px; }
  .footer .admin-link a { display: inline-block; padding: 8px 0; }
}
@media (max-width: 380px) {
  .grid { gap: 10px; }
  .card-body { padding: 10px; }
  .card-title { font-size: 12px; }
  .lang-btn { padding: 6px 8px; }
  .cart-btn { padding: 6px 10px; }
}
