/* ============================================================
   省钱比价 · 什么值得买风格
   ============================================================ */
/* ---------- 主题变量 ---------- */
:root {
  --primary: #e4393c;
  --primary-dark: #c7272b;
  --primary-light: #ff6b6e;
  --primary-ghost: rgba(228, 57, 60, 0.08);
  --bg: #f5f5f5;
  --card-bg: #ffffff;
  --text: #333333;
  --text-light: #999999;
  --border: #eeeeee;
  --success: #52c41a;
  --warning: #faad14;
  /* 平台色 */
  --jd: #e4393c;
  --taobao: #ff5000;
  --pdd: #e02e24;
  --meituan: #ffc300;
  --douyin: #111111;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-card-hover: 0 10px 28px rgba(228, 57, 60, 0.14);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
/* ---------- 基础重置 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
               "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}
input { font-family: inherit; }
.container { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
/* ---------- 顶部氛围装饰 ---------- */
.ambient {
  position: absolute;
  inset: 0 0 auto 0;
  height: 260px;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.ambient__glyph {
  position: absolute;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.07);
  user-select: none;
  animation: floaty 9s ease-in-out infinite;
}
.ambient__glyph:nth-child(1) { font-size: 150px; top: -30px; left: 4%; animation-delay: 0s; }
.ambient__glyph:nth-child(2) { font-size: 90px; top: 60px; right: 8%; animation-delay: -3s; }
.ambient__glyph:nth-child(3) { font-size: 60px; top: 150px; left: 18%; animation-delay: -6s; }
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%      { transform: translateY(-14px) rotate(4deg); }
}
/* ---------- 页头 ---------- */
.site-header { position: relative; z-index: 1; background: linear-gradient(135deg, #e4393c 0%, #d03034 55%, #b52a2e 100%); padding: 14px 0 8px; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}
.brand__mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #fff;
  color: var(--primary);
  font-size: 22px;
  font-weight: 900;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
  transition: transform 0.3s var(--ease);
}
.brand:hover .brand__mark { transform: rotate(-8deg) scale(1.06); }
.brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.brand__name { font-size: 21px; font-weight: 800; letter-spacing: 1px; }
.brand__slogan { font-size: 11px; opacity: 0.85; letter-spacing: 2px; }
.brand-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.3;
  color: #fff;
}
.brand-stats__num { font-size: 16px; font-weight: 800; color: #ffe08a; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.15); }
.brand-stats__label { font-size: 11px; opacity: 0.8; }
/* ---------- 搜索英雄区 ---------- */
.hero { position: relative; z-index: 1; background: linear-gradient(160deg, #b52a2e 0%, #d03034 45%, #e8574a 100%); padding: 26px 0 34px; }
.hero::after {
  /* 底部与页面背景的自然过渡 */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 22px;
  background: var(--bg);
  border-radius: 22px 22px 0 0;
}
.hero__tip {
  text-align: center;
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  margin-bottom: 16px;
  letter-spacing: 0.5px;
}
.hero__tip strong { color: #ffe08a; font-size: 16px; font-weight: 800; margin: 0 2px; }
.search-box {
  display: flex;
  align-items: stretch;
  background: #fff;
  border-radius: 999px;
  padding: 5px;
  max-width: 640px;
  margin: 0 auto;
  box-shadow: 0 8px 30px rgba(120, 10, 12, 0.35);
  transition: box-shadow 0.35s var(--ease), transform 0.35s var(--ease);
}
.search-box:focus-within { box-shadow: 0 10px 40px rgba(120, 10, 12, 0.45), 0 0 0 4px rgba(255, 255, 255, 0.28); transform: translateY(-2px); }
#search-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  font-size: 16px;
  padding: 12px 18px;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
}
#search-input::placeholder { color: #b8b8b8; }
.search-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 26px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s;
  white-space: nowrap;
}
.search-btn:hover { transform: scale(1.04); box-shadow: 0 4px 14px rgba(199, 39, 43, 0.45); }
.search-btn:active { transform: scale(0.97); }
.search-btn__icon { font-size: 15px; }
/* ---------- 搜索历史 ---------- */
.search-history {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 640px;
  margin: 14px auto 0;
  font-size: 12px;
}
.search-history__label { color: rgba(255, 255, 255, 0.75); }
.search-history__chips { display: flex; gap: 8px; flex-wrap: wrap; }
.history-chip {
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: background 0.2s, transform 0.2s var(--ease);
}
.history-chip:hover { background: rgba(255, 255, 255, 0.32); transform: translateY(-1px); }
.search-history__clear {
  margin-left: auto;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.2s;
}
.search-history__clear:hover { color: #fff; }
/* ---------- 主内容 ---------- */
.main { position: relative; z-index: 2; padding: 6px 0 40px; }
/* ---------- Tab ---------- */
.tabs { display: flex; gap: 32px; border-bottom: 2px solid var(--border); margin-bottom: 18px; }
.tab {
  position: relative;
  padding: 12px 4px 14px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-light);
  transition: color 0.25s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab__icon { font-size: 18px; transition: transform 0.3s var(--ease); }
.tab:hover { color: var(--primary); }
.tab:hover .tab__icon { transform: scale(1.15) rotate(-6deg); }
.tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--primary);
  transform: scaleX(0);
  transition: transform 0.3s var(--ease);
}
.tab.is-active { color: var(--primary); }
.tab.is-active::after { transform: scaleX(1); }
/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.sort-group {
  display: inline-flex;
  gap: 8px;
  background: #fff;
  padding: 5px;
  border-radius: 999px;
  box-shadow: var(--shadow-card);
}
.sort-btn {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  transition: all 0.25s var(--ease);
}
.sort-btn:hover { color: var(--primary); background: var(--primary-ghost); }
.sort-btn.is-active { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 3px 10px rgba(228, 57, 60, 0.35); }
.result-count { font-size: 13px; color: var(--text-light); }
.result-count strong { color: var(--primary); font-weight: 800; }
/* ---------- 加载中 ---------- */
.loading { text-align: center; padding: 48px 0; }
.spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto 14px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.loading__text { font-size: 14px; color: var(--text-light); animation: pulse-text 1.6s ease-in-out infinite; }
@keyframes pulse-text {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}
/* ---------- 空状态 & 错误 ---------- */
.empty-state,
.error-state { text-align: center; padding: 64px 16px; }
.empty-state__icon,
.error-state__icon { display: block; font-size: 56px; margin-bottom: 14px; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
.empty-state__title { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-state__desc { font-size: 13px; color: var(--text-light); }
.error-state__text { font-size: 15px; color: var(--text); margin-bottom: 16px; }
.error-state__retry {
  padding: 9px 28px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  transition: background 0.2s, transform 0.2s var(--ease);
}
.error-state__retry:hover { background: var(--primary-dark); transform: translateY(-2px); }
/* ---------- 商品卡片 ---------- */
.results { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 720px) {
  .results { grid-template-columns: repeat(2, 1fr); }
}
.product-card {
  position: relative;
  display: flex;
  gap: 14px;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
  transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease), border-color 0.28s;
  animation: card-in 0.45s var(--ease) backwards;
}
.product-card:nth-child(1)  { animation-delay: 0.02s; }
.product-card:nth-child(2)  { animation-delay: 0.06s; }
.product-card:nth-child(3)  { animation-delay: 0.10s; }
.product-card:nth-child(4)  { animation-delay: 0.14s; }
.product-card:nth-child(5)  { animation-delay: 0.18s; }
.product-card:nth-child(6)  { animation-delay: 0.22s; }
.product-card:nth-child(n+7){ animation-delay: 0.26s; }
@keyframes card-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card-hover); border-color: rgba(228, 57, 60, 0.18); }
.product-card__img {
  flex: 0 0 80px;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #f4f4f4;
  display: grid;
  place-items: center;
}
.product-card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s var(--ease); }
.product-card:hover .product-card__img img { transform: scale(1.08); }
.img-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: #f0f0f0;
  font-size: 30px;
}
.product-card__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.product-card__title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
  transition: color 0.2s;
}
.product-card:hover .product-card__title { color: var(--primary); }
/* 平台 badge */
.platform-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
  vertical-align: middle;
  margin-right: 6px;
  flex-shrink: 0;
}
.platform-badge--jd      { background: var(--jd); }
.platform-badge--taobao  { background: var(--taobao); }
.platform-badge--pdd     { background: var(--pdd); }
.platform-badge--meituan { background: var(--meituan); color: #333; }
.platform-badge--douyin  { background: var(--douyin); }
.platform-badge--default { background: var(--text-light); }
/* 优惠券 */
.coupon-tag {
  display: inline-block;
  padding: 1px 7px;
  border: 1px dashed var(--primary);
  border-radius: 4px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  background: var(--primary-ghost);
  vertical-align: middle;
  white-space: nowrap;
}
.product-card__tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
/* 价格行 */
.product-card__price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}
.price {
  color: var(--primary);
  font-weight: 800;
  font-size: 22px;
  line-height: 1;
  letter-spacing: -0.5px;
}
.price__symbol { font-size: 13px; font-weight: 700; margin-right: 1px; }
.price-original { color: var(--text-light); font-size: 12px; text-decoration: line-through; }
/* 元信息行 */
.product-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-light);
  flex-wrap: wrap;
}
.sales { color: var(--warning); font-weight: 600; }
.rating { color: var(--warning); }
.shop-name { max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 数据来源 badge */
.source-badge {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.source-badge--real { background: rgba(82, 196, 26, 0.12); color: var(--success); border: 1px solid rgba(82, 196, 26, 0.35); }
.source-badge--mock { background: rgba(250, 173, 20, 0.14); color: #d48806; border: 1px solid rgba(250, 173, 20, 0.4); }
/* 最低价款高亮 */
.product-card--best { border-color: rgba(228, 57, 60, 0.35); }
.product-card--best::before {
  content: "👑 全网最低";
  position: absolute;
  top: -9px;
  left: 14px;
  padding: 2px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff9a3d, var(--primary));
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  box-shadow: 0 3px 10px rgba(228, 57, 60, 0.4);
}
/* ---------- AI 面板 ---------- */
.ai-panel {
  margin-top: 26px;
  border-radius: var(--radius-lg);
  background: linear-gradient(170deg, #eaf4ff 0%, #f6fbff 45%, #ffffff 100%);
  border: 1px solid #dbeafe;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  animation: card-in 0.45s var(--ease) backwards;
}
.ai-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 18px;
}
.ai-panel__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  color: #1f6fd6;
}
.ai-panel__sparkle { display: inline-block; animation: twinkle 1.8s ease-in-out infinite; }
@keyframes twinkle {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
  50%      { transform: scale(1.25) rotate(18deg); opacity: 0.7; }
}
.ai-panel__arrow { display: inline-block; transition: transform 0.3s var(--ease); font-size: 14px; }
.ai-panel.is-collapsed .ai-panel__arrow { transform: rotate(-90deg); }
.ai-analyze-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.ai-analyze-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5); }
.ai-analyze-btn:active { transform: scale(0.97); }
.ai-analyze-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.ai-analyze-btn__spark { animation: twinkle 1.4s ease-in-out infinite; }
.ai-panel__body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.35s var(--ease); }
.ai-panel.is-collapsed .ai-panel__body { grid-template-rows: 0fr; }
.ai-content-wrap { overflow: hidden; min-height: 0; }
.ai-content {
  padding: 0 18px 18px;
  font-size: 14px;
  line-height: 1.85;
  color: #374151;
  white-space: pre-wrap;
  word-break: break-word;
}
.ai-placeholder { color: #93a8c9; font-size: 13px; text-align: center; padding: 18px 0 6px; }
.ai-close {
  display: block;
  margin: 0 auto 14px;
  padding: 6px 22px;
  border-radius: 999px;
  font-size: 12px;
  color: #1f6fd6;
  border: 1px solid #bfdbfe;
  background: #fff;
  transition: background 0.2s;
}
.ai-close:hover { background: #eff6ff; }
/* 打字机光标 */
.ai-cursor {
  display: inline-block;
  width: 8px;
  height: 16px;
  margin-left: 2px;
  vertical-align: -2px;
  background: #3b82f6;
  border-radius: 2px;
  animation: blink 0.85s steps(1) infinite;
}
@keyframes blink {
  50% { opacity: 0; }
}
.ai-streaming-note { display: inline-block; margin-top: 10px; font-size: 12px; color: #93a8c9; }
/* ---------- 页脚 ---------- */
.site-footer { background: #fff; border-top: 1px solid var(--border); padding: 32px 0 26px; margin-top: 20px; }
.legend__title { font-size: 15px; font-weight: 800; margin-bottom: 8px; color: var(--text); }
.legend__desc { font-size: 13px; color: var(--text-light); max-width: 640px; margin-bottom: 14px; }
.legend__badges { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.legend-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.legend-badge--real { background: rgba(82, 196, 26, 0.1); color: var(--success); border: 1px solid rgba(82, 196, 26, 0.3); }
.legend-badge--mock { background: rgba(250, 173, 20, 0.12); color: #d48806; border: 1px solid rgba(250, 173, 20, 0.35); }
.platforms {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.platforms__label { font-size: 13px; color: var(--text-light); }
.platform-chip {
  padding: 3px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--chip-color, var(--text-light));
  letter-spacing: 1px;
  transition: transform 0.2s var(--ease);
}
.platform-chip:hover { transform: translateY(-2px); }
.copyright { font-size: 12px; color: #c0c0c0; border-top: 1px dashed var(--border); padding-top: 16px; }
/* ---------- 移动端适配 ---------- */
@media (max-width: 640px) {
  .brand-stats { display: none; }
  .brand__name { font-size: 19px; }
  .hero { padding: 20px 0 30px; }
  #search-input { font-size: 15px; padding: 11px 14px; }
  .search-btn { padding: 0 16px; letter-spacing: 1px; }
  .search-btn__text { display: none; }
  .search-btn__icon { font-size: 18px; }
  .tabs { gap: 22px; }
  .tab { font-size: 15px; }
  .sort-group { width: 100%; justify-content: space-between; }
  .sort-btn { flex: 1; text-align: center; padding: 7px 8px; }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .product-card { padding: 13px; }
  .price { font-size: 20px; }
  .ai-panel__header { flex-direction: column; align-items: stretch; }
  .ai-analyze-btn { justify-content: center; }
  .ambient__glyph:nth-child(1) { font-size: 100px; }
}
/* ---------- 减少动画偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
