/* ===== 基础变量 ===== */
:root {
  --bg: #f0f2f5;
  --bg-grad: linear-gradient(180deg, #f0f2f5 0%, #e8ebf0 100%);
  --card-bg: #ffffff;
  --card-hover: #fafbff;
  --text: #1a1a2e;
  --text-sec: #4a4a68;
  --text-muted: #8b8ba7;
  --border: #e8eaf0;
  --border-hov: #d0d5e0;
  --primary: #6366f1;
  --primary-lt: #818cf8;
  --primary-dk: #4f46e5;
  --primary-bg: #eef2ff;
  --primary-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --accent: #8b5cf6;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.12);
  --shadow-xl: 0 20px 48px rgba(0,0,0,.16);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --nav-h: 60px;
  --t: .25s cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
  --bg: #0d0f17;
  --bg-grad: linear-gradient(180deg, #0d0f17 0%, #111421 100%);
  --card-bg: #181b28;
  --card-hover: #1d2130;
  --text: #f0f1f5;
  --text-sec: #c4c6d0;
  --text-muted: #7c7e90;
  --border: #252836;
  --border-hov: #353950;
  --primary: #818cf8;
  --primary-lt: #a5b4fc;
  --primary-dk: #6366f1;
  --primary-bg: #1c1f30;
  --accent: #a78bfa;
  --danger: #f87171;
  --danger-bg: #2a1212;
  --success: #34d399;
  --success-bg: #0d2e22;
  --warning: #fbbf24;
  --warning-bg: #2a1f06;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.2);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow: 0 4px 12px rgba(0,0,0,.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
  --shadow-xl: 0 20px 48px rgba(0,0,0,.6);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-grad);
  color: var(--text);
  min-height: 100vh;
  transition: background var(--t), color var(--t);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ===== 导航栏 ===== */
.navbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(255,255,255,.82);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}
[data-theme="dark"] .navbar { background: rgba(24,27,40,.82); }
.nav-inner {
  max-width: 1280px; margin: 0 auto; height: 100%; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.logo { display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 800; flex-shrink: 0; }
.logo-icon { font-size: 26px; }
.logo-text {
  background: var(--primary-grad);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.logo-text small { font-size: 11px; opacity: .5; font-weight: 500; -webkit-text-fill-color: var(--text-muted); }

.nav-stats { display: flex; gap: 16px; margin-left: auto; }
.nav-stat { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.nav-stat b { color: var(--primary); font-size: 14px; }
@media (max-width: 640px) { .nav-stats { display: none; } }

.icon-btn {
  background: var(--primary-bg); border: 1px solid var(--border);
  font-size: 18px; cursor: pointer;
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t); flex-shrink: 0;
}
.icon-btn:hover { background: var(--primary); border-color: var(--primary); transform: scale(1.08); }
[data-theme="dark"] .theme-icon-light { display: none; }
:root .theme-icon-dark { display: none; }

/* ===== 搜索区 ===== */
.hero {
  padding: 64px 24px 48px;
  position: relative; overflow: hidden;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, var(--primary-bg) 0%, transparent 70%);
}
.hero-bg-orbs { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .15; animation: float 12s ease-in-out infinite; }
.orb1 { width: 300px; height: 300px; background: var(--primary); top: -80px; left: 10%; }
.orb2 { width: 250px; height: 250px; background: var(--accent); top: -60px; right: 15%; animation-delay: -4s; }
.orb3 { width: 200px; height: 200px; background: var(--primary-lt); bottom: -50px; left: 40%; animation-delay: -8s; }
@keyframes float {
  0%,100% { transform: translate(0,0); }
  33% { transform: translate(30px,-20px); }
  66% { transform: translate(-20px,15px); }
}

.hero-inner { max-width: 760px; margin: 0 auto; text-align: center; position: relative; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-bg); border: 1px solid var(--border);
  padding: 6px 16px; border-radius: 50px;
  font-size: 13px; font-weight: 600; color: var(--primary);
  margin-bottom: 16px;
}
.hero-title {
  font-size: 42px; font-weight: 900; margin-bottom: 12px;
  background: linear-gradient(135deg, var(--text) 0%, var(--text-sec) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; letter-spacing: -.03em; line-height: 1.15;
}
.title-accent {
  background: var(--primary-grad);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  color: var(--text-muted); font-size: 15px; margin-bottom: 28px;
  line-height: 1.6; max-width: 580px; margin-left: auto; margin-right: auto;
}

.search-form {
  display: flex; gap: 6px;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 56px; padding: 5px;
  box-shadow: var(--shadow-lg);
  transition: border-color var(--t), box-shadow var(--t);
}
.search-form:focus-within {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg), 0 0 0 4px rgba(99,102,241,.12);
}
.search-input-wrap { flex: 1; display: flex; align-items: center; position: relative; }
.search-icon { position: absolute; left: 18px; font-size: 18px; opacity: .35; }
#searchInput {
  flex: 1; border: none; outline: none; background: none;
  font-size: 16px; color: var(--text); font-weight: 500;
  padding: 14px 16px 14px 46px;
}
#searchInput::placeholder { color: var(--text-muted); font-weight: 400; }
.clear-btn {
  position: absolute; right: 12px;
  border: none; background: var(--border); color: var(--text-muted);
  width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
  font-size: 12px; display: flex; align-items: center; justify-content: center;
  transition: all var(--t);
}
.clear-btn:hover { background: var(--danger); color: #fff; }
.search-btn {
  background: var(--primary-grad); color: #fff;
  border: none; padding: 14px 32px;
  border-radius: 50px; font-size: 16px; font-weight: 700;
  cursor: pointer; transition: all var(--t);
  white-space: nowrap; letter-spacing: .02em;
  box-shadow: 0 4px 14px rgba(99,102,241,.35);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 100px;
}
.search-btn:hover { box-shadow: 0 6px 20px rgba(99,102,241,.45); transform: translateY(-1px); }
.search-btn:active { transform: scale(.97); }
.search-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-loader {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hot-searches {
  margin-top: 20px; display: flex; flex-wrap: wrap;
  align-items: center; gap: 8px; justify-content: center;
}
.hot-label { font-size: 12px; color: var(--text-muted); margin-right: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.hot-tag {
  border: 1px solid var(--border); background: var(--card-bg);
  color: var(--text-sec); padding: 6px 14px;
  border-radius: 50px; font-size: 13px; cursor: pointer; font-weight: 500;
  transition: all var(--t);
}
.hot-tag:hover {
  border-color: var(--primary); color: var(--primary);
  background: var(--primary-bg); transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* ===== 工具栏 ===== */
.toolbar {
  max-width: 1280px; margin: 20px auto; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.toolbar-left { display: flex; align-items: center; gap: 12px; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }

.switch-wrap { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch-wrap input { display: none; }
.switch-slider {
  width: 44px; height: 24px; background: var(--border);
  border-radius: 24px; position: relative; transition: background var(--t);
}
.switch-slider::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; background: #fff;
  border-radius: 50%; transition: transform var(--t);
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.switch-wrap input:checked + .switch-slider { background: var(--primary-grad); }
.switch-wrap input:checked + .switch-slider::after { transform: translateX(20px); }
.switch-label { font-size: 14px; font-weight: 500; }
.filter-count {
  font-size: 12px; color: var(--primary);
  background: var(--primary-bg); padding: 4px 10px;
  border-radius: 50px; font-weight: 600;
}

.sort-tabs { display: flex; gap: 4px; background: var(--bg); border-radius: 50px; padding: 3px; }
.sort-tab {
  border: none; background: none; color: var(--text-muted);
  padding: 6px 14px; border-radius: 50px; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all var(--t); white-space: nowrap;
}
.sort-tab:hover { color: var(--text); }
.sort-tab.active {
  background: var(--card-bg); color: var(--primary); font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ===== 加载骨架 ===== */
.loading-state { max-width: 1280px; margin: 20px auto; padding: 0 24px; }
.loading-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px;
}
.skeleton-card {
  background: var(--card-bg); border-radius: var(--radius); padding: 18px;
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.sk-header { height: 24px; background: var(--border); border-radius: 8px; margin-bottom: 14px; width: 60%; }
.skeleton-line {
  height: 14px; background: var(--border); border-radius: 7px; margin-bottom: 10px;
  animation: pulse 1.5s ease-in-out infinite;
}
.w70 { width: 70%; } .w50 { width: 50%; } .w90 { width: 90%; }
@keyframes pulse { 0%,100% { opacity: .3; } 50% { opacity: .6; } }

/* ===== 最低价横幅 ===== */
.cheapest-banner {
  max-width: 1280px; margin: 20px auto; padding: 0 24px;
  animation: fadeInUp .4s ease-out;
}
.cheapest-banner > div, .cheapest-banner > a {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, #fef9c3 0%, #fde68a 50%, #fcd34d 100%);
  border: 2px solid #f59e0b; border-radius: var(--radius);
  padding: 18px 24px; box-shadow: 0 8px 24px rgba(245,158,11,.25);
  position: relative; overflow: hidden;
}
.cheapest-banner > div::before, .cheapest-banner > a::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent);
  transform: translateX(-100%);
  animation: shimmer 3s ease-in-out infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
[data-theme="dark"] .cheapest-banner > div,
[data-theme="dark"] .cheapest-banner > a {
  background: linear-gradient(135deg, #422006 0%, #78350f 50%, #92400e 100%);
  border-color: #b45309;
}
.cheapest-icon { font-size: 36px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.15)); }
.cheapest-info { flex: 1; display: flex; flex-direction: column; gap: 2px; position: relative; }
.cheapest-label { font-size: 11px; color: #92400e; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.cheapest-price { font-size: 32px; font-weight: 900; color: #78350f; letter-spacing: -.02em; }
.cheapest-platform { font-size: 14px; color: #92400e; font-weight: 500; }
.cheapest-btn {
  background: linear-gradient(135deg, #b45309, #d97706); color: #fff !important;
  padding: 12px 24px; border-radius: 50px;
  font-weight: 700; white-space: nowrap; transition: all var(--t);
  box-shadow: 0 4px 12px rgba(180,83,9,.4); position: relative;
}
.cheapest-btn:hover { transform: scale(1.05); box-shadow: 0 6px 16px rgba(180,83,9,.5); }

/* ===== 结果区 ===== */
.results {
  max-width: 1280px; margin: 0 auto; padding: 0 24px 48px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

/* 平台卡片 */
.platform-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t), transform var(--t), border-color var(--t);
  animation: fadeInUp .4s ease-out backwards;
}
.platform-card:hover {
  box-shadow: var(--shadow-lg); transform: translateY(-4px);
  border-color: var(--border-hov);
}
.platform-card.is-cheapest {
  border-color: var(--warning);
  box-shadow: 0 0 0 2px rgba(245,158,11,.35), var(--shadow);
}
.platform-card.is-cheapest:hover {
  box-shadow: 0 0 0 2px rgba(245,158,11,.5), var(--shadow-lg);
}

.platform-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--card-hover) 0%, transparent 100%);
}
.platform-header::before {
  content: ''; width: 4px; height: 20px; border-radius: 2px;
  background: var(--p-color, var(--primary));
  flex-shrink: 0;
}
.platform-icon { font-size: 22px; }
.platform-name { font-weight: 700; font-size: 15px; }
.platform-mode {
  margin-left: auto; font-size: 10px;
  padding: 3px 10px; border-radius: 50px;
  background: var(--primary-bg); color: var(--primary);
  font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
}
.platform-mode.stale { background: var(--warning-bg); color: var(--warning); }
.platform-mode.demo { background: var(--bg); color: var(--text-muted); }
.platform-mode.live { background: var(--success-bg); color: var(--success); }

.platform-items { padding: 6px; }
.platform-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 14px; }

/* 商品行 */
.item-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-bottom: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background var(--t);
}
.item-row:last-child { border-bottom: none; }
.item-row:hover { background: var(--primary-bg); }

.item-info { flex: 1; min-width: 0; }
.item-title {
  font-size: 14px; line-height: 1.4; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.item-shop { font-size: 12px; color: var(--text-muted); }
.item-coupon {
  font-size: 10px; padding: 2px 8px; border-radius: 6px;
  background: var(--danger-bg); color: var(--danger);
  white-space: nowrap; font-weight: 600;
}
.item-coupon.discount { background: var(--success-bg); color: var(--success); }

.item-price-wrap { text-align: right; white-space: nowrap; }
.item-price { font-size: 20px; font-weight: 800; color: var(--danger); letter-spacing: -.02em; }
.item-original { font-size: 12px; color: var(--text-muted); text-decoration: line-through; }

.item-buy {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--primary-grad); color: #fff;
  padding: 8px 16px; border-radius: 50px;
  font-size: 13px; font-weight: 700; white-space: nowrap;
  transition: all var(--t);
  box-shadow: 0 2px 8px rgba(99,102,241,.3);
}
.item-buy:hover { transform: scale(1.08); box-shadow: 0 4px 14px rgba(99,102,241,.4); }

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 80px 24px; }
.empty-icon { font-size: 56px; margin-bottom: 16px; opacity: .4; }
.empty-title { color: var(--text-sec); font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.empty-sub { color: var(--text-muted); font-size: 14px; }

/* ===== 特性区 ===== */
.features {
  max-width: 1280px; margin: 0 auto; padding: 48px 24px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px;
}
.feature-card {
  text-align: center; padding: 28px 20px;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: all var(--t);
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-hov); }
.feature-icon {
  font-size: 32px; margin-bottom: 12px;
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-left: auto; margin-right: auto;
  background: var(--primary-bg);
}
.feature-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.feature-card p { font-size: 13px; color: var(--text-muted); }

/* ===== 页脚 ===== */
.footer {
  border-top: 1px solid var(--border); background: var(--card-bg);
}
.footer-inner {
  max-width: 1280px; margin: 0 auto; padding: 28px 24px;
  text-align: center; display: flex; flex-direction: column; gap: 8px;
}
.footer-brand { display: flex; align-items: center; gap: 6px; justify-content: center; font-weight: 700; font-size: 18px; }
.footer-logo { font-size: 22px; }
.footer-note { color: var(--text-muted); font-size: 13px; }
.footer-note span { color: var(--primary); font-weight: 600; }
.footer-copy { color: var(--text-muted); font-size: 12px; opacity: .7; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .hero { padding: 40px 20px 32px; }
  .hero-title { font-size: 28px; }
  .hero-subtitle { font-size: 14px; }
  .search-form { flex-direction: column; border-radius: var(--radius); padding: 14px; gap: 10px; }
  .search-input-wrap { width: 100%; }
  .search-btn { width: 100%; border-radius: var(--radius); }
  .results { grid-template-columns: 1fr; }
  .hot-searches { justify-content: flex-start; }
  .cheapest-banner > div, .cheapest-banner > a { flex-wrap: wrap; }
  .cheapest-price { font-size: 26px; }
  .toolbar { flex-direction: column; align-items: flex-start; }
  .sort-tabs { flex-wrap: wrap; }
}

/* ===== 动画 ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.platform-card:nth-child(1) { animation-delay: 0s; }
.platform-card:nth-child(2) { animation-delay: .06s; }
.platform-card:nth-child(3) { animation-delay: .12s; }
.platform-card:nth-child(4) { animation-delay: .18s; }
.platform-card:nth-child(5) { animation-delay: .24s; }
.platform-card:nth-child(6) { animation-delay: .30s; }
.platform-card:nth-child(7) { animation-delay: .36s; }
.platform-card:nth-child(8) { animation-delay: .42s; }
.platform-card:nth-child(9) { animation-delay: .48s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ===== 搜索历史 ===== */
.history-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.history-chip {
  background: var(--card-bg);
  border: 1px dashed var(--border-hov);
  color: var(--text-sec);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--t);
}
.history-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
}
.clear-history {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 8px;
  opacity: .5;
  transition: opacity var(--t);
}
.clear-history:hover { opacity: 1; background: var(--danger-bg); }

