/*
 * Garage tool — the Epsilon Motorsports garage in WTCC colours: a dark panel with the Autoground gold accent. One accent per subsystem, set inline as --accent.
 * Loaded inside the garage's shadow root (see js/garage-main.js), so these rules never touch the rest of the site
 * and the site's never touch these.
 */

:host {
  display: block;
  color-scheme: dark;
  --bg: #0a0a0c;
  --bg-2: #101013;
  --panel: #141418;
  --panel-2: #1b1b21;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f2f2f0;
  --muted: #9a9aa3;
  --accent: #e3ae41;
  --lime: #e3ae41;
  --ok: #7ee787;
  --warn: #ffd166;
  --bad: #ff5f6d;
  --radius: 12px;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
  --display: 'Barlow Condensed', 'Arial Narrow', Impact, sans-serif;
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  padding: 24px;
  font-size: 14px;
  line-height: 1.5;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
a { color: var(--lime); }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1, h2 { font-family: var(--display); font-weight: 800; text-transform: uppercase; letter-spacing: .01em; }
h1 { font-size: 30px; line-height: 1.05; }
h2 { font-size: 21px; line-height: 1.1; }
h3 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
h4 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
p { margin: 0 0 8px; }

.app { padding: 8px 0 60px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.good { color: var(--ok); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }

/* ------------------------------------------------------------------ header */

.view-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  flex-wrap: wrap;
}
.view-head h1 { line-height: 1.25; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.search { position: relative; display: flex; align-items: center; }
.search .icon { position: absolute; left: 10px; width: 15px; height: 15px; opacity: 0.5; }
.search .input { padding-left: 30px; width: 220px; }

/* ------------------------------------------------------------------ inputs */

.input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 8px 10px;
  font: inherit;
  width: 100%;
  transition: border-color 0.15s, background 0.15s;
}
.input:focus { outline: none; border-color: var(--accent); background: rgba(255, 255, 255, 0.07); }
.input.compact { width: auto; padding: 8px 10px; }
textarea.input { resize: vertical; }
input[type="color"].input { padding: 2px; height: 36px; cursor: pointer; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: right 14px center, right 9px center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 12px; color: var(--muted); letter-spacing: 0.03em; }
.field-hint { font-size: 11.5px; color: var(--muted); opacity: 0.8; }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }

.btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, 0.11); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--lime); border-color: transparent; color: #0a0a0c; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.danger, .btn.ghost.danger { color: var(--bad); border-color: rgba(255, 95, 109, 0.35); }
.btn.danger:hover { background: rgba(255, 95, 109, 0.14); }
.btn.small { padding: 5px 10px; font-size: 12.5px; }

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.icon-btn.on { border-color: var(--accent); color: var(--accent); background: rgba(227, 174, 65, 0.12); }
.icon-btn.danger:hover { color: var(--bad); border-color: rgba(255, 95, 109, 0.4); }
.icon { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.link-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: 12px; text-decoration: underline; padding: 0 4px; }
.link-btn:hover { color: var(--text); }

/* ------------------------------------------------------------ garage cards */

.garage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.vehicle-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s, box-shadow 0.18s;
}
.vehicle-card:hover, .vehicle-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  outline: none;
}
/* Laid out like the car cards in My Garage (account.html): the picture inset with rounded corners, a gold
   drivetrain tag over the name, the trim beside it, then the completeness bar for a linked car. */
