:root {
  --ink: #1a1a1a;
  --ink-muted: #5b5b5b;
  --ink-faint: #9a9a9a;
  --paper: #f7f4ef;
  --line: rgba(0, 0, 0, 0.14);
  --line-strong: rgba(0, 0, 0, 0.36);
  --neg-strong: #1a3a5c;
  --neg-mid: #5b8ba8;
  --neutral: #f2ecd8;
  --pos-mid: #e88a5c;
  --pos-strong: #b02f2a;
  --water: #cfe1f2;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}

body {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

/* ---- header ---- */
.chrome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 28px;
  border-bottom: 0.5px solid var(--line);
  gap: 20px;
}
.masthead {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  flex-shrink: 0;
}
.brand {
  font-family: var(--font-serif);
  font-size: 20px;
  letter-spacing: 0.2px;
}
.sep { color: var(--ink-faint); }
.place {
  color: var(--ink-muted);
  font-size: 13px;
}
#national-mode {
  display: flex;
  gap: 2px;
  border: 0.5px solid var(--line-strong);
  border-radius: 3px;
  padding: 2px;
  background: var(--paper);
}
#national-mode button {
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  letter-spacing: 0.2px;
  border-radius: 2px;
  transition: color 120ms, background 120ms;
}
#national-mode button:hover { color: var(--ink); }
#national-mode button[aria-selected="true"] {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.05);
}
.search {
  position: relative;
  width: 280px;
}
.search input {
  width: 100%;
  border: 0.5px solid var(--line-strong);
  border-radius: 3px;
  background: var(--paper);
  padding: 6px 10px;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--ink);
  outline: none;
}
.chrome-lab {
  display: block;
  padding: 2px 4px;
  margin-left: auto;
  transition: opacity 120ms;
}
.chrome-lab:hover { opacity: 0.6; }
.chrome-lab-logo {
  height: 40px;
  width: auto;
  display: block;
}

/* Search sits next to the brand on the left. Subtle by default. */
.top-search {
  position: relative;
  width: 300px;
  margin-left: 4px;
  margin-right: auto;  /* pushes the logo to the right */
}
.top-search input {
  width: 100%;
  border: 0.5px solid transparent;
  border-radius: 2px;
  background: transparent;
  padding: 6px 10px;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--ink);
  outline: none;
  text-align: left;
  transition: border-color 140ms, background 140ms;
}
.top-search input:hover { border-color: var(--line); }
.top-search input:focus {
  border-color: var(--line-strong);
  background: var(--paper);
}
.top-search input::placeholder { color: var(--ink-faint); }
.top-search ul {
  position: absolute;
  top: 34px;
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--paper);
  border: 0.5px solid var(--line-strong);
  border-radius: 3px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 20;
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}
.top-search li {
  padding: 6px 10px;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
}
.top-search li:hover,
.top-search li.active { background: rgba(0,0,0,0.05); }
.top-search li .hint {
  color: var(--ink-muted);
  font-family: var(--font-mono);
  float: right;
  font-size: 11px;
}

.search input:focus { border-color: var(--ink); }
.search input::placeholder { color: var(--ink-faint); }
.search ul {
  position: absolute;
  top: 32px;
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--paper);
  border: 0.5px solid var(--line-strong);
  border-radius: 3px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 10;
}
.search li {
  padding: 6px 10px;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
}
.search li:hover, .search li.active { background: rgba(0, 0, 0, 0.05); }
.search li .hint {
  color: var(--ink-muted);
  font-family: var(--font-mono);
  float: right;
  font-size: 11px;
}

.lede {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--ink-muted);
  font-style: italic;
  max-width: 320px;
  text-align: right;
  line-height: 1.3;
}

/* ---- map ---- */
main {
  position: relative;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
  background: var(--paper);
}
#map canvas { cursor: crosshair; }

#beeswarm {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: var(--paper);
  z-index: 2;
}
#beeswarm.hidden { display: none; }
#beeswarm .metro-bubble {
  cursor: pointer;
  transition: opacity 150ms;
}
#beeswarm .metro-bubble:hover { stroke: var(--ink); stroke-width: 1.5; }
#beeswarm .axis {
  fill: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
}
#beeswarm .axis-line {
  stroke: var(--ink-faint);
  stroke-width: 0.5;
}
#beeswarm .axis-label {
  fill: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.3px;
}
#beeswarm .metro-label {
  font-family: var(--font-serif);
  font-size: 12px;
  fill: var(--ink);
  stroke: var(--paper);
  stroke-width: 3;
  stroke-linejoin: round;
  paint-order: stroke fill;
  pointer-events: none;
}

