:root {
  --bg: #ffffff;
  --text: #1b2033;
  --muted: #5f6578;
  --line: rgba(0, 0, 0, 0.12);
  --accent: #2f55c4;
  --hover: rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.45 "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#map { position: absolute; inset: 0; }
button { font: inherit; color: inherit; cursor: pointer; }

/* Title block, top left, like censusdots */
#title { position: absolute; top: 10px; left: 14px; max-width: calc(100% - 80px); pointer-events: none; }
#title > * { pointer-events: auto; }
h1 { font-size: 36px; font-weight: 700; margin: 0; line-height: 1.1; letter-spacing: -0.01em;
  display: inline-block; background: rgba(255,255,255,.4); padding: 2px 0; border-radius: 6px; white-space: nowrap; }

#legend { list-style: none; padding: 0; margin: 6px 0 8px; }
#legend li { display: flex; align-items: center; gap: 10px; padding: 1px 6px; margin: 0 -6px; border-radius: 6px;
  font-size: 17px; cursor: pointer; user-select: none; }
#legend li:hover { background: var(--hover); }
#legend li.off { opacity: .35; }
#legend.locked li { cursor: default; }
#legend.locked li:hover { background: none; }
#legend .sw { width: 8px; height: 8px; border-radius: 50%; flex: none; }
#legend .pct { margin-left: auto; font-size: 12.5px; color: var(--muted); }

#search { margin-top: 6px; position: relative; width: 230px; max-width: 100%; }
#search input { width: 100%; box-sizing: border-box; max-width: 100%; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: rgba(255,255,255,.95); color: var(--text); font: inherit; font-size: 14px; box-shadow: var(--shadow); }
#search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
#suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5; margin: 0; padding: 4px 0; list-style: none;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); font-size: 14px; }
#suggest li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 12px; cursor: pointer; }
#suggest li span { color: var(--muted); font-size: 12.5px; }
#suggest li.on, #suggest li:hover { background: var(--hover); }

/* Bottom-right buttons */
#actions { position: absolute; right: 22px; bottom: 26px; display: flex; gap: 14px; }
#tipwrap { position: absolute; left: 24px; bottom: 26px; }
#actions button { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px 18px;
  font-size: 18px; box-shadow: var(--shadow); }
#actions button:hover, #tip:hover { background: #f5f6f8; }
#tip { display: inline-block; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px 18px;
  font-size: 18px; box-shadow: var(--shadow); color: inherit; text-decoration: none; }

/* Place profile panel, left side (like censusdots' "Georgia Demographics") */
#picked { position: absolute; left: 24px; top: 118px; bottom: 80px; width: 330px; max-width: calc(100% - 48px);
  overflow: auto; background: #fbfbfc; border-radius: 4px; box-shadow: 0 2px 10px rgba(0,0,0,.18);
  padding: 22px 22px 16px; z-index: 4; }
#picked[hidden] { display: none; }
#picked h2 { font-size: 27px; line-height: 1.1; margin: 0 24px 8px 0; font-weight: 700; }
.nowrap { white-space: nowrap; }
.kicker { text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-size: 12.5px; margin: 0 0 16px; }
#picked table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; margin-bottom: 8px; }
#picked th { text-align: left; font-weight: 600; padding: 7px 6px; border-bottom: 1px solid var(--line); }
#picked td { padding: 6px; border-bottom: 1px solid rgba(0,0,0,.05); font-variant-numeric: tabular-nums; }
#picked th:not(:first-child), #picked td:not(:first-child) { text-align: right; }
#picked .sw { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
#picked .muted { color: var(--muted); }
#picked p { font-size: 13.5px; margin: 12px 0; }
#picked .parents a { color: var(--accent); text-decoration: none; }
#picked .parents a:hover { text-decoration: underline; }
#picked .source { font-style: italic; max-width: none; }
.x { position: absolute; top: 8px; right: 10px; background: none; border: 0; font-size: 22px; line-height: 1; color: var(--muted); }
.mini { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: rgba(0,0,0,.05); }
.mini span { display: block; height: 100%; }

/* Bottom-right popovers (share, legend) */
.pop { position: absolute; right: 22px; bottom: 82px; background: #fff; border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0,0,0,.2); padding: 18px 22px 16px; z-index: 5; }
.pop[hidden] { display: none; }
.pop-title { font-size: 19px; margin: 0 22px 2px 0; }
.pop .lede { margin: 0; color: var(--muted); font-size: 16px; }
.source { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; max-width: 300px; }
.source a { color: var(--accent); }
.sources { font-style: italic; line-height: 1.5; font-size: 13.5px; }
.sources a { color: #4a52d8; text-decoration: none; }
.sources a:hover { text-decoration: underline; }
#about { width: 330px; }
#sharePanel { right: 380px; width: 550px; max-width: calc(100% - 44px); }
#sharePanel label { display: block; color: var(--muted); font-size: 17px; margin: 14px 0 6px; }
.copyrow { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 4px; padding: 0 12px 0 0; }
.copyrow input { flex: 1; min-width: 0; border: 0; padding: 12px 14px; font: inherit; font-size: 17px; color: var(--text); background: none; }
.copyrow input:focus { outline: none; }
.copyrow button { background: none; border: 0; font-weight: 700; font-size: 17px; }

.toast { position: absolute; right: 22px; bottom: 80px; background: #1b2033; color: #fff; padding: 6px 12px;
  border-radius: 6px; font-size: 14px; }

@media (max-width: 600px) {
  h1 { font-size: 30px; }
  #legend li { font-size: 12.5px; padding: 2px 6px; }
  #actions { right: 12px; bottom: 30px; gap: 8px; }
  #actions button, #tip { font-size: 15px; padding: 6px 12px; }
  #tipwrap { left: 12px; bottom: 30px; }
  #picked { top: auto; bottom: 76px; max-height: 55%; left: 12px; right: 12px; width: auto; }
  .pop, #sharePanel { right: 12px; left: 12px; width: auto; bottom: 76px; }
}

#about .pct { display: none; }
