/* Forza Horizon 6 Car Database - styles.css (no external fonts or assets) */

:root {
  color-scheme: dark;
  --bg: #0b0d11;
  --bg-2: #0f1217;
  --panel: #14171c;
  --panel-2: #1a1f27;
  --panel-3: #222833;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --line-3: rgba(255, 255, 255, 0.24);
  --grid: #252a33;
  --axis: #3a414d;
  --ink: #f2f4f7;
  --ink-2: #c3c9d3;
  --ink-3: #8d95a3;
  --ink-4: #5f6775;
  --link: #8cc4ff;
  --accent: #ff4f9a;
  --accent-2: #ff8a3d;
  --accent-soft: rgba(255, 79, 154, 0.14);
  --focus: #ffd166;
  --good: #0ca30c;
  --crit: #d03b3b;
  --s1: #3987e5;
  --radius: 14px;
  --radius-sm: 9px;
  --hdr-h: 64px;
  --ovbar-h: 60px;
  /* index.html sets viewport-fit=cover, so keep content clear of notches and the home indicator. */
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  --silhouette: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 287'%3E%3Cellipse cx='264' cy='244' rx='214' ry='9' fill='%23000' opacity='.35'/%3E%3Cpath d='M46 196C46 182 58 172 84 168L150 160C178 136 214 116 262 112H318C352 114 380 128 408 150L452 158C472 162 482 174 482 188V200C482 206 478 210 472 210H432A37 37 0 0 0 358 210H168A37 37 0 0 0 94 210H56C50 210 46 206 46 200Z' fill='%232b323d'/%3E%3Cpath d='M178 158C198 138 226 124 258 121H296L298 157ZM308 121H318C344 123 366 134 388 152L310 157Z' fill='%23394252'/%3E%3Ccircle cx='131' cy='210' r='30' fill='%23181c23'/%3E%3Ccircle cx='395' cy='210' r='30' fill='%23181c23'/%3E%3Ccircle cx='131' cy='210' r='13' fill='%233a4250'/%3E%3Ccircle cx='395' cy='210' r='13' fill='%233a4250'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  padding: 0 var(--safe-r) 0 var(--safe-l);
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
body.ov-open { overflow: hidden; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.2; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.u { color: var(--ink-3); font-size: 0.86em; font-weight: 500; }
.na { color: var(--ink-4); }
.cr { color: var(--ink-3); font-size: 0.82em; font-weight: 600; letter-spacing: 0.04em; }
kbd {
  font: 600 10px/1 var(--mono); padding: 3px 5px; border-radius: 4px;
  border: 1px solid var(--line-2); color: var(--ink-3); background: rgba(255, 255, 255, 0.03);
}
.skip {
  position: absolute; left: 12px; top: -48px; z-index: 100; padding: 10px 14px; border-radius: 8px;
  background: var(--ink); color: #0b0d11; font-weight: 700;
}
.skip:focus { top: 12px; }
.noscript { padding: 24px; text-align: center; }
.fatal { max-width: 560px; margin: 60px auto; text-align: center; color: var(--ink-2); }

/* icons inside controls */
.btn svg, .seg svg, .pill svg, .mini-tag svg, .ms-btn svg, .input-ico svg, .search-ico, .pin svg, .tray-x svg, .cmp-x svg, .kbd-ico svg, .pi-arrow svg {
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none;
}

/* engine position + drivetrain icons (dgGlyph in app.js): the game's art (each .dg-<drive>[-<placement>] sets --dg in
   data/drivetrain-icons.css), painted in the text colour through its alpha (ink on the panels, near-black on the white
   pressed chip and checked tile); the half-transparent body is the car, the opaque parts the engine and the driven axles.
   A background, so it is told to print; without its stylesheet an icon is blank, not a solid block. The element is an
   <svg>, so under forced colours the default forced-color-adjust (preserve-parent-color) paints it in its parent's forced
   text colour and leaves the masked background alone. */
.dg {
  display: inline-block; flex: none; background: currentColor; -webkit-print-color-adjust: exact; print-color-adjust: exact;
  -webkit-mask: var(--dg, linear-gradient(transparent, transparent)) center / contain no-repeat;
  mask: var(--dg, linear-gradient(transparent, transparent)) center / contain no-repeat;
}
.dg-s { width: 31px; height: 16px; }
.dg-m { width: 35px; height: 18px; }
.dg-l { width: 39px; height: 20px; }
/* icon + words (specifications, compare, car page) or the icon alone (cars table); top-aligned so rows keep their height */
.drv { display: inline-flex; align-items: center; gap: 4px; vertical-align: top; white-space: nowrap; }
/* card sub-line: the icon leads the 17px line; lifted off ink-3 only when colours are not forced (a colour set on the
   icon itself would survive forced colours) */
.card-sub > .dg { margin-right: 1px; }
@media (forced-colors: none) { .card-sub > .dg { color: var(--ink-2); } }

/* ------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ink);
  font-weight: 650; font-size: 13px; white-space: nowrap; text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--panel-3); border-color: var(--line-3); text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.06); }
.btn.primary { background: linear-gradient(120deg, var(--accent), var(--accent-2)); border-color: transparent; color: #1a0610; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.icon { width: 36px; padding: 0; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12px; }
.btn.sm.icon { width: 30px; padding: 0; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }
.btn kbd { margin-left: 4px; }
.linkish { background: none; border: 0; padding: 0; color: var(--link); text-align: left; font-weight: 600; }
.linkish:hover { text-decoration: underline; }

/* --------------------------------------------------------- segmented */
.seg {
  display: inline-flex; gap: 2px; margin: 0; padding: 3px; min-width: 0;
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel);
}
.seg label { position: relative; display: block; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg span {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px;
  color: var(--ink-2); font-weight: 650; font-size: 12.5px; white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}
.seg span svg { width: 15px; height: 15px; }
.seg label:hover span { color: var(--ink); }
.seg input:checked + span { background: var(--ink); color: #0b0d11; }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
.seg-sm span { height: 28px; padding: 0 11px; font-size: 12px; }

/* --------------------------------------------------------------- header */
.hdr {
  position: sticky; top: 0; z-index: 40;
  background: rgba(11, 13, 17, 0.88);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.hdr::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, var(--accent), var(--accent-2) 35%, rgba(255, 138, 61, 0) 75%);
  opacity: 0.75;
}
.hdr-in {
  max-width: 1640px; margin: 0 auto; height: var(--hdr-h); padding: 0 24px;
  display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); flex: none; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-flex; gap: 3px; transform: skewX(-18deg); margin-right: 2px; }
.brand-mark i { display: block; width: 6px; height: 28px; border-radius: 2px; background: linear-gradient(180deg, var(--accent), var(--accent-2)); }
.brand-mark i:nth-child(2) { opacity: 0.72; }
.brand-mark i:nth-child(3) { opacity: 0.45; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.05; }
.brand-top { font-size: 10.5px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); }
.brand-main { font-size: 19px; font-weight: 850; font-style: italic; letter-spacing: -0.01em; text-transform: uppercase; }
.count-pill {
  flex: none; height: 26px; padding: 0 10px; display: inline-flex; align-items: center; border-radius: 999px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); color: var(--ink-2); font-size: 12px; font-weight: 650;
}
.search { position: relative; flex: 1 1 auto; max-width: 560px; margin-left: auto; }
.search-ico { position: absolute; left: 13px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input {
  width: 100%; height: 40px; padding: 0 44px 0 40px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line-2); color: var(--ink);
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-kbd { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search input:focus ~ .search-kbd, .search input:not(:placeholder-shown) ~ .search-kbd { display: none; }
.hdr-dl svg { width: 16px; height: 16px; }

/* ---------------------------------------------------------- filter bar */
.fbar { max-width: 1640px; margin: 0 auto; padding: 16px 24px 0; }
.fbar-in { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; }
.fgrp { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.flbl, .fg-t, .sub-lbl {
  font-size: 11px; font-weight: 750; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-3);
}
.fbar-end { display: flex; gap: 8px; margin-left: auto; }
.fb-more[aria-expanded="true"] { border-color: var(--accent); background: var(--accent-soft); }
.fb-n {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: #1a0610; font-size: 11px; font-weight: 800;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--ink-2);
  font-weight: 650; font-size: 12.5px; white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.chip:hover { border-color: var(--line-3); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #0b0d11; }
.chip-n { font-weight: 500; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] .chip-n { color: #4b5261; }
/* no car for it: the label and icon dimmed, not the chip, so its outline and focus ring keep their contrast (and the
   label still 4.5:1); the count, already ink-3, stays as it is */
.chip.zero > :not(.chip-n) { opacity: 0.6; }
.chip-cls { padding-left: 4px; }
.chip-cls .chip-l {
  display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--cc); color: var(--ci); font-weight: 850; font-size: 12px;
}
.chip-cls[aria-pressed="true"] { background: rgba(255, 255, 255, 0.1); background: color-mix(in srgb, var(--cc) 24%, var(--panel)); border-color: var(--cc); color: var(--ink); }
.chip-cls[aria-pressed="true"] .chip-n { color: var(--ink-2); }
/* Drive, Engine and Layout chips lead with a drivetrain icon: tighter, so the groups stay compact */
.chip-drv { padding-left: 6px; gap: 5px; }
.rar-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--rc); }

/* ---------------------------------------------------------- filter panel */
.fpanel { max-width: 1640px; margin: 12px auto 0; padding: 0 24px; }
.fpanel-in {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px 22px;
  padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.fg { min-width: 0; margin: 0; padding: 0; border: 0; }
.fg-t { display: block; margin: 0 0 9px; padding: 0; }
.fg-hint { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--ink-3); margin-left: 6px; }
/* the drivetrain mode on the bar's Drive label, when not stock */
.fl-m { text-transform: none; letter-spacing: 0; font-weight: 500; }
.fg-engine {
  grid-column: span 2; padding: 14px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(25, 158, 112, 0.09), rgba(57, 135, 229, 0.06));
  border: 1px solid rgba(25, 158, 112, 0.28);
}
.fg-engine legend { float: left; width: 100%; }
/* Drivetrain: as tall as its chips; beside Engine in one column when the grid has fewer than 4 */
.fg-drive { align-self: start; }
.fpanel { container-type: inline-size; }
@container (width < 1104px) { .fg-drive { grid-column: span 1; } }
.fg-engine legend + * { clear: both; }
.eng-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.eng-top .input-ico { flex: 1 1 220px; max-width: none; }
.sub-lbl { margin: 10px 0 6px; font-size: 10.5px; }
.fg-ranges { display: flex; flex-direction: column; gap: 14px; }
.range { display: flex; align-items: center; gap: 8px; }
.range input {
  width: 100%; min-width: 0; height: 36px; padding: 0 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--panel-2); font-variant-numeric: tabular-nums;
}
.range input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.range-sep { color: var(--ink-3); font-size: 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--ink-2); cursor: pointer; font-size: 13px; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.ms-gap { margin-top: 10px; }
.input-ico { position: relative; flex: 1; min-width: 180px; max-width: 440px; }
.input-ico > svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.input-ico input {
  width: 100%; height: 36px; padding: 0 12px 0 36px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--panel-2);
}
.input-ico input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* multi-select */
.ms { position: relative; }
.ms-btn {
  width: 100%; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--panel-2); text-align: left;
}
.ms-btn:hover { border-color: var(--line-3); }
.ms-btn[aria-expanded="true"] { border-color: var(--accent); }
.ms-t { font-weight: 650; }
.ms-v { margin-left: auto; color: var(--ink-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 62%; }
.ms-btn svg { width: 15px; height: 15px; color: var(--ink-3); transition: transform 0.15s; }
.ms-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.ms-pop {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); min-width: 250px; padding: 8px;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
.ms-q { width: 100%; height: 34px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--bg-2); }
.ms-q:focus { outline: none; border-color: var(--accent); }
.ms-list { list-style: none; margin: 8px 0; padding: 0; max-height: 300px; overflow: auto; overscroll-behavior: contain; }
.ms-it label { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.ms-it label:hover { background: var(--panel-3); }
.ms-it input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex: none; }
.ms-it.zero .ms-l { color: var(--ink-4); }
.ms-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-n { margin-left: auto; color: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.ms-logo { width: 24px; height: 24px; display: inline-grid; place-items: center; flex: none; border-radius: 6px; background: #07080b; }
.ms-logo img { max-width: 18px; max-height: 18px; object-fit: contain; }
.ms-gh { padding: 10px 8px 3px; }
.ms-gbtn { background: none; border: 0; padding: 0; font-size: 10.5px; font-weight: 750; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.ms-gbtn:hover { color: var(--ink); }
.ms-foot { display: flex; justify-content: space-between; gap: 8px; }
.ms-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.ms-tags:empty { display: none; }
.mini-tag {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 6px 0 9px; border-radius: 999px;
  background: var(--accent-soft); border: 1px solid rgba(255, 79, 154, 0.35); color: var(--ink); font-size: 12px; font-weight: 600;
}
.mini-tag svg { width: 13px; height: 13px; }

/* --------------------------------------------------------- results bar */
.results { max-width: 1640px; margin: 0 auto; padding: 16px 24px calc(110px + var(--safe-b)); outline: none; }
.rbar-in { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; }
.rcount { margin: 0; color: var(--ink-2); white-space: nowrap; }
.rcount strong { color: var(--ink); font-size: 17px; font-weight: 800; }
.pills { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; min-width: 0; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; max-width: 360px; padding: 0 8px 0 11px; border-radius: 999px;
  background: var(--accent-soft); border: 1px solid rgba(255, 79, 154, 0.35); color: var(--ink); font-size: 12px; font-weight: 600;
}
.pill:hover { border-color: var(--accent); }
.pill .pl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill svg { width: 14px; height: 14px; }
.pill-clear { background: transparent; border-color: var(--line-2); color: var(--ink-2); padding: 0 11px; }
.rbar-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.sortsel select {
  height: 36px; padding: 0 34px 0 14px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--panel-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5.5 7.5 4.5 4.5 4.5-4.5' fill='none' stroke='%238d95a3' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 11px center / 15px 15px;
  -webkit-appearance: none; appearance: none; font-weight: 650; font-size: 13px;
}
.sortsel select:hover { border-color: var(--line-3); }
.sortsel option { background: var(--panel-2); color: var(--ink); }

/* ---------------------------------------------------------------- table */
/* position: relative makes the frame the containing block of the visually hidden (absolute) labels in the
   cells; without it they escape the horizontal scroll and widen the whole page on narrow screens. */
.tbl-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
/* 7px sides (cells and header buttons alike) leave room for the drivetrain icon in the Drive column */
.tbl th, .tbl td { padding: 6px 7px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl thead th { background: var(--panel-2); padding: 0; font-size: 10.5px; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.tbl thead th:first-child { border-top-left-radius: var(--radius); }
.tbl thead th:last-child { border-top-right-radius: var(--radius); }
.th-btn {
  display: flex; align-items: center; gap: 4px; width: 100%; padding: 11px 7px; border: 0; background: none;
  color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; text-align: inherit;
}
.th-btn:hover { color: var(--ink); }
.th-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; border-radius: 6px; }
.num .th-btn { justify-content: flex-end; }
.th.sorted, .tbl thead th.sorted { color: var(--ink); }
.sort-ind { display: inline-flex; width: 13px; height: 13px; }
.sort-ind:empty { display: none; }
.sort-ind svg { width: 13px; height: 13px; fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover td { background: rgba(255, 255, 255, 0.035); }
.num { text-align: right !important; }
.tbl .c-img { width: 86px; padding: 4px 4px 4px 10px; }
.thumb {
  display: block; position: relative; overflow: hidden; border-radius: 7px;
  background: radial-gradient(ellipse at 50% 72%, #262d38, #161a21 72%);
}
.thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.thumb.noimg { background: var(--silhouette) center 58% / 84% auto no-repeat, radial-gradient(ellipse at 50% 72%, #222832, #151920 72%); }
.thumb.ph-sm { width: 72px; height: 40px; }
.tbl .c-name .car-link, .tbl .c-name .sub { max-width: 270px; }
.car-link { display: block; color: var(--ink); font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
.car-link:hover { color: #fff; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.tbl .sub { display: block; font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; }
.tbl .c-eng .eng { max-width: 170px; }
.eng { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
/* a car matched through an engine swap: the engine, under the car's own; through a drivetrain swap: the drives it
   gets, under its icon */
.c-eng .swap-b, .c-drv .swap-b { display: block; width: max-content; height: auto; margin-top: 3px; line-height: 17px; }
.c-eng .swap-b { max-width: 210px; overflow: hidden; text-overflow: ellipsis; }
.tbl .c-pin { width: 46px; padding-right: 12px; }

/* class badge */
.badge {
  display: inline-flex; align-items: stretch; height: 22px; border-radius: 6px; overflow: hidden; vertical-align: middle;
  font-size: 12px; line-height: 22px; font-weight: 800; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 1px var(--bc);
}
.badge b { background: var(--bc); color: var(--bi); min-width: 25px; padding: 0 6px; text-align: center; font-weight: 850; }
.badge i { font-style: normal; padding: 0 7px; background: #07080b; color: var(--ink); }
.badge.lg { height: 36px; line-height: 36px; font-size: 19px; border-radius: 9px; }
.badge.lg b { min-width: 44px; padding: 0 11px; }
.badge.lg i { padding: 0 13px; }
.badge.ghost { opacity: 0.92; }

/* swap badge */
.swap-b {
  display: inline-flex; align-items: center; gap: 4px; height: 19px; padding: 0 7px; border-radius: 999px; white-space: nowrap;
  border: 1px solid rgba(25, 158, 112, 0.6); background: rgba(25, 158, 112, 0.14); color: #b6f0d9; font-size: 11px; font-weight: 650;
}
.swap-more { color: #8fd8bc; font-weight: 600; }

/* pin button */
.pin {
  position: relative; display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border-radius: 999px;
  border: 1px solid var(--line-2); background: rgba(11, 13, 17, 0.72); color: var(--ink-2);
}
.pin:hover { color: var(--ink); border-color: var(--line-3); }
.pin svg { grid-area: 1 / 1; width: 14px; height: 14px; stroke-width: 2.2; }
.pin svg + svg { display: none; }
.pin[aria-pressed="true"] { background: var(--pc, var(--accent)); border-color: transparent; color: #fff; }
.pin[aria-pressed="true"] svg { display: none; }
.pin[aria-pressed="true"] svg + svg { display: block; }

/* ---------------------------------------------------------------- grid */
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 14px; }
.card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  content-visibility: auto; contain-intrinsic-size: auto 340px;
}
.card:hover { border-color: var(--line-3); transform: translateY(-2px); box-shadow: var(--shadow); }
.card:focus-within { border-color: var(--line-3); }
.card-media {
  position: relative; aspect-ratio: 512 / 287;
  background: radial-gradient(ellipse 70% 40% at 50% 88%, rgba(255, 255, 255, 0.07), transparent 70%), linear-gradient(180deg, #1c222b, #12161c);
}
.thumb.ph-card { width: 100%; height: 100%; border-radius: 0; background: none; }
.thumb.ph-card.noimg { background: var(--silhouette) center 58% / 80% auto no-repeat; }
.card-media .badge { position: absolute; left: 10px; top: 10px; }
.card .pin { position: absolute; right: 10px; top: 10px; z-index: 2; }
.card-body { display: flex; flex-direction: column; gap: 5px; flex: 1; padding: 10px 14px 12px; }
.card-make { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.card-make span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo { display: inline-grid; place-items: center; flex: none; background: #07080b; border: 1px solid var(--line); }
.logo img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-sm { width: 22px; height: 22px; padding: 3px; border-radius: 6px; }
.card-title { margin: 0; font-size: 16.5px; font-weight: 800; line-height: 1.2; }
.card-title a { color: var(--ink); }
.card-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: var(--radius); }
.card-title a:focus-visible { outline: none; }
.card-title a:focus-visible::after { outline: 2px solid var(--focus); outline-offset: -2px; }
.card-title a:hover { text-decoration: none; }
/* icon, drive and any drivetrain-swap badge keep their width; the category after them takes what is left, cut short,
   or wraps under a badge that leaves it too little room */
.card-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.card-sub > * { flex: none; }
.card-sub > .cs-t { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.card-sub > .swap-b ~ .cs-t { min-width: 3em; }
.card-sub > .swap-b { height: 16px; padding: 0 6px; font-size: 10.5px; }
.card-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 6px 0 0; }
.card-stats dt { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 650; }
.card-stats dd { margin: 0; font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-stats .u { font-size: 0.8em; }
.card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: auto; padding-top: 9px; border-top: 1px solid var(--line); font-size: 12px;
}
.card-eng { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; color: var(--ink-2); overflow: hidden; }
.card-price { font-weight: 700; white-space: nowrap; }

/* empty states */
.empty { text-align: center; padding: 70px 20px; color: var(--ink-2); }
.empty h2 { margin: 0 0 6px; font-size: 20px; }
.empty p { margin: 0 0 18px; color: var(--ink-3); }
.sentinel { height: 1px; }

/* ----------------------------------------------------------------- tray */
.tray { position: fixed; left: 50%; bottom: calc(16px + var(--safe-b)); z-index: 45; transform: translateX(-50%); max-width: calc(100% - 20px); }
.tray-in {
  display: flex; align-items: center; gap: 10px; padding: 7px 7px 7px 16px; border-radius: 999px;
  background: rgba(26, 31, 39, 0.94); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--line-2); box-shadow: var(--shadow);
}
.tray-t { font-size: 11px; font-weight: 750; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-3); }
.tray-list { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; min-width: 0; overflow-x: auto; }
.tray-list li { position: relative; display: flex; align-items: center; gap: 2px; padding: 3px 4px 3px 3px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); box-shadow: inset 0 -2px 0 var(--c); }
.tray-car { display: flex; align-items: center; gap: 6px; color: var(--ink); font-size: 12px; font-weight: 650; }
.tray-car:hover { text-decoration: none; }
.thumb.ph-xs { width: 44px; height: 25px; border-radius: 999px; }
.tray-n { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-x { display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--ink-3); }
.tray-x:hover { color: var(--ink); background: rgba(255, 255, 255, 0.08); }
.tray-x svg { width: 13px; height: 13px; }

.toast {
  position: fixed; left: 50%; bottom: calc(86px + var(--safe-b)); z-index: 70; max-width: calc(100% - 32px);
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #0b0d11; padding: 10px 16px; border-radius: 999px; font-weight: 650; box-shadow: var(--shadow);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* -------------------------------------------------------------- overlays */
.ov {
  position: fixed; inset: 0; z-index: 50; overflow-y: auto; overscroll-behavior: contain; background: var(--bg);
  padding: 0 var(--safe-r) 0 var(--safe-l);
}
.ov-bar {
  position: sticky; top: 0; z-index: 6;
  background: rgba(11, 13, 17, 0.9); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.ov-bar-in { max-width: 1400px; margin: 0 auto; height: var(--ovbar-h); padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ov-nav { display: flex; align-items: center; gap: 8px; }
.ov-pos { min-width: 70px; text-align: center; color: var(--ink-3); font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }
.ov-title { margin: 0; font-size: 17px; font-weight: 800; outline: none; }
.pin-btn[aria-pressed="true"] { background: var(--pc, var(--accent)); border-color: transparent; color: #fff; }

/* ---------------------------------------------------------------- detail */
.dt { max-width: 1400px; margin: 0 auto; padding: 22px 24px calc(90px + var(--safe-b)); display: flex; flex-direction: column; gap: 18px; }
.dt-missing { margin: 40px 0 8px; outline: none; }
.dt-hero {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 28px; align-items: center;
  padding: 22px 30px; border-radius: 20px; overflow: hidden; border: 1px solid var(--line);
  background:
    radial-gradient(90% 85% at 24% 62%, rgba(255, 255, 255, 0.06), transparent 62%),
    linear-gradient(180deg, #161b23, #0f1218);
}
.dt-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.55;
  background: radial-gradient(70% 70% at 22% 70%, var(--cls), transparent 70%);
  -webkit-mask-image: linear-gradient(90deg, #000, transparent 70%);
  mask-image: linear-gradient(90deg, #000, transparent 70%);
  filter: saturate(0.9);
  mix-blend-mode: screen;
  opacity: 0.22;
}
.dt-hero::after {
  content: ""; position: absolute; right: -40px; top: 0; bottom: 0; width: 260px; pointer-events: none; opacity: 0.5;
  background: repeating-linear-gradient(-62deg, transparent 0 14px, rgba(255, 255, 255, 0.025) 14px 28px);
}
.dt-stage { position: relative; z-index: 1; }
.thumb.ph-hero { width: 100%; max-width: 620px; margin: 0 auto; aspect-ratio: 512 / 287; background: none; border-radius: 0; }
.thumb.ph-hero.noimg { background: var(--silhouette) center / 90% auto no-repeat; }
.thumb.ph-hero img { filter: drop-shadow(0 18px 18px rgba(0, 0, 0, 0.55)); }
.dt-head { position: relative; z-index: 1; min-width: 0; }
.dt-make { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; color: var(--ink-2); font-weight: 650; }
.logo-lg { width: 52px; height: 52px; padding: 7px; border-radius: 12px; }
.dt-mk { font-size: 15px; }
.dt-ctry { color: var(--ink-3); font-size: 13px; font-weight: 500; }
.dt-title { margin: 12px 0 12px; outline: none; }
.dt-kicker { display: block; font-size: 15px; font-weight: 650; color: var(--ink-2); }
.dt-model {
  display: block; margin-top: 2px; font-size: clamp(30px, 3.6vw, 48px); font-weight: 850; font-style: italic;
  letter-spacing: -0.02em; line-height: 1.02; overflow-wrap: anywhere;
}
.dt-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 999px; white-space: nowrap;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); font-size: 12px; font-weight: 650; color: var(--ink-2);
}
.tag-type { color: var(--ink); background: rgba(255, 255, 255, 0.1); }
.tag-warn { border-color: rgba(208, 59, 59, 0.55); color: #f4b4b4; }
.tag-rar::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--rc); }
.tag-stock {
  height: 18px; padding: 0 6px; border: 0; border-radius: 5px; vertical-align: 1px;
  background: rgba(242, 244, 247, 0.92); color: #0b0d11; font-size: 9.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
}
.dt-pi { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; }
.pi-arrow { display: inline-flex; color: var(--ink-3); }
.pi-arrow svg { width: 18px; height: 18px; }
.pi-note { color: var(--ink-3); font-size: 12px; }
.dt-facts { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 18px 0 0; }
.dt-facts dt { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.dt-facts dd { margin: 2px 0 0; font-size: 15px; font-weight: 700; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile { padding: 14px 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); min-width: 0; }
.tile-l { font-size: 12px; font-weight: 650; color: var(--ink-3); }
.tile-v { margin-top: 3px; font-size: 27px; font-weight: 750; letter-spacing: -0.01em; white-space: nowrap; }
.tile-u { margin-left: 5px; font-size: 14px; font-weight: 600; color: var(--ink-3); }
.tile-s { margin-top: 1px; font-size: 12px; color: var(--ink-3); }

/* sections */
.sec { min-width: 0; padding: 18px 20px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.sec-h { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 14px; }
.sec-t { margin: 0; font-size: 13px; font-weight: 850; letter-spacing: 0.13em; text-transform: uppercase; }
.sec-t::before {
  content: ""; display: inline-block; width: 4px; height: 14px; margin-right: 9px; vertical-align: -2px; border-radius: 2px;
  background: linear-gradient(var(--accent), var(--accent-2)); transform: skewX(-14deg);
}
.sec-sub { color: var(--ink-3); font-size: 12px; }
.dt-grid { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 18px; }
.loading { margin: 8px 0; }

/* ratings: in-game style stat bars, 10 segments split by 2px surface gaps */
.ratings { display: flex; flex-direction: column; gap: 15px; }
.rt { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 6px 10px; }
.rt-l { font-size: 11px; font-weight: 750; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-2); }
.rt-v { font-size: 16px; font-weight: 750; }
.rt-bar { grid-column: 1 / -1; position: relative; height: 9px; overflow: hidden; border-radius: 0 4px 4px 0; background: rgba(57, 135, 229, 0.17); }
.rt-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; background: var(--rc, var(--s1)); }
.rt-bar::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), var(--panel) calc(10% - 2px) 10%);
}

/* spec sheet */
.specs { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px 30px; }
.spec-g h3 { margin: 0 0 4px; font-size: 11px; font-weight: 750; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-3); }
.kv { margin: 0; }
.kv > div { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--ink-3); flex: none; max-width: 55%; }
.kv dd { margin: 0; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }

/* small tables */
.tbl-scroll { overflow-x: auto; }
.tbl-sm { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.tbl-sm th, .tbl-sm td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tbl-sm thead th { font-size: 10.5px; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.tbl-sm tbody th { font-weight: 650; }
.tbl-sm tr.is-stock { background: rgba(255, 255, 255, 0.04); }
.swaps .donor { white-space: normal; min-width: 180px; }

/* power / torque chart */
.cc { position: relative; }
.cc-wrap { position: relative; }
.cc-plot { position: relative; outline: none; cursor: crosshair; touch-action: pan-y; border-radius: 8px; }
.cc-plot:focus-visible { box-shadow: 0 0 0 2px var(--focus); }
.cc-plot svg { display: block; overflow: visible; }
.cc-plot text { font-family: var(--font); }
.cc-grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.cc-base { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.cc-tick { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.cc-yl, .cc-xl, .cc-xt { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.cc-yl, .cc-xt { text-anchor: end; }
.cc-xl { text-anchor: middle; }
.cc-ttl text { fill: var(--ink-2); font-size: 12px; font-weight: 750; }
.cc-unit { fill: var(--ink-3); font-weight: 500; }
.cc-key { stroke-width: 2.5; stroke-linecap: round; }
.cc-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.cc-area { opacity: 0.1; }
.cc-peak, .cc-end, .cc-hd { stroke: var(--panel); stroke-width: 2; }
.cc-flat { stroke-width: 4; stroke-linecap: round; opacity: 0.85; }
.cc-flat-e { stroke-width: 2; stroke-linecap: round; }
.cc-pl, .cc-el {
  fill: var(--ink); font-size: 11.5px; font-weight: 650;
  paint-order: stroke; stroke: var(--panel); stroke-width: 4px; stroke-linejoin: round;
}
.cc-el { fill: var(--ink-2); font-size: 11px; font-weight: 600; }
.cc-hl { stroke: var(--ink-3); stroke-width: 1; shape-rendering: crispEdges; }
.cc-tip {
  position: absolute; top: 2px; z-index: 3; min-width: 150px; padding: 8px 10px; pointer-events: none;
  background: rgba(9, 11, 14, 0.96); border: 1px solid var(--line-2); border-radius: 9px; box-shadow: var(--shadow); font-size: 12px;
}
.cc-tip-h { margin-bottom: 4px; font-weight: 750; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cc-tip-g { margin-top: 6px; font-size: 10px; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.cc-tip-r { display: flex; align-items: center; gap: 8px; white-space: nowrap; line-height: 1.6; }
.cc-tip-r strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.cc-tip-l { color: var(--ink-3); max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.lk { display: inline-block; flex: none; width: 14px; height: 0; border-top: 2.5px solid var(--c); border-radius: 2px; }
.cc-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 12px; padding: 0; font-size: 12.5px; color: var(--ink-2); }
.cc-legend li { display: flex; align-items: center; gap: 8px; }
.cc-tbl { margin-top: 10px; }
.cc-tbl summary { cursor: pointer; color: var(--ink-3); font-size: 12px; width: max-content; }
.cc-tbl summary:hover { color: var(--ink); }
.cc-tbl-in { max-height: 300px; overflow: auto; margin-top: 8px; }

/* peak rpm band (when no curve) */
.rb-wrap { padding: 4px 2px 0; }
.rb { display: block; overflow: visible; }
.rb text { font-family: var(--font); }
.rb-track { fill: rgba(255, 255, 255, 0.07); }
.rb-red { fill: rgba(208, 59, 59, 0.35); }
.rb-rl { fill: #f4b4b4; font-size: 11px; font-weight: 650; }
.rb-tick { stroke: var(--axis); }
.rb-tl { fill: var(--ink-3); font-size: 11px; }
.rb-lead { stroke: var(--ink-4); stroke-width: 1; }
.rb-dot { stroke: var(--panel); stroke-width: 2; }
.rb-l { fill: var(--ink-3); font-size: 12px; paint-order: stroke; stroke: var(--panel); stroke-width: 4px; stroke-linejoin: round; }
.rb-v { fill: var(--ink); font-weight: 750; }

/* tabs */
.tabs { display: inline-flex; gap: 2px; margin-left: auto; padding: 3px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line-2); }
.tabs [role="tab"] { height: 30px; padding: 0 16px; border: 0; border-radius: 999px; background: none; color: var(--ink-2); font-weight: 700; font-size: 13px; }
.tabs [role="tab"]:hover { color: var(--ink); }
.tabs [aria-selected="true"] { background: var(--ink); color: #0b0d11; }
.empty-inline { padding: 30px 10px; text-align: center; }
.empty-inline p { margin: 4px 0; }

/* tuning graph */
.tg-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; margin-bottom: 10px; }
.tg-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.tg-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; font-size: 12px; color: var(--ink-2); }
.tg-legend li { display: inline-flex; align-items: center; gap: 6px; }
.lg-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.lg-ring { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--ink); }
.tg-main { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 12px; }
/* The graph fills the screen below the car page's bar (title and tools included), measured on the dynamic
   viewport so mobile browser toolbars never push it off-screen. Dragging on it pans the graph, so some page
   must stay visible to scroll by. The vh line is the fallback for browsers without dvh. */
.tg-view {
  position: relative; overflow: hidden; border-radius: 10px; border: 1px solid var(--line);
  height: clamp(200px, calc(100vh - var(--ovbar-h) - 110px), 800px);
  height: clamp(200px, calc(100dvh - var(--ovbar-h) - 110px), 800px);
  background: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.055) 1px, transparent 0) 0 0 / 22px 22px, #0f1216;
}
.tg-svg { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none; }
.tg-svg.panning { cursor: grabbing; }
.tg-svg text { font-family: var(--font); }
.tg-links path { fill: none; stroke: rgba(255, 255, 255, 0.17); stroke-width: 1.25; }
.tn { cursor: pointer; outline: none; }
.tn-bg { fill: var(--panel-2); stroke: rgba(255, 255, 255, 0.13); stroke-width: 1; transition: fill 0.12s, stroke 0.12s; }
.tn:hover .tn-bg { fill: var(--panel-3); stroke: rgba(255, 255, 255, 0.3); }
.k-root .tn-bg { fill: #2a1420; stroke: var(--accent); stroke-width: 1.5; }
.k-area .tn-bg { fill: #1f2630; stroke: rgba(255, 255, 255, 0.22); }
.k-type .tn-bg { fill: #181d25; }
.tn-l { fill: var(--ink); font-size: 12px; font-weight: 600; }
.k-root .tn-l { font-size: 13px; font-weight: 700; }
.k-area .tn-l { font-weight: 750; }
.tn-m { fill: var(--ink-3); font-size: 11px; font-weight: 400; }
.tn-ms { fill: var(--ink); font-weight: 750; }
.tn-dot { fill: var(--tc, #7d8593); }
.t-street { --tc: #256abf; }
.t-sport { --tc: #5598e7; }
.t-race { --tc: #9ec5f4; }
.t-special { --tc: #d95926; }
.t-conv { --tc: #199e70; }
.t-base { --tc: #7d8593; }
.is-stock .tn-bg { stroke: #f2f4f7; stroke-width: 1.6; }
.is-sel .tn-bg { stroke: var(--accent); stroke-width: 2; fill: #2a1822; }
.tn:focus-visible .tn-bg { stroke: var(--focus); stroke-width: 2.5; }
.tn-tog circle { fill: #0a0c10; stroke: rgba(255, 255, 255, 0.28); stroke-width: 1; }
.tn-tog path { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; }
.tn:hover .tn-tog circle { stroke: var(--accent); }
.tn.enter { animation: tnIn 0.24s ease-out both; }
@keyframes tnIn { from { opacity: 0; } to { opacity: 1; } }
.tg-help { margin: 8px 2px 0; color: var(--ink-3); font-size: 11.5px; }
.tg-side {
  min-width: 0; overflow: auto; padding: 16px;
  max-height: clamp(200px, calc(100vh - var(--ovbar-h) - 110px), 800px);
  max-height: clamp(200px, calc(100dvh - var(--ovbar-h) - 110px), 800px);
  border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line);
}
.tg-side h3 { margin: 4px 0 12px; font-size: 16px; font-weight: 800; overflow-wrap: anywhere; }
.tg-kicker { display: block; font-size: 11px; font-weight: 650; color: var(--ink-3); overflow-wrap: anywhere; }
.tg-empty h3 { margin-top: 0; }
.tg-empty p { color: var(--ink-2); font-size: 13px; }
.tg-kids { list-style: none; margin: 10px 0 0; padding: 0; }
.tg-kids li { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.tg-kids li .muted { flex: none; font-size: 11.5px; }
.tdot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--c); vertical-align: 1px; }

/* upgrade list */
.ul-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.ul-count { font-size: 12px; }
.ua { margin-bottom: 10px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.ua > summary { display: flex; align-items: baseline; gap: 10px; padding: 11px 14px; cursor: pointer; list-style: none; }
.ua > summary::-webkit-details-marker, .ub > summary::-webkit-details-marker { display: none; }
.ua > summary::before, .ub > summary::before {
  content: ""; width: 7px; height: 7px; flex: none; margin-right: 2px; align-self: center;
  border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(-45deg); transition: transform 0.15s;
}
.ua[open] > summary::before, .ub[open] > summary::before { transform: rotate(45deg); }
.ua-t { font-weight: 800; font-size: 14px; }
.ua > summary .muted { font-size: 12px; }
.ua-b { padding: 0 14px 12px; }
.ua-sub { margin: 10px 0 0; background: var(--panel); }
.ut { margin-top: 12px; }
.ut-h { display: flex; align-items: baseline; gap: 10px; }
.ut-h h4 { margin: 0; font-size: 13px; font-weight: 750; }
.ut-h .muted { font-size: 12px; }
.ut-note { margin: 4px 0 0; }
.ut-t { width: 100%; margin-top: 6px; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.ut-t th, .ut-t td { padding: 6px 8px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.ut-t thead th { font-size: 10px; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
.ut-t tbody th { font-weight: 650; white-space: nowrap; }
.ut-t .num, .ut-t .lvl { white-space: nowrap; }
.ur.is-stock { background: rgba(255, 255, 255, 0.045); }
.ur-sub > td { padding: 0 0 8px 18px; border-bottom: 1px solid var(--line); }
.attrs { white-space: normal; min-width: 200px; }
.kvc {
  display: inline-flex; gap: 4px; margin: 0 4px 3px 0; padding: 1px 8px; border-radius: 999px; white-space: nowrap;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); font-size: 11.5px; color: var(--ink-2);
}
.kvc b { color: var(--ink-3); font-weight: 600; }
.ub > summary { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; cursor: pointer; list-style: none; color: var(--link); font-weight: 650; font-size: 12.5px; }
.ub > summary .muted { font-weight: 500; }
.ub-b { padding-left: 4px; }
.ul-none { padding: 20px 0; text-align: center; }

/* presets */
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.preset { padding: 14px 16px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.preset h3 { margin: 0 0 6px; font-size: 14.5px; }
.preset p { margin: 0 0 8px; color: var(--ink-2); font-size: 13px; }
.preset-parts { display: flex; flex-wrap: wrap; gap: 5px; list-style: none; margin: 8px 0 0; padding: 0; }
.preset-parts li { padding: 2px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); font-size: 11.5px; color: var(--ink-2); }

/* --------------------------------------------------------------- compare */
.cmp { max-width: 1400px; margin: 0 auto; padding: 22px 24px calc(90px + var(--safe-b)); display: flex; flex-direction: column; gap: 18px; }
.cmp-empty { text-align: center; padding: 50px 20px; }
.cmp-empty p { color: var(--ink-2); }
.kbd-ico { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-2); vertical-align: -6px; }
.kbd-ico svg { width: 12px; height: 12px; stroke-width: 2.2; }
.cmp-hint { margin: -6px 0 0; }
/* position: relative makes the scroller the containing block of the visually hidden labels inside it, which would
   otherwise widen the page */
.cmp-scroll { position: relative; overflow-x: auto; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.cmp-t { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.cmp-t th, .cmp-t td { padding: 9px 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.cmp-t tbody tr:last-child > * { border-bottom: 0; }
.cmp-t tbody th { position: sticky; left: 0; z-index: 1; background: var(--panel); color: var(--ink-3); font-weight: 600; white-space: nowrap; }
.cmp-t td { min-width: 190px; font-weight: 600; }
.cmp-corner { position: sticky; left: 0; z-index: 2; background: var(--panel); }
.cmp-car { vertical-align: top !important; padding-top: 14px !important; min-width: 210px; }
.cmp-card { position: relative; display: flex; flex-direction: column; gap: 6px; }
.cmp-card::before { content: ""; display: block; height: 3px; border-radius: 2px; background: var(--c); margin-bottom: 4px; }
.thumb.ph-cmp { width: 100%; max-width: 230px; aspect-ratio: 512 / 287; background: radial-gradient(ellipse at 50% 75%, #262d38, transparent 70%); }
.cmp-name { color: var(--ink); font-weight: 800; font-size: 15px; line-height: 1.25; }
.cmp-kick { display: block; color: var(--ink-3); font-size: 12px; font-weight: 600; }
.cmp-key { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-3); font-size: 11px; font-weight: 500; }
.cmp-x { position: absolute; right: 0; top: 10px; z-index: 1; display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(11, 13, 17, 0.8); color: var(--ink-2); }
.cmp-x:hover { color: var(--ink); border-color: var(--line-3); }
.cmp-x svg { width: 13px; height: 13px; }
.cmp-g th { background: var(--bg-2) !important; color: var(--ink) !important; font-size: 10.5px; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
td.best { background: rgba(12, 163, 12, 0.11); }
.best-mark {
  display: inline-flex; align-items: center; margin-left: 8px; height: 17px; padding: 0 6px; border-radius: 5px; vertical-align: 1px;
  background: rgba(12, 163, 12, 0.22); color: #9be59b; font-size: 9.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
}
.cmp-rt { display: flex; align-items: center; gap: 10px; }
.cmp-rt-v { min-width: 28px; }
.cmp-rt-bar { position: relative; flex: 1; max-width: 140px; height: 7px; border-radius: 0 4px 4px 0; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.cmp-rt-bar span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; }
.pk { margin-bottom: 16px; }
.pk-t { margin: 0 0 8px; font-size: 12px; font-weight: 750; color: var(--ink-2); }
.pk-r { display: grid; grid-template-columns: minmax(120px, 200px) 1fr auto; align-items: center; gap: 12px; padding: 4px 0; }
.pk-n { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-bar { height: 12px; background: rgba(255, 255, 255, 0.05); border-radius: 0 4px 4px 0; overflow: hidden; }
.pk-fill { display: block; height: 100%; max-width: 100%; background: var(--c); border-radius: 0 4px 4px 0; }
.pk-v { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* engine power filter + engine comparison */
.minpow { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 4px 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel-2); }
.minpow:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.minpow-l { font-size: 12px; font-weight: 650; color: var(--ink-3); white-space: nowrap; }
.minpow input { width: 74px; height: 30px; padding: 0 6px; border: 0; background: transparent; font-variant-numeric: tabular-nums; outline: none; }
.minpow-u { padding-right: 8px; font-size: 12px; color: var(--ink-3); }
.eng-cmp { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -2px 0 14px; }
.eng-cmp .flbl { margin-right: 4px; }
.eng-chip .lk { border-top-color: var(--c, transparent); }
.eng-chip[aria-pressed="false"] .lk { border-top-style: dashed; border-top-color: var(--ink-4); }
.eng-chip[aria-pressed="true"] { background: rgba(255, 255, 255, 0.1); border-color: var(--line-3); color: var(--ink); }
.eng-chip[aria-pressed="true"] .chip-n { color: var(--ink-2); }
.eng-chip.is-base { cursor: default; background: rgba(255, 255, 255, 0.06); color: var(--ink); }
.cc-redz { fill: rgba(208, 59, 59, 0.1); }
.cc-redl { stroke: rgba(208, 59, 59, 0.75); stroke-width: 1; shape-rendering: crispEdges; }
.cc-redt { fill: #f0a3a3; font-size: 11px; font-weight: 650; }
.swaps tr.hit { background: rgba(25, 158, 112, 0.1); }
.tag-hit { height: 18px; padding: 0 6px; border-radius: 5px; border-color: rgba(25, 158, 112, 0.6); background: rgba(25, 158, 112, 0.16); color: #b6f0d9; font-size: 9.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; vertical-align: 1px; }
.sec-note { margin: 10px 0 0; }

/* ---------------------------------------------------------------- footer */
.ftr { max-width: 1640px; margin: 0 auto; padding: 22px 24px 40px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 12.5px; }
.ftr p { margin: 0 0 6px; }

/* ------------------------------------------------------------ responsive */
.tbl-wrap.fit { overflow: visible; }
.tbl-wrap.fit .tbl thead th { position: sticky; top: var(--sticky-top, var(--hdr-h)); z-index: 3; }
.tbl-wrap.fit .tbl thead th:first-child, .tbl-wrap.fit .tbl thead th:last-child { border-radius: 0; }
@media (max-width: 1180px) {
  .dt-grid { grid-template-columns: 1fr; }
  .tg-main { grid-template-columns: 1fr; }
  .tg-side { max-height: none; }
}
@media (max-width: 900px) {
  .hdr { position: relative; }
  :root { --sticky-top: 0px; }
  .hdr-in { height: auto; flex-wrap: wrap; padding: 10px 16px; gap: 10px 12px; }
  .search { order: 5; flex: 1 1 100%; max-width: none; margin: 0; }
  .hdr-dl span { display: none; }
  .hdr-dl { width: 36px; padding: 0; }
  .seg-units { margin-left: auto; }
  .fg-engine { grid-column: 1 / -1; }
  .dt-hero { grid-template-columns: 1fr; gap: 10px; padding: 18px; }
  .thumb.ph-hero { max-width: 520px; }
}
@media (max-width: 720px) {
  .fbar, .fpanel, .results { padding-left: 14px; padding-right: 14px; }
  .fbar-in { gap: 10px 14px; }
  .fbar-end { margin-left: 0; width: 100%; }
  .fb-more { flex: 1; }
  .fpanel-in { grid-template-columns: 1fr; padding: 14px; }
  .rbar-tools { margin-left: 0; width: 100%; }
  .rbar-tools .sortsel { flex: 1; }
  .sortsel select { width: 100%; }
  .count-pill { display: none; }
  .tbl .c-img { display: none; }
  .tbl .c-name { position: sticky; left: 0; z-index: 1; background: var(--panel); max-width: 180px; box-shadow: 1px 0 0 var(--line); }
  .tbl thead th.c-name { z-index: 2; background: var(--panel-2); }
  .ov-bar-in { padding: 0 12px; gap: 8px; }
  .ov-bar-in .btn kbd { display: none; }
  .ov-pos { min-width: 0; }
  .dt, .cmp { padding: 14px 12px calc(80px + var(--safe-b)); }
  .sec { padding: 14px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-v { font-size: 22px; }
  .dt-facts { gap: 10px 20px; }
  .tabs { margin-left: 0; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
  .card-body { padding: 9px 11px 11px; }
  .card-title { font-size: 15px; }
  .card-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-foot { flex-wrap: wrap; }
  .tray-t { display: none; }
  .tray-n { display: none; }
  /* Tools and legend wrap onto more rows here, so leave them more room. */
  .tg-view {
    height: clamp(200px, calc(100vh - var(--ovbar-h) - 170px), 640px);
    height: clamp(200px, calc(100dvh - var(--ovbar-h) - 170px), 640px);
  }
  .tg-help { font-size: 10.5px; }
  .pk-r { grid-template-columns: minmax(80px, 120px) 1fr auto; gap: 8px; }
}
@media (max-width: 420px) {
  .brand-main { font-size: 16px; }
  .brand-top { font-size: 9.5px; }
  .seg-units span { padding: 0 9px; }
  .grid { grid-template-columns: 1fr 1fr; }
  .card-stats dd { font-size: 12px; }
}

/* ---------------------------------------------------- motion & contrast */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .card:hover { transform: none; }
}
@media (forced-colors: active) {
  .chip[aria-pressed="true"], .seg input:checked + span, .tabs [aria-selected="true"] { outline: 2px solid CanvasText; }
  /* focus on a pressed or checked one, drawn apart from that outline */
  .chip[aria-pressed="true"]:focus-visible, .seg input:checked:focus-visible + span { outline: 2px solid Highlight; outline-offset: 2px; }
  .chip.zero > :not(.chip-n) { opacity: 1; }
  .rt-fill, .pk-fill, .cmp-rt-bar span { background: Highlight; forced-color-adjust: none; }
  .rt-stock { background: CanvasText; forced-color-adjust: none; }
  .tn-bg { stroke: CanvasText; }
}
@media print {
  .hdr, .fbar, .fpanel, .rbar, .tray, .ov-bar, .tg-tools, .toast { display: none !important; }
  body, .ov { background: #fff; color: #000; position: static; overflow: visible; }
  /* print darkens light text but not the icons */
  .card-sub > .dg { color: #000; }
}

/* ============================================================== car builds */
/* entry points: header button, car page */
.hdr-builds { flex: none; }
.hdr-builds svg { width: 16px; height: 16px; }
.hdr-builds .fb-n { margin-left: 1px; }
.dt-build { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.dt-build-l span { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.bl-drop svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* build editor */
.tn { max-width: 1400px; margin: 0 auto; padding: 18px 24px calc(90px + var(--safe-b)); display: flex; flex-direction: column; gap: 16px; }
.tn-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex: 1 1 auto; }
.tn-title-k { flex: none; font-size: 11px; font-weight: 750; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-3); }
.tn-title-c { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tn-save { flex: none; }
.tn-head {
  display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 10px 20px; align-items: center; padding: 14px 20px;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: radial-gradient(70% 90% at 12% 60%, rgba(255, 255, 255, 0.05), transparent 65%), linear-gradient(180deg, #161b23, #10131a);
}
.tn-car { display: block; }
.thumb.ph-tn { width: 100%; aspect-ratio: 512 / 287; background: none; border-radius: 0; }
.thumb.ph-tn.noimg { background: var(--silhouette) center / 90% auto no-repeat; }
.tn-hm { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tn-kick { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 9px; color: var(--ink-2); font-size: 13px; font-weight: 650; }
.tn-kick a { color: var(--ink-2); }
.tn-kick a:hover { color: var(--ink); }
.tn-kick .muted { font-size: 12px; font-weight: 500; }
.tn-name {
  width: calc(100% + 10px); min-width: 0; height: 44px; padding: 0 10px; margin-left: -10px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; font-size: 24px; font-weight: 850; letter-spacing: -0.01em; text-overflow: ellipsis;
}
.tn-name:hover { border-color: var(--line-2); }
.tn-name:focus { outline: none; border-color: var(--accent); background: var(--bg-2); box-shadow: 0 0 0 3px var(--accent-soft); }
.tn-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.tn-status { margin: 0; color: var(--ink-3); font-size: 12.5px; }
.tn-status[data-dirty="true"] { color: var(--ink); font-weight: 650; }
.tn-status[data-dirty="true"]::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--accent); }
.tn-load select {
  max-width: 260px; height: 30px; padding: 0 30px 0 12px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 12px; font-weight: 650;
  background: var(--panel-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5.5 7.5 4.5 4.5 4.5-4.5' fill='none' stroke='%238d95a3' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 9px center / 14px 14px;
  -webkit-appearance: none; appearance: none; text-overflow: ellipsis;
}
.tn-load select:hover { border-color: var(--line-3); }
.tn-load option { background: var(--panel-2); color: var(--ink); }
.tn-notes summary { width: max-content; cursor: pointer; color: var(--ink-3); font-size: 12px; font-weight: 650; }
.tn-notes summary:hover { color: var(--ink); }
.tn-notes textarea {
  display: block; width: 100%; min-height: 64px; margin-top: 6px; padding: 8px 10px; resize: vertical;
  border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--bg-2);
}
.tn-notes textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tn-shared {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px 10px 14px; border-radius: var(--radius-sm); background: rgba(25, 158, 112, 0.1); border: 1px solid rgba(25, 158, 112, 0.42);
}
.tn-shared p { margin: 0; }
.tn-problem .cmp-empty p { max-width: 560px; margin-left: auto; margin-right: auto; }
.tn-problem-act { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

.tn-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.tn-main { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.tn-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.tn-count { margin: 0; color: var(--ink-2); font-size: 13px; }
.tn-count strong { color: var(--ink); font-size: 16px; }
.tn-note {
  display: flex; align-items: flex-start; gap: 8px; padding: 10px 10px 10px 14px; font-size: 13px;
  border-radius: var(--radius-sm); background: rgba(255, 209, 102, 0.07); border: 1px solid rgba(255, 209, 102, 0.34);
}
.tn-note > div { flex: 1; min-width: 0; }
.tn-note ul { margin: 6px 0 0; padding-left: 18px; color: var(--ink-2); }
.tn-note-warn { background: rgba(208, 59, 59, 0.08); border-color: rgba(208, 59, 59, 0.45); }
p.tn-note { margin: 0; }

.tn-area { min-width: 0; padding: 14px 16px 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.tn-ah { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 12px; }
.tn-at { margin: 0; font-size: 13px; font-weight: 850; letter-spacing: 0.13em; text-transform: uppercase; }
.tn-at::before {
  content: ""; display: inline-block; width: 4px; height: 14px; margin-right: 9px; vertical-align: -2px; border-radius: 2px;
  background: linear-gradient(var(--accent), var(--accent-2)); transform: skewX(-14deg);
}
.tn-am { color: var(--ink-3); font-size: 12px; }
.tn-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 8px; align-items: start; }
.tn-slot { position: relative; min-width: 0; padding: 10px 12px 11px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.tn-slot.is-changed { border-color: rgba(255, 79, 154, 0.42); background: linear-gradient(90deg, rgba(255, 79, 154, 0.07), transparent 65%), var(--bg-2); }
.tn-slot.is-changed::before {
  content: ""; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(var(--accent), var(--accent-2));
}
.tn-slot.is-wide { grid-column: 1 / -1; }
.tn-sh { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-height: 26px; }
.tn-st { margin: 0; font-size: 13px; font-weight: 750; }
.tn-chg {
  display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 5px;
  background: var(--accent-soft); color: #ffc2dc; font-size: 9.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
}
.tn-sv { margin-left: auto; font-size: 12.5px; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tn-dot { color: var(--ink-4); }
.tn-rs { height: 26px; padding: 0 9px; }
.tn-rs svg { width: 14px; height: 14px; }
.tn-cur { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 6px; color: var(--ink-2); font-size: 12.5px; }
.tn-cn { color: var(--ink); font-weight: 650; overflow-wrap: anywhere; }
.tn-meta-l { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; color: var(--ink-3); }
.tn-meta-l .kvc, .tn-om .kvc { margin: 0; }
.tn-mfr { color: var(--ink-2); }
.tag-def {
  height: 18px; padding: 0 6px; border-radius: 5px; vertical-align: 1px;
  border-color: rgba(25, 158, 112, 0.6); background: rgba(25, 158, 112, 0.16); color: #b6f0d9;
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
}
/* few options: segmented choice that wraps on narrow screens */
.tn-seg { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 8px; padding: 3px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line-2); }
.tn-seg label { position: relative; flex: 1 1 0; min-width: 62px; }
.tn-seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.tn-seg span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 40px; padding: 4px 8px;
  border-radius: 7px; text-align: center; color: var(--ink-2); transition: background-color 0.15s, color 0.15s;
}
.tn-seg b { font-size: 12.5px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.tn-seg i { font-style: normal; font-size: 10.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tn-seg label:hover span { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.tn-seg input:checked + span { background: var(--ink); color: #0b0d11; }
.tn-seg input:checked + span i { color: #4b5261; }
.tn-seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
/* Drivetrain options: the layout glyph left of the label and price, so the tile keeps its 40px */
.tn-seg .tn-dgo { display: grid; grid-template: 1fr auto auto 1fr / auto auto; justify-content: center; align-items: center; column-gap: 8px; text-align: left; }
.tn-seg .tn-dgo .dg { grid-row: 1 / -1; }
.tn-seg .tn-dgo b { grid-area: 2 / 2; overflow-wrap: normal; }
.tn-seg .tn-dgo i { grid-area: 3 / 2; }
/* many options: radio list, searchable past eight */
.tn-tg { margin-top: 8px; }
.tn-tg svg { transition: transform 0.15s; }
.tn-tg[aria-expanded="true"] svg { transform: rotate(180deg); }
.tn-pick { margin-top: 8px; }
.tn-q-w { max-width: none; margin-bottom: 6px; }
.tn-opts {
  display: flex; flex-direction: column; gap: 2px; padding: 2px; overflow: auto; overscroll-behavior: contain;
  max-height: clamp(220px, calc(100vh - var(--ovbar-h) - 220px), 460px);
  max-height: clamp(220px, calc(100dvh - var(--ovbar-h) - 220px), 460px);
  border-radius: 9px; background: var(--panel); border: 1px solid var(--line);
}
.tn-pick.is-inline .tn-opts { max-height: none; }
.tn-opt { position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: start; gap: 2px 10px; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.tn-opt:hover { background: rgba(255, 255, 255, 0.04); }
.tn-opt.is-sel { background: rgba(255, 255, 255, 0.08); box-shadow: inset 0 0 0 1px var(--line-3); }
.tn-opt input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); cursor: pointer; }
.tn-opt:focus-within { outline: 2px solid var(--focus); outline-offset: -2px; }
.tn-opt input:focus-visible { outline: none; }
.tn-ob { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tn-on { font-size: 13px; font-weight: 650; overflow-wrap: anywhere; }
.tn-om { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; color: var(--ink-3); font-size: 12px; }
.tn-pw { color: var(--ink); font-weight: 650; }
.tn-ov { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; font-size: 12.5px; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tn-ow { color: var(--ink-3); font-size: 11.5px; font-weight: 600; }
.tn-cr { white-space: nowrap; }
.tn-none { margin: 8px 4px 0; }
.tn-fixed { margin: 10px 2px 0; }

/* summary column: sticky beside the slots, sized to the dynamic viewport like the parts graph */
.tn-side {
  position: sticky; top: calc(var(--ovbar-h) + 14px); min-width: 0; overflow: auto; overscroll-behavior: contain;
  max-height: calc(100vh - var(--ovbar-h) - 28px);
  max-height: calc(100dvh - var(--ovbar-h) - 28px);
  border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line);
}
.tn-side-in { display: flex; flex-direction: column; gap: 14px; padding: 16px; }
.tn-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.tn-acts .btn { height: 32px; padding: 0 12px; font-size: 12.5px; }
.tn-del:hover { border-color: rgba(208, 59, 59, 0.6); color: #f4b4b4; }
.tn-sharebox { padding: 10px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--line); }
.tn-share-row { display: flex; gap: 6px; margin-top: 6px; }
.tn-share-row input {
  flex: 1; min-width: 0; height: 30px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--line-2);
  background: var(--panel); color: var(--ink-2); font: 12px var(--mono);
}
.tn-pi { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 12px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--line); }
.tn-pi.is-na .badge { opacity: 0.6; }
.tn-pi-na { display: flex; flex-direction: column; gap: 2px; flex: 1 1 180px; min-width: 0; }
.tn-pi-na strong { font-size: 13px; }
.tn-pi-na span { color: var(--ink-3); font-size: 12px; }
.tn-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.tn-kpi { min-width: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--line); }
.tn-kpi:first-child:nth-last-child(odd) { grid-column: 1 / -1; }
.tn-kpi dt { color: var(--ink-3); font-size: 11.5px; font-weight: 650; }
.tn-kpi dd { margin: 2px 0 0; font-size: 19px; font-weight: 750; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.tn-kpi dd .u { font-size: 12px; }
.tn-kd { display: block; margin-top: 1px; color: var(--ink-3); font-size: 11.5px; font-weight: 600; letter-spacing: 0; }
.tn-est {
  display: inline-flex; align-items: center; height: 16px; margin-left: 6px; padding: 0 5px; border-radius: 4px; vertical-align: 2px; cursor: help;
  border: 1px solid var(--line-3); color: var(--ink-3); font-size: 9.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
}
.tn-ref { display: block; color: var(--ink-3); font-size: 11.5px; font-weight: 500; }
.tn-sec { padding-top: 12px; border-top: 1px solid var(--line); }
.tn-sh3 { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; color: var(--ink-3); font-size: 11px; font-weight: 750; letter-spacing: 0.13em; text-transform: uppercase; }
.tn-sh3 .muted { letter-spacing: 0.04em; text-transform: none; font-weight: 600; }
.tn-sec.is-na .ratings { opacity: 0.6; }
.tn-sec .ratings { gap: 11px; }
.tn-perf dd { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.tn-pv { white-space: nowrap; }
/* peak power / torque with their rpm above the curve; the caveat of an upgraded turbo curve below it */
.tn-peaks { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: -2px 0 8px; color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.tn-peaks b { color: var(--ink); font-weight: 700; }
.tn-flat { color: var(--ink-2); font-weight: 600; cursor: help; border-bottom: 1px dotted var(--line-3); }
.tn-cnote { margin: 8px 0 0; color: var(--ink-3); font-size: 11.5px; }
.tn-mnotes { margin: 0; padding: 10px 12px 10px 26px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--line); color: var(--ink-3); font-size: 12px; }
.tn-mnotes li + li { margin-top: 4px; }
.tn-mini { display: none; }
/* build PI: change vs stock, stock reference, typical error */
.tn-pi-m { display: flex; flex-direction: column; gap: 1px; flex: 1 1 160px; min-width: 0; }
.tn-pi-m strong { font-size: 14px; font-weight: 750; }
.tn-pi-m .tn-est { vertical-align: 1px; }
/* rating bars: the change vs stock and a tick at the stock value */
.tn-rts .rt-v { display: inline-flex; align-items: baseline; gap: 8px; }
.tn-rd { font-size: 11.5px; font-weight: 750; font-variant-numeric: tabular-nums; }
.tn-rd.is-up { color: #7fd99a; }
.tn-rd.is-down { color: #f3a0a0; }
.rt-stock { position: absolute; z-index: 1; top: 0; bottom: 0; width: 2px; background: var(--ink); opacity: 0.85; }
/* an estimated rating that reads low / high on builds like this one */
.rt-lean {
  display: inline-block; margin-left: 8px; padding: 0 5px; border-radius: 4px; border: 1px dashed var(--line-3); vertical-align: 1px; cursor: help;
  color: var(--ink-3); font-size: 10px; font-weight: 650; letter-spacing: 0.02em; text-transform: none; white-space: nowrap;
}
/* how accurate the estimates are */
.tn-acc { border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.tn-acc > summary { padding: 10px 12px; cursor: pointer; color: var(--ink-2); font-weight: 650; }
.tn-acc > summary:hover { color: var(--ink); }
.tn-acc[open] > summary { border-bottom: 1px solid var(--line); }
.tn-acc p { margin: 10px 12px; }
.tn-acc .tbl-scroll { margin: 0 4px; }
.tn-acc-t th, .tn-acc-t td { padding: 6px 8px; }
.tn-acc-t tbody th { color: var(--ink-2); font-weight: 600; }
.tn-acc-nv { color: var(--ink-3); font-style: italic; cursor: help; white-space: normal !important; }
.tn-acc-few { color: var(--ink-3); font-style: italic; cursor: help; }
.cmp-est { margin: -6px 0 0; }
.cmp-est .tn-est { margin-left: 0; cursor: default; }

/* My builds */
.bl-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl { max-width: 1400px; margin: 0 auto; padding: 18px 24px calc(90px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
.bl-bar-acts { display: flex; gap: 6px; }
.bl-io > summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; cursor: pointer; list-style: none; }
.bl-io > summary::-webkit-details-marker { display: none; }
.bl-io > summary::after {
  content: ""; width: 7px; height: 7px; margin-left: auto; align-self: center; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg); transition: transform 0.15s;
}
.bl-io[open] > summary::after { transform: rotate(-135deg); }
.bl-io-b { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.bl-drop {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 124px; padding: 16px;
  border-radius: var(--radius-sm); border: 1.5px dashed var(--line-3); background: var(--bg-2); text-align: center; cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.bl-drop:hover { border-color: var(--ink-3); }
.bl-drop input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.bl-drop:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.bl-drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.bl-drop-t { display: inline-flex; align-items: center; gap: 8px; }
.bl-drop-t svg { width: 18px; height: 18px; }
.bl-paste { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.bl-paste textarea {
  width: 100%; min-height: 76px; padding: 8px 10px; resize: vertical; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--bg-2); font: 12px/1.4 var(--mono);
}
.bl-paste textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.bl-paste .btn { align-self: flex-start; }
#bl-report { grid-column: 1 / -1; }
#bl-report:empty { display: none; }
.bl-report { padding: 10px 14px; border-radius: var(--radius-sm); background: rgba(12, 163, 12, 0.08); border: 1px solid rgba(12, 163, 12, 0.36); font-size: 13px; }
.bl-report.is-err { background: rgba(208, 59, 59, 0.08); border-color: rgba(208, 59, 59, 0.45); }
.bl-report p { margin: 0 0 4px; }
.bl-report p:last-child { margin-bottom: 0; }
.bl-errs { margin: 4px 0 0; padding-left: 18px; color: var(--ink-2); }
.bl-cmpbar {
  position: sticky; top: calc(var(--ovbar-h) + 8px); z-index: 4; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px;
  padding: 7px 8px 7px 16px; border-radius: 999px; background: rgba(26, 31, 39, 0.95); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--line-2); box-shadow: var(--shadow);
}
.bl-cmpbar p { margin: 0 auto 0 0; color: var(--ink-2); }
.bl-car { min-width: 0; padding: 14px 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.bl-ch { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.thumb.ph-bl { flex: none; width: 112px; aspect-ratio: 512 / 287; background: radial-gradient(ellipse at 50% 75%, #262d38, transparent 70%); }
.bl-cn { flex: 1; min-width: 0; }
.bl-cn h2 { margin: 0; font-size: 16px; font-weight: 800; overflow-wrap: anywhere; }
.bl-cn h2 a { color: var(--ink); }
.bl-cm { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-top: 4px; }
.bl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bl-b { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px 14px; padding: 10px 12px 10px 8px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.bl-b.is-sel { border-color: var(--line-3); box-shadow: inset 3px 0 0 var(--accent); }
.bl-pick { display: grid; place-items: center; width: 30px; height: 30px; cursor: pointer; }
.bl-pick input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.bl-main { min-width: 0; }
.bl-name { color: var(--ink); font-size: 14.5px; font-weight: 750; overflow-wrap: anywhere; }
.bl-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 4px; font-size: 13px; font-weight: 650; }
.bl-f { white-space: nowrap; }
.bl-line { color: var(--ink-3); font-size: 12.5px; font-weight: 500; }
.bl-when { margin-top: 2px; }
.bl-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

/* compare builds: parts that differ */
.bd-t td { min-width: 160px; white-space: normal; vertical-align: top; }
.bd-t thead th { white-space: nowrap; }
.bd-t tbody th { white-space: normal; min-width: 130px; }
.bd-area { display: block; color: var(--ink-3); font-size: 11px; font-weight: 500; }
.bd-n { color: var(--ink-3); }
.bd-chg .bd-n { color: var(--ink); font-weight: 650; }
.bd-p { display: block; color: var(--ink-3); font-size: 11.5px; }

@media (max-width: 1100px) {
  .tn-grid { grid-template-columns: minmax(0, 1fr); }
  .tn-side { position: static; max-height: none; overflow: visible; }
  .tn-mini {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
    padding: 8px calc(12px + var(--safe-r)) calc(8px + var(--safe-b)) calc(12px + var(--safe-l));
    background: rgba(20, 23, 28, 0.96); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--line-2);
  }
  .tn-mini-in { display: flex; align-items: center; gap: 8px 14px; max-width: 760px; margin: 0 auto; }
  .tn-mini-v { font-size: 13.5px; font-weight: 750; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .tn-mini-v.is-pw { margin-right: auto; }
  .tn-mini-pi { display: inline-flex; align-items: center; gap: 3px; flex: none; }
  .tn-mini-e { color: var(--ink-3); font-size: 12px; font-weight: 750; }
}
@media (max-width: 900px) {
  /* the search has its own row here: the builds button joins it instead of crowding the brand row */
  .hdr-builds-t { display: none; }
  .hdr-builds { order: 6; height: 40px; padding: 0 11px; }
  .hdr-in:has(.hdr-builds) .search { flex: 1 1 calc(100% - 84px); }
}
@media (max-width: 720px) {
  .tn, .bl { padding: 14px 12px calc(96px + var(--safe-b)); }
  .tn-head { grid-template-columns: 96px minmax(0, 1fr); align-items: start; gap: 8px 12px; padding: 12px; }
  .tn-name { height: 38px; font-size: 19px; }
  .tn-area { padding: 12px; }
  .tn-slots { grid-template-columns: minmax(0, 1fr); }
  .tn-side-in { padding: 14px; }
  .bl-io-b { grid-template-columns: minmax(0, 1fr); }
  .bl-b { grid-template-columns: auto minmax(0, 1fr); }
  .bl-acts { grid-column: 1 / -1; justify-content: flex-start; }
  .bl-ch { flex-wrap: wrap; gap: 10px 12px; }
  .thumb.ph-bl { width: 84px; }
  .bl-cmpbar { border-radius: var(--radius-sm); }
}
@media (max-width: 560px) {
  .bl-bar-acts .btn { width: 36px; padding: 0; }
  .bl-bar-acts .btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tn-mini-in { gap: 8px 10px; }
  .tn-mini-v { font-size: 12.5px; }
  .tn-mini-pi:not(:empty) ~ .tn-mini-v.is-kg { display: none; }
  .tn-acts .btn { flex: 1 1 auto; }
}
@media (max-width: 400px) {
  /* three Drivetrain options side by side are too narrow for icon + price: plain tiles */
  .tn-seg:has(> label:nth-child(3)) .tn-dgo { display: flex; text-align: center; }
  .tn-seg:has(> label:nth-child(3)) .tn-dgo .dg { display: none; }
}
@media (forced-colors: active) {
  .tn-seg input:checked + span { outline: 2px solid CanvasText; }
  .tn-slot.is-changed { border-width: 2px; }
}
@media print {
  .tn-mini, .tn-acts, .bl-cmpbar, .bl-io { display: none !important; }
  .tn-side { position: static; max-height: none; overflow: visible; }
}

/* ============================================================== my garage */
/* entry points: header button, the owned mark of the list rows and cards, "Your copies" on the car page */
.hdr-garage { flex: none; }
.hdr-garage svg { width: 16px; height: 16px; }
.hdr-garage .fb-n { margin-left: 1px; }
.own-b {
  display: inline-flex; align-items: center; gap: 2px; height: 16px; margin-right: 6px; padding: 0 5px; border-radius: 5px; vertical-align: -3px;
  background: rgba(12, 163, 12, 0.16); border: 1px solid rgba(12, 163, 12, 0.5); color: #9be59b; font-size: 10.5px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.own-b svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.card-media .own-b { position: absolute; left: 10px; bottom: 9px; height: 22px; margin: 0; padding: 0 7px; gap: 3px; background: rgba(7, 8, 11, 0.86); border-color: rgba(12, 163, 12, 0.7); font-size: 12px; }
.card-media .own-b svg { width: 12px; height: 12px; }
.dt-own { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; margin-top: 2px; }
.dt-own-t { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 12.5px; font-weight: 700; }
.dt-own-t svg { width: 14px; height: 14px; color: #9be59b; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.own-c {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%; height: 32px; padding: 0 12px 0 5px; border-radius: 999px;
  border: 1px solid var(--line-2); background: rgba(11, 13, 17, 0.55); color: var(--ink-2); font-size: 12px; font-weight: 650;
}
.own-c:hover { border-color: var(--line-3); color: var(--ink); text-decoration: none; }
.own-c > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.own-more { font-size: 12.5px; font-weight: 650; }

/* the view */
.gg { max-width: 1400px; margin: 0 auto; padding: 18px 24px calc(90px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
.gg-del:hover { border-color: rgba(208, 59, 59, 0.6); color: #f4b4b4; }
.ov.gg-dragging { box-shadow: inset 0 0 0 3px var(--accent); }
.ov.gg-dragging .gg-drop { border-color: var(--accent); background: var(--accent-soft); }
.gg code { padding: 1px 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.07); font: 12.5px var(--mono); overflow-wrap: anywhere; }

/* import panel: where the save is, the picker, the stages, the report or the error */
.gg-lead { margin: 12px 0 0; max-width: 780px; color: var(--ink-2); }
.gg-io-b { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 14px 18px; margin-top: 14px; }
.gg-h3 { margin: 0 0 8px; font-size: 13px; font-weight: 750; }
.gg-h3 .muted { margin-left: 6px; font-weight: 500; }
.gg-steps { display: grid; gap: 7px; margin: 0; padding-left: 20px; color: var(--ink-2); font-size: 13px; }
.gg-steps li::marker { color: var(--ink-3); font-weight: 700; }
.gg-how > .muted { margin: 10px 0 0; }
.gg-path { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 2px; }
.gg-path code { padding: 5px 9px; border-radius: 7px; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--ink); font-size: 13px; -webkit-user-select: all; user-select: all; }
.gg-pickw { display: flex; flex-direction: column; min-width: 0; }
.gg-drop { flex: 1; min-height: 150px; }
.gg-drop[aria-busy="true"] { opacity: 0.6; cursor: progress; }
.gg-privacy { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0 0; color: var(--ink-2); font-size: 12.5px; }
.gg-privacy svg { width: 16px; height: 16px; margin-top: 1px; fill: none; stroke: #9be59b; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.gg-progress, .gg-result { grid-column: 1 / -1; min-width: 0; }
.gg-result:empty { display: none; }
.gg-stages { display: grid; gap: 6px; margin: 0; padding: 12px 14px; list-style: none; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--line); color: var(--ink-3); font-size: 13px; }
.gg-stages li { display: flex; align-items: center; gap: 9px; }
.gg-stages .is-done { color: var(--ink-2); }
.gg-stages .is-active { color: var(--ink); font-weight: 650; }
.gg-st-i { display: inline-grid; place-items: center; flex: none; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line-3); }
.gg-st-i svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.is-done .gg-st-i { border-color: transparent; background: var(--good); color: #fff; }
.is-active .gg-st-i { border-color: var(--accent); border-top-color: transparent; animation: ggSpin 0.8s linear infinite; }
@keyframes ggSpin { to { transform: rotate(360deg); } }
.gg-report:focus, .gg-err:focus { outline: none; }
.gg-rep-act { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px !important; }
.gg-err-t { margin: 0 0 6px; font-size: 15px; font-weight: 800; }
.gg-err p { margin: 0 0 6px; }
.gg-code { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }
.gg-code code { background: rgba(255, 255, 255, 0.1); color: var(--ink); }
.gg-diag { margin-top: 8px; }
.gg-diag summary { width: max-content; max-width: 100%; cursor: pointer; color: var(--ink-3); font-size: 12px; }
.gg-diag summary:hover { color: var(--ink); }
.gg-diag pre { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2); font: 11.5px/1.45 var(--mono); }

/* summary, profile, Car Collection, barn finds */
.gg-tiles .tile { background: var(--bg-2); }
.gg-strip { margin-top: 14px; }
.gg-strip-t { margin: 0 0 7px; color: var(--ink-2); }
.gg-strip-t strong, .gg-big strong { color: var(--ink); font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.gg-strip-l { margin: 7px 0 0; font-size: 12.5px; }
.gg-bar { display: flex; height: 8px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, 0.09); }
.gg-bar > span { display: block; height: 100%; background: var(--good); }
.gg-bar > .is-2 { background: rgba(12, 163, 12, 0.42); }
.gg-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 14px; align-items: start; }
.gg-card .sec-h { margin-bottom: 10px; }
.tiles.gg-prof { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.gg-prof .tile { padding: 10px 12px; background: var(--bg-2); }
.gg-prof .tile-v { font-size: 20px; }
.gg-big { margin: 0 0 8px; color: var(--ink-2); }
.gg-legend { display: grid; gap: 4px; margin: 10px 0 0; padding: 0; list-style: none; color: var(--ink-2); font-size: 12.5px; }
.gg-legend li { display: flex; align-items: center; gap: 8px; }
.gg-key { flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--good); }
.gg-key.is-2 { background: rgba(12, 163, 12, 0.42); }
.gg-key.is-3 { background: rgba(255, 255, 255, 0.14); }
.gg-card > .muted.small { margin: 10px 0 0; }
.gg-more { margin-top: 10px; }
.gg-more summary { width: max-content; max-width: 100%; cursor: pointer; color: var(--link); font-size: 12.5px; font-weight: 650; }
.gg-names { display: flex; flex-direction: column; gap: 3px; max-height: 280px; overflow: auto; margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; }
.gg-names a { color: var(--ink); }

/* the cars: the controls, then one panel per model with its copies */
.gg-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.gg-q { flex: 1 1 240px; max-width: 460px; }
.gg-sortw { display: flex; gap: 6px; margin-left: auto; }
.gg-filters { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 12px; }
.gg-countw { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 12px; }
.gg-count { margin: 0; color: var(--ink-2); }
.gg-count strong { color: var(--ink); font-size: 16px; font-weight: 800; }
.gg-list { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 0; padding: 0; list-style: none; }
/* (no content-visibility: the list is drawn in chunks as it scrolls, and on a deep list put back by Back or a redraw,
   Chrome's deferred layout of hundreds of skipped groups made one long task) */
.gg-g { min-width: 0; padding: 14px 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.gg-gh { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.gg-img { flex: none; display: block; }
.thumb.ph-gg { flex: none; width: 112px; aspect-ratio: 512 / 287; background: radial-gradient(ellipse at 50% 75%, #262d38, transparent 70%); }
.gg-gn { flex: 1; min-width: 0; }
.gg-gt { margin: 0; font-size: 16px; font-weight: 800; overflow-wrap: anywhere; }
.gg-gt a { color: var(--ink); }
.gg-gm { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 4px; }
.gg-cs { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.gg-c {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; align-items: center; gap: 8px 14px; min-width: 0;
  padding: 9px 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line);
}
.gg-cb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.gg-ct { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
.gg-tag {
  display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 6px; border-radius: 5px; white-space: nowrap;
  background: rgba(255, 255, 255, 0.08); color: var(--ink-2); font-size: 9.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
}
.gg-tag.is-up { background: var(--accent-soft); color: #ffc2dc; }
.gg-tag.is-fav { background: rgba(242, 201, 76, 0.14); color: #f2c94c; }
.gg-tag.is-fav svg { width: 11px; height: 11px; fill: currentColor; stroke: none; }
.gg-tag.is-barn { background: rgba(176, 133, 96, 0.2); color: #e3c6a5; }
.gg-cf { display: flex; flex-wrap: wrap; gap: 2px 14px; min-width: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.gg-f { white-space: nowrap; }
.gg-f b { font-weight: 700; }
.gg-ca { display: flex; justify-content: flex-end; }
.gg-parts { grid-column: 1 / -1; }
.gg-parts > summary { width: max-content; max-width: 100%; cursor: pointer; color: var(--ink-3); font-size: 12px; font-weight: 650; }
.gg-parts > summary:hover { color: var(--ink); }
.gg-parts-b { margin-top: 8px; padding: 8px 12px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); }
.gg-parts-b > p { margin: 0; }
.gg-h4 { margin: 6px 0 4px; color: var(--ink-3); font-size: 10.5px; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; }
.gg-h4 .muted { margin-left: 6px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.gg-pl { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 3px 16px; margin: 0 0 4px; padding: 0; list-style: none; font-size: 12.5px; }
.gg-pt { color: var(--ink-3); }
.gg-unk { padding: 10px 4px 0; }
.gg-unk h3 { margin: 0 0 4px; font-size: 14px; font-weight: 800; }
.gg-empty { padding: 40px 20px; }
.gg-empty h3 { margin: 0 0 6px; font-size: 18px; }

@media (max-width: 900px) {
  /* icon buttons beside the search, as My builds */
  .hdr-garage-t { display: none; }
  .hdr-garage { order: 6; height: 40px; padding: 0 11px; }
  .hdr-in:has(.hdr-garage) .search { flex: 1 1 calc(100% - 84px); }
  .hdr-in:has(.hdr-garage):has(.hdr-builds) .search { flex-basis: calc(100% - 172px); }
}
@media (max-width: 720px) {
  .gg { padding: 14px 12px calc(96px + var(--safe-b)); }
  .gg-io-b { grid-template-columns: minmax(0, 1fr); }
  .gg-drop { min-height: 124px; }
  .gg-sortw { width: 100%; margin-left: 0; }
  .gg-sortw .sortsel { flex: 1; }
  .gg-q { max-width: none; }
  .gg-g { padding: 12px; }
  .gg-gh { gap: 10px 12px; }
  .thumb.ph-gg { width: 84px; }
  /* the editor button beside the badge, the figures below them */
  .gg-c { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; }
  .gg-cb { grid-area: 1 / 1; }
  .gg-ca { grid-area: 1 / 2; align-self: start; }
  .gg-cf { grid-area: 2 / 1 / 3 / -1; }
}
@media (forced-colors: active) {
  .gg-bar > span, .gg-key { background: Highlight; forced-color-adjust: none; }
  .gg-bar > .is-2, .gg-key.is-2 { background: GrayText; }
  .own-b, .gg-tag { border: 1px solid CanvasText; }
}
@media print {
  .gg-io, .gg-ctl, .gg-ca, .gg-parts { display: none !important; }
}

/* ========================================================= my garage: the build editor */
/* a car of the imported garage ("In game", tuner.js inGameHtml): the game's own figures from the player's save, framed
   in the garage green; the model's estimate beside them in muted text. --ig-bg also fills the rating bars' gaps. */
.tn-shared.tn-ingame { background: rgba(12, 163, 12, 0.08); border-color: rgba(12, 163, 12, 0.45); }
.tn-ig {
  --ig-bg: #131c18;
  display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: var(--radius-sm);
  background: var(--ig-bg); border: 1px solid rgba(12, 163, 12, 0.5);
}
.tn-ig.is-partial { border-style: dashed; }
.tn-ig-h { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.tn-ig-t {
  display: inline-flex; align-items: center; gap: 7px; margin: 0;
  color: #9be59b; font-size: 11px; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase;
}
.tn-ig-t::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.tn-ig-t:focus { outline: none; }
.tn-ig-t:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.tn-ig-src { color: var(--ink-3); font-size: 11.5px; }
.tn-ig-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.tn-ig-ref { color: var(--ink-2); }
.tn-ig .tn-peaks { margin: 0; }
.tn-ig-sub { margin: -6px 0 0; color: var(--ink-3); font-size: 11.5px; }
.tn-ig .ratings { gap: 11px; }
.tn-ig .rt-bar::after { background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), var(--ig-bg) calc(10% - 2px) 10%); }
/* the model's rating, where it differs from the game's */
.tn-rref { margin-left: 8px; color: var(--ink-3); font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; text-transform: none; white-space: nowrap; }
.tn-ig-foot { margin: 0; color: var(--ink-3); font-size: 11.5px; }
/* the model's notes beside the game's figures: whose figures they are about */
.tn-mnotes-h { margin: 0 0 -8px; color: var(--ink-3); font-size: 11px; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; }
/* after a change: the in-game figures no longer apply, the in-game build is one click away */
.tn-ig-stale { align-items: center; flex-wrap: wrap; }
.tn-ig-stale > div { flex: 1 1 200px; }
/* top speed, acceleration, braking and grip of a garage car: model estimates, the game does not store them */
.tn-ns { display: block; margin-top: 1px; color: var(--ink-3); font-size: 10.5px; font-weight: 500; }
/* parts bought in the game for the car in view: tagged Owned in the slots, "Owned" for the price on a segmented tile */
.tag-own {
  height: 18px; padding: 0 6px; border-radius: 5px; vertical-align: 1px;
  border-color: rgba(12, 163, 12, 0.6); background: rgba(12, 163, 12, 0.16); color: #9be59b;
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
}
.tn-seg i.is-own { color: #9be59b; font-weight: 700; }
.tn-seg input:checked + span i.is-own { color: #0a6b0a; }
.tn-ownn { display: flex; align-items: flex-start; gap: 8px; margin: 0; color: var(--ink-2); font-size: 13px; }
.tn-ownn svg { width: 16px; height: 16px; margin-top: 1px; flex: none; fill: none; stroke: #9be59b; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.tn-ownn .tag-own { vertical-align: 0; }
/* My builds: a build that is a garage car's ("In game · S1 812"), and the way to the garage import */
.bl-ig {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px 0 6px; border-radius: 6px; white-space: nowrap;
  border: 1px solid rgba(12, 163, 12, 0.55); background: rgba(12, 163, 12, 0.14); color: #9be59b; font-size: 12px; font-weight: 750;
}
.bl-ig svg { width: 12px; height: 12px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.bl-gl { grid-column: 1 / -1; margin: 0; }

@media (max-width: 560px) {
  .tn-ig { padding: 10px; }
  .tn-ig-tags { margin-left: 0; }
}
@media (forced-colors: active) {
  .tn-ig { border: 2px solid CanvasText; }
  .tn-ig-t::before { background: CanvasText; forced-color-adjust: none; }
  .tag-own, .bl-ig { border: 1px solid CanvasText; }
}
@media print {
  .tn-ig-stale .btn { display: none !important; }
}
