:root {
  --ink: #142446;
  --blue: #21447b;
  --muted: #465b71;
  --line: #d4dce4;
  --water: #dce9f0;
  --soft: #f1f5f8;
  font-family: var(--font-carlito), Calibri, 'Segoe UI', sans-serif;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
html:has([data-map-ready='true']),
body:has([data-map-ready='true']) {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
button,
select {
  font: inherit;
  color: inherit;
}
button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: #fff;
}
a {
  color: var(--blue);
  text-underline-offset: 3px;
}
button:focus-visible,
select:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #3567a3;
  outline-offset: -3px;
}
::selection {
  background: var(--blue);
  color: #fff;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-thumb {
  background: #9cadbd;
  border-radius: 6px;
}
::-webkit-scrollbar-track {
  background: #eaf0f5;
}
.screen {
  height: 100dvh;
  width: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) 28px;
  overflow: hidden;
}
.topbar {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 22px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.logo {
  font:
    700 30px/1 var(--font-fira),
    sans-serif;
  letter-spacing: -0.035em;
  color: #111;
  text-decoration: none;
  white-space: nowrap;
}
.logo span {
  background: #c4161c;
  color: white;
  padding: 1px 4px 4px;
  display: inline-block;
}
.mock-label {
  font-size: 12px;
  background: var(--soft);
  padding: 3px 8px;
  color: var(--muted);
}
.method {
  margin-left: auto;
  font-size: 14px;
  text-decoration: none;
}
.list-toggle {
  display: none;
}
.primary {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}
.publication {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 22px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}
.filters {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0;
  background: #fff;
  margin: 0;
}
.time-window {
  display: flex;
  gap: 4px;
}
.time-window button {
  height: 40px;
  min-width: 56px;
  border-color: transparent;
  padding: 0 12px;
}
.time-window button[aria-pressed='true'] {
  background: var(--ink);
  color: white;
}
.filters label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
select {
  height: 42px;
  background: #fff;
  border: 0;
  max-width: 190px;
  font-size: 14px;
  padding: 0 5px;
  color: var(--ink);
}
#unknown {
  flex: none;
  margin-left: 0;
  min-height: 40px;
  padding: 0 10px;
  color: var(--blue);
  font-size: 13px;
  background: var(--soft);
  border-color: transparent;
}
#unknown[aria-pressed='true'] {
  background: var(--blue);
  color: #fff;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(340px, 28vw, 420px);
  min-height: 0;
  overflow: hidden;
}
.map-zone {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: var(--water);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}
.map-viewport,
#map-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
  cursor: grab;
}
.map-canvas {
  position: relative;
  min-height: 0;
  height: 100%;
}
#map-viewport[data-dragging] {
  cursor: grabbing;
}
#map-plane {
  position: relative;
  width: 100%;
  height: 100%;
}
#map-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.land {
  fill: #f8f7f1;
  stroke: #a6b6bf;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.land.province {
  fill: none;
  stroke: #c5ced4;
  stroke-width: 0.65;
}
.land.active-area {
  fill: #e6edf0;
}
.land.province.chosen {
  fill: #c5d8e6;
  stroke: #21447b;
  stroke-width: 1.5;
}
.map-label {
  fill: #566d7e;
  font-size: 11px;
  letter-spacing: 1.2px;
  text-anchor: middle;
  pointer-events: none;
}
#pins {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.event-pin {
  position: absolute;
  pointer-events: auto;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  display: grid;
  place-items: center;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}