/* ===== 平台筛选 ===== */
.platform-filter-wrap { position: relative; }
.platform-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text-sec);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--t);
}
.platform-filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.platform-filter-count {
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.platform-filter-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  min-width: 180px;
  z-index: 50;
}
.pf-actions {
  display: flex;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.pf-action {
  flex: 1;
  background: var(--primary-bg);
  color: var(--primary);
  border: none;
  padding: 6px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: background var(--t);
}
.pf-action:hover { background: var(--primary); color: #fff; }
.pf-list { display: flex; flex-direction: column; gap: 2px; }
.pf-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--t);
  user-select: none;
}
.pf-item:hover { background: var(--card-hover); }
.pf-item.checked { background: var(--primary-bg); }
.pf-item input { display: none; }
.pf-icon { font-size: 16px; }
.pf-name { font-size: 13px; color: var(--text); }
.pf-item.checked .pf-name { color: var(--primary-dk); font-weight: 600; }
.pf-item.checked::after {
  content: '✓';
  margin-left: auto;
  color: var(--primary);
  font-weight: 700;
}

/* ===== 分享按钮 ===== */
.share-btn {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text-sec);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--t);
}
.share-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}
.share-btn.copied {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

/* ===== 移动端补充 ===== */
@media (max-width: 768px) {
  .toolbar-left, .toolbar-right { flex-wrap: wrap; gap: 8px; }
  .platform-filter-dropdown { left: auto; right: 0; min-width: 160px; }
  .share-btn { padding: 6px 10px; font-size: 12px; }
}

/* ===== 价格历史横条 ===== */
.price-history-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-sec);
}
.history-lowest { color: var(--text-sec); }
.history-lowest b { color: var(--success); font-weight: 700; font-size: 14px; }
.price-trend { font-size: 12px; }
.trend-up { color: var(--danger); font-weight: 600; }
.trend-down { color: var(--success); font-weight: 600; }
.trend-flat { color: var(--text-muted); }
.trend-new { color: var(--primary); font-weight: 600; }
.chart-btn {
  margin-left: auto;
  background: var(--primary-bg);
  color: var(--primary);
  border: 1px solid var(--primary-lt);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--t);
}
.chart-btn:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-1px);
}

