@import url('https://fonts.googleapis.com/css2?family=ZCOOL+KuaiLe&display=swap');

/**
 * 「比比」首页样式 v2.0 — 小红书风格
 * 移动端优先，颜色 / 间距 / 圆角均使用 CSS 变量
 */

:root {
  /* 颜色系统 */
  --primary: #ff2442;
  --primary-light: #ffe8eb;
  --bg: #f8f8f8;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #666666;
  --text-light: #999999;
  --border: #f0f0f0;
  --search-bg: #f5f5f5;

  /* 间距（8px 网格） */
  --page-padding: 16px;
  --section-gap: 12px;
  --element-gap: 8px;

  /* 圆角 */
  --radius-card: 16px;
  --radius-image: 12px;
  --radius-search: 24px;
  --radius-btn: 24px;
  --radius-tag: 20px;

  /* 字体 */
  --font-h1: 22px;
  --font-h2: 18px;
  --font-h3: 14px;
  --font-body: 14px;
  --font-caption: 12px;
  --font-small: 11px;

  /* 布局 */
  --top-bar-height: 56px;
  --tab-bar-height: 64px;
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.04);
  --transition-fast: 0.2s ease;
  --transition-page: 0.3s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    "Segoe UI", sans-serif;
  font-size: var(--font-body);
  font-weight: 400;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
}

button {
  cursor: pointer;
}

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

/* 页面淡入 */
.page {
  min-height: 100vh;
  max-width: 100%;
  margin: 0 auto;
  padding-bottom: calc(var(--tab-bar-height) + env(safe-area-inset-bottom, 0px) + 8px);
  background: var(--bg);
  animation: pageFadeIn var(--transition-page) ease;
}

@keyframes pageFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ========== 区块一：顶部导航栏 ========== */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--top-bar-height);
  padding: 0 var(--page-padding);
  background: var(--card);
}

.top-bar__left {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  cursor: pointer;
}

.top-bar__brand {
  font-family: 'ZCOOL KuaiLe', cursive;
  font-size: var(--font-h1);
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
  flex-shrink: 0;
}

.top-bar__subtitle {
  font-size: var(--font-caption);
  font-weight: 400;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-bar__right {
  display: flex;
  align-items: center;
  gap: var(--element-gap);
  flex-shrink: 0;
}

.top-bar__notify {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  border-radius: 50%;
  transition: background var(--transition-fast);
}

.top-bar__notify svg {
  display: block;
}

.top-bar__notify:active {
  background: var(--primary-light);
}

/* ========== 区块二：搜索栏 ========== */
.search-section {
  position: relative;
  z-index: 20;
  padding: var(--section-gap) var(--page-padding);
  background: var(--card);
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  padding: 6px 6px 6px 10px;
  background: var(--search-bg);
  border-radius: var(--radius-search);
}

.search-bar__icon-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-light);
}

.search-bar__icon-btn:active {
  background: var(--border);
}

.search-bar__icon-btn svg {
  display: block;
}

.search-bar__input {
  flex: 1;
  min-width: 0;
  height: 36px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
}

.search-bar__input::placeholder {
  color: var(--text-light);
}

.search-bar__submit {
  flex-shrink: 0;
  height: 36px;
  padding: 0 16px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  background: var(--primary);
  border-radius: var(--radius-btn);
}

.search-bar__submit:active {
  opacity: 0.92;
}

.search-bar__submit--static {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.search-bar__placeholder {
  flex: 1;
  min-width: 0;
  height: 36px;
  display: flex;
  align-items: center;
  color: var(--text-light);
  font-size: 15px;
  pointer-events: none;
}

#homeSearchEntry {
  cursor: pointer;
}

#homeSearchEntry .search-bar__icon-btn {
  pointer-events: none;
}

/* ========== 搜索页顶部栏 ========== */
.search-page-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px var(--page-padding);
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.search-page-header__back {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.search-page-header__back:active {
  background: var(--search-bg);
}

.search-page-header__back svg {
  display: block;
}

.search-bar--page {
  flex: 1;
  min-width: 0;
}

.search-page-header__spacer {
  width: 0;
  flex-shrink: 0;
}

.page--search {
  background: var(--bg);
  padding-bottom: 24px;
}

.search-page-main {
  padding: var(--section-gap) 0 32px;
}

/* ========== 搜索页通用区块 ========== */
.search-block {
  margin: 0 var(--page-padding) var(--section-gap);
  padding: var(--section-gap) var(--page-padding);
  background: var(--card);
  border-radius: var(--radius-card);
}

.search-block[hidden] {
  display: none;
}

.search-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--section-gap);
  min-height: 24px;
}

