[data-page="katalog-gpx"] {
  --gpx-gap: 20px;
  --gpx-card-radius: 8px;
  --gpx-card-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding-bottom: var(--gpx-gap);
}

.route-title,
.gpx-card {
  background: #fff;
  border-radius: var(--gpx-card-radius);
  box-shadow: var(--gpx-card-shadow);
}

.route-title {
  padding: 16px 20px;
}

.route-title .page-title {
  margin: 0;
}

.katalog-gpx-map-container,
.katalog-gpx-sections,
.katalog-gpx-overview,
[data-page="katalog-gpx"] .route-description,
.gpx-mapbox-card,
[data-page="katalog-gpx"] .gallery-container {
  margin-top: var(--gpx-gap);
}

.katalog-gpx-map-container {
  height: 550px;
  min-height: 0;
  margin-bottom: 0;
}

.katalog-gpx-canvas {
  width: 100%;
  height: 100%;
  border-radius: var(--gpx-card-radius);
  box-shadow: var(--gpx-card-shadow);
}

.gpx-card {
  padding: 16px 20px 20px;
}

.gpx-card__title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.katalog-gpx-overview {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: var(--gpx-gap);
  align-items: stretch;
}

.katalog-gpx-overview--facts-only {
  grid-template-columns: minmax(0, 1fr);
}

.gpx-profile {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.gpx-profile__chart {
  position: relative;
  flex: 1 1 auto;
  min-height: 240px;
}

.gpx-facts {
  display: flex;
  flex-direction: column;
}

.katalog-gpx-overview--facts-only .gpx-facts__list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gpx-facts__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.katalog-gpx-overview--facts-only .gpx-facts__actions {
  flex-direction: row;
  flex-wrap: wrap;
}

.gpx-facts__actions .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: normal;
  text-align: center;
}

.katalog-gpx-overview--facts-only .gpx-facts__actions .btn {
  flex: 1 1 220px;
}

[data-page="katalog-gpx"] .route-description {
  padding: 20px;
  overflow-wrap: anywhere;
}

[data-page="katalog-gpx"] .route-description > :first-child {
  margin-top: 0;
}

[data-page="katalog-gpx"] .route-description > :last-child {
  margin-bottom: 0;
}

[data-page="katalog-gpx"] .route-description img,
[data-page="katalog-gpx"] .route-description iframe {
  max-width: 100%;
}

.route-description__intro {
  font-size: 16px;
  line-height: 1.6;
}

.map-container--mapbox {
  position: relative;
  height: 550px;
  min-height: 0;
  margin: 0;
}

.map-container--mapbox .gpx-mapbox__canvas {
  width: 100%;
  height: 100%;
  background: #f3f4f6;
  overflow: hidden;
  border-radius: var(--gpx-card-radius);
}

.katalog-gpx-gallery-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gpx-gap);
  margin: 0;
  clear: both;
}

.katalog-gpx-gallery-row::before,
.katalog-gpx-gallery-row::after {
  content: none;
}

.gallery-header {
  margin-bottom: var(--gpx-gap);
  text-align: center;
}

.gallery-header h2 {
  margin: 0 0 12px;
}

.gallery-header__description {
  max-width: 960px;
  margin: 0 auto;
  line-height: 1.6;
}

.gallery-header__description .btn {
  margin: 8px 0;
}

.gpx-gallery-card__distance {
  color: var(--brand-link-primary-color);
  font-size: 12px;
  font-weight: 600;
}

.gpx-gallery-modal__image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.gpx-mapbox__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  border-radius: var(--gpx-card-radius);
  pointer-events: auto;
  z-index: 3;
}

.gpx-mapbox__overlay[hidden] {
  display: none;
}

.gpx-mapbox__preview {
  border: none;
  background: transparent;
  cursor: pointer;
  color: #111827;
  font: inherit;
  padding: 0;
}

.gpx-mapbox__preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--gpx-card-radius);
  filter: brightness(0.92);
  transition: filter 0.2s ease;
}

.gpx-mapbox__preview:hover img,
.gpx-mapbox__preview:focus-visible img {
  filter: brightness(1);
}

.gpx-mapbox__preview-label {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.75);
  color: #fff;
  font-weight: 600;
}

.map-container--mapbox .gpx-mapbox__loader,
.map-container--mapbox .gpx-mapbox__error {
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  font-weight: 600;
  font-size: 16px;
}

.map-container--mapbox .gpx-mapbox__error {
  background: rgba(248, 113, 113, 0.92);
  color: #7f1d1d;
}

