/* Layout: the map is the page. A slim top bar (search, issue button, path) floats over it.
   Phone: a bottom sheet with the place's numbers, tap or swipe to expand. Wide screens: the sheet becomes a right-hand column. */
:root {
  /* Night city: one dark look on every device. Brighter = higher number. */
  --sea: #04070d;
  --bg: rgba(120, 170, 230, .07);
  --surface: rgba(12, 19, 33, .78);
  --solid: #0b1220;
  --ink: #e8f3ff;
  --muted: #8d9db5;
  --line: rgba(150, 185, 230, .14);
  --accent: #3ad6ff;
  --on-accent: #03121b;
  --land-nodata: #0f1625;
  --hatch: #1b2638;
  --border: rgba(3, 6, 12, .85);
  --county: #5fb4d6;
  --glass: blur(14px) saturate(140%);
  --shadow: 0 0 0 1px rgba(140, 190, 255, .10), 0 10px 30px rgba(0, 0, 0, .5);
  --r0: #1b1f4a; --r1: #23407a; --r2: #1f6aa0; --r3: #1d97be; --r4: #3cc8dc; --r5: #b2f7f2;
  --sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --numf: "Space Grotesk", "Noto Sans TC", system-ui, sans-serif;
  --sheet-peek-px: 132px; /* how much of the phone panel shows when collapsed */
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; }
body { background: var(--sea); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.55; overflow: hidden; }
button { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; font-family: var(--numf); }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
/* map shapes never show the browser focus ring; the glowing outline marks the pick */
#map, #map *, #map:focus, #map *:focus { outline: none; }

.app { position: relative; height: 100%; display: grid; grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr); }
.stage, .sheet { min-height: 0; }
.stage { position: relative; overflow: hidden; height: 100%; touch-action: none;
  background: radial-gradient(circle at 50% 40%, rgba(40, 90, 150, .16), transparent 65%), radial-gradient(rgba(120, 170, 230, .10) 1px, transparent 1.2px) 0 0 / 22px 22px, var(--sea); }
/* street map tiles sit under the colors */
#tiles { position: absolute; inset: 0; z-index: 0; isolation: isolate; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .3s;
  filter: invert(1) hue-rotate(180deg) brightness(.7) contrast(.9) saturate(.45); }
#map { z-index: 1; }
#roads { position: absolute; inset: 0; z-index: 2; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .3s;
  filter: invert(1) hue-rotate(180deg) brightness(1.15) saturate(.4) drop-shadow(0 0 1px rgba(0,0,0,.9)); }