.maplibregl-ctrl-attrib {
  font-family: var(--font-sans);
  font-size: 10.5px;
  background: rgba(247, 244, 239, 0.75) !important;
}
.maplibregl-ctrl-attrib a { color: var(--ink-muted); }
.maplibregl-ctrl-group {
  background: var(--paper) !important;
  border: 0.5px solid var(--line-strong) !important;
  box-shadow: none !important;
}
.maplibregl-ctrl-group button {
  background: transparent !important;
}
.maplibregl-canary { display: none; }

/* ---- callouts (SVG-native) ---- */
#map .callout-pin {
  fill: var(--ink);
  stroke: var(--paper);
  stroke-width: 1.5;
  pointer-events: none;
}
#map .callout-lead {
  stroke: var(--ink);
  stroke-width: 0.6;
  fill: none;
  pointer-events: none;
}
#map .callout-title {
  font-family: var(--font-serif);
  font-size: 16px;
  fill: var(--ink);
  stroke: var(--paper);
  stroke-width: 5.5px;
  stroke-linejoin: round;
  paint-order: stroke fill;
  pointer-events: none;
}

/* ---- Editorial layer (only at national zoom, JS toggles .visible) ---- */
.editorial {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 220ms;
}
.editorial.visible { opacity: 1; }
#editorial-headline {
  top: 24px;
  left: 32px;
  max-width: 460px;
}
#editorial-headline .ed-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 12px;
}
#editorial-headline .ed-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 34px;
  line-height: 1.08;
  letter-spacing: -0.2px;
  color: var(--ink);
  margin: 0 0 14px;
}
#editorial-headline .ed-deck {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-muted);
  max-width: 420px;
  margin: 0;
}
#editorial-headline .ed-deck em {
  font-style: italic;
  color: var(--ink);
}

#editorial-legend {
  bottom: 32px;
  left: 32px;
  width: 260px;
  pointer-events: auto;
}
#editorial-legend .ed-legend-titlerow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
#editorial-legend .ed-legend-title {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--ink);
}
#editorial-legend .ed-legend-info {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 0.5px solid var(--line-strong);
  color: var(--ink-muted);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 10px;
  line-height: 13px;
  text-align: center;
  cursor: pointer;
  background: var(--paper);
  padding: 0;
  transition: color 120ms, border-color 120ms;
}
#editorial-legend .ed-legend-info:hover,
#editorial-legend .ed-legend-info:focus {
  color: var(--ink);
  border-color: var(--ink);
  outline: none;
}
#editorial-legend .ed-legend-tip {
  position: absolute;
  bottom: 22px;
  left: -6px;
  width: 280px;
  padding: 12px 14px;
  background: var(--paper);
  border: 0.5px solid var(--line-strong);
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--ink);
  line-height: 1.5;
  letter-spacing: 0;
  text-align: left;
  font-style: normal;
  cursor: default;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms;
  z-index: 5;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
#editorial-legend .ed-legend-tip em { font-style: italic; }
#editorial-legend .ed-legend-tip.open {
  opacity: 1;
  pointer-events: auto;
}
#editorial-legend .ed-legend-subtitle {
  font-family: var(--font-sans);
  font-size: 11.5px;
  color: var(--ink-muted);
  letter-spacing: 0.1px;
  margin-bottom: 12px;
  max-width: 260px;
  line-height: 1.5;
}
#editorial-legend .ed-legend-subtitle strong {
  font-weight: 500;
  color: var(--ink);
}
#editorial-legend .ed-legend-scale {
  display: flex;
  height: 8px;
  border-radius: 1px;
  overflow: hidden;
  margin-bottom: 4px;
}
#editorial-legend .ed-legend-tick { flex: 1; }
#editorial-legend .ed-legend-labels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--ink-muted);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-bottom: 16px;
}
#editorial-legend .ed-legend-labels span {
  text-align: center;
}
#editorial-legend .ed-legend-labels span:first-child { text-align: left; }
#editorial-legend .ed-legend-labels span:last-child { text-align: right; }
#editorial-legend .ed-mid-tick { color: var(--ink-faint); font-size: 9px; }
#editorial-legend .ed-legend-size {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--ink-muted);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
#editorial-legend .ed-size-dot {
  display: inline-block;
  background: var(--ink-faint);
  border-radius: 100px;
  flex-shrink: 0;
}
#editorial-legend .ed-size-dot.small  { width: 6px; height: 10px; }
#editorial-legend .ed-size-dot.medium { width: 8px; height: 14px; }
#editorial-legend .ed-size-dot.large  { width: 10px; height: 18px; }
#editorial-legend .ed-size-label { margin-left: 6px; }