.search-block__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.search-block__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 32px;
  min-height: 32px;
  padding: 4px;
  color: var(--text-light);
  border-radius: var(--radius-tag);
}

.search-block__action--text {
  font-size: var(--font-caption);
  padding: 4px 8px;
}

.search-block__action:active {
  background: var(--search-bg);
}

.search-block__action svg {
  display: block;
  flex-shrink: 0;
}

/* 标签（历史 / 推荐） */
.search-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--element-gap);
}

.search-tags--recommend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--element-gap);
}

.search-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  padding: 8px 12px;
  font-size: var(--font-caption);
  color: var(--text-secondary);
  background: var(--search-bg);
  border-radius: var(--radius-tag);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.search-tag:active {
  background: var(--primary-light);
  color: var(--primary);
}

.search-tags--recommend .search-tag {
  width: 100%;
}

/* ========== 好物行情榜单 ========== */
.hot-rank {
  list-style: none;
  margin: 0;
  padding: 0;
}

.hot-rank__item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.hot-rank__item:last-child {
  border-bottom: none;
}

.hot-rank__item:active {
  background: var(--search-bg);
}

.hot-rank__rank {
  flex-shrink: 0;
  width: 28px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.hot-rank__rank--medal {
  font-size: 16px;
  font-weight: 400;
}

.hot-rank__name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hot-rank__price {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.hot-rank__platform {
  flex-shrink: 0;
  padding: 2px 6px;
  font-size: var(--font-small);
  color: var(--text-light);
  background: var(--search-bg);
  border-radius: 4px;
}

/* 兼容旧类名（若其他页面引用） */
.search-history-panel[hidden] {
  display: none;
}

@media (min-width: 768px) {
  .search-tags--recommend {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .page--search {
    max-width: 720px;
    margin: 0 auto;
    box-shadow: 0 0 0 1px var(--border);
  }
}

@media (min-width: 1024px) {
  .page--search {
    max-width: 960px;
  }
}

/* ========== 区块三：分类导航 ========== */
.category-nav {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--element-gap) var(--page-padding) var(--section-gap);
  background: var(--card);
  margin-bottom: var(--section-gap);
  scrollbar-width: none;
}

.category-nav::-webkit-scrollbar {
  display: none;
}

.category-nav__item {
  position: relative;
  flex-shrink: 0;
  padding: 8px 12px 12px;
  font-size: var(--font-body);
  font-weight: 400;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: color var(--transition-fast);
}

.category-nav__item.is-active {
  color: var(--primary);
  font-weight: 600;
}

/* 选中态：底部 3px 红色圆点 */
.category-nav__item.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--primary);
  transform: translateX(-50%);
}

/* ========== 区块四：商品瀑布流 ========== */
.main {
  padding: 0 var(--page-padding);
}

.product-waterfall {
  column-count: 2;
  column-gap: var(--element-gap);
}

.product-card {
  break-inside: avoid;
  margin-bottom: var(--element-gap);
  padding: var(--element-gap);
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform var(--transition-fast);
  display: inline-block;
  width: 100%;
}

.product-card:active {
  transform: scale(0.98);
}

.product-card__image {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-image);
  background: linear-gradient(160deg, #ececec, #e0e0e0);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: var(--font-small);
  overflow: hidden;
  margin-bottom: var(--element-gap);
}

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

/* 错落高度，增强瀑布流感 */
.product-card[data-ratio="tall"] .product-card__image {
  aspect-ratio: 3 / 4;
}

.product-card[data-ratio="wide"] .product-card__image {
  aspect-ratio: 4 / 5;
}

.product-card__title {
  font-size: var(--font-h3);
  font-weight: 500;
  color: var(--text);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  margin-bottom: 6px;
  line-height: 1.4;
}

.product-card__price {
  font-size: var(--font-h2);
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
  margin-bottom: var(--element-gap);
}

.product-card__user {
  display: flex;
  align-items: center;
  gap: 6px;
}

.product-card__avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e5e5e5;
  flex-shrink: 0;
}

.product-card__nickname {
  font-size: var(--font-small);
  font-weight: 400;
  color: var(--text-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-waterfall__empty {
  column-span: all;
  padding: 48px 16px;
  text-align: center;
  color: var(--text-light);
  font-size: var(--font-body);
}

/* ========== 区块五：底部导航（毛玻璃） ========== */
.tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: calc(var(--tab-bar-height) + env(safe-area-inset-bottom, 0px));
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(240, 240, 240, 0.8);
}

.tab-bar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  color: var(--text-light);
  transition: color var(--transition-fast);
}

