/* SPDX-License-Identifier: AGPL-3.0-or-later */
/* Colours, type and components follow ridrs (ridrs_app/web/src/landing.js and packages/ui-shell):
   cyan/lime accents, italic display caps, mono eyebrows. Fonts are self-hosted (vendor/fonts).
   The interface is always dark (ridrs); the map is always light (OpenFreeMap positron), so everything drawn on the map
   uses the --map-* tokens and the level colours --l1 … --l7, which read on both.
   --lime and --cyan are fills; text and borders on the page background use --hi and --link. */
@import url("vendor/fonts/fonts.css");

:root {
  --detail-w: 440px; /* width of the route dialog on wide screens; the drag handle at its right edge changes it (site/app.js) */
  color-scheme: dark;
  --bg: #07090e; --surface: #0d121c; --surface-raised: #131b2a; --border: #1b2a3c;
  --cyan: #00f0ff; --lime: #ccff00; --amber: #e8a838;
  --text: #f1f5f9; --muted: #8b9bb4; --faint: #5b6b82; --focus: #5aa9e6;
  --sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --display: 'Chakra Petch', 'Plus Jakarta Sans', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --hi: var(--lime); --link: var(--cyan); --on-lime: #07090e;
  --shadow: 0 10px 30px rgb(0 0 0 / .55), 0 0 0 1px var(--border); --chip-shadow: 0 4px 14px rgb(0 0 0 / .45);
  /* Lokalisierungsstufe 1 (best) … 7, from green over cyan and blue to grey: readable on the dark UI and the light map */
  --l1: #6aa800; --l2: #2fb344; --l3: #0aa2bf; --l4: #3b7ddd; --l5: #e08a00; --l6: #7b8794; --l7: #a3adb9;
  /* Drawn on the light map */
  --map-route: #0089a3; --map-casing: #ffffff; --map-point-stroke: #ffffff; --map-preview: #5f8a00; --map-text: #0d121c;
}


* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 400 15px/1.45 var(--sans); color: var(--text); background: var(--bg); overflow: hidden; -webkit-font-smoothing: antialiased; }
#map { position: fixed; inset: 0; background: var(--bg); }
a { color: var(--link); }
::selection { background: var(--cyan); color: var(--bg); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
input, select, button { font: inherit; color: inherit; }
input[type=search], input[type=number], select { padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-raised); min-width: 0; }
input[type=checkbox] { accent-color: var(--hi); }
.eyebrow { font: 600 .7rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--link); }

