:root {
  --ink: #111827;
  --muted: #5f6b7a;
  --line: #d8dee7;
  --soft: #f5f7fb;
  --paper: #ffffff;
  --navy: #1f3a5f;
  --tesla: #ef4444;
  --rivian: #3b82f6;
  --green: #169b62;
  --amber: #d97706;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: #f0f3f8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.hero {
  color: #fff;
  background:
    linear-gradient(115deg, rgba(13, 29, 52, .94), rgba(31, 58, 95, .82)),
    radial-gradient(circle at 70% 20%, rgba(59, 130, 246, .28), transparent 30%),
    #152943;
}

.hero__inner {
  width: min(1160px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 44px 0 34px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #b9d6ff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 820px;
  font-size: clamp(34px, 5.6vw, 64px);
  line-height: .97;
}

.lede {
  max-width: 760px;
  margin: 18px 0 0;
  color: #dbeafe;
  font-size: 18px;
  line-height: 1.5;
}

.original-prompt {
  max-width: 980px;
  margin-top: 24px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-left: 3px solid #b9d6ff;
  border-radius: 8px;
  background: rgba(255, 255, 255, .08);
}

.original-prompt__label {
  margin: 0 0 7px;
  color: #b9d6ff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.original-prompt__text {
  margin: 0;
  color: #eaf2ff;
  font-size: 13px;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.meta-row span {
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 6px;
  color: #eaf2ff;
  background: rgba(255, 255, 255, .08);
  font-size: 13px;
}

main {
  width: min(1160px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 22px 0 54px;
}

.kpi-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.kpi {
  min-height: 132px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.kpi__label {
  min-height: 34px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.kpi__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.kpi__name {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.kpi__value {
  font-size: 18px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  margin: 0 -4px 16px;
  padding: 10px 4px;
  background: rgba(240, 243, 248, .92);
  backdrop-filter: blur(8px);
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segmented button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--paper);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.segmented button[aria-pressed="true"] {
  border-color: var(--navy);
  color: #fff;
  background: var(--navy);
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.chart-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.chart-card__header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 16px 10px;
}

.chart-card h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.22;
}

.chart-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.chart-link {
  flex: 0 0 auto;
  align-self: start;
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.chart-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0 10px 10px;
}

.chart-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.axis-label {
  fill: #64748b;
  font-size: 11px;
}

.grid-line {
  stroke: #e5e7eb;
  stroke-width: 1;
}

.zero-line {
  stroke: #9aa6b4;
  stroke-width: 1.2;
}

.series-line {
  fill: none;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dot {
  fill: #fff;
  stroke-width: 2.4;
}

.bar {
  rx: 2;
}

.hit-target {
  fill: transparent;
  cursor: crosshair;
}

.legend {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 0 16px 16px;
  color: var(--muted);
  font-size: 13px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.notes {
  margin-top: 18px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.notes h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.notes ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.tooltip {
  position: fixed;
  z-index: 10;
  display: none;
  min-width: 174px;
  padding: 10px 11px;
  border: 1px solid rgba(15, 23, 42, .16);
  border-radius: 7px;
  color: var(--ink);
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 16px 40px rgba(15, 23, 42, .16);
  pointer-events: none;
  font-size: 13px;
}

.tooltip strong {
  display: block;
  margin-bottom: 5px;
}

.tooltip .tesla { color: var(--tesla); }
.tooltip .rivian { color: var(--rivian); }

@media (max-width: 900px) {
  .kpi-band,
  .chart-grid {
    grid-template-columns: 1fr;
  }

  .hero__inner,
  main {
    width: min(100vw - 28px, 720px);
  }

  .toolbar {
    position: static;
  }
}
