:root {
  --panel-bg: rgba(62, 62, 62, 0.78);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #f3f3f3;
  --accent: #1aa64a;
  --muted: #b7b7b7;
  --map-bg: #2f2f2f;
  --shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
  --panel-surface: rgba(90, 90, 90, 0.6);
  --panel-surface-strong: rgba(110, 110, 110, 0.65);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Montserrat", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, #4c4c4c, #3a3a3a 65%, #2f2f2f);
}

.app {
  display: grid;
  grid-template-columns: clamp(240px, 24vw, 380px) 1fr;
  min-height: 100vh;
}

.panel {
  background: var(--panel-bg);
  border-right: 1px solid var(--panel-border);
  padding: 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  /* gap: 16px; */
  max-height: 100vh;
  overflow: auto;
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  text-align: center;
  flex-wrap: wrap;
}

.brand__logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.brand__badge {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.brand__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}

.brand__title {
  font-family: "Montserrat", "Segoe UI", sans-serif;
  font-size: 26px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brand__subtitle {
  font-size: 12px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel__header h1 {
  margin: 0 0 6px;
  font-size: 26px;
  letter-spacing: 0.5px;
}

.panel__header {
  margin-bottom: 8px;
}

.panel__header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.panel__section h2 {
  margin: 0 0 10px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.panel__toggle {
  display: none;
  order: 99;
  align-self: center;
  margin-top: auto;
  /* margin-bottom: 8px; */
  width: 40px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 18px;
  background: rgba(234, 238, 241, 0.9);
  font-size: 20px;
  line-height: 1;
  color: #455056;
  cursor: pointer;
  box-shadow: inset 0 0 0 4px rgba(64, 77, 84, 0.15),
    0 10px 22px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(6px);
  position: sticky;
  bottom: 12px;
  z-index: 5;
}

.panel__toggle:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 4px rgba(64, 77, 84, 0.2),
    0 0 0 6px rgba(64, 77, 84, 0.18),
    0 10px 22px rgba(0, 0, 0, 0.3);
}

.control-list {
  display: grid;
  gap: 8px;
  font-size: 14px;
  padding-bottom: 8px;
}

.control-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  transition: background 0.2s ease;
}

.control-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.control-item input[type="checkbox"],
.control-item input[type="radio"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.control-group {
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 12px 12px;
  background: var(--panel-surface);
  backdrop-filter: blur(8px);
}

.control-group__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: bold;
  font-family: "Montserrat", "Segoe UI", sans-serif;
  letter-spacing: 0.03em;
}

.control-group__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex: 1 1 auto;
  white-space: normal;
}

.control-group__toggle {
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.control-group__toggle:hover {
  background: rgba(255, 255, 255, 0.15);
}

.control-group__toggle:active {
  transform: scale(0.96);
}

.control-group--collapsed .control-group__children {
  display: none;
}

.control-group--collapsed .control-group__title {
  margin-bottom: 0;
}

.control-group__children {
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.tour-label__line {
  display: block;
}

.map {
  background: var(--map-bg);
  position: relative;
  z-index: 0;
}

#map {
  width: 100%;
  height: 100vh;
  position: relative;
  --poi-size: 24px;
}

.historic-copyright {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.65);
  color: #fff;
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: 0.1px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 500;
  text-align: center;
  max-width: min(90%, 720px);
}

.historic-copyright--visible {
  opacity: 1;
}

.layer-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  flex: 0 0 12px;
}

.layer-swatch--line {
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: #1f7a8c;
}

.control-item--historic .layer-swatch--historic {
  background: #c64242;
}

.control-item--historic input[type="checkbox"]:checked + .layer-swatch--historic {
  background: #1aa64a;
}

.layer-badge {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 20px;
  border: 1px solid rgba(255, 255, 255, 0.65);
}

.layer-badge--media {
  padding: 0;
}

.layer-badge--icon-only {
  background: #ffffff;
  border: none;
}

.layer-badge__icon {
  width: 16px;
  height: 16px;
  display: block;
  object-fit: contain;
}