.event-pin > span {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid #637f96;
  background: #ffffffed;
  transform: translateY(-5px);
}
.map-level {
  display: inline-block;
  background: var(--level-bg);
  color: var(--level-fg);
  padding: 1px 6px 2px;
  font-size: 12px;
  line-height: 17px;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.event-pin .pin-level {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 4px;
  font-size: 11px;
  line-height: 15px;
  pointer-events: none;
}
.event-pin:hover > span,
.event-pin[aria-pressed='true'] > span,
.event-pin[data-news-lead] > span {
  background: var(--blue);
  color: white;
}
.event-pin[aria-pressed='true'] > span,
.event-pin[data-news-lead] > span {
  outline: 2px solid white;
  outline-offset: 1px;
}
.event-pin.is-preview { z-index: 3; }
.event-pin[aria-pressed='true'], .event-pin[data-news-lead] { z-index: 2; }
.event-pin.is-preview > span { outline: 2px solid var(--blue); outline-offset: 3px; }
.event-pin.is-preview::before {
  content: ''; position: absolute; pointer-events: none;
  width: 36px; height: 36px; border: 2px solid var(--blue); border-radius: 50%;
  left: 50%; top: calc(50% - 5px); transform: translate(-50%, -50%); opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .event-pin.is-preview::before { animation: event-preview 650ms cubic-bezier(0.16, 1, 0.3, 1) 2; }
  @keyframes event-preview {
    from { opacity: 0.8; transform: translate(-50%, -50%) scale(0.85); }
    to { opacity: 0; transform: translate(-50%, -50%) scale(1.5); }
  }
}
.compact-pins .event-pin > span, .compact-pins .event-pin[aria-pressed='true'] > span {
  width: 22px; height: 22px; font-size: 10px; transform: translateY(-5px);
}
.compact-pins .event-pin .pin-level { font-size: 9px; line-height: 11px; padding-inline: 2px; }
.map-heading {
  position: absolute;
  z-index: 2;
  top: 16px;
  left: 16px;
  background: #fffffff2;
  max-width: 310px;
  padding: 10px 14px;
  pointer-events: none;
}
.map-heading h1 {
  font-size: 23px;
  line-height: 1.15;
}
.map-heading p {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  margin-top: 5px;
}
.map-legend {
  margin-top: 8px;
  pointer-events: auto;
  font-size: 12px;
}
.map-heading .legend-content p {
  display: block;
}
.map-legend summary {
  cursor: pointer;
  line-height: 24px;
}
.legend-ranges {
  display: inline-flex;
  gap: 3px;
  margin-left: 4px;
}
.legend-ranges .map-level {
  padding: 0 4px;
  font-size: 11px;
}
.legend-content {
  max-height: min(330px, 40dvh);
  overflow-y: auto;
  padding-right: 4px;
  -webkit-user-select: text;
  user-select: text;
}
.legend-short {
  display: none;
}
.legend-content ol {
  list-style: none;
  padding: 0;
  margin: 8px 0;
  display: grid;
  gap: 5px;
}
.legend-content li {
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: baseline;
  gap: 8px;
}
.map-heading:has(.map-legend[open]) {
  z-index: 5;
}
/* Tor bezpieczeństwa wewnętrznego pod drabiną 0-7: osobna pozycja, bo nie jest szczeblem. */
.legend-track {
  display: grid;
  justify-items: start;
  gap: 3px;
  margin: 0 0 8px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}
.card-meta .map-level {
  margin-left: 4px;
}
.map-tools {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  border: 1px solid #b6c4cf;
  background: white;
}
.map-tools button {
  border: 0;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
}
.map-tools button + button {
  border-top: 1px solid var(--line);
}
.map-tools button:hover {
  background: var(--soft);
}
.map-credit {
  position: absolute;
  bottom: 10px;
  right: 12px;
  font-size: 11px;
  background: #ffffffed;
  padding: 2px 5px;
  color: var(--muted);
  pointer-events: none;
}
#selection-card {
  -webkit-user-select: text;
  user-select: text;
  position: absolute;
  z-index: 4;
  width: 286px;
  background: #fffffff5;
  border: 1px solid #9fb4c5;
  border-radius: 14px;
  padding: 10px 14px 12px;
}
.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.card-meta strong {
  color: var(--blue);
}
.card-meta button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  border-radius: 50%;
  flex: none;
}
#selection-card h2 {
  font-size: 18px;
  line-height: 1.22;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 2px 0 8px;
}
#selection-card .card-place {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
#selection-card .card-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.card-actions button,
.card-actions a {
  font-size: 13px;
  min-height: 38px;
  padding: 7px 10px;
  border-radius: 5px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.card-actions button {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}
@media (min-width: 901px) {
  .layout-b:has(#event-panel[open] #tab-detail[aria-pressed='true']) #open-detail {
    display: none;
  }
}
.card-actions a {
  border: 1px solid #b8c7d4;
  background: white;
}
/* Wpis z adresu spoza listy i notka o scaleniu (selection.js): ten sam wpis, nigdy inny. */
.selection-note,
.detail .selection-note {
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  margin: 2px 0 6px;
}
.detail .detail-actions button {
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--blue);
  background: white;
  color: var(--blue);
  font-size: 14px;
}
.selection-line {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}
.selection-line path {
  fill: none;
  stroke: #21447b;
  stroke-width: 1.4;
}
.panel {
  position: static;
  inset: auto;
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.panel[open] {
  display: flex;
}
.panel-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 12px;
  flex: none;
}
.panel-heading h2 {
  font-size: 23px;
  line-height: 1.2;
}
.panel-heading > span {
  font-size: 13px;
  color: var(--muted);
  margin-left: auto;
}
#close-list {
  display: none;
}
/* Marka i okres nad listą na telefonie: lista zakrywa nagłówek strony (przegląd 24.10). */
.panel-brand {
  display: none;
}
.panel-tabs {
  display: flex;
  gap: 6px;
  padding: 0 20px 12px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.panel-tabs button {
  min-height: 38px;
  padding: 6px 12px;
  font-size: 14px;
  border-color: transparent;
  background: var(--soft);
}
.panel-tabs button[aria-pressed='true'] {
  background: var(--ink);
  color: white;
}
#panel-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
#event-list,
.event-day-group > ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.event-day {
  margin: 0;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 700;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
}
.event-row {
  border-bottom: 1px solid var(--line);
  padding: 16px 20px;
}
.event-row.selected {
  background: #f1f6fa;
}
.row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 7px;
}
/* Numer wpisu na liście wygląda jak jego kółko na mapie (biała tarcza, granatowy obrys), a wybrany jak wybrane kółko. */
.number {
  background: white;
  color: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 50%;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.event-row.selected .number {
  background: var(--blue);
  color: white;
}
.event-row h4 {
  margin: 0;
  font-size: 19px;
  line-height: 1.22;
}
.event-row h4 button {
  text-align: left;
  background: transparent;
  border: 0;
  padding: 0;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}
.event-row h4 button:hover {
  text-decoration: underline;
}
.event-row p {
  font-size: 14px;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}
.detail {
  padding: 18px 20px;
}
.detail .row-meta {
  margin-bottom: 10px;
}
.detail h3 {
  font-size: 23px;
  line-height: 1.2;
  margin-bottom: 12px;
}
.detail h4 {
  font-size: 14px;
  margin: 18px 0 7px;
}
.detail p {
  font-size: 16px;
  line-height: 1.5;
}
.detail .claim-status {
  display: inline-block;
  background: #e3eaf2;
  color: #21447b;
  font-size: 13px;
  font-weight: 700;
  padding: 3px 6px;
  margin: 10px 0;
}
.detail .scope {
  font-size: 13px;
  color: var(--muted);
}
.detail ul {
  padding-left: 18px;
  margin: 10px 0;
  overflow-wrap: anywhere;
}
.detail li {
  font-size: 15px;
  margin: 7px 0;
}
.detail .full-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  background: var(--blue);
  color: #fff;
  padding: 9px 12px;
  margin-top: 16px;
  text-decoration: none;
  font-size: 14px;
}
.panel-end,
#list-empty {
  padding: 20px;
  font-size: 13px;
  color: var(--muted);
}
.bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  background: #fff;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
#coverage {
  font-weight: 700;
  color: var(--ink);
}
.mobile-hint {
  display: none;
}
.map-empty {
  position: absolute;
  top: 40%;
  left: 20px;
  right: 20px;
  text-align: center;
  padding: 20px;
  background: white;
  font-size: 16px;
  border-radius: 12px;
}
.map-empty button {
  display: block;
  margin: 12px auto 0;
  min-height: 44px;
  padding: 8px 12px;
  color: #21447b;
}
.load-error {
  padding: 24px;
  background: #fff;
  color: #142446;
}

