:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --line: #e5e7eb;
  --line-2: #f0f1f3;
  --accent: #c0392b;
  --accent-dark: #992d22;
  --accent-soft: #fdf2f0;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 10px 30px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
}

button, input { font: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px max(20px, calc((100vw - 1120px) / 2));
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brandmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.logo {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(145deg, #1f2937, #111827);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  box-shadow: inset 0 -2px 0 rgba(192, 57, 43, 0.95);
}

.brandtext { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brandtext strong { font-size: 15px; font-weight: 700; letter-spacing: 0.01em; }
.brandtext small { color: var(--muted); font-size: 11px; letter-spacing: 0.03em; }

.top-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.rules-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 7px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.rules-btn:hover { border-color: #d1d5db; background: var(--surface-2); color: var(--ink); }

.date-pill {
  padding: 6px 10px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 24px 36px;
}

.hero { max-width: 860px; }

.eyebrow {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  margin-bottom: 8px;
}

h1 {
  margin: 0 0 6px;
  font-size: clamp(24px, 3.4vw, 30px);
  line-height: 1.2;
  letter-spacing: -0.025em;
  font-weight: 750;
}

.sub {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13.5px;
}

.contact-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 10px 0 14px;
  font-size: 13px;
  color: var(--muted);
}

.contact-line a {
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
  letter-spacing: .2px;
  border-bottom: 1px dashed rgba(192, 57, 43, .45);
}

.contact-line a:hover { border-bottom-style: solid; }

.contact-tag {
  margin-left: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .2px;
}

.searchbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 14px;
  background: var(--surface);
  border: 1px solid #d1d5db;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  max-width: 860px;
}

.searchbox:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12);
}

.searchicon {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  fill: none;
  stroke: var(--muted-2);
  stroke-width: 2;
  stroke-linecap: round;
}

#q {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 11px 0;
  font-size: 16px;
  color: var(--ink);
}

#q::placeholder { color: var(--muted-2); }

