:root {
  --ink: #17141a;
  --muted: #6d6672;
  --line: #e6e1e8;
  --bg: #faf8f6;
  --card: #ffffff;
  --mud: #7a4f2c;
  --accent: #c48ad9;
  --accent-ink: #5b2a73;
  --hot: #ff5c1a;
  --panel-w: 380px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { display: flex; background: var(--bg); }

#map { flex: 1; height: 100vh; }

#panel {
  width: var(--panel-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--line);
  z-index: 1000;
}

.brand {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px;
  padding: 16px 18px 14px;
  background: var(--ink); color: #fff;
}
.brand h1 { margin: 0; font-size: 22px; font-weight: 900; letter-spacing: -0.02em; }
.brand h1 span { color: var(--accent); }
.tagline { margin: 2px 0 0; font-size: 12px; color: #b9b2bd; }

.mode { display: flex; flex: 1 1 100%; background: #2c2730; border-radius: 999px; padding: 3px; }
.mode button { flex: 1; }
.mode button {
  border: 0; background: transparent; color: #cfc8d3; font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 6px 9px; border-radius: 999px; cursor: pointer;
}
.mode button.active { background: var(--accent); color: var(--ink); }

#browse, #detail { flex: 1; overflow-y: auto; display: flex; flex-direction: column; min-height: 0; }
#detail { padding: 14px 18px 18px; display: block; }
#detail[hidden], #browse[hidden] { display: none; }

.search { padding: 14px 18px 8px; }
.search input {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card);
}
.search input:focus { outline: 2px solid var(--accent); border-color: transparent; }

#filters { margin: 0 18px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
#filters summary { cursor: pointer; font-weight: 700; font-size: 13px; padding: 6px 0; color: var(--muted); }
#filter-count { color: var(--accent-ink); }
.filter { margin: 10px 0 12px; }
.filter > label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.filter output { font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }

.range { position: relative; height: 22px; }
.range::before { content: ""; position: absolute; left: 0; right: 0; top: 10px; height: 3px; background: var(--line); border-radius: 2px; }
.range .fill { position: absolute; top: 10px; height: 3px; background: var(--accent); border-radius: 2px; }
.range input {
  position: absolute; inset: 0; width: 100%; margin: 0; background: none;
  pointer-events: none; -webkit-appearance: none; appearance: none;
}
.range input::-webkit-slider-thumb {
  -webkit-appearance: none; pointer-events: auto; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent-ink); cursor: grab;
}
.range input::-moz-range-thumb {
  pointer-events: auto; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent-ink); cursor: grab;
}
.range input::-moz-range-track { background: none; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--card); font: inherit; font-size: 13px;
  padding: 4px 10px; border-radius: 999px; cursor: pointer; color: var(--ink);
}
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip small { color: var(--muted); margin-left: 3px; }
.chip[aria-pressed="true"] small { color: #b9b2bd; }

button.link { border: 0; background: none; padding: 0; font: inherit; font-size: 13px; color: var(--accent-ink); cursor: pointer; text-decoration: underline; }

.listhead { display: flex; justify-content: space-between; align-items: center; padding: 10px 18px 6px; font-size: 13px; color: var(--muted); }
.listhead select { font: inherit; font-size: 13px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; background: var(--card); }

#list { list-style: none; margin: 0; padding: 0 10px 16px; }
#list li {
  display: grid; grid-template-columns: 42px 1fr; gap: 10px; align-items: center;
  padding: 9px 8px; border-radius: 10px; cursor: pointer;
}
#list li:hover, #list li.hover { background: #f0eaf2; }
.nr {
  width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center;
  background: var(--ink); color: var(--accent); font-weight: 900; font-size: 14px; letter-spacing: -0.03em;
}
.nr.none { background: #ece6ee; color: var(--muted); font-size: 11px; font-weight: 700; }
.li-name { font-weight: 650; font-size: 14px; line-height: 1.25; }
.li-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }

.empty { padding: 20px 18px; color: var(--muted); font-size: 14px; }

/* detalje */
#detail h2 { margin: 12px 0 4px; font-size: 21px; line-height: 1.2; letter-spacing: -0.01em; }
.d-sub { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; }
.stat b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11.5px; color: var(--muted); }
.profile { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
#profile { width: 100%; display: block; cursor: crosshair; }
#profile-tip {
  position: absolute; top: 6px; right: 10px; font-size: 12px; background: var(--ink); color: #fff;
  padding: 2px 7px; border-radius: 6px; font-variant-numeric: tabular-nums;
}
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; border-radius: 10px;
  background: var(--ink); color: #fff; text-decoration: none; font-weight: 700; font-size: 14px; margin: 14px 8px 0 0;
}
.btn.secondary { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.d-section { margin-top: 18px; }
.d-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 6px; }
.d-section ul { margin: 0; padding-left: 18px; font-size: 14px; }
.d-section li { margin: 3px 0; }
.note { font-size: 12px; color: var(--muted); margin-top: 6px; }

footer { padding: 10px 18px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); }
footer a { color: inherit; }

.leaflet-container { font: inherit; }

.timeline {
  position: absolute; z-index: 1000; left: 56px; right: 56px; bottom: 26px;
  display: flex; align-items: center; gap: 12px;
  background: rgba(255, 255, 255, 0.96); border-radius: 12px; padding: 10px 14px 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}
.timeline[hidden] { display: none; }
.tl-play {
  flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--ink); color: #fff; font-size: 14px;
}
.tl-main { flex: 1; min-width: 0; }
.tl-label { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-label .tl-name { font-size: 13px; }
.tl-count { color: var(--muted); }
.tl-range { width: 100%; margin: 4px 0 0; accent-color: var(--hot); }
.tl-years { position: relative; height: 15px; font-size: 11px; color: var(--muted); }
.tl-years span { position: absolute; top: 0; transform: translateX(-2px); border-left: 1px solid var(--line); padding-left: 3px; }
.tl-speed { flex: none; font: inherit; font-size: 13px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: #fff; }
/* Light OpenStreetMap map in all views. In the heatmap the map is turned grey and faded,
   so the coloured density lines are the only strong colour on screen. */
#map { background: #e8e6e3; }
#map.heat .leaflet-tile-pane { filter: grayscale(1) contrast(0.75) brightness(1.1); }
.heat-canvas { position: absolute; pointer-events: none; }
.heat-legend { background: rgba(255, 255, 255, 0.92); color: #17141a; box-shadow: 0 1px 4px rgba(0,0,0,0.2); padding: 8px 10px; border-radius: 8px; font-size: 12px; min-width: 180px; }
.heat-legend .bar { height: 10px; border-radius: 3px; margin-bottom: 4px; }
.heat-legend .labels { display: flex; justify-content: space-between; }
.leaflet-tooltip.route-tip { font-weight: 650; font-size: 13px; border-radius: 8px; }

@media (max-width: 760px) {
  body { flex-direction: column-reverse; }
  #map { height: 52vh; flex: none; }
  #panel { width: 100%; height: 48vh; border-right: 0; border-top: 1px solid var(--line); }
  .brand { padding: 10px 14px; }
  .brand h1 { font-size: 18px; }
  .tagline { display: none; }
  #filters:not([open]) { padding-bottom: 0; }
  footer { display: none; }
  .timeline { left: 8px; right: 8px; bottom: 20px; gap: 8px; padding: 8px 10px 4px; }
  .tl-label { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .tl-count { display: none; }
  .tl-play { width: 34px; height: 34px; }
}
