:root {
  --paper: #f7f8f3;
  --ink: #12231c;
  --muted: #66716c;
  --line: #d8ded8;
  --acid: #ddff3d;
  --acid-strong: #c8ed19;
  --mint: #dff4e8;
  --white: #ffffff;
  --danger: #b84331;
  --shadow: 0 16px 44px rgba(18, 35, 28, 0.08);
  --radius: 6px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "PingFang SC", sans-serif;
  letter-spacing: 0;
}

button, input { font: inherit; }
button { color: inherit; }

button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid rgba(18, 35, 28, 0.35);
  outline-offset: 3px;
}

.topbar {
  height: 68px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 248, 243, 0.94);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--acid);
  border-radius: 4px;
  font-family: SimHei, sans-serif;
}

.topbar-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.saved-button, .reset-button {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.saved-button > span:first-child { font-size: 21px; }
.saved-count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--acid);
  font-size: 11px;
}

.app-shell {
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: minmax(330px, 0.78fr) minmax(620px, 1.5fr);
}

.control-panel {
  padding: clamp(34px, 5vw, 72px) clamp(28px, 4vw, 64px);
  border-right: 1px solid var(--line);
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 28px,
    var(--paper);
}

.panel-heading { max-width: 480px; }
.eyebrow {
  margin: 0 0 12px;
  font-family: Consolas, "Microsoft YaHei UI", monospace;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: #4f655b;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 16px;
  font-family: SimHei, "Microsoft YaHei UI", sans-serif;
  font-size: clamp(38px, 4.2vw, 62px);
  line-height: 1.05;
  font-weight: 900;
}

h1 span {
  display: inline-block;
  padding: 2px 7px 5px;
  background: var(--acid);
  transform: rotate(-1deg);
}

.intro {
  max-width: 410px;
  margin-bottom: 38px;
  color: var(--muted);
  line-height: 1.7;
  font-size: 14px;
}

.demand-search {
  max-width: 430px;
  margin: 0 0 34px;
  padding: 14px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--white);
}
.demand-search label { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 900; }
.demand-search-row { display: flex; gap: 7px; }
.demand-search input {
  min-width: 0;
  flex: 1;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-size: 12px;
}
.demand-search input::placeholder { color: #8b9790; }
.demand-search button {
  width: 40px;
  height: 38px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--acid);
  cursor: pointer;
  font-size: 19px;
  font-weight: 900;
}
.demand-search small { display: block; margin-top: 8px; color: var(--muted); font-size: 10px; }

fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
.control-group { margin-top: 30px; }
.control-group legend {
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 900;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 290px;
  padding: 4px;
  background: #e6ebe6;
  border-radius: var(--radius);
}

.segment {
  height: 40px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.segment.active { background: var(--white); box-shadow: 0 2px 8px rgba(18, 35, 28, 0.08); }

.major-group > label { display: block; margin-bottom: 12px; font-size: 13px; font-weight: 900; }
.major-input {
  width: 100%;
  min-height: 42px;
  padding: 0 38px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}
.major-input:focus-visible { outline: 3px solid rgba(18, 35, 28, 0.35); outline-offset: 3px; }
.major-hint { display: block; margin-top: 8px; color: var(--muted); font-size: 10px; line-height: 1.45; }

.group-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.group-label-row output { font-family: Consolas, monospace; font-size: 15px; font-weight: 900; white-space: nowrap; }

.range-wrap { height: 32px; position: relative; margin-top: 4px; }
.range-track {
  position: absolute;
  top: 14px;
  left: 0;
  right: 0;
  height: 5px;
  background: #d7ded8;
  border-radius: 4px;
}
.range-fill { position: absolute; height: 100%; background: var(--ink); border-radius: 4px; }
.range-wrap input[type="range"] {
  position: absolute;
  width: 100%;
  height: 32px;
  margin: 0;
  background: transparent;
  pointer-events: none;
  appearance: none;
}
.range-wrap input[type="range"]::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  border: 4px solid var(--ink);
  border-radius: 50%;
  background: var(--acid);
  appearance: none;
  cursor: grab;
  pointer-events: auto;
}
.range-wrap input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 4px solid var(--ink);
  border-radius: 50%;
  background: var(--acid);
  cursor: grab;
  pointer-events: auto;
}
.range-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice {
  min-height: 64px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.56);
  text-align: left;
  cursor: pointer;
}
.choice b, .choice small { display: block; }
.choice b { margin-bottom: 5px; font-size: 13px; }
.choice small { color: var(--muted); font-size: 10px; }
.choice.active { border-color: var(--ink); background: var(--ink); color: var(--white); }
.choice.active small { color: #b8c3bd; }

.preference-row { display: flex; gap: 8px; }
.preference-row button {
  flex: 1;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--white);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}
.preference-row button.active { border-color: var(--acid-strong); background: var(--acid); }