/* ===== 价格变化徽章（商品行） ===== */
.item-change {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
  vertical-align: middle;
}
.item-change.up { background: var(--danger-bg); color: var(--danger); }
.item-change.down { background: var(--success-bg); color: var(--success); }
.item-change.flat { background: var(--bg); color: var(--text-muted); }
.item-change.new { background: var(--primary-bg); color: var(--primary); }

/* ===== 走势图模态框 ===== */
.chart-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.chart-modal-content {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  padding: 24px;
  animation: modalIn .25s ease;
}
@media (min-width: 1024px) {
  .chart-modal-content { max-width: 820px; padding: 32px; }
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.chart-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}
.chart-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.chart-modal-header h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart-range-tabs {
  display: inline-flex;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
  width: fit-content;
}
.range-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--t);
}
.range-tab:hover { color: var(--text); }
.range-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99,102,241,.3);
}
.chart-modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 8px;
  transition: all var(--t);
  flex-shrink: 0;
}
.chart-modal-close:hover {
  background: var(--bg);
  color: var(--danger);
  transform: rotate(90deg);
}

.chart-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: transform var(--t);
}
.stat-item:hover { transform: translateY(-2px); }
.stat-label { font-size: 11px; color: var(--text-muted); }
.stat-value { font-size: 18px; font-weight: 700; color: var(--text); }
.stat-value.primary { color: var(--primary); }
.stat-value.success { color: var(--success); }
.stat-value.danger { color: var(--danger); }

