/* C4 Pit Crew — garage motorsport UI */

:root {
  --bg: #080a0e;
  --bg-elevated: #10141c;
  --bg-card: #141a24;
  --bg-card-hover: #1a2230;
  --border: #2c3548;
  --border-glow: rgba(225, 6, 0, 0.35);
  --text: #f2f4f8;
  --text-muted: #9aa4b8;
  --accent: #e10600;
  --accent-hot: #ff2d22;
  --accent-soft: rgba(225, 6, 0, 0.16);
  --gold: #e0b53a;
  --gold-dim: #a67c12;
  --success: #3ecf8e;
  --warning: #f0b429;
  --info: #5eb0ff;
  --radius: 18px;
  --radius-sm: 13px;
  --nav-h: 70px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --font: "Outfit", "Segoe UI", system-ui, -apple-system, sans-serif;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 10px 28px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 0 1px rgba(225, 6, 0, 0.12), 0 12px 32px rgba(0, 0, 0, 0.4);
  --ease: 0.18s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(225, 6, 0, 0.12), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(224, 181, 58, 0.06), transparent 50%),
    linear-gradient(180deg, #0a0c11 0%, var(--bg) 40%, #06080c 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: var(--info);
}

.app {
  max-width: 900px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 22px);
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(180deg, rgba(8, 10, 14, 0.97) 0%, rgba(10, 12, 18, 0.92) 100%);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid rgba(44, 53, 72, 0.9);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  padding: calc(10px + var(--safe-top)) 14px 12px;
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 4px 10px 4px 2px;
  border: none;
  border-radius: 16px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--ease), transform var(--ease), box-shadow var(--ease);
}

.brand:hover {
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 0 1px rgba(224, 181, 58, 0.12);
}

.brand:active {
  transform: scale(0.98);
}

.brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.brand-mark {
  /* ~3" × 1.5" proportions (2:1) at UI size */
  width: 7rem;
  height: 3.5rem;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  padding: 0;
  background: transparent;
  box-shadow:
    0 0 0 1px rgba(224, 181, 58, 0.4),
    0 6px 18px rgba(0, 0, 0, 0.45),
    0 0 20px rgba(225, 6, 0, 0.2);
  overflow: hidden;
}

.brand-emblem {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  border-radius: 10px;
}

@media (min-width: 480px) {
  .brand-mark {
    width: 8.5rem;
    height: 4.25rem;
    border-radius: 11px;
  }
  .brand-emblem {
    border-radius: 11px;
  }
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.brand-title,
.brand h1,
#page-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.15;
  display: block;
  letter-spacing: -0.02em;
}

.brand-sub,
.brand p {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.vehicle-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px 10px;
}

.year-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.year-wrap label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.year-wrap select {
  appearance: none;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 30px 9px 13px;
  font-weight: 700;
  max-width: 11.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%),
    linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 14px) calc(50% - 2px), calc(100% - 9px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  transition: border-color var(--ease), box-shadow var(--ease);
}

.year-wrap select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

.engine-wrap select {
  max-width: 13rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.search-bar {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.search-bar input {
  flex: 1;
  background: rgba(16, 20, 28, 0.9);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 12px 18px;
  outline: none;
  font-weight: 500;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2) inset;
  transition: border-color var(--ease), box-shadow var(--ease);
}

.search-bar input::placeholder {
  color: #6b758a;
}

.search-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 2px 12px rgba(0, 0, 0, 0.2) inset;
}

.search-bar button {
  background: linear-gradient(165deg, var(--accent-hot), var(--accent) 55%, #a00400);
  color: #fff;
  border-radius: 999px;
  padding: 0 20px;
  font-weight: 800;
  min-height: 46px;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 16px rgba(225, 6, 0, 0.35);
  transition: filter var(--ease), transform var(--ease), box-shadow var(--ease);
}

.search-bar button:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 20px rgba(225, 6, 0, 0.45);
}

.search-bar button:active {
  transform: scale(0.97);
}

/* Views */
.view {
  display: none;
  padding: 14px;
  animation: fade 0.18s ease;
}