.searchbox button {
  height: 42px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  padding: 0 20px;
  font-weight: 650;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.searchbox button:hover { background: var(--accent-dark); }

.tabs {
  display: inline-flex;
  max-width: 100%;
  gap: 2px;
  margin-top: 12px;
  padding: 3px;
  background: #eceef1;
  border-radius: 9px;
  overflow-x: auto;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 11px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12.5px;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab:hover { color: var(--ink-2); }
.tab.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

.examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 13px;
  color: var(--muted-2);
  font-size: 12px;
}

.examples button {
  border: 0;
  border-bottom: 1px dashed #d1d5db;
  border-radius: 0;
  background: none;
  color: var(--muted);
  padding: 1px 0;
  cursor: pointer;
  font-size: 12px;
}

.examples button:hover { color: var(--accent); border-bottom-color: var(--accent); }

.status {
  min-height: 22px;
  margin: 24px 0 12px;
  color: var(--muted);
  font-size: 12px;
}

.status .parsed {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 5px;
  background: #f1f3f5;
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 500;
}

.tag.muted { background: #f7f8f9; color: var(--muted); }

.results { display: grid; gap: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  animation: rise 0.2s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line-2);
}

.identity { min-width: 0; }

.brandline {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.brand {
  color: var(--ink-2);
  background: #f1f3f5;
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 11.5px;
  font-weight: 650;
}

.cat-badge {
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.cat-badge[data-cat="environmental"] { background: var(--accent-soft); color: var(--accent-dark); }
.cat-badge[data-cat^="secondhand"] { background: var(--amber-soft); color: var(--amber); }
.cat-badge[data-cat="apple"] { background: #f3f4f6; color: var(--ink-2); }

.variant {
  color: var(--muted);
  font-size: 11.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
}

.model {
  margin: 0;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 720;
}

.config {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.hero-price {
  text-align: right;
  flex: 0 0 auto;
  padding-left: 12px;
}

.hero-price .label {
  color: var(--muted-2);
  font-size: 10.5px;
  letter-spacing: 0.04em;
}

.hero-price .num {
  color: var(--accent-dark);
  font-size: clamp(30px, 5vw, 38px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.hero-price .num small { font-size: 15px; font-weight: 650; margin-right: 2px; }
.hero-price .cond { color: var(--muted); font-size: 11.5px; }

.table-wrap { padding: 0 20px; overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.05em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th:last-child, td:last-child { text-align: right; }

td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: top;
}

tbody tr:nth-child(even):not(.is-top):not(.is-a) { background: #fcfcfd; }
tbody tr:hover { background: #fafafa; }
tr:last-child td { border-bottom: 0; }

td.cond { color: var(--ink-2); }
td.price { font-weight: 650; color: var(--ink); white-space: nowrap; }
td.price .warn { color: var(--amber); margin-left: 4px; }

tr.is-top td, tr.is-a td { background: #fff7f5; }
tr.is-top td.cond, tr.is-a td.cond { font-weight: 650; color: var(--accent-dark); }
tr.is-top td:first-child, tr.is-a td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

.note, .warnbox {
  margin: 12px 20px 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.2px;
  line-height: 1.65;
}

.note { background: var(--surface-2); color: var(--ink-2); }
.warnbox { background: var(--amber-soft); color: var(--amber); border: 1px solid #fde68a; }

.deductions {
  margin: 12px 20px 0;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.deductions summary {
  cursor: pointer;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 650;
  outline: none;
}

.deductions ul { margin: 9px 0 2px; padding-left: 17px; }
.deductions li { margin: 6px 0; font-size: 12.2px; line-height: 1.65; color: var(--ink-2); }
.note-meta { display: block; color: var(--accent-dark); font-weight: 650; font-size: 11px; margin-bottom: 1px; }

.deductions.rules { background: var(--amber-soft); border-color: #fde68a; border-left: 3px solid var(--amber); }
.rule-row { margin-top: 8px; }
.rule-row b { display: block; color: var(--amber); font-size: 11px; margin-bottom: 2px; }
.rule-row p { margin: 0; font-size: 12.2px; line-height: 1.65; color: var(--ink-2); }

.card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 20px 15px;
  color: var(--muted-2);
  font-size: 11px;
}

.copybtn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 6px;
  padding: 5px 9px;
  cursor: pointer;
  font-size: 11.5px;
}

.copybtn:hover { border-color: #d1d5db; background: var(--surface-2); }

.apple-head { padding: 18px 20px 8px; }
.apple-note { margin: 6px 0 0; color: var(--muted); font-size: 12.2px; line-height: 1.65; }

.seg-chips {
  display: flex;
  gap: 2px;
  padding: 5px 20px 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.seg-chip {
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  border-radius: 0;
  padding: 8px 10px 9px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.seg-chip b { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.seg-chip span { display: block; margin-top: 1px; font-size: 11px; color: var(--muted-2); font-weight: 600; }
.seg-chip:hover b { color: var(--ink-2); }
.seg-chip.active { border-bottom-color: var(--accent); }
.seg-chip.active b { color: var(--ink); font-weight: 700; }
.seg-chip.active span { color: var(--accent-dark); }

.seg-body { padding: 0 20px; }
.seg-body .table-wrap { padding: 0; }
.seg-title { color: var(--muted); font-size: 11.5px; margin: 10px 0 7px; }

.matrix { min-width: 560px; }
.matrix th { background: var(--surface-2); }
.matrix td:first-child { font-weight: 650; color: var(--ink-2); }
.matrix td.price { font-variant-numeric: tabular-nums; }

.related { margin-top: 20px; }
.related h3 { margin: 0 0 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.related-list { display: flex; flex-wrap: wrap; gap: 7px; }

.related-list button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 7px;
  padding: 7px 10px;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 12px;
}

.related-list button:hover { border-color: #d1d5db; background: var(--surface-2); }
.related-list .rp { color: var(--accent-dark); font-weight: 700; }

.empty {
  background: var(--surface);
  border: 1px dashed #d1d5db;
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
}

.empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 5px; }

.guide { margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--line); }
.guide h3 { margin: 0 0 12px; font-size: 13px; font-weight: 650; }
.category-note { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.category-note div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.category-note div:first-child { border-left: 3px solid var(--accent); }
.category-note b { display: block; font-size: 12px; color: var(--ink); margin-bottom: 3px; }
.category-note span { font-size: 11.8px; color: var(--muted); line-height: 1.6; }

.guide-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.guide-grid div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.guide-grid b { display: block; font-size: 11.8px; color: var(--ink-2); margin-bottom: 3px; }
.guide-grid span { font-size: 11.5px; color: var(--muted); line-height: 1.55; }
.guide-tip { margin: 11px 0 0; color: var(--muted); font-size: 11.5px; }

.textbtn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent-dark);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 规则弹窗 */
.rules-dialog {
  width: min(920px, calc(100vw - 32px));
  max-height: 86vh;
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(16, 24, 40, 0.24);
}

.rules-dialog::backdrop { background: rgba(17, 24, 39, 0.46); backdrop-filter: blur(3px); }

.rules-dialog-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 13px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.rules-dialog-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.02em; line-height: 1.3; }

.dialog-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.dialog-close:hover { background: #f1f3f5; }

.rules-dialog-body { max-height: calc(86vh - 88px); overflow-y: auto; padding: 2px 22px 24px; }
.rules-dialog-body h3 { margin: 18px 0 7px; color: var(--ink); font-size: 14px; }
.rules-dialog-body ol, .rules-dialog-body ul { margin: 0; padding-left: 19px; }
.rules-dialog-body li { margin: 5px 0; color: var(--ink-2); font-size: 12.5px; line-height: 1.7; }
.rules-dialog-body li ul { margin-top: 4px; }

.rules-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.rules-table { min-width: 760px; font-size: 12px; }
.rules-table th { background: var(--surface-2); padding: 9px 11px; }
.rules-table td { padding: 9px 11px; line-height: 1.6; color: var(--ink-2); vertical-align: top; }
.rules-table td:first-child { white-space: nowrap; color: var(--ink); }

.footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px 36px;
  color: var(--muted-2);
  font-size: 11px;
}

.footer p { margin: 3px 0; }

.footer .stats-line {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}

.skeleton {
  height: 170px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, #eceef1 25%, #f6f7f8 50%, #eceef1 75%);
  background-size: 200% 100%;
  animation: shimmer 1s infinite linear;
}

@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 760px) {
  .topbar { padding: 9px 16px; }
  .brandtext small { display: none; }
  .rules-btn { padding: 6px 9px; font-size: 11.5px; }
  .date-pill { font-size: 10.5px; padding: 5px 8px; }
  .wrap { padding: 20px 16px 30px; }
  h1 { font-size: 22px; }
  .sub { font-size: 12.5px; margin-bottom: 14px; }
  .searchbox { padding-left: 12px; }
  .searchbox button { padding: 0 15px; }
  .tabs { width: 100%; }
  .card-head { flex-direction: column; gap: 10px; padding: 16px 16px 12px; }
  .hero-price { text-align: left; padding-left: 0; }
  .table-wrap { padding: 0 16px; }
  .note, .warnbox, .deductions { margin-left: 16px; margin-right: 16px; }
  .card-foot { padding: 11px 16px 14px; }
  .apple-head { padding: 16px 16px 8px; }
  .seg-chips { padding-left: 16px; padding-right: 16px; }
  .seg-body { padding-left: 16px; padding-right: 16px; }
  .guide-grid { grid-template-columns: repeat(2, 1fr); }
  .category-note { grid-template-columns: 1fr; }
  .rules-dialog-head { padding: 15px 16px 11px; }
  .rules-dialog-head h2 { font-size: 17px; }
  .rules-dialog-body { padding: 2px 16px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
