/* Map --------------------------------------------------------------------- */
.work { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 348px; gap: 12px; }
#mapWrap { position: relative; min-height: 200px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
#insights { overflow-y: auto; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); scrollbar-width: thin; }
#insights .panel:last-child { border-bottom: none; }
#progress { margin-top: 10px; }
#progress:empty { display: none; }
#map { position: absolute; inset: 0; background: var(--surface-2); }
.leaflet-container { font: inherit; }
.leaflet-bar a { background: var(--raised); color: var(--ink); border-color: var(--line) !important; }
.leaflet-bar a:hover { background: var(--surface-2); }
.leaflet-bar, .leaflet-control-layers { border: 1px solid var(--line) !important; box-shadow: var(--shadow) !important; border-radius: var(--radius-sm) !important; overflow: hidden; }
.leaflet-control-layers { background: var(--raised); color: var(--ink); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--muted); font-size: 10px; }
.leaflet-control-attribution a { color: var(--ink-2); }
/* Scale bar: the app's own type. Leaflet's default adds a white text shadow, which reads as a smudged outline on the dark theme. */
.leaflet-control-scale-line { background: color-mix(in srgb, var(--surface) 82%, transparent); border: 1.5px solid var(--ink-2); border-top: none;
  color: var(--ink); font: 550 11px/1.5 var(--font, inherit); font-family: inherit; text-shadow: none; padding: 0 5px; font-variant-numeric: tabular-nums; }
.leaflet-control-scale-line:not(:first-child) { border: 1.5px solid var(--ink-2); border-bottom: none; margin-top: -1.5px; }
.leaflet-tooltip { background: var(--raised); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 550; }
.ctx { filter: saturate(.55); }
.pixelated { image-rendering: pixelated; }

.floating { position: absolute; z-index: 1000; background: color-mix(in srgb, var(--raised) 94%, transparent);
  backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
#layerCard { top: 10px; left: 10px; width: 264px; max-height: calc(100% - 20px); overflow-y: auto; padding: 10px 12px 10px; scrollbar-width: thin; }
.fold { margin-top: 8px; }
.fold > summary { cursor: pointer; font-size: 12px; font-weight: 550; color: var(--ink-2); list-style: none; display: flex; align-items: center; gap: 6px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: ""; width: 5px; height: 5px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); transition: transform .12s; }
.fold[open] > summary::before { transform: rotate(45deg); }
.fold:has(.stats:empty):has(#layerNote:empty) { display: none; }
.lc-head { display: flex; align-items: center; gap: 8px; }
.lc-head h2 { flex: 1; }
.lc-head + .lc-body { margin-top: 8px; }
/* Compact (the default): the layer's name and its colour scale, nothing else. The button opens the rest. */
#layerCard.folded { width: 190px; padding: 6px 8px 7px; overflow: visible; }
#layerCard.folded .lc-head { position: absolute; top: 6px; right: 6px; }
#layerCard.folded #layerSel { border-color: transparent; background-color: transparent; font-weight: 600; padding-left: 4px; }
#layerCard.folded #legend .ends { font-size: 10px; margin-top: 2px; }
#layerCard.folded #legend:empty { display: none; }
#layerCard.folded .lc-head h2, #layerCard.folded .fold, #layerCard.folded #sceneRow { display: none; }
#layerCard.folded .lc-head + .lc-body { margin-top: 0; }
#layerCard.folded #layerSel { width: calc(100% - 32px); }
#layerCard.folded #legend img, #layerCard.folded #legend .grad { margin-top: 5px; height: 7px; }
#layerCard.folded #btnLayerFold svg { transform: rotate(180deg); }
.lc-opts { margin-top: 2px; }
#sceneRow { margin-top: 8px; }
#legend img, #legend .grad { width: 100%; height: 10px; display: block; border-radius: 3px; margin-top: 12px; }
#legend .ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 3px; font-variant-numeric: tabular-nums; }
#legend .zleg { display: flex; gap: 14px; margin-top: 12px; font-weight: 550; }
#legend .zleg i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.stats { margin-top: 8px; }
.stats:empty { display: none; }
.stats .row { margin-top: 10px; }
#layerNote { margin: 8px 0 0; font-size: 11px; line-height: 1.4; }
#layerNote:empty { display: none; }

.map-empty { position: absolute; inset: 0; z-index: 999; display: grid; place-items: center; pointer-events: none; }
.map-empty > div { display: flex; flex-direction: column; gap: 4px; max-width: 320px; text-align: center; padding: 18px 22px;
  background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.map-empty b { font-size: 15px; }
.map-empty span { color: var(--ink-2); }

.wind-ctl { display: flex; align-items: center; gap: 5px; padding: 3px 8px; font-size: 12px; color: var(--ink); cursor: default;
  background: color-mix(in srgb, var(--raised) 92%, transparent); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); }