.tab-bar__icon {
  position: relative;
  width: 24px;
  height: 24px;
  line-height: 1;
}

.tab-bar__svg {
  display: block;
}

.tab-bar__svg--on {
  display: none;
}

.tab-bar__item.is-active .tab-bar__svg--off {
  display: none;
}

.tab-bar__item.is-active .tab-bar__svg--on {
  display: block;
}

.tab-bar__label {
  font-size: var(--font-small);
  line-height: 1.2;
}

.tab-bar__item.is-active {
  color: var(--primary);
}

/* ========== 网站底部备案（固定底部居中） ========== */
.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: transparent;
  pointer-events: none;
}

/* 有底部 Tab：固定在 Tab 栏上方正中 */
body[data-page="home"] .site-footer,
body[data-page="profile"] .site-footer {
  bottom: calc(var(--tab-bar-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: 0;
  height: 32px;
}

.site-footer__beian {
  display: inline-block;
  font-size: 12px;
  color: #999999 !important;
  text-decoration: none;
  line-height: 1.4;
  pointer-events: auto;
}

.site-footer__beian:active,
.site-footer__beian:hover {
  color: #999999 !important;
  text-decoration: underline;
}

/* ========== 「我的」页面 ========== */
.page--profile {
  background: var(--bg);
}

.profile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--top-bar-height);
  padding: 0 var(--page-padding);
  background: var(--card);
}

.profile-top__left {
  flex: 1;
}

.profile-top__right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.profile-top__btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background var(--transition-fast);
}

.profile-top__btn:active {
  background: var(--search-bg);
}

.profile-top__btn svg {
  display: block;
}

.profile-main {
  padding: var(--section-gap) var(--page-padding);
}

.profile-user {
  display: flex;
  align-items: center;
  gap: var(--section-gap);
  padding: 20px var(--page-padding);
  margin-bottom: var(--section-gap);
  background: var(--card);
  border-radius: 12px;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.profile-user:active {
  transform: scale(0.99);
}

.profile-user__avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: #e5e5e5;
  flex-shrink: 0;
}

.profile-user__info {
  min-width: 0;
  flex: 1;
}

.profile-user__name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 4px;
}

.profile-user__desc {
  font-size: 12px;
  color: var(--text-light);
  line-height: 1.3;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 16px;
  background: var(--card);
  border-radius: 12px;
}

.profile-grid__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 88px;
  padding: 16px 8px;
  border-radius: 12px;
  transition: background var(--transition-fast);
}

.profile-grid__item:active {
  background: var(--search-bg);
}

.profile-grid__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.profile-grid__icon svg {
  display: block;
}

.profile-grid__label {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.2;
}

/* ========== 搜索结果页 ========== */
:root {
  --recommend: #34c759;
  --value-pick: #ff9500;
  --ai-summary-bg: #fff0f0;
}

