/* RepairScore: a teardown mat. Safety-yellow header band, petrol result panel, exploded-view breakdown. */
:root {
  color-scheme: light;
  --bg: #eef1e9;
  --bg-alt: #e2e8db;
  --surface: #fbfcf8;
  --ink: #11302c;
  --muted: #48605a;
  --hair: #c3cdc1;
  --accent: #f6c500;
  --accent-ink: #1c1a05;
  --panel: #0f4640;
  --panel-ink: #f2f6ee;
  --panel-muted: #b9d2cb;
  --panel-line: rgba(242, 246, 238, 0.28);
  --link: #0a574f;
  --danger: #a12f17;
  --good-bg: #cfe9d7;
  --mid-bg: #fbe894;
  --low-bg: #fbd9b6;
  --poor-bg: #f5c6b9;
  --p-good: #7fd69b;
  --p-mid: #f6c500;
  --p-low: #ff9f4a;
  --p-poor: #ff6f52;
  --grid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cpath d='M32 0H0v32' fill='none' stroke='%2311302c' stroke-opacity='.09'/%3E%3C/svg%3E");
  --display: "Avenir Next Condensed", "Avenir Next", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --body: "Avenir Next", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b2321;
    --bg-alt: #0f2d2a;
    --surface: #133632;
    --ink: #e8f0e8;
    --muted: #a5bbb4;
    --hair: #2c524c;
    --panel: #18473f;
    --link: #f6c500;
    --danger: #ff9a80;
    --good-bg: #1c5b3a;
    --mid-bg: #5d4b00;
    --low-bg: #6c3b0c;
    --poor-bg: #702515;
    --grid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cpath d='M32 0H0v32' fill='none' stroke='%23e8f0e8' stroke-opacity='.06'/%3E%3C/svg%3E");
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b2321;
  --bg-alt: #0f2d2a;
  --surface: #133632;
  --ink: #e8f0e8;
  --muted: #a5bbb4;
  --hair: #2c524c;
  --panel: #18473f;
  --link: #f6c500;
  --danger: #ff9a80;
  --good-bg: #1c5b3a;
  --mid-bg: #5d4b00;
  --low-bg: #6c3b0c;
  --poor-bg: #702515;
  --grid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cpath d='M32 0H0v32' fill='none' stroke='%23e8f0e8' stroke-opacity='.06'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 80px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 700px) { .wrap { padding: 0 32px; } }

h1, h2, h3 { font-family: var(--display); line-height: 1.12; margin: 0; letter-spacing: 0.005em; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.2rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 700; }
h3 { font-size: 1.3rem; font-weight: 600; }
p { margin: 0 0 16px; }
a { color: var(--link); text-underline-offset: 3px; }
.small { font-size: 0.9rem; color: var(--muted); margin: 8px 0; }
.muted { color: var(--muted); }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 16px; top: -60px; z-index: 30;
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 4px;
}
.skip:focus { top: 8px; }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.result :focus-visible { outline-color: var(--accent); }

.code {
  font-family: var(--mono); font-size: max(0.78em, 12px); font-weight: 600;
  background: var(--ink); color: var(--bg);
  padding: 2px 5px; border-radius: 3px; vertical-align: 0.08em;
}

