/* ========================================================================
   柚子生活圈 - 设计系统 & 组件样式
   完全对应 uni-app 项目中的 uni.scss + 各组件 .vue 样式
   ======================================================================== */

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

:root {
  --color-primary: #D85A45;
  --color-primary-light: #FFF4ED;
  --color-primary-lighter: #FFF8F3;
  --color-primary-border: #FFE0CC;
  --color-text: #222;
  --color-text-sub: #666;
  --color-text-mute: #999;
  --color-bg: #F7F7F8;
  --color-card: #FFFFFF;
  --color-border: #EEEEEE;
  --color-success: #5BA82A;
  --color-success-bg: #F0F9E8;
  --color-warning: #D4A02A;
  --color-warning-bg: #FFF7E0;
}

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

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

/* ========== 顶部应用栏 ========== */
/* sticky-header：topbar + 分类导航一起固定在顶部 */
.sticky-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
}

.topbar {
  background: #fff;
  padding: 0 16px;
  border-bottom: 1px solid var(--color-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(--color-text-mute);
  flex-shrink: 0;
}

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

.brand-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-primary);
  white-space: nowrap;
}

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

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

/* 好物页提示条 */
.rank-tip {
  text-align: center;
  font-size: 12px;
  color: var(--color-primary);
  background: var(--color-primary-light);
  padding: 6px 16px;
  line-height: 1.4;
}

/* 好物页搜索栏 */
.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(--color-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;
  font-size: 13px;
}

.rank-search-btn {
  height: 38px;
  padding: 0 18px;
  background: var(--color-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: 0.8; }

/* ========== 双层分类导航 ========== */
.category-nav {
  position: relative;
  background: #fff;
  padding: 0 50px 0 0;
}

.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(--color-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(--color-text-sub);
  background: transparent;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  transition: all .15s;
}

.cat-tag.active {
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
}

.cat-tag.small {
  height: 24px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 12px;
}

.cat-tag .ico {
  margin-right: 3px;
  font-size: 13px;
}

.search-btn {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 14px;
  border: 1.5px solid var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  z-index: 10;
  cursor: pointer;
}
.search-btn:active { background: var(--color-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(--color-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(--color-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: translateX(0); }
}

.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(--color-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(--color-text-mute);
  transform: rotate(45deg);
  border-radius: 1px;
}

.search-input input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--color-text);
  height: 32px;
}
.search-input input::placeholder { color: var(--color-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;
}

.search-go {
  margin-left: 8px;
  flex-shrink: 0;
  font-size: 13px;
  color: #fff;
  font-weight: 500;
  background: var(--color-primary);
  padding: 7px 16px;
  border-radius: 16px;
  cursor: pointer;
  line-height: 1;
}
.search-go:active { opacity: 0.85; }
.close-btn:active { background: #E5E5E5; }
.close-btn::before, .close-btn::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 1.5px;
  background: var(--color-text-sub);
  border-radius: 1px;
}
.close-btn::before { transform: rotate(45deg); }
.close-btn::after { transform: rotate(-45deg); }

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

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

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

.img-wrap {
  position: relative;
  width: 100px;
  height: 100px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background: var(--color-primary-light);
}

/* 列表卡片商品图：填满正方形容器，按 cover 裁剪 */
.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(--color-primary);
  opacity: 0.5;
  font-size: 12px;
}

.info {
  flex: 1;
  margin-left: 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-right: 50px;
  position: relative;
}

.title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: var(--color-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(--color-text-mute); margin-right: 4px; }
.price { font-size: 20px; font-weight: 700; color: var(--color-primary); line-height: 1; }

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

.tags {
  margin-top: auto;
  display: flex;
  gap: 4px;
}
.tag {
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 3px;
  background: #F0F0F0;
  color: var(--color-text-mute);
}
.tag-success { background: var(--color-success-bg); color: var(--color-success); }
.tag-warning { background: var(--color-warning-bg); color: var(--color-warning); }

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

/* 操作按钮组：复制 + 去购买 */
.action-group {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 3;
}
.copy-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--color-text-mute);
  cursor: pointer;
  line-height: 1;
}
.copy-btn:active { opacity: 0.7; }