.page--result {
  background: var(--bg);
  padding-bottom: 32px;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px var(--page-padding);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.result-header__back,
.result-header__camera {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.result-header__back:active,
.result-header__camera:active {
  background: var(--search-bg);
}

.result-header__back svg,
.result-header__camera svg {
  display: block;
}

.result-header__search {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 14px;
  background: var(--search-bg);
  border-radius: var(--radius-search);
  display: flex;
  align-items: center;
}

.result-header__input {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
}

.result-main {
  padding: var(--section-gap) var(--page-padding) 24px;
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
}

/* AI 摘要 */
.ai-summary {
  display: flex;
  gap: 10px;
  padding: 16px;
  background: var(--ai-summary-bg);
  border-radius: 12px;
}

.ai-summary__icon {
  flex-shrink: 0;
  font-size: 22px;
  line-height: 1.2;
}

.ai-summary__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.ai-summary__text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* 商品推荐 / 替代卡片 */
.result-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
}

.result-card__image {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  background: #e8e8e8;
  flex-shrink: 0;
}

.result-card__info {
  flex: 1;
  min-width: 0;
}

.result-card__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-card__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.result-card__price {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

.result-card__platform {
  font-size: 11px;
  color: var(--text-light);
  background: var(--search-bg);
  padding: 2px 6px;
  border-radius: 4px;
}

.result-card__aside {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.result-badge {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.result-badge--recommend {
  color: var(--recommend);
}

.result-badge--value {
  color: var(--value-pick);
}

.result-card__btn {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  background: var(--primary);
  border-radius: 14px;
  white-space: nowrap;
}

.result-card__btn:active {
  opacity: 0.9;
}

/* 替代区块 */
.alt-block {
  padding: 12px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
}

.alt-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.alt-block__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.alt-block__why {
  font-size: 12px;
  color: var(--primary);
  flex-shrink: 0;
}

.alt-block__reason {
  margin: 0 0 10px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  background: var(--search-bg);
  border-radius: 8px;
}

.alt-block__reason[hidden] {
  display: none;
}

.alt-block .result-card {
  padding: 0;
  box-shadow: none;
}

/* Tab */
.result-tabs {
  display: flex;
  background: var(--card);
  border-radius: 12px 12px 0 0;
  overflow: hidden;
}

.result-tabs__item {
  flex: 1;
  height: 44px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-light);
  position: relative;
  transition: color var(--transition-fast);
}

.result-tabs__item.is-active {
  color: var(--primary);
}

.result-tabs__item.is-active::after {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}

/* 列表 */
.result-list-panel {
  margin-top: -12px;
  background: var(--card);
  border-radius: 0 0 12px 12px;
  padding: 4px 0;
  box-shadow: var(--shadow-card);
}

.result-list-panel[hidden] {
  display: none;
}

.result-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.result-list__item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.result-list__item:last-child {
  border-bottom: none;
}

.result-list__platform {
  flex-shrink: 0;
  width: 52px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.result-list__name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-list__price {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.result-list__service {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-light);
  background: var(--search-bg);
  padding: 2px 6px;
  border-radius: 4px;
}

.result-list__btn {
  flex-shrink: 0;
  height: 28px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  background: var(--primary);
  border-radius: 14px;
}

.result-list__btn:active {
  opacity: 0.9;
}

/* ========== Toast ========== */
.toast[hidden] {
  display: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-bar-height) + 24px + env(safe-area-inset-bottom, 0px));
  z-index: 300;
  transform: translateX(-50%);
  max-width: calc(100% - 48px);
  padding: 10px 16px;
  color: #ffffff;
  font-size: 13px;
  background: rgba(26, 26, 26, 0.88);
  border-radius: var(--radius-btn);
  white-space: nowrap;
  animation: pageFadeIn var(--transition-fast) ease;
}

/* ========== 响应式 ========== */
@media (min-width: 768px) {
  .page {
    max-width: 720px;
    box-shadow: 0 0 0 1px var(--border);
  }

  .tab-bar {
    left: 50%;
    right: auto;
    width: 720px;
    transform: translateX(-50%);
  }

  .product-waterfall {
    column-count: 3;
  }
}

@media (min-width: 1024px) {
  .page {
    max-width: 960px;
  }

  .tab-bar {
    width: 960px;
  }

  .product-waterfall {
    column-count: 4;
  }
}

/* ---------- 商品详情页（比比内展示） ---------- */
.page--product {
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  min-height: 100vh;
  background: var(--bg);
}

.product-detail__header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--top-bar-height);
  padding: 0 var(--page-padding);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.product-detail__back,
.product-detail__header-spacer {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.product-detail__header-title {
  font-size: 16px;
  font-weight: 600;
}

.product-detail__hero {
  background: var(--card);
}

.product-detail__image {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #fff;
}

.product-detail__panel {
  margin: var(--section-gap) var(--page-padding) 0;
  padding: 16px;
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.product-detail__price {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
  margin-bottom: 8px;
}

.product-detail__title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 10px;
}

.product-detail__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.product-detail__shop,
.product-detail__commission {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: var(--font-caption);
}

.product-detail__tip {
  font-size: var(--font-caption);
  color: var(--text-light);
}

.product-detail__section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}

.product-detail__info-list {
  list-style: none;
}

.product-detail__info-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--font-body);
}

.product-detail__info-list li:last-child {
  border-bottom: none;
}

.product-detail__info-list span {
  color: var(--text-light);
  flex-shrink: 0;
}

.product-detail__info-list strong {
  font-weight: 500;
  text-align: right;
  word-break: break-all;
}

.product-detail__footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  gap: 10px;
  padding: 10px var(--page-padding) calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.product-detail__btn {
  flex: 1;
  height: 44px;
  border-radius: var(--radius-btn);
  font-size: 15px;
  font-weight: 600;
}

.product-detail__btn--ghost {
  background: var(--search-bg);
  color: var(--text);
}

.product-detail__btn--primary {
  background: var(--primary);
  color: #fff;
}

.product-detail__btn:active {
  opacity: 0.9;
}