#editorial-about {
  position: absolute;
  bottom: 24px;
  right: 32px;
  z-index: 6;
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-muted);
  letter-spacing: 1.8px;
  text-transform: uppercase;
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  pointer-events: auto;
  transition: color 120ms, border-color 120ms, background 120ms;
}
#editorial-about:hover {
  color: var(--ink);
  border-color: var(--ink);
  background: rgba(0,0,0,0.03);
}

#attrib {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: 0.2px;
  z-index: 4;
  background: rgba(247, 244, 239, 0.7);
  padding: 2px 6px;
  border-radius: 2px;
}
#attrib a { color: var(--ink-muted); text-decoration: none; }
#attrib a:hover { color: var(--ink); }

/* ---- left panel ---- */
#panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 380px;
  height: 100%;
  background: rgba(247, 244, 239, 0.94);
  border-right: 0.5px solid var(--line);
  padding: 24px 24px 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  z-index: 5;
  overflow-y: auto;
}

#panel-title {
  font-family: var(--font-serif);
  font-size: 26px;
  line-height: 1.1;
  color: var(--ink);
  padding-bottom: 8px;
  border-bottom: 0.5px solid var(--line);
  margin-bottom: 4px;
}
#panel-title:empty { display: none; }

/* ---- inspector ---- */
#inspector {
  position: relative;
  padding: 4px 2px 8px;
  font-size: 13px;
}
#inspector .tract-id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
#inspector .place-name {
  font-family: var(--font-serif);
  font-size: 20px;
  margin: 4px 0 12px;
  line-height: 1.15;
}
#inspector .row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-top: 0.5px solid var(--line);
}
#inspector .row:first-of-type { border-top: none; }
#inspector .row .k {
  color: var(--ink-muted);
  font-size: 12px;
}
#inspector .row .v {
  font-family: var(--font-mono);
  font-size: 13px;
}
#inspector .row.delta .v.pos { color: var(--pos-strong); }
#inspector .row.delta .v.neg { color: var(--neg-strong); }
#inspector .close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
}
#inspector .close:hover { color: var(--ink); }

/* ---- legend ---- */
#legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.2px;
  width: 100%;
  margin-top: auto;
}
#legend .subtitle {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.1px;
}
#legend svg#histogram {
  display: block;
  width: 100%;
  height: auto;
}
#legend .hist-bar { stroke: none; }
#legend .hist-marker {
  stroke: var(--ink);
  stroke-width: 1;
  fill: none;
}
#legend .hist-marker.primary { stroke-width: 1.75; }
#legend .hist-label {
  font-family: var(--font-sans);
  font-size: 10.5px;
  fill: var(--ink);
}
#legend .hist-label.primary { font-weight: 500; }
#legend .hist-axis {
  font-family: var(--font-mono);
  font-size: 9.5px;
  fill: var(--ink-muted);
}
#legend .hist-baseline {
  stroke: var(--ink-faint);
  stroke-width: 0.5;
}
#legend .tract-marker circle {
  stroke: var(--ink);
  stroke-width: 1.25;
}
#legend .tract-marker line {
  stroke: var(--ink);
  stroke-width: 1.25;
}
#legend .tract-marker text {
  font-family: var(--font-sans);
  font-size: 10.5px;
  fill: var(--ink);
  font-weight: 500;
  stroke: var(--paper);
  stroke-width: 4px;
  stroke-linejoin: round;
  paint-order: stroke fill;
}
#legend .title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
#legend .title {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--ink);
  letter-spacing: 0.1px;
}
#legend .subtitle {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.1px;
}
#legend .info {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 0.5px solid var(--line-strong);
  color: var(--ink-muted);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 10px;
  line-height: 13px;
  text-align: center;
  cursor: pointer;
  background: var(--paper);
  padding: 0;
  transition: color 120ms, border-color 120ms;
}
#legend .info:hover, #legend .info:focus {
  color: var(--ink);
  border-color: var(--ink);
  outline: none;
}
#legend .info-tooltip {
  position: absolute;
  bottom: 22px;
  left: -6px;
  width: 280px;
  padding: 12px 14px;
  background: var(--paper);
  border: 0.5px solid var(--line-strong);
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--ink);
  line-height: 1.5;
  letter-spacing: 0;
  text-align: left;
  font-style: normal;
  cursor: default;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms;
  z-index: 5;
}
#legend .info-tooltip.open {
  opacity: 1;
  pointer-events: auto;
}