#roads img { position: absolute; left: 0; top: 0; user-select: none; max-width: none; }
#lblsvg { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; pointer-events: none; }
#tiles img { position: absolute; left: 0; top: 0; transform-origin: 0 0; user-select: none; max-width: none; }
.attr { position: absolute; z-index: 3; right: max(8px, env(safe-area-inset-right, 0px)); font-size: 10px; color: var(--muted); opacity: .8; pointer-events: auto; }
.attr a { color: inherit; }
.attr[hidden] { display: none; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
#map:active { cursor: grabbing; }

/* map styling */
.town { stroke: var(--border); stroke-width: .5; vector-effect: non-scaling-stroke; transition: fill .45s ease; cursor: pointer; fill-opacity: var(--fo, 1); }
.town.nodata { fill: url(#hatch); }
.town:hover { stroke: var(--accent); stroke-width: 1.5; }
.vill { stroke: var(--border); stroke-width: .4; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill .45s ease; fill-opacity: var(--fo, 1); }
.vill.nodata { fill: url(#hatch); }
.vill:hover { stroke: var(--accent); stroke-width: 1.5; }
#villages.off, #townlines.off { display: none; }
.town-line { fill: none; stroke: var(--county); stroke-opacity: .7; stroke-width: 1.4; vector-effect: non-scaling-stroke; pointer-events: none; }
.lbl.vill-l { font-size: 11.5px; fill: #eef7ff; stroke: rgba(3,6,12,.8); stroke-width: 3px; }
.lbl.vill-l.on-light { fill: #03121b; stroke: rgba(220,255,255,.55); }
.lbl.vill-l .v { font-weight: 500; font-size: 10.5px; }
.lbl.town-big { font-size: 15px; fill: var(--ink); stroke: var(--sea); stroke-width: 4px; opacity: .9; }
.county-line { fill: none; stroke: var(--county); stroke-opacity: .45; stroke-width: 1; vector-effect: non-scaling-stroke; pointer-events: none; }
.county-line.focus { stroke-opacity: 1; stroke-width: 2; filter: drop-shadow(0 0 3px var(--accent)); }
.sel-line { fill: none; stroke: var(--accent); stroke-width: 2.5; filter: drop-shadow(0 0 4px var(--accent)) drop-shadow(0 0 10px rgba(58,214,255,.6)); vector-effect: non-scaling-stroke; pointer-events: none; }
.inset-box { fill: none; stroke: var(--county); stroke-opacity: .35; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.lbl { font-family: var(--sans); font-weight: 700; pointer-events: none; paint-order: stroke; stroke-linejoin: round; text-anchor: middle; dominant-baseline: middle; }
.lbl.county { font-size: 13px; fill: var(--ink); stroke: var(--sea); stroke-width: 3.5px; letter-spacing: .08em; }
.lbl.town-l { font-size: 12px; fill: #eef7ff; stroke: rgba(3,6,12,.8); stroke-width: 3px; }
.lbl.town-l.on-light { fill: #03121b; stroke: rgba(220,255,255,.55); }
.lbl.town-l .v, .lbl.vill-l .v { font-family: var(--numf); font-weight: 500; font-size: 10.5px; }

/* top bar */
.top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5; pointer-events: none;
  padding-top: 12px;
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 8px;
}
.top > * { pointer-events: auto; }
.bar { display: flex; gap: 8px; align-items: center; position: relative; z-index: 2; } /* above the topic button, so search results drop over it */
.brand {
  font-weight: 900; font-size: 16px; letter-spacing: .1em; white-space: nowrap;
  background: var(--surface); backdrop-filter: var(--glass); -webkit-backdrop-filter: var(--glass); border-radius: 12px; padding: 0 12px; height: 44px; display: flex; align-items: center; box-shadow: var(--shadow);
}
.brand small { font-family: var(--sans); font-size: 10px; font-weight: 700; color: var(--accent); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; margin-left: 6px; letter-spacing: .05em; }
.search { position: relative; flex: 1; min-width: 0; }
.search input {
  width: 100%; height: 44px; border: 0; border-radius: 12px; padding: 0 14px 0 38px; font: inherit; font-size: 16px;
  background: var(--surface); backdrop-filter: var(--glass); -webkit-backdrop-filter: var(--glass); color: var(--ink); box-shadow: var(--shadow);
}
.search input:focus { outline: none; box-shadow: 0 0 0 1px var(--accent), 0 0 18px rgba(58,214,255,.25); }
.search input::placeholder { color: var(--muted); }
.search svg { position: absolute; z-index: 1; left: 12px; top: 13px; width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 2; }
.results {
  position: absolute; z-index: 2; top: 50px; left: 0; right: 0; background: var(--solid); border-radius: 12px; box-shadow: var(--shadow);
  overflow: hidden; max-height: 50vh; overflow-y: auto;
}
.results button { display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: left; border: 0; background: none; padding: 11px 14px; cursor: pointer; border-top: 1px solid var(--line); }
.results button:first-child { border-top: 0; }
.results button:hover, .results button.hi { background: var(--bg); }
.results span:last-child { color: var(--muted); font-size: 13px; }

/* issue picker: one button in the top bar, a slide-out menu with every issue */
.issue-btn {
  align-self: flex-start; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 10px; border-radius: 12px; cursor: pointer; max-width: 100%;
  border: 1px solid rgba(58,214,255,.45); background: var(--surface); backdrop-filter: var(--glass); -webkit-backdrop-filter: var(--glass); box-shadow: var(--shadow), 0 0 14px rgba(58,214,255,.18);
}
.issue-btn svg { width: 18px; height: 18px; stroke: var(--accent); fill: none; stroke-width: 2; flex: none; }
.issue-btn .k { font-size: 11px; color: var(--accent); letter-spacing: .1em; }
.issue-btn b { font-weight: 700; white-space: nowrap; }
.issue-btn small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.issue-btn .chev { color: var(--muted); font-size: 12px; }
.drawer { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.drawer.open { pointer-events: auto; }
.drawer .shade { position: absolute; inset: 0; background: rgba(2,5,10,.55); opacity: 0; transition: opacity .25s; }
.drawer.open .shade { opacity: 1; }
.drawer .panel {
  position: absolute; top: 0; bottom: 0; left: 0; width: min(88vw, 360px); display: flex; flex-direction: column;
  background: rgba(10,16,28,.92); backdrop-filter: var(--glass); -webkit-backdrop-filter: var(--glass);
  box-shadow: 1px 0 0 rgba(140,190,255,.14), 20px 0 50px rgba(0,0,0,.5);
  transform: translateX(-102%); transition: transform .3s cubic-bezier(.2,.8,.2,1);
  padding-top: env(safe-area-inset-top, 0px); padding-left: env(safe-area-inset-left, 0px);
}
.drawer.open .panel { transform: none; }
@media (prefers-reduced-motion: reduce) { .drawer .panel, .drawer .shade { transition: none; } }
.drawer header { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 6px 18px; }
.drawer header h2 { font-size: 18px; letter-spacing: .08em; }
.drawer header button { width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--bg); cursor: pointer; font-size: 18px; }
.drawer .list { overflow-y: auto; flex: 1; padding: 4px 10px 24px; overscroll-behavior: contain; }
.drawer .grp { font-size: 11px; color: var(--accent); letter-spacing: .14em; padding: 14px 8px 6px; }
.opt { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; width: 100%; text-align: left; border: 0; background: none; border-radius: 12px; padding: 10px 10px; cursor: pointer; }
.opt:hover { background: var(--bg); }
.opt .n { font-weight: 700; font-size: 15px; }
.opt .tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; align-self: center; white-space: nowrap; }
.opt .m { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
.opt[aria-current="true"] { background: rgba(58,214,255,.12); box-shadow: inset 0 0 0 1px rgba(58,214,255,.5); }
.opt[aria-current="true"] .n { color: var(--accent); }
.legend .cat { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--ink); }
.legend .cat i, .pill .dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: 0; }
.vbars { display: flex; flex-direction: column; gap: 8px; }
.vb { display: grid; grid-template-columns: 6.5rem 1fr 3.4rem; gap: 8px; align-items: center; font-size: 14px; }
.vb .nm small { color: var(--muted); font-size: 11px; margin-left: 4px; }
.vb.win .nm { font-weight: 700; }
.vb .track { height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.vb .track span { display: block; height: 100%; border-radius: 5px; }
.vb .v { text-align: right; font-weight: 700; font-family: var(--numf); }

.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-size: 13px; }
.crumbs button { border: 0; background: var(--surface); backdrop-filter: var(--glass); -webkit-backdrop-filter: var(--glass); box-shadow: var(--shadow); border-radius: 999px; padding: 4px 12px; cursor: pointer; }
.crumbs button[aria-current="true"] { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.crumbs i { font-style: normal; color: var(--muted); padding: 0 2px; }

/* zoom buttons and legend */
.ctrls {
  position: absolute; z-index: 4; right: max(12px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column;
  background: var(--surface); backdrop-filter: var(--glass); -webkit-backdrop-filter: var(--glass); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden;
}
.ctrls button.st { font-size: 12px; font-weight: 700; color: var(--muted); }
.ctrls button.st[aria-pressed="true"] { color: var(--accent); }
.ctrls button { width: 44px; height: 44px; border: 0; background: none; cursor: pointer; font-size: 20px; line-height: 1; }
.ctrls button + button { border-top: 1px solid var(--line); }
.ctrls button.tw { font-size: 12px; font-weight: 700; }
.legend {
  position: absolute; z-index: 4; left: max(12px, env(safe-area-inset-left, 0px)); background: var(--surface); backdrop-filter: var(--glass); -webkit-backdrop-filter: var(--glass); border-radius: 12px; box-shadow: var(--shadow);
  padding: 8px 12px; font-size: 12px; color: var(--muted); width: min(240px, 60vw); display: flex; flex-direction: column; gap: 4px;
}
.legend b { color: var(--ink); font-weight: 700; font-size: 12px; }
@media (max-width: 899px) { .legend { width: min(200px, 52vw); padding: 6px 10px; } .legend b, .legend .hint { display: none; } }
.ramp { display: flex; height: 8px; border-radius: 4px; overflow: hidden; box-shadow: 0 0 12px rgba(58,214,255,.2); }
.ramp span { flex: 1; }
.ramp-l { display: flex; justify-content: space-between; }
.legend .nd { display: flex; align-items: center; gap: 6px; }
.legend .nd svg { width: 14px; height: 10px; border-radius: 2px; }

.tip {
  position: absolute; z-index: 6; pointer-events: none; background: var(--solid); color: var(--ink); box-shadow: var(--shadow); border-radius: 8px; padding: 6px 10px; font-size: 13px;
  transform: translate(-50%, calc(-100% - 12px)); white-space: nowrap;
}
.tip b { font-weight: 700; }

/* sheet */
.sheet {
  position: absolute; z-index: 7; left: 0; right: 0; bottom: 0; height: 86%;
  background: var(--surface); backdrop-filter: var(--glass); -webkit-backdrop-filter: var(--glass); border-radius: 18px 18px 0 0; box-shadow: 0 0 0 1px rgba(140,190,255,.10), 0 -10px 40px rgba(0,0,0,.55);
  transform: translateY(calc(100% - var(--sheet-peek-px) - env(safe-area-inset-bottom, 0px))); transition: transform .35s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column;
}
.sheet.open { transform: translateY(0); }
.handle { flex: none; height: 26px; border: 0; background: none; cursor: pointer; display: flex; align-items: center; justify-content: center; width: 100%; touch-action: none; }
.handle::before { content: ""; width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet-body {
  overflow-y: auto; flex: 1; min-height: 0; overscroll-behavior: contain;
  padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px));
  padding-block: 0 24px;
  display: flex; flex-direction: column; gap: 18px;
}
@media (prefers-reduced-motion: reduce) { .sheet, .town { transition: none; } }

@media (min-width: 900px) {
  .app { grid-template-columns: 1fr 400px; }
  .sheet { position: relative; transform: none; height: 100%; border-radius: 0; background: var(--solid); box-shadow: -1px 0 0 rgba(140,190,255,.12); grid-column: 2; grid-row: 1; padding-top: env(safe-area-inset-top, 0px); }
  .handle { display: none; }
  .sheet-body { padding-top: 24px; }
  .stage { grid-column: 1; grid-row: 1; }
  .top { max-width: 640px; }
}

/* sheet content */
.place { display: flex; flex-direction: column; gap: 2px; }
.place .eyebrow { font-size: 12px; color: var(--accent); letter-spacing: .14em; }
.place h2 { font-weight: 900; font-size: 30px; letter-spacing: .04em; }
.hero { display: flex; flex-direction: column; gap: 6px; }
.hero .measure { font-size: 13px; color: var(--muted); }
.hero .big { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.hero .big strong { font-family: var(--numf); font-size: 48px; font-weight: 700; color: var(--topic, var(--accent)); text-shadow: 0 0 24px color-mix(in srgb, var(--topic, var(--accent)) 35%, transparent); line-height: 1; letter-spacing: -.01em; }
.hero .big span { color: var(--muted); font-size: 14px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { font-size: 13px; border-radius: 999px; padding: 3px 10px; background: var(--bg); border: 1px solid var(--line); }
.pill.hot { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.pill.up { color: var(--accent); border-color: currentColor; background: none; }
.strip-wrap { position: relative; padding-top: 20px; }
.strip { width: 100%; height: 40px; display: block; }
.strip-me { position: absolute; top: 0; transform: translateX(-50%); font-size: 12px; font-weight: 700; white-space: nowrap; }
.strip-l { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.src { font-size: 12.5px; color: var(--muted); }
.src a { color: var(--muted); }
.card-note { font-size: 13px; color: var(--muted); background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.empty { display: flex; flex-direction: column; gap: 10px; background: var(--bg); border-radius: 12px; padding: 14px; }
.empty strong { font-size: 16px; }
.btn { align-self: flex-start; border: 0; border-radius: 999px; background: var(--accent); color: var(--on-accent); padding: 8px 16px; cursor: pointer; font-weight: 700; }

.sec h3 { font-size: 15px; margin-bottom: 6px; }
.rows { display: flex; flex-direction: column; }
.row {
  display: grid; grid-template-columns: 1.6rem minmax(0, 6.5rem) 1fr 3.8rem; gap: 8px; align-items: center; min-height: 38px;
  border: 0; background: none; text-align: left; padding: 0 6px; border-radius: 8px; cursor: pointer; width: 100%;
}
.row:hover { background: var(--bg); }
.row.sel { box-shadow: inset 0 0 0 1.5px var(--accent); }
.row .rk { color: var(--muted); font-size: 12px; text-align: right; }
.row .nm { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .nm small { color: var(--muted); font-weight: 400; font-size: 11px; margin-left: 2px; }
.row .bar { height: 12px; border-radius: 2px; min-width: 2px; }
.row .v { text-align: right; font-weight: 700; font-size: 14px; font-family: var(--numf); }

.issues { display: flex; flex-direction: column; }
.iss { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; align-items: baseline; border: 0; border-top: 1px solid var(--line); background: none; padding: 10px 2px; text-align: left; cursor: pointer; width: 100%; }
.iss .n { font-weight: 700; }
.iss .n::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; background: var(--sw, var(--land-nodata)); vertical-align: -1px; }
.iss .r { font-weight: 700; text-align: right; }
.iss .s { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); padding-left: 18px; }
.iss.on { background: var(--bg); border-radius: 8px; }

.how { font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }
.how summary { cursor: pointer; color: var(--ink); font-weight: 700; font-size: 14px; }
.how ul { margin: 8px 0 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; }
.how a { color: var(--accent); }

.loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; }

/* share button and its message */
.ctrls button.sh { color: var(--ink); }
.toast {
  position: absolute; z-index: 9; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: min(90vw, 360px); text-align: center;
  background: var(--solid); color: var(--ink); border-radius: 12px; padding: 10px 16px; font-size: 14px; box-shadow: var(--shadow), 0 0 20px rgba(58,214,255,.25);
}
/* text written into the page for search engines; the app replaces it */
.seo h2 { font-size: 28px; font-weight: 900; }
/* the quick summary that is in the page itself (for search engines that read the page text).
   People see the place name and a calm loading placeholder until the app draws the real panel. */
ul.seo, nav.seo { display: none; }
.seo.place::after {
  content: ""; display: block; height: 220px; margin-top: 18px; border-radius: 12px;
  background:
    linear-gradient(var(--bg), var(--bg)) 0 0 / 55% 44px no-repeat,
    linear-gradient(var(--bg), var(--bg)) 0 60px / 100% 14px no-repeat,
    linear-gradient(var(--bg), var(--bg)) 0 86px / 80% 14px no-repeat,
    linear-gradient(var(--bg), var(--bg)) 0 130px / 100% 36px no-repeat,
    linear-gradient(var(--bg), var(--bg)) 0 180px / 100% 36px no-repeat;
  animation: seoPulse 1.4s ease-in-out infinite alternate;
}
@keyframes seoPulse { from { opacity: .45; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .seo.place::after { animation: none; } }
.seo b { color: var(--ink); }
/* preview image mode (?og=1): just the map and a title, used to make og.png */
.og-title { display: none; }
.og-mode .top, .og-mode .ctrls, .og-mode .legend, .og-mode .sheet, .og-mode .attr { display: none !important; }
.og-mode .app { grid-template-columns: 1fr !important; }
.og-mode .og-title { display: flex; flex-direction: column; gap: 6px; position: absolute; z-index: 5; left: 64px; top: 50%; transform: translateY(-50%); }
.og-mode .og-title b { font-size: 64px; font-weight: 900; letter-spacing: .08em; color: var(--ink); text-shadow: 0 0 30px rgba(58,214,255,.4); }
.og-mode .og-title span { font-size: 28px; color: var(--accent); letter-spacing: .1em; }

/* 2026 candidate guide */
.cands { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cands li { display: grid; grid-template-columns: 2rem 2.6rem 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--bg); }
.cands .no { width: 2rem; height: 2rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; border: 1.5px solid var(--accent); color: var(--accent); }
.cands .nm { font-weight: 700; font-size: 16px; word-break: break-all; }
.cands .nm em { font-style: normal; font-size: 11px; font-weight: 500; color: var(--on-accent); background: var(--accent); border-radius: 999px; padding: 1px 7px; margin-left: 6px; vertical-align: 2px; }
.cands .pt { font-size: 13px; color: var(--muted); white-space: nowrap; }
.ctx { margin: 0; padding-left: 1.1em; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.ctx b { color: var(--ink); font-weight: 500; }
/* name badge: first character on the party color, same for every candidate */
.cands .av {
  width: 2.6rem; height: 2.6rem; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 900; color: #03121b; background: var(--pc);
  box-shadow: 0 0 0 2px rgba(4,7,13,.9), 0 0 0 3px var(--pc), 0 0 14px color-mix(in srgb, var(--pc) 45%, transparent);
}
.cands .no { width: 1.8rem; height: 1.8rem; font-size: 14px; }

/* MapLibre map */
#map { position: absolute; inset: 0; background: var(--sea); }
#map canvas { outline: none; }
.maplibregl-ctrl-attrib, .maplibregl-ctrl-attrib.maplibregl-compact { background: rgba(4,7,13,.7) !important; color: var(--muted); font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--muted) !important; }
.maplibregl-ctrl-attrib-button { filter: invert(1) opacity(.6); }
.maplibregl-ctrl-bottom-right { bottom: env(safe-area-inset-bottom, 0px); }
.ctrls button.d3 { font-size: 13px; font-weight: 900; color: var(--accent); letter-spacing: .04em; }
.crumbs button[data-jump] { font-size: 12px; padding: 3px 10px; color: var(--muted); }

.loading { z-index: 2; }

/* topic colors: a dot in the menu and on the issue button, matching each group's map colors */
.opt .tdot, .issue-btn .tdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; background: var(--tc, var(--topic, var(--accent))); box-shadow: 0 0 8px var(--tc, var(--topic, var(--accent))); }
.opt[aria-current="true"] .n { color: var(--tc, var(--accent)); }
.opt[aria-current="true"] { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tc, var(--accent)) 60%, transparent); background: color-mix(in srgb, var(--tc, var(--accent)) 12%, transparent); }
.issue-btn { border-color: color-mix(in srgb, var(--topic, var(--accent)) 55%, transparent); }
.legend .ramp { box-shadow: 0 0 12px color-mix(in srgb, var(--topic, var(--accent)) 25%, transparent); }

/* ---------- small motions ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* panel content rises in, one piece after another */
  .sheet-body.enter > * { animation: rise .42s cubic-bezier(.2,.8,.2,1) both; }
  .sheet-body.enter > *:nth-child(2) { animation-delay: .04s; }
  .sheet-body.enter > *:nth-child(3) { animation-delay: .08s; }
  .sheet-body.enter > *:nth-child(4) { animation-delay: .12s; }
  .sheet-body.enter > *:nth-child(5) { animation-delay: .16s; }
  .sheet-body.enter > *:nth-child(n+6) { animation-delay: .2s; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

  /* ranking bars and vote bars grow from the left */
  .sheet-body.enter .row .bar, .sheet-body.enter .vb .track span { transform-origin: left center; animation: grow .7s cubic-bezier(.2,.8,.2,1) both; }
  .sheet-body.enter .row:nth-child(n+2) .bar { animation-delay: .05s; }
  .sheet-body.enter .row:nth-child(n+4) .bar { animation-delay: .1s; }
  .sheet-body.enter .row:nth-child(n+7) .bar { animation-delay: .15s; }
  @keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

  /* the distribution strip fades in */
  .sheet-body.enter .strip rect { animation: fadein .6s ease both; }
  @keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

  /* menu items slide in when the menu opens */
  .drawer.open .opt, .drawer.open .grp { animation: slidein .36s cubic-bezier(.2,.8,.2,1) both; }
  .drawer.open .list > :nth-child(-n+6) { animation-delay: .03s; }
  .drawer.open .list > :nth-child(n+7) { animation-delay: .07s; }
  @keyframes slidein { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }

  /* the topic dot breathes slowly */
  .issue-btn .tdot { animation: breathe 3.2s ease-in-out infinite; }
  @keyframes breathe { 0%, 100% { box-shadow: 0 0 6px var(--topic, var(--accent)); } 50% { box-shadow: 0 0 14px var(--topic, var(--accent)); } }

  /* buttons lift a little on hover and press down when tapped */
  .opt, .row, .iss, .chip, .crumbs button, .ctrls button, .issue-btn, .btn { transition: transform .15s ease, background-color .2s ease, box-shadow .2s ease; }
  .opt:hover, .row:hover, .iss:hover { transform: translateX(2px); }
  .issue-btn:hover, .crumbs button:hover { transform: translateY(-1px); }
  .opt:active, .row:active, .iss:active, .crumbs button:active, .ctrls button:active, .issue-btn:active, .btn:active { transform: scale(.97); }

  /* the share message pops in */
  .toast:not([hidden]) { animation: pop .28s cubic-bezier(.2,.9,.3,1.3) both; }
  @keyframes pop { from { opacity: 0; transform: translate(-50%, -40%) scale(.94); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

  /* the tooltip follows smoothly */
  .tip { transition: left .08s linear, top .08s linear; }
}

/* phone panel: no scrolling while it is collapsed; swiping on it pulls it open */
@media (max-width: 899px) {
  .sheet:not(.open) .sheet-body { overflow: hidden; touch-action: none; }
  .sheet:not(.open) { touch-action: none; }
  .sheet.open .sheet-body { touch-action: pan-y; }
}

/* phone panel, collapsed: a compact strip with the place, the topic and the main number */
@media (max-width: 899px) {
  .place h2, .hero .big strong, .place .eyebrow, .hero .measure { transition: font-size .3s cubic-bezier(.2,.8,.2,1); }
  .sheet:not(.open) .sheet-body { gap: 4px; padding-top: 0; }
  .sheet:not(.open) .place { flex-direction: row; align-items: baseline; gap: 8px; }
  .sheet:not(.open) .place .eyebrow { font-size: 11px; order: 2; }
  .sheet:not(.open) .place h2 { font-size: 19px; }
  .sheet:not(.open) .hero { gap: 2px; }
  .sheet:not(.open) .hero .measure { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sheet:not(.open) .hero .big strong { font-size: 30px; }
  .sheet:not(.open) .hero .big span { font-size: 12px; }
  .sheet:not(.open) .hero .pills, .sheet:not(.open) .hero > p { display: none; }
  .sheet:not(.open) .handle { height: 20px; }
  /* everything below the main number waits until the panel opens */
  .sheet:not(.open) .sheet-body > :nth-child(n+3) { visibility: hidden; }
  /* open: roomier, with a bigger main number */
  .sheet.open .hero .big strong { font-size: 56px; }
  .sheet.open .place h2 { font-size: 32px; }
}

/* ---------- embed mode (?embed=1): only the map, the legend, a place card and a credit ---------- */
.embed-card, .embed-credit { display: none; }
.embed-mode .top, .embed-mode .sheet, .embed-mode #share, .embed-mode #embedBtn, .embed-mode #ztw, .embed-mode #zst, .embed-mode .og-title { display: none !important; }
.embed-mode .app { grid-template-columns: 1fr !important; }
.embed-mode.embed-topics .top { display: flex !important; }
.embed-mode.embed-topics .top .bar, .embed-mode.embed-topics .crumbs { display: none !important; }
.embed-mode .legend { top: auto !important; bottom: 10px; }
.embed-mode .embed-credit {
  display: block; position: absolute; z-index: 6; right: 10px; bottom: 10px; font-size: 12px; font-weight: 700; letter-spacing: .08em;
  color: var(--ink); text-decoration: none; background: var(--surface); backdrop-filter: var(--glass); -webkit-backdrop-filter: var(--glass);
  padding: 5px 10px; border-radius: 999px; box-shadow: var(--shadow);
}
.embed-mode .embed-credit:hover { color: var(--topic, var(--accent)); }
.embed-mode .embed-card:not([hidden]) {
  display: flex; flex-direction: column; gap: 2px; position: absolute; z-index: 6; left: 10px; top: 10px; max-width: min(260px, 70vw);
  background: var(--surface); backdrop-filter: var(--glass); -webkit-backdrop-filter: var(--glass); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow);
}
.embed-mode.embed-topics .embed-card:not([hidden]) { top: 60px; }
.embed-card b { font-size: 15px; }
.embed-card .num { font-family: var(--numf); font-size: 22px; font-weight: 700; color: var(--topic, var(--accent)); }
.embed-card small { color: var(--muted); font-size: 11.5px; }
.embed-card a { color: var(--accent); font-size: 12px; margin-top: 4px; }
.embed-mode .maplibregl-ctrl-bottom-right { bottom: 40px; }

/* the 嵌入 code box */
.embed-box { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(2,5,10,.6); padding: 16px; }
.embed-box[hidden] { display: none; }
.embed-inner { width: min(520px, 100%); background: var(--solid); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.embed-inner header { display: flex; justify-content: space-between; align-items: center; font-size: 17px; }
.embed-inner header button { width: 36px; height: 36px; border: 0; border-radius: 10px; background: var(--bg); cursor: pointer; }
.embed-inner p { font-size: 13.5px; color: var(--muted); }
.embed-opts { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; align-items: center; }
.embed-opts select { background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; }
.embed-inner textarea { width: 100%; font: 12px/1.5 ui-monospace, Menlo, monospace; color: var(--ink); background: #060a12; border: 1px solid var(--line); border-radius: 10px; padding: 10px; resize: none; }

/* contact links: bottom of the topic menu, and the end of the side panel */
.drawer-foot { display: flex; align-items: baseline; gap: 10px; padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.drawer-foot a { color: var(--accent); font-weight: 700; text-decoration: none; }
.drawer-foot a:hover { text-decoration: underline; }
.contact-line { margin-top: 14px; }
.contact-line a { color: var(--accent); font-weight: 700; }
