:root {
  --bg: #071018;
  --panel: rgba(14, 27, 34, 0.96);
  --panel-soft: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.16);
  --green: #9cd483;
  --green-strong: #46a35f;
  --blue: #1680b6;
  --blue-soft: #3bb7d7;
  --gold: #f2a900;
  --red: #e75d64;
  --purple: #8d6ef2;
  --teal: #25c0a8;
  --white: #ffffff;
  --muted: rgba(255, 255, 255, 0.72);
  --dim: rgba(255, 255, 255, 0.52);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  overflow: hidden;
  background: var(--bg);
  color: var(--white);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.4;
}

button {
  font: inherit;
}

h1,
h2,
p,
ul,
dl,
dd {
  margin: 0;
}

.case-demo {
  display: grid;
  grid-template-columns: minmax(340px, 410px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(240px, 31svh);
  height: 100svh;
  background:
    radial-gradient(circle at 25% 15%, rgba(22, 128, 182, 0.16), transparent 30%),
    radial-gradient(circle at 18% 80%, rgba(156, 212, 131, 0.12), transparent 28%),
    var(--bg);
}

.case-demo:fullscreen {
  width: 100vw;
  height: 100vh;
}

.demo-side {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  padding: 24px;
  overflow: auto;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(110, 173, 85, 0.1), rgba(15, 111, 171, 0.11)),
    var(--panel);
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2.1rem, 3vw, 2.75rem);
  line-height: 0.96;
}

.demo-side p {
  color: var(--muted);
}

h2 {
  color: var(--white);
  font-size: 0.84rem;
  font-weight: 900;
  text-transform: uppercase;
}

.scenario-card,
.scenario-summary,
.legend-card,
.metric-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.scenario-card,
.scenario-summary,
.legend-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

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

.scenario-buttons button {
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
  cursor: pointer;
  font-weight: 850;
  text-align: left;
  line-height: 1.12;
}

