.map-root { display: block; }
.map-status { color: var(--muted); padding: var(--space-4) 0; }
.map-error { color: var(--bad); }
.map-controls { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-5); align-items: end; margin-bottom: var(--space-5); }
.map-field { display: grid; gap: var(--space-1); font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.map-field select { min-width: 15rem; max-width: 100%; text-transform: none; letter-spacing: 0; font-weight: 400; }

.map-body { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: var(--space-5); align-items: start; }
.map-stage { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--space-4); min-width: 0; }
.map-svg { display: block; width: 100%; height: auto; }
.map-svg { cursor: grab; touch-action: none; }
.map-shape { stroke: none; transition: fill .2s, opacity .3s; vector-effect: non-scaling-stroke; }
.map-shape.is-dim { opacity: .22; }
.map-shape-commune { stroke: var(--surface); stroke-width: .3; }
.map-lakes { fill: var(--surface); stroke: none; opacity: .9; pointer-events: none; }
.map-canton-lines { fill: none; stroke: var(--fg); stroke-width: 1.3; opacity: .55; pointer-events: none; vector-effect: non-scaling-stroke; }
.map-country-line { fill: none; stroke: var(--fg); stroke-width: 1.4; opacity: .7; pointer-events: none; vector-effect: non-scaling-stroke; }
.map-hit-shape { fill: transparent; stroke: none; cursor: pointer; outline: none; vector-effect: non-scaling-stroke; }
.map-hit-shape.is-hover, .map-hit-shape:focus-visible { stroke: var(--fg); stroke-width: 1.6; }
.map-hit-shape.is-sel { stroke: var(--accent); stroke-width: 2.6; }

.map-tip { position: absolute; z-index: 2; pointer-events: none; white-space: nowrap; max-width: calc(100% - var(--space-2)); }
.map-tip span { color: var(--muted); margin-left: var(--space-2); }

.map-legend { margin: var(--space-4) var(--space-1) 0; font-variant-numeric: tabular-nums; }
.map-legend-bar { height: 10px; border-radius: 999px; border: 1px solid var(--border); }
.map-legend-ticks { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--muted); margin-top: var(--space-2); font-variant-numeric: tabular-nums; }

.map-rank { padding: var(--space-4); max-height: 32rem; overflow: auto; }
.map-rank-title { margin: 0 0 var(--space-3) !important; font-size: var(--fs-xs); color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .06em; }
.map-rank-list { list-style: none; margin: 0; padding: 0; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.map-rank-list li { display: grid; grid-template-columns: 2rem 1fr auto; column-gap: var(--space-2); align-items: baseline;
  padding: var(--space-2) var(--space-2); border-radius: 6px; cursor: pointer; }
.map-rank-list li.is-hover, .map-rank-list li:hover { background: var(--surface-2); }
.map-rank-list li:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.map-rank-gap { text-align: center; color: var(--muted); cursor: default !important; display: block !important; }
.map-rank-n { color: var(--muted); font-size: var(--fs-xs); text-align: right; }
.map-rank-name small { color: var(--muted); font-weight: 600; }
.map-rank-val { font-weight: 600; }
.map-rank-bar { grid-column: 2 / 4; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: var(--space-1); }
.map-rank-bar i { display: block; height: 100%; border-radius: 2px; }
.map-note { color: var(--muted); font-size: var(--fs-sm); margin: var(--space-4) 0 0; max-width: 80ch; }

@media (max-width: 860px) {
  .map-body { grid-template-columns: minmax(0, 1fr); }
  .map-rank { max-height: 26rem; }
  .map-field { flex: 1 1 100%; }
  .map-field select { min-width: 0; width: 100%; }
  .map-stage { padding: var(--space-2); }
  .map-legend { margin: var(--space-3) var(--space-2) var(--space-2); }
  .map-legend-ticks span:nth-child(even) { display: none; }
  .map-rank-list li { padding-block: var(--space-3); }
}
.map-nodata-bg { fill: var(--surface); }
.map-nodata-line { stroke: var(--muted); stroke-width: 1; opacity: .5; }
.map-hit-shape.is-nodata { cursor: default; }
.map-legend-nodata { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-3); font-size: var(--fs-xs); color: var(--muted); }
.map-nodata-swatch { display: inline-block; width: 18px; height: 12px; border: 1px solid var(--border); border-radius: 3px;
  background: repeating-linear-gradient(45deg, var(--surface) 0 2px, color-mix(in srgb, var(--muted) 60%, var(--surface)) 2px 3px); }

