html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

#map {
  width: 100%;
  height: 100vh;
  background: #e9e6df;
}

/* Верхня панель проєкту */
.project-header {
  position: absolute;
  top: 18px;
  left: 58px;
  z-index: 1000;
  max-width: 560px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 9px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

.project-header-inner {
  display: flex;
  align-items: center;
  gap: 14px;
}

.project-logo-wrap {
  flex: 0 0 auto;
}

.project-logo {
  display: block;
  width: 92px;
  height: auto;
}

.project-text-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

.project-name {
  margin-bottom: 4px;
  color: #7a6a53;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-header h1 {
  margin: 0;
  color: #262626;
  font-size: 20px;
  font-weight: 650;
  line-height: 1.25;
}

.subtitle {
  margin-top: 5px;
  color: #666;
  font-size: 13px;
  line-height: 1.35;
}

/* Панель керування */
.map-panel {
  width: 270px;
  padding: 14px 15px;
  color: #333;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.22);
  transition:
    width 0.2s ease,
    padding 0.2s ease;
}

.map-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.map-panel-title {
  margin: 0;
  color: #2d351f;
  font-size: 15px;
  font-weight: 650;
}

.panel-toggle {
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  padding: 0;
  color: #555;
  background: #faf9f7;
  border: 1px solid #c8c0b3;
  border-radius: 5px;
  font-size: 18px;
  line-height: 23px;
  cursor: pointer;
}

.panel-toggle:hover {
  background: #efebe5;
}

.map-panel-content {
  margin-top: 13px;
}

.map-panel.collapsed {
  width: auto;
  min-width: 0;
  padding: 9px 10px;
}

.map-panel.collapsed .map-panel-content {
  display: none;
}

.map-panel.collapsed .map-panel-title {
  font-size: 13px;
}

.control-section {
  margin-bottom: 15px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e7e3da;
}

.control-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.control-label {
  display: block;
  margin-bottom: 8px;
  color: #42463c;
  font-size: 13px;
  font-weight: 650;
}

/* Перемикачі */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 26px;
  color: #444;
  font-size: 13px;
}

.layer-toggle-row {
  margin-top: 9px;
}

.layer-toggle-row:first-of-type {
  margin-top: 0;
}

.layer-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.layer-swatch {
  display: inline-block;
  flex: 0 0 auto;
  width: 25px;
}

.bike-route-swatch {
  height: 5px;
  background: #3f7024;
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9);
}

.old-border-swatch {
  height: 4px;
  background:
    repeating-linear-gradient(
      to right,
      #b63b2c 0,
      #b63b2c 8px,
      transparent 8px,
      transparent 13px
    );
}

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 22px;
}

.switch input {
  width: 0;
  height: 0;
  opacity: 0;
}

.slider-switch {
  position: absolute;
  inset: 0;
  background: #bbb;
  border-radius: 22px;
  cursor: pointer;
  transition: 0.2s;
}

.slider-switch::before {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  content: "";
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: 0.2s;
}

.switch input:checked + .slider-switch {
  background: #566d2a;
}

.switch input:checked + .slider-switch::before {
  transform: translateX(20px);
}

/* Прозорість */
input[type="range"] {
  width: 100%;
  cursor: pointer;
  accent-color: #566d2a;
}

.opacity-value {
  margin-top: 3px;
  color: #777;
  font-size: 12px;
  text-align: right;
}

/* Кнопки */
.control-button {
  width: 100%;
  padding: 9px 10px;
  color: #333;
  background: #faf9f7;
  border: 1px solid #c8c0b3;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.control-button:hover {
  color: #2f4018;
  background: #efebe5;
  border-color: #9f947f;
}

.control-button.active {
  color: #fff;
  background: #566d2a;
  border-color: #566d2a;
}

.control-button + .control-button {
  margin-top: 7px;
}

/* Підписи режиму порівняння */
.comparison-label {
  position: absolute;
  top: 112px;
  z-index: 900;
  padding: 6px 10px;
  color: #333;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 5px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.15);
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
}

#modern-label {
  left: 20px;
}

#historical-label {
  right: 20px;
}

/* Tooltip маршрутів */
.route-tooltip {
  padding: 5px 8px;
  color: #263217;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(49, 70, 19, 0.25);
  border-radius: 4px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.15);
  font-size: 12px;
  font-weight: 600;
}

/* Leaflet */
.leaflet-control-zoom {
  margin-top: 18px !important;
}

.leaflet-control-attribution {
  font-size: 10px;
}

.leaflet-sbs-range {
  z-index: 999 !important;
}

/* Планшет */
@media (max-width: 900px) {
  .project-header {
    max-width: 480px;
  }

  .project-logo {
    width: 80px;
  }

  .project-header h1 {
    font-size: 18px;
  }
}

/* Мобільна версія */
@media (max-width: 700px) {
  .project-header {
    top: 10px;
    left: 52px;
    right: auto;
    max-width: none;
    padding: 5px;
    border-radius: 8px;
  }

  .project-header-inner {
    display: block;
  }

  .project-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
  }

  .project-text-wrap {
    display: none;
  }

  .map-panel {
    width: 205px;
    padding: 10px 11px;
  }

  .map-panel.collapsed {
    width: auto;
    padding: 8px 9px;
  }

  .map-panel-title {
    font-size: 13px;
  }

  .panel-toggle {
    width: 24px;
    height: 24px;
    font-size: 16px;
    line-height: 20px;
  }

  .control-section {
    margin-bottom: 11px;
    padding-bottom: 10px;
  }

  .control-label,
  .toggle-row {
    font-size: 12px;
  }

  .control-button {
    padding: 8px;
    font-size: 12px;
  }

  .opacity-value {
    font-size: 11px;
  }

  .comparison-label {
    top: 88px;
    padding: 5px 8px;
    font-size: 11px;
  }

  #modern-label {
    left: 8px;
  }

  #historical-label {
    right: 8px;
  }

  .layer-swatch {
    width: 21px;
  }
}