@media (max-width: 900px) {
  .screen {
    grid-template-rows: auto auto minmax(0, 1fr) 24px;
  }
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0 8px;
    min-height: 0;
    padding: 4px 12px 0;
  }
  .topbar > .logo {
    grid-column: 1;
    grid-row: 1;
  }
  .topbar > .list-toggle {
    grid-column: 2;
    grid-row: 1;
  }
  .logo {
    font-size: 27px;
  }
  .mock-label,
  .method {
    display: none;
  }
  .list-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    margin-left: auto;
    min-height: 44px;
    padding: 0 12px;
    font-size: 14px;
    border-radius: 5px;
  }
  .publication {
    padding: 0 14px;
    font-size: 11px;
  }
  .publication > span + span {
    display: none;
  }
  .filters {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr) auto;
    grid-template-rows: 44px 44px;
    gap: 0 6px;
    padding: 4px 0;
  }
  .time-window {
    grid-column: 1;
    grid-row: 1;
  }
  .time-window button {
    min-width: 52px;
    height: 44px;
    padding: 0 8px;
  }
  .filters label {
    min-width: 0;
  }
  .filters label > span {
    display: none;
  }
  .filters label:has(#area) {
    grid-column: 2 / 4;
    grid-row: 1;
  }
  .filters label:has(#kind) {
    grid-column: 1 / 3;
    grid-row: 2;
  }
  select {
    height: 44px;
    max-width: none;
    width: 100%;
    min-width: 0;
    font-size: 14px;
    padding: 0 6px;
  }
  #unknown {
    grid-column: 3;
    grid-row: 2;
    min-height: 44px;
    padding: 0 7px;
    font-size: 12px;
    white-space: nowrap;
  }
  .workspace {
    display: block;
    position: relative;
  }
  .map-zone {
    position: absolute;
    inset: 0;
  }
  .map-heading {
    top: 10px;
    left: 10px;
    padding: 8px 10px;
    max-width: calc(100% - 76px);
  }
  .map-heading h1 {
    font-size: 18px;
  }
  .map-heading p {
    font-size: 11px;
    line-height: 1.3;
    margin-top: 3px;
  }
  .map-tools {
    top: 10px;
    right: 10px;
  }
  .map-tools button {
    width: 44px;
    height: 44px;
  }
  .map-credit {
    bottom: auto;
    top: 154px;
    right: 10px;
    font-size: 9px;
  }
  .event-pin > span {
    width: 32px;
    height: 32px;
  }
  .event-pin[aria-pressed='true'] > span {
    width: 36px;
    height: 36px;
  }
  #selection-card {
    left: 10px !important;
    right: 10px;
    bottom: 10px;
    top: auto !important;
    width: auto;
    padding: 6px 12px 10px;
    border-radius: 14px;
  }
  .card-meta {
    font-size: 12px;
  }
  .card-meta button {
    width: 44px;
    height: 36px;
  }
  #selection-card h2 {
    font-size: 18px;
    line-height: 1.18;
    -webkit-line-clamp: 2;
    margin: 0 0 6px;
  }
  #selection-card .card-place {
    font-size: 12px;
  }
  #selection-card .card-actions {
    margin-top: 8px;
    gap: 8px;
  }
  .card-actions button,
  .card-actions a {
    min-height: 44px;
    padding: 7px 11px;
    font-size: 13px;
  }
  .selection-line {
    display: none;
  }
  .panel {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    max-height: none;
    border: 0;
    margin: 0;
  }
  .panel::backdrop {
    background: #14244666;
  }
  #close-list {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 44px;
    padding: 0 8px;
    border: 0;
    color: var(--blue);
    background: var(--soft);
  }
  .panel-brand {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px 0;
  }
  .panel-brand .logo {
    margin: 0;
    font-size: 24px;
  }
  .panel-heading {
    padding: 8px 12px;
    min-height: 60px;
  }
  .panel-heading h2 {
    font-size: 22px;
  }
  .panel-tabs {
    padding: 0 12px 10px;
  }
  .panel-tabs button {
    min-height: 44px;
    padding: 8px 16px;
  }
  .bottom-bar {
    padding: 0 12px;
    font-size: 11px;
  }
  .safety {
    display: none;
  }
  .mobile-hint {
    display: inline;
  }
  .detail {
    padding: 18px;
  }
  .detail h3 {
    font-size: 24px;
  }
  .detail .full-link {
    min-height: 44px;
  }
  .event-row {
    padding: 16px 18px;
  }
}