.view.active {
  display: block;
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.view-intro {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.view-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.count-pill {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--info);
  background: rgba(77, 163, 255, 0.12);
  border: 1px solid rgba(77, 163, 255, 0.3);
  border-radius: 999px;
  padding: 6px 10px;
}

.section-title {
  margin: 0 0 12px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  font-weight: 700;
}

.section-title.spaced {
  margin-top: 22px;
}

.stack-sm {
  margin-bottom: 10px;
}

.stack-md {
  margin-top: 16px;
}

.mt-xs {
  margin-top: 4px;
}

.mt-sm {
  margin-top: 6px;
}

.mt-md {
  margin-top: 12px;
}

.text-sm {
  font-size: 0.85rem;
}

/* Home */
.simple-hero {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 14px;
}

.car-hero {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 40%),
    var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow-glow);
}

.car-hero-photo {
  position: relative;
  aspect-ratio: 16 / 9;
  background:
    radial-gradient(ellipse 80% 60% at 50% 80%, rgba(225, 6, 0, 0.12), transparent 60%),
    #06080c;
}

.car-hero-photo img {
  width: 100%;
  height: 100%;
  /* Show whole car — never crop nose/tail/roof */
  object-fit: contain;
  object-position: center;
  display: block;
}

.car-hero-badge {
  position: absolute;
  left: 12px;
  bottom: 12px;
  background: rgba(6, 8, 12, 0.78);
  border: 1px solid rgba(224, 181, 58, 0.35);
  border-radius: 14px;
  padding: 10px 14px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.car-hero-badge span {
  display: block;
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1;
}

.car-hero-badge small {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.car-hero-copy {
  padding: 14px 16px 16px;
}

.look-blurb {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.year-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}

.year-card {
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  padding: 0;
  width: 100%;
  transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

.year-card:hover {
  border-color: #3a4660;
}

.year-card:active {
  transform: scale(0.985);
}

.year-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 8px 20px rgba(225, 6, 0, 0.18);
}

.year-card-img {
  aspect-ratio: 16 / 10;
  background: #080a0e;
  overflow: hidden;
}

.year-card-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.year-card-meta {
  padding: 8px 10px 10px;
  display: grid;
  gap: 2px;
}

.year-card-meta strong {
  font-size: 1rem;
}

.year-card-meta span {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.25;
}

.year-research-hero {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  aspect-ratio: 16 / 9;
  background: #080a0e;
}

.year-research-hero img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

/* Photo credits (CC attribution) */
.photo-credits {
  margin-top: 18px;
  margin-bottom: 10px;
}

.photo-credits-summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text);
  list-style-position: outside;
}

.photo-credits-summary:hover {
  color: var(--accent);
}

.photo-credits-list {
  margin: 10px 0 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 8px;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.photo-credits-list li strong {
  color: var(--text);
  font-weight: 700;
}

.photo-credits-list a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.year-research-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.88));
}

.year-research-overlay h2 {
  margin: 8px 0 4px;
  font-size: 1.5rem;
}

.year-research-overlay p {
  margin: 0;
  color: #d0d5dd;
  font-weight: 600;
}

@media (min-width: 700px) {
  .year-gallery {
    grid-template-columns: repeat(3, 1fr);
  }

  .car-hero {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
  }

  .car-hero-photo {
    aspect-ratio: auto;
    min-height: 220px;
  }
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold);
  font-weight: 800;
}

