*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  background: #0d0d0d;
  color: #f0f0f0;
  -webkit-font-smoothing: antialiased;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
}

input {
  font: inherit;
  color: inherit;
}

ul, ol {
  list-style: none;
}

#map {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #f5f5f5;
}

.route-focused {
  filter: drop-shadow(0 0 4px currentColor) drop-shadow(0 0 10px currentColor);
  transition: filter 0.2s ease;
  stroke-opacity: 1;
}

#action-bar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: stretch;
  width: calc(100% - 48px);
  max-width: 420px;
  height: 64px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(40px) saturate(200%) brightness(1.1);
  -webkit-backdrop-filter: blur(40px) saturate(200%) brightness(1.1);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.12) inset, 0 -1px 0 rgba(0, 0, 0, 0.25) inset, 0 16px 48px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.06);
}
#action-bar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.85);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}
#action-bar button:last-of-type {
  border-right: none;
}
#action-bar button:hover {
  color: rgb(0, 0, 0);
  background: rgba(0, 0, 0, 0.05);
}
#action-bar button.active {
  color: rgb(0, 0, 0);
  background: rgba(0, 0, 0, 0.08);
}
#action-bar button svg {
  width: 20px;
  height: 20px;
}
#action-bar #strava-btn {
  color: rgba(252, 76, 2, 0.75);
}
#action-bar #strava-btn:hover {
  color: #fc4c02;
  background: rgba(252, 76, 2, 0.1);
}
#action-bar #strava-btn.active {
  color: #fc4c02;
  background: rgba(252, 76, 2, 0.1);
}

#filter-panel {
  bottom: 92px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 48px);
  max-width: 420px;
}

#map.drag-over::after {
  content: "Drop GPX / FIT file";
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  pointer-events: none;
  z-index: 2000;
}

#filter-panel {
  position: fixed;
  z-index: 1000;
  padding: 16px;
  display: none;
  flex-direction: column;
  gap: 16px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(40px) saturate(200%) brightness(1.1);
  -webkit-backdrop-filter: blur(40px) saturate(200%) brightness(1.1);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.12) inset, 0 -1px 0 rgba(0, 0, 0, 0.25) inset, 0 16px 48px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.06);
}
#filter-panel.open {
  display: flex;
}

#filter-sports {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
#filter-sports button {
  padding: 4px 8px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.05);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
#filter-sports button:hover {
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.1);
}
#filter-sports button[data-sport=run].active {
  background: rgba(232, 39, 46, 0.25);
  border-color: rgba(232, 39, 46, 0.5);
  color: #e8272e;
  box-shadow: 0 0 12px rgba(232, 39, 46, 0.2);
}
#filter-sports button[data-sport=ride].active {
  background: rgba(245, 166, 35, 0.25);
  border-color: rgba(245, 166, 35, 0.5);
  color: #f5a623;
  box-shadow: 0 0 12px rgba(245, 166, 35, 0.2);
}
#filter-sports button[data-sport=hike].active {
  background: rgba(90, 158, 68, 0.25);
  border-color: rgba(90, 158, 68, 0.5);
  color: #5a9e44;
  box-shadow: 0 0 12px rgba(90, 158, 68, 0.2);
}
#filter-sports button[data-sport=kanu].active {
  background: rgba(0, 180, 216, 0.25);
  border-color: rgba(0, 180, 216, 0.5);
  color: #00b4d8;
  box-shadow: 0 0 12px rgba(0, 180, 216, 0.2);
}
#filter-sports button[data-sport=skitour].active {
  background: rgba(116, 143, 252, 0.25);
  border-color: rgba(116, 143, 252, 0.5);
  color: #748ffc;
  box-shadow: 0 0 12px rgba(116, 143, 252, 0.2);
}
#filter-sports button[data-sport=other].active {
  background: rgba(148, 163, 184, 0.25);
  border-color: rgba(148, 163, 184, 0.5);
  color: #94a3b8;
  box-shadow: 0 0 12px rgba(148, 163, 184, 0.2);
}

#filter-dates {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(0, 0, 0, 0.35);
  font-size: 11px;
}
#filter-dates input[type=date] {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 4px 8px;
  color: rgba(0, 0, 0, 0.8);
  font-size: 11px;
  flex: 1;
}
#filter-dates input[type=date]::-webkit-calendar-picker-indicator {
  filter: invert(0.6);
  cursor: pointer;
}

.activity-popup .leaflet-popup-content-wrapper {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(40px) saturate(200%) brightness(1.1);
  -webkit-backdrop-filter: blur(40px) saturate(200%) brightness(1.1);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.12) inset, 0 -1px 0 rgba(0, 0, 0, 0.25) inset, 0 16px 48px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.06);
  color: #f0f0f0;
  padding: 0;
}
.activity-popup .leaflet-popup-content {
  margin: 0;
}
.activity-popup .leaflet-popup-tip-container {
  display: none;
}

.popup-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  min-width: 160px;
}

.popup-sport {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.popup-sport--run {
  color: #e8272e;
}
.popup-sport--ride {
  color: #f5a623;
}
.popup-sport--hike {
  color: #5a9e44;
}
.popup-sport--kanu {
  color: #00b4d8;
}
.popup-sport--skitour {
  color: #748ffc;
}
.popup-sport--other {
  color: #94a3b8;
}

.popup-name {
  font-size: 13px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.popup-meta {
  font-size: 11px;
  color: rgba(0, 0, 0, 0.4);
}
