/* ========================================================================
   家政好物线报站 - 样式（移动端 H5，最大宽度 480px）
   主题色：#D85A45 橙红
   ======================================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --primary: #E8553F;
  --primary-light: #FFF4ED;
  --primary-lighter: #FFF8F3;
  --primary-border: #FFE0CC;
  --text: #222;
  --text-sub: #666;
  --text-mute: #999;
  --bg: #FAF7F5;
  --card: #FFFFFF;
  --border: #EEEEEE;
  --success: #5BA82A;
  --success-bg: #F0F9E8;
  --warning: #D4A02A;
  --warning-bg: #FFF7E0;
  --radius-card: 14px;
  --shadow-card: 0 2px 8px rgba(232, 85, 63, .06);
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  background: var(--bg);
  min-height: 100vh;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  min-height: 100vh;
  position: relative;
  padding-bottom: 100px;
}

.plain-button {
  appearance: none; -webkit-appearance: none; border: 0; font: inherit;
  color: inherit; text-align: inherit; margin: 0; padding: 0;
  background: transparent; box-shadow: none; cursor: pointer;
}
.plain-button:focus-visible, [data-action]:focus-visible {
  outline: 3px solid rgba(232, 85, 63, .35); outline-offset: 2px;
}

/* ---------- 顶部栏 ---------- */
.sticky-header { position: sticky; top: 0; z-index: 50; background: #fff; }

.topbar { background: #fff; padding: 0 16px; border-bottom: 1px solid var(--border); }
.topbar-inner { height: 48px; display: flex; align-items: center; justify-content: space-between; }
.topbar-inner.center { justify-content: center; }
.topbar-update { font-size: 12px; color: var(--text-mute); flex-shrink: 0; }
.topbar-title { font-size: 16px; font-weight: 600; color: var(--primary); white-space: nowrap; }

.refresh-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: var(--primary); cursor: pointer; flex-shrink: 0;
  transition: transform .3s;
}
.refresh-btn:active { opacity: .6; }
.refresh-btn.spinning { animation: spin .6s linear; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

.fixed-tip, .rank-tip {
  text-align: center; font-size: 12px; color: var(--primary);
  background: var(--primary-light); padding: 6px 16px; line-height: 1.4;
}

/* 排序栏 */
.sort-bar {
  display: flex; align-items: center; gap: 8px;
  margin: 0 12px 8px; padding: 8px 12px;
  background: #fff; border-radius: 8px; font-size: 13px;
}
.sort-label { color: #999; flex-shrink: 0; }
.sort-opt {
  padding: 4px 12px; border-radius: 14px; cursor: pointer;
  color: #666; background: #F5F5F5; transition: all .15s;
}
.sort-opt:active { opacity: .8; }
.sort-active { background: var(--primary); color: #fff; font-weight: 600; }

/* 好物页搜索栏 */
.rank-search-bar { display: flex; align-items: center; padding: 6px 16px 10px; gap: 8px; }
.rank-search-bar input {
  flex: 1; height: 38px; background: #fff;
  border: 2px solid var(--primary); border-radius: 19px;
  padding: 0 14px; font-size: 13px; color: #333; outline: none;
  box-shadow: 0 2px 8px rgba(216, 90, 69, .12);
}
.rank-search-bar input::placeholder { color: #AAA; }
.rank-search-btn {
  height: 38px; padding: 0 18px; background: var(--primary); color: #fff;
  border-radius: 19px; font-size: 14px; font-weight: 600; cursor: pointer;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(216, 90, 69, .2);
}
.rank-search-btn:active { opacity: .8; }

/* ---------- 双层分类导航 ---------- */
.category-nav { position: relative; background: #fff; padding-right: 50px; }
.cat-row {
  display: flex; overflow-x: auto; padding: 8px 10px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.cat-row::-webkit-scrollbar { display: none; }
.cat-row.sub { padding-top: 0; border-top: 1px solid var(--border); }

.cat-tag {
  display: inline-flex; align-items: center; height: 28px;
  padding: 0 14px; margin-right: 8px; border-radius: 14px;
  font-size: 14px; color: var(--text-sub); white-space: nowrap;
  flex-shrink: 0; cursor: pointer; user-select: none; transition: all .15s;
}
.cat-tag.active { background: var(--primary); color: #fff; font-weight: 600; }
.cat-tag.small { height: 24px; padding: 0 12px; font-size: 13px; border-radius: 12px; }

.search-btn {
  position: absolute; top: 8px; right: 10px;
  width: 28px; height: 28px; border-radius: 14px;
  border: 1.5px solid var(--primary);
  display: flex; align-items: center; justify-content: center;
  background: #fff; z-index: 10; cursor: pointer;
}
.search-btn:active { background: var(--primary-light); }

.search-ico { position: relative; width: 16px; height: 16px; }
.search-ico::before {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 9px; height: 9px; border: 2px solid var(--primary);
  border-radius: 50%; box-sizing: border-box;
}
.search-ico::after {
  content: ''; position: absolute; top: 11px; left: 11px;
  width: 6px; height: 1.5px; background: var(--primary);
  transform: rotate(45deg); border-radius: 1px;
}

/* 搜索输入模式 */
.search-bar {
  display: flex; align-items: center; padding: 8px 10px;
  height: 44px; box-sizing: border-box; animation: slideIn .2s ease;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

.search-input {
  flex: 1; height: 32px; background: #F5F5F5; border-radius: 16px;
  display: flex; align-items: center; padding: 0 32px 0 12px; position: relative;
}
.search-ico-sm { position: relative; width: 14px; height: 14px; margin-right: 8px; flex-shrink: 0; }
.search-ico-sm::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 8px; height: 8px; border: 1.5px solid var(--text-mute);
  border-radius: 50%; box-sizing: border-box;
}
.search-ico-sm::after {
  content: ''; position: absolute; top: 9px; left: 9px;
  width: 5px; height: 1.2px; background: var(--text-mute);
  transform: rotate(45deg); border-radius: 1px;
}
.search-input input { flex: 1; border: none; outline: none; background: transparent; font-size: 14px; color: var(--text); height: 32px; }
.search-input input::placeholder { color: var(--text-mute); }

.close-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; border-radius: 9px; background: #E0E0E0;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; cursor: pointer;
}
.close-btn:active { background: #E5E5E5; }
.close-btn::before, .close-btn::after {
  content: ''; position: absolute; width: 8px; height: 1.5px;
  background: var(--text-sub); border-radius: 1px;
}
.close-btn::before { transform: rotate(45deg); }
.close-btn::after { transform: rotate(-45deg); }

.search-go {
  margin-left: 8px; flex-shrink: 0; font-size: 13px; color: #fff; font-weight: 500;
  background: var(--primary); padding: 7px 16px; border-radius: 16px; cursor: pointer; line-height: 1;
}
.search-go:active { opacity: .85; }

/* ---------- 搜索结果提示 ---------- */
.notice {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--primary-light); border-radius: 6px;
  margin: 10px 10px 0; padding: 7px 10px; font-size: 13px; color: var(--primary);
}
.notice .more { color: var(--text-mute); font-size: 12px; cursor: pointer; }

/* ---------- 商品卡片 ---------- */
.product-card {
  position: relative; display: flex; background: var(--card);
  border-radius: var(--radius-card); padding: 12px; margin: 10px;
  cursor: pointer; transition: transform .12s; box-shadow: var(--shadow-card);
}
.product-card:active { transform: scale(.98); background: #FAFAFA; }

.badge {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  background: var(--primary); color: #fff;
  font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 3px;
}
.badge-strategy { left: auto; right: 10px; background: var(--warning); }

.img-wrap {
  position: relative; width: 112px; height: 112px; flex-shrink: 0;
  border-radius: 8px; overflow: hidden; background: var(--primary-light);
}
.img-wrap.plain-button { padding: 0; cursor: pointer; }
.img-wrap .img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--primary); opacity: .5; font-size: 12px;
}

.info {
  flex: 1; margin-left: 12px; display: flex; flex-direction: column;
  min-width: 0; padding-right: 50px; position: relative;
}
.info.plain-button { background: transparent; cursor: pointer; width: 100%; }
.title {
  font-size: 15px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.subtitle {
  margin-top: 4px; font-size: 12px; color: var(--text-mute);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.price-row { margin-top: 6px; display: flex; align-items: baseline; }
.price-label { font-size: 11px; color: var(--text-mute); margin-right: 4px; }
.price { font-size: 20px; font-weight: 700; color: var(--primary); line-height: 1; font-variant-numeric: tabular-nums; }
.price-unknown { font-size: 12px; font-weight: 600; color: var(--warning); line-height: 1.3; }
.detail-price-unknown { font-size: 14px; }

.gift {
  margin-top: 6px; background: var(--primary-lighter);
  border: 1px solid var(--primary-border); border-radius: 4px;
  padding: 4px 6px; font-size: 11px; color: var(--primary);
  align-self: flex-start; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 3px;
}
.gift svg { flex-shrink: 0; }

.tags { margin-top: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.tag { font-size: 10px; padding: 2px 5px; border-radius: 3px; background: #F0F0F0; color: var(--text-mute); }
.tag-success { background: var(--success-bg); color: var(--success); }
.tag-warning { background: var(--warning-bg); color: var(--warning); }
.tag-strategy { background: #FFF4ED; color: var(--primary); border: 1px solid #FFD9C6; }
.freshness { background: #EEF6FF; color: #4F7CA8; }
.freshness.stale { background: #FFF7E0; color: #A47716; }

.fav-float {
  position: absolute; top: 16px; left: 96px; z-index: 4;
  width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.92);
  color: #999; text-align: center; font-size: 19px; line-height: 26px;
  box-shadow: 0 1px 5px rgba(0,0,0,.12); cursor: pointer;
}
.fav-float.active { color: var(--primary); }

.action {
  background: var(--primary); color: #fff; font-size: 12px; font-weight: 600;
  padding: 6px 14px; border-radius: 14px; cursor: pointer; flex-shrink: 0;
}
.action:active { opacity: .85; }

.action-group {
  position: absolute; right: 12px; bottom: 12px;
  display: flex; align-items: center; gap: 6px; z-index: 3;
}
.copy-btn {
  position: relative;
  width: 28px; height: 28px; border-radius: 50%;
  background: #fff; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--text-mute); cursor: pointer; line-height: 1;
}
.copy-btn::after { content: ''; position: absolute; inset: -8px; }
.copy-btn:active { opacity: .7; }
.copy-btn.copied { color: #fff; background: var(--success); border-color: var(--success); }

/* 加载状态 */
.loading, .finished { text-align: center; color: var(--text-mute); font-size: 13px; padding: 24px 0; }
.scroll-more { text-align: center; color: var(--text-mute); font-size: 12px; padding: 12px 0; }
.empty { text-align: center; color: var(--text-mute); font-size: 13px; padding: 50px 0; }

/* 骨架屏 */
.skeleton-card {
  display: flex; background: var(--card); border-radius: var(--radius-card);
  padding: 12px; margin: 10px; gap: 12px;
}
.sk-img { width: 112px; height: 112px; border-radius: 8px; background: #F0EBE8; animation: shimmer 1.2s infinite linear; }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 6px 0; }
.sk-line { height: 14px; border-radius: 7px; background: #F0EBE8; animation: shimmer 1.2s infinite linear; }
.sk-line.w70 { width: 70%; } .sk-line.w45 { width: 45%; } .sk-line.w30 { width: 30%; }
@keyframes shimmer {
  0% { opacity: 1; } 50% { opacity: .45; } 100% { opacity: 1; }
}

/* 复制引流弹层 */
.copy-panel {
  position: fixed; inset: 0; z-index: 9997;
  background: rgba(0, 0, 0, .5);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.cp-card {
  width: 260px; background: #fff; border-radius: 16px;
  padding: 20px 16px; text-align: center;
  animation: popIn .25s ease;
}
@keyframes popIn { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.cp-title { font-size: 17px; font-weight: 700; color: var(--success); }
.cp-desc { margin-top: 6px; font-size: 12px; color: var(--text-sub); line-height: 1.6; }
.cp-qr { margin: 12px auto 0; width: 220px; max-width:100%; padding: 6px; background: #fff; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.cp-qr img { width: 100%; height: auto; display: block; }
.cp-card { max-height:90vh; overflow:auto; }
.cp-tip { margin-top: 8px; font-size: 12px; color: var(--primary); font-weight: 600; }

/* 免责声明 */
.disclaimer { margin: 16px 4px 8px; font-size: 11px; color: var(--text-mute); text-align: center; line-height: 1.6; }

/* tab 内 SVG 图标 */
.tab-icon { display: block; line-height: 1; margin: 0 auto 3px; width: 24px; height: 24px; transition: transform .15s; }
.tab-icon svg { display: block; }
.mi-icon { display: inline-flex; margin-right: 10px; color: var(--primary); }
.refresh-btn svg { display: block; }

/* 尊重系统减弱动效设置 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.loading-spinner {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 60vh; gap: 16px;
}
.loading-spinner p { font-size: 14px; color: #999; }
.spinner {
  width: 36px; height: 36px; border: 3px solid #F0F0F0;
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ---------- 排行页 ---------- */
.rank-page { padding: 8px 12px 80px; min-height: 100vh; }
.rank-list { display: flex; flex-direction: column; gap: 8px; }
.rank-bottom-hint {
  text-align: center; font-size: 15px; color: #555;
  padding: 24px 16px 12px; line-height: 1.7; cursor: pointer; font-weight: 500;
}
.rank-bottom-hint b { color: var(--primary); }
.rank-bottom-hint:active { color: var(--primary); }

.rank-more-btn {
  text-align: center; font-size: 14px; font-weight: 500; color: var(--primary);
  background: #FFF4ED; border-radius: var(--radius-card);
  padding: 13px 16px; margin-top: 10px; cursor: pointer;
}
.rank-more-btn:active { opacity: .7; }

.rank-search-notice {
  text-align: center; font-size: 12px; color: #AAA;
  padding: 8px 12px; background: #F5F5F5; margin: 0 0 8px; border-radius: 6px;
}
.rank-search-clear { color: var(--primary); cursor: pointer; padding: 2px 6px; }

.rank-card {
  display: flex; align-items: center; background: #fff;
  border-radius: 10px; padding: 10px; cursor: pointer; transition: box-shadow .15s;
}
.rank-card:active { box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }

.rank-num {
  width: 28px; height: 28px; border-radius: 6px; background: #F0F0F0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #666; flex-shrink: 0; margin-right: 10px;
}
.rank-1 { background: #FF3B30; color: #fff; }
.rank-2 { background: #FF6B35; color: #fff; }
.rank-3 { background: #FFB800; color: #fff; }

.rank-img-wrap {
  width: 86px; height: 86px; border-radius: 6px; overflow: hidden;
  background: #F5F5F5; flex-shrink: 0; margin-right: 10px; position: relative;
}
.rank-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rank-img-place {
  width: 100%; height: 100%; display: flex; align-items: center;
  justify-content: center; color: #CCC; font-size: 11px;
}
.rank-info {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  justify-content: space-between; height: 86px;
}
.rank-name {
  font-size: 14px; font-weight: 500; color: #333; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.rank-bottom { display: flex; align-items: center; justify-content: space-between; }
.rank-price { font-size: 16px; font-weight: 700; color: var(--primary); }

.retry-btn { text-align: center; padding: 12px; margin-top: 16px; font-size: 14px; color: var(--primary); cursor: pointer; }

/* ---------- 底部 Tab ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; max-width: 480px; margin: 0 auto;
  background: #fff; border-top: 1px solid var(--border);
  display: flex; z-index: 50; padding-top: 4px;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, .04);
}
.tab {
  flex: 1; text-align: center; padding: 6px 0 12px; cursor: pointer;
  color: #999; font-size: 12px; transition: color .15s; position: relative;
}
.tab.plain-button { background: #fff; }
.tab-icon { font-size: 26px; display: block; line-height: 1.2; margin-bottom: 3px; transition: transform .15s; }
.tab.active { color: var(--primary); font-weight: 700; }
.tab.active .tab-icon { transform: translateY(-2px) scale(1.15); filter: drop-shadow(0 2px 3px rgba(216, 90, 69, .25)); }
.tab.active::after {
  content: ''; position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
  width: 20px; height: 3px; background: var(--primary); border-radius: 0 0 3px 3px;
}

/* ---------- 我的页 ---------- */
.mine-page { padding: 0 12px 80px; min-height: 100vh; }
.mine-logo { text-align: center; padding: 20px 16px 12px; }
.mine-logo img { width: 72px; height: 72px; border-radius: 50%; box-shadow: 0 4px 12px rgba(216, 90, 69, .2); }
.mine-logo-text { font-size: 16px; font-weight: 700; color: var(--primary); margin-top: 8px; }

.menu { background: #fff; margin: 10px 0; border-radius: 10px; overflow: hidden; }
.menu-item {
  display: flex; align-items: center; padding: 14px 15px;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.menu-item:last-child { border-bottom: none; }
.mi-icon { font-size: 18px; margin-right: 10px; }
.mi-text { flex: 1; font-size: 15px; }
.mi-arrow { font-size: 15px; color: var(--text-mute); }

.contact-card {
  background: #fff; margin: 12px 0; padding: 20px 16px 16px;
  border-radius: 10px; text-align: center;
}
.contact-desc { font-size: 13px; color: #999; margin-bottom: 14px; }
.contact-qr {
  display: inline-block; padding: 8px; border-radius: 8px;
  background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
}
.contact-qr img { width: 180px; height: 180px; display: block; }
.contact-tip { margin-top: 12px; font-size: 12px; color: #AAA; }
.contact-unavailable { color: #888; padding: 18px; background: #F7F7F7; border-radius: 8px; }
.contact-wechat { display: block; margin: 10px auto 0; padding: 9px 14px; border-radius: 18px; background: var(--primary-light); color: var(--primary); cursor: pointer; }

.saved-section { background: #fff; margin: 12px 0; padding: 14px; border-radius: 10px; }
.saved-section h2 { font-size: 14px; margin-bottom: 10px; }
.saved-empty { color: #AAA; font-size: 12px; padding: 8px 0; }
.saved-list { display: flex; flex-direction: column; gap: 8px; }
.saved-item { width: 100%; display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 9px; cursor: pointer; background: #fff; }
.saved-item img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; }
.saved-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.saved-item b { color: var(--primary); font-size: 13px; }

.feedback-card { background: #fff; margin: 12px 0; padding: 16px; border-radius: 10px; }
.feedback-card label { display: block; font-weight: 600; margin-bottom: 8px; }
.feedback-card textarea { width: 100%; min-height: 130px; border: 1px solid var(--border); border-radius: 8px; padding: 10px; resize: vertical; font: inherit; }
.feedback-submit { display: block; width: 100%; margin-top: 10px; padding: 10px; border-radius: 20px; background: var(--primary); color: #fff; text-align: center; cursor: pointer; }

/* ---------- FAQ ---------- */
.faq-page { padding: 0 12px 40px; }
.faq-nav {
  background: var(--primary); display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; padding: 10px 12px; position: sticky; top: 0; z-index: 10;
}
.faq-list { background: #fff; border-radius: 10px; overflow: hidden; margin-top: 10px; }
.faq-item { border-bottom: 1px solid #F0F0F0; }
.faq-item:last-child { border-bottom: none; }
.faq-q {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; cursor: pointer; font-size: 14px; font-weight: 500; color: #333;
}
.faq-q-text { flex: 1; }
.faq-arrow { font-size: 18px; color: #CCC; margin-left: 8px; transition: transform .2s; }
.faq-item.open .faq-arrow { transform: rotate(90deg); color: var(--primary); }
.faq-a { display: none; padding: 0 16px 16px; font-size: 13px; color: #666; line-height: 1.75; }
.faq-item.open .faq-a { display: block; }
.faq-a p { margin-bottom: 6px; }
.faq-a p:last-child { margin-bottom: 0; }
.faq-a b { color: var(--primary); }

/* ---------- 商品详情页 ---------- */
.detail-page { min-height: 100vh; padding-bottom: 70px; }
.detail-nav {
  background: var(--primary); display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; padding: 10px 12px; position: sticky; top: 0; z-index: 10;
}
.nav-back {
  justify-self: start; color: #fff; font-size: 14px; font-weight: 500;
  background: rgba(255, 255, 255, .22); padding: 6px 12px;
  border-radius: 16px; cursor: pointer; white-space: nowrap;
}
.nav-back:active { background: rgba(255, 255, 255, .35); }
.nav-title { color: #fff; font-size: 16px; font-weight: 600; text-align: center; justify-self: center; }

.detail-content { padding: 12px; }
.detail-img-wrap {
  position: relative; width: 100%; aspect-ratio: 1 / 1;
  background: #FFF4ED; border-radius: 8px; overflow: hidden;
  margin-bottom: 12px; display: flex; align-items: center; justify-content: center;
  cursor: zoom-in;
}
.detail-img-wrap .img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-placeholder-lg { color: var(--primary); opacity: .5; font-size: 14px; }
.detail-img-badge {
  position: absolute; top: 8px; left: 8px; background: var(--primary);
  color: #fff; font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 10px;
}

.detail-info-card { background: #fff; border-radius: 8px; padding: 14px; margin-bottom: 12px; }
.detail-title { font-size: 17px; font-weight: 600; line-height: 1.4; }
.detail-subtitle { margin-top: 6px; font-size: 13px; color: var(--text-mute); }
.detail-price-row { margin-top: 10px; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px; }
.detail-price { font-size: 26px; font-weight: 700; color: var(--primary); line-height: 1; }
.gift-chip { background: #FFF4ED; color: var(--primary); font-size: 11px; padding: 2px 6px; border-radius: 3px; }
.detail-tags { margin-top: 10px; display: flex; gap: 4px; flex-wrap: wrap; }

.section-title {
  display: flex; align-items: center; gap: 6px;
  margin: 12px 0 8px; font-size: 14px; font-weight: 500;
}
.section-bar { width: 4px; height: 14px; background: var(--primary); border-radius: 2px; }
.section-title .section-action {
  margin-left: auto; font-size: 12px; color: var(--primary);
  background: #FFF4ED; padding: 3px 8px; border-radius: 6px; cursor: pointer;
}

.addon-img-wrap { background: #fff; border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.addon-img { width: 100%; display: block; cursor: zoom-in; object-fit: contain; }

.guide-card { background: #fff; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.guide-line { font-size: 13px; line-height: 1.75; white-space: pre-wrap; word-break: break-all; }
.guide-line-empty { min-height: 7px; }
.guide-link { color: var(--primary); text-decoration: underline; word-break: break-all; cursor: pointer; }
.guide-link:active { opacity: .65; }

.copy-tip {
  margin: -4px 0 12px; padding: 8px 12px;
  background: var(--primary-light); border-radius: 8px;
  font-size: 12px; color: var(--primary); line-height: 1.5;
}

.tip-card { background: #FFF4ED; border-radius: 8px; padding: 10px 12px; margin-top: 12px; }
.tip-title { font-size: 12px; color: var(--primary); font-weight: 500; margin-bottom: 4px; }
.tip-text { font-size: 12px; color: #5C3A2E; line-height: 1.6; }

.detail-footer {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: #fff; border-top: 1px solid #F0F0F2;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: flex; gap: 8px; z-index: 10;
}
.footer-btn {
  flex: 1; text-align: center; font-size: 14px; font-weight: 500;
  padding: 11px 0; border-radius: 22px; cursor: pointer;
}
.footer-btn:active { opacity: .85; }
.footer-btn-primary { background: var(--primary); color: #fff; }
.footer-btn-sub { background: #FFF4ED; color: var(--primary); }
.detail-secondary-actions { display: flex; justify-content: center; gap: 18px; padding: 14px 12px 90px; }
.text-action { background: transparent; color: #777; font-size: 12px; cursor: pointer; }
.text-action.danger { color: #B66A5A; }

/* ---------- 好物详情页 ---------- */
.rank-detail-page { min-height: 100vh; padding-bottom: 82px; }
.rank-detail-nav {
  background: var(--primary); padding: 10px 12px;
  display: flex; align-items: center; gap: 8px;
  position: sticky; top: 0; z-index: 10;
}
.rank-detail-nav .nav-back {
  font-size: 14px; padding: 4px 10px; border-radius: 14px;
  background: rgba(255, 255, 255, .2); flex-shrink: 0; justify-self: auto;
}
.rank-detail-nav .nav-title.center { flex: 1; margin-right: 64px; justify-self: auto; }

.rank-detail-fail { display: flex; flex-direction: column; align-items: center; padding: 60px 20px; text-align: center; }
.fail-icon { font-size: 48px; margin-bottom: 16px; }
.fail-title { font-size: 18px; font-weight: 600; color: #333; margin-bottom: 8px; }
.fail-desc { font-size: 14px; color: #999; margin-bottom: 24px; line-height: 1.5; }
.fail-actions { display: flex; gap: 10px; }
.fail-btn { padding: 10px 24px; border-radius: 20px; font-size: 14px; font-weight: 500; cursor: pointer; background: #F5F5F5; color: #666; }
.fail-btn.primary { background: var(--primary); color: #fff; }
.fail-btn:active { opacity: .8; }

.rd-carousel-wrap { position: relative; background: #fff; }
.rd-carousel {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; scroll-behavior: smooth;
}
.rd-carousel::-webkit-scrollbar { display: none; }
.rd-carousel-item {
  flex: 0 0 100%; scroll-snap-align: start; aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center; background: #F5F5F5;
}
.rd-carousel-item img { width: 100%; height: 100%; object-fit: contain; cursor: pointer; }
.rd-carousel-dots { display: flex; justify-content: center; gap: 6px; padding: 10px 0; background: #fff; }
.rd-dot { width: 6px; height: 6px; border-radius: 3px; background: #DDD; cursor: pointer; transition: all .2s; }
.rd-dot.active { width: 16px; background: var(--primary); }

.rd-info-card { background: #fff; border-radius: 10px; margin: 10px 12px; padding: 14px; }
.rd-title { font-size: 16px; font-weight: 600; color: #333; line-height: 1.5; }
.rd-price-row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.rd-price-label { font-size: 13px; color: #999; }
.rd-price-val { font-size: 24px; font-weight: 700; color: var(--primary); }
.rd-shop-row, .rd-time-row { display: flex; gap: 8px; font-size: 13px; color: #666; margin-top: 6px; }
.rd-shop-label, .rd-time-label { color: #999; flex-shrink: 0; }

.rd-section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.rd-section-title span { font-size: 15px; font-weight: 600; color: #333; }
.rd-copy-btn {
  font-size: 12px; color: var(--primary); border: 1px solid var(--primary);
  border-radius: 12px; padding: 4px 12px; cursor: pointer;
}
.rd-copy-btn:active { opacity: .7; }
.rd-content-text { background: #FFF8F3; border-radius: 8px; padding: 12px; font-size: 13px; line-height: 1.6; }
.rd-content-line { word-break: break-all; }
.rd-content-empty { height: 8px; }

.rd-material-flow { display: flex; flex-direction: column; gap: 10px; }
.rd-material-img { border-radius: 6px; overflow: hidden; cursor: pointer; background: #F5F5F5; }
.rd-material-img img { width: 100%; display: block; }
.rd-material-fallback { padding: 40px 20px; text-align: center; color: #999; font-size: 13px; }
.rd-material-text { font-size: 14px; color: #333; line-height: 1.6; background: #FFF8F3; border-radius: 6px; padding: 10px 12px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(.8);
  background: rgba(0, 0, 0, .75); color: #fff;
  font-size: 13px; padding: 10px 20px; border-radius: 6px;
  z-index: 9999; opacity: 0; transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ---------- 图片大图预览 ---------- */
.img-preview-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .92);
  z-index: 9998; display: flex; align-items: center; justify-content: center;
  cursor: zoom-out; overflow: auto; -webkit-overflow-scrolling: touch;
}
.img-preview-img {
  max-width: 92vw; max-height: 92vh; object-fit: contain;
  transform-origin: center center; transition: transform .15s ease;
  cursor: zoom-in; user-select: none; -webkit-user-drag: none;
}

/* 分类加载状态 */
.cat-loading, .cat-error, .cat-empty { padding: 16px 20px; font-size: 13px; color: var(--text-mute); text-align: center; }
.cat-error { color: var(--primary); }
.group-invite-qr img { display:block; width:auto; max-width:min(240px,100%); max-height:440px; height:auto; margin:16px auto; }

/* 首页：紧凑精选与自助进群，保持真实商品和原有购买流程。 */
.home-page { --primary:#D45F48; --primary-light:#FBEDE6; --primary-lighter:#FBF2EC; --primary-border:#F0DCD1; --bg:#F7F5F1; --text:#282824; --text-sub:#696960; --text-mute:#797971; --border:#E9E5DC; --shadow-card:none; }
.home-topbar { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:15px 16px; border:0; }
.home-brand { display:flex; align-items:center; gap:10px; min-width:0; }
.home-brand-mark { width:36px; height:36px; display:grid; place-items:center; flex-shrink:0; color:#FFF; background:var(--primary); border-radius:12px; }
.home-topbar .topbar-title { font-size:16px; font-weight:500; color:var(--text); }
.home-brand p { font-size:11px; color:var(--text-mute); margin-top:2px; }
.home-topbar-actions { display:flex; align-items:center; gap:2px; flex-shrink:0; }
.home-search-btn, .home-topbar .refresh-btn { width:36px; height:36px; border-radius:50%; display:grid; place-items:center; background:var(--bg); }
.home-topbar .refresh-btn { color:var(--text-sub); }
.home-search-btn .search-ico::before { border-color:var(--text-sub); }
.home-search-btn .search-ico::after { background:var(--text-sub); }
.home-intro { padding:17px 16px 0; }
.home-daily { display:flex; align-items:center; justify-content:space-between; gap:8px; color:var(--text-mute); font-size:11px; }
.home-daily .topbar-update { font-size:11px; }
.home-intro h1 { font-size:18px; line-height:1.45; font-weight:500; margin:10px 0 5px; }
.home-intro > p { font-size:12px; color:var(--text-sub); margin-bottom:13px; }
.home-group-invite { display:grid; grid-template-columns:20px minmax(0,1fr) auto 8px; gap:8px; align-items:center; width:100%; border-radius:14px; background:var(--primary-light); padding:13px 10px; min-height:68px; cursor:pointer; }
.home-group-icon { display:flex; color:var(--primary); }
.home-group-copy { min-width:0; }
.home-group-copy strong { display:block; color:var(--text); font-size:12px; font-weight:500; }
.home-group-copy > span { display:block; color:var(--text-sub); font-size:11px; margin-top:3px; }
.home-group-link { color:var(--primary); font-size:11px; font-weight:500; white-space:nowrap; }
.home-group-arrow { color:var(--primary); font-size:20px; }
.home-category-nav { padding:0; background:transparent; margin:15px 12px 10px; }
.home-filter-row { display:flex; align-items:center; gap:6px; }
.home-filter { flex-shrink:0; background:#FFF; color:var(--text-sub); border-radius:20px; padding:7px 9px; min-height:35px; font-size:12px; white-space:nowrap; cursor:pointer; }
.home-filter.active { background:var(--primary); color:#FFF; }
.home-category-toggle { margin-left:auto; min-width:0; max-width:75px; overflow:hidden; text-overflow:ellipsis; color:var(--text-sub); font-size:12px; min-height:35px; padding:6px 3px; white-space:nowrap; cursor:pointer; }
.home-category-options { margin-top:9px; border-radius:12px; background:#FFF; padding:3px 0; }
.home-category-options .cat-tag { font-size:12px; font-weight:400; padding:0 10px; }
.home-category-options .cat-row { padding:7px 9px; }
.home-page .category-nav:has(.search-bar) { margin:12px; padding:0; border-radius:12px; }
.home-page .sort-bar { background:transparent; padding:0 3px 2px; margin:0 12px 5px; font-size:11px; gap:6px; }
.home-page .sort-opt { background:#FFF; padding:5px 10px; font-size:11px; font-weight:400; }
.home-page .sort-active { background:#EEEAE3; color:var(--text); font-weight:500; }
.home-page .product-card { display:grid; grid-template-columns:96px minmax(0,1fr); grid-template-rows:auto auto; gap:8px 12px; min-height:165px; margin:11px 12px; padding:12px; border-radius:17px; box-shadow:none; }
.home-page .product-card:active { transform:none; background:#FFF; }
.home-page .img-wrap { width:96px; height:120px; grid-row:1 / 3; border-radius:11px; background:#F4F3EE; }
.home-page .img-wrap .img { object-fit:contain; }
.home-page .info { margin-left:0; padding-right:22px; gap:0; width:100%; align-self:start; text-align:left; }
.home-page .title { font-size:14px; font-weight:500; line-height:1.45; }
.home-page .subtitle { font-size:11px; margin-top:4px; color:var(--text-mute); }
.home-page .gift { padding:3px 6px; border:0; font-size:11px; margin-top:7px; border-radius:5px; background:var(--primary-light); }
.home-page .price-row { margin-top:8px; flex-wrap:wrap; row-gap:4px; }
.home-page .price { font-size:24px; font-weight:500; }
.home-page .price-label { font-size:11px; }
.home-page .tags { margin-top:6px; }
.home-page .tag { font-size:11px; }
.home-page .fav-float { left:auto; right:5px; top:6px; width:32px; height:32px; font-size:23px; line-height:32px; box-shadow:none; background:transparent; }
.product-card-bottom { grid-column:2; display:flex; align-items:center; justify-content:space-between; gap:5px; }
.home-page .product-update { color:var(--text-mute); font-size:11px; min-width:0; }
.home-page .action-group { position:static; gap:5px; flex-shrink:0; }
.home-page .action { font-size:11px; font-weight:500; padding:7px 11px; border-radius:18px; min-height:30px; }
.home-page .copy-btn { width:27px; height:29px; border:0; background:var(--bg); font-size:15px; }
.home-page .copy-btn::after { inset:0; }
.home-list-tip { text-align:center; margin:18px 16px 0; color:var(--text-mute); font-size:11px; }
.home-page .tabbar { box-shadow:none; border-top-color:var(--border); padding-top:7px; }
.home-page .tab.active { font-weight:500; }
.home-page .tab.active .tab-icon { transform:none; filter:none; }
.home-page .tab.active::after { display:none; }

/* 有效群码弹层：不拦截浏览商品，过期立即撤下图片。 */
.group-qr-overlay { position:fixed; inset:0; z-index:9996; background:rgba(40,36,30,.46); display:flex; align-items:center; justify-content:center; padding:20px; }
.group-qr-dialog { --primary:#D45F48; position:relative; width:100%; max-width:350px; max-height:calc(100vh - 40px); max-height:calc(100dvh - 40px); overflow:auto; overscroll-behavior:contain; border-radius:22px; background:#FFF; color:#282824; padding:24px 20px 17px; text-align:center; box-shadow:0 12px 40px rgba(30,25,20,.15); }
.group-qr-close { position:absolute; top:6px; right:7px; width:38px; height:38px; color:#797971; font-size:26px; cursor:pointer; }
.group-qr-symbol { display:grid; place-items:center; width:44px; height:44px; background:#FBEDE6; color:var(--primary); border-radius:14px; margin:0 auto 12px; }
.group-qr-dialog h2 { font-size:18px; font-weight:500; padding:0 13px; }
.group-qr-description { font-size:12px; color:#696960; margin-top:8px; }
.group-qr-image { display:block; width:auto; height:auto; max-width:100%; max-height:42vh; max-height:42dvh; margin:16px auto 12px; object-fit:contain; }
.group-qr-expiry { font-size:11px; color:#797971; margin:6px 0 12px; }
.group-qr-primary { display:flex; align-items:center; justify-content:center; width:100%; min-height:44px; background:var(--primary); color:#FFF; padding:11px 10px; border-radius:12px; font-size:14px; font-weight:500; text-decoration:none; cursor:pointer; }
.group-qr-primary:disabled { opacity:.65; cursor:wait; }
.group-qr-help { font-size:11px; color:#797971; margin:10px 0 2px; }
.group-qr-dismiss { display:block; width:100%; min-height:40px; padding:9px; font-size:12px; color:#696960; cursor:pointer; }
.group-qr-unavailable { padding:24px 0; color:#797971; }
.group-qr-unavailable p { font-size:15px; color:#282824; margin:9px 0 5px; }
.group-qr-unavailable span { font-size:12px; }
@media(max-width:359px) {
  .home-topbar { padding:13px 12px; }
  .home-topbar .topbar-title { font-size:15px; }
  .home-brand { gap:8px; }
  .home-intro { padding-left:12px; padding-right:12px; }
  .home-group-invite { grid-template-columns:18px minmax(0,1fr) 8px; gap:5px 7px; }
  .home-group-icon { grid-column:1; grid-row:1 / 3; }
  .home-group-copy { grid-column:2; grid-row:1; }
  .home-group-link { grid-column:2; grid-row:2; }
  .home-group-arrow { grid-column:3; grid-row:1 / 3; }
  .home-filter-row { gap:5px; }
  .home-filter { padding:7px 8px; }
  .home-page .product-card { grid-template-columns:80px minmax(0,1fr); gap:8px 10px; padding:11px; }
  .home-page .img-wrap { width:80px; height:112px; }
  .home-page .info { padding-right:15px; }
  .home-page .title { font-size:13px; }
  .home-page .product-update { font-size:11px; }
  .home-page .action { padding:7px 9px; }
}
.share-card-trigger { min-width:38px; font-size:11px; }
.product-share-overlay { position:fixed; inset:0; z-index:10001; background:rgba(40,36,30,.5); display:flex; align-items:center; justify-content:center; padding:14px; }
.product-share-dialog { background:#fffdf9; color:#302d29; width:430px; max-width:100%; max-height:calc(100dvh - 28px); overflow:auto; border-radius:18px; padding:18px; box-sizing:border-box; box-shadow:0 18px 70px #302d2933; }
.product-share-dialog header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.product-share-dialog h2 { font-size:18px; font-weight:600; margin:0 0 5px; }
.product-share-dialog header p,.product-share-note,.product-share-status { font-size:12px; color:#7c746b; margin:0 0 12px; line-height:1.6; }
.product-share-close { width:36px; height:36px; font-size:26px; flex-shrink:0; }
.product-share-preview { background:#f4eee6; border-radius:10px; min-height:150px; text-align:center; overflow:hidden; }
.product-share-preview img { display:block; width:100%; height:auto; }
.product-share-preview>p { padding:50px 10px; font-size:14px; }
.product-share-note { margin:12px 0; }
.product-share-actions { display:flex; gap:10px; }
.product-share-actions button,.share-retry { min-height:44px; border-radius:10px; background:#f4eee6; padding:10px 16px; font-size:14px; }
.product-share-actions button { flex:1; }
.product-share-actions .share-save { background:#bd5d45; color:#fff; }
.product-share-actions button:disabled { opacity:.45; }
.product-share-status { margin:10px 0 0; }