.map-container--mapbox.is-failed {
  height: auto;
}

.map-container--mapbox.is-failed .gpx-mapbox__canvas {
  display: none;
}

.map-container--mapbox.is-failed .gpx-mapbox__error {
  position: static;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 15px;
}

.gpx-mapbox__marker {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--gpx-route-color, #263442);
  border-radius: 50%;
  background: #fff;
  color: #233242;
  box-shadow: 0 2px 6px #10182266;
  pointer-events: none;
}

.gpx-mapbox__heading {
  position: absolute;
  inset: -1px;
}

.gpx-mapbox__heading::before {
  content: '';
  position: absolute;
  bottom: calc(100% - 1px);
  left: calc(50% - 4px);
  border: solid transparent;
  border-width: 0 4px 6px;
  border-bottom-color: var(--gpx-route-color, #263442);
}

.gpx-mapbox__elevation {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 7px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 5px #10182255;
  font: 600 11px/1.4 system-ui, sans-serif;
  white-space: nowrap;
}

.gpx-mapbox__figure {
  width: 28px;
  height: 28px;
}

.gpx-mapbox__marker.is-facing-left .gpx-mapbox__figure {
  transform: scaleX(-1);
}

@media (prefers-reduced-motion: no-preference) {
  .gpx-mapbox__wheel,
  .gpx-mapbox__crank,
  .gpx-mapbox__pulse,
  .gpx-mapbox__limb {
    transform-box: fill-box;
    transform-origin: center;
  }

  .gpx-mapbox__marker.is-playing .gpx-mapbox__wheel,
  .gpx-mapbox__marker.is-playing .gpx-mapbox__crank {
    animation: gpx-mapbox-spin 1.4s linear infinite;
  }

  .gpx-mapbox__marker.is-playing .gpx-mapbox__bob {
    animation: gpx-mapbox-bob .7s ease-in-out infinite alternate;
  }

  .gpx-mapbox__marker.is-playing .gpx-mapbox__limb {
    transform-origin: center top;
    animation: gpx-mapbox-stride .48s ease-in-out infinite alternate;
  }

  .gpx-mapbox__marker.is-playing .gpx-mapbox__limb--back {
    animation-direction: alternate-reverse;
  }

  .gpx-mapbox__marker.is-playing .gpx-mapbox__pulse {
    animation: gpx-mapbox-pulse .9s ease-in-out infinite alternate;
  }
}

@keyframes gpx-mapbox-spin {
  to { transform: rotate(1turn); }
}

@keyframes gpx-mapbox-bob {
  to { transform: translateY(1px); }
}

@keyframes gpx-mapbox-stride {
  from { transform: rotate(-17deg); }
  to { transform: rotate(17deg); }
}

@keyframes gpx-mapbox-pulse {
  to { transform: scale(1.18); opacity: .7; }
}

.gpx-mapbox__controls {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 2px;
  width: 368px;
  padding: 3px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 1px 5px #17253640;
  color: #233242;
  font-size: 12px;
  line-height: 1;
}

.gpx-mapbox__actions {
  display: contents;
}

.gpx-mapbox__actions[hidden] {
  display: none;
}

.gpx-mapbox__button,
.gpx-mapbox__speed {
  box-sizing: border-box;
  flex: none;
  width: 28px;
  height: 28px;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.gpx-mapbox__button {
  display: grid;
  place-items: center;
}

.gpx-mapbox__speed {
  width: 42px;
  padding-left: 3px;
  font-weight: 600;
}

.gpx-mapbox__button:hover,
.gpx-mapbox__speed:hover {
  background: #e8edf0;
}

.gpx-mapbox__button[aria-pressed="true"] {
  background: #dae8ee;
  color: #184e65;
  box-shadow: inset 0 0 0 1px #b4cbd5;
}

.gpx-mapbox__controls :focus-visible {
  outline: 2px solid #166591;
  outline-offset: -2px;
}

.gpx-mapbox__controls .gpx-mapbox__slider {
  flex: 1 1 0;
  min-width: 0;
  height: 24px;
  margin: 0;
  cursor: pointer;
  accent-color: #235a72;
}

.gpx-mapbox__controls.is-narrow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(0, 1.5fr) repeat(5, minmax(0, 1fr));
  width: 258px;
}

.gpx-mapbox__controls.is-narrow .gpx-mapbox__slider {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 100%;
}

.gpx-mapbox__controls.is-collapsed {
  display: flex;
  width: max-content;
}

.poi-popup h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.poi-popup p {
  margin: 0 0 6px;
}

.poi-popup__image {
  display: block;
  max-width: 260px;
  height: auto;
  margin: 8px 0;
  border-radius: 8px;
}

.custom-map-control-button {
  height: 40px;
  margin: 10px;
  padding: 0 0.5em;
  overflow: hidden;
  background-color: #fff;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 1px 4px -1px rgba(0, 0, 0, 0.3);
  font: 400 18px Roboto, Arial, sans-serif;
  cursor: pointer;
}

.custom-map-control-button:hover {
  background: #ebebeb;
}

#street-view {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 1000;
  width: 80%;
  height: 80%;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transform: translate(-50%, -50%);
}