@media (max-width: 350px) {
  .logo {
    font-size: 24px;
  }
  .topbar {
    padding: 0 10px;
  }
  .list-toggle {
    padding: 0 10px;
  }
  .map-heading h1 {
    font-size: 17px;
  }
  .map-heading {
    max-width: calc(100% - 70px);
  }
  .map-heading p {
    font-size: 10px;
  }
  #selection-card h2 {
    font-size: 17px;
  }
  .publication {
    font-size: 11px;
  }
  .filters {
    padding-inline: 8px;
  }
  .card-meta {
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .event-pin > span {
    transition:
      background-color 0.14s,
      color 0.14s;
  }
  .panel:modal {
    animation: panel-in 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  }
  @keyframes panel-in {
    from {
      clip-path: inset(10% 0 0);
    }
    to {
      clip-path: inset(0);
    }
  }
}

@media (max-width: 900px) {
  .card-meta button {
    height: 44px;
  }
}

@media (max-width: 900px) and (max-height: 550px) {
  .screen {
    grid-template-rows: auto auto minmax(0, 1fr) 20px;
  }
  .publication {
    visibility: hidden;
    overflow: hidden;
  }
  .topbar {
    min-height: 0;
  }
  .logo {
    font-size: 24px;
  }
  .list-toggle {
    min-height: 38px;
  }
  .filters {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    flex-wrap: nowrap;
    padding: 2px 8px;
  }
  .filters label {
    min-width: 140px;
  }
  .time-window {
    flex: none;
  }
  .filters button {
    flex: none;
  }
  .map-heading {
    padding: 5px 8px;
    max-width: 220px;
  }
  .map-heading h1 {
    font-size: 17px;
  }
  .map-heading p {
    display: none;
  }
  .map-tools {
    flex-direction: row;
  }
  .map-tools button + button {
    border-top: 0;
    border-left: 1px solid var(--line);
  }
  .map-tools button {
    width: 40px;
    height: 40px;
  }
  #selection-card {
    width: calc(100% - 20px);
    padding: 4px 10px 6px;
  }
  #selection-card h2 {
    -webkit-line-clamp: 1;
    font-size: 17px;
    margin: 0;
  }
  .card-meta button {
    height: 28px;
  }
  .card-place {
    display: none;
  }
  #selection-card .card-actions {
    margin-top: 5px;
  }
  .card-actions button,
  .card-actions a {
    min-height: 40px;
    padding: 5px 9px;
  }
  .map-credit {
    top: 62px;
  }
}

