:root {
  color-scheme: dark;
  --canvas: #0A0A0B;
  --graphite: #1C1C1E;
  --card: #2C2C2E;
  --ink: #F5F5F7;
  --muted: rgba(245, 245, 247, 0.62);
  --accent: #FF453A;
  --hair: rgba(245, 245, 247, 0.28);
  --hair-soft: rgba(245, 245, 247, 0.14);
  --hair-faint: rgba(245, 245, 247, 0.2);
  --hair-strong: rgba(245, 245, 247, 0.38);
  --hair-hover: rgba(245, 245, 247, 0.32);
  --dot: rgba(245, 245, 247, 0.45);
  --focus: #fff;
  --scrub-on: #fff;
  --scrub-ink: #0A0A0B;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", sans-serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --canvas: #F5F5F7;
  --graphite: #FFFFFF;
  --card: #FFFFFF;
  --ink: #1D1D1F;
  --muted: #86868B;
  --hair: rgba(29, 29, 31, 0.16);
  --hair-soft: rgba(29, 29, 31, 0.08);
  --hair-faint: rgba(29, 29, 31, 0.12);
  --hair-strong: rgba(29, 29, 31, 0.22);
  --hair-hover: rgba(29, 29, 31, 0.28);
  --dot: rgba(29, 29, 31, 0.28);
  --focus: #1D1D1F;
  --scrub-on: #1D1D1F;
  --scrub-ink: #F5F5F7;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--canvas); color: var(--ink); }
body { min-height: 100vh; }
button, a, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { text-decoration: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.dim {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.011em;
  flex: none;
}
.dim-switch {
  width: 42px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: #E5E5EA;
  padding: 0;
  position: relative;
  flex: none;
}
html[data-theme="dim"] .dim-switch { background: #636366; }
.dim-switch .knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
  transition: transform 160ms ease;
}
.dim-switch[aria-checked="true"] .knob { transform: translateX(18px); }

.home, .compare-main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 18px 0 24px;
}
.stage {
  width: min(1180px, calc(100% - 36px));
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 auto;
  padding: 12px 0 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.home-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas: "brand figure tools";
  align-items: start;
  gap: 12px;
  margin-bottom: 16px;
}
.brand { grid-area: brand; margin: 6px 0 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.home-figure { grid-area: figure; text-align: center; }
.home-tools { grid-area: tools; justify-self: end; margin-top: 6px; }
.hero-title {
  margin: 0 0 10px;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.pair { display: flex; align-items: flex-end; justify-content: center; gap: 22px; }
.pair-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pair-name {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.pair-name i { width: 3px; height: 14px; border-radius: 2px; background: currentColor; }
.pair-name.tesla { color: #FF453A; }
.pair-name.byd { color: #0A84FF; }
.pair-val {
  font-size: clamp(44px, 5.2vw, 72px);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 0.92;
  border-bottom: 4px solid transparent;
  padding-bottom: 3px;
}
.pair-val.tesla { border-bottom-color: #FF453A; }
.pair-val.byd { border-bottom-color: #0A84FF; }
.pair-sep { font-size: clamp(32px, 4vw, 48px); font-weight: 500; line-height: 1; padding-bottom: 8px; }
.hero-meta {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.period-pill {
  justify-self: end;
  margin: 6px 0 0;
  border: 1px solid var(--hair);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
}

.bento {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.tile {
  position: relative;
  display: block;
  min-height: 0;
  padding: 12px 14px 12px 18px;
  background: var(--card);
  border-radius: 18px;
  overflow: hidden;
}
.tile-bar {
  position: absolute;
  left: 8px;
  top: 14px;
  width: 3px;
  height: 28px;
  border-radius: 2px;
  background: var(--accent);
}
.compare-bridge {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  width: min(520px, 100%);
  margin: 2px auto 14px;
  padding: 12px 18px 12px 22px;
  background: var(--card);
  border-radius: 18px;
  position: relative;
}
.compare-bridge .tile-bars {
  display: flex;
  gap: 2px;
}
.compare-bridge .tile-bars i {
  width: 3px;
  height: 32px;
  border-radius: 2px;
  display: block;
}
.compare-bridge .tile-bars i:first-child { background: #FF453A; }
.compare-bridge .tile-bars i:last-child { background: #0A84FF; }
.compare-bridge-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.compare-tile-pair {
  margin: 1px 0 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.compare-tile-metric {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.compare-tile-gms {
  display: flex;
  align-items: center;
  gap: 12px;
}
.compare-gm {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 52px;
}
.compare-gm-name {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.compare-gm-name.tesla { color: #FF453A; }
.compare-gm-name.byd { color: #0A84FF; }
.compare-gm-val {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.compare-tile-gap {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1;
}
.tile-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile-name { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.tile-q {
  border: 1px solid var(--hair);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: -0.01em;
  flex: none;
}
.col-q {
  margin: 8px 0 0;
  border: 1px solid var(--hair);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.stats { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.stats li { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sl { color: var(--muted); font-size: 13px; }
.sv {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.chip {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--hair-faint);
  border-radius: 999px;
  padding: 1px 6px;
}
.compare-gap {
  margin: 10px 0 0;
  font-size: clamp(32px, 3vw, 42px);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1;
}
.compare-note { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.35; }

.mast {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  position: relative;
  z-index: 3;
  view-transition-name: stage-card;
}
.back {
  background: none;
  border: 0;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  padding: 0 4px 0 0;
}
.co-switch { position: relative; min-width: 0; }
.co-name {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.05;
  border-bottom: 0;
  display: inline-block;
}
.co-name-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  padding: 0;
  letter-spacing: inherit;
  line-height: inherit;
}
.co-name-text { border-bottom: 2px solid var(--line, var(--accent)); }
.co-caret {
  width: 8px;
  height: 8px;
  margin-top: 2px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  flex: none;
}
.co-name-btn[aria-expanded="true"] .co-caret {
  margin-top: 6px;
  transform: rotate(225deg);
}
.co-menu {
  position: absolute;
  z-index: 4;
  top: calc(100% + 10px);
  left: 0;
  min-width: 196px;
  margin: 0;
  padding: 6px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
}
.co-menu[hidden] { display: none; }
.co-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: transparent;
  padding: 8px 10px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-align: left;
}
.co-option i {
  width: 3px;
  height: 16px;
  border-radius: 2px;
  display: block;
  flex: none;
}
.co-option[aria-selected="true"],
.co-option:hover { background: var(--hair-faint); }
.mast-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.text-link {
  color: var(--canvas);
  background: var(--ink);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.015em;
  white-space: nowrap;
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--full, #FF453A) 88%, transparent),
    0 8px 18px color-mix(in srgb, var(--full, #FF453A) 42%, transparent);
}
.text-link:hover { color: var(--canvas); filter: brightness(1.08); }
.stage .period-pill { margin: 0; }

.metrics, .chart-switch {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.stage .metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  overflow: hidden;
  flex: none;
  margin: 10px 0 8px;
  padding: 0;
}
/* Leapmotor's strip is five series. OEMs that mark four stay on four columns. */
.stage .metrics:has(> :nth-child(5):last-child) {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.metric {
  background: var(--card);
  border: 1px solid transparent;
  border-radius: 16px;
  min-width: 0;
  padding: 10px 12px 12px;
  text-align: left;
}
.metric .k { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.metric .v {
  display: block;
  margin-top: 4px;
  font-size: clamp(22px, 2.2vw, 30px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.05;
}
.chart-switch .metric { min-width: 0; padding: 8px 14px; border-radius: 999px; }
.metric[aria-pressed="true"] {
  background: var(--graphite);
  border-color: var(--hair-strong);
}
html[data-theme="light"] .metric[aria-pressed="true"] { background: #E8E8ED; }
.metric.is-entering {
  animation: rise 280ms ease-out both;
  animation-delay: calc(var(--i) * 40ms);
}

.chart-well {
  background: var(--graphite);
  border-radius: 22px;
  padding: 4px;
  overflow: hidden;
}
.stage .chart-well {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}
.chart-well.is-entering { animation: rise 280ms ease-out; }
.stage-frame {
  display: block;
  width: 100%;
  height: 520px;
  border: 0;
  background: var(--graphite);
  border-radius: 18px;
}
.stage .stage-frame { height: 100%; min-height: 0; }

.scrub {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
  flex: none;
  padding: 8px 0 0;
}
.scrub button.scrub-gap {
  background: transparent;
  color: var(--muted);
  padding: 8px 4px;
  font-size: 16px;
  font-weight: 700;
}
.scrub button {
  border: 0;
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  flex: 0 0 auto;
  transition: padding 280ms ease-out, background 280ms ease-out, color 280ms ease-out;
}
.scrub button[aria-pressed="true"] {
  background: var(--scrub-on);
  color: var(--scrub-ink);
  padding: 8px 22px;
}
.dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--dot);
  flex: 0 0 auto;
}

.compare {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}
.compare-main {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: auto;
  margin: 0;
  padding: 10px 16px 8px;
}
.rail {
  background: var(--graphite);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  overflow: auto;
}
html[data-theme="light"] .rail { background: #E8E8ED; }
html[data-theme="light"] .rail a[aria-current="page"] { background: #FFFFFF; }
.rail a {
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.rail a[aria-current="page"] { background: var(--card); }
.crumb { margin: 0; color: var(--muted); font-size: 13px; }
.compare-head {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
}
.compare-title {
  width: 100%;
  margin: 0;
  padding: 0 120px;
  box-sizing: border-box;
  text-align: center;
  font-size: clamp(22px, 2.2vw, 30px);
  font-weight: 600;
  letter-spacing: -0.04em;
}
.compare-tools {
  position: absolute;
  top: 0;
  right: 0;
}
.pickers { display: flex; justify-content: center; gap: 12px; margin: 8px 0 2px; flex: none; }
.picker { position: relative; display: inline-flex; align-items: center; }
.picker-mark {
  position: absolute;
  left: 14px;
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--mark, var(--ink));
  pointer-events: none;
}
.picker select {
  appearance: none;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23F5F5F7' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 0;
  border-radius: 999px;
  padding: 8px 36px 8px 26px;
  font-weight: 600;
}
html[data-theme="light"] .picker select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231D1D1F' stroke-width='1.4'/%3E%3C/svg%3E");
}
.picker select option:disabled { color: var(--muted); }
.chart-switch { justify-content: center; margin: 8px 0; flex: none; }
.compare .chart-switch {
  flex-wrap: wrap;
  gap: 8px;
  overflow: visible;
}
.compare .chart-switch .metric {
  padding: 6px 12px;
  font-size: 13px;
  white-space: nowrap;
}
.compare .chart-well {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  position: relative;
}
.compare .stage-frame,
.gap-chart {
  width: 100%;
  height: 100%;
  min-height: 0;
}
.gap-chart { display: block; }
.compare .stage-frame[hidden],
.gap-chart[hidden] { display: none; }
.legend {
  display: flex;
  justify-content: center;
  gap: 22px;
  min-height: 0;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  flex: none;
}
.legend-item { display: inline-flex; align-items: center; gap: 8px; }
.legend-item i { width: 22px; height: 2px; display: inline-block; }
.compare-figures {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-top: 4px;
  flex: none;
}
.gap-mid { text-align: center; }
.side-name { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.03em; }
.side-num {
  margin: 2px 0 0;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 0.95;
}
.side-sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.side-right { text-align: right; }
.full-row { text-align: center; margin: 8px 0 0; }
.range { justify-content: center; }

html[data-theme="light"] .compare-bridge,
html[data-theme="light"] .tile,
html[data-theme="light"] .metric,
html[data-theme="light"] .chart-well {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.045);
}
html[data-theme="light"] .co-menu {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .metric.is-entering, .chart-well.is-entering { animation: none; }
  .scrub button, .dim-switch .knob { transition: none; }
}

@media (max-width: 1100px) {
  .bento { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 800px) {
  .home, .compare-main { width: min(100% - 24px, 1120px); }
  .compare-bridge {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "bars copy gap"
      "bars gms gap";
    width: min(100%, 520px);
  }
  .compare-bridge .tile-bars { grid-area: bars; }
  .compare-bridge-copy { grid-area: copy; }
  .compare-tile-gms { grid-area: gms; justify-content: flex-start; }
  .compare-tile-gap { grid-area: gap; }
  .home-head {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand tools"
      "figure figure";
    align-items: center;
  }
  .home-tools { margin-top: 0; }
  .compare {
    display: block;
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .compare-main { height: auto; overflow: visible; }
  .bento { grid-template-columns: 1fr; }
  .period-pill { justify-self: start; margin-top: 12px; }
  .stage {
    height: auto;
    max-height: none;
    overflow: visible;
    width: min(100% - 24px, 1180px);
  }
  .stage .metrics,
  .stage .metrics:has(> :nth-child(5):last-child) { grid-template-columns: 1fr 1fr; overflow: visible; }
  .stage .period-pill { margin-left: 0; }
  .scrub { overflow-x: auto; justify-content: flex-start; }
  .rail { display: flex; flex-direction: row; gap: 8px; padding: 12px; align-items: center; }
  .compare-title { padding: 0 96px; }
  .compare-main { padding-top: 18px; }
  .stage .stage-frame, .stage-frame { height: 420px; }
  .side-num { font-size: 42px; }
}