#close-street-view {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1001;
  width: 30px;
  height: 30px;
  color: #fff;
  background-color: var(--brand-primary-color);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.gpx-mobile-accordion__toggle {
  display: none;
}

@media (max-width: 1199px) {
  .katalog-gpx-gallery-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 991px) {
  .katalog-gpx-overview {
    grid-template-columns: minmax(0, 1fr);
  }

  .gpx-facts__list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .gpx-facts__actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .gpx-facts__actions .btn {
    flex: 1 1 220px;
  }

  .katalog-gpx-gallery-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  [data-page="katalog-gpx"] {
    --gpx-gap: 14px;
  }

  .route-title {
    padding: 12px 14px;
  }

  .gpx-card,
  [data-page="katalog-gpx"] .route-description {
    padding: 14px;
  }

  .katalog-gpx-map-container {
    height: 360px;
  }

  .map-container--mapbox {
    height: 420px;
  }

  .gpx-profile__chart {
    min-height: 200px;
  }

  .gpx-facts__list,
  .katalog-gpx-overview--facts-only .gpx-facts__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gpx-facts__actions {
    flex-direction: column;
  }

  .gpx-facts__actions .btn {
    flex: 0 0 auto;
  }

  .gpx-mobile-accordion {
    background: #fff;
    border: 1px solid rgba(121, 171, 43, 0.28);
    border-radius: var(--brand-radius);
    overflow: hidden;
  }

  .gpx-mobile-accordion__toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 42px;
    padding: 8px 10px;
    color: var(--brand-primary-color);
    background: #fff;
    border: 0;
    font-weight: 700;
    text-align: left;
  }

  .gpx-mobile-accordion__title {
    flex: 0 0 auto;
  }

  .gpx-mobile-accordion__summary {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--brand-text-primary-color);
    font-weight: 600;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .gpx-mobile-accordion__icon {
    flex: 0 0 auto;
    margin-left: auto;
    font-size: 15px;
  }

  .gpx-mobile-accordion:not(.is-open) > [data-gpx-mobile-accordion-panel] {
    display: none !important;
  }

  .gpx-mobile-accordion.is-open > [data-gpx-mobile-accordion-panel] {
    max-height: min(55vh, 360px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px;
    border-top: 1px solid rgba(121, 171, 43, 0.18);
  }

  .gpx-mobile-accordion .section-sidebar {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .gpx-mobile-accordion .section-item {
    min-height: 38px;
    padding: 4px 38px 4px 6px;
    gap: 8px;
    font-size: 14px;
  }

  .gpx-mobile-accordion .section-icon {
    width: 28px;
    height: 28px;
  }

  .gpx-mobile-accordion .section-icon--glyph i {
    font-size: 15px;
  }

  .gpx-mobile-accordion .section-count {
    top: 4px;
    left: -12px;
    width: 17px;
    height: 17px;
    font-size: 9px;
  }

  .gpx-mobile-accordion .section-button {
    right: 4px;
    width: 28px;
    height: 28px;
  }

  .gpx-mobile-accordion .section-button i {
    font-size: 13px;
  }
}

@media (max-width: 575px) {
  .katalog-gpx-gallery-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.route-info,
.route-description,
#elevation-profile {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.katalog-gpx-meta-row {
  margin-top: 8px;
}

#elevation-profile {
  width: 100%;
  height: 250px;
  padding: 15px;
}

.route-info {
  padding: 20px;
  margin-bottom: 20px;
  min-height: 250px;
}

.route-description {
  padding: 20px;
}

.stats {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-item i {
  color: #4d7a2b;
  font-size: 1.2em;
}

@media (max-width: 767px) {
  .route-info {
    min-height: 0;
  }
}
