/* Owned by: the map. Tokens follow the v2 boards. */
:root {
  --ground: #0e1728;
  --deck: #131d31;
  --deck-2: #182440;
  --rule: #26334d;
  --rule-2: #1e2a42;
  --rule-3: #3a4866;
  --ink: #e9ecf2;
  --ink-2: #d5dae3;
  --muted: #b3bccb;
  --muted-2: #a3acbd;
  --quiet: #8792a6;
  --firm: #8cc2f7;
  --indie: #f0a640; /* reserved for independents; not used on this map */
  --hover: #1c2842;
  --nodata: #2b2f37;
  --serif: Newsreader, Georgia, 'Times New Roman', serif;
  --sans: 'Sofia Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --edge: 24px;
  --panel-w: 420px;
  --key-w: 360px;
  --hist-h: 26px;
  --sheet-h: 0px;
  --halo: 0 0 1px rgba(7, 12, 22, 1), 0 0 2px rgba(7, 12, 22, 0.95), 0 0 4px rgba(7, 12, 22, 0.8), 0 0 7px rgba(7, 12, 22, 0.55);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--ink); }
a:hover { color: #fff; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.num { font-variant-numeric: lining-nums tabular-nums; }
.nw { white-space: nowrap; }
.firm { color: var(--firm); }

/* ---------- Map ---------- */
.map { position: fixed; inset: 0; background: #161e2c; z-index: 0; }
.map .maplibregl-canvas { outline: none; }
.map .maplibregl-canvas:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.map.is-hovering .maplibregl-canvas { cursor: pointer; }

/* UI fades in once the data is ready. */
.panel, .dock, .attrib, .labels, .sheet { transition: opacity 280ms var(--ease); }
body.is-loading .dock, body.is-loading .attrib, body.is-loading .labels { opacity: 0; }
body.is-loading .panel .rows, body.is-loading .panel .total { opacity: 0; }

/* ---------- Labels on the map (ours, HTML) ---------- */
.labels { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.leaders { position: absolute; inset: 0; overflow: visible; }
.leaders line { stroke: rgba(233, 236, 242, 0.8); stroke-width: 1; }
.leaders circle { fill: #fff; stroke: #0a101c; stroke-width: 1.2; }
.lbl {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  white-space: nowrap;
  color: #fff;
  font-family: var(--sans);
  text-shadow: var(--halo);
  transition: opacity 160ms linear;
  will-change: transform;
}
.lbl.on { opacity: 1; }
.lbl-key, .lbl-nta { font-size: 12px; line-height: 14px; font-weight: 600; letter-spacing: 0.01em; }
.lbl-nta { max-width: 118px; white-space: normal; text-align: center; }
.labels[data-z="mid"] .lbl-nta { font-size: 12.5px; line-height: 15px; }
.labels[data-z="far"] .lbl-nta { font-size: 13.5px; line-height: 16px; max-width: 140px; }
.lbl-boro { font-size: 11.5px; line-height: 15px; color: #dfe6f0; text-align: center; }
.lbl-boro .lbl-cap { font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.lbl-boro .lbl-num { font-family: var(--serif); font-size: 15px; font-weight: 500; letter-spacing: 0; color: #fff; font-variant-numeric: lining-nums tabular-nums; }
.lbl-boro .lbl-sub { display: block; font-size: 12px; line-height: 15px; color: var(--ink-2); letter-spacing: 0; }
.lbl-note {
  width: 200px;
  white-space: normal;
  font-size: 13px;
  line-height: 17px;
  color: var(--ink-2);
}
.lbl-note b { display: block; margin-bottom: 1px; font-family: var(--serif); font-size: 17px; line-height: 20px; font-weight: 500; color: #fff; }
.lbl-city { font-size: 11.5px; line-height: 14px; font-weight: 500; color: var(--muted); padding-left: 9px; }
.lbl-city::before { content: ''; position: absolute; left: 0; top: 5px; width: 4px; height: 4px; border-radius: 50%; background: var(--ink-2); box-shadow: 0 0 0 1.5px rgba(7, 12, 22, 0.9); }

/* ---------- Left panel (opaque) ---------- */
.panel {
  position: absolute;
  z-index: 3;
  top: var(--edge);
  left: var(--edge);
  width: var(--panel-w);
  max-height: calc(100% - var(--edge) * 2);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 28px 22px;
  background: var(--deck);
  border: 1px solid var(--rule);
  border-radius: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
.wordmark {
  display: inline-block;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 17px;
  line-height: 20px;
  color: var(--ink);
  text-decoration: none;
}
.wordmark:hover { text-decoration: underline 1px; text-underline-offset: 4px; }
.title {
  margin: 12px 0 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: -0.012em;
  color: var(--ink);
  text-wrap: balance;
}
/* The title and dek fold away once a place is pinned: the place's name becomes the heading. */
.intro {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 260ms var(--ease), opacity 200ms linear;
}
.intro-in { min-height: 0; overflow: hidden; }
.dek {
  margin: 10px 0 0;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink-2);
}
.panel.is-pinned .intro { grid-template-rows: 0fr; opacity: 0; }
.panel.is-pinned .search { margin-top: 10px; }
.panel.is-pinned .sources { margin-top: 14px; }

/* When the panel scrolls, a fade at its bottom edge says so. */
.panel::after {
  content: '';
  position: sticky;
  bottom: -22px;
  display: block;
  height: 40px;
  margin: -40px -28px 0;
  background: linear-gradient(to bottom, rgba(19, 29, 49, 0), var(--deck) 75%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms;
}
.panel.has-more::after { opacity: 1; }

/* Search */
.search { position: relative; margin: 16px 0 0; }
.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  border-bottom: 1px solid var(--muted-2);
  transition: border-color 150ms;
}
.search-field:focus-within { border-bottom-color: var(--ink); box-shadow: 0 1px 0 var(--ink); }
.search-icon { flex: none; color: var(--muted-2); }
.search-field:focus-within .search-icon { color: var(--ink); }
.search input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1;
  color: var(--ink);
  caret-color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}
.search input::placeholder { color: var(--muted-2); opacity: 1; }
.search input:focus-visible { outline: none; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-clear {
  flex: none;
  display: grid; place-items: center;
  width: 32px; height: 32px; margin-right: -8px;
  padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted-2);
}
.search-clear:hover { color: var(--ink); }
.search-msg { margin: 0; font-size: 13px; line-height: 18px; color: var(--muted-2); }
.search-msg:empty { display: none; }
.search-msg:not(:empty) { margin-top: 8px; }

.sugg {
  position: absolute;
  z-index: 10;
  top: 50px;
  left: -12px;
  right: -12px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--deck-2);
  border: 1px solid var(--rule-3);
  border-radius: 12px;
  box-shadow: 0 14px 32px rgba(4, 8, 18, 0.5);
}
.sugg li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.sugg li[aria-selected="true"], .sugg li:hover { background: #22304d; }
.sugg .s-name {
  min-width: 0;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 22px;
  color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sugg .s-name mark { background: none; color: inherit; font-weight: 600; }
.sugg .s-kind { flex: none; font-size: 13px; line-height: 18px; color: var(--muted-2); white-space: nowrap; }

/* Mode switch */
.modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 16px 0 0;
  padding: 3px;
  border: 1px solid var(--rule);
  border-radius: 999px;
}
.mode {
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
  transition: background-color 180ms var(--ease), color 180ms var(--ease);
}
.mode:hover { color: var(--ink); }
.mode[aria-pressed="true"] { background: var(--ink); color: var(--ground); }

.more-toggle { display: none; }

/* Filter note */
.filter-note {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 -6px;
  font-size: 14px;
  line-height: 20px;
  color: var(--muted);
}
.filter-note b { font-weight: 600; color: var(--ink); }
.filter-note .firm { font-family: var(--serif); font-size: 16px; font-weight: 400; }
.text-btn {
  flex: none;
  padding: 0; border: 0; background: none;
  font-size: 14px; font-weight: 600; color: var(--ink);
  text-decoration: underline 1px; text-underline-offset: 3px; text-decoration-color: var(--muted-2);
}
.text-btn:hover { text-decoration-color: var(--ink); }

/* Summary table */
.summary { margin: 20px 0 0; }
.thead, .trow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px 64px;
  column-gap: 10px;
  align-items: baseline;
}
.thead {
  padding-bottom: 7px;
  border-bottom: 1px solid var(--rule);
  font-size: 12px;
  font-weight: 600;
  line-height: 15px;
  letter-spacing: 0.02em;
  color: var(--muted-2);
}
.thead .num { text-align: right; }
.rows { margin: 0; padding: 0; list-style: none; }
.rows li { border-bottom: 1px solid var(--rule-2); transition: opacity 180ms; }
.trow {
  width: 100%;
  margin: 0;
  padding: 6px 0 7px;
  border: 0;
  background: transparent;
  text-align: left;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 21px;
  color: var(--ink);
}
.trow .t-n, .trow .t-s { text-align: right; font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.trow .t-name { color: var(--firm); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows li.is-dim { opacity: 0.45; }
.rows li.tail .trow { padding-left: 14px; font-size: 16px; }
.trow.t-others .t-name { color: var(--ink-2); display: flex; align-items: baseline; gap: 8px; }
button.trow.t-others:hover .t-name span { text-decoration: underline 1px; text-underline-offset: 4px; text-decoration-color: var(--muted-2); }
.trow.t-others .chev {
  width: 7px; height: 7px;
  border-right: 1.5px solid var(--muted-2); border-bottom: 1.5px solid var(--muted-2);
  transform: translateY(-3px) rotate(45deg);
  transition: transform 200ms var(--ease);
}
.trow.t-others[aria-expanded="true"] .chev { transform: translateY(0) rotate(-135deg); }
.trow.total {
  margin: 0;
  padding-top: 8px;
  border-top: 1px solid var(--rule-3);
  font-weight: 500;
}
.trow.total .t-name { color: var(--ink); }
.rows li:last-child { border-bottom: 0; }

/* Sources */
.sources { margin: 18px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted-2); }
.sources p { margin: 0 0 6px; }
.sources .franchise { color: var(--ink-2); font-size: 14px; line-height: 1.45; }
.sources p:last-child { margin: 0; }
.how-link {
  margin: 0 0 0 2px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: underline 1px;
  text-decoration-color: var(--muted-2);
  text-underline-offset: 4px;
}
.how-link:hover { text-decoration-color: var(--ink); }

/* ---------- A place: the pinned view ---------- */
.place { margin: 14px 0 0; }
.pv-headrow { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pv-headrow .pv-name { min-width: 0; }
.back {
  flex: none;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin: 0;
  padding: 0;
  white-space: nowrap;
  border: 0;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: underline 1px;
  text-decoration-color: var(--muted-2);
  text-underline-offset: 4px;
}
.back:hover { text-decoration-color: var(--ink); }
.pv-name {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.15;
  color: var(--ink);
  text-wrap: balance;
}
.pv-panel .pv-name.is-long { font-size: 23px; line-height: 1.18; }
.pv-sub { margin: 3px 0 0; font-size: 14px; line-height: 18px; color: var(--muted-2); }
.pv-off { color: var(--quiet); }
.lead {
  display: flex;
  align-items: last baseline;
  gap: 14px;
  margin: 10px 0 0;
}
.big {
  flex: none;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 44px;
  line-height: 44px;
  letter-spacing: -0.015em;
  color: #fff;
  font-variant-numeric: lining-nums tabular-nums;
  white-space: nowrap;
}
.big.is-none { color: var(--muted-2); }
.lead-t {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.3;
  color: var(--ink-2);
}
.lead-n { color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.cmp {
  margin: 8px 0 0;
  font-size: 13.5px;
  line-height: 19px;
  color: var(--muted-2);
}
.cmp .cv { color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.cmp .cp { white-space: nowrap; }
.cmp .sep { color: var(--quiet); }

/* Breakdown: brands under each firm, and a line for restaurants counted once. */
.firms { width: 100%; margin: 12px 0 0; border-collapse: collapse; }
.firms thead th {
  padding: 0 0 6px;
  border-bottom: 1px solid var(--rule);
  font-size: 12px;
  font-weight: 600;
  line-height: 15px;
  letter-spacing: 0.02em;
  color: var(--muted-2);
  text-align: left;
}
.firms thead th.num { text-align: right; }
.firms tbody + tbody tr.f > * { border-top: 1px solid var(--rule-2); }
.firms td.num, .firms th.num { text-align: right; white-space: nowrap; padding-left: 12px; font-variant-numeric: lining-nums tabular-nums; }
.firms tr.f th, .firms tr.f td { padding-top: 6px; padding-bottom: 0; vertical-align: baseline; font-family: var(--serif); font-size: 17px; line-height: 21px; }
.firms tr.f th { text-align: left; font-weight: 400; }
.firms tr.f th.others { color: var(--ink-2); }
.firms tr.f td { color: var(--ink); }
.firms tr.b td { padding: 0; font-family: var(--serif); font-size: 15px; line-height: 19px; color: var(--ink-2); vertical-align: baseline; }
.firms tr.b td:first-child { padding-left: 14px; }
.firms tr.b td.num { color: var(--muted); }
.firms tr.b.b-rest td:first-child { color: var(--muted); }
.firms tr.b.co td { font-family: var(--sans); font-size: 13px; line-height: 18px; color: var(--muted-2); padding-top: 1px; white-space: nowrap; }
.firms tbody tr:last-child td { padding-bottom: 6px; }
.note, .none {
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 17px;
  color: var(--muted-2);
}
.none { font-size: 13.5px; }
.nearby {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--rule-2);
  font-size: 13.5px;
  line-height: 19px;
  color: var(--ink);
  font-variant-numeric: lining-nums tabular-nums;
}
.nearby .sep { color: var(--quiet); }
.nearby-k { font-weight: 600; color: var(--muted-2); margin-right: 3px; }
.nb { white-space: nowrap; }
.nb-go {
  padding: 0; border: 0; background: none;
  font: inherit; color: var(--ink);
  text-decoration: underline 1px; text-decoration-color: var(--muted-2); text-underline-offset: 3px;
}
.nb-go:hover { text-decoration-color: var(--ink); }

/* ---------- Bottom right: zoom, the drawer, the legend and the filter control ---------- */
.dock {
  position: absolute;
  z-index: 3;
  top: var(--edge);
  right: var(--edge);
  bottom: 14px;
  width: var(--key-w);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  gap: 10px;
  pointer-events: none;
}
.dock > * { pointer-events: auto; flex: none; }
.zoom {
  align-self: flex-end;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  background: var(--deck);
  margin-bottom: 6px;
}
.zoom button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  transition: background-color 150ms;
}
.zoom button + button { border-top: 1px solid var(--rule); }
.zoom button:hover { background: var(--hover); color: #fff; }
.zoom button:focus-visible { outline-offset: -3px; }
.dock.is-drawer > .zoom { display: none; }

/* The legend sits on the map itself, no box. A feathered scrim behind the corner keeps it legible
   when the map under it is bright; over the ocean it disappears. */
.legend { flex: none; text-shadow: var(--halo); position: relative; }
.legend::before {
  content: '';
  position: absolute;
  z-index: -1;
  left: -64px;
  right: calc(var(--edge) * -1);
  top: -40px;
  bottom: -56px; /* the filter control, the gap and the dock's margin: down to the window's edge, never past it */
  background: rgba(14, 23, 40, 0.9);
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 64px), linear-gradient(to bottom, transparent 0, #000 40px);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent 0, #000 64px), linear-gradient(to bottom, transparent 0, #000 40px);
  mask-composite: intersect;
  pointer-events: none;
}
.dock.is-drawer .legend::before { top: 0; -webkit-mask-image: linear-gradient(to right, transparent 0, #000 64px); mask-image: linear-gradient(to right, transparent 0, #000 64px); }
.legend-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 17px;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.scale { position: relative; margin-top: 4px; }
.bench { position: relative; height: 18px; }
.mark {
  position: absolute;
  bottom: 4px;
  transform: translateX(var(--dx, 0px));
  font-size: 12px;
  line-height: 14px;
  color: var(--ink);
  white-space: nowrap;
  font-variant-numeric: lining-nums tabular-nums;
}
.mark b { font-weight: 700; letter-spacing: 0.02em; }
.mark::after {
  content: '';
  position: absolute;
  top: calc(100% + 1px);
  left: calc(var(--dx, 0px) * -1 - 0.75px);
  width: 1.5px;
  height: calc(var(--hist-h) + 17px);
  background: var(--ink);
  box-shadow: 0 0 0 0.5px rgba(7, 12, 22, 0.6);
}
.mark.is-range::after { display: none; }
.bench .tk {
  position: absolute;
  top: calc(100% - 2px);
  width: 1.5px;
  height: calc(var(--hist-h) + 16px);
  margin-left: -0.75px;
  background: var(--ink);
  box-shadow: 0 0 0 0.5px rgba(7, 12, 22, 0.6);
}
.hist { display: flex; align-items: flex-end; gap: 1px; height: var(--hist-h); }
.hist i { flex: 1 1 0; display: block; min-width: 0; }
.ramp { display: flex; height: 10px; gap: 1px; margin-top: 2px; }
.ramp i { flex: 1 1 0; display: block; }
.ticks { position: relative; height: 16px; margin-top: 4px; font-size: 12px; line-height: 16px; color: var(--ink-2); font-variant-numeric: lining-nums tabular-nums; }
.ticks span { position: absolute; top: 0; white-space: nowrap; transform: translateX(-50%); }
.ticks span:first-child { transform: none; }
.ticks span.top { left: auto; right: 0; transform: none; color: var(--muted-2); padding-left: 4px; }
.legend-note { margin: 6px 0 0; font-size: 12px; line-height: 16px; color: var(--muted-2); }
.legend-note .bars-k { color: var(--muted-2); }
.legend-note .nd { display: inline-block; vertical-align: -1px; width: 16px; height: 10px; margin: 0 5px 0 2px; background: var(--nodata); box-shadow: 0 0 0 1px rgba(233, 236, 242, 0.25); }

.filter-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: -4px; }
.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 36px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-shadow: var(--halo);
}
.filter-btn span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: underline 1px; text-decoration-color: var(--muted-2); text-underline-offset: 4px; }
.filter-btn:hover span { text-decoration-color: var(--ink); }
.filter-btn svg { flex: none; }
.filter-btn .pill-firm { font-family: var(--serif); font-weight: 400; font-size: 16px; color: var(--firm); }
.clear-btn { text-shadow: var(--halo); }

.drawer {
  flex: 0 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--deck);
  border: 1px solid var(--rule);
  border-radius: 14px;
  animation: drawer-in 220ms var(--ease);
}
@keyframes drawer-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.drawer-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 8px 4px 16px;
}
.drawer-head h2 { margin: 0; font-size: 15px; font-weight: 600; color: var(--ink); }
.icon-x {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted);
}
.icon-x:hover { background: var(--hover); color: var(--ink); }
.drawer-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 16px 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
.fgroup { margin: 0; padding: 0; border: 0; min-width: 0; }
.fgroup + .fgroup { margin-top: 12px; }
.fhead, .fopt {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) 64px 46px;
  column-gap: 9px;
  align-items: baseline;
}
.fhead {
  margin: 0;
  padding: 10px 0 6px;
  border-bottom: 1px solid var(--rule);
  font-size: 12px;
  font-weight: 600;
  line-height: 15px;
  letter-spacing: 0.02em;
  color: var(--muted-2);
}
.fhead > span:first-child { grid-column: 1 / 3; }
.fhead .f-n, .fhead .f-s { text-align: right; font-weight: 500; }
#gDef { display: block; }
.fopt {
  position: relative;
  align-items: center;
  min-height: 32px;
  padding: 4px 0;
  border-bottom: 1px solid var(--rule-2);
  cursor: pointer;
}
.fgroup .fopt:last-child { border-bottom: 0; }
.fopt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.fopt .dot {
  width: 16px; height: 16px;
  border: 1.5px solid var(--rule-3);
  border-radius: 50%;
  transition: border-color 150ms;
}
.fopt input:checked + .dot { border-color: var(--ink); background: radial-gradient(circle, var(--ink) 0 3.5px, transparent 4px); }
.fopt input:focus-visible + .dot { outline: 2px solid var(--ink); outline-offset: 2px; }
.fopt:hover .dot { border-color: var(--muted); }
.fopt .f-name { min-width: 0; font-size: 15px; line-height: 19px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fopt input:checked ~ .f-name { font-weight: 600; }
.fopt .f-n, .fopt .f-s { font-size: 14px; line-height: 19px; color: var(--ink-2); text-align: right; font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.fopt .f-s { color: var(--muted-2); }
.fopt.is-empty .f-name, .fopt.is-empty .f-n, .fopt.is-empty .f-s { opacity: 0.45; }
.fopt:has(input:disabled) { cursor: default; }
.fopt:has(input:disabled) .dot { opacity: 0.45; }
.fopt:has(input:disabled):hover .dot { border-color: var(--rule-3); }
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}
.seg label {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 11px 9px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 150ms, background-color 150ms;
}
.seg label:hover { border-color: var(--rule-3); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label:has(input:checked) { border-color: var(--ink-2); background: var(--hover); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
.seg .seg-t { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink); }
.seg .seg-d { font-size: 12px; line-height: 16px; color: var(--muted-2); }
.seg .seg-v { font-size: 14px; font-weight: 500; color: var(--ink-2); font-variant-numeric: lining-nums tabular-nums; }
.fnote { margin: 10px 0 0; font-size: 12px; line-height: 17px; color: var(--muted-2); }

/* ---------- Hover card: four lines ---------- */
.tip {
  position: absolute;
  z-index: 6;
  top: 0;
  left: 0;
  width: max-content;
  min-width: 210px;
  max-width: 340px;
  padding: 11px 14px 11px;
  background: var(--deck);
  border: 1px solid var(--rule-3);
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(3, 7, 16, 0.45);
  pointer-events: none;
  will-change: transform;
  opacity: 0;
  transition: opacity 110ms linear;
}
.tip.is-shown { opacity: 1; }
.pv-card .h-name { margin: 0; line-height: 22px; }
.pv-card .pv-name { display: inline; font-size: 19px; line-height: 22px; }
.pv-card .pv-sub { display: inline; margin: 0 0 0 4px; font-size: 13px; white-space: nowrap; }
.h-grid { display: grid; grid-template-columns: auto auto; align-items: center; justify-content: space-between; column-gap: 14px; margin-top: 6px; }
.h-tab { border-collapse: collapse; }
.h-tab th { padding: 1px 10px 1px 0; font-size: 13px; line-height: 19px; font-weight: 500; color: var(--muted-2); text-align: left; white-space: nowrap; }
.h-tab td { padding: 1px 0; font-family: var(--serif); font-size: 16px; line-height: 19px; color: var(--ink); text-align: right; white-space: nowrap; }
.h-tab tr + tr > * { border-top: 1px solid var(--rule-2); }
.pv-card .big { font-size: 36px; line-height: 38px; }
.h-top { margin: 5px 0 0; font-size: 13.5px; line-height: 18px; color: var(--ink-2); }
.h-top .h-k { color: var(--muted-2); margin-right: 2px; }
.pv-card .note { margin-top: 5px; font-size: 12px; line-height: 16px; }

/* ---------- Attribution ---------- */
.attrib {
  position: absolute;
  z-index: 4;
  left: calc(var(--edge) - 4px);
  bottom: 3px;
  margin: 0;
  padding: 1px 4px 2px;
  font-size: 11px;
  line-height: 15px;
  color: var(--quiet);
  text-shadow: var(--halo);
}
.attrib a { color: var(--quiet); text-decoration: none; }
.attrib a:hover { color: var(--ink); }
.attrib a + a { margin-left: 4px; }

/* ---------- How we know ---------- */
.how {
  width: min(640px, calc(100vw - 32px));
  max-height: min(86vh, 820px);
  padding: 0;
  border: 1px solid var(--rule-3);
  border-radius: 16px;
  background: var(--deck);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(3, 7, 16, 0.6);
}
.how[open] { display: flex; animation: drawer-in 200ms var(--ease); }
.how::backdrop { background: rgba(6, 10, 20, 0.62); }
.how-in { display: flex; flex-direction: column; min-height: 0; width: 100%; }
.how-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 14px 28px;
  border-bottom: 1px solid var(--rule);
}
.how-head h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 32px; }
.how-body { overflow-y: auto; padding: 4px 28px 28px; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
.how-body h3 { margin: 24px 0 8px; font-size: 13px; font-weight: 600; letter-spacing: 0.02em; color: var(--muted-2); }
.how-body p, .how-body li, .how-body dd { font-family: var(--serif); font-size: 17px; line-height: 1.5; color: var(--ink-2); }
.how-body p { margin: 16px 0 0; }
.how-body .lead { display: block; color: var(--ink); font-size: 19px; }
.how-body dl { margin: 0; }
.how-body dt { margin: 14px 0 2px; font-size: 14px; font-weight: 600; color: var(--ink); }
.how-body dd { margin: 0; }
.how-body ul { margin: 0; padding-left: 18px; }
.how-body li { margin: 0 0 8px; }
.how-body li::marker { color: var(--rule-3); }
.how-body .src li { font-family: var(--sans); font-size: 14px; line-height: 1.5; color: var(--muted); }
.how-body .src a { color: var(--ink); text-decoration: underline 1px; text-decoration-color: var(--muted-2); text-underline-offset: 3px; }
.how-body .figs { display: grid; grid-template-columns: 1fr auto; column-gap: 16px; margin-top: 8px; }
.how-body .figs span { padding: 7px 0 8px; border-bottom: 1px solid var(--rule-2); font-family: var(--serif); font-size: 17px; color: var(--ink-2); }
.how-body .figs span:nth-child(2n) { text-align: right; color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }

/* ---------- Short desktop windows ---------- */
@media (min-width: 641px) and (max-height: 820px) {
  .title { font-size: 30px; }
  .dek { font-size: 16px; }
  .panel { padding-top: 22px; padding-bottom: 20px; }
}

/* ---------- Phone: the search on top, the story and the details in a sheet at the bottom ---------- */
.sheet { display: none; }
@media (max-width: 640px) {
  :root { --edge: 12px; --hist-h: 0px; }
  .panel {
    top: 0; left: 0; right: 0;
    width: auto;
    max-height: none;
    overflow: visible;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "word modes" "search search";
    align-items: center;
    column-gap: 12px;
    padding: calc(10px + env(safe-area-inset-top)) 16px 6px;
    border-width: 0 0 1px;
    border-radius: 0 0 14px 14px;
  }
  .panel::after { display: none; }
  .wordmark { grid-area: word; font-size: 17px; line-height: 20px; }
  .modes { grid-area: modes; margin: 0; padding: 2px; }
  .mode { height: 30px; padding: 0 11px; font-size: 13.5px; }
  .search { grid-area: search; margin-top: 4px; }
  .search-field { height: 44px; }
  .search input { font-size: 19px; }
  .sugg { left: -6px; right: -6px; top: 48px; }

  .sheet {
    display: block;
    position: fixed;
    z-index: 4;
    left: 0; right: 0; bottom: 0;
    max-height: 56vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--deck);
    border-top: 1px solid var(--rule);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 24px rgba(3, 7, 16, 0.35);
  }
  .sheet-grip { width: 36px; height: 4px; margin: 0 auto 6px; border-radius: 2px; background: var(--rule-3); }
  .sheet .title { margin: 0; font-size: 21px; line-height: 1.15; }
  .sheet .dek { margin-top: 5px; font-size: 15px; line-height: 1.4; }
  .sheet .intro { display: block; }
  .more-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 40px;
    margin: 4px 0 0;
    padding: 2px 0;
    border: 0;
    border-top: 1px solid var(--rule-2);
    background: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
  }
  .more-toggle::after {
    content: '';
    width: 7px; height: 7px;
    margin-right: 4px;
    border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
    transform: translateY(-2px) rotate(-135deg);
    transition: transform 200ms var(--ease);
  }
  .more-toggle[aria-expanded="true"]::after { transform: translateY(2px) rotate(45deg); }
  .more { display: none; padding-bottom: 4px; }
  .sheet.is-more .more, .sheet.is-pinned .more { display: block; }
  .sheet.is-pinned .intro, .sheet.is-pinned .more-toggle { display: none; }
  .sheet.is-pinned .sources > p:not(.franchise) { display: none; }
  .sheet.is-pinned .place { margin-top: 2px; }
  .sheet.is-pinned { max-height: 50vh; }
  body.is-pinned-phone .dock { display: none; }
  body.is-pinned-phone .attrib { bottom: calc(var(--sheet-h) + 3px); }
  .sheet .pv-name { font-size: 23px; }
  .summary { margin-top: 8px; }
  .filter-note { margin-top: 8px; margin-bottom: 0; }
  .thead, .trow { grid-template-columns: minmax(0, 1fr) 84px 56px; }

  .dock {
    top: auto;
    left: var(--edge);
    right: var(--edge);
    bottom: calc(var(--sheet-h) + 22px);
    width: auto;
    max-height: calc(100% - var(--sheet-h) - 150px);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "drawer" "legend";
    align-content: end;
    gap: 8px;
  }
  .dock > .zoom { display: none; }
  .drawer { grid-area: drawer; }
  .legend { grid-area: legend; }
  .filter-row { grid-area: legend; justify-self: end; align-self: start; margin: -6px 0 0; }
  .scale { margin-top: 8px; }
  .hist { display: none; }
  .legend-title { font-size: 12.5px; line-height: 16px; padding-right: 76px; }
  .bench { height: 17px; }
  .mark { font-size: 12px; bottom: 3px; }
  .mark::after { height: 16px; }
  .bench .tk { height: 15px; }
  .ticks { font-size: 12px; }
  .legend-note { display: none; }
  .filter-btn { font-size: 13.5px; min-height: 28px; }
  .clear-btn { display: none; }
  .drawer-body { max-height: calc(100vh - var(--sheet-h) - 260px); }
  .attrib { left: auto; right: 8px; bottom: calc(var(--sheet-h) + 3px); font-size: 11px; line-height: 14px; }
  .legend::before { left: -12px; right: -12px; top: -18px; bottom: -24px; -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 18px); mask-image: linear-gradient(to bottom, transparent 0, #000 18px); }
  .lbl-key { font-size: 11px; line-height: 13px; }
  .lbl-boro { font-size: 10.5px; }
  .lbl-boro .lbl-num { font-size: 13.5px; }
  .lbl-boro .lbl-sub { font-size: 11px; line-height: 13px; }
  .tip { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}