/* Search mask, top centre */
#search { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); width: min(660px, calc(100vw - 24px)); z-index: 5; }
#search { container-type: inline-size; }
/* Narrow bar (dialog open, small windows): the logo alone carries the brand, the field keeps its room. */
@container (max-width: 560px) { #search .brand span { display: none; } }
#search .bar { display: flex; align-items: center; gap: .6rem; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: .4rem .45rem .4rem .85rem; }
#search .brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--text); white-space: nowrap; }
#search .brand img { height: 1.05rem; width: auto; display: block; }
#search .brand span { font: italic 700 .95rem/1 var(--display); text-transform: uppercase; letter-spacing: .01em; padding-left: .55rem; border-left: 1px solid var(--border); }
#search #q { flex: 1; border: 1px solid transparent; background: var(--surface-raised); padding: .6rem .8rem; border-radius: 12px; font-size: 1rem; }
#search #q::placeholder { color: var(--faint); }
#search #q:focus { border-color: var(--link); outline: none; }
#filter-toggle { border: 1px solid var(--border); background: var(--surface-raised); border-radius: 999px; padding: .55rem .9rem; cursor: pointer; white-space: nowrap; font-weight: 600; font-size: .9rem; }
#filter-toggle[aria-expanded=true] { border-color: var(--link); }
#filter-n:not(:empty) { margin-left: .4rem; background: var(--lime); color: var(--on-lime); border-radius: 99px; padding: 0 .4rem; font-size: .75rem; font-weight: 700; }
#suggest, #filters { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); margin: .45rem 0 0; }
#suggest { list-style: none; padding: .35rem; max-height: 50vh; overflow-y: auto; }
#suggest li { padding: .5rem .65rem; border-radius: 10px; cursor: pointer; }
#suggest li[aria-selected=true], #suggest li:hover { background: var(--surface-raised); }
#suggest .t { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#filters[hidden], #suggest[hidden] { display: none; }
.link { border: 0; background: none; color: var(--link); cursor: pointer; padding: 0; font-size: .85rem; }

/* Chips: quick filters and active filters under the bar, topics and presets in the panel */
.pill { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: .32rem .7rem; font-size: .8rem; font-weight: 600; cursor: pointer; white-space: nowrap; transition: border-color .15s, background-color .15s; }
.pill small { font: 500 .7rem var(--mono); color: var(--muted); }
.pill[aria-pressed=true], .pill.on { border-color: var(--hi); background: color-mix(in srgb, var(--lime) 14%, var(--surface)); }
.pill[aria-pressed=true] small { color: var(--hi); }
@media (hover: hover) { .pill:hover { border-color: var(--link); } }
.zero { opacity: .45; }
.chiprow { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .35rem; margin-top: .45rem; }
.chiprow:empty { display: none; }
#quick .pill { box-shadow: var(--chip-shadow); }
#quick .pill.view::before { content: ""; width: .7rem; height: .7rem; border: 1.5px dashed currentColor; border-radius: 2px; }
#active .link { padding: .2rem .4rem; background: color-mix(in srgb, var(--surface) 85%, transparent); border-radius: 99px; }
body.filters-open #active { display: none; }

/* Filter panel: sections, segmented controls, two-handle ranges */
#filters { display: flex; flex-direction: column; max-height: calc(100vh - 130px); max-height: calc(100dvh - 130px); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: .7rem .9rem 0; }
.panel-head h2 { font: italic 700 1rem/1 var(--display); text-transform: uppercase; margin: 0; }
.panel-head .x { width: 2rem; height: 2rem; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-raised); cursor: pointer; }
.presets { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; padding: .6rem .9rem .5rem; border-bottom: 1px solid var(--border); }
.presets .eyebrow { margin-right: .25rem; }
.panel-scroll { overflow-y: auto; padding: 0 .9rem; overscroll-behavior: contain; }
.sec { border-bottom: 1px solid var(--border); }
.sec:last-child { border-bottom: 0; }
.sec summary { cursor: pointer; padding: .7rem 0; font: 600 .72rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--link); list-style: none; display: flex; justify-content: space-between; }
.sec summary::-webkit-details-marker { display: none; }
.sec summary::after { content: "+"; color: var(--muted); font-size: .9rem; }
.sec[open] summary::after { content: "–"; }
.sec-body { display: grid; gap: .55rem; padding-bottom: .9rem; min-width: 0; }
.lbl, .seg legend, .range2 legend { font-size: .82rem; font-weight: 600; color: var(--muted); padding: 0; }
.hint { font-weight: 400; color: var(--faint); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.seg .opts { display: flex; margin-top: .3rem; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-raised); }
.seg label { flex: 1 1 0; position: relative; display: flex; flex-direction: column; align-items: center; padding: .35rem .2rem; cursor: pointer; min-width: 0; text-align: center; }
.seg label + label { border-left: 1px solid var(--border); }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { font-size: .82rem; font-weight: 600; white-space: nowrap; }
.seg small { font: 500 .66rem var(--mono); color: var(--faint); }
.seg label:has(input:checked) { background: color-mix(in srgb, var(--lime) 16%, var(--surface-raised)); }
.seg label:has(input:checked) span, .seg label:has(input:checked) small { color: var(--hi); }
.seg label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: -3px; }
.loc-name { margin: -.2rem 0 0; font-size: .78rem; }
.chk { display: flex; align-items: center; gap: .45rem; cursor: pointer; font-size: .9rem; }
.chk small, .multi small { margin-left: auto; font: 500 .7rem var(--mono); color: var(--faint); }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
#filters select { width: 100%; }
.multi { display: grid; gap: .3rem; }
.multi input[type=search] { width: 100%; }
.multi .list { max-height: 11.5rem; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: .25rem; background: var(--surface-raised); }
.multi .list label { display: flex; align-items: center; gap: .45rem; padding: .25rem .4rem; border-radius: 6px; cursor: pointer; font-size: .88rem; }
.multi .list label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi .list label[hidden] { display: none; }
@media (hover: hover) { .multi .list label:hover { background: var(--surface); } }
.multi .more { margin: 0; font-size: .78rem; }
.range2 .track { position: relative; height: 1.6rem; margin-top: .2rem; }
.range2 .track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 4px; transform: translateY(-50%); background: var(--border); border-radius: 2px; }
.range2 input[type=range] { position: absolute; inset: 0; width: 100%; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; accent-color: var(--lime); }
.range2 input[type=range]::-webkit-slider-thumb { pointer-events: auto; -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--lime); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--lime); cursor: pointer; }
.range2 input[type=range]::-moz-range-thumb { pointer-events: auto; width: 14px; height: 14px; border-radius: 50%; background: var(--lime); border: 3px solid var(--bg); cursor: pointer; }
.range2 input[type=range]:focus-visible { outline: none; }
.range2 input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--focus); }
.range2 .nums { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--muted); }
.range2 .nums input { width: 5.5rem; }
.panel-foot { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .55rem .9rem; border-top: 1px solid var(--border); }
.panel-foot .btn { margin: 0; }
/* Video count: bottom centre, above the legal line */

