:root {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #1c1c1e;
  background: #f2f2f7;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --blue: #007aff;
  --blue-pressed: #0062cc;
  --label: #1c1c1e;
  --secondary: #6e6e73;
  --tertiary: #8e8e93;
  --fill: #f2f2f7;
  --fill-strong: #e9e9ef;
  --divider: rgba(60, 60, 67, 0.16);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: #f2f2f7; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f2f2f7; }
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(0, 122, 255, 0.28); outline-offset: 2px; }
body.modal-open { overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); }

.app-shell { width: min(100%, 720px); min-height: 100vh; margin: 0 auto; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.04), 0 24px 70px rgba(0,0,0,.08); }
.top-bar { position: sticky; top: 0; z-index: 5; background: rgba(255,255,255,.93); backdrop-filter: saturate(180%) blur(22px); border-bottom: 1px solid var(--divider); }
.top-bar-inner { padding: calc(18px + env(safe-area-inset-top, 0px)) 20px 14px; }
.top-bar h1 { margin: 0; font-size: 30px; line-height: 1.15; letter-spacing: -.035em; font-weight: 760; }
.top-bar h1 + p { margin: 5px 0 18px; color: var(--secondary); font-size: 14px; line-height: 1.4; }

.search-field { height: 46px; display: flex; align-items: center; gap: 9px; padding: 0 13px; border-radius: 13px; color: var(--tertiary); background: var(--fill); }
.search-field input { min-width: 0; flex: 1; border: 0; outline: none; color: var(--label); background: transparent; font-size: 16px; line-height: 1; }
.search-field input::placeholder { color: var(--tertiary); }
.clear-search { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; color: white; background: #a7a7ac; border: 0; border-radius: 50%; }

.result-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 17px 0 12px; }
.result-toolbar p { display: flex; align-items: baseline; gap: 5px; margin: 0; }
.result-toolbar p strong { font-size: 20px; letter-spacing: -.02em; }
.result-toolbar p span { color: var(--secondary); font-size: 13px; }
.toolbar-actions { display: flex; align-items: center; gap: 8px; }
.sort-select select { height: 38px; max-width: 142px; padding: 0 26px 0 10px; border: 0; color: var(--secondary); background: transparent; font-size: 13px; appearance: auto; }
.filter-button { position: relative; height: 38px; display: flex; align-items: center; gap: 6px; padding: 0 12px; border: 0; border-radius: 11px; color: var(--label); background: var(--fill); font-size: 14px; font-weight: 600; }
.filter-button b { display: grid; place-items: center; min-width: 18px; height: 18px; margin-right: -5px; padding: 0 5px; border-radius: 9px; color: white; background: var(--blue); font-size: 11px; }