.scenario-buttons button[aria-pressed="true"] {
  border-color: rgba(156, 212, 131, 0.78);
  background: linear-gradient(180deg, #7cbf5d, #4d8938);
}

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

.metric-grid div {
  padding: 12px;
}

.metric-grid span,
.metric-grid strong {
  display: block;
}

.metric-grid span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.metric-grid strong {
  margin-top: 5px;
  color: var(--green);
  font-size: 1.42rem;
  line-height: 1;
}

.scenario-summary p {
  color: var(--muted);
}

.scenario-summary dl {
  display: grid;
  gap: 8px;
}

.scenario-summary dl div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  min-width: 0;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.scenario-summary dt {
  color: var(--dim);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.scenario-summary dd {
  min-width: 0;
  margin-top: 0;
  color: var(--white);
  font-weight: 800;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.legend-card ul {
  display: grid;
  gap: 8px;
  padding: 0;
  list-style: none;
}

.legend-card li {
  display: flex;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.swatch {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 4px;
}

.swatch-audibility {
  background: rgba(22, 128, 182, 0.26);
  border-color: var(--blue-soft);
}

.swatch-planning {
  background: rgba(242, 169, 0, 0.28);
  border-color: var(--gold);
}

.swatch-db {
  background: linear-gradient(90deg, #88497b, #18558c, #134367, #092032);
  border-color: rgba(255, 255, 255, 0.72);
}

.swatch-kept {
  background: var(--green-strong);
  border-radius: 999px;
}

.swatch-relocated {
  background: var(--blue);
  border-radius: 999px;
}

.swatch-modified {
  background: var(--gold);
  border-radius: 999px;
}

.swatch-upper {
  background: var(--teal);
  border-radius: 999px;
}

.swatch-retired {
  background: transparent;
  border-color: var(--red);
  border-radius: 999px;
}

.swatch-new {
  background: var(--purple);
  border-radius: 999px;
}

.swatch-outdoor {
  background: rgba(156, 212, 131, 0.28);
  border-color: var(--green);
}

.swatch-boundary {
  background: transparent;
  border-color: var(--green);
}

.db-ramp {
  display: grid;
  gap: 5px;
  padding-top: 4px;
}

.db-ramp-bar {
  height: 9px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: linear-gradient(90deg, #88497b, #18558c, #134367, #092032);
}

.db-ramp-labels {
  display: flex;
  justify-content: space-between;
  color: var(--dim);
  font-size: 0.72rem;
  font-weight: 850;
}

.demo-note {
  font-size: 0.82rem;
}

.map-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
}

.fullscreen-toggle {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 700;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(7, 16, 24, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 28px rgba(7, 16, 24, 0.2);
  color: #071018;
  cursor: pointer;
  transition:
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.fullscreen-toggle:hover,
.fullscreen-toggle:focus-visible {
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(7, 16, 24, 0.28);
  transform: translateY(-1px);
}

.fullscreen-toggle svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

#warning-map {
  width: 100%;
  height: 100%;
  background: #0b141b;
}

.map-message {
  display: grid;
  height: 100%;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #111820;
  color: var(--white);
}

.leaflet-popup-content {
  font-size: 0.92rem;
}

.leaflet-popup-content strong {
  color: var(--green);
}

.budget-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  padding: 16px 22px 18px;
  border-top: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(7, 16, 24, 0.96), rgba(14, 27, 34, 0.98)),
    var(--bg);
}

.budget-panel-head {
  display: flex;
  gap: 18px;
  align-items: end;
  justify-content: space-between;
}

.budget-panel-head h2 {
  max-width: 680px;
  font-size: 1rem;
  text-transform: none;
}

.chart-metric-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chart-metric-buttons button {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 850;
}

.chart-metric-buttons button[aria-pressed="true"] {
  border-color: rgba(156, 212, 131, 0.7);
  background: rgba(156, 212, 131, 0.18);
  color: var(--green);
}

.chart-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 8px 10px 2px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.budget-chart {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 150px;
}

.chart-bg {
  fill: rgba(255, 255, 255, 0.045);
  stroke: rgba(255, 255, 255, 0.12);
}

.chart-grid {
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 1;
}

.chart-grid.vertical {
  stroke-dasharray: 4 7;
}

.chart-axis-label,
.chart-title,
.chart-legend text {
  fill: rgba(255, 255, 255, 0.74);
  font-size: 13px;
  font-weight: 850;
}

.chart-title {
  fill: var(--green);
  text-transform: uppercase;
}

.chart-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
  filter: url("#chartGlow");
}

.chart-point {
  stroke: #071018;
  stroke-width: 2;
  pointer-events: none;
}

.chart-point[data-kind="counterfactual"] {
  stroke: #ffffff;
}

.chart-hover-area {
  fill: transparent;
  cursor: crosshair;
  pointer-events: all;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  display: grid;
  gap: 4px;
  width: max-content;
  max-width: 230px;
  padding: 10px 12px;
  border: 1px solid rgba(156, 212, 131, 0.42);
  border-radius: 8px;
  background: rgba(7, 16, 24, 0.96);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.36);
  color: var(--white);
  font-size: 0.8rem;
  pointer-events: none;
}

.chart-tooltip strong {
  color: var(--green);
}

.chart-tooltip span {
  color: var(--muted);
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .case-demo {
    grid-template-columns: 1fr;
    grid-template-rows: auto 72svh auto;
    min-height: 100svh;
    height: auto;
  }

  .demo-side {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }

  .budget-panel-head {
    align-items: start;
    flex-direction: column;
  }

  .budget-chart {
    height: 230px;
  }
}

@media (max-width: 560px) {
  .demo-side {
    padding: 20px;
  }

  .scenario-buttons,
  .metric-grid,
  .scenario-summary dl {
    grid-template-columns: 1fr;
  }

  .budget-panel {
    padding: 14px;
  }
}