/* ---- footer ---- */
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 24px;
  border-top: 0.5px solid var(--line);
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.2px;
}
footer a {
  color: var(--ink-muted);
  text-decoration: none;
  border-bottom: 0.5px solid var(--ink-faint);
}
footer a:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  /* Tablet — headline shrinks, panel narrows */
  #editorial-headline .ed-title { font-size: 24px; }
  #editorial-headline .ed-deck { font-size: 12px; }
  #editorial-headline { max-width: 320px; top: 20px; left: 20px; }
  #panel { width: 300px; }
}

@media (max-width: 780px) {
  /* Phone — chrome stacks, headline overlays top of map, legend/about compact */
  .chrome {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 10px 16px;
    gap: 10px;
    align-items: center;
  }
  .brand { font-size: 17px; }
  .chrome-lab-logo { height: 30px; }
  .top-search { order: 3; flex: 1 0 100%; max-width: none; margin: 4px 0 0; }
  .top-search input { border-color: var(--line); background: var(--paper); }

  #editorial-headline {
    position: relative;
    top: auto; left: auto;
    max-width: none;
    padding: 20px 16px 12px;
  }
  #editorial-headline .ed-title { font-size: 22px; line-height: 1.15; }
  #editorial-headline .ed-deck { font-size: 12.5px; line-height: 1.5; }

  #map { position: absolute; top: 0; left: 0; right: 0; bottom: 0; }

  #editorial-legend {
    bottom: 12px; left: 12px;
    width: auto; max-width: 260px;
    background: rgba(247,244,239,0.9);
    padding: 8px 10px;
    border-radius: 3px;
    pointer-events: auto;
  }
  #editorial-about { bottom: 12px; right: 12px; font-size: 9px; padding: 5px 9px; }

  #inspector { position: absolute; top: auto; bottom: 60px; left: 12px; right: 12px; width: auto; }
  #panel { width: 100%; height: auto; max-height: 55vh; bottom: 0; top: auto; }
  #panel-title { font-size: 22px; }
}

/* ==== Mobile chrome & editorial adjustments ==== */
@media (max-width: 640px) {
  .chrome { padding: 10px 14px; }
  .brand { font-size: 15px; }
  .chrome-lab-logo { height: 28px; }
  .top-search {
    order: 3;
    flex: 1 0 100%;
    max-width: none;
    margin: 6px 0 0;
    width: 100%;
  }
  .top-search input {
    border-color: var(--line);
    background: var(--paper);
    text-align: left;
    font-size: 13px;
  }
  #editorial-headline {
    top: 16px;
    left: 16px;
    max-width: 260px;
    pointer-events: none;
  }
  #editorial-headline .ed-title {
    font-size: 18px;
    line-height: 1.1;
    margin-bottom: 8px;
  }
  #editorial-headline .ed-deck { display: none; }
  #editorial-legend {
    bottom: 12px;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    background: rgba(247, 244, 239, 0.94);
    padding: 8px 10px 10px;
    border-radius: 3px;
    border: 0.5px solid var(--line);
    pointer-events: auto;
  }
  #editorial-legend .ed-legend-title { font-size: 12px; }
  #editorial-legend .ed-legend-scale { height: 6px; margin-bottom: 3px; }
  #editorial-legend .ed-legend-labels { font-size: 9px; grid-template-columns: 1fr 1fr 1fr 1fr 1fr; }
  #editorial-legend .ed-legend-labels span:first-child { text-align: left; }
  #editorial-legend .ed-legend-labels span:last-child { text-align: right; }
  #editorial-legend .ed-legend-labels .ed-mid-tick { text-align: center; }
  #editorial-legend .ed-legend-size { display: none; }
  #editorial-about {
    bottom: 12px;
    right: 12px;
    font-size: 9px;
    padding: 5px 9px;
    letter-spacing: 1.4px;
  }
  #attrib { font-size: 9px; }
}