.results-panel { padding: clamp(34px, 5vw, 72px) clamp(28px, 5vw, 76px); background: var(--white); }
.results-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.results-head h2 { max-width: 620px; margin: 0; font-size: clamp(25px, 3vw, 40px); line-height: 1.15; }
.results-actions { display: flex; align-items: center; gap: 16px; white-space: nowrap; }
.web-search-button { color: var(--ink); font-size: 11px; font-weight: 900; text-decoration: none; }
.web-search-button:hover { color: #547264; }
.web-search-button span { color: #3b7a57; font-size: 16px; }
.reset-button { padding: 8px 0; color: var(--muted); font-size: 12px; }
.reset-button span { font-size: 18px; }

.match-note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 22px 0 16px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: Consolas, monospace;
  font-size: 11px;
}
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: #35a866; box-shadow: 0 0 0 4px #def4e7; }
.price-status { margin: -7px 0 16px; color: var(--muted); font: 10px Consolas, monospace; }

.product-list { display: grid; gap: 10px; }
.all-models-search {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 17px 2px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
.all-models-search:hover strong { text-decoration: underline; text-underline-offset: 4px; }
.all-models-search strong, .all-models-search small { display: block; }
.all-models-search strong { font-size: 13px; }
.all-models-search small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.all-models-search-arrow { color: #3b7a57; font-size: 22px; }
.empty-results {
  min-height: 300px;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 32px;
  border: 1px dashed #aeb9b2;
  border-radius: var(--radius);
  background: #f7faf7;
  text-align: center;
}
.empty-results strong { font-size: 17px; }
.empty-results span { color: var(--muted); font-size: 12px; }
.product-card {
  min-height: 146px;
  display: grid;
  grid-template-columns: 168px 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 12px 16px 12px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
.product-card:hover { transform: translateY(-2px); border-color: #9ca9a1; box-shadow: var(--shadow); }
.product-image {
  width: 168px;
  height: 120px;
  object-fit: cover;
  border-radius: 4px;
  background: #edf0ed;
  filter: saturate(0.82) contrast(1.04);
}
.product-copy { min-width: 0; }
.product-kicker { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; color: var(--muted); font: 10px Consolas, monospace; }
.rank { padding: 3px 6px; background: var(--mint); color: var(--ink); border-radius: 3px; font-weight: 900; }
.profile-tag { padding: 3px 6px; border: 1px solid currentColor; border-radius: 3px; font-weight: 900; }
.profile-tag.light { color: #26735a; background: #e8f5ed; }
.profile-tag.balanced { color: #596b3d; background: #f0f4df; }
.profile-tag.power { color: #9b4b2d; background: #fff0e8; }
.product-copy h3 { margin: 0 0 8px; font-size: 18px; }
.product-reason { margin: 0 0 10px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.specs { display: flex; flex-wrap: wrap; gap: 6px; }
.specs span { padding-right: 7px; border-right: 1px solid var(--line); color: #3b4d44; font-size: 10px; }
.specs span:last-child { border-right: 0; }
.web-sources { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.web-sources b { padding: 3px 6px; border-radius: 3px; background: var(--acid); font-size: 9px; }
.web-sources a { color: #486358; font-size: 9px; text-decoration: underline; text-underline-offset: 2px; }
.web-sources a:hover { color: var(--ink); }
.product-price { min-width: 105px; text-align: right; }
.price { display: block; font: 900 20px Consolas, monospace; }
.price-label { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.price-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 13px; }
.product-search { color: var(--muted); font-size: 10px; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.product-search:hover { color: var(--ink); }
.save-product {
  width: 34px;
  height: 34px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
}
.save-product.saved { border-color: var(--ink); background: var(--ink); color: var(--acid); }

.result-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 28px;
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.result-footer strong, .result-footer span { display: block; }
.result-footer strong { margin-bottom: 4px; font-size: 13px; }
.result-footer span { color: var(--muted); font-size: 10px; }
.primary-button {
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--ink);
  color: var(--white);
  cursor: pointer;
  font-weight: 900;
  white-space: nowrap;
}
.primary-button:hover { background: #294238; }
.primary-button span { display: inline; color: var(--acid); font-size: 18px; margin-left: 10px; }

.summary-dialog {
  width: min(540px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  padding: 34px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  color: var(--ink);
  box-shadow: 0 32px 90px rgba(18,35,28,.25);
}
.summary-dialog::backdrop { background: rgba(18,35,28,.48); backdrop-filter: blur(3px); }
.summary-dialog h2 { font-size: 28px; }
.dialog-close { position: absolute; top: 12px; right: 14px; width: 34px; height: 34px; border: 0; background: transparent; cursor: pointer; font-size: 26px; }
.summary-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 22px; }
.summary-meta span { padding: 5px 8px; border-radius: 3px; background: #edf1ed; font-size: 11px; font-weight: 800; }
.summary-dialog ol { margin: 0 0 24px; padding-left: 22px; }
.summary-dialog li { padding: 10px 0; border-bottom: 1px solid var(--line); line-height: 1.5; }
.summary-dialog li strong { display: block; font-size: 14px; }
.summary-dialog li span { color: var(--muted); font-size: 11px; }
.wide { width: 100%; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 50;
  padding: 11px 16px;
  border-radius: 4px;
  background: var(--ink);
  color: var(--white);
  font-size: 12px;
  font-weight: 800;
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: 180ms ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .control-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .panel-heading { max-width: 640px; }
  .intro { max-width: 580px; }
  #pickerForm { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
  .compact-group { grid-column: 1 / -1; }
}

@media (max-width: 650px) {
  .topbar { height: 60px; grid-template-columns: 1fr auto; padding: 0 18px; }
  .topbar-note { display: none; }
  .saved-button { font-size: 12px; }
  .app-shell { min-height: calc(100vh - 60px); }
  .control-panel, .results-panel { padding: 32px 18px; }
  h1 { font-size: 40px; }
  h1 span {
    display: inline;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
  }
  #pickerForm { display: block; }
  .results-head { align-items: flex-start; }
  .results-actions { align-items: flex-end; flex-direction: column; gap: 7px; }
  .results-head h2 { font-size: 28px; }
  .product-card { grid-template-columns: minmax(82px, 96px) minmax(0, 1fr); gap: 13px; padding: 10px; }
  .product-image { width: 96px; height: 112px; }
  .product-price { grid-column: 2; display: flex; align-items: center; justify-content: space-between; text-align: left; }
  .price-actions { justify-content: flex-start; }
  .result-footer { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
  .summary-dialog { padding: 28px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