.stat-skeleton {
  height: 56px;
  background: linear-gradient(90deg, var(--bg) 25%, var(--border) 50%, var(--bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}

.chart-container {
  position: relative;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  min-height: 200px;
}
.price-chart {
  width: 100%;
  height: auto;
  display: block;
}

/* SVG 元素样式（暗色模式自动适配） */
.grid-line {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  opacity: 0.7;
}
.axis-label {
  font-size: 10px;
  fill: var(--text-muted);
}
.chart-line {
  stroke: var(--primary);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  fill: none;
}
.chart-dot {
  fill: var(--primary);
  transition: r 0.15s ease, fill 0.15s ease;
}
.chart-dot.hover { r: 6; }
.chart-dot.is-lowest { fill: var(--success); }
.chart-dot.is-highest { fill: var(--danger); }
.chart-dot.is-current {
  stroke: var(--card-bg);
  stroke-width: 2.5;
  r: 5;
}
.chart-hit {
  cursor: pointer;
}
.annotation-low {
  font-size: 11px;
  fill: var(--success);
  font-weight: 700;
}
.annotation-high {
  font-size: 11px;
  fill: var(--danger);
  font-weight: 700;
}

.chart-error, .chart-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}
.chart-error { color: var(--danger); }

.chart-skeleton { padding: 20px 0; }
.chart-skeleton .sk-line {
  height: 14px;
  background: linear-gradient(90deg, var(--bg) 25%, var(--border) 50%, var(--bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
  margin: 14px 0;
}
.chart-skeleton .w30 { width: 30%; }
.chart-skeleton .w40 { width: 40%; }
.chart-skeleton .w50 { width: 50%; }
.chart-skeleton .w70 { width: 70%; }

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--text);
  color: var(--card-bg);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  box-shadow: var(--shadow-xl);
  white-space: nowrap;
  z-index: 10;
  animation: ttIn .15s ease;
}
@keyframes ttIn {
  from { opacity: 0; transform: translate(-50%, -90%); }
  to { opacity: 1; transform: translate(-50%, -100%); }
}
.chart-tooltip .tt-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
}
.chart-tooltip .tt-time {
  margin-top: 2px;
  opacity: 0.85;
}
.chart-tooltip .tt-platform {
  margin-top: 2px;
  opacity: 0.7;
  font-size: 11px;
}