/* Route dialog, left */
#detail { position: fixed; top: 12px; left: 12px; bottom: 12px; margin: 0; width: min(var(--detail-w), calc(100vw - 24px)); max-height: none; height: auto;
  border: 0; border-radius: 18px; box-shadow: var(--shadow); background: var(--surface); color: var(--text); padding: 0; overflow: hidden; z-index: 6; }
#detail[open] { display: flex; flex-direction: column; }
#detail-body { overflow-y: auto; padding: 1rem 1.1rem 1.1rem; }
#detail .close { position: absolute; top: 10px; right: 10px; width: 2rem; height: 2rem; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-raised); cursor: pointer; z-index: 1; }
#detail .close:hover { border-color: var(--link); }
/* Drag handle at the dialog's right edge (wide screens): drag, arrow keys, double click for the default width */
#detail .resize-handle { position: absolute; top: 0; right: 0; bottom: 0; width: 12px; cursor: ew-resize; touch-action: none; z-index: 2; }
#detail .resize-handle::after { content: ""; position: absolute; top: 50%; right: 3px; width: 4px; height: 44px; transform: translateY(-50%); border-radius: 2px; background: var(--border); transition: background .15s; }
#detail .resize-handle:hover::after, #detail .resize-handle:focus-visible::after, body.resizing #detail .resize-handle::after { background: var(--link); }
#detail .resize-handle:focus-visible { outline: none; }
body.resizing, body.resizing * { cursor: ew-resize !important; user-select: none; }
#detail h2 { font: italic 700 1.2rem/1.15 var(--display); text-transform: uppercase; margin: .35rem 2.4rem .35rem 0; overflow-wrap: anywhere; }
#detail dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem .9rem; margin: .7rem 0; font-size: .9rem; }
#detail dt { font: 600 .68rem/1.9 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
#detail dd { margin: 0; overflow-wrap: anywhere; }
/* Road class bar in the dialog: from fast (dark) to small roads (light), track and path in amber */
.roadbar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin-top: .35rem; background: var(--surface-raised); }
.roadbar span { min-width: 2px; }
.roadleg { display: flex; flex-wrap: wrap; gap: .15rem .7rem; margin-top: .3rem; font-size: .78rem; color: var(--muted); }
.roadleg i { display: inline-block; width: .6rem; height: .6rem; border-radius: 2px; margin-right: .3rem; vertical-align: -1px; }
.rc-motorway { background: #5b6b82; } .rc-trunk { background: #6f86a6; } .rc-primary { background: #2b8fd6; } .rc-secondary { background: #19b6d6; }
.rc-minor { background: var(--cyan); } .rc-residential { background: #9fb4c8; } .rc-track { background: var(--amber); } .rc-path { background: #c05a2c; } .rc-ferry { background: repeating-linear-gradient(45deg, var(--faint) 0 3px, transparent 3px 6px); }
/* Several videos at one position: the choice in the dialog */
.stack { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; gap: .35rem; }
.stack button { width: 100%; text-align: left; display: grid; gap: .15rem; padding: .55rem .7rem; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-raised); color: var(--text); cursor: pointer; }
.stack .t { font-weight: 600; overflow-wrap: anywhere; }
.stack .meta { font-size: .8rem; }
@media (hover: hover) { .stack button:hover { border-color: var(--link); } }
#detail .back { display: block; margin: 0 2.4rem .4rem 0; font-size: .85rem; }
/* Elevation profile in the dialog */
.profile-box { margin: .6rem 0 0; }
.profile { width: 100%; height: auto; display: block; touch-action: none; }
.profile .area { fill: color-mix(in srgb, var(--cyan) 18%, transparent); }
.profile .ln { fill: none; stroke: var(--link); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.profile text { font: 500 9px var(--mono); fill: var(--faint); }
.profile .cur { stroke: var(--hi); stroke-width: 2; }
.profile .hov { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 2; }
.profile .hit { fill: transparent; cursor: crosshair; }
.profile-plot { position: relative; }
.profile-box.has-climbs { padding-top: 14px; } /* room for a circle above the highest summit */
.climb-mark { position: absolute; transform: translate(-50%, calc(-100% - 3px)); min-width: 18px; height: 18px; padding: 0 3px; border-radius: 9px;
  display: grid; place-items: center; font: 700 10px/1 var(--mono); color: var(--hi); background: var(--surface-raised); border: 1.5px solid var(--link); cursor: help; }
.profile-read { margin: .1rem 0 0; min-height: 1.2em; font: 500 .75rem var(--mono); }
.profile-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--link); border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--link); pointer-events: none; }
#detail .loc-box { border-left: 3px solid var(--c); background: var(--surface-raised); padding: .5rem .7rem; border-radius: 0 10px 10px 0; font-size: .88rem; margin: .7rem 0; color: var(--muted); }
#detail .loc-box b { color: var(--text); }
#detail .wish-box { margin: .7rem 0; }
#detail .wish-box p { margin: .3rem 0; }
#detail .wish-box .row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.meta { color: var(--muted); font-size: .85rem; }
.lvl { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; color: var(--muted); white-space: nowrap; }
.lvl::before { content: ""; width: .65rem; height: .65rem; border-radius: 50%; background: var(--c); }
.btn { display: inline-flex; align-items: center; min-height: 2.5rem; padding: 0 1.1rem; border-radius: 999px; text-decoration: none; font-weight: 700; font-size: .92rem;
  color: var(--text); background: var(--surface-raised); border: 1px solid var(--border); margin: .25rem .4rem .25rem 0; cursor: pointer; transition: border-color .15s, background-color .15s; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.warn { color: var(--amber); }
.preview { margin: .6rem 0 0; }
.preview img { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--border); }
.preview figcaption { margin-top: .25rem; font-size: .75rem; }
.btn-primary { background: var(--lime); color: var(--on-lime); border-color: transparent; }
@media (hover: hover) { .btn:hover { border-color: var(--link); } .btn-primary:hover { background: #dbff4d; border-color: transparent; } }
.video { aspect-ratio: 16 / 9; width: 100%; margin-top: .6rem; border-radius: 12px; overflow: hidden; background: #000; color: #f1f5f9; position: relative; border: 1px solid var(--border); }
.video iframe { width: 100%; height: 100%; border: 0; display: block; }
.video .ride-picture { width: 100%; height: 100%; object-fit: cover; display: block; } /* a ride (Van Gestel) has no player: its picture */
.consent { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: .5rem; padding: 1rem; text-align: center; font-size: .85rem; color: #b8c3d2; } /* always on the black video area */
.consent a { color: #5ee9f5; }
.consent .btn { background: var(--lime); color: var(--on-lime); border-color: transparent; }
.readout { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .82rem; margin-top: .45rem; color: var(--muted); }
.readout b { color: var(--hi); font: 600 .85rem var(--mono); }
.video-pointer { width: 20px; height: 20px; border-radius: 50%; background: var(--lime); border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--hi), 0 0 14px rgb(204 255 0 / .6); cursor: grab; }
.video-pointer:active { cursor: grabbing; }

/* With the dialog open, the search mask centres in the remaining map area. */
@media (min-width: 761px) {
  body.detail-open #search { left: calc(50% + var(--detail-w) / 2 - 16px); width: min(660px, calc(100vw - var(--detail-w) - 104px)); } /* clear of the zoom buttons */
}
#notice { position: fixed; top: 84px; left: 50%; transform: translateX(-50%); background: var(--surface-raised); color: var(--amber); border: 1px solid var(--amber); padding: .5rem .8rem; border-radius: 10px; z-index: 7; }

/* MapLibre controls: dark like the rest of the interface */
.maplibregl-ctrl-group { background: var(--surface) !important; box-shadow: var(--shadow) !important; border-radius: 12px !important; }
.maplibregl-ctrl-group button + button { border-top-color: var(--border) !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1); }
.maplibregl-ctrl-attrib { background: color-mix(in srgb, var(--surface) 85%, transparent) !important; color: var(--muted); }
.maplibregl-ctrl-attrib a { color: var(--muted) !important; }
.maplibregl-ctrl-attrib-button { filter: invert(1); }
.maplibregl-ctrl-top-right { top: 74px; }

/* Text pages (Lizenz, Datenschutz, Impressum) */
body.page { overflow: auto; background: radial-gradient(70rem 32rem at 75% -12rem, rgb(0 240 255 / .09), transparent 70%), var(--bg); }
.page main { max-width: 44rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.page main[hidden] { display: none; }
.page .home-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page .langs { font-size: .85rem; color: var(--faint); }
.page .langs b { color: var(--text); font-weight: 600; }
.page .home { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); }
.page .home img { height: 1.3rem; }
.page .home span { font: italic 700 1rem/1 var(--display); text-transform: uppercase; padding-left: .6rem; border-left: 1px solid var(--border); }
.page h1 { font: italic 700 clamp(1.8rem, 5vw, 2.6rem)/1.05 var(--display); text-transform: uppercase; margin: 2rem 0 1rem; }
.page h2 { font: italic 700 1.2rem/1.2 var(--display); text-transform: uppercase; margin: 1.8rem 0 .5rem; }
.page p, .page li { color: var(--muted); }
.page .todo { background: var(--surface-raised); color: var(--amber); border: 1px solid var(--amber); padding: .5rem .75rem; border-radius: 10px; }

@media (min-width: 761px) { .panel-foot .show { display: none; } }
@media (max-width: 760px) {
  #search .brand span { display: none; }
  /* One scrolling line per chip row, so the map keeps its space */
  .chiprow { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; margin-left: -12px; margin-right: -12px; padding: 0 12px 4px; }
  .chiprow::-webkit-scrollbar, .presets::-webkit-scrollbar { display: none; }
  .presets { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .presets .pill { flex: none; }
  /* No transform on the search mask, so the fixed sheet below is relative to the viewport */
  #search { left: 12px; transform: none; }
  body.filters-open #search { z-index: 9; }
  /* Full-height sheet with a sticky "N Videos anzeigen" */
  #filters:not([hidden]) { position: fixed; inset: 0; margin: 0; max-height: none; height: 100%; height: 100dvh; border-radius: 0; z-index: 8; }
  .panel-scroll { flex: 1; }
  .panel-foot { padding-bottom: max(.55rem, env(safe-area-inset-bottom)); }
  .maplibregl-ctrl-top-right { display: none; }
  #detail { top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: 62vh; border-radius: 18px 18px 0 0; }
  #detail .resize-handle { display: none; } /* the sheet spans the screen */
  #detail h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; } /* one line on phones; the full title is its tooltip */
}

/* Close buttons: an icon, not the "×" glyph, so it sits exactly in the middle of the circle */
#detail .close, .panel-head .x { display: grid; place-items: center; padding: 0; color: var(--text); }
#detail .close svg, .panel-head .x svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

/* Bottom bar: credits + legal (left), video count (centre), legend (right) in one grid */
#bottombar { position: fixed; left: 12px; right: 12px; bottom: 10px; z-index: 2; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end; gap: 8px 12px; pointer-events: none; }
#bottombar > * { pointer-events: auto; }
.mapfoot { justify-self: start; max-width: 100%; margin: 0; padding: .35rem .7rem; border-radius: 12px; font-size: .7rem; line-height: 1.55; color: var(--faint);
  background: color-mix(in srgb, var(--surface) 90%, transparent); box-shadow: var(--chip-shadow); }
.mapfoot p, .mapfoot nav { margin: 0; }
.mapfoot a { color: var(--muted); }
/* Language menu in the legal line: looks like a link, native list on click */
.mapfoot .lang { font: inherit; color: var(--muted); background: transparent; border: 0; padding: 0 .1rem; cursor: pointer; }
.mapfoot .lang option { color: var(--text); background: var(--surface); }
#summary { justify-self: center; margin: 0; white-space: nowrap; font: 500 .72rem/1.6 var(--mono); letter-spacing: .04em; color: var(--muted);
  background: color-mix(in srgb, var(--surface) 90%, transparent); box-shadow: var(--chip-shadow); border-radius: 99px; padding: .2rem .8rem; }
#legend { justify-self: end; font-size: .75rem; padding: .45rem .7rem; border-radius: 12px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow); }
#legend summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem;
  font: 600 .65rem/1.6 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--link); }
#legend summary::-webkit-details-marker { display: none; }
#legend summary::after { content: "+"; color: var(--muted); }
#legend[open] summary::after { content: "–"; }
#legend-items { display: grid; gap: .15rem; margin-top: .3rem; }
#legend-tracks { display: grid; gap: .15rem; margin-top: .45rem; padding-top: .35rem; border-top: 1px solid var(--border); }
#legend-tracks[hidden] { display: none; }
#legend .track-key { background: none; border: 0; padding: 0; font: inherit; font-size: .78rem; cursor: pointer; text-align: left; max-width: 16rem; overflow: hidden; text-overflow: ellipsis; }
#legend .track-key::before { width: 1rem; height: .25rem; border-radius: 2px; }
#legend .track-key:hover { color: var(--text); }
.track-tip .maplibregl-popup-content { padding: .4rem .65rem; font-size: .82rem; color: #0d121c; }
/* Medium widths (and next to the open dialog): the count sits right above the credits, the legend beside both */
@media (max-width: 1150px) and (min-width: 761px) {
  #bottombar { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "sum leg" "foot leg"; grid-template-rows: 1fr auto; }
}
@media (min-width: 761px) {
  body.detail-open #bottombar { left: calc(var(--detail-w) + 26px); grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "sum leg" "foot leg"; grid-template-rows: 1fr auto; }
}
@media (max-width: 1150px) and (min-width: 761px) {
  #summary { grid-area: sum; justify-self: start; } .mapfoot { grid-area: foot; } #legend { grid-area: leg; }
}
@media (min-width: 761px) {
  body.detail-open #summary { grid-area: sum; justify-self: start; } body.detail-open .mapfoot { grid-area: foot; } body.detail-open #legend { grid-area: leg; }
}
/* Phones: count and folded legend in one row, credits below; hidden while the route sheet is open */
@media (max-width: 760px) {
  #bottombar { left: 8px; right: 8px; bottom: 8px; grid-template-columns: minmax(0, 1fr) auto; }
  #summary { grid-column: 1; grid-row: 1; justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  #legend { grid-column: 2; grid-row: 1; }
  .mapfoot { grid-column: 1 / -1; grid-row: 2; font-size: .64rem; }
  body.detail-open #bottombar { display: none; }
}
/* Route dialog (site/route.js): two stacked players (site/route-deck.js), black in a gap, controls, coverage bar */
.route-swatch { display: inline-block; width: .75rem; height: .75rem; border-radius: 3px; background: var(--c); margin-right: .45rem; vertical-align: .05em; }
.video.deck .deck-layer { position: absolute; inset: 0; opacity: 0; pointer-events: none; transition: opacity .25s linear; z-index: 1; }
.video.deck .deck-layer.on { opacity: 1; pointer-events: auto; z-index: 2; }
.video.deck .deck-layer iframe { width: 100%; height: 100%; border: 0; display: block; }
.video.deck .deck-black { position: absolute; inset: 0; background: #000; z-index: 3; }
.video.deck .deck-black[hidden] { display: none; }
.video.deck .rp-consent { z-index: 4; background: #000; }
.video.deck .rp-consent[hidden] { display: none; }
.rp-consent .link { color: #b8c3d2; text-decoration: underline; }
.route-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: .5rem; }
.route-ctl .grow { flex: 1; }
.route-ctl .btn { min-height: 2.2rem; padding: 0 .75rem; }
.route-ctl .btn.small { padding: 0 .6rem; font-family: var(--mono); }
.route-ctl .rp-play { padding: 0 .9rem; background: var(--lime); color: var(--on-lime); border-color: transparent; }
.route-ctl .rp-play svg { width: 1.1rem; height: 1.1rem; fill: currentColor; }
.rp-rate { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; color: var(--muted); }
.rp-rate select { padding: .25rem .4rem; }
.profile.seekable .hit { cursor: pointer; }
.rp-band { position: relative; height: 10px; margin: .55rem 0 0; border-radius: 5px; background: var(--surface-raised); border: 1px solid var(--border); cursor: pointer; touch-action: none; }
.rp-band span { position: absolute; top: 0; bottom: 0; }
.rp-band span.on { background: var(--map-preview); }
.rp-band .cur { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; background: var(--hi); border-radius: 2px; }
.rp-band:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.rp-band-key { margin: .3rem 0 0; font-size: .75rem; }
.rp-band-key .key { display: inline-block; width: .7rem; height: .5rem; border-radius: 2px; background: var(--surface-raised); border: 1px solid var(--border); margin: 0 .3rem 0 .6rem; }
.rp-band-key .key:first-child { margin-left: 0; }
.rp-band-key .key.on { background: var(--map-preview); }
.rp-h { font-size: .9rem; margin: 1rem 0 0; }
.rp-videos li { display: grid; gap: .2rem; }
.rp-videos .rp-open { justify-self: end; font-size: .8rem; }
.rp-videos .rp-np { padding: .45rem .7rem; border: 1px dashed var(--border); border-radius: 12px; }
.route-ctl .btn[hidden] { display: none; }
