/* ===========================
   Reset & Base
=========================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
               "Microsoft YaHei", sans-serif;
  background: #f4f6fb;
  color: #222;
  min-height: 100vh;
  overflow-x: hidden;
}
button { cursor: pointer; border: none; outline: none; background: none; }
input  { outline: none; border: none; background: none; }

/* ===========================
   Header
=========================== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
  padding: 14px 16px 12px;
  box-shadow: 0 2px 12px rgba(21,101,192,.35);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 6px;
}
.logo-icon { font-size: 22px; }
.logo-text {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .5px;
}
.logo-sub {
  font-size: 11px;
  color: rgba(255,255,255,.7);
  background: rgba(255,255,255,.15);
  border-radius: 10px;
  padding: 1px 7px;
}

.location-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,.18);
  border-radius: 20px;
  padding: 5px 10px;
  cursor: pointer;
  transition: background .2s;
}
.location-bar:active { background: rgba(255,255,255,.28); }
.loc-icon { font-size: 13px; }
.loc-text {
  font-size: 12px;
  color: #fff;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.loc-arrow { font-size: 14px; color: rgba(255,255,255,.7); }

/* Search */
.search-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}
.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 24px;
  padding: 0 12px;
  height: 42px;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.search-icon { font-size: 16px; color: #999; flex-shrink: 0; }
.search-input {
  flex: 1;
  font-size: 15px;
  color: #333;
  height: 100%;
}
.search-input::placeholder { color: #bbb; font-size: 14px; }
.search-clear {
  font-size: 14px;
  color: #bbb;
  padding: 4px;
  line-height: 1;
}
.search-btn {
  background: #ff6b00;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border-radius: 24px;
  padding: 0 18px;
  height: 42px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(255,107,0,.4);
  transition: opacity .15s;
  flex-shrink: 0;
}
.search-btn:active { opacity: .8; }

/* Hot tags */
.hot-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.hot-label { font-size: 12px; color: rgba(255,255,255,.6); white-space: nowrap; }
.tag {
  background: rgba(255,255,255,.18);
  color: #fff;
  font-size: 12px;
  border-radius: 12px;
  padding: 3px 10px;
  cursor: pointer;
  transition: background .15s;
}
.tag:active { background: rgba(255,255,255,.32); }

/* ===========================
   Main
=========================== */
.main {
  padding: 0 0 70px;
  min-height: calc(100vh - 140px);
}

/* ===========================
   Welcome Page
=========================== */
.welcome-page { padding: 24px 16px; }

.welcome-hero {
  text-align: center;
  padding: 24px 0 20px;
}
.hero-img { font-size: 60px; margin-bottom: 12px; }
.hero-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a237e;
  margin-bottom: 8px;
}
.hero-desc { font-size: 13px; color: #666; line-height: 1.6; }

/* Platform grid */
.platform-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0;
}
.platform-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px 12px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
  transition: transform .2s, box-shadow .2s;
}
.platform-card:active { transform: scale(.97); }
.pc-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: #fff;
}
.pc-name { font-size: 14px; font-weight: 600; color: #222; }
.pc-tag { font-size: 11px; color: #999; margin-top: 3px; }

/* How to */
.how-to {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  margin: 8px 0 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.how-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}
.how-step + .how-step { border-top: 1px solid #f0f0f0; }
.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1565c0, #0d47a1);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.step-text { font-size: 14px; color: #444; }

.start-btn {
  width: 100%;
  height: 50px;
  background: linear-gradient(135deg, #ff6b00, #ff8c00);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  border-radius: 25px;
  box-shadow: 0 4px 16px rgba(255,107,0,.4);
  transition: opacity .15s;
  letter-spacing: .5px;
}
.start-btn:active { opacity: .85; }

/* ===========================
   Loading Page
=========================== */
.loading-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  padding: 40px 20px;
}
.loading-inner { text-align: center; }

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e3e8f0;
  border-top-color: #1565c0;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text { font-size: 15px; color: #555; margin-bottom: 16px; }

.loading-stores {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.ls-item {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 12px;
  color: #fff;
  opacity: .5;
  transition: opacity .3s;
}
.ls-item.active { opacity: 1; }

/* ===========================
   Result Page
=========================== */
.result-page { padding: 0; }

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #eee;
  gap: 8px;
}
.result-query {
  font-size: 14px;
  font-weight: 600;
  color: #222;
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  overflow: hidden;
}
.result-count {
  font-size: 12px;
  color: #999;
  font-weight: 400;
  white-space: nowrap;
}
.sort-bar { display: flex; gap: 6px; }
.sort-btn {
  font-size: 12px;
  color: #888;
  background: #f4f6fb;
  border-radius: 12px;
  padding: 4px 10px;
  transition: all .15s;
  white-space: nowrap;
}
.sort-btn.active {
  background: #1565c0;
  color: #fff;
}

/* Best Deal */
.best-deal-wrap { padding: 12px 16px 0; }

.best-deal-card {
  background: linear-gradient(135deg, #fff9e6, #fff3cc);
  border: 2px solid #ffc107;
  border-radius: 16px;
  padding: 16px;
  position: relative;
  overflow: hidden;
  margin-bottom: 4px;
}
.best-deal-card::before {
  content: '🏆 全网最低价';
  position: absolute;
  top: 0;
  right: 0;
  background: #ffc107;
  color: #7b5a00;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-bottom-left-radius: 10px;
}
.bd-row1 {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 6px;
}
.bd-img {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  object-fit: cover;
  background: #f0f0f0;
  flex-shrink: 0;
}
.bd-img-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  background: linear-gradient(135deg, #e8f0fe, #c5cae9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  flex-shrink: 0;
}
.bd-info { flex: 1; min-width: 0; }
.bd-name {
  font-size: 15px;
  font-weight: 600;
  color: #222;
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bd-spec { font-size: 12px; color: #888; margin-bottom: 8px; }
.bd-price-row { display: flex; align-items: baseline; gap: 6px; }
.bd-price {
  font-size: 26px;
  font-weight: 800;
  color: #e53935;
}
.bd-price-unit { font-size: 14px; color: #e53935; font-weight: 600; }
.bd-origin {
  font-size: 13px;
  color: #bbb;
  text-decoration: line-through;
}
.bd-row2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  gap: 10px;
}
.bd-store-badge {
  display: flex;
  align-items: center;
  gap: 6px;
}
.bd-store-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.bd-store-name { font-size: 13px; color: #555; font-weight: 500; }
.bd-buy-btn {
  background: linear-gradient(135deg, #e53935, #c62828);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  border-radius: 22px;
  padding: 10px 22px;
  box-shadow: 0 3px 10px rgba(229,57,53,.4);
  transition: opacity .15s;
  white-space: nowrap;
}
.bd-buy-btn:active { opacity: .8; }

/* All results */
.all-results { padding: 12px 16px; }

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: #444;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-title::before {
  content: '';
  width: 4px;
  height: 16px;
  background: #1565c0;
  border-radius: 2px;
}

.result-card {
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: transform .15s;
}
.result-card:active { transform: scale(.99); }
.rc-img-wrap {
  position: relative;
  flex-shrink: 0;
}
.rc-img {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  background: #f5f5f5;
}
.rc-img-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}
.rc-store-badge {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #fff;
  font-weight: 700;
  border-radius: 8px;
  padding: 1px 6px;
  white-space: nowrap;
}
.rc-info { flex: 1; min-width: 0; }
.rc-name {
  font-size: 14px;
  font-weight: 500;
  color: #222;
  line-height: 1.4;
  margin-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rc-spec { font-size: 11px; color: #999; margin-bottom: 6px; }
.rc-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.rc-rating { font-size: 11px; color: #ff8c00; }
.rc-sales { font-size: 11px; color: #999; }
.rc-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.rc-price-wrap { display: flex; align-items: baseline; gap: 4px; }
.rc-price {
  font-size: 20px;
  font-weight: 800;
  color: #e53935;
}
.rc-price-unit { font-size: 12px; color: #e53935; font-weight: 600; }
.rc-origin { font-size: 12px; color: #ccc; text-decoration: line-through; }
.rc-btn {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  border-radius: 18px;
  padding: 7px 16px;
  transition: opacity .15s;
}
.rc-btn:active { opacity: .8; }

/* Lowest tag */
.lowest-tag {
  font-size: 10px;
  background: #ffebee;
  color: #e53935;
  border-radius: 6px;
  padding: 2px 6px;
  font-weight: 600;
  margin-left: 4px;
}

/* ===========================
   Empty Page
=========================== */
.empty-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  padding: 40px 20px;
}
.empty-inner { text-align: center; }
.empty-icon { font-size: 56px; margin-bottom: 16px; }
.empty-title { font-size: 17px; font-weight: 600; color: #444; margin-bottom: 8px; }
.empty-desc { font-size: 14px; color: #888; line-height: 1.6; margin-bottom: 24px; }
.retry-btn {
  background: #1565c0;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border-radius: 22px;
  padding: 12px 32px;
}

/* ===========================
   Footer
=========================== */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: #bbb;
  background: #fff;
  border-top: 1px solid #eee;
  padding: 8px 16px;
  z-index: 50;
}

/* ===========================
   Disclaimer
=========================== */
.disclaimer {
  margin: 4px 16px 16px;
  background: #fff8e1;
  border-radius: 10px;
  padding: 10px 14px;
}
.disclaimer p { font-size: 11px; color: #888; line-height: 1.6; }

/* ===========================
   Modal
=========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
}
.modal-box {
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 28px 24px 36px;
  width: 100%;
  text-align: center;
}
.modal-icon { font-size: 44px; margin-bottom: 12px; }
.modal-title { font-size: 18px; font-weight: 700; color: #222; margin-bottom: 10px; }
.modal-desc { font-size: 14px; color: #666; line-height: 1.7; margin-bottom: 24px; }
.modal-btns { display: flex; gap: 12px; }
.modal-cancel {
  flex: 1;
  height: 46px;
  border-radius: 23px;
  background: #f4f6fb;
  color: #666;
  font-size: 15px;
  font-weight: 500;
}
.modal-confirm {
  flex: 1;
  height: 46px;
  border-radius: 23px;
  background: linear-gradient(135deg, #1565c0, #0d47a1);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

/* ===========================
   Toast
=========================== */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.8);
  background: rgba(0,0,0,.75);
  color: #fff;
  font-size: 14px;
  padding: 12px 24px;
  border-radius: 10px;
  z-index: 999;
  pointer-events: none;
  opacity: 0;
  transition: all .25s;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ===========================
   Price compare bar
=========================== */
.compare-bar-wrap {
  background: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.compare-bar-title {
  font-size: 13px;
  font-weight: 600;
  color: #444;
  margin-bottom: 12px;
}
.compare-bar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.cb-store {
  font-size: 12px;
  color: #555;
  width: 60px;
  flex-shrink: 0;
}
.cb-track {
  flex: 1;
  height: 8px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
}
.cb-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s ease;
}
.cb-price {
  font-size: 13px;
  font-weight: 700;
  color: #e53935;
  width: 50px;
  text-align: right;
  flex-shrink: 0;
}
.cb-no { font-size: 11px; color: #ccc; }

/* ===========================
   Responsive
=========================== */
@media (min-width: 480px) {
  .platform-grid { grid-template-columns: 1fr 1fr 1fr 1fr; }
  .header { padding: 14px 24px 12px; }
  .welcome-page, .result-page { max-width: 540px; margin: 0 auto; }
}
