:root {
  --bg: #fff;
  --bg-muted: #fafafa;
  --bg-nav: #f5f5f5;
  --border: #ddd;
  --text: #222;
  --text-muted: #666;
  --accent: #2a6dbf;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

body { display: flex; flex-direction: column; }

/* Top nav */
.topnav {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.topnav h1 { margin: 0; font-size: 1.05rem; font-weight: 600; flex: 1; }
.topnav nav { display: flex; gap: 0.25rem; }
.topnav nav a {
  text-decoration: none;
  color: var(--text);
  padding: 0.35rem 0.7rem;
  border-radius: 3px;
}
.topnav nav a:hover { background: rgba(0,0,0,0.05); }
.topnav nav a.active { background: var(--text); color: white; }
.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.lang-toggle .lang-opt {
  border: none;
  background: white;
  color: var(--text-muted);
  padding: 0.3rem 0.55rem;
  font: inherit;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}
.lang-toggle .lang-opt + .lang-opt { border-left: 1px solid var(--border); }
.lang-toggle .lang-opt:not(.active):hover { background: #eee; }
.lang-toggle .lang-opt.active {
  background: var(--text);
  color: white;
  font-weight: 700;
  cursor: default;
}

/* Low-data warning icon (ranking "Lata" column) */
.warn-icon { cursor: help; font-size: 0.85em; }

/* Data-coverage years subtitle */
.data-years {
  margin: 0 0 0.7rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

/* "Click a row…" hint — bold so it's not missed */
.click-hint { font-weight: 600; color: var(--text); }

/* Note explaining the bold (weakest) subject in the detail tables */
.detail-tables-note { margin: 0.4rem 0 0.6rem; }

/* Help page layout. It is a normal document, not the full-height flex app
   shell — so it scrolls at the window edge and the readable text column (capped
   for legibility) is centred rather than left-aligned with the scrollbar at 1/5. */
body.page-about { display: block; height: auto; }
.page-about .topnav { position: sticky; top: 0; z-index: 10; }
.page-about main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem;
  line-height: 1.5;
}
.page-about .lead { font-size: 1.05rem; margin: 0 0 1.2rem; }
.page-about section { margin: 1.6rem 0; }
.page-about h2 {
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}
.page-about h3 { font-size: 1rem; margin: 1rem 0 0.3rem; }
.page-about p { margin: 0.5rem 0; }
.page-about ul { margin: 0.5rem 0; padding-left: 1.3rem; }
.page-about li { margin: 0.3rem 0; }
.page-about .swatch { vertical-align: middle; margin-right: 0.2rem; }
.page-about a { color: #2166ac; }
/* sections clear the sticky nav when reached via an anchor link */
.page-about section { scroll-margin-top: 3.5rem; }

/* Table of contents (collapsible) */
.page-about .toc {
  margin: 0 0 1.5rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-muted);
}
.page-about .toc summary { cursor: pointer; font-weight: 600; }
.page-about .toc ul { columns: 2; margin: 0.5rem 0 0; padding-left: 1.1rem; }
.page-about .toc li { margin: 0.15rem 0; }
@media (max-width: 640px) { .page-about .toc ul { columns: 1; } }

/* Floating "back to contents" button — appears after scrolling, jumps to the top */
#toc-fab {
  position: fixed;
  /* Sit just outside the centred 720px text column (half = 360px) on wide screens,
     so it tracks where the text ends; fall back to the window edge when narrow. */
  right: max(1rem, calc(50% - 360px - 3.1rem));
  bottom: 1rem;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.6rem; height: 2.6rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
#toc-fab.visible { display: flex; }
#toc-fab:hover { background: #eee; }

/* Map page layout */
.page-map main { flex: 1; display: flex; min-height: 0; }
#map { flex: 1; min-width: 0; height: 100%; }

#panel {
  width: 320px;
  background: var(--bg-muted);
  border-left: 1px solid var(--border);
  padding: 1rem;
  overflow-y: auto;
  flex-shrink: 0;
}

.panel-section {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.panel-section:last-child { border-bottom: none; }

.panel-section h2 {
  margin: 0 0 0.5rem 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.6rem;
}
.field > span { font-size: 0.85rem; color: var(--text-muted); }

.field select, .field input[type="text"], .field input[type="number"] {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  font: inherit;
  background: white;
}

.field input[type="range"] { width: 100%; }

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  margin-bottom: 0.3rem;
}
.checkbox-field span { font-size: 0.9rem; }

.radio-group {
  border: none;
  padding: 0;
  margin: 0 0 0.6rem 0;
}
.radio-group legend { font-size: 0.85rem; color: var(--text-muted); padding: 0; margin-bottom: 0.25rem; }
.radio-group label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-right: 0.75rem;
  cursor: pointer;
}

/* "Find a school" autocomplete */
.school-find { position: relative; }
.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  background: white;
  border: 1px solid var(--border);
  border-radius: 3px;
  max-height: 16rem;
  overflow-y: auto;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
.autocomplete-list li {
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}
.autocomplete-list li:last-child { border-bottom: none; }
.autocomplete-list li.active,
.autocomplete-list li:hover { background: #eef4ff; }
.autocomplete-list .ac-name { display: block; font-size: 0.83rem; font-weight: 600; color: #222; }
.autocomplete-list .ac-loc { display: block; font-size: 0.76rem; color: var(--text-muted); }
.autocomplete-list .ac-offmap { color: #b06a00; font-weight: 600; }
.autocomplete-list .ac-empty { padding: 0.4rem 0.5rem; color: var(--text-muted); font-size: 0.83rem; cursor: default; }

#search-form { flex-direction: row; gap: 0.35rem; }
#search-form input { flex: 1; }
#search-form button {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  background: white;
  border-radius: 3px;
  cursor: pointer;
}
#search-form button:hover { background: #eee; }

.muted { color: var(--text-muted); }
.small { font-size: 0.8rem; }

.legend { list-style: none; margin: 0; padding: 0; font-size: 0.8rem; }
.legend li { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; }
.legend-letter { width: 1em; text-align: center; font-weight: 700; }
.swatch {
  display: inline-block;
  width: 1rem; height: 1rem;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.2);
}

/* Popups */
/* Bound the popup height so the year-by-year history scrolls inside the popup
   instead of growing past the screen. Paired with autoPan:false on touch
   (see map.js): a tall popup no longer forces the map to pan, which was
   closing the popup on mobile right after it opened. */
.leaflet-popup-content {
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: hidden;
}
.popup-school h3 { margin: 0 0 0.35rem 0; font-size: 1rem; }
.popup-school .addr { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 0.5rem 0; }
.popup-school table { border-collapse: collapse; font-size: 0.85rem; width: 100%; }
.popup-school th, .popup-school td { padding: 2px 6px; text-align: left; border-bottom: 1px solid #eee; }
.popup-school th { font-weight: 600; }
.popup-school td.num { text-align: right; font-variant-numeric: tabular-nums; }
.popup-school .warning {
  display: inline-block;
  background: #fff3cd;
  border: 1px solid #ffe69c;
  color: #8a6500;
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  margin-top: 0.4rem;
}
.popup-school .composite-row td { background: #f5f5f5; font-weight: 600; }

.popup-school .show-history-btn {
  margin-top: 0.5rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  background: white;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
}
.popup-school .show-history-btn:hover { background: #eee; }
.popup-school .show-history-btn[disabled] { opacity: 0.6; cursor: progress; }

.popup-school .history { margin-top: 0.6rem; }
.popup-school .sparkline { margin-bottom: 0.4rem; }
.popup-school .sparkline svg {
  display: block;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 2px;
}
.popup-school .spark-legend { margin-top: 0.15rem; }
.legend-item { margin-right: 0.6em; font-size: 0.75em; white-space: nowrap; }

.popup-school .history-table { width: 100%; font-size: 0.8rem; }
.popup-school .history-table th { font-weight: 600; }
.popup-school .history-table tr.sep td {
  padding: 0; border-bottom: 1px dashed #ccc; height: 4px;
}

/* Cluster icons (custom colouring done via inline style) */
.school-cluster {
  background: #aaa;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 4px rgba(0,0,0,0.3);
  color: white;
  font-weight: 600;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
}

/* Ranking page */
.page-ranking main {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.ranking-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}
.ranking-controls .field { flex: 0 0 auto; min-width: 140px; margin-bottom: 0; }
.ranking-controls .field input[type="text"] { min-width: 200px; }

#ranking-info { color: var(--text-muted); font-size: 0.85rem; }

/* The four one-line notes between the controls and the table. Left to default
   <p> margins they stacked ~16px of air between each, which on a phone pushed
   the table itself below the fold. */
.ranking-meta { margin: 0 0 0.6rem; }
.ranking-meta > p { margin: 0.1rem 0; }
.ranking-meta > details { margin: 0.1rem 0; }
.ranking-meta .data-years { margin-bottom: 0.15rem; }

/* Collapsed settings: a single muted line the same size as the notes around it,
   so shipping it costs no vertical space until someone opens it. */
.settings-block > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
}
.settings-block > summary::-webkit-details-marker { display: none; }
.settings-block > summary::before { content: '⚙'; font-size: 0.95em; }
.settings-block > summary:hover { color: var(--text); }
.settings-block[open] > summary { margin-bottom: 0.25rem; }
.settings-block .checkbox-field { margin-bottom: 0.15rem; }

.ranking-table-wrap { overflow-x: auto; }
table.ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
table.ranking-table th, table.ranking-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid #eee;
  text-align: left;
  vertical-align: top;
}
table.ranking-table th {
  background: var(--bg-nav);
  position: sticky; top: 0;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
table.ranking-table th .sort-indicator { color: var(--text-muted); font-size: 0.8em; margin-left: 0.25rem; }

/* Help icon + CSS-only tooltip (hover on desktop, tap-to-focus on mobile) */
.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15em;
  height: 1.15em;
  border: 1px solid var(--text-muted);
  border-radius: 50%;
  font-size: 0.78em;
  font-style: italic;
  font-weight: 700;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text-muted);
  cursor: help;
  position: relative;
  vertical-align: middle;
}
/* When the icon is a link into the help page, keep it looking like the icon
   rather than like body-text link. */
a.help-icon { text-decoration: none; margin-left: 0.3rem; }

/* A help icon inside a form field anchors its bubble to the label row, not to
   itself, and opens rightwards. The default (hanging off the icon with right:0,
   which suits the ranking's right-aligned column headers) sends the bubble left
   — and in the 320px map panel that runs straight off the left edge, where it
   gets clipped: overflow-y:auto forces overflow-x to auto too, so the panel
   cuts it and the map shows through. Anchored to the label, the bubble starts at
   the field's left edge and its 240px fits the panel with room to spare. */
.field > span { position: relative; }
.field a.help-icon { position: static; }
.field a.help-icon:hover::after,
.field a.help-icon:focus::after { left: 0; right: auto; }
.help-icon:hover, .help-icon:focus { background: var(--text-muted); color: #fff; outline: none; }
.help-icon:hover::after, .help-icon:focus::after {
  content: attr(data-help);
  position: absolute;
  top: 150%;
  right: 0;
  width: 240px;
  background: #333;
  color: #fff;
  padding: 0.5rem 0.6rem;
  border-radius: 4px;
  font: 400 0.78rem/1.4 system-ui, sans-serif;
  white-space: normal;
  text-align: left;
  z-index: 20;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
/* Inline help disclosure: same "?" affordance as .help-icon, but the text
   expands in the flow rather than being absolutely positioned. Both places that
   use it sit inside a scroll container — the Leaflet popup (overflow-y:auto) and
   the ranking chart grid on mobile (overflow-x:auto) — which would clip a
   positioned tooltip. Also works on touch, where :hover never fires. */
.chart-help { margin: 0 0 0.35rem; }
.chart-help > summary {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
}
.chart-help > summary::-webkit-details-marker { display: none; }
.chart-help .help-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1.15em;
  height: 1.15em;
  border: 1px solid var(--text-muted);
  border-radius: 50%;
  font: italic 700 0.85em/1 Georgia, "Times New Roman", serif;
}
.chart-help > summary:hover .help-dot,
.chart-help[open] .help-dot { background: var(--text-muted); color: #fff; }
.chart-help > p {
  margin: 0.3rem 0 0;
  font: 400 0.78rem/1.45 system-ui, sans-serif;
  color: var(--text-muted);
}

table.ranking-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.ranking-table td.num .dec {
  font-size: 0.85em;
  color: var(--text-muted);
}
table.ranking-table tr.highlight { background: #fff3cd; }
table.ranking-table td.class-cell { text-align: center; }
.class-badge {
  display: inline-block;
  min-width: 1.4rem;
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  font-weight: 700;
  text-align: center;
  border: 1px solid rgba(0,0,0,0.15);
}
.class-badge-sm { min-width: 1rem; padding: 0 0.25rem; font-size: 0.78em; }

/* Expandable per-school detail row */
table.ranking-table tr.detail-row > td {
  background: #fafafa;
  padding: 0.7rem 1rem;
  border-bottom: 2px solid var(--border);
}
/* The detail spans the (often wider-than-viewport) table, so pin its content to
   the left of the horizontal scroll area and cap it to the viewport — otherwise
   charts/tables run off-screen to the right on mobile. */
.detail-panel {
  position: sticky;
  left: 0;
  width: calc(100vw - 2rem);
  max-width: 1100px;
  box-sizing: border-box;
}
.detail-traj { margin-bottom: 0.6rem; line-height: 1.9; }
.traj-item { display: inline-block; margin-right: 0.5rem; white-space: nowrap; }
.detail-counts { color: var(--text-muted); margin-left: 0.4rem; }
.detail-table { border-collapse: collapse; font-size: 0.85rem; }
.detail-table th, .detail-table td {
  padding: 2px 10px; text-align: left; border-bottom: 1px solid #eee;
}
.detail-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.detail-table tr.sep td { padding: 0; border-bottom: 1px dashed #ccc; height: 4px; }
.detail-load-btn {
  border: 1px solid var(--border);
  background: white;
  padding: 0.4rem 0.8rem;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
}
.detail-load-btn:hover { background: #eee; }
.detail-load-btn[disabled] { opacity: 0.6; cursor: progress; }

/* Detail panel: chart grid (rows = LOO / single-year, cols = score/rank/pct) */
.chart-grid {
  display: grid;
  /* min width per chart column so charts stay readable; they grow to fill on
     desktop and the grid scrolls horizontally inside the panel on mobile. */
  grid-template-columns: auto repeat(3, minmax(180px, 1fr));
  align-items: center;
  gap: 0.2rem 0.4rem;
  margin: 0.3rem 0 0.4rem;
}
.cg-colhead { text-align: center; font-weight: 600; font-size: 0.85rem; }
.cg-rowhead { font-weight: 600; font-size: 0.8rem; color: var(--text-muted); padding-right: 0.3rem; }
.cg-cell { min-width: 0; }
.cg-cell svg { display: block; max-width: 100%; height: auto; }
.chart-legend { margin-bottom: 0.5rem; }

.detail-tables-toggle,
.popup-tables-toggle {
  border: 1px solid var(--border);
  background: white;
  padding: 0.35rem 0.7rem;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
}
.detail-tables-toggle:hover,
.popup-tables-toggle:hover { background: #eee; }
/* Full width in the popup: it is the only control there, and a comfortable tap
   target matters more than a snug button on a phone. */
.popup-tables-toggle { display: block; width: 100%; margin-top: 0.4rem; }
.detail-dim-switch { margin: 0.5rem 0; display: flex; gap: 0.25rem; }
.detail-dim-btn {
  border: 1px solid var(--border);
  background: white;
  padding: 0.25rem 0.6rem;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
}
.detail-dim-btn.active { background: var(--text); color: white; border-color: var(--text); }
.detail-tables { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: flex-start; }
.detail-table caption {
  caption-side: top;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.detail-table td.weakest { font-weight: 700; }

.off-map { color: var(--text-muted); font-size: 0.85em; }

/* Mobile */
@media (max-width: 700px) {
  /* Keep the nav links visible. The title is flex:1 but min-width:auto stops
     a flex item shrinking below its text width, so a long title pushed the nav
     (now 3 links) off the right edge. min-width:0 + ellipsis lets the title
     shrink; the nav never shrinks. */
  .topnav { gap: 0.5rem; padding: 0.5rem 0.6rem; }
  .topnav h1 {
    font-size: 0.9rem;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topnav nav { flex-shrink: 0; }
  .topnav nav a { padding: 0.35rem 0.5rem; }

  /* Detail panel: stack the numeric tables (each with its caption above) and
     let the wide chart grid scroll horizontally inside the pinned panel. */
  .detail-tables { flex-direction: column; }
  .chart-grid { overflow-x: auto; }

  /* Ranking controls on a phone: a fixed 2-column grid instead of flex-wrap.
     Wrapping left the fields ragged (a select and a 3-radio fieldset are
     different heights, and align-items:flex-end staggered them), and pushed the
     search box onto a row of its own. The "Publiczna" fieldset is the tall item,
     so it spans two rows and the two short fields — data view, then search —
     stack beside it instead of below it. Explicit placement rather than auto
     flow, so the optional view-param field can appear without reshuffling. */
  .ranking-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 0.6rem;
    row-gap: 0.45rem;
    align-items: start;
  }
  .ranking-controls .field--metric   { grid-column: 1; grid-row: 1; }
  .ranking-controls .field--subject  { grid-column: 2; grid-row: 1; }
  .ranking-controls .field--view     { grid-column: 1; grid-row: 2; }
  .ranking-controls .field--search   { grid-column: 1; grid-row: 3; }
  .ranking-controls .radio-group     { grid-column: 2; grid-row: 2 / span 2; }
  .ranking-controls #view-param-field { grid-column: 1 / -1; grid-row: 4; }
  /* Grid columns are half the viewport, so the desktop min-widths would overflow. */
  .ranking-controls .field,
  .ranking-controls .field input[type="text"] { min-width: 0; }
  .ranking-controls .field select,
  .ranking-controls .field input[type="text"] { width: 100%; }
  .ranking-controls .radio-group { margin-bottom: 0; }

  /* Years and school count share a line; the hint and the methodology link get
     one each. Four lines of notes become three, with the air taken out. */
  .ranking-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 0.5rem;
    row-gap: 0.15rem;
    align-items: baseline;
    margin-bottom: 0.5rem;
  }
  .ranking-meta > p,
  .ranking-meta > details { margin: 0; }
  .ranking-meta .data-years { grid-column: 1; grid-row: 1; font-size: 0.9rem; }
  .ranking-meta #ranking-info { grid-column: 2; grid-row: 1; }
  .ranking-meta .click-hint { grid-column: 1 / -1; grid-row: 2; }
  /* Collapsed, the settings toggle rides along in the methodology link's row, so
     it adds no height at all. Opened, it drops to a full-width row of its own —
     a half-width column would squeeze the explanation into a ribbon. */
  .ranking-meta .meta-links { grid-column: 1; grid-row: 3; }
  .ranking-meta .settings-block { grid-column: 2; grid-row: 3; justify-self: end; }
  .ranking-meta .settings-block[open] { grid-column: 1 / -1; grid-row: 4; justify-self: stretch; }

  .page-map main { flex-direction: column; }
  #map { height: 60vh; flex: 0 0 60vh; }
  #panel {
    width: 100%;
    max-height: 40vh;
    border-left: none;
    border-top: 1px solid var(--border);
  }
  /* On touch the × is the only way to close a popup (click-to-close is off —
     see map.js), so make it a comfortable tap target. Matches Leaflet's own
     selector specificity (.leaflet-container a.…) so no !important is needed. */
  .leaflet-container a.leaflet-popup-close-button {
    width: 32px;
    height: 32px;
    font-size: 26px;
    line-height: 26px;
    padding: 4px 6px 0 0;
  }
}