.simple-hero h2,
.car-hero-copy h2 {
  margin: 0 0 4px;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.lede {
  margin: 0;
  color: var(--text-muted);
  font-weight: 500;
}

.hero-stat {
  margin: 12px 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.hero-stat strong {
  color: var(--text);
  font-size: 1.1rem;
}

.ask-cta {
  margin-bottom: 14px;
}

.howto-cta {
  margin-bottom: 14px;
  border-color: rgba(225, 6, 0, 0.4);
  background: linear-gradient(160deg, rgba(225, 6, 0, 0.14), var(--bg-card) 58%);
  box-shadow: var(--shadow-glow);
}

.ask-cta-title {
  margin: 0 0 6px;
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* How-to change _____ bar */
.howto-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.howto-bar-compact {
  margin-bottom: 12px;
  padding: 12px;
}

.howto-prefix {
  flex: 0 0 auto;
  font-weight: 800;
  font-size: 0.95rem;
  color: #ffb4b0;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.howto-part-input {
  flex: 1 1 10rem;
  min-width: 8rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 12px 16px;
  outline: none;
  min-height: 46px;
  font-weight: 600;
}

.howto-part-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.howto-part-input::placeholder {
  color: var(--text-muted);
  font-weight: 500;
}

.howto-bar .btn-primary {
  flex: 0 0 auto;
}

/* How-to chips: one horizontal scroll row under Find how-to (no vertical wrap) */
.howto-chip-row {
  margin-bottom: 0;
  padding-bottom: 8px;
}

.howto-vehicle-hint {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffb4b0;
}

.vehicle-fit-banner {
  background: rgba(77, 163, 255, 0.12);
  border: 1px solid rgba(77, 163, 255, 0.35);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: #cfe6ff;
  line-height: 1.4;
}

.vehicle-fit-banner strong {
  color: #fff;
}

.vehicle-fit-note {
  color: var(--text-muted);
  font-weight: 500;
}

.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;
}

@media (max-width: 520px) {
  .howto-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .howto-prefix {
    font-size: 0.9rem;
  }

  .howto-bar .btn-primary {
    width: 100%;
  }
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.stat-pill {
  flex: 1 1 auto;
  min-width: 4.5rem;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.04), transparent 50%), var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 11px 8px;
  display: grid;
  gap: 2px;
  text-align: center;
  transition: border-color var(--ease), transform var(--ease), box-shadow var(--ease);
  box-shadow: var(--shadow-card);
}

.stat-pill strong {
  font-size: 1.2rem;
  color: #fff;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.stat-pill span {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.stat-pill:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft), var(--shadow-card);
  transform: translateY(-1px);
}

.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  margin-bottom: 16px;
}

.menu-tile {
  text-align: left;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.04) 0%, transparent 42%),
    var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 13px;
  display: grid;
  gap: 5px;
  min-height: 100px;
  transition: border-color var(--ease), background var(--ease), transform var(--ease), box-shadow var(--ease);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.menu-tile::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent-hot), var(--gold-dim));
  opacity: 0.85;
}