.chart-legend {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-sec);
  flex-wrap: wrap;
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}

@media (max-width: 768px) {
  .chart-modal { padding: 10px; }
  .chart-modal-content { padding: 16px; }
  .chart-modal-header h3 { font-size: 16px; }
  .chart-stats { grid-template-columns: repeat(2, 1fr); }
  .chart-legend { gap: 8px; }
  .chart-tooltip { font-size: 11px; padding: 6px 8px; }
}

/* ===== 通用区块标题 ===== */
.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.section-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ===== 商品分类导航 ===== */
.categories {
  max-width: var(--container);
  margin: 24px auto 8px;
  padding: 0 20px;
}
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--t);
  text-align: center;
}
.category-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary-lt);
  box-shadow: var(--shadow-md);
}
.cat-icon { font-size: 28px; }
.cat-name { font-size: 14px; font-weight: 600; color: var(--text); }
.cat-hint { font-size: 11px; color: var(--text-muted); }

/* ===== 发现区（热搜 + 节日历） ===== */
.discover {
  max-width: var(--container);
  margin: 32px auto;
  padding: 0 20px;
}
.discover-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.discover-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

/* 热搜榜 */
.trending-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.trending-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 24px 8px;
}
.trending-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--t);
}
.trending-item:hover { background: var(--bg); }
.trending-rank {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  background: var(--bg);
  color: var(--text-muted);
  flex-shrink: 0;
}
.trending-rank.rank-1 { background: #fde68a; color: #92400e; }
.trending-rank.rank-2 { background: #e5e7eb; color: #4b5563; }
.trending-rank.rank-3 { background: #fed7aa; color: #9a3412; }
.trending-query {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trending-count {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* 购物节日历 */
.festivals-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.festival-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--t);
}
.festival-item:hover {
  border-color: var(--primary-lt);
  transform: translateX(2px);
}
.festival-item.is-soon {
  background: linear-gradient(135deg, var(--primary-bg), transparent);
  border-color: var(--primary-lt);
}
.festival-icon { font-size: 22px; flex-shrink: 0; }
.festival-info { flex: 1; min-width: 0; }
.festival-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.festival-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.festival-countdown {
  font-size: 12px;
  color: var(--text-sec);
  text-align: right;
  flex-shrink: 0;
}
.festival-countdown b {
  font-size: 16px;
  color: var(--primary);
  font-weight: 700;
}
.festival-countdown.soon b { color: var(--danger); }

/* ===== 价格区间筛选 ===== */
.price-range-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
}
.price-range-label { font-size: 14px; }
.price-range-input {
  width: 60px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  padding: 4px;
  outline: none;
}
.price-range-input::placeholder { color: var(--text-muted); }
.price-range-input::-webkit-inner-spin-button,
.price-range-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.price-range-sep { color: var(--text-muted); font-size: 12px; }

@media (max-width: 768px) {
  .discover-grid { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .price-range-wrap { width: 100%; justify-content: center; }
}
