:root {
  --bg: #0a0e1a;
  --panel: rgba(15, 23, 42, 0.86);
  --panel-solid: #0f172a;
  --border: rgba(148, 163, 184, 0.16);
  --text: #e7ecf5;
  --muted: #92a0b8;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --accent-contrast: #061019;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.6em 1em;
  z-index: 1000;
  border-radius: 0 0 8px 0;
  font-weight: 700;
}
.skip-link:focus { left: 0; }

#map {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #0a0e1a;
}

.leaflet-tile-pane {
  filter: invert(92%) hue-rotate(180deg) brightness(0.95) contrast(90%);
}

.leaflet-control-attribution {
  background: rgba(10, 14, 26, 0.75) !important;
  color: var(--muted) !important;
  backdrop-filter: blur(4px);
}
.leaflet-control-attribution a { color: var(--text) !important; }
.leaflet-control-zoom a {
  background: var(--panel-solid) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
.leaflet-control-zoom a:hover { background: #16213c !important; }

/* Top bar */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: linear-gradient(to bottom, rgba(6, 10, 20, 0.85), transparent);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 900;
  font-size: 0.85rem;
  box-shadow: var(--shadow);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.05rem; letter-spacing: 0.01em; }
.brand-sub {
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: none;
}
.brand-sub:hover { color: var(--accent); text-decoration: underline; }

.sidebar-toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.sidebar-toggle-icon {
  width: 14px;
  height: 10px;
  position: relative;
  display: inline-block;
}
.sidebar-toggle-icon::before,
.sidebar-toggle-icon::after,
.sidebar-toggle-icon {
  background: var(--text);
}
.sidebar-toggle-icon::before,
.sidebar-toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 14px;
  height: 2px;
  background: var(--text);
}
.sidebar-toggle-icon { height: 2px; top: 4px; }
.sidebar-toggle-icon::before { top: -4px; }
.sidebar-toggle-icon::after { top: 4px; }

/* Sidebar */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 15;
  width: 360px;
  max-width: 88vw;
  padding: 4.5rem 1rem 1rem;
  background: var(--panel);
  backdrop-filter: blur(14px);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}

.sidebar-inner {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-height: 0;
  flex: 1;
}

.sidebar-intro {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.search-input,
.year-input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-size: 0.88rem;
  font-family: inherit;
}
.search-input { width: 100%; }
.search-input::placeholder,
.year-input::placeholder { color: #5f6f8c; }
.search-input:focus,
.year-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

.year-filter {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.year-filter label { flex-shrink: 0; }
.year-input { width: 100%; min-width: 0; }

.empty-note {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

.maps-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.maps-list-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.maps-list-item:hover {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.35);
}
.maps-list-item.active {
  background: var(--accent);
  border-color: var(--accent);
}
.maps-list-item.active .maps-list-title,
.maps-list-item.active .maps-list-meta {
  color: var(--accent-contrast);
}

.maps-list-title { font-weight: 700; font-size: 0.92rem; }
.maps-list-meta { font-size: 0.76rem; color: var(--muted); }

/* Overlay info panel */

.overlay-panel {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 20;
  width: 300px;
  max-width: calc(100vw - 2rem);
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem 1rem;
  box-shadow: var(--shadow);
}

.overlay-info {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.overlay-title { font-weight: 700; font-size: 0.9rem; line-height: 1.35; }

.overlay-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  border-radius: 6px;
  flex-shrink: 0;
}
.overlay-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }

.overlay-slider-label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
#overlay-opacity { width: 100%; accent-color: var(--accent); }

.overlay-attrib {
  font-size: 0.7rem;
  color: var(--muted);
  margin: 0.5rem 0 0;
}

/* Mobile */

@media (max-width: 760px) {
  .sidebar-toggle { display: inline-flex; }

  .sidebar {
    transform: translateX(-100%);
    width: 86vw;
  }
  .sidebar.open { transform: translateX(0); }

  .overlay-panel {
    left: 1rem;
    right: 1rem;
    width: auto;
    bottom: 1rem;
  }
}