.menu-tile:hover {
  border-color: rgba(225, 6, 0, 0.4);
  background:
    linear-gradient(145deg, rgba(225, 6, 0, 0.08) 0%, transparent 50%),
    var(--bg-card-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.menu-tile:active {
  transform: scale(0.985);
}

.menu-tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.menu-tile .menu-icon {
  font-size: 1.3rem;
  color: var(--gold);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

.menu-tile strong {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.menu-tile span:last-child {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.35;
}

.hint-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

/* Cards */
.card-grid {
  display: grid;
  gap: 10px;
}

.card {
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.03), transparent 40%),
    var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px;
  text-align: left;
  width: 100%;
  transition: border-color var(--ease), background var(--ease), box-shadow var(--ease), transform var(--ease);
  box-shadow: var(--shadow-card);
}

.card:hover {
  background:
    linear-gradient(165deg, rgba(225, 6, 0, 0.06), transparent 45%),
    var(--bg-card-hover);
  border-color: rgba(225, 6, 0, 0.35);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.pill {
  display: inline-flex;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.pill.accent {
  background: var(--accent-soft);
  color: #ff8a84;
  border-color: rgba(225, 6, 0, 0.35);
}

.pill.gold {
  background: rgba(212, 160, 23, 0.12);
  color: var(--gold);
  border-color: rgba(212, 160, 23, 0.3);
}

.pill.info {
  background: rgba(77, 163, 255, 0.12);
  color: var(--info);
  border-color: rgba(77, 163, 255, 0.3);
}

.card h3 {
  margin: 0 0 4px;
  font-size: 1.02rem;
}

.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.part-card {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 0;
  padding: 0;
  overflow: hidden;
  align-items: stretch;
}

.part-card-img {
  background:
    radial-gradient(ellipse at 50% 40%, #1a2030 0%, #0a0c10 70%);
  min-height: 112px;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--border);
  padding: 8px;
}

.part-card-img img {
  width: 100%;
  height: 100%;
  max-height: 120px;
  object-fit: contain;
  display: block;
  border-radius: 6px;
}

.part-card-img.placeholder {
  color: var(--text-muted);
  font-size: 1.4rem;
  font-weight: 800;
  opacity: 0.45;
}

.part-card-body {
  padding: 12px 14px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.part-card-body .card-kicker {
  margin-top: 0;
  margin-bottom: 4px;
}

.part-card-body h3 {
  font-size: 0.98rem;
  line-height: 1.25;
}

.part-card-body p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.84rem;
  line-height: 1.35;
}

.part-hero {
  background:
    radial-gradient(ellipse at 50% 30%, #1a2232 0%, #0a0c10 65%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.part-hero img {
  width: 100%;
  max-height: 360px;
  min-height: 200px;
  object-fit: contain;
  display: block;
  padding: 16px;
  background: transparent;
}

.part-hero-caption {
  margin: 0;
  padding: 10px 14px;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
}

.topic-photo {
  margin-bottom: 14px;
}

.topic-photo img {
  max-height: 280px;
}

.knowledge-panel h3 {
  margin: 12px 0 6px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.knowledge-panel h3:first-child {
  margin-top: 0;
}

.knowledge-panel ul {
  margin: 0 0 8px;
  padding-left: 18px;
}

.knowledge-panel li {
  margin-bottom: 4px;
}

@media (min-width: 700px) {
  .card-grid.parts-grid,
  #parts-list.card-grid,
  #home-parts.card-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Diagram image cards */
.diagram-stack {
  display: grid;
  gap: 14px;
}

.diagram-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  width: 100%;
  padding: 0;
  display: block;
}

.diagram-card:hover {
  border-color: #3a4660;
}

.diagram-ask-label {
  padding: 10px 12px 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
}

.diagram-ask-label strong {
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.diagram-frame {
  padding: 10px 10px 0;
  background: #e8e2d4;
}

.diagram-frame.large {
  padding: 12px;
  background: #e8e2d4;
}

.diagram-svg,
.diagram-svg-manual {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.diagram-svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid #1e2636;
}

.diagram-meta {
  padding: 12px 14px 14px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.diagram-meta h3 {
  margin: 6px 0 4px;
  font-size: 1.05rem;
}

.diagram-meta p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.diagram-hero {
  margin-bottom: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.diagram-hero .diagram-ask-label {
  padding: 12px 14px 0;
}

/* Filters / chips — single-line horizontal scroll */
.filter-row,
.chip-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 10px;
  margin-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: rgba(225, 6, 0, 0.55) rgba(255, 255, 255, 0.06);
}

.filter-row::-webkit-scrollbar,
.chip-row::-webkit-scrollbar {
  height: 8px;
  display: block;
}

.filter-row::-webkit-scrollbar-track,
.chip-row::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}

.filter-row::-webkit-scrollbar-thumb,
.chip-row::-webkit-scrollbar-thumb {
  background: rgba(225, 6, 0, 0.55);
  border-radius: 999px;
}

.filter-row button,
.chip {
  flex: 0 0 auto;
  padding: 10px 14px;
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(16, 20, 28, 0.95);
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--text-muted);
  scroll-snap-align: start;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: border-color var(--ease), color var(--ease), background var(--ease), box-shadow var(--ease);
}

.filter-row button.active,
.chip:hover,
.filter-row button:hover {
  border-color: rgba(225, 6, 0, 0.5);
  color: #ffc9c6;
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px rgba(225, 6, 0, 0.15);
}

.filter-row button:focus-visible,
.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Ask */
.ask-box {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.ask-box-flush {
  margin-bottom: 0;
}

.ask-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.ask-box textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  outline: none;
}

.ask-box textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn-primary {
  background: linear-gradient(165deg, var(--accent-hot), var(--accent) 50%, #a00400);
  color: #fff;
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 800;
  min-height: 46px;
  letter-spacing: 0.01em;
  transition: filter var(--ease), transform var(--ease), box-shadow var(--ease);
  box-shadow: 0 4px 18px rgba(225, 6, 0, 0.32);
}

.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 22px rgba(225, 6, 0, 0.42);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.btn-sm {
  padding: 10px 14px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
}

.btn-ghost:hover {
  border-color: var(--info);
}

.ai-status {
  margin: 0 0 10px;
  font-size: 0.85rem;
}

.ai-settings {
  margin-bottom: 12px;
}

.ai-settings summary {
  cursor: pointer;
  font-size: 0.95rem;
}

.ai-settings code {
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.8rem;
}

.ai-field {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ai-field input,
.ai-field select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}

.ai-answer {
  background: linear-gradient(145deg, #152028, var(--bg-card));
  border: 1px solid rgba(77, 163, 255, 0.4);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.ai-answer h3 {
  margin: 0 0 8px;
  color: var(--info);
}

.ai-answer .ai-body {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.5;
  color: var(--text);
}

.ai-answer .ai-meta {
  margin: 10px 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.memory-banner {
  background: rgba(62, 207, 142, 0.12);
  border: 1px solid rgba(62, 207, 142, 0.35);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: #b6f0d0;
}

.memory-list {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.memory-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.memory-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.memory-answer {
  margin: 0;
  color: var(--text);
  white-space: pre-wrap;
  font-size: 0.92rem;
  line-height: 1.45;
}

.memory-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

#memory-manual-a {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  width: 100%;
  resize: vertical;
  font-family: inherit;
}

.ask-banner h3 {
  margin: 4px 0 6px;
  font-size: 1.15rem;
}

.direct-answer {
  background: linear-gradient(145deg, #1a2818, var(--bg-card));
  border: 1px solid rgba(62, 207, 142, 0.45);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.direct-answer h3 {
  margin: 4px 0 10px;
  font-size: 1.15rem;
  color: #8ef0c0;
}

.direct-answer-body {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
}

.color-callout {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: #1c1810;
  border: 2px solid #c4a574;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.color-callout strong {
  display: block;
  font-size: 1.2rem;
  margin-bottom: 4px;
  color: #e8d5b0;
}

.color-callout p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.color-swatch {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.15);
}

.color-swatch.tan {
  background: linear-gradient(145deg, #d4b896, #a68b5b);
}

.key-answers-panel .key-answer {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.key-answers-panel .key-answer:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.key-answers-panel .key-answer h4 {
  margin: 0 0 6px;
  color: #8ef0c0;
  font-size: 0.95rem;
}

.key-answers-panel .key-answer p {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.5;
}

.answer {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.answer p {
  margin: 0;
  color: var(--text-muted);
}

/* Detail */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 12px;
  padding: 10px 0;
  min-height: 44px;
  transition: color var(--ease);
}

.back-btn:hover {
  color: var(--text);
}

.back-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.detail-header h2 {
  margin: 0 0 8px;
  font-size: 1.4rem;
}

.detail-header .summary {
  color: var(--text-muted);
  margin: 0 0 12px;
}

.panel {
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.035), transparent 45%),
    var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-card);
}

.panel h3 {
  margin: 0 0 10px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  font-weight: 700;
}

.panel ul {
  margin: 0;
  padding-left: 18px;
}

.panel li {
  margin-bottom: 6px;
}

.warn-panel {
  border-color: rgba(240, 180, 41, 0.4);
  background: rgba(240, 180, 41, 0.08);
}

.warn-panel h3 {
  color: var(--warning);
}

.muted {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Steps + printable checklist */
.steps {
  display: grid;
  gap: 10px;
}

.checklist-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.checklist-progress {
  flex: 1 1 12rem;
  min-width: 10rem;
}

.checklist-progress-bar {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 6px;
}

.checklist-progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #ff6a3d);
  border-radius: 999px;
}

.checklist-progress-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.checklist-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checklist-step {
  align-items: start;
}

.step-check-box {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--bg-elevated);
  color: var(--success);
  font-size: 1.2rem;
  font-weight: 900;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.step.done .step-check-box {
  border-color: rgba(62, 207, 142, 0.55);
  background: rgba(62, 207, 142, 0.15);
}

.step-num-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.step-num-line h4 {
  margin: 0;
}

.step-index {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
  min-width: 1.2rem;
}

.step-body {
  min-width: 0;
}

.print-meta {
  display: none;
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: #333;
}

/* Shop list (parts + machine shop) */
.shop-list-panel h3 {
  margin-bottom: 6px;
}

.shop-list-intro {
  margin: 0 0 12px !important;
  font-size: 0.88rem;
  line-height: 1.4;
}

.shop-section {
  margin-bottom: 14px;
}

.shop-section:last-child {
  margin-bottom: 0;
}

.shop-section h4 {
  margin: 0 0 8px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
}

.shop-items {
  display: grid;
  gap: 6px;
}

.shop-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.92rem;
  line-height: 1.35;
}

.shop-item input {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.shop-item.done {
  opacity: 0.72;
}

.shop-item.done span {
  text-decoration: line-through;
  color: var(--text-muted);
}

@media print {
  body.printing-checklist * {
    visibility: hidden;
  }

  body.printing-checklist .print-checklist,
  body.printing-checklist .print-checklist * {
    visibility: visible;
  }

  body.printing-checklist .print-checklist {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    max-width: none;
    color: #000;
    background: #fff;
    padding: 12px 16px 24px;
  }

  body.printing-checklist .no-print,
  body.printing-checklist .bottom-nav,
  body.printing-checklist .topbar,
  body.printing-checklist .step-check {
    display: none !important;
  }

  body.printing-checklist .print-meta {
    display: block;
  }

  body.printing-checklist .step {
    break-inside: avoid;
    background: #fff;
    border: 1px solid #ccc;
    color: #000;
    grid-template-columns: 28px 1fr;
  }

  body.printing-checklist .step-check-box {
    border: 2px solid #000;
    background: #fff;
    color: #000;
    width: 28px;
    height: 28px;
  }

  body.printing-checklist .step.done .step-check-box::after {
    content: "✓";
  }

  body.printing-checklist .warn-panel {
    border: 1px solid #000;
    background: #f5f5f5;
  }

  body.printing-checklist .panel,
  body.printing-checklist .detail-header h2,
  body.printing-checklist .summary,
  body.printing-checklist .disclaimer {
    color: #000;
  }

  body.printing-checklist .pill {
    border: 1px solid #666;
    color: #000;
    background: #eee;
  }

  body.printing-checklist .shop-list-panel {
    break-inside: avoid;
    border: 1px solid #000;
    background: #fff;
  }

  body.printing-checklist .shop-section h4 {
    color: #000;
  }

  body.printing-checklist .shop-item {
    break-inside: avoid;
    background: #fff;
    border: 1px solid #999;
    color: #000;
  }

  body.printing-checklist .shop-item.done span {
    color: #333;
  }

  body.printing-checklist .shop-list-intro {
    color: #333 !important;
  }
}

.step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
}

.step-num {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: #ff8a84;
  display: grid;
  place-items: center;
  font-weight: 800;
  border: 1px solid rgba(225, 6, 0, 0.3);
}

.step h4 {
  margin: 0 0 6px;
}

.step p {
  margin: 0;
  color: var(--text-muted);
  white-space: pre-wrap;
  font-size: 0.95rem;
}

.step.done {
  opacity: 0.55;
}

.step.done .step-num {
  background: rgba(62, 207, 142, 0.15);
  color: var(--success);
  border-color: rgba(62, 207, 142, 0.35);
}

.step-check {
  margin-top: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--info);
  min-height: 40px;
  padding: 8px 0;
  display: inline-flex;
  align-items: center;
}

/* Specs / components */
.spec-list {
  display: grid;
  gap: 8px;
}

.spec-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.spec-item:last-child {
  border-bottom: none;
}

.spec-item strong {
  display: block;
  margin-bottom: 2px;
}

.spec-item span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.component-list {
  display: grid;
  gap: 8px;
}

.component-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.component-row span {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: right;
}

/* Wire table */
.table-wrap {
  overflow-x: auto;
}

.wire-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.wire-table th {
  text-align: left;
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.wire-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.wire-table .arrow {
  color: var(--accent);
  font-weight: 800;
}

.wire-color {
  color: var(--info);
  font-weight: 600;
}

.shop-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shop-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}

.shop-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.shop-btn.forum-btn {
  border-color: color-mix(in srgb, var(--info) 40%, var(--border));
}

.shop-btn.forum-btn:hover {
  border-color: var(--info);
  background: color-mix(in srgb, var(--info) 12%, transparent);
}

.web-search-panel {
  margin-top: 16px;
}

.web-search-panel .web-search-label {
  margin: 12px 0 6px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.web-search-panel .web-search-label:first-of-type {
  margin-top: 4px;
}

.teach-panel {
  margin-top: 16px;
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.teach-panel .teach-label {
  display: block;
  margin: 10px 0 4px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.teach-panel input,
.teach-panel textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

.teach-panel textarea {
  resize: vertical;
  min-height: 100px;
}

.teach-panel #teach-save-btn {
  margin-top: 12px;
}

.link-list {
  display: grid;
  gap: 8px;
}

.link-list button {
  text-align: left;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-weight: 700;
}

.link-list button:hover {
  border-color: var(--info);
}

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 36px 16px;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  line-height: 1.45;
}

.disclaimer {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.02);
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: linear-gradient(180deg, rgba(10, 12, 18, 0.92), rgba(6, 8, 12, 0.98));
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  border-top: 1px solid rgba(44, 53, 72, 0.95);
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.4);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  z-index: 50;
  max-width: 900px;
  margin: 0 auto;
}

.bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 8px 2px 6px;
  transition: color var(--ease), background var(--ease);
  -webkit-tap-highlight-color: transparent;
  border-radius: 12px;
  margin: 4px 2px 0;
}

.bottom-nav button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -4px;
  border-radius: 10px;
}

.wire-count {
  margin: 4px 0 10px;
}

/* ---------- RPO Code Finder ---------- */
.rpo-input {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  outline: none;
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  line-height: 1.45;
}

.rpo-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.rpo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.rpo-results {
  margin-top: 14px;
}

.rpo-report {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  overflow: hidden;
}

.rpo-report-header {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
}

.rpo-decode-meta {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.rpo-summary {
  margin: 0;
  padding: 10px 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(225, 6, 0, 0.22);
  border-radius: 10px;
}

.rpo-summary-list {
  margin: 8px 0 0;
  padding-left: 1.2rem;
  max-height: 140px;
  overflow-y: auto;
}

.rpo-summary-list li {
  margin: 4px 0;
  font-size: 0.9rem;
}

/* Main multi-code meanings panel — tall enough to read, scrolls for long stickers */
.rpo-scroll {
  max-height: min(62vh, 560px);
  min-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  scroll-behavior: smooth;
}

.rpo-scroll:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.rpo-scroll-browse {
  min-height: 180px;
  max-height: min(55vh, 480px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

/* Scrollbar (WebKit) */
.rpo-scroll::-webkit-scrollbar,
.rpo-summary-list::-webkit-scrollbar {
  width: 10px;
}
.rpo-scroll::-webkit-scrollbar-thumb,
.rpo-summary-list::-webkit-scrollbar-thumb {
  background: #3a4660;
  border-radius: 8px;
}
.rpo-scroll::-webkit-scrollbar-track,
.rpo-summary-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.rpo-card-stack {
  display: grid;
  gap: 10px;
}

.rpo-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 14px 12px;
  border-left: 4px solid var(--border);
}

.rpo-index {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.rpo-card-extra {
  margin: 0;
}

.rpo-card.rpo-imp-critical {
  border-left-color: var(--accent);
}

.rpo-card.rpo-imp-high {
  border-left-color: var(--gold);
}

.rpo-card.rpo-imp-normal {
  border-left-color: var(--info);
}

.rpo-card.rpo-imp-low {
  border-left-color: #5a6578;
}

.rpo-card.rpo-imp-unknown,
.rpo-card.rpo-card-miss {
  border-left-color: #8b4513;
  opacity: 0.95;
}

.rpo-card-top {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

.rpo-code {
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  color: #fff;
  background: rgba(225, 6, 0, 0.18);
  border: 1px solid rgba(225, 6, 0, 0.35);
  border-radius: 8px;
  padding: 2px 10px;
}

.rpo-card h3 {
  margin: 0 0 4px;
  font-size: 1.02rem;
  line-height: 1.3;
}

.rpo-years {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: var(--gold);
}

.rpo-body {
  margin-top: 6px;
}

.rpo-detail {
  margin: 0 0 10px;
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.45;
}

.rpo-includes-block {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: rgba(77, 163, 255, 0.08);
  border: 1px solid rgba(77, 163, 255, 0.2);
  border-radius: 10px;
}

.rpo-includes-years {
  display: block;
  font-size: 0.88rem;
  color: var(--info);
  margin-bottom: 6px;
}

.rpo-includes-block ul {
  margin: 0;
  padding-left: 1.2rem;
}

.rpo-includes-block li {
  margin: 3px 0;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.4;
}

.rpo-var-list {
  margin: 0 0 10px;
  padding-left: 1.2rem;
}

.rpo-var-list li {
  margin: 3px 0;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.35;
}

.rpo-garage {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.rpo-related {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.rpo-related-chip {
  font-family: ui-monospace, Consolas, monospace;
}

.rpo-filter-row {
  margin: 4px 0 10px;
}

.rpo-year-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
}

.rpo-help-list {
  margin: 10px 0 0;
  padding-left: 1.2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.rpo-help-list li {
  margin: 6px 0;
}

.rpo-imp-pill {
  font-size: 0.72rem;
}

/* ---------- C4 VIN Decoder ---------- */
.vin-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  outline: none;
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.4;
}

.vin-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.vin-results {
  margin-top: 14px;
}

.vin-report {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  overflow: hidden;
}

.vin-report.vin-status-ok {
  border-color: rgba(34, 197, 94, 0.45);
}

.vin-report.vin-status-err {
  border-color: rgba(225, 6, 0, 0.4);
}

.vin-report-header {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
}

.vin-status {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.vin-display {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  word-break: break-all;
}

.vin-mono {
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  letter-spacing: 0.06em;
}

.vin-err-list,
.vin-warn-list {
  margin: 10px 0 0;
  padding-left: 1.2rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

.vin-err-list {
  color: #fca5a5;
}

.vin-warn-list {
  color: #fcd34d;
}

.vin-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  padding: 12px;
}

.vin-stat {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 72px;
}

.vin-stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.vin-stat strong {
  font-size: 1rem;
  line-height: 1.25;
}

.vin-stat-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.vin-pill-ok {
  color: #4ade80;
}

.vin-pill-bad {
  color: #f87171;
}

.vin-pill-muted {
  color: var(--text-muted);
}

.vin-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 0 4px;
}

.vin-report .vin-table-wrap {
  padding: 0 12px 12px;
}

.vin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.vin-table th,
.vin-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.vin-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.15);
}

.vin-table tr:last-child td {
  border-bottom: none;
}

.vin-pos {
  white-space: nowrap;
  font-weight: 600;
  color: var(--accent);
  width: 3.5rem;
}

.vin-raw {
  font-weight: 700;
  width: 3rem;
}

.vin-pos-detail {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.35;
}

.vin-notes {
  margin: 0;
  padding: 10px 14px 12px 2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.vin-notes li {
  margin: 4px 0;
}

.vin-rpo-tip {
  margin: 0;
  padding: 10px 14px 14px;
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.12);
}

.vin-help-list {
  margin: 10px 0 0;
  padding-left: 1.2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.vin-help-list li {
  margin: 6px 0;
}

.vin-code-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.vin-code-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  font-size: 0.85rem;
}

.vin-code-chip code {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.95rem;
}

.vin-ref-table {
  margin-top: 8px;
}

.vin-panel .ask-cta-title {
  margin-bottom: 4px;
}

.wire-search-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 12px 16px;
  outline: none;
  margin-bottom: 10px;
}

.wire-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.wire-directory {
  display: grid;
  gap: 8px;
}

.wire-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: left;
  width: 100%;
}

.wire-row:hover {
  border-color: #3a4660;
}

.wire-swatch {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.wire-row h3 {
  margin: 0 0 4px;
  font-size: 0.98rem;
}

.wire-row .wire-path {
  margin: 0 0 4px;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.35;
}

.wire-row .wire-note {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.wire-row .wire-sys {
  display: inline-block;
  margin-bottom: 4px;
}

.color-callout.green-temp .color-swatch {
  background: linear-gradient(145deg, #1a7a42, #0d5c2e);
}

.bottom-nav button .icon {
  font-size: 1.2rem;
  line-height: 1;
  transition: transform var(--ease), color var(--ease);
}

.bottom-nav button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.bottom-nav button.active {
  color: #fff;
  background: rgba(225, 6, 0, 0.1);
}

.bottom-nav button.active .icon {
  color: var(--accent-hot);
  transform: translateY(-1px);
  filter: drop-shadow(0 0 8px rgba(225, 6, 0, 0.5));
}

/* Selection + focus polish */
:focus:not(:focus-visible) {
  outline: none;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
}

/* Image reveal */
.part-card-img img,
.part-hero img,
.year-card-img img,
.car-hero-photo img {
  animation: img-in 0.28s ease both;
}

@keyframes img-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .view {
    animation: none;
  }
}

@media (min-width: 700px) {
  .menu-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .part-card {
    grid-template-columns: 128px 1fr;
  }

  .part-card-img {
    min-height: 128px;
  }

  .part-card-img img {
    max-height: 140px;
  }

  .bottom-nav button {
    font-size: 0.65rem;
  }
}

/* Desktop: center bottom nav under app column */
@media (min-width: 900px) {
  .bottom-nav {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 100%;
    border-radius: 16px 16px 0 0;
  }
}
