:root {
  --bg: #0f2742;
  --bg-2: #0b1e33;
  --panel: #16365a;
  --panel-2: #1c4270;
  --line: rgba(255, 255, 255, 0.14);
  --text: #ffffff;
  --muted: #bccbdb;
  --orange: #ff6a13;
  --orange-dark: #e8590c;
  --ok: #3ddc97;
  --soon-bg: #4a3a12;
  --soon-line: #e0b341;
  --stop-bg: #4a1620;
  --stop-line: #ff5a6e;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}
body.has-cta { padding-bottom: 84px; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 8px; }
h1 { font-size: clamp(1.6rem, 5vw, 2.3rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.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;
}
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid #ffffff; outline-offset: 3px; }

/* ---------- header / banners ---------- */
.site-header {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; max-width: 1100px; margin: 0 auto;
}
.site-header .logo { border-radius: 12px; }
.brand { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
.brand strong { font-size: 1.1rem; letter-spacing: 0.02em; }
.brand span { color: var(--orange); font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; }
.draft-banner {
  background: var(--soon-bg); border-block: 1px solid var(--soon-line);
  color: #ffe6a3; text-align: center; padding: 8px 16px; font-size: 0.9rem;
}

main { max-width: 1100px; margin: 0 auto; padding: 8px 16px 32px; }
.hero { padding: 12px 0 4px; max-width: 720px; }
.hero p { color: var(--muted); font-size: 1.05rem; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin: 14px 0;
}

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 18px; border-radius: 999px; border: 2px solid transparent;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--orange); color: #1a0a00; }
.btn-primary:hover { background: #ff7f33; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }
.link-btn {
  background: none; border: 0; color: var(--orange); font: inherit; font-weight: 600;
  padding: 8px 0; cursor: pointer; min-height: 44px;
}
.link-btn:hover { text-decoration: underline; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-weight: 600; }
.field em { font-weight: 400; font-style: normal; color: var(--muted); }
.field input, .field textarea, .field select {
  font: inherit; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-height: 46px; width: 100%;
}
.field input::placeholder, .field textarea::placeholder { color: #7f93a8; }
.field-row { display: grid; grid-template-columns: 1fr; gap: 0 12px; margin-top: 14px; }
@media (min-width: 640px) { .field-row { grid-template-columns: 160px 1fr 1fr; } }

.chip-row { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 2px solid var(--line); font-weight: 600; background: var(--bg-2);
}
.chip input:checked + span { border-color: var(--orange); background: rgba(255, 106, 19, 0.16); }
.chip input:focus-visible + span { outline: 3px solid #fff; outline-offset: 2px; }

/* ---------- system grid ---------- */
.system-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.system-card {
  text-align: left; font: inherit; color: inherit; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 12px; padding: 14px; min-height: 92px;
  display: flex; flex-direction: column; gap: 4px; cursor: pointer;
}
button.system-card:hover { border-color: var(--orange); }
.system-card strong { font-size: 1.02rem; }
.system-card small { color: var(--muted); }
.system-card.is-soon { opacity: 0.55; cursor: default; }
.badge {
  align-self: flex-start; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; border-radius: 999px; padding: 2px 9px; background: rgba(255, 255, 255, 0.1);
}
.badge.live { background: rgba(255, 106, 19, 0.2); color: #ffb98a; }
.badge.common { background: rgba(61, 220, 151, 0.16); color: #8ff0c4; }
.badge.possible { background: rgba(224, 179, 65, 0.18); color: #f2d481; }
.badge.rare { background: rgba(255, 255, 255, 0.1); color: var(--muted); }

/* ---------- viewer ---------- */
.viewer { margin-top: 10px; }
.viewer-head { max-width: 760px; }
.viewer-grid { display: grid; grid-template-columns: 1fr; gap: 18px; margin-top: 12px; }
@media (min-width: 900px) {
  .viewer-grid { grid-template-columns: minmax(340px, 480px) 1fr; align-items: start; }
  .viewer-grid.no-diagram { grid-template-columns: 1fr; max-width: 760px; }
  .diagram-col { position: sticky; top: 14px; }
}
.diagram-frame {
  background: radial-gradient(circle at 50% 45%, #1d4570 0%, #0c2038 75%);
  border: 1px solid var(--line); border-radius: var(--radius);
  aspect-ratio: 1 / 1; width: 100%; max-width: 520px; margin: 0 auto; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.diagram-frame svg { width: 100%; height: 100%; display: block; }
.diagram-frame svg [data-layer] {
  transition: opacity 0.35s ease, transform 0.45s ease, visibility 0s linear 0s;
  transform-box: fill-box; transform-origin: center;
}
.diagram-frame svg [data-layer].peeled {
  opacity: 0; visibility: hidden; transform: scale(1.08); pointer-events: none;
  transition: opacity 0.35s ease, transform 0.45s ease, visibility 0s linear 0.35s;
}
.diagram-frame svg [data-part] { cursor: pointer; }
.diagram-frame svg [data-part]:hover { filter: brightness(1.15); }
.diagram-frame svg [data-part].hl {
  filter: drop-shadow(0 0 5px #ff6a13) drop-shadow(0 0 14px #ff6a13);
  animation: pulse 1.6s ease-in-out infinite;
}
.diagram-frame svg [data-part]:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
@keyframes pulse { 50% { filter: drop-shadow(0 0 3px #ff6a13) drop-shadow(0 0 8px #ff6a13); } }

/* Phones: keep a compact diagram pinned while the causes scroll underneath. */
@media (max-width: 899px) {
  .viewer-grid { display: block; }
  .diagram-col { display: contents; }
  .diagram-frame {
    position: sticky; top: 0; z-index: 6; width: 100%; max-width: none;
    aspect-ratio: auto; height: 36vh; min-height: 220px;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 12px 18px -10px rgba(0, 0, 0, 0.7);
  }
  .diagram-frame svg { width: auto; height: 100%; max-width: 100%; }
  .info-col { margin-top: 14px; }
  .acc-item { scroll-margin-top: calc(36vh + 12px); }
}

.peel { max-width: 520px; margin: 14px auto 0; }
.peel label { font-weight: 700; display: block; margin-bottom: 6px; }
.peel input[type="range"] { width: 100%; accent-color: var(--orange); min-height: 32px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chips button {
  font: inherit; font-size: 0.88rem; font-weight: 600; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 0 14px; min-height: 40px; cursor: pointer;
}
.chips button[aria-pressed="true"] { border-color: var(--orange); background: rgba(255, 106, 19, 0.18); }
.layer-note { color: var(--muted); font-size: 0.95rem; margin-top: 10px; min-height: 3em; }

/* ---------- tabs & accordions ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.tabs button {
  font: inherit; font-weight: 700; color: var(--muted); background: none; border: 0;
  border-bottom: 3px solid transparent; padding: 10px 14px; min-height: 46px; cursor: pointer;
}
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--orange); }

.acc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.acc-item { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.acc-item.open { border-color: var(--orange); }
.acc-btn {
  width: 100%; text-align: left; font: inherit; font-weight: 600; color: inherit; background: none;
  border: 0; padding: 14px; min-height: 52px; cursor: pointer; display: flex; gap: 10px; align-items: center;
}
.acc-btn .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.acc-btn .dot.soon { background: var(--soon-line); }
.acc-btn .dot.stop { background: var(--stop-line); }
.acc-btn .chev { margin-left: auto; transition: transform 0.2s ease; }
.acc-item.open .chev { transform: rotate(90deg); }
.acc-body { padding: 0 14px 14px; }

.sev { border-radius: 10px; padding: 12px; margin-bottom: 12px; border: 1px solid var(--line); background: var(--bg-2); }
.sev strong { display: block; margin-bottom: 2px; }
.sev.soon { background: var(--soon-bg); border-color: var(--soon-line); }
.sev.stop { background: var(--stop-bg); border-color: var(--stop-line); }
.sev.stop strong { color: #ff9aa8; font-size: 1.1rem; }
.sev .btn { margin-top: 8px; }

.cause-list { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 10px; }
.cause { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.cause-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 4px; }
.cause-name { font-weight: 600; flex: 1; min-width: 180px; }
.price { font-weight: 700; color: #ffd0b0; }
.part-link {
  font: inherit; font-size: 0.85rem; color: var(--orange); background: none; border: 0;
  padding: 6px 0; min-height: 36px; cursor: pointer; text-decoration: underline;
}
.signs { margin: 0 0 12px; padding-left: 20px; color: var(--muted); }
.cta-inline { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.small { font-size: 0.88rem; }

.site-footer { max-width: 1100px; margin: 0 auto; padding: 8px 16px 40px; color: var(--muted); font-size: 0.85rem; }

/* ---------- sticky call-to-action bar ---------- */
.cta-bar {
  position: fixed; inset: auto 0 0 0; z-index: 20; display: flex; gap: 8px; justify-content: center;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(11, 30, 51, 0.96); border-top: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.cta-bar .btn { flex: 1; max-width: 220px; }

/* ---------- dialog ---------- */
dialog {
  width: min(480px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto;
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 18px; padding: 20px;
}
dialog::backdrop { background: rgba(3, 10, 20, 0.7); }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 8px; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--orange); flex: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-error { color: #ff9aa8; min-height: 1.4em; font-weight: 600; margin: 0 0 4px; }

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

/* ---------- vehicle lookup ---------- */
.field select { appearance: auto; }
.vin-box { margin-top: 4px; border-top: 1px solid var(--line); padding-top: 10px; }
.vin-box summary { cursor: pointer; font-weight: 600; color: var(--orange); }
.vin-box p { margin: 8px 0; }
.vin-row { display: flex; gap: 8px; }
.vin-row input {
  flex: 1; min-width: 0; font: inherit; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.vehicle-status { min-height: 1.4em; margin: 8px 0 0; }
.vehicle-status.ok { color: var(--ok); }
.vehicle-status.err { color: #ff9aa8; }

/* ---------- picker buttons + pick-list sheet ---------- */
.picker-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  min-height: 48px; font: inherit; font-weight: 600; text-align: left; cursor: pointer;
  color: var(--text); background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px;
}
.picker-btn:hover { border-color: rgba(255, 255, 255, 0.35); }
.picker-btn.is-empty .picker-val { color: #9fb2c6; font-weight: 400; }
.picker-btn .chev { flex: none; color: var(--muted); }

dialog.picker {
  padding: 0; width: min(520px, 100%); max-width: 100%; margin: 0 auto auto;
  border-radius: 0 0 18px 18px; border-top: 0;
  max-height: 62vh; max-height: min(62dvh, 560px); overflow: hidden;
}
dialog.picker[open] { display: flex; flex-direction: column; }
.picker-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 6px 2px 18px; }
.picker-head h2 { margin: 0; font-size: 1.1rem; }
.picker-close {
  width: 44px; height: 44px; border: 0; background: transparent; color: var(--text);
  font-size: 1.9rem; line-height: 1; cursor: pointer; border-radius: 10px; flex: none;
}
.picker-close:hover { background: rgba(255, 255, 255, 0.1); }
.picker-search { padding: 4px 14px 8px; }
.picker-search input {
  width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-height: 48px;
}
.picker-search input:focus { border-color: var(--orange); outline: none; box-shadow: 0 0 0 2px rgba(255, 106, 19, 0.35); }
.picker-note { padding: 0 18px; margin: 0 0 6px; }
.picker-note:empty { display: none; }
.picker-list {
  list-style: none; margin: 0; padding: 0 8px 12px; overflow-y: auto; flex: 1;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
.picker-opt {
  display: flex; align-items: center; min-height: 48px; padding: 12px; border-radius: 10px;
  cursor: pointer; font-size: 1.02rem;
}
.picker-opt:hover, .picker-opt.is-active { background: rgba(255, 255, 255, 0.1); }
.picker-opt.is-current { color: var(--orange); font-weight: 700; }
.picker-opt[aria-selected="true"]::after { content: "\2713"; margin-left: auto; padding-left: 12px; }
.picker-group {
  padding: 10px 12px 4px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
@media (min-width: 700px) {
  dialog.picker { margin: auto; border-radius: 18px; border-top: 1px solid var(--line); max-height: min(70vh, 620px); }
}

/* ---------- request form ---------- */
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.sheet-head h2 { margin: 0; }
.time-row { margin: 0 0 14px; }
.sticky-actions {
  position: sticky; bottom: 0; background: var(--panel); margin-top: 8px;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
}
.sticky-actions .btn-primary { flex: 1; }
#cta-lead { flex: 2; max-width: 340px; }
.cta-inline .btn { min-height: 48px; }
@media (max-width: 599px) {
  #lead-dialog {
    width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0;
    border: 0; border-radius: 0; padding: 14px 16px 0;
  }
  .field input, .field textarea, .picker-btn { font-size: 16px; }   /* stops iOS zooming into fields */
  .btn { min-height: 48px; }
}

/* no grey tap rectangle behind rounded buttons on touch screens */
button, label, a, summary, .picker-opt { -webkit-tap-highlight-color: transparent; }