/* 加载动画 */
.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(--color-primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ========== 排行页 ========== */
.rank-page {
  padding: 0 12px 80px;
  min-height: 100vh;
  background: #F7F7F8;
}

.rank-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rank-bottom-hint {
  text-align: center;
  font-size: 13px;
  color: #999;
  padding: 20px 16px 10px;
  line-height: 1.6;
  cursor: pointer;
}
.rank-bottom-hint:active { color: var(--color-primary); }

.rank-search-notice {
  text-align: center;
  font-size: 12px;
  color: #AAA;
  padding: 8px 12px;
  background: #F5F5F5;
  margin: 0 12px 8px;
  border-radius: 6px;
}
.rank-search-clear {
  color: var(--color-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(--color-primary);
}

.retry-btn {
  text-align: center;
  padding: 12px;
  margin-top: 16px;
  font-size: 14px;
  color: var(--color-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(--color-border);
  display: flex;
  z-index: 50;
}
.tab {
  flex: 1;
  text-align: center;
  padding: 8px 0 6px;
  cursor: pointer;
  color: var(--color-text-mute);
  font-size: 11px;
}
.tab-icon { font-size: 22px; display: block; line-height: 1.1; margin-bottom: 2px; }
.tab.active { color: var(--color-primary); font-weight: 600; }

/* ========== 其他页面 ========== */
.page-title {
  background: #fff;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--color-border);
}
.page-title h1 {
  font-size: 20px;
  font-weight: 700;
}
.page-title p {
  font-size: 12px;
  color: var(--color-text-mute);
  margin-top: 4px;
}

.empty {
  text-align: center;
  color: var(--color-text-mute);
  font-size: 13px;
  padding: 50px 0;
}

/* 加载中 / 加载更多 / 已加载完 */
.loading,
.finished {
  text-align: center;
  color: var(--color-text-mute);
  font-size: 13px;
  padding: 24px 0;
}

.load-more {
  text-align: center;
  color: var(--color-primary);
  font-size: 13px;
  padding: 16px 0;
  cursor: pointer;
  font-weight: 500;
}
.load-more:active {
  opacity: 0.6;
}

/* 外卖福利页 */
.takeout-page { padding: 0 12px 80px; min-height: 100vh; background: #F7F7F8; }

.takeout-tip {
  text-align: center;
  font-size: 12px;
  color: var(--color-primary);
  background: var(--color-primary-light);
  padding: 6px 16px;
  line-height: 1.4;
  margin: 0 -12px 10px;
}

.takeout-card { background: #fff; border-radius: 10px; padding: 14px; margin: 10px 0; }
.takeout-card-feature {
  background: linear-gradient(135deg, #FFF8F3 0%, #FFEFE5 100%);
  border: 1px solid #FFE0CC;
}
.takeout-card-title { font-size: 15px; font-weight: 600; color: #333; margin-bottom: 10px; }

.takeout-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px; margin-top: 6px;
  background: #fff; border: 1px solid #FFE0CC; border-radius: 8px;
  text-decoration: none; color: #333;
  font-size: 13px; font-weight: 500;
  transition: all .15s;
}
.takeout-card-feature .takeout-link { background: #fff; }
.takeout-link:active { background: #FFF8F3; transform: scale(0.98); }
.takeout-link-label { flex: 1; }
.takeout-link-arrow {
  color: var(--color-primary);
  font-size: 16px;
  font-weight: bold;
}

.takeout-bottom-hint {
  text-align: center;
  font-size: 13px;
  color: #999;
  padding: 20px 16px 10px;
  line-height: 1.6;
  cursor: pointer;
}
.takeout-bottom-hint:active { color: var(--color-primary); }
  background: var(--color-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 12px;
}

/* 我的 */
.profile {
  display: flex;
  align-items: center;
  background: #fff;
  margin: 10px;
  padding: 16px;
  border-radius: 10px;
}
.avatar {
  width: 50px;
  height: 50px;
  background: var(--color-primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}
.pinfo { margin-left: 12px; flex: 1; }
.pname { font-size: 16px; font-weight: 600; color: var(--color-text); }
.phint { font-size: 12px; color: var(--color-text-mute); margin-top: 3px; }
.menu {
  background: #fff;
  margin: 10px;
  border-radius: 10px;
  overflow: hidden;
}
.menu-item {
  display: flex;
  align-items: center;
  padding: 14px 15px;
  border-bottom: 1px solid var(--color-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; color: var(--color-text); }
.mi-arrow { font-size: 15px; color: var(--color-text-mute); }
.mi-version { font-size: 12px; color: var(--color-text-mute); }

/* 我的页面 */
.mine-page { padding: 0 12px 80px; min-height: 100vh; background: #F7F7F8; }

.mine-section-title {
  font-size: 13px; font-weight: 600; color: #999;
  padding: 16px 4px 8px;
}

/* 快捷入口 */
.mine-quick {
  display: flex; gap: 8px;
}
.mine-quick-item {
  flex: 1; background: #fff; border-radius: 10px;
  padding: 16px 8px 12px; text-align: center;
  cursor: pointer;
  transition: transform .12s;
}
.mine-quick-item:active { transform: scale(0.96); }
.mine-quick-icon { font-size: 28px; margin-bottom: 6px; }
.mine-quick-label { font-size: 14px; font-weight: 600; color: #333; }
.mine-quick-sub { font-size: 11px; color: #999; margin-top: 2px; }

/* 联系我们卡片 */
.contact-card {
  background: #fff;
  margin: 12px;
  padding: 20px 16px 16px;
  border-radius: 10px;
  text-align: center;
}
.contact-title {
  font-size: 15px; font-weight: 600; color: #333; margin-bottom: 6px;
}
.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,0.06);
}
.contact-qr img {
  width: 180px; height: 180px; display: block;
}
.contact-tip {
  margin-top: 12px; font-size: 12px; color: #AAA;
}

.footer-tip {
  text-align: center;
  font-size: 11px;
  color: var(--color-text-mute);
  padding: 20px 15px;
}

/* ========== 新增：API 状态徽章（v2 接口对接版） ========== */
.api-badge {
  margin-left: 8px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: 600;
  vertical-align: middle;
}
.api-badge.mock {
  background: #F0F0F0;
  color: var(--color-text-mute);
}
.api-badge.real {
  background: var(--color-success-bg);
  color: var(--color-success);
}

/* API 错误提示条（后端连接失败时显示） */
.api-error-bar {
  padding: 8px 16px;
  background: #FFF4E5;
  color: #B85C00;
  font-size: 12px;
  line-height: 1.5;
  border-bottom: 1px solid #FFD9A8;
  word-break: break-all;
}

/* ========== 新增：分类加载状态 ========== */
.cat-loading,
.cat-error,
.cat-empty {
  padding: 16px 20px;
  font-size: 13px;
  color: var(--color-text-mute);
  text-align: center;
}
.cat-error {
  color: var(--color-primary);
}

/* ========== 新增：分类图标（图片链接） ========== */
.cat-icon {
  width: 16px;
  height: 16px;
  margin-right: 4px;
  vertical-align: middle;
}
.cat-icon-sm {
  width: 14px;
  height: 14px;
  margin-right: 3px;
  vertical-align: middle;
}

/* ========== 攻略商品卡片样式 ========== */
.badge-strategy {
  left: auto;
  right: 10px;
  background: var(--color-warning, #F0AC3E);
}
.tag-strategy {
  background: #FFF4ED;
  color: var(--color-primary);
  border: 1px solid #FFD9C6;
}
.action-strategy {
  background: var(--color-warning, #F0AC3E) !important;
}

/* ========== 商品详情页 ========== */
.detail-page {
  min-height: 100vh;
  background: #F7F7F8;
  padding-bottom: 70px;
}
.detail-nav {
  background: var(--color-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, 0.22);
  padding: 6px 12px;
  border-radius: 16px;
  cursor: pointer;
  white-space: nowrap;
}
.nav-back:active { background: rgba(255, 255, 255, 0.35); }
.nav-title {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  justify-self: center;
}
.detail-content {
  padding: 12px;
}
/* 详情页主图：1:1 正方形 */
.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;
}

/* 详情页大图：填满容器，按 cover 裁剪 */
.detail-img-wrap .img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.img-placeholder-lg {
  color: var(--color-primary);
  opacity: 0.5;
  font-size: 14px;
}
.detail-img-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--color-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;
  color: var(--color-text);
  line-height: 1.4;
}
.detail-subtitle {
  margin-top: 6px;
  font-size: 13px;
  color: var(--color-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(--color-primary);
  line-height: 1;
}
.gift-chip {
  background: #FFF4ED;
  color: var(--color-primary);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
}
.detail-tags {
  margin-top: 10px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* 策略卡片 */
.strategy-card {
  background: linear-gradient(135deg, #FFF4ED 0%, #FFE8D6 100%);
  border: 1px solid #FFD9C6;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.strategy-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.strategy-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}
.strategy-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-primary);
}
.strategy-text {
  font-size: 13px;
  color: #5C3A2E;
  line-height: 1.6;
}

/* 区块标题 */
.section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 12px 0 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
}
.section-bar {
  width: 4px;
  height: 14px;
  background: var(--color-primary);
  border-radius: 2px;
}

/* 步骤时间线 */
.steps {
  position: relative;
}
.steps-line {
  position: absolute;
  left: 15px;
  top: 16px;
  bottom: 16px;
  width: 2px;
  background: #FFE8D6;
}
.step {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  position: relative;
}
.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  z-index: 1;
}
.step-card {
  flex: 1;
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid;
}
.step-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.step-chip {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 500;
}
.step-meta {
  font-size: 11px;
  color: var(--color-text-mute);
}
.step-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 4px;
}
.step-desc {
  font-size: 12px;
  color: var(--color-text-mute);
  margin-bottom: 6px;
  line-height: 1.5;
}
.step-price {
  font-size: 13px;
  color: var(--color-primary);
  font-weight: 600;
  margin-bottom: 6px;
}
.step-url-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.step-url {
  flex: 1;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 11px;
  color: #666;
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.step-btn {
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
}
.step-btn-copy {
  color: #fff;
}
.step-btn-open {
  background: #fff;
  border: 1px solid;
}

/* 提示卡片 */
.tip-card {
  background: #FFF4ED;
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 12px;
}
.tip-title {
  font-size: 12px;
  color: var(--color-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;
  padding-bottom: 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-outline {
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  background: #fff;
}
.footer-btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.footer-btn-full {
  flex: 1;
}

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

/* ========== 详情页新增样式（简化方案） ========== */

/* 章节标题右侧操作按钮 */
.section-title .section-action {
  margin-left: auto;
  font-size: 12px;
  font-weight: 400;
  color: var(--color-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;
  color: var(--color-text);
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-all;
}
.guide-line-empty {
  min-height: 7px;
}

/* 购买说明内的可点击链接（URL 自动识别高亮） */
.guide-link {
  color: var(--color-primary);
  text-decoration: underline;
  word-break: break-all;
  cursor: pointer;
}
.guide-link:active {
  opacity: 0.65;
}

/* ========== 滚动加载更多提示 ========== */
.scroll-more {
  text-align: center;
  color: var(--color-text-mute);
  font-size: 12px;
  padding: 12px 0;
}

/* ========== 复制到微信提示 ========== */
.copy-tip {
  margin: -4px 0 12px;
  padding: 8px 12px;
  background: var(--color-primary-light);
  border-radius: 8px;
  font-size: 12px;
  color: var(--color-primary);
  line-height: 1.5;
}

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

/* ========== 好物商品详情 ========== */
.rank-detail-page {
  min-height: 100vh;
  background: #F7F7F8;
  padding-bottom: 20px;
}
.rank-detail-nav {
  background: var(--color-primary);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.rank-detail-nav .nav-back {
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 10px;
  background: rgba(255,255,255,.2);
  border-radius: 14px;
  flex-shrink: 0;
}
.rank-detail-nav .nav-title { color: #fff; font-size: 16px; font-weight: 500; }
.rank-detail-nav .nav-title.center { flex: 1; text-align: center; margin-right: 64px; }

/* 详情失败页 */
.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(--color-primary); color: #fff; }
.fail-btn:active { opacity: 0.8; }
.rank-detail-content { padding: 0; }

/* 轮播 */
.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(--color-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(--color-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(--color-primary);
  border: 1px solid var(--color-primary); border-radius: 12px;
  padding: 4px 12px; cursor: pointer;
}
.rd-copy-btn:active { opacity: 0.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;
}
