:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --ink: #111318;
  --muted: #6f7480;
  --line: #e5e7eb;
  --accent: #e13b2f;
  --accent-dark: #b8231b;
  --good: #137a52;
  --warm: #fff3e8;
  --shadow: 0 12px 36px rgba(17, 19, 24, .08);
  --radius: 24px;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.app-shell { width: min(100%, 720px); margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 16px 120px; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 6px 4px 18px; }
.eyebrow, .mini-label { font-size: 10px; letter-spacing: .18em; font-weight: 800; color: #8b9099; }
h1 { font-size: 24px; line-height: 1.1; margin: 5px 0 0; letter-spacing: -.04em; }
.status-dot { width: 38px; height: 38px; border-radius: 50%; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; box-shadow: 0 4px 14px rgba(0,0,0,.04); }
.status-dot span { width: 9px; height: 9px; border-radius: 50%; background: #b7bac1; box-shadow: 0 0 0 5px rgba(183,186,193,.14); }
.status-dot.online span { background: var(--good); box-shadow: 0 0 0 5px rgba(19,122,82,.12); }
.hero-card { background: var(--ink); color: #fff; border-radius: 30px; padding: 26px 22px 20px; box-shadow: var(--shadow); overflow: hidden; position: relative; }
.hero-card::after { content: ""; position: absolute; width: 210px; height: 210px; right: -110px; top: -95px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; box-shadow: 0 0 0 35px rgba(255,255,255,.025), 0 0 0 70px rgba(255,255,255,.018); pointer-events: none; }
.hero-kicker { margin: 0 0 7px; color: #aeb2bb; font-size: 13px; font-weight: 700; }
.hero-copy h2 { margin: 0; font-size: clamp(31px, 8vw, 42px); line-height: 1.08; letter-spacing: -.055em; font-weight: 700; }
.hero-copy h2 strong { color: #ff6457; font-weight: 800; }
.hero-copy > p:last-child { color: #b8bbc2; line-height: 1.65; font-size: 14px; margin: 14px 0 20px; max-width: 460px; }
.camera-button { width: 100%; min-height: 74px; border: 0; border-radius: 19px; background: #fff; color: var(--ink); padding: 12px 16px; display: grid; grid-template-columns: 46px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left; font-weight: 850; font-size: 19px; cursor: pointer; position: relative; z-index: 1; }
.camera-button:active { transform: scale(.992); }
.camera-button small { grid-column: 2; color: #8a8e97; font-size: 12px; font-weight: 600; margin-top: 2px; }
.camera-icon { grid-row: 1 / span 2; width: 46px; height: 46px; display: grid; place-items: center; background: var(--accent); color: #fff; border-radius: 14px; font-size: 32px; line-height: 1; transform: rotate(-10deg); }
.gallery-button { width: 100%; margin-top: 9px; border: 0; background: transparent; color: #d1d4da; padding: 11px; font-size: 13px; font-weight: 700; cursor: pointer; position: relative; z-index: 1; }
.stats-row { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin: 11px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px 15px; min-height: 72px; }
.stat span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 7px; }
.stat strong { font-size: 20px; letter-spacing: -.03em; }
.stat small { color: var(--muted); font-size: 11px; margin-left: 3px; }
.stat-wide strong { font-size: 14px; font-weight: 750; }
.manual-search { margin: 20px 2px 16px; }
.manual-search label { display: block; font-size: 12px; color: var(--muted); font-weight: 700; margin: 0 0 8px 2px; }
.search-box { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.search-box input { min-width: 0; height: 52px; border: 1px solid #dcdfe4; background: var(--card); border-radius: 16px; padding: 0 15px; outline: none; color: var(--ink); box-shadow: 0 3px 12px rgba(0,0,0,.02); }
.search-box input:focus { border-color: #9ca1aa; box-shadow: 0 0 0 3px rgba(17,19,24,.06); }
.search-box button { border: 0; border-radius: 16px; background: var(--ink); color: #fff; font-weight: 800; padding: 0 18px; cursor: pointer; }
.scan-panel { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 10px; display: grid; grid-template-columns: 92px 1fr; gap: 14px; align-items: center; box-shadow: var(--shadow); margin: 12px 0; }
.preview-wrap { width: 92px; height: 92px; border-radius: 15px; overflow: hidden; position: relative; background: #eceef1; }
.preview-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-line { position: absolute; left: 7px; right: 7px; height: 2px; background: #ff5145; box-shadow: 0 0 11px rgba(255,81,69,.8); animation: scan 1.65s ease-in-out infinite; }
@keyframes scan { 0%, 100% { top: 12px; opacity: .4; } 50% { top: 78px; opacity: 1; } }
.scan-copy { min-width: 0; display: grid; gap: 5px; }
.scan-copy strong { font-size: 16px; }
.scan-copy span { color: var(--muted); font-size: 12px; line-height: 1.5; }
.analysis-panel { margin: 22px 0 8px; }
.section-title-row { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 0 2px 10px; }
.section-title-row h3 { margin: 2px 0 0; font-size: 18px; letter-spacing: -.03em; }
.text-button { border: 0; background: transparent; color: var(--accent-dark); font-size: 12px; font-weight: 800; cursor: pointer; padding: 6px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 8px 11px; font-size: 12px; color: #4b5059; }
.chip strong { color: var(--ink); }
.results-section { margin-top: 24px; }
.result-count { color: var(--muted); font-size: 12px; }
.results-list { display: grid; gap: 11px; }
.product-card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 11px; display: grid; grid-template-columns: 118px 1fr; gap: 13px; box-shadow: 0 6px 18px rgba(17,19,24,.045); position: relative; overflow: hidden; }
.product-card.best { border-color: rgba(19,122,82,.28); box-shadow: 0 8px 24px rgba(19,122,82,.08); }
.product-image { width: 118px; height: 118px; border-radius: 15px; background: #f0f1f3; object-fit: cover; }
.product-main { min-width: 0; padding: 2px 2px 2px 0; }
.match-row { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.match-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 850; border-radius: 999px; padding: 5px 8px; color: var(--good); background: rgba(19,122,82,.08); }
.match-badge.low { color: #9a5a17; background: #fff1dd; }
.product-title { margin: 0 0 7px; font-size: 14px; line-height: 1.45; font-weight: 800; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.model-line { color: var(--muted); font-size: 11px; min-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.price-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px; margin-top: 8px; }
.price { color: var(--accent); font-size: 22px; line-height: 1; font-weight: 900; letter-spacing: -.04em; }
.compare-price { color: #a4a7ae; font-size: 11px; text-decoration: line-through; }
.product-link { display: inline-flex; margin-top: 9px; color: #4f5560; font-size: 11px; font-weight: 750; text-decoration: none; }
.product-link::after { content: " ↗"; }
.empty-state { color: #969aa3; text-align: center; padding: 34px 16px 28px; }
.empty-state .empty-icon { width: 48px; height: 48px; margin: 0 auto 10px; border-radius: 50%; border: 1px solid #d7d9de; display: grid; place-items: center; font-size: 22px; }
.empty-state strong { display: block; color: #696e77; font-size: 14px; }
.empty-state p { font-size: 12px; line-height: 1.65; }
.bottom-action { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; padding: 10px 16px max(10px, env(safe-area-inset-bottom)); background: linear-gradient(to top, rgba(243,244,246,1) 65%, rgba(243,244,246,0)); }
.bottom-action button { display: block; width: min(100%, 688px); margin: 0 auto; height: 56px; border: 0; border-radius: 18px; background: var(--ink); color: #fff; font-weight: 850; box-shadow: 0 10px 30px rgba(17,19,24,.2); cursor: pointer; }
.toast { position: fixed; left: 50%; bottom: 92px; transform: translate(-50%, 14px); background: rgba(17,19,24,.94); color: #fff; border-radius: 12px; padding: 10px 14px; font-size: 12px; opacity: 0; pointer-events: none; transition: .22s ease; z-index: 50; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.hidden { display: none !important; }
@media (max-width: 410px) {
  .app-shell { padding-left: 12px; padding-right: 12px; }
  .hero-card { border-radius: 25px; padding: 23px 18px 18px; }
  .product-card { grid-template-columns: 104px 1fr; }
  .product-image { width: 104px; height: 112px; }
  .price { font-size: 20px; }
}