/* ---------- header ---------- */
.site-head { background: var(--accent); color: var(--accent-ink); border-bottom: 3px solid #11302c; }
.head-row { display: flex; align-items: center; gap: 8px 24px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-height: 44px; }
.brand-mark { flex: none; }
.bm-head { fill: #11302c; }
.bm-star { fill: #f6c500; stroke: #f6c500; stroke-width: 1.4; stroke-linejoin: round; }
.brand-word { font-family: var(--display); font-weight: 700; font-size: 1.65rem; letter-spacing: 0.01em; text-transform: uppercase; }
.brand-word span { font-weight: 500; }
.site-head nav { margin-left: auto; }
.nav { display: flex; flex-wrap: wrap; gap: 0 4px; list-style: none; margin: 0; padding: 0; }
.nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px;
  color: inherit; font-weight: 600; text-decoration: none; border-radius: 4px;
}
.nav a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.site-head :focus-visible { outline-color: #11302c; }
.theme-btn { color: inherit !important; border-color: #11302c !important; }
@media (max-width: 900px) {
  .site-head nav { order: 3; width: 100%; margin-left: -10px; }
  .theme-btn { margin-left: auto; }
  .nav:not(.nav-plain) li:first-child { display: none; }
  .site-head nav { margin-left: -6px; }
  .nav { gap: 0; }
  .nav a { padding: 0 6px; }
}

/* ---------- buttons ---------- */
.btn, .btn-quiet {
  font: inherit; font-weight: 600; min-height: 44px; padding: 8px 16px;
  border-radius: 4px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: background-color 160ms, color 160ms, border-color 160ms;
}
.btn { background: var(--surface); color: var(--ink); border: 2px solid var(--ink); }
.btn:hover:not(:disabled) { background: var(--ink); color: var(--bg); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: #11302c; }
.btn-primary:hover:not(:disabled) { background: #11302c; color: #f6c500; }
.btn-quiet { background: transparent; color: var(--muted); border: 1px solid var(--hair); font-weight: 500; }
.btn-quiet:hover { color: var(--ink); border-color: var(--ink); }
.btn-link {
  font: inherit; font-size: 0.92rem; background: none; border: 0; padding: 6px 4px; min-height: 32px;
  color: var(--link); text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.btn-link.danger { color: var(--danger); }

/* ---------- bench: intro, result, form ---------- */
.bench { background-color: var(--bg); background-image: var(--grid); padding: 32px 0 56px; }
.bench-grid { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
.bench-intro { order: 1; } .result { order: 2; } .score-form { order: 3; }
.bench-intro .lead { font-size: 1.15rem; max-width: 62ch; margin: 16px 0 0; }
.notice { margin-top: 16px; padding: 12px 16px; border-left: 4px solid var(--accent); background: var(--surface); }

@media (min-width: 980px) {
  .bench-grid {
    grid-template-columns: minmax(0, 1fr) 412px; column-gap: 48px; row-gap: 32px;
    grid-template-areas: "intro result" "form result";
  }
  .bench-intro { grid-area: intro; padding-top: 8px; }
  .score-form { grid-area: form; }
  .result { grid-area: result; align-self: start; }
}
@media (min-width: 980px) and (min-height: 700px) {
  .result { position: sticky; top: 16px; }
}

.result {
  background: var(--panel); color: var(--panel-ink);
  border-radius: 6px; padding: 20px 24px 24px;
  border-top: 8px solid var(--accent);
}
.result-kind { margin: 0; font-size: 0.9rem; color: var(--panel-muted); }
.result-name { font-size: 1.45rem; margin: 2px 0 8px; overflow-wrap: anywhere; min-height: 1.12em; }
.gauge-box { max-width: 300px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; }
.gauge-box .gauge { order: 1; max-width: 250px; }
.gauge-box .score-line { order: 2; }
.gauge-box .verdict { order: 3; }
@media (max-width: 979px) {
  .gauge-box .score-line { order: 0; margin: 4px 0 0; }
  .gauge-box .verdict { order: 1; margin: 2px 0 8px; }
  .gauge-box .gauge { order: 2; max-width: 220px; }
}
.gauge { display: block; width: 100%; height: auto; aspect-ratio: 200 / 120; }
.g-track { fill: none; stroke: var(--panel-line); stroke-width: 14; }
.g-fill { fill: none; stroke: var(--accent); stroke-width: 14; transition: stroke-dasharray 220ms ease-out; }
.g-ticks line { stroke: var(--panel-muted); stroke-width: 1.5; }
.g-nums text { fill: var(--panel-muted); font-family: var(--mono); font-size: 12px; }
.g-needle { transform-origin: 100px 100px; transition: transform 220ms ease-out; }
.g-needle line { stroke: var(--panel-ink); stroke-width: 3; stroke-linecap: round; }
.g-hub { fill: var(--panel-ink); }
.score-line { margin: -4px 0 0; text-align: center; line-height: 1; }
.score-num {
  font-family: var(--display); font-weight: 700; font-size: 3.6rem; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.score-of { font-family: var(--mono); font-size: 0.9rem; color: var(--panel-muted); }
.verdict { font-family: var(--display); font-size: 1.35rem; font-weight: 600; text-align: center; margin: 6px 0 2px; color: var(--accent); }
.basis { text-align: center; font-size: 0.9rem; color: var(--panel-muted); margin: 0 0 8px; min-height: 1.4em; }

.exploded { aspect-ratio: 340 / 302; margin: 8px 0 12px; }
.exploded svg { display: block; width: 100%; height: auto; }
.guides line { stroke: var(--panel-muted); stroke-width: 1; stroke-dasharray: 2 3; }
.plate .pl-top, .plate .pl-side { stroke: #082a26; stroke-width: 1; stroke-linejoin: round; transition: fill 200ms; }
.plate .pl-shade { fill: #000; fill-opacity: 0.28; }
.p-good .pl-top, .p-good .pl-side { fill: var(--p-good); }
.p-mid .pl-top, .p-mid .pl-side { fill: var(--p-mid); }
.p-low .pl-top, .p-low .pl-side { fill: var(--p-low); }
.p-poor .pl-top, .p-poor .pl-side { fill: var(--p-poor); }
.p-na .pl-top, .p-na .pl-side { fill: var(--panel); stroke: var(--panel-muted); stroke-dasharray: 3 3; }
.p-na .pl-shade { fill-opacity: 0; }
.plate.is-off { opacity: 0.45; }
.pl-screws circle { fill: #082a26; fill-opacity: 0.55; }
.leader { stroke: var(--panel-muted); stroke-width: 1; }
.pl-code { fill: var(--panel-muted); font-family: var(--mono); font-size: 12px; }
.pl-label { fill: var(--panel-ink); font-family: var(--body); font-size: 12.5px; }
.pl-val { font-family: var(--mono); font-size: 13px; font-weight: 700; fill: var(--panel-ink); }
.v-good { fill: var(--p-good); } .v-mid { fill: var(--p-mid); } .v-low { fill: var(--p-low); } .v-poor { fill: #ff9a85; }
.v-na { fill: var(--panel-muted); font-weight: 400; }

.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn-onpanel { background: transparent; color: var(--panel-ink); border-color: var(--panel-ink); }
.btn-onpanel:hover:not(:disabled) { background: var(--panel-ink); color: #0f4640; }
.result .btn-primary { border-color: var(--accent); }
.result .btn-primary:hover:not(:disabled) { background: var(--panel-ink); color: #0f4640; border-color: var(--panel-ink); }
.share-fallback { margin: 12px 0 0; }
.share-fallback label { display: block; font-size: 0.9rem; margin-bottom: 4px; }
.share-fallback input { width: 100%; }

/* ---------- form ---------- */
label { font-weight: 600; }
input[type="text"], select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 2px solid var(--ink); border-radius: 4px; min-height: 46px; padding: 8px 12px; width: 100%;
}
input[aria-invalid="true"] { border-color: var(--danger); }
.field-row { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 620px) { .field-row { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.field label { display: block; margin-bottom: 4px; }
.field-msg { min-height: 1.5em; margin: 4px 0 0; font-size: 0.92rem; color: var(--danger); font-weight: 600; }

.questions { min-height: 900px; }
.q { border: 0; border-top: 2px solid var(--ink); margin: 16px 0 0; padding: 14px 0 0; min-width: 0; }
.q legend { float: left; width: 100%; padding: 0; font-family: var(--display); font-size: 1.3rem; font-weight: 600; line-height: 1.2; margin-bottom: 10px; }
.opts { clear: both; display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 620px) { .opts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.opt { position: relative; display: block; font-weight: 400; cursor: pointer; }
.opt input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.opt-body {
  display: flex; align-items: center; min-height: 48px; height: 100%; padding: 8px 12px 8px 40px;
  background: var(--surface); border: 1px solid var(--hair); border-radius: 4px; line-height: 1.3; font-size: 0.97rem;
  transition: background-color 150ms, border-color 150ms;
}
.opt-body::before {
  content: ""; position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; margin-top: -9px;
  border: 2px solid var(--ink); border-radius: 50%; background: var(--surface);
}
.opt:hover .opt-body { border-color: var(--ink); }
.opt input:checked + .opt-body { background: var(--accent); color: var(--accent-ink); border-color: #11302c; font-weight: 600; }
.opt input:checked + .opt-body::before { background: #11302c; border-color: #11302c; box-shadow: inset 0 0 0 3px #f6c500; }
.opt input:focus-visible + .opt-body { outline: 3px solid var(--ink); outline-offset: 2px; }
.opt-unsure .opt-body { background: transparent; border-style: dashed; color: var(--muted); }
.opt-unsure input:checked + .opt-body { background: var(--bg-alt); color: var(--ink); border: 1px dashed var(--ink); }
.opt-unsure input:checked + .opt-body::before { box-shadow: inset 0 0 0 3px var(--bg-alt); background: var(--ink); border-color: var(--ink); }
.q-reason { margin: 10px 0 0; min-height: 1.5em; font-size: 0.95rem; color: var(--muted); max-width: 68ch; }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; align-items: center; }

/* ---------- bands ---------- */
.band { padding: 56px 0; background: var(--surface); border-top: 1px solid var(--hair); }
.band-alt { background: var(--bg-alt); }
.section-lead { max-width: 68ch; margin: 12px 0 24px; color: var(--muted); }

.reason-list { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.reason {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 16px;
  padding: 16px 0; border-bottom: 1px solid var(--hair); align-items: start;
}
.reason > .code { margin-top: 4px; }
.reason h3 { font-size: 1.2rem; }
.r-answer { margin: 2px 0 2px; font-weight: 600; }
.r-text { margin: 0; color: var(--muted); max-width: 66ch; }
.r-score { grid-column: 2; display: grid; grid-template-columns: 3.2em 120px auto; gap: 12px; align-items: center; margin-top: 6px; }
.r-num { font-family: var(--mono); font-weight: 700; font-size: 1.25rem; font-variant-numeric: tabular-nums; text-align: right; }
.r-bar { display: block; height: 10px; background: var(--bg-alt); border: 1px solid var(--hair); border-radius: 2px; overflow: hidden; }
.r-bar span { display: block; height: 100%; background: var(--ink); transition: width 200ms ease-out; }
.r-good .r-bar span { background: #1f7a46; } .r-mid .r-bar span { background: #c79a00; }
.r-low .r-bar span { background: #d2691e; } .r-poor .r-bar span { background: #c23b1e; }
.r-share { font-size: 0.88rem; color: var(--muted); }
.r-na .r-num { color: var(--muted); font-weight: 400; }
@media (min-width: 860px) {
  .reason { grid-template-columns: auto minmax(0, 1fr) 330px; }
  .r-score { grid-column: 3; margin-top: 4px; }
}

.two-up { display: grid; gap: 40px; grid-template-columns: minmax(0, 1fr); margin-top: 40px; }
@media (min-width: 860px) { .two-up { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 56px; } }
.tips { margin: 12px 0 0; padding-left: 20px; }
.tips li { margin-bottom: 10px; max-width: 66ch; }

details { border-top: 2px solid var(--ink); }
details:last-of-type { border-bottom: 2px solid var(--ink); }
summary {
  cursor: pointer; font-family: var(--display); font-size: 1.25rem; font-weight: 600;
  min-height: 52px; padding: 12px 32px 12px 0; position: relative; list-style: none;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; position: absolute; right: 4px; top: 8px; font-family: var(--mono); font-size: 1.5rem; font-weight: 400; }
details[open] > summary::after { content: "\2212"; }
details > :last-child { margin-bottom: 20px; }

.weights-grid { display: grid; gap: 4px 24px; grid-template-columns: minmax(0, 1fr); margin: 12px 0; }
@media (min-width: 520px) { .weights-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.slider-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 8px; padding: 6px 0; }
.slider-row label { font-size: 0.95rem; }
.slider-row output { font-family: var(--mono); font-weight: 700; min-width: 1.5ch; text-align: right; }
.slider-row input { grid-column: 1 / -1; width: 100%; height: 36px; margin: 0; accent-color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 8px 0 0; }
.formula { font-family: var(--mono); font-size: 0.95rem; background: var(--bg-alt); padding: 12px 16px; border-left: 4px solid var(--accent); overflow-x: auto; }

/* ---------- tables ---------- */
/* position: relative keeps visually hidden labels inside the scroller instead of widening the page */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--hair); vertical-align: middle; }
.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
thead th { border-bottom: 2px solid var(--ink); font-weight: 600; white-space: nowrap; }
.calc tfoot th, .calc tfoot td { border-top: 2px solid var(--ink); font-weight: 700; }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 8px; }
.toolbar-gap { flex: 1 1 0; }
.toolbar select { width: auto; min-height: 44px; }
.sort-pick { display: none; align-items: center; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 500; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--ink); }
.file-btn { cursor: pointer; }

.matrix-wrap { background: var(--surface); border: 2px solid var(--ink); border-radius: 6px; margin-top: 8px; }
.matrix thead th { position: sticky; top: 0; background: var(--surface); padding: 4px 6px; }
.th-btn {
  font: inherit; font-weight: 600; color: inherit; background: none; border: 0; cursor: pointer;
  min-height: 44px; padding: 4px; border-radius: 3px; white-space: nowrap;
}
.th-btn:hover { text-decoration: underline; }
.matrix th[aria-sort] .th-btn { box-shadow: inset 0 -3px 0 var(--accent); }
.matrix tbody th { min-width: 210px; font-weight: 400; }
.dev-name { display: block; font-weight: 600; overflow-wrap: anywhere; }
.dev-meta { display: block; font-size: 0.86rem; color: var(--muted); }
.tag {
  display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 0 6px; border-radius: 3px;
  border: 1px solid var(--muted); color: var(--muted); vertical-align: 0.05em;
}
.chip { display: inline-block; min-width: 2.6em; padding: 3px 6px; border-radius: 3px; text-align: center; color: var(--ink); }
.c-good { background: var(--good-bg); } .c-mid { background: var(--mid-bg); }
.c-low { background: var(--low-bg); } .c-poor { background: var(--poor-bg); }
.c-na { color: var(--muted); }
.total .chip { font-size: 1.1rem; min-width: 3em; }
.is-saved > th { box-shadow: inset 4px 0 0 var(--accent); }
.acts { white-space: nowrap; }
.empty { color: var(--muted); padding: 20px 12px; margin: 0; }

@media (max-width: 899px) {
  .sort-pick { display: inline-flex; }
  .toolbar-gap { display: none; }
  .matrix-wrap { position: relative; }
  .matrix thead { display: block; position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); visibility: hidden; }
  .matrix, .matrix tbody { display: block; }
  .matrix tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 8px; padding: 14px 12px; border-bottom: 2px solid var(--ink); }
  .matrix tr:last-child { border-bottom: 0; }
  .matrix th, .matrix td { border: 0; padding: 0; }
  .matrix tbody th { grid-column: 1 / -1; min-width: 0; padding-left: 0; }
  .is-saved > th { box-shadow: none; }
  .is-saved { box-shadow: inset 4px 0 0 var(--accent); }
  .matrix td.cellc { text-align: left; display: flex; flex-direction: column; gap: 2px; }
  .matrix td[data-label]::before { content: attr(data-label); font-family: var(--body); font-size: 0.78rem; line-height: 1.2; color: var(--muted); }
  .matrix td.cellc { justify-content: space-between; }
  .matrix td.cellc .chip { align-self: start; }
  .matrix td.total { grid-column: 1 / 3; display: flex; align-items: center; gap: 8px; text-align: left; }
  .matrix td.cmp { grid-column: 3 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
  .matrix td.total::before, .matrix td.cmp::before { font-size: 0.9rem; }
  .matrix td.acts { grid-column: 1 / -1; }
  .matrix td.empty { grid-column: 1 / -1; padding: 12px 0; }
}

.compare-panel { margin-top: 40px; }
.compare-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; border-bottom: 2px solid var(--ink); padding-bottom: 8px; }
.compare-head h3 { margin-right: auto; }
.compare { min-width: 560px; }
.compare th[scope="row"] { position: sticky; left: 0; background: var(--bg-alt); min-width: 150px; font-weight: 600; }
.compare thead th { white-space: normal; vertical-align: bottom; min-width: 150px; }
.compare td { vertical-align: top; }
.cmp-num { font-family: var(--mono); font-weight: 700; margin-right: 4px; }
.is-best { background: var(--mid-bg); }
.best-tag { display: inline-block; font-size: 12.5px; font-weight: 700; background: var(--ink); color: var(--bg); padding: 0 5px; border-radius: 3px; }
.total-row th, .total-row td { border-top: 2px solid var(--ink); font-weight: 600; }
.cmp-short { display: none; }
.scroll-hint { position: sticky; left: 0; }
@media (min-width: 760px) { .scroll-hint { display: none; } }
.sponsored { margin-top: 24px; }
.link-row a { margin-right: 16px; }

/* ---------- guide ---------- */
.guide-grid { display: grid; gap: 40px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 980px) { .guide-grid { grid-template-columns: minmax(0, 1fr) 320px; gap: 72px; } }
.prose { max-width: 70ch; }
.prose h3 { margin: 40px 0 12px; font-size: 1.45rem; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 16px; }
.prose li { margin-bottom: 8px; }
.fasteners { margin: 16px 0 20px; padding: 20px 16px 12px; background: var(--accent); border-radius: 6px; border: 2px solid #11302c; }
.fasteners svg { display: block; width: 100%; max-width: 440px; height: auto; margin: 0 auto; }
.fs-head circle { fill: #11302c; }
.fs-slot path, .fs-slot polygon { fill: #f6c500; stroke: #f6c500; }
.fs-label text { fill: #1c1a05; font-family: var(--body); font-size: 13px; font-weight: 600; }
.fasteners figcaption { font-size: 0.86rem; color: #1c1a05; text-align: center; margin-top: 4px; }
.glossary { align-self: start; background: var(--bg-alt); border-radius: 6px; padding: 24px; border-top: 8px solid var(--panel); }
.glossary dl { margin: 12px 0 0; }
.glossary dt { font-weight: 700; margin-top: 14px; }
.glossary dd { margin: 2px 0 0; color: var(--muted); font-size: 0.95rem; }

.faq-wrap { max-width: 860px; }
.faq-wrap h2 { margin-bottom: 24px; }
.faq p { max-width: 68ch; }

/* ---------- footer, mini bar, snack ---------- */
.site-foot { background: #0b2a27; color: #d9e6df; padding: 40px 0 48px; font-size: 0.95rem; border-top: 8px solid var(--accent); }
.site-foot p { max-width: 78ch; margin: 0 0 10px; }

/* Result bar: on every width; JS hides it while the score itself is on screen. */
.mini {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  height: calc(64px + env(safe-area-inset-bottom, 0px)); padding: 6px max(16px, calc((100vw - 1180px) / 2 + 32px));
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  background: #0f4640; color: #f2f6ee; border-top: 4px solid #f6c500;
}
.mini[hidden] { display: none !important; }
.mini-score { font-family: var(--display); font-weight: 700; font-size: 1.9rem; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mini-of { font-family: var(--mono); font-size: 0.8rem; font-weight: 400; color: #b9d2cb; }
.mini-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.mini-verdict { font-weight: 600; font-size: 1rem; }
.mini-sub { font-size: 0.82rem; color: #b9d2cb; }
/* Narrow screens: the secondary line goes, the verdict may wrap to two lines; nothing is cut off. */
@media (max-width: 420px) { .mini { gap: 10px; } .mini-sub { display: none; } .mini-verdict { font-size: 0.95rem; } }
.mini-link { color: #f6c500; font-weight: 600; min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
body:has(> .mini) { padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
body.bar-top .mini {
  top: 0; bottom: auto; border-top: 0; border-bottom: 4px solid #f6c500;
  padding-top: calc(6px + env(safe-area-inset-top, 0px)); padding-bottom: 6px;
}

.snack {
  position: fixed; left: 16px; right: 16px; bottom: 80px; z-index: 25; max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 16px;
  background: #11302c; color: #f2f6ee; border-radius: 6px; border: 2px solid #f6c500; font-size: 0.97rem;
}
.snack > span { flex: 1 1 auto; min-width: 0; }
.snack-btn { white-space: nowrap; }
@media (max-width: 420px) { .snack { flex-wrap: wrap; } .snack > span { flex-basis: 100%; } }
.snack-btn { font: inherit; font-weight: 600; min-height: 44px; min-width: 44px; padding: 4px 12px; border-radius: 4px; cursor: pointer; background: transparent; color: #f6c500; border: 1px solid #f6c500; }
.snack-btn:focus-visible { outline-color: #f6c500; }


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

/* ---------- guide sections: plain on wide screens; the script folds them on phones ---------- */
.guide-sec.closed > .guide-body { display: none; }
.fold-btn {
  font: inherit; color: inherit; background: none; border: 0; border-radius: 3px; cursor: pointer;
  display: block; width: 100%; text-align: left; min-height: 56px; padding: 12px 36px 12px 0; position: relative;
}
.fold-btn::after {
  content: "\2212"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 1.5rem; font-weight: 400;
}
.closed > h3 > .fold-btn::after { content: "+"; }
.prose .guide-sec.folding { border-top: 2px solid var(--ink); }
.prose .guide-sec.folding:last-child { border-bottom: 2px solid var(--ink); }
.guide-sec.folding > h3 { margin: 0; }
.guide-sec.folding:not(.closed) { padding-bottom: 12px; }
.gloss.folding:not(.closed) { padding-bottom: 0; }

/* ---------- ad slots: hidden and zero height until switched on ---------- */
.ad-slot { background: var(--bg); border-top: 1px solid var(--hair); padding: 24px 0 32px; }
.ad-label { font-size: 0.8rem; color: var(--muted); margin: 0 0 8px; text-align: center; }
.ad-box { min-height: 120px; max-width: 100%; overflow: hidden; }
.ad-box ins { display: block; }
@media (max-width: 600px) { .ad-box { min-height: 280px; } }

/* ---------- start button, progress, how-to-find-out ---------- */
.intro-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin: 20px 0 0; }
.intro-note { color: var(--muted); font-size: 0.95rem; max-width: 46ch; }
.progress { margin: 24px 0 0; }
.progress-text { margin: 0 0 6px; font-weight: 600; font-size: 0.95rem; }
.progress-bar { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; height: 10px; }
.progress-bar span { background: var(--surface); border: 1px solid var(--hair); border-radius: 2px; transition: background-color 180ms; }
.progress-bar span.on { background: var(--ink); border-color: var(--ink); }
.q-find { clear: both; margin: 0 0 12px; font-size: 0.95rem; color: var(--muted); max-width: 70ch; }
.q-find strong { color: var(--ink); font-weight: 600; }
.tips-link { margin: 16px 0 0; }

/* ---------- bundle: sibling tools on the same domain ---------- */
.bundle { background: var(--bg-alt); border-top: 1px solid var(--hair); padding: 32px 0 36px; }
.bundle h2 { font-size: 1.35rem; margin-bottom: 8px; }
.bundle-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px 40px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 860px) { .bundle-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bundle-list li { color: var(--muted); max-width: 64ch; }
.bundle-list a { display: flex; align-items: center; width: max-content; max-width: 100%; min-height: 44px; font-weight: 700; color: var(--link); }

/* ---------- article checklist ---------- */
.prose .checklist { list-style: none; padding: 0; margin: 0 0 20px; counter-reset: step; }
.checklist > li { position: relative; padding: 12px 0 12px 44px; border-top: 1px solid var(--hair); counter-increment: step; }
.checklist > li:last-child { border-bottom: 1px solid var(--hair); }
.checklist > li::before {
  content: counter(step); position: absolute; left: 0; top: 12px; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 700; font-size: 0.9rem;
  border: 2px solid var(--ink); border-radius: 3px;
}
.flags { display: grid; gap: 16px 32px; grid-template-columns: minmax(0, 1fr); margin: 8px 0 20px; }
@media (min-width: 640px) { .flags { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.flags h3 { font-size: 1.15rem; margin: 0 0 6px; padding-left: 10px; border-left: 6px solid var(--accent); }
.flags ul { margin: 0; padding-left: 20px; }
.page .byline { color: var(--muted); font-size: 0.92rem; margin: -4px 0 20px; }
.page .tool-cta { background: var(--bg-alt); border-left: 6px solid var(--accent); padding: 16px 20px; margin: 28px 0; }
.page .tool-cta p { margin: 0 0 10px; }
.page .tool-cta p:last-child { margin: 0; }

.page .ad-inline { background: transparent; margin: 20px 0; padding: 16px 0 20px; border: 0; }

/* ---------- spare-part price calculator, units, provisional state ---------- */
.price-calc { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px 16px; margin: 0 0 12px; padding: 12px; background: var(--bg-alt); border-radius: 4px; }
@media (min-width: 520px) { .price-calc { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.price-calc label { display: block; margin-bottom: 4px; font-size: 0.95rem; }
.price-calc .unit, .unit { font-weight: 400; color: var(--muted); }
.price-msg { grid-column: 1 / -1; margin: 0; font-size: 0.95rem; min-height: 1.5em; }
.price-msg.is-error { color: var(--danger); font-weight: 600; }
.r-unit { font-size: 0.75em; font-weight: 400; color: var(--muted); }
.pl-unit { fill: var(--panel-muted); font-family: var(--mono); font-size: 12px; }
.band-prov .g-fill { stroke: var(--panel-muted); }
.band-prov .verdict { color: var(--panel-ink); }
/* Provisional: a smaller, greyed figure with a "so far" label, so it cannot be read as a final score. */
.band-prov .score-num { font-size: 2.4rem; color: var(--panel-muted); }
.band-prov .score-line::before { content: "So far "; font-family: var(--body); font-size: 1rem; font-weight: 600; color: var(--panel-muted); margin-right: 4px; }
.mini.is-prov .mini-score { font-size: 1.4rem; color: #b9d2cb; }
.mini.is-prov .mini-score::before { content: "So far "; font-family: var(--body); font-size: 0.8rem; font-weight: 600; }
.c-prov { background: transparent; outline: 2px dashed var(--muted); outline-offset: -2px; }
.prov-mark { margin-left: 2px; color: var(--muted); }
.scale-list { font-family: var(--body); }

/* ---------- footer links, plain pages ---------- */
.site-foot a { color: #f6c500; }
.foot-nav { list-style: none; margin: 16px 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 0 20px; }
.foot-nav a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; font-weight: 600; }
.foot-legal { color: #a9c0b8; font-size: 0.9rem; }
.page { background-color: var(--bg); background-image: var(--grid); padding: 40px 0 72px; }
.page .prose { background: var(--surface); border-top: 8px solid var(--accent); border-radius: 6px; padding: 32px 24px 24px; max-width: 760px; }
.page h1 { margin-bottom: 16px; }
.page .prose a { overflow-wrap: anywhere; }
.page .prose h2 { font-size: 1.5rem; margin: 36px 0 10px; }
.page .lead { font-size: 1.12rem; }
.page .updated { color: var(--muted); font-size: 0.92rem; margin-top: 32px; }
.confirm-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 12px 0 0; }
.confirm-msg { min-height: 1.5em; font-weight: 600; margin: 12px 0 0; }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: var(--surface); }
@media (min-width: 700px) { .page .prose { padding: 40px 48px 32px; } }
@media (max-width: 600px) {
  .page { padding: 16px 0 48px; }
  .page .prose { padding: 24px 16px 20px; }
  .checklist > li { padding-left: 38px; }
}
/* Laptops with short screens: a more compact panel so the sticky result fits beside the questions. */
@media (min-width: 980px) and (max-height: 959px) {
  .result { padding: 14px 20px 18px; }
  .result-name { font-size: 1.25rem; margin-bottom: 4px; }
  .gauge-box .gauge { max-width: 200px; }
  .score-num { font-size: 3rem; }
  .verdict { margin-top: 2px; }
  .basis { margin-bottom: 4px; }
  .exploded { margin: 4px 0 10px; }
}
@media (min-width: 601px) and (max-width: 979px) {
  .exploded { max-width: 440px; margin-left: auto; margin-right: auto; }
  .result-actions { max-width: 440px; margin: 0 auto; }
}
@media print { .ad-slot, .foot-nav { display: none !important; } .guide-body { display: block !important; } .fold-btn::after { content: "" !important; } }

/* ---------- phones ---------- */
input, select, textarea { font-size: max(16px, 1em); }
.more-row { display: none; margin: 16px 0 0; }
.q-more { margin-top: 40px; }
.q-more > summary { font-family: var(--body); font-size: 1.05rem; color: var(--muted); }
.q-more-note { font-weight: 400; }
.q-more .q:first-of-type { margin-top: 0; }
.site-foot :focus-visible { outline-color: #f6c500; }
main { scroll-margin-top: 0; }

/* Touch targets: 44 x 44px at every width. */
.btn-link { min-height: 44px; min-width: 44px; padding: 10px 6px; }
.acts .btn-link + .btn-link { margin-left: 12px; }
.check { min-width: 44px; justify-content: center; }
.th-btn { min-width: 44px; }
.nav a { min-width: 44px; justify-content: center; }
@media (max-width: 899px) {
  .snack { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 600px) {
  .slider-row input { height: 44px; }
  .toolbar .btn { flex: 1 1 auto; }
  .result { padding: 16px 16px 20px; }
  .exploded { aspect-ratio: 250 / 261; max-width: 330px; margin-left: auto; margin-right: auto; }
  .exploded .compact .pl-code { font-size: 12px; }
  .exploded .compact .pl-label { font-size: 12.5px; }
  .exploded .compact .pl-val { font-size: 13px; }
  .fasteners { padding: 16px 8px 10px; }
  .fs-label text { font-size: 21px; }
  .questions { min-height: 0; }
  .more-row { display: block; }
  .more-btn { width: 100%; }
  .compare { min-width: 0; width: 100%; table-layout: fixed; font-size: 0.9rem; }
  .compare.cmp-n3 { min-width: 470px; }
  .compare.cmp-n4 { min-width: 600px; }
  .compare th, .compare td { padding: 8px 6px; }
  .compare th[scope="row"] { min-width: 88px; width: 88px; }
  .compare thead th { min-width: 124px; overflow-wrap: anywhere; }
  .cmp-long { display: none; }
  .cmp-short { display: block; }
  .compare .code { font-size: 12.5px; }
  .reason-list:not(.show-all) > .extra { display: none; }
  .tips:not(.show-all) > .extra { display: none; }
  .matrix tbody:not(.show-all) > .extra { display: none; }
  .band { padding: 40px 0; }
  .bench { padding: 24px 0 40px; }
  .prose > h2 { margin-bottom: 20px; }
}

/* ---------- print: always the light palette, tool chrome removed ---------- */
@media print {
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    color-scheme: light;
    --bg: #eef1e9;
    --bg-alt: #e2e8db;
    --surface: #fbfcf8;
    --ink: #11302c;
    --muted: #48605a;
    --hair: #c3cdc1;
    --accent: #f6c500;
    --accent-ink: #1c1a05;
    --panel: #0f4640;
    --panel-ink: #f2f6ee;
    --panel-muted: #b9d2cb;
    --panel-line: rgba(242, 246, 238, 0.28);
    --link: #0a574f;
    --danger: #a12f17;
    --good-bg: #cfe9d7;
    --mid-bg: #fbe894;
    --low-bg: #fbd9b6;
    --poor-bg: #f5c6b9;
    --p-good: #7fd69b;
    --p-mid: #f6c500;
    --p-low: #ff9f4a;
    --p-poor: #ff6f52;
    --grid: none;
  }
  body { font-size: 11.5pt; padding-bottom: 0; background: #fff; }
  .site-head nav, .theme-btn, .skip, .mini, .snack, .score-form, .result-actions, .share-fallback,
  .toolbar, #export-note, .acts, .cmp, .compare-head button, .sponsored, .th-btn span { display: none !important; }
  .site-head, .result, .fasteners, .chip, .r-bar span, .code, .site-foot, .is-best, .best-tag {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .bench { padding: 16px 0 24px; background: #fff; }
  .bench-grid { display: block; }
  .result { position: static; max-width: 420px; margin-top: 16px; break-inside: avoid; }
  .band { padding: 24px 0; background: #fff; }
  .reason, .faq, .glossary, .fasteners, tr { break-inside: avoid; }
  h2, h3 { break-after: avoid; }
  details > *:not(summary) { display: block; }
  summary::after { content: ""; }
  .matrix-wrap { border-width: 1px; }
  .more-row, .to-top { display: none !important; }
  a { color: inherit; text-decoration: none; }
}