.card-art {
  background: radial-gradient(120% 100% at 50% 20%, color-mix(in srgb, var(--paint) 26%, transparent), transparent 70%), #0d1117;
  margin: 16px 16px 0;
  height: 160px;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 0 20px 10px;
}
.silhouette { width: 100%; height: 120px; display: block; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.5)); }
.card-art.has-render { padding: 0; background: #000; }
.card-render { width: 100%; height: 160px; display: block; object-fit: cover; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.card-tag { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.card-body h2 { margin: 0; line-height: 1.1; }
.card-trim { font-size: 0.6em; color: var(--muted); letter-spacing: .04em; }
.card-mygarage { display: flex; flex-direction: column; gap: 6px; }
.card-progress { display: flex; align-items: center; gap: 8px; }
.card-bar { flex: 1; height: 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.card-bar i { display: block; height: 100%; background: linear-gradient(to top right, #ecbe4c, #f13961); }
.card-mygarage .ok { color: var(--ok); }
.card-stats { display: flex; gap: 18px; flex-wrap: wrap; }
.card-stat { display: flex; flex-direction: column; line-height: 1.3; }
.card-badges { display: flex; gap: 6px; flex-wrap: wrap; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.03);
}
.badge.overdue { border-color: rgba(255, 95, 109, 0.4); color: #ffb3b8; }
.badge.soon { border-color: rgba(255, 209, 102, 0.4); color: #ffe1a3; }
.badge.ok { border-color: rgba(126, 231, 135, 0.35); color: #bff5c4; }
.badge.plain { color: var(--muted); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); }
.dot.soon { background: var(--warn); }
.dot.overdue { background: var(--bad); box-shadow: 0 0 0 3px rgba(255, 95, 109, 0.18); }
.dot.unknown, .dot.none { background: #5b6577; }

/* ------------------------------------------------------------- vehicle view */

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(380px, 0.85fr);
  gap: 18px;
  align-items: start;
}
@media (max-width: 1080px) { .workspace { grid-template-columns: 1fr; } }

.stage-wrap {
  background: linear-gradient(180deg, #0e1219, #0a0d12);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  position: sticky;
  top: 80px;
}
@media (max-width: 1080px) { .stage-wrap { position: static; } }

.stage { position: relative; height: min(62vh, 620px); min-height: 380px; }
.stage-canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.stage-canvas:active { cursor: grabbing; }

.hotspots { position: absolute; inset: 0; pointer-events: none; }
.hotspot {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 6px;
  background: rgba(12, 16, 22, 0.82);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(6px);
  transform-origin: 0 0;
  margin: -14px 0 0 -14px;
  transition: opacity 0.2s, border-color 0.2s, background 0.2s;
  white-space: nowrap;
}
.hotspot:hover { border-color: var(--accent); }
.hotspot-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); flex: none; }
.hotspot-label { display: flex; align-items: center; gap: 7px; }
.hotspot-meta { display: flex; gap: 4px; }
.hotspot .chip { font-size: 10.5px; padding: 1px 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.09); color: var(--muted); }
.hotspot .chip.overdue { background: rgba(255, 95, 109, 0.22); color: #ffc9cd; }
.hotspot .chip.soon { background: rgba(255, 209, 102, 0.2); color: #ffe6b0; }
.hotspot.quiet { opacity: 0.55; }
.hotspot.quiet .hotspot-name { color: var(--muted); }
.hotspot.muted { opacity: 0.28; }
.hotspot.active {
  background: color-mix(in srgb, var(--accent) 22%, rgba(12, 16, 22, 0.9));
  border-color: var(--accent);
  opacity: 1;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
}
.stage-hint { color: var(--muted); font-size: 12px; }
.stage-bar { flex-wrap: wrap; }
.part-credits { flex: 1 1 100%; order: 9; font-size: 11px; line-height: 1.4; }
.part-credits a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.stage-tools { display: flex; gap: 6px; }

.system-rail {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
}
.rail-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.rail-chip:hover { color: var(--text); border-color: var(--line-strong); }
.rail-chip.active { color: var(--text); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.rail-swatch { width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }
.rail-count { background: rgba(255, 255, 255, 0.1); border-radius: 999px; padding: 0 6px; font-size: 11px; }

/* -------------------------------------------------------------- side panel */

.side-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 420px;
}
.focus-bar { display: none; }
.focus-bar.on {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-bottom: 1px solid var(--line);
}
.focus-swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }

.tabs { display: flex; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 8px 12px;
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.side-panel-body { padding: 14px; overflow: auto; }
.panel { display: flex; flex-direction: column; gap: 14px; }

.card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.card.sub { background: rgba(255, 255, 255, 0.03); margin-bottom: 10px; }
.card.sub.active { border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.panel-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.split { display: grid; grid-template-columns: 1fr; gap: 14px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.tile {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tile.clickable { cursor: pointer; }
.tile.clickable:hover { border-color: var(--accent); }
.tile-label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.tile-value { font-size: 18px; font-weight: 650; }
.tile-sub { font-size: 12px; color: var(--muted); }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 2px;
  border-top: 1px solid var(--line);
}
.list-row:first-child { border-top: 0; }
.list-row.status-planned { opacity: 0.75; }
.list-row.status-removed { opacity: 0.5; text-decoration-color: var(--muted); }
.row-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-actions { display: flex; gap: 6px; align-items: center; }
.col-right { text-align: right; min-width: 90px; }
.notes { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; white-space: pre-wrap; }

.pill { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; border-radius: 999px; padding: 1px 8px; background: rgba(255, 255, 255, 0.1); color: var(--muted); }
.pill.ok { background: rgba(126, 231, 135, 0.16); color: #bff5c4; }
.pill.warn { background: rgba(255, 209, 102, 0.16); color: #ffe1a3; }
.pill.planned { background: rgba(143, 180, 255, 0.16); color: #cfe0ff; }
.pill.removed { background: rgba(255, 255, 255, 0.08); }
.tag { font-size: 11.5px; border-radius: 999px; padding: 2px 9px; border: 1px solid color-mix(in srgb, var(--tag) 45%, transparent); color: color-mix(in srgb, var(--tag) 80%, white); background: color-mix(in srgb, var(--tag) 12%, transparent); white-space: nowrap; }

.due.overdue { color: #ff9aa2; }
.due.soon { color: #ffdc9a; }
.due.ok { color: var(--muted); }
.due.unknown, .due.none { color: var(--muted); font-style: italic; }

.history { margin-top: 6px; }
.history summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.mini-list { list-style: none; margin: 6px 0 0; padding: 0 0 0 10px; border-left: 1px solid var(--line); font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; }

.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 80px; gap: 10px; align-items: center; font-size: 12.5px; }
.bar-track { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; }
.bar-value { text-align: right; color: var(--muted); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 0; }
.fact dt { color: var(--muted); font-size: 11.5px; }
.fact dd { margin: 0; }

.empty { text-align: center; color: var(--muted); padding: 22px 10px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty.big { grid-column: 1 / -1; padding: 60px 20px; }
.empty.big h2 { color: var(--text); }
.empty p { max-width: 46ch; }

/* ----------------------------------------------------------- setup sheets */

.setup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.read-group { background: rgba(255, 255, 255, 0.025); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.read-title { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-bottom: 6px; }
.read-corners { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.read-corner { display: flex; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; }
.read-pairs { display: flex; flex-direction: column; gap: 3px; }
.pair { display: flex; justify-content: space-between; gap: 10px; font-variant-numeric: tabular-nums; }

.corner-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.corner-cell { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); }
.corner-cell.target .input { border-style: dashed; }
.group { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0; }
.group legend { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 0 6px; }

/* ------------------------------------------------------------- alignment */

.align-body { display: grid; grid-template-columns: minmax(150px, 200px) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 620px) { .align-body { grid-template-columns: 1fr; } }
.align-svg { width: 100%; height: auto; max-height: 280px; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.table th, .table td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--line); }
.table thead th { color: var(--muted); font-weight: 550; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; }
.table td.bad { color: #ff9aa2; }
.table td.good { color: #cdefd2; }
.align-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 4px 14px; margin-top: 10px; }
.align-corner-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.align-inputs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.align-table-wrap { overflow-x: auto; }

/* ---------------------------------------------------------------- modals */

.modal {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  padding: 0;
  width: min(560px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}
.modal.wide { width: min(880px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(4, 6, 10, 0.66); backdrop-filter: blur(3px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 16px; max-height: min(70vh, 640px); overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.form-stack { display: flex; flex-direction: column; gap: 12px; }
.span-2 { grid-column: span 2; }
@media (max-width: 520px) { .span-2 { grid-column: span 1; } .corner-grid, .align-inputs { grid-template-columns: repeat(2, 1fr); } }

/* ---------------------------------------------------------------- toasts */

.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast {
  background: rgba(20, 26, 34, 0.96);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 9px 14px;
  box-shadow: var(--shadow);
  animation: rise 0.25s ease;
}
.toast.ok { border-color: rgba(126, 231, 135, 0.4); }
.toast.bad { border-color: rgba(255, 95, 109, 0.45); }
.toast.leaving { opacity: 0; transition: opacity 0.35s; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

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

/* Subsystems with nothing logged shrink to a dot until they are hovered. */
.hotspot.quiet:not(.active) { padding: 4px; opacity: 0.5; }
.hotspot.quiet:not(.active) .hotspot-label { display: none; }
.hotspot.quiet:not(.active):hover { padding: 4px 10px 4px 6px; opacity: 1; }
.hotspot.quiet:not(.active):hover .hotspot-label { display: flex; }

.table td .cell-value { display: block; font-variant-numeric: tabular-nums; }
.table td .cell-target { display: block; color: var(--muted); font-size: 11px; }

/* Engine card, linked alignment and the spec chips on a garage card. */
.engine-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.linked-align { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.linked-align .row { gap: 12px; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.mini-stat { white-space: nowrap; }
.card-spec { display: flex; gap: 6px; flex-wrap: wrap; }
.spec-chip {
  font-size: 11.5px;
  letter-spacing: 0.04em;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 1px 7px;
  font-variant-numeric: tabular-nums;
}
.spec-chip.quiet { color: var(--muted); border-color: var(--line); letter-spacing: 0; }

/* What the vehicle form recognised from the year, make and model. */
.detect-strip { display: none; }
.detect-strip.on {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 12.5px;
}
.detect-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
  background: rgba(126, 231, 135, 0.16);
  color: #bff5c4;
}
.detect-tag.partial { background: rgba(255, 209, 102, 0.16); color: #ffe1a3; }
.detect-tag.guess { background: rgba(255, 255, 255, 0.09); color: var(--muted); }

/* ======================================================= WTCC additions */

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.eyebrow { font: 700 11px/1 'Inter', sans-serif; letter-spacing: .18em; text-transform: uppercase; color: var(--lime); }
.callout { border: 1px solid var(--line); background: rgba(255, 255, 255, .03); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }

/* ---------------------------------------------------- performance index */

.pi-badge {
  --pi: #3fd0c9;
  display: inline-flex; align-items: stretch; border-radius: 7px; overflow: hidden; flex: none;
  font: 800 13px/1 var(--display); letter-spacing: .02em; border: 1px solid var(--pi); background: #0a0a0c;
}
.pi-badge b { background: var(--pi); color: #0a0a0c; padding: 4px 7px; min-width: 24px; text-align: center; }
.pi-badge span { padding: 4px 8px; color: var(--text); }
.pi-badge.big { font-size: 20px; border-radius: 9px; }
.pi-badge.big b { padding: 7px 11px; min-width: 38px; }
.pi-badge.big span { padding: 7px 12px; }
.card-art { position: relative; }
.card-art .pi-badge { position: absolute; top: 10px; right: 10px; }
.head-badge { display: flex; }

.mod-points { font: 800 15px/1 var(--display); color: var(--lime); min-width: 44px; text-align: right; flex: none; }
.list-row.status-planned .mod-points, .list-row.status-removed .mod-points { color: var(--muted); }
.score-preview { padding: 8px 10px; border: 1px dashed var(--line-strong); border-radius: 9px; }
.score-preview strong { color: var(--lime); font: 800 18px/1 var(--display); margin-right: 4px; }

.pi-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.pi-scale { position: relative; display: flex; height: 18px; border-radius: 5px; overflow: visible; margin: 4px 0 14px; }
.pi-band { background: color-mix(in srgb, var(--pi) 70%, #000); color: #0a0a0c; font: 800 11px/18px var(--display); text-align: center; min-width: 18px; }
.pi-band:first-child { border-radius: 5px 0 0 5px; }
.pi-band:nth-last-child(2) { border-radius: 0 5px 5px 0; }
.pi-marker { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1px; background: #fff; border-radius: 2px; box-shadow: 0 0 0 2px #0a0a0c; }

/* ------------------------------------------------------- 3D & photos */

.seg { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.seg-btn { background: rgba(255, 255, 255, .04); border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 12.5px; cursor: pointer; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { color: #0a0a0c; background: var(--lime); border-color: var(--lime); font-weight: 700; }
.choice-list { display: grid; gap: 8px; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--text); font: inherit; cursor: pointer; }
.choice:hover { border-color: var(--line-strong); }
.choice.active { border-color: var(--lime); background: rgba(227, 174, 65, .07); }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px; border: 1.5px dashed var(--line-strong); border-radius: 12px; cursor: pointer; text-align: center; color: var(--text); }
.dropzone:hover { border-color: var(--lime); }
.dropzone .icon { width: 22px; height: 22px; color: var(--lime); }
.fit-tools { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 8px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { position: relative; width: 84px; height: 60px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb b { position: absolute; top: 3px; left: 3px; background: var(--lime); color: #0a0a0c; font-size: 11px; border-radius: 4px; padding: 0 5px; }
.sf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-top: 10px; }
.sf-card { border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: grid; gap: 6px; font-size: 12.5px; }
.sf-card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 6px; }
.shot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.shot { display: grid; gap: 4px; justify-items: center; }
.shot label { width: 100%; aspect-ratio: 4 / 3; border: 1.5px dashed var(--line-strong); border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; text-align: center; padding: 6px; overflow: hidden; position: relative; color: var(--muted); }
.shot label:hover { border-color: var(--lime); color: var(--text); }
.shot.filled label { border-style: solid; padding: 0; }
.shot.filled img { width: 100%; height: 100%; object-fit: cover; }
.shot.filled label span { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0, 0, 0, .65); color: #fff; padding: 2px 4px; font-size: 11px; }
.photo-list { display: grid; gap: 8px; margin-top: 12px; }
.photo-row { display: flex; align-items: center; gap: 10px; }
.photo-row img { width: 72px; height: 52px; object-fit: cover; border-radius: 6px; }
.photo-row select { flex: 1; }

.stage-status { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: rgba(10, 10, 12, .85); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 12px; z-index: 3; }
.stage-status.bad { color: var(--bad); border-color: rgba(255, 95, 109, .4); }
.view-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn { background: rgba(255, 255, 255, .05); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.chip-btn:hover { border-color: var(--lime); }
.vehicle-view.real-model .stage-hint,
.vehicle-view.real-model .stage-tools .icon-btn:nth-child(n+3) { display: none; }

/* --------------------------------------------------------- QR passes */

.pass { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.qr-box { background: #fff; border-radius: 10px; padding: 6px; width: 188px; flex: none; }
.qr-box svg { display: block; width: 100%; height: auto; }
.pass-info { flex: 1; min-width: 200px; display: grid; gap: 6px; justify-items: start; }
.pass-code { font: 800 20px/1 var(--display); letter-spacing: .12em; color: var(--lime); }
.pass-code.small { font-size: 14px; }
.pass-cars { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.pass-car { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.pass-car .qr-box { width: 84px; padding: 3px; }
.pass-car > div:last-child { display: grid; gap: 4px; justify-items: start; }

.scan-view { display: grid; gap: 16px; max-width: 860px; }
.scan-body { display: grid; gap: 16px; }
.scan-hero { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.scan-hero .grow { display: grid; gap: 6px; justify-items: start; }
.scan-photo { width: min(320px, 100%); aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; }
.scan-title { font-size: 28px; }
.scan-cars { display: grid; gap: 8px; margin-top: 12px; }
.scan-car { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); text-decoration: none; }
.scan-car:hover { border-color: var(--lime); }
.staff-tools { border-color: rgba(227, 174, 65, .35); }
.judge { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.judge summary { cursor: pointer; font-weight: 650; }
.judge-row { display: grid; grid-template-columns: 170px 1fr 28px; gap: 10px; align-items: center; font-size: 13px; }
.judge-row input { accent-color: #e3ae41; }
.judge-row output { font: 800 16px/1 var(--display); color: var(--lime); text-align: right; }
@media (max-width: 560px) { .judge-row { grid-template-columns: 1fr 28px; } .judge-row input { grid-column: 1 / -1; } }

/* Mod-list import: the paste box, then the review table. */
.modal.import-modal { width: min(1120px, calc(100vw - 32px)); }
.import-source { display: flex; flex-direction: column; gap: 8px; border-radius: 10px; }
.import-source.drag { outline: 2px dashed var(--accent); outline-offset: 4px; }
.import-text { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.5; }
.import-file { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.import-error { color: #ff9aa2; margin: 0; }
.import-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.import-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.import-table { min-width: 960px; }
.import-table td { padding: 4px; vertical-align: middle; }
.import-table td:first-child, .import-table th:first-child { width: 32px; text-align: center; }
.import-table .input.compact { width: 100%; padding: 6px 8px; font-size: 12.5px; }
.import-table select.input.compact { min-width: 160px; padding-right: 28px; }
.import-table .col-brand { min-width: 130px; }
.import-table .col-name { min-width: 210px; }
.import-table .col-pn { min-width: 110px; }
.import-table .col-cost { min-width: 72px; }
.import-table .col-notes { min-width: 170px; }
.import-table select.col-status { min-width: 118px; }
.import-table tr.look td:first-child { box-shadow: inset 3px 0 0 #ffd166; }
.import-table tr.look { background: rgba(255, 209, 102, 0.05); }
.import-table tr.off { opacity: 0.45; }
.import-fold { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.import-fold summary { cursor: pointer; font-weight: 600; }
.import-fold[open] summary { margin-bottom: 8px; }
.import-fold .muted { margin: 0 0 8px; }
.import-why { font-size: 11px; color: #ffe1a3; padding: 2px 2px 0; }

/* ------------------------------------------------- WTCC door card editor */

.doorcard-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.doorcard-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.doorcard-head .grow { flex: 1; }
.doorcard-bar .seg { margin: 0; }
.doorcard-show { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.doorcard-sliders { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px 16px; align-items: center; }
.doorcard-sliders > .btn { justify-self: start; }
.doorcard-slider { display: grid; grid-template-columns: 92px 1fr 44px; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.doorcard-slider input { width: 100%; accent-color: var(--accent); }
.doorcard-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.stage-canvas.placing { cursor: crosshair; }