/* The mobile legend owns space above the canvas instead of covering its markers. */
@media (max-width: 900px) {
  .map-zone {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .map-canvas {
    height: auto;
  }
  .map-heading {
    position: relative;
    z-index: 5;
    inset: auto;
    max-width: none;
    padding: 0 10px;
    background: #fff;
    border-bottom: 1px solid var(--line);
  }
  .map-heading h1 {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .map-heading > p {
    display: none;
  }
  .map-legend {
    margin: 0;
  }
  .map-legend summary {
    min-height: 44px;
    line-height: 44px;
  }
  .legend-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 6px;
    max-height: clamp(64px, calc(100dvh - 640px), 112px);
    margin-bottom: 4px;
    overscroll-behavior: contain;
  }
  .legend-full {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .legend-short {
    display: inline;
  }
  .map-heading .legend-content p {
    order: 1;
    margin: 0;
    font-size: 11px;
    line-height: 14px;
  }
  .legend-content > a {
    order: 2;
    font-size: 11px;
    line-height: 14px;
  }
  .legend-content ol {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
    gap: 2px 8px;
  }
  .legend-content li {
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    gap: 4px;
    font-size: 12px;
    line-height: 16px;
  }
  .map-legend .legend-content .level {
    padding: 0 4px;
    font-size: 11px;
    line-height: 16px;
  }
  .legend-track {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 6px;
    margin: 0;
    padding-top: 2px;
    font-size: 12px;
    line-height: 16px;
  }
}
@media (max-width: 900px) and (max-height: 650px) {
  .map-zone:has(.map-legend[open]) #selection-card {
    padding: 4px 10px 6px;
  }
  .map-zone:has(.map-legend[open]) #selection-card h2 {
    -webkit-line-clamp: 1;
    font-size: 17px;
    margin: 0;
  }
  .map-zone:has(.map-legend[open]) .card-place {
    display: none;
  }
  .map-zone:has(.map-legend[open]) .card-meta button {
    height: 28px;
  }
  .map-zone:has(.map-legend[open]) #selection-card .card-actions {
    margin-top: 5px;
  }
  .map-zone:has(.map-legend[open]) .card-actions button,
  .map-zone:has(.map-legend[open]) .card-actions a {
    min-height: 40px;
    padding: 5px 9px;
  }
  .map-zone:has(.map-legend[open]) .map-tools {
    flex-direction: row;
  }
  .map-zone:has(.map-legend[open]) .map-tools button {
    width: 40px;
    height: 40px;
  }
  .map-zone:has(.map-legend[open]) .map-tools button + button {
    border-top: 0;
    border-left: 1px solid var(--line);
  }
  .map-zone:has(.map-legend[open]) .map-credit {
    top: 62px;
  }
}
@media (max-width: 900px) and (orientation: landscape) and (max-height: 650px) {
  .map-zone:has(.map-legend[open]) {
    grid-template-columns: min(180px, 32vw) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }
  .map-heading:has(.map-legend[open]) {
    border-bottom: 0;
    border-right: 1px solid var(--line);
    min-height: 0;
  }
  .map-legend[open] .legend-ranges {
    display: none;
  }
  .map-legend[open] .legend-content {
    max-height: max(64px, calc(100dvh - 200px));
  }
  .map-legend[open] .legend-content ol {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 900px) and (orientation: landscape) and (max-height: 350px) {
  .map-zone:not(:has(.map-legend[open])) {
    display: block;
  }
  .map-zone:not(:has(.map-legend[open])) .map-canvas {
    height: 100%;
  }
  .map-heading:not(:has(.map-legend[open])) {
    position: absolute;
    top: 0;
    left: 0;
    max-width: 200px;
  }
  .map-heading:not(:has(.map-legend[open])) .legend-ranges {
    display: none;
  }
  .map-zone:has(.map-legend[open]) #selection-card,
  .map-zone #selection-card {
    bottom: 6px;
    padding: 2px 8px 4px;
  }
  .map-zone #selection-card .card-meta button {
    height: 18px;
    width: 28px;
  }
  .map-zone #selection-card .card-actions {
    margin-top: 2px;
  }
  .map-zone #selection-card .card-actions button,
  .map-zone #selection-card .card-actions a {
    min-height: 28px;
    padding: 2px 8px;
  }
  .map-zone .map-tools {
    top: 4px;
  }
}

