:root {
  --bg: #f7f1df;
  --paper: #fffaf0;
  --surface: #ffffff;
  --ink: #18211f;
  --muted: #5a655f;
  --line: #cfc5aa;
  --brand: #2f8f5b;
  --brand-strong: #18613c;
  --brand-soft: #d9ead7;
  --road: #26302d;
  --amber: #f5c04a;
  --amber-soft: #fff0bf;
  --danger: #a73528;
  --danger-soft: #ffe0dc;
  --focus: #0b62c4;
  --shadow: 0 18px 42px rgba(24, 33, 31, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1916;
    --paper: #13211d;
    --surface: #182622;
    --ink: #f7f1df;
    --muted: #c9d1c6;
    --line: #3b5048;
    --brand: #70d790;
    --brand-strong: #95e8aa;
    --brand-soft: #203a2e;
    --road: #0b100f;
    --amber: #ffd36c;
    --amber-soft: #493b18;
    --danger: #ffafa6;
    --danger-soft: #4d211f;
    --focus: #8cc6ff;
    --shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
  }
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light dark;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, var(--paper) 0, var(--bg) 430px),
    var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.55;
}

a {
  color: var(--brand-strong);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

img,
svg {
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -5rem;
  z-index: 20;
  background: var(--ink);
  color: var(--bg);
  padding: 0.7rem 0.9rem;
}

.skip-link:focus {
  top: 1rem;
}

.site-header,
.site-footer,
main {
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.brand img {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
}

.site-header nav,
.site-footer nav,
.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.site-header nav a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.site-header nav a[aria-current="page"] {
  color: var(--brand-strong);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  align-items: center;
  padding: clamp(2rem, 8vw, 5rem) 0 1.4rem;
}

.hero-copy {
  max-width: 850px;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--brand-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

h1 {
  max-width: 880px;
  font-size: clamp(2.45rem, 9vw, 5.8rem);
}

h2 {
  font-size: clamp(1.65rem, 5vw, 3rem);
}

h3 {
  font-size: 1.2rem;
}

p {
  margin: 0 0 1rem;
}

.lede,
.article-lede {
  max-width: 760px;
  color: var(--muted);
  font-size: clamp(1.08rem, 2.4vw, 1.33rem);
}

.plain-note,
.muted,
.form-note,
.copy-status,
.form-status {
  color: var(--muted);
}

.plain-note {
  max-width: 720px;
  font-weight: 700;
}

.road-panel {
  position: relative;
  min-height: 220px;
  overflow: hidden;
  background:
    linear-gradient(108deg, transparent 0 28%, var(--road) 28% 72%, transparent 72% 100%),
    linear-gradient(180deg, var(--brand-soft), var(--paper));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.road-line {
  position: absolute;
  left: 49%;
  top: -18px;
  width: 14px;
  height: 280px;
  background: repeating-linear-gradient(180deg, var(--amber) 0 34px, transparent 34px 60px);
  transform: rotate(8deg);
}

.road-check {
  position: absolute;
  right: 28px;
  bottom: 28px;
  width: 84px;
  height: 84px;
  border: 8px solid var(--brand);
  border-radius: 50%;
  background: var(--surface);
}

.road-check::after {
  content: "";
  position: absolute;
  left: 20px;
  top: 24px;
  width: 32px;
  height: 18px;
  border-left: 8px solid var(--brand-strong);
  border-bottom: 8px solid var(--brand-strong);
  transform: rotate(-45deg);
}

.tool-shell,
.feedback-section,
.article,
.not-found {
  margin: 1.4rem 0;
  padding: clamp(1rem, 4vw, 1.5rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.section-head {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.step-tabs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin: 1rem 0;
}

.step-tab,
.button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.step-tab {
  background: var(--paper);
  color: var(--ink);
  padding: 0.75rem 0.9rem;
  text-align: left;
}

.step-tab[aria-selected="true"] {
  background: var(--road);
  border-color: var(--road);
  color: #fffaf0;
}

.step-panel {
  padding-top: 0.5rem;
}

.two-column,
.score-top,
.compare-head {
  display: grid;
  gap: 1rem;
}

.toggle-list,
.prep-list,
.cars-area,
.comparison-area {
  display: grid;
  gap: 0.75rem;
}

.toggle-list label,
.prep-item,
.category-card,
.car-card,
.empty-state,
.score-pill,
.note-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.toggle-list label,
.prep-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-height: 50px;
  padding: 0.75rem;
}

input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  flex: 0 0 auto;
  accent-color: var(--brand);
}

.prep-item.done {
  background: var(--brand-soft);
}

.add-car-form {
  display: grid;
  gap: 0.5rem;
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--ink);
  font-weight: 800;
}

label span,
.small-text {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  padding: 0.72rem 0.8rem;
}

textarea {
  resize: vertical;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 0.95rem;
  text-decoration: none;
}

.button.primary {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
  color: #ffffff;
}

.button.secondary {
  background: var(--paper);
  color: var(--ink);
}

.button.danger {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.car-card {
  padding: 1rem;
}

.car-head {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.car-title-row,
.category-top,
.weight-row,
.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.car-title {
  font-size: 1.25rem;
  font-weight: 900;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0.45rem 0.7rem;
  color: var(--brand-strong);
  font-weight: 900;
}

.category-card {
  padding: 0.85rem;
  margin-bottom: 0.75rem;
}

.rating-options,
.weight-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.rating-options label,
.weight-options label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.weight-options label {
  min-width: 92px;
}

.rating-options input,
.weight-options input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.rating-options label:has(input:checked),
.weight-options label:has(input:checked) {
  background: var(--amber-soft);
  border-color: var(--amber);
  color: var(--ink);
}

.car-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.comparison-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  background: var(--surface);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.75rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--paper);
}

td.best {
  background: var(--brand-soft);
  color: var(--ink);
  font-weight: 900;
}

tfoot th,
tfoot td {
  font-weight: 900;
}

.ranking {
  margin-top: 1rem;
  padding: 0.9rem;
  border-left: 6px solid var(--brand);
  background: var(--brand-soft);
  font-weight: 800;
}

.notes-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.note-block {
  padding: 0.85rem;
}

.feedback-section form {
  display: grid;
  gap: 0.85rem;
  max-width: 720px;
}

.visually-hidden,
.honeypot {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.article {
  max-width: 850px;
}

.article h2 {
  margin-top: 2rem;
  font-size: clamp(1.45rem, 4vw, 2.15rem);
}

.article h3 {
  margin-top: 1.2rem;
}

.article p {
  color: var(--ink);
}

.article .article-lede {
  color: var(--muted);
}

.site-footer {
  padding: 2rem 0 3rem;
}

.site-footer p {
  margin-bottom: 0.55rem;
}

.site-footer a {
  color: var(--ink);
}

@media (min-width: 740px) {
  .hero {
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.8fr);
  }

  .step-tabs {
    grid-template-columns: repeat(3, 1fr);
  }

  .step-tab {
    text-align: center;
  }

  .two-column,
  .score-top,
  .compare-head {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.9fr);
    align-items: start;
  }

  .add-car-form {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .add-car-form label {
    grid-column: 1 / -1;
  }

  .car-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }
}

@media (max-width: 560px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand span {
    font-size: 1.05rem;
  }

  .actions .button,
  .car-actions .button {
    width: 100%;
  }

  .road-panel {
    min-height: 160px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

@media print {
  body {
    background: #ffffff;
    color: #000000;
  }

  .skip-link,
  .site-header,
  .hero,
  .step-tabs,
  #panel-prep,
  #panel-score,
  .feedback-section,
  .site-footer,
  .compare-head .actions,
  #copyStatus {
    display: none !important;
  }

  main,
  .tool-shell {
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  #panel-compare {
    display: block !important;
  }

  .comparison-scroll {
    overflow: visible;
    border: 0;
  }

  table {
    min-width: 0;
  }

  .note-block,
  .ranking {
    border: 1px solid #999999;
    background: #ffffff;
  }
}

/* :WHY? wg-pages-deploy.sh stamps a version line with an inline style attribute,
   which this site's CSP (style-src 'self') blocks; this rule styles it instead. */
.wg-version { text-align: center; padding: 14px 12px; font: 400 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; opacity: .6; letter-spacing: .04em; }
