/* Neutral surfaces and a single amber action color keep model codes legible. */
:root {
  color-scheme: light;
  --paper: #edeae3;
  --card: #fffcf5;
  --ink: #252420;
  --muted: #59564f;
  --line: #d9d2c5;
  --control-line: #8c8272;
  --mist: #eee8dc;
  --surface: #f7f3e9;
  --surface-hover: #f0e9da;
  --accent: #efb45a;
  --accent-hover: #f5c371;
  --on-accent: #22180d;
  --link: #754916;
  --focus: #92540f;
  --selected: #383127;
  --on-selected: #fffbef;
  --error: #8c3528;
  --warning: #a67531;
  --fit-ink: #245137;
  --fit-surface: #e5eee0;
  --blocked-ink: #893927;
  --blocked-surface: #f5e4dc;
  --limited-ink: #674810;
  --limited-surface: #f1e7cf;
  --unknown-ink: #514d44;
  --unknown-surface: #ebe6dd;
  --shadow: #2620142b;
  --backdrop: #221b146e;
  --radius: 12px;
  --model-font: "SF Mono", Menlo, "Cascadia Mono", Consolas, ui-monospace, monospace;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #171716;
  --card: #232220;
  --ink: #f3ede1;
  --muted: #c3b8a7;
  --line: #484239;
  --control-line: #8e826f;
  --mist: #302c26;
  --surface: #2b2823;
  --surface-hover: #383227;
  --accent: #efb45a;
  --accent-hover: #f6c779;
  --link: #f4c883;
  --focus: #ffcd7d;
  --selected: #e6b16a;
  --on-selected: #22180d;
  --error: #ffc0ac;
  --warning: #bc8947;
  --fit-ink: #b9e3bd;
  --fit-surface: #27382a;
  --blocked-ink: #ffc1b0;
  --blocked-surface: #472d26;
  --limited-ink: #f5d292;
  --limited-surface: #433722;
  --unknown-ink: #e4dac8;
  --unknown-surface: #353127;
  --shadow: #0008;
  --backdrop: #0009;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; }
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }
button, a, input { touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.wrap { width: min(1120px, calc(100% - 60px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 65px; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 20px; letter-spacing: .04em; font-weight: 760; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 31px; height: 31px; position: relative; background: var(--selected); border-radius: 7px; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; left: 7px; width: 16px; height: 8px; border: 1.5px solid var(--on-selected); border-radius: 2px; transform: skewX(-23deg); }
.brand-mark::before { top: 7px; background: var(--on-selected); }
.brand-mark::after { top: 15px; }
nav { display: flex; align-items: center; gap: 21px; }
nav a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; font-size: 14px; color: var(--muted); }
nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 5px; }
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; min-width: 68px; padding: 0 10px; border: 1px solid var(--control-line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 13px; }
.theme-toggle:hover { background: var(--surface-hover); }
.theme-symbol { position: relative; width: 15px; height: 15px; flex: 0 0 15px; border: 1.5px solid currentColor; border-radius: 50%; }
.theme-symbol::before { content: ""; position: absolute; inset: 1px 50% 1px 1px; border-radius: 9px 0 0 9px; background: currentColor; }
[data-theme="dark"] .theme-symbol { transform: rotate(180deg); }

.hero {
  position: relative;
  display: grid;
  align-items: center;
  min-height: 178px;
  padding: 28px 40px;
  margin-top: 22px;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid #3b342a;
  border-inline-start: 3px solid var(--accent);
  color: #fffaee;
  isolation: isolate;
  background: #201b17;
}
.hero::before, .hero::after { content: ""; position: absolute; inset: 0; z-index: -1; }
.hero::before { filter: saturate(.6); background: url("./assets/quick-release.webp") right 46% / min(66%, 720px) auto no-repeat; }
.hero::after { background: linear-gradient(90deg, #201b17 6%, #201b17 35%, #201b17d1 53%, #201b1718 80%); }
.hero-copy { max-width: 550px; }
h1, h2, h3, p, ul { margin: 0; }
h1 { font-size: clamp(34px, 4.1vw, 53px); letter-spacing: -.045em; font-weight: 770; line-height: 1.16; }
.hero-copy p { margin-top: 10px; color: #f0dfc8; line-height: 1.6; font-size: 15px; }
h2 { font-size: 22px; line-height: 1.4; letter-spacing: -.025em; }
h3 { font-size: 15px; line-height: 1.45; }

.workspace { display: grid; grid-template-columns: minmax(0, .89fr) minmax(0, 1.11fr); gap: 16px; margin-top: 16px; align-items: start; }
.panel { min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.lookup, .result { padding: 22px; scroll-margin-top: 14px; }
.field-tip { color: var(--muted); font-size: 13px; line-height: 1.55; margin-top: 5px; }
.lookup form { display: grid; gap: 13px; margin-top: 17px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 690; }
.field-error { color: var(--error); font-size: 13px; line-height: 1.55; }
.model-control { display: grid; width: 100%; min-height: 56px; grid-template-columns: 30px minmax(0, 1fr) 13px; gap: 10px; align-items: center; text-align: left; padding: 7px 12px; background: var(--surface); border: 1px solid var(--control-line); border-radius: 10px; color: var(--ink); }
.model-control:hover { border-color: var(--link); }
.model-control[aria-invalid="true"] { border-color: var(--error); }
.model-text { display: grid; gap: 2px; min-width: 0; }
.model-text strong { font-size: 15px; overflow-wrap: anywhere; }
.model-text:has(small:not([hidden])) strong, .model-option strong, .pair-name strong, .result-head h2 { font-family: var(--model-font), "PingFang SC", "Microsoft YaHei", sans-serif; font-variant-numeric: tabular-nums; }
.model-text small { color: var(--muted); line-height: 1.35; font-size: 12px; }
.model-symbol { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: var(--mist); color: var(--link); }
.model-symbol::before { content: ""; width: 14px; height: 8px; border: 1.5px solid currentColor; border-radius: 2px; }
.plate-symbol::before { transform: skewX(-24deg); }
.clamp-symbol::before { border-block-start: 0; border-inline-width: 2.5px; height: 9px; }
.control-chevron { width: 8px; height: 8px; border: solid var(--link); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); margin-left: 1px; }
.form-actions { display: flex; align-items: stretch; gap: 8px; margin-top: 1px; }
.button { border: 0; padding: 0 15px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; font-size: 14px; font-weight: 700; text-decoration: none; }
.primary { color: var(--on-accent); background: var(--accent); white-space: nowrap; }
.primary:hover { background: var(--accent-hover); }
.secondary { border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.secondary:hover { background: var(--mist); }
.form-actions .primary { flex: 1; }

.result { min-height: 296px; }
.result:has(#result-empty:not([hidden])), .result:has(#result-pending:not([hidden])) { align-self: stretch; }
.result-empty > p, .result-pending > p { margin-top: 5px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.result-pending { border-left: 3px solid var(--warning); padding-left: 13px; }
.quick-list { display: grid; gap: 6px; margin-top: 14px; }
.quick-card { display: grid; width: 100%; grid-template-columns: minmax(0, 1fr) auto 13px; gap: 9px; align-items: center; text-align: left; min-height: 54px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); }
.quick-card:hover { border-color: var(--control-line); background: var(--mist); }
.quick-card > :last-child { color: var(--link); }
.pair-name { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.pair-name strong { font-size: 14px; line-height: 1.4; }
.pair-name small, .row-evidence { font-size: 12px; color: var(--muted); line-height: 1.35; }
.pill { display: inline-flex; width: fit-content; border-radius: 100px; padding: 4px 9px; font-size: 12px; font-weight: 700; line-height: 1.25; white-space: nowrap; }
.fit { color: var(--fit-ink); background: var(--fit-surface); }
.no-fit { color: var(--blocked-ink); background: var(--blocked-surface); }
.limited { color: var(--limited-ink); background: var(--limited-surface); }
.unknown { color: var(--unknown-ink); background: var(--unknown-surface); }

.result-head { display: flex; align-items: start; justify-content: space-between; gap: 9px; }
.result-head h2 { margin-top: 6px; overflow-wrap: anywhere; }
.share-button { flex-shrink: 0; }
.result-detail { margin-top: 9px; font-size: 14px; line-height: 1.65; }
.purchase, .related { border-top: 1px solid var(--line); margin-top: 15px; padding-top: 13px; }
.offer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; padding: 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.offer-match { display: inline-block; margin-bottom: 4px; color: var(--link); font-size: 11px; font-weight: 700; }
.offer strong, .offer small { display: block; font-size: 13px; line-height: 1.5; }
.offer small { color: var(--muted); margin-top: 3px; }
.offer a { flex-shrink: 0; }
.offer small a { white-space: nowrap; }
.store-note, .copy-feedback { color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 9px; }
.copy-feedback:empty { margin: 0; }
.copy-link { width: 100%; min-height: 40px; margin-top: 5px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: var(--card); }
.supplement { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 7px; }
.search-supplies { font-size: 13px; color: var(--link); text-underline-offset: 3px; }
.alternative-link { margin-top: 8px; }
.evidence { border-top: 1px solid var(--line); margin-top: 14px; }
.evidence summary { position: relative; list-style: none; font-size: 14px; font-weight: 660; padding: 9px 0; min-height: 44px; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.evidence summary::-webkit-details-marker { display: none; }
.evidence summary span { font-weight: 500; color: var(--muted); font-size: 12px; }
.evidence summary::after { content: ""; width: 7px; height: 7px; border: solid var(--link); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); margin-left: auto; margin-right: 4px; }
.evidence[open] summary::after { transform: rotate(225deg); }
.evidence ul { list-style: none; padding: 0; }
.evidence li { display: flex; gap: 9px; align-items: baseline; margin-bottom: 6px; font-size: 13px; line-height: 1.5; }
.evidence li span, .evidence p { color: var(--muted); font-size: 12px; }
.evidence li span { flex-shrink: 0; }
.evidence a { color: var(--link); text-underline-offset: 3px; }

.combinations { margin-top: 28px; scroll-margin-top: 15px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.section-heading p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.catalog-search { width: min(390px, 100%); }
.catalog-search input { width: 100%; min-height: 44px; border: 1px solid var(--control-line); border-radius: 9px; padding: 0 12px; background: var(--card); color: var(--ink); font-size: 16px; }
.catalog-search input::placeholder { color: var(--muted); opacity: 1; }
.filters { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.filters button { min-height: 38px; border: 1px solid var(--line); border-radius: 30px; color: var(--ink); background: var(--card); padding: 0 11px; font-size: 13px; }
.filters button[aria-pressed="true"] { background: var(--selected); border-color: var(--selected); color: var(--on-selected); }
.database { overflow: hidden; }
.table-head, .table-row { display: grid; grid-template-columns: minmax(0, 1fr) 105px 105px 15px; gap: 9px; align-items: center; text-align: left; padding: 9px 17px; }
.table-head { font-size: 13px; font-weight: 650; background: var(--mist); }
.table-row { width: 100%; border: 0; border-top: 1px solid var(--line); color: var(--ink); background: var(--card); min-height: 55px; }
.table-row:hover { background: var(--surface-hover); }
.table-row:focus-visible { outline-offset: -4px; }
.row-arrow { color: var(--link); }
.empty { padding: 14px; color: var(--muted); font-size: 14px; }
.empty .button { margin-top: 8px; }
.site-footer { display: flex; justify-content: space-between; gap: 9px; padding: 17px 0 24px; margin-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.6; }

.picker-dialog { width: min(480px, calc(100% - 28px)); padding: 19px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); background: var(--card); box-shadow: 0 18px 70px var(--shadow); }
.picker-dialog::backdrop { background: var(--backdrop); }
.picker-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 11px; }
.close-picker { min-height: 40px; }
.picker-dialog .catalog-search { display: block; width: 100%; }
.picker-count { color: var(--muted); font-size: 12px; margin: 10px 0 6px; }
.model-list { display: grid; gap: 5px; align-content: start; overflow: auto; max-height: min(360px, 45dvh); }
.model-option { width: 100%; padding: 8px 11px; text-align: left; min-height: 49px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.model-option:hover, .model-option[aria-pressed="true"] { background: var(--mist); }
.model-option:focus-visible { outline-offset: -3px; }
.model-option span { display: grid; gap: 3px; }
.model-option strong { font-size: 14px; }
.model-option small { font-size: 12px; line-height: 1.35; color: var(--muted); }

@media (max-width: 760px) {
  .wrap { width: calc(100% - 28px); }
  .header-inner { min-height: 55px; }
  nav { gap: 10px; }
  nav a { font-size: 13px; }
  .theme-toggle { min-width: 54px; padding-inline: 6px; }
  .hero { min-height: 112px; margin-top: 12px; padding: 14px 17px; border-radius: 13px; }
  .hero::before { filter: saturate(.6); background-size: 76% auto; background-position: right 48%; }
  .hero::after { background: linear-gradient(90deg, #201b17 10%, #201b17eb 36%, #201b1760 80%); }
  .hero-copy { max-width: 235px; }
  .hero-copy p { margin-top: 6px; font-size: 12px; }
  h1 { font-size: clamp(25px, 7vw, 35px); }
  h1 span { display: block; }
  h2 { font-size: 19px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 11px; margin-top: 11px; }
  .lookup, .result { padding: 15px; }
  .result { min-height: 0; }
  .field-tip { font-size: 12px; }
  .lookup form { margin-top: 12px; gap: 9px; }
  .model-control { min-height: 51px; }
  .pair-name strong { font-size: 13px; }
  .share-button { padding-inline: 9px; min-height: 41px; }
  .offer { flex-wrap: wrap; align-items: start; }
  .offer .primary { width: 100%; }
  .section-heading { align-items: start; flex-direction: column; gap: 9px; }
  .table-head, .table-row { grid-template-columns: minmax(0, 1fr) 74px; padding-inline: 10px; gap: 4px; }
  .table-head > :last-child, .row-arrow { display: none; }
  .row-evidence { grid-column: 1; padding-top: 2px; }
  .site-footer { flex-direction: column; gap: 2px; }
  .picker-dialog { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 16px 16px 0 0; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
