:root {
  --bg: #f4f5fb;
  --bg-2: #eef0fa;
  --card: #ffffff;
  --text: #1b1f2a;
  --muted: #6b7384;
  --line: #e7e9f2;
  --brand: #6366f1;
  --brand-2: #8b5cf6;
  --brand-3: #ec4899;
  --price: #f43f5e;
  --ok: #10b981;
  --warn: #f59e0b;
  --shadow-sm: 0 1px 2px rgba(24, 28, 45, .05), 0 4px 14px rgba(24, 28, 45, .06);
  --shadow-md: 0 6px 18px rgba(44, 39, 110, .10), 0 18px 40px rgba(44, 39, 110, .08);
  --radius: 16px;
  --radius-lg: 22px;
  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 48%, #ec4899 100%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

html, body {
  margin: 0; padding: 0;
  background:
    radial-gradient(1200px 600px at 12% -8%, #e9e7ff 0%, rgba(233, 231, 255, 0) 60%),
    radial-gradient(1000px 520px at 100% 0%, #ffe9f5 0%, rgba(255, 233, 245, 0) 55%),
    linear-gradient(180deg, #f6f7fc 0%, #eef0fa 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { margin: 0; line-height: 1.35; }
img { -webkit-user-drag: none; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; position: relative; z-index: 1; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------- bg decor */
.bg-decor { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.bg-decor .blob {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5;
  animation: float 18s ease-in-out infinite;
}
.bg-decor .b1 { width: 460px; height: 460px; left: -120px; top: -80px;
  background: radial-gradient(circle at 30% 30%, #a5b4fc, #6366f1); }
.bg-decor .b2 { width: 520px; height: 520px; right: -160px; top: 40px;
  background: radial-gradient(circle at 70% 30%, #f0abfc, #ec4899); animation-delay: -6s; }
.bg-decor .b3 { width: 420px; height: 420px; left: 40%; top: 320px;
  background: radial-gradient(circle at 50% 50%, #c4b5fd, #8b5cf6); opacity: .35; animation-delay: -11s; }
.bg-decor .grid-overlay {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(99, 102, 241, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, .05) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 78%);
}
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(28px, 26px) scale(1.06); }
}

/* ---------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(231, 233, 242, .8);
}
.header-inner {
  display: flex; align-items: center; gap: 18px;
  height: 64px;
  padding-top: env(safe-area-inset-top, 0);
}
.logo { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.logo-mark { font-size: 22px; filter: drop-shadow(0 4px 10px rgba(99, 102, 241, .35)); }
.logo-text { font-size: 19px; font-weight: 800; letter-spacing: -.4px; }
.logo-accent {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}

.search-box { flex: 1; display: flex; max-width: 520px; position: relative; }
.search-box input {
  flex: 1; height: 42px; padding: 0 16px;
  border: 1px solid var(--line); border-right: none;
  border-radius: 12px 0 0 12px;
  background: #fff; color: var(--text); font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search-box input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .12);
}
.search-box button {
  height: 42px; padding: 0 22px; border: none; border-radius: 0 12px 12px 0;
  background: var(--grad); color: #fff; font-size: 14px; font-weight: 600;
  box-shadow: 0 8px 18px rgba(124, 58, 237, .28); transition: filter .15s, transform .15s;
}
.search-box button:hover { filter: brightness(1.06); transform: translateY(-1px); }
.search-box button:active { transform: translateY(0); }

.top-nav { display: flex; align-items: center; gap: 16px; margin-left: auto; flex-shrink: 0; }
.top-nav a { font-size: 14px; color: var(--muted); transition: color .15s; position: relative; padding: 4px 0; }
.top-nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: var(--grad); border-radius: 2px; transform: scaleX(0); transition: transform .18s;
}
.top-nav a:hover, .top-nav a.active { color: var(--brand); }
.top-nav a.active::after { transform: scaleX(1); }
.refresh-btn {
  height: 34px; padding: 0 15px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--muted); font-size: 13px; transition: all .15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.refresh-btn:hover { border-color: var(--brand); color: var(--brand); box-shadow: var(--shadow-sm); }
.refresh-btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------------------------------------------------------- hero */
.hero { padding: 52px 0 30px; text-align: center; position: relative; }
.hero h1 {
  font-size: 40px; font-weight: 800; letter-spacing: -1px; margin-bottom: 14px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 10px 40px rgba(124, 58, 237, .18);
}
.hero > p { color: var(--muted); font-size: 16px; margin: 0 auto 28px; max-width: 640px; }
.hero b { color: var(--brand); font-weight: 700; }

.hero-search {
  display: flex; max-width: 580px; margin: 0 auto 18px;
  box-shadow: 0 14px 40px rgba(99, 102, 241, .22); border-radius: 16px;
  background: #fff;
}
.hero-search input {
  flex: 1; height: 54px; padding: 0 22px;
  border: 1px solid var(--line); border-right: none;
  border-radius: 16px 0 0 16px; font-size: 16px; outline: none; background: #fff;
  transition: border-color .15s;
}
.hero-search input:focus { border-color: var(--brand); }
.hero-search button {
  height: 54px; padding: 0 30px; border: none; border-radius: 0 16px 16px 0;
  background: var(--grad); color: #fff; font-size: 16px; font-weight: 700;
  transition: filter .15s, transform .15s;
}
.hero-search button:hover { filter: brightness(1.07); }
.hero-search button:active { transform: scale(.99); }

.hero-tags { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; margin-bottom: 28px; }
.hero-tags .tag {
  padding: 6px 15px; border-radius: 999px;
  background: rgba(255, 255, 255, .82); border: 1px solid var(--line);
  font-size: 13px; color: var(--muted); transition: all .18s; backdrop-filter: blur(6px);
}
.hero-tags .tag:hover {
  border-color: transparent; color: #fff;
  background: var(--grad); transform: translateY(-2px); box-shadow: 0 8px 18px rgba(124, 58, 237, .25);
}

.hero-stats { display: flex; justify-content: center; gap: 44px; flex-wrap: wrap; }
.stat-item { text-align: center; }
.stat-num {
  font-size: 28px; font-weight: 800; letter-spacing: -.5px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------------------------------------------------------- blocks */
.section-block { margin: 40px 0 64px; position: relative; z-index: 1; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 18px; gap: 12px; flex-wrap: wrap;
}
.section-head h2 {
  font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 10px;
}
.section-head h2::before {
  content: ""; width: 5px; height: 20px; border-radius: 3px; background: var(--grad);
}

.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); gap: 13px; }
.site-card {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 15px; position: relative;
  background: rgba(255, 255, 255, .9); border: 1px solid var(--line); border-radius: 14px;
  transition: all .2s; backdrop-filter: blur(6px);
}
.site-card:hover {
  border-color: transparent; transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(99, 102, 241, .18);
  background: #fff;
}
.site-card:hover .site-go { color: var(--brand-2); transform: translate(2px, -2px); }
.site-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); flex-shrink: 0; box-shadow: 0 0 0 3px rgba(16, 185, 129, .18); }
.site-dot.bad { background: #cbd2e0; box-shadow: 0 0 0 3px rgba(203, 210, 224, .2); }
.site-info { min-width: 0; flex: 1; }
.site-name { font-size: 14px; font-weight: 700; }
.site-host {
  font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block;
}
.site-count {
  font-size: 12px; color: var(--muted); flex-shrink: 0;
  background: var(--bg-2); padding: 2px 8px; border-radius: 999px;
}
.site-go { color: var(--muted); font-size: 15px; flex-shrink: 0; transition: all .18s; }

/* ---------------------------------------------------------- result */
.result-head { padding: 30px 0 16px; position: relative; z-index: 1; }
.result-title { font-size: 24px; font-weight: 800; }
.result-title span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result-head p { margin: 8px 0 0; }

.toolbar {
  background: rgba(255, 255, 255, .92); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 17px; margin-bottom: 20px; box-shadow: var(--shadow-sm); backdrop-filter: blur(8px);
  position: relative; z-index: 1;
}
.tool-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.tool-row + .tool-row { margin-top: 12px; }
.tool-label { font-size: 13px; color: var(--muted); margin-right: 2px; flex-shrink: 0; }
.sort-group, .view-group { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.view-group { margin-left: auto; }

.chip {
  height: 34px; padding: 0 15px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--muted); font-size: 13px;
  transition: all .16s; white-space: nowrap; display: inline-flex; align-items: center;
}
.chip:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); }
.chip.active {
  background: var(--grad); border-color: transparent; color: #fff; font-weight: 600;
  box-shadow: 0 8px 18px rgba(124, 58, 237, .25);
}
.chip.primary-chip { border-color: var(--brand); color: var(--brand); }
.chip.primary-chip:hover { background: var(--brand); color: #fff; }

.filter-group { display: flex; gap: 7px; flex-wrap: wrap; }

.price-input {
  width: 96px; height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px;
  font-size: 13px; outline: none; background: #fff; color: var(--text);
}
.price-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }
.dash { color: var(--muted); }
.check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--brand); width: 16px; height: 16px; }

/* ---------------------------------------------------------- cards */
.result-body { display: flex; flex-direction: column; gap: 11px; position: relative; z-index: 1; }

.goods-card {
  display: flex; align-items: center; gap: 15px;
  padding: 15px 17px;
  background: rgba(255, 255, 255, .92); border: 1px solid var(--line); border-radius: var(--radius);
  transition: all .2s; backdrop-filter: blur(6px);
}
.goods-card:hover {
  border-color: transparent; box-shadow: var(--shadow-md); transform: translateY(-2px); background: #fff;
}

.goods-img {
  width: 60px; height: 60px; flex-shrink: 0;
  border-radius: 14px; background: linear-gradient(135deg, #eef0fa, #fafbff);
  object-fit: cover; border: 1px solid var(--line);
}
.goods-img.img-fail { display: none; }

.goods-main { flex: 1; min-width: 0; }
.goods-title {
  font-size: 15px; font-weight: 700; line-height: 1.5; margin-bottom: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.goods-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.seller-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(99, 102, 241, .12), rgba(236, 72, 153, .12));
  color: var(--brand); font-weight: 700; font-size: 12px;
}
.dot-sep { color: #d3d8e6; }
.stock-out { color: #b4bccb; }
.stock-in { color: var(--ok); font-weight: 600; }

.goods-price { text-align: right; flex-shrink: 0; min-width: 100px; }
.price-num { font-size: 23px; font-weight: 800; color: var(--price); letter-spacing: -.5px;
  text-shadow: 0 4px 14px rgba(244, 63, 94, .16); }
.price-num .yen { font-size: 15px; font-weight: 700; margin-right: 1px; }
.price-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }

.goods-action { flex-shrink: 0; }
.buy-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 20px;
  border-radius: 11px; font-size: 13px; font-weight: 700;
  background: var(--grad); color: #fff;
  box-shadow: 0 8px 18px rgba(124, 58, 237, .28); transition: filter .15s, transform .15s;
}
.buy-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.buy-btn:active { transform: translateY(0); }

/* group mode */
.group-card {
  background: rgba(255, 255, 255, .94); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); backdrop-filter: blur(6px);
}
.group-head { display: flex; align-items: center; gap: 15px; padding: 15px 17px; }
.group-head .goods-main { cursor: pointer; }
.group-name { font-size: 16px; font-weight: 800; }
.group-stats { display: flex; gap: 15px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 5px; }
.group-stats b { color: var(--text); font-weight: 700; }
.group-toggle {
  width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--muted); font-size: 13px; flex-shrink: 0; transition: all .18s;
}
.group-toggle:hover { border-color: var(--brand); color: var(--brand); }
.group-toggle.open { transform: rotate(180deg); background: var(--bg-2); }
.group-body { border-top: 1px solid var(--line); background: rgba(250, 251, 254, .6); display: none; }
.group-body.open { display: block; }
.group-offer {
  display: flex; align-items: center; gap: 15px;
  padding: 12px 17px; border-bottom: 1px solid #eef0f6;
}
.group-offer:last-child { border-bottom: none; }
.group-offer.best { background: linear-gradient(90deg, rgba(244, 63, 94, .06), transparent); }

/* ---------------------------------------------------------- pager removed (single-page) */
.pager { display: none; }

/* ---------------------------------------------------------- states */
.empty {
  text-align: center; padding: 80px 20px; color: var(--muted);
  background: rgba(255, 255, 255, .9); border: 1px solid var(--line); border-radius: var(--radius);
}
.empty-icon { font-size: 44px; margin-bottom: 14px; opacity: .55; }
.empty h3 { font-size: 17px; color: var(--text); margin-bottom: 6px; }

.skeleton { background: rgba(255, 255, 255, .9); border: 1px solid var(--line); border-radius: var(--radius); padding: 17px; }
.sk-line { height: 14px; border-radius: 7px; background: linear-gradient(90deg, #eef0f6 25%, #f6f7fb 50%, #eef0f6 75%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------------------------------------------------------- footer */
.site-footer { border-top: 1px solid var(--line); background: rgba(255, 255, 255, .7);
  padding: 28px 0 calc(28px + env(safe-area-inset-bottom, 0)); margin-top: 44px;
  position: relative; z-index: 1; backdrop-filter: blur(6px); }
.site-footer p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.7; }
.site-footer p + p { margin-top: 6px; }

.toast {
  position: fixed; left: 50%; bottom: calc(40px + env(safe-area-inset-bottom, 0)); transform: translateX(-50%);
  padding: 12px 24px; border-radius: 12px;
  background: rgba(27, 31, 42, .94); color: #fff; font-size: 14px; font-weight: 500;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .22); z-index: 999; animation: toastIn .22s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ---------------------------------------------------------- responsive */
@media (min-width: 1280px) {
  .hero h1 { font-size: 46px; }
  .wrap { padding: 0 28px; }
}
@media (max-width: 1024px) {
  .hero h1 { font-size: 34px; }
}
@media (max-width: 820px) {
  .top-nav a[data-nav] { display: none; }
  .header-inner { gap: 12px; }
  .logo-text { display: none; }
  .hero-stats { gap: 30px; }
  .section-block { margin: 32px 0 48px; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 14px; }
  .site-header { border-radius: 0; }
  .header-inner { height: 56px; }
  .search-box { max-width: none; }
  .search-box input { height: 40px; }
  .search-box button { height: 40px; padding: 0 16px; }
  .refresh-btn { padding: 0 12px; font-size: 12px; }

  .hero { padding: 32px 0 22px; }
  .hero h1 { font-size: 27px; letter-spacing: -.5px; }
  .hero > p { font-size: 14px; margin-bottom: 22px; }
  .hero-search { flex-direction: column; box-shadow: none; background: transparent; border-radius: 0; }
  .hero-search input {
    height: 52px; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm);
    background: #fff;
  }
  .hero-search button { height: 50px; border-radius: 14px; margin-top: 10px; box-shadow: 0 10px 24px rgba(124, 58, 237, .3); }
  .hero-stats { gap: 22px; }
  .stat-num { font-size: 23px; }

  .section-block { margin: 26px 0 40px; }
  .section-head h2 { font-size: 18px; }

  .site-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .site-card { padding: 12px 13px; }
  .site-name { font-size: 13px; }
  .site-go { display: none; }

  .toolbar { padding: 13px 14px; }
  .tool-row { gap: 7px; }
  .view-group { margin-left: 0; width: 100%; }
  .chip { height: 36px; flex: 1 1 auto; justify-content: center; min-width: 64px; }
  .price-input { width: 1fr; flex: 1; min-width: 0; }

  /* 商品卡：图片居左，标题+meta 占满，价格与按钮另起一行 */
  .goods-card { flex-wrap: wrap; gap: 11px; padding: 13px 14px; align-items: flex-start; }
  .goods-img { order: 0; width: 52px; height: 52px; }
  .goods-main { order: 1; flex: 1 1 calc(100% - 70px); }
  .goods-price {
    order: 2; text-align: left; min-width: 0; flex: 0 0 auto;
    display: flex; align-items: baseline; gap: 8px;
  }
  .goods-price::before { content: "售价"; font-size: 12px; color: var(--muted); }
  .goods-action { order: 3; flex: 1 1 100%; }
  .buy-btn { width: 100%; justify-content: center; height: 42px; }

  .group-head { flex-wrap: wrap; }
  .group-toggle { order: 3; }
}
@media (max-width: 380px) {
  .hero h1 { font-size: 24px; }
  .stat-num { font-size: 20px; }
  .site-grid { gap: 8px; }
  .price-num { font-size: 20px; }
}