/* 主筛选按钮：加大、醒目、居中 */
.filter-cta-row { display: flex; justify-content: center; margin: 16px 0 0; }
.filter-cta { position: relative; width: min(100%, 320px); height: 56px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 26px; border: 0; border-radius: 17px; color: #fff; background: linear-gradient(180deg, #3492ff 0%, #007aff 100%); font-size: 18px; font-weight: 700; letter-spacing: .02em; box-shadow: 0 10px 24px rgba(0,122,255,.30), 0 2px 6px rgba(0,122,255,.18); transition: transform .12s ease, box-shadow .18s ease, background .18s ease; }
.filter-cta svg { flex: 0 0 auto; }
.filter-cta:active { transform: translateY(1px); background: linear-gradient(180deg, #1f83e8 0%, #0062cc 100%); box-shadow: 0 5px 14px rgba(0,122,255,.28); }
.filter-cta b { display: grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 13px; color: var(--blue); background: #fff; font-size: 14px; font-weight: 800; }

.segment { display: grid; grid-template-columns: repeat(3, 1fr); padding: 2px; border-radius: 11px; background: var(--fill-strong); }
.segment button { height: 36px; border: 0; border-radius: 9px; color: #3a3a3c; background: transparent; font-size: 14px; font-weight: 550; transition: background .18s ease, color .18s ease, box-shadow .18s ease; }
.segment button.selected { color: white; background: var(--blue); box-shadow: 0 2px 7px rgba(0,122,255,.24); }

.active-filters { display: flex; gap: 7px; margin: 12px -20px -2px; padding: 0 20px 2px; overflow-x: auto; scrollbar-width: none; }
.active-filters::-webkit-scrollbar { display: none; }
.active-filters button { height: 32px; display: flex; align-items: center; gap: 5px; flex: 0 0 auto; padding: 0 10px; border: 0; border-radius: 16px; color: var(--blue); background: rgba(0,122,255,.1); font-size: 12px; font-weight: 600; }

.results { padding: 0 20px; }
.product-row { width: 100%; display: grid; grid-template-columns: 50px minmax(0,1fr) 20px; align-items: center; gap: 13px; padding: 17px 0; text-align: left; color: inherit; background: white; border: 0; border-bottom: 1px solid var(--divider); cursor: pointer; }
.product-row:active { opacity: .58; }
.brand-mark { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 13px; color: #55555a; background: linear-gradient(145deg,#f7f7fa,#e8e8ee); border: 1px solid rgba(60,60,67,.08); font-size: 19px; font-weight: 700; }
.product-main { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.product-name { width: 100%; overflow: hidden; color: var(--label); font-size: 16px; line-height: 1.35; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.product-brand { width: 100%; margin-top: 3px; overflow: hidden; color: var(--secondary); font-size: 12px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.tag-line { display: flex; gap: 5px; margin-top: 8px; }
.tag-line span { padding: 3px 7px; border-radius: 6px; color: #5c5c61; background: var(--fill); font-size: 11px; line-height: 1.25; }
.price-line { display: flex; align-items: baseline; gap: 11px; margin-top: 9px; }
.price-line strong { color: var(--label); font-size: 16px; line-height: 1; letter-spacing: -.01em; }
.price-line span { color: var(--tertiary); font-size: 12px; }
.row-chevron { color: #b0b0b5; }
.catalog-note { margin: 0; padding: 22px 20px calc(30px + var(--safe-bottom)); color: var(--tertiary); background: white; text-align: center; font-size: 11px; }

.empty-state { display: flex; min-height: 48vh; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; color: var(--tertiary); text-align: center; }
.empty-state h2 { margin: 14px 0 4px; color: var(--label); font-size: 18px; }
.empty-state p { margin: 0; font-size: 14px; }
.empty-state button { margin-top: 20px; padding: 10px 16px; color: var(--blue); background: rgba(0,122,255,.09); border: 0; border-radius: 10px; font-size: 14px; font-weight: 600; }

.modal-layer { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.36); animation: fade-in .2s ease both; }
.sheet { width: min(100%, 720px); max-height: min(91vh, 900px); display: flex; flex-direction: column; overflow: hidden; background: white; border-radius: 22px 22px 0 0; box-shadow: 0 -20px 60px rgba(0,0,0,.15); animation: sheet-up .28s cubic-bezier(.22,.8,.26,1) both; }
.grabber { width: 38px; height: 5px; flex: 0 0 auto; margin: 8px auto 0; border-radius: 3px; background: #d1d1d6; }
.sheet-header { min-height: 62px; display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; padding: 8px 20px 7px; border-bottom: 1px solid var(--divider); }
.sheet-header h2 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; padding: 0; color: #56565c; background: var(--fill); border: 0; border-radius: 19px; }
.filter-scroll, .detail-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.filter-scroll { padding: 4px 20px 24px; }
.filter-group { margin: 20px 0 0; padding: 0; border: 0; min-width: 0; }
.filter-group legend { padding: 0; color: var(--label); font-size: 15px; font-weight: 700; }
.filter-group legend span { color: var(--tertiary); font-size: 12px; font-weight: 400; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.chip { min-height: 36px; padding: 7px 13px; border: 0; border-radius: 10px; color: #4d4d52; background: var(--fill); font-size: 13px; transition: .15s ease; }
.chip.active { color: white; background: var(--blue); box-shadow: 0 2px 7px rgba(0,122,255,.2); }
.price-range { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 9px; margin-top: 11px; }
.price-range label { height: 46px; display: flex; align-items: center; gap: 5px; padding: 0 12px; border: 1px solid var(--divider); border-radius: 11px; }
.price-range span { color: var(--secondary); }
.price-range input { min-width: 0; width: 100%; padding: 0; border: 0; outline: 0; background: transparent; font-size: 14px; }
.price-range i { color: var(--tertiary); font-style: normal; }
.sheet-actions { display: grid; grid-template-columns: minmax(105px,.65fr) 1.6fr; gap: 10px; flex: 0 0 auto; padding: 12px 20px calc(12px + var(--safe-bottom)); border-top: 1px solid var(--divider); background: rgba(255,255,255,.96); }
.sheet-actions button { height: 50px; border: 0; border-radius: 13px; font-size: 16px; font-weight: 650; }
.secondary-button { color: var(--blue); background: rgba(0,122,255,.09); }
.primary-button { color: white; background: var(--blue); }
.primary-button:active { background: var(--blue-pressed); }

.detail-heading { align-items: flex-start; padding-top: 10px; }
.detail-heading div { min-width: 0; padding: 2px 14px 4px 0; }
.detail-heading p { margin: 0 0 3px; color: var(--secondary); font-size: 12px; }
.detail-heading h2 { font-size: 20px; line-height: 1.32; }
.detail-scroll { padding: 0 20px 18px; }
.detail-price { display: flex; align-items: baseline; gap: 12px; padding: 18px 0; }
.detail-price strong { font-size: 23px; letter-spacing: -.02em; }
.detail-price span { color: var(--tertiary); font-size: 13px; }
.detail-list { margin: 0; border-top: 1px solid var(--divider); }
.detail-list div { display: grid; grid-template-columns: 92px 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--divider); }
.detail-list dt { color: var(--tertiary); font-size: 13px; }
.detail-list dd { margin: 0; color: var(--label); font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.source-note { margin: 16px 0 0; color: var(--tertiary); font-size: 11px; }
.detail-actions { display: grid; gap: 8px; flex: 0 0 auto; padding: 10px 20px calc(12px + var(--safe-bottom)); border-top: 1px solid var(--divider); background: white; }
.detail-actions button { height: 48px; display: flex; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 12px; color: var(--blue); background: rgba(0,122,255,.09); font-size: 15px; font-weight: 650; }
.detail-actions button:disabled { color: #a7a7ac; background: var(--fill); }
.copy-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.copy-pair button { font-size: 13px; gap: 5px; }
.copy-pair svg { width: 17px; height: 17px; flex-shrink: 0; }
.loading-message { margin: 0; padding: 40px 20px; color: var(--secondary); text-align: center; }
.product-row > svg { color: #a7a7ac; }
.icon-button { flex-shrink: 0; }

.toast { position: fixed; left: 50%; bottom: calc(26px + var(--safe-bottom)); z-index: 40; display: flex; align-items: center; gap: 9px; padding: 12px 17px; color: white; background: rgba(28,28,30,.92); border-radius: 13px; box-shadow: 0 8px 28px rgba(0,0,0,.22); font-size: 14px; font-weight: 600; transform: translateX(-50%); white-space: nowrap; animation: toast-in .22s ease both; }
.toast svg { color: #34c759; }

@keyframes fade-in { from { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(45px); opacity: .65; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%,12px) scale(.96); } }

@media (min-width: 721px) {
  body { padding: 24px 0; }
  .app-shell { min-height: calc(100vh - 48px); border-radius: 22px; overflow: clip; }
  .top-bar { top: 24px; }
  .sheet { margin-bottom: 24px; border-radius: 22px; }
  .product-row { grid-template-columns: 54px minmax(0,1fr) 20px; }
}

@media (max-width: 390px) {
  .top-bar-inner, .results, .filter-scroll, .detail-scroll { padding-left: 16px; padding-right: 16px; }
  .active-filters { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
  .top-bar h1 { font-size: 28px; }
  .sort-select select { max-width: 120px; }
  .filter-cta { height: 54px; font-size: 17px; }
  .product-row { grid-template-columns: 46px minmax(0,1fr) 18px; gap: 11px; }
  .brand-mark { width: 46px; height: 46px; }
}

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