/* ==== Mobile city-zoom panel — bottom sheet with real typography ==== */
@media (max-width: 640px) {
  #panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    max-height: 58vh;
    padding: 14px 16px 20px;
    background: var(--paper);
    border-top: 0.5px solid var(--line);
    border-right: none;
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.08);
    overflow-y: auto;
    z-index: 8;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  #panel::before {
    content: "";
    display: block;
    width: 40px;
    height: 3px;
    border-radius: 2px;
    background: var(--line-strong);
    margin: 0 auto 6px;
    flex-shrink: 0;
  }
  #panel-title {
    font-size: 22px;
    padding-bottom: 4px;
    margin-bottom: 0;
    border-bottom: none;
    line-height: 1.1;
  }
  #inspector {
    padding: 0;
    font-size: 12px;
  }
  #inspector .place-name { font-size: 15px; margin: 4px 0 10px; }
  #inspector .tract-id { font-size: 9px; }
  #inspector .row { padding: 5px 0; }
  #inspector .row .k { font-size: 11px; }
  #inspector .row .v { font-size: 12px; }

  /* On phone we replace the desktop histogram entirely with the hero block.
     Hide the whole legend section — the hero block above already carries the
     label, tooltip, and scale reference. */
  #legend { display: none; }

  /* Hero block injected via JS at city zoom. */
  #panel #m-hero-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
    position: relative;
  }
  #panel .m-hero-eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: var(--ink-muted);
  }
  #panel .m-hero-info {
    width: 16px; height: 16px;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    background: transparent;
    color: var(--ink-muted);
    font-family: var(--font-serif);
    font-size: 11px;
    font-style: italic;
    line-height: 14px;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  #panel .m-hero-info:hover { color: var(--ink); border-color: var(--ink); }
  #panel .m-hero-tip {
    background: var(--paper);
    border: 1px solid var(--line);
    padding: 10px 12px;
    font-family: var(--font-sans);
    font-size: 11.5px;
    line-height: 1.55;
    color: var(--ink);
    border-radius: 2px;
    margin-top: 4px;
  }
  #panel .m-hero {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-top: 2px;
  }
  #panel .m-hero-label {
    font-family: var(--font-sans);
    font-size: 12px;
    color: var(--ink);
    letter-spacing: 0.1px;
    flex: 1;
    line-height: 1.35;
  }
  #panel .m-hero-value {
    font-family: var(--font-serif);
    font-size: 46px;
    line-height: 1;
    letter-spacing: -1px;
  }
  #panel .m-scale {
    position: relative;
    height: 10px;
    border-radius: 2px;
    background: linear-gradient(to right, var(--neg-strong), var(--neg-mid), var(--neutral), var(--pos-mid), var(--pos-strong));
    margin-top: 10px;
  }
  #panel .m-scale-marker {
    position: absolute;
    top: -4px;
    width: 2px;
    height: 18px;
    background: var(--ink);
    transform: translateX(-1px);
    box-shadow: 0 0 0 1px var(--paper);
  }
  #panel .m-scale-labels {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--ink-muted);
    letter-spacing: 0.4px;
    margin-top: 6px;
  }
  #panel .m-scale-labels span:nth-child(1) { text-align: left; }
  #panel .m-scale-labels span:nth-child(2) { text-align: center; }
  #panel .m-scale-labels span:nth-child(3) { text-align: right; }
}

@media (max-width: 480px) {
  /* Small phone — trim editorial and simplify legend */
  #editorial-headline .ed-title { font-size: 19px; line-height: 1.2; }
  #editorial-headline .ed-deck { font-size: 12px; }
  #editorial-legend {
    width: calc(100vw - 24px);
    max-width: 320px;
  }
  #editorial-legend .ed-legend-labels {
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    gap: 4px;
    font-size: 8.5px;
  }
  #editorial-legend .ed-legend-labels span:first-child { text-align: left; }
  #editorial-legend .ed-legend-labels span:last-child { text-align: right; }
  #editorial-legend .ed-legend-labels .ed-mid-tick { text-align: center; font-size: 8px; }
  #editorial-legend .ed-legend-size { display: none; }
}