/* Enhancement only: server-rendered list remains usable if JS is absent or fails. */
.layout-b:not([data-map-ready='true']) .screen {
  display: none;
}

.layout-b[data-map-ready='true'] .map-fallback {
  display: none;
}

.map-fallback {
  max-width: 800px;
  padding: 24px;
  margin: auto;
}

.map-fallback h1 {
  margin: 20px 0;
  font-size: 28px;
}

.map-fallback li {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.map-fallback h2 {
  font-size: 22px;
  margin-bottom: 10px;
}

.map-skip {
  position: fixed;
  left: 12px;
  top: -100px;
  z-index: 30;
  background: var(--blue);
  color: #fff;
  padding: 12px;
}

.map-skip:focus {
  top: 8px;
}

.source-status {
  position: relative;
  z-index: 10;
  background: #fbfcfd;
}

.panel-end a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 8px;
}

/* Keep the filters in the masthead on smaller computers as well. */
@media (min-width: 901px) and (max-width: 1199px) {
  .topbar {
    gap: 12px;
    padding-inline: 16px;
  }
  .logo {
    font-size: 26px;
  }
  .filters {
    gap: 6px;
  }
  .filters label > span {
    display: none;
  }
  .filters select {
    max-width: 145px;
  }
  .time-window button {
    min-width: 48px;
    padding-inline: 8px;
  }
  .method {
    white-space: nowrap;
  }
}