.map-year.is-loading { opacity: .6; pointer-events: none; }

.map-controls-top { align-items: end; }
.map-mode button { font-size: var(--fs-base); min-height: 44px; padding: 0 var(--space-5); }
.map-controls .seg button { min-height: 40px; }
.map-field input[type=search] { min-width: 15rem; text-transform: none; letter-spacing: 0; font-weight: 400; }
.map-search { position: relative; }
.map-results { position: absolute; top: 100%; left: 0; right: 0; z-index: 5; margin: var(--space-1) 0 0; padding: var(--space-1); list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  text-transform: none; letter-spacing: 0; font-weight: 400; font-size: var(--fs-sm); color: var(--fg); }
.map-results li { padding: var(--space-3); border-radius: 6px; cursor: pointer; }
.map-results li:hover { background: var(--surface-2); }
.map-results small { color: var(--muted); font-weight: 600; }
.map-zoom-btns { position: absolute; top: var(--space-3); right: var(--space-3); display: grid; gap: var(--space-1); }
.map-zoom-btns button { width: 40px; height: 40px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--fg);
  font: inherit; font-size: 1.25rem; line-height: 1; cursor: pointer; box-shadow: var(--shadow); }
.map-zoom-btns button:hover { background: var(--surface-2); }
.map-zoom-btns button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.map-label { font-size: 11px; font-weight: 700; fill: var(--fg); text-anchor: middle; dominant-baseline: central; pointer-events: none;
  paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; transition: opacity .3s; }
.map-label.is-dim { opacity: .25; }
.map-legend-classes { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); font-size: var(--fs-xs); color: var(--muted); }
.map-cls { display: inline-flex; align-items: center; gap: var(--space-2); white-space: nowrap; }
.map-cls i { width: 18px; height: 12px; border-radius: 3px; border: 1px solid var(--border); flex: none; }
.map-side { display: grid; gap: var(--space-4); min-width: 0; }
.map-card, .map-summary { padding: var(--space-4); }
.map-card h3, .map-summary h3 { margin: 0 !important; font-size: var(--fs-lg); }
.map-card h3 small { color: var(--muted); font-weight: 600; font-size: var(--fs-sm); }
.map-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.map-card-x { border: 0; background: transparent; color: var(--muted); font-size: 1.5rem; line-height: 1; cursor: pointer; min-width: 40px; min-height: 40px; }
.map-card-val { margin: var(--space-2) 0 var(--space-1); font-size: var(--fs-xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.map-card-val span { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; margin-left: var(--space-2); }
.map-card-sub { margin: var(--space-1) 0 0; color: var(--muted); font-size: var(--fs-sm); }
.map-back { cursor: pointer; min-height: 36px; }
.map-dl { display: grid; grid-template-columns: auto 1fr; gap: var(--space-1) var(--space-3); margin: var(--space-3) 0 0; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.map-dl dt { color: var(--muted); } .map-dl dd { margin: 0; }
.map-rank-list li.is-sel { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
@media (max-width: 860px) {
  .map-mode { width: 100%; } .map-mode button { flex: 1; padding: 0 var(--space-3); }
  .map-field input[type=search] { min-width: 0; width: 100%; }
  .map-search { flex: 1 1 100%; }
  .map-label { display: none; }
  .map-results li { min-height: 44px; display: flex; align-items: center; gap: var(--space-2); }
  .map-rank-list li { min-height: 44px; }
}