.control-group--large-icons .layer-badge {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  font-size: 13px;
}

.control-group--large-icons .layer-badge__icon {
  width: 20px;
  height: 20px;
}

.control-group--icon-20 .layer-badge {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.control-group--icon-20 .layer-badge__icon {
  width: 20px;
  height: 20px;
}

.control-group--icon-20 .layer-badge--media {
  background: #fff;
  border: 1px solid #fff;
}

.control-group--icon-20 .layer-badge--icon-only {
  background: #fff;
  border: 1px solid #fff;
}

.poi-marker {
  background: transparent;
  border: none;
}

.poi-marker__badge {
  width: var(--poi-size);
  height: var(--poi-size);
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: calc(var(--poi-size) / 2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fffaf3;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.poi-marker__badge--media {
  padding: 0;
}

.poi-marker__badge--icon-only {
  background: transparent;
  border: none;
  box-shadow: none;
  width: calc(var(--poi-size) + 2px);
  height: calc(var(--poi-size) + 2px);
}

.poi-marker__icon {
  width: calc(var(--poi-size) - 6px);
  height: calc(var(--poi-size) - 6px);
  display: block;
  object-fit: contain;
}

.poi-marker__badge--icon-only .poi-marker__icon {
  width: calc(var(--poi-size) + 2px);
  height: calc(var(--poi-size) + 2px);
}

.poi-cluster-icon {
  background: transparent;
  border: none;
}

.poi-cluster {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--cluster-fill);
  color: var(--cluster-text);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.3px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.22),
    0 8px 18px rgba(0, 0, 0, 0.25);
}

.poi-cluster span {
  display: block;
  line-height: 1;
}

.poi-popup {
  font-size: 13px;
  line-height: 1.35;
}

.poi-popup__label {
  font-size: 13px;
  color: #0a0912;
  font-weight: 700;
  margin-bottom: 6px;
}

.poi-popup__content {
  margin-bottom: 6px;
}

.poi-popup__link a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.poi-popup__link a:hover {
  text-decoration: underline;
}

.poi-popup__content a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.poi-popup__content a:hover {
  text-decoration: underline;
}

.poi-popup__source {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

.locate-button {
  font-size: 16px;
  line-height: 26px;
  text-align: center;
}

.leaflet-bar,
.leaflet-control-zoom {
  box-shadow: none !important;
  border: none !important;
  background: transparent !important;
}

.leaflet-bar a,
.leaflet-bar a.leaflet-disabled,
.leaflet-control-zoom a,
.leaflet-control-zoom a.leaflet-disabled {
  background: rgba(90, 90, 90, 0.65) !important;
  color: var(--text) !important;
  border: none !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18),
    0 6px 16px rgba(0, 0, 0, 0.2) !important;
  border-radius: 999px !important;
  width: 40px !important;
  height: 40px !important;
  line-height: 40px !important;
  backdrop-filter: blur(8px);
}

.leaflet-bar a:hover,
.leaflet-control-zoom a:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
}

.leaflet-bar a + a,
.leaflet-control-zoom a + a {
  border-top: none !important;
  margin-top: 6px;
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 48svh) 1fr;
    height: 100svh;
    min-height: 100svh;
  }

  .app.app--collapsed {
    grid-template-rows: minmax(0, 100px) 1fr;
  }

  .panel {
    position: relative;
    border-right: none;
    border-bottom: none;
    padding: 8px 18px 4px;
    max-height: none;
    height: 100%;
    min-height: 0;
    overflow: auto;
    transition: max-height 0.3s ease;
    gap: 8px;
  }

  .panel__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: auto;
    bottom: 6px;
  }

  .panel--collapsed {
    padding: 8px 18px 4px;
    gap: 2px;
    max-height: 100px;
    overflow: hidden;
  }

  .panel--collapsed .panel__toggle {
    order: 1;
    align-self: center;
    margin-top: 12px;
    height: 20px;
  }

  .panel--collapsed .panel__section {
    display: none;
  }

  .panel--collapsed .panel__header {
    margin-bottom: 2px;
  }

  #map {
    height: 100%;
  }
}