/* Header density follows its controls, separately from the map/panel breakpoint. */
.filter-row-break {
  display: none;
}
.kind-filters {
  display: contents;
}
@media (max-width: 900px) {
  .topbar {
    display: flex;
    flex-wrap: wrap;
    align-content: start;
    gap: 0 6px;
    padding: 4px 12px;
  }
  .topbar .logo {
    flex: none;
    font-size: 24px;
  }
  .topbar .filters {
    display: contents;
  }
  .topbar .time-window {
    flex: none;
  }
  .topbar .time-window button {
    min-width: 44px;
    padding-inline: 6px;
  }
  .topbar .list-toggle {
    flex: none;
    margin: 0;
    padding-inline: 8px;
    border-radius: 0;
  }
  .topbar .filters label {
    flex: 1;
    min-width: 0;
  }
  .topbar .filters select {
    width: 100%;
    min-width: 0;
    max-width: none;
    padding-inline: 3px;
  }
  .topbar #unknown {
    flex: none;
    padding-inline: 6px;
  }
}
@media (min-width: 680px) and (max-width: 900px) {
  .topbar {
    flex-wrap: nowrap;
    min-height: 56px;
    padding-block: 0;
  }
  .topbar .logo {
    font-size: 22px;
  }
  .topbar .filters label {
    min-width: 88px;
  }
}
@media (min-width: 480px) and (max-width: 679px) {
  /* Use the otherwise empty space next to the brand for the area selector. */
  .topbar .kind-filters {
    display: flex;
    flex-basis: 100%;
    gap: 6px;
  }
}
@media (max-width: 479px) {
  .topbar .logo {
    flex: 1;
  }
  .filter-row-break {
    display: block;
    flex-basis: 100%;
    height: 0;
  }
}
@media (max-width: 359px) {
  .topbar {
    padding-inline: 8px;
    gap: 0 4px;
  }
  .topbar .logo {
    font-size: 20px;
  }
  .topbar .time-window {
    gap: 0;
  }
  .topbar .list-toggle {
    padding-inline: 6px;
    font-size: 13px;
  }
  .topbar #unknown {
    font-size: 11px;
    padding-inline: 4px;
  }
}
