.map-stage,
.map-panel,
.map-controls,
.map-controls__label,
.filter-chip,
.identifier,
.identifier__title,
.identifier__meta,
.identifier-nav,
.map-stage__status {
  font-family: var(--font-ui);
}

.map-panel {
  position: relative;
  min-width: 0;
  min-height: var(--commons-stage-min-height);
  height: 100%;
}

.map-stage {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: var(--commons-stage-min-height);
  border: 0;
  border-radius: 0;
  background: rgba(250, 249, 244, 0.14);
  overflow: hidden;
  box-shadow: none;
}

.map-ol-target {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.map-stage__terrain {
  position: absolute;
  inset: 0;
}

.map-stage__terrain {
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
  background:
    linear-gradient(rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.18)) 0 0 / 100% 100% no-repeat,
    linear-gradient(rgba(23, 29, 27, 0.05), rgba(23, 29, 27, 0.05)) 0 22% / 100% 1px no-repeat,
    linear-gradient(rgba(23, 29, 27, 0.04), rgba(23, 29, 27, 0.04)) 0 46% / 100% 1px no-repeat,
    linear-gradient(rgba(23, 29, 27, 0.05), rgba(23, 29, 27, 0.05)) 0 71% / 100% 1px no-repeat,
    linear-gradient(90deg, rgba(23, 29, 27, 0.04), rgba(23, 29, 27, 0.04)) 24% 0 / 1px 100% no-repeat,
    linear-gradient(90deg, rgba(23, 29, 27, 0.05), rgba(23, 29, 27, 0.05)) 50% 0 / 1px 100% no-repeat,
    linear-gradient(90deg, rgba(23, 29, 27, 0.04), rgba(23, 29, 27, 0.04)) 76% 0 / 1px 100% no-repeat;
}

.map-stage__terrain::before,
.map-stage__terrain::after {
  content: "";
  position: absolute;
  inset: 0;
}

.map-stage__terrain::before {
  background:
    linear-gradient(151deg, transparent 0 44.8%, rgba(255, 255, 255, 0.22) 45%, transparent 45.2%) 0 0 / 100% 100% no-repeat,
    linear-gradient(29deg, transparent 0 55.8%, rgba(255, 255, 255, 0.18) 56%, transparent 56.2%) 0 0 / 100% 100% no-repeat;
  opacity: 0.9;
}

.map-stage--fallback .map-stage__terrain {
  opacity: 1;
}

.map-stage--loading .map-stage__terrain {
  opacity: 0.72;
}

.map-stage__status {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 4;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--commons-line);
  border-radius: 999px;
  background: rgba(249, 247, 241, 0.84);
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}

.map-stage__status--error {
  border-color: rgba(150, 52, 52, 0.18);
  color: #8a3939;
}

.map-stage__status--fallback {
  border-color: rgba(83, 103, 116, 0.18);
  color: #415765;
}

.marker {
  position: absolute;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2.5px solid #f8f6f0;
  border-radius: 999px;
  background: var(--category-color);
  box-shadow:
    0 0 0 1px rgba(17, 17, 17, 0.18),
    0 10px 18px rgba(17, 17, 17, 0.12);
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
}

.marker:hover,
.marker:focus-visible,
.marker--active {
  transform: translate(-50%, -50%) scale(1.18);
  box-shadow:
    0 0 0 1px rgba(17, 17, 17, 0.24),
    0 0 0 10px color-mix(in srgb, var(--category-color) 22%, transparent),
    0 12px 24px rgba(17, 17, 17, 0.16);
}

.map-controls {
  display: grid;
  gap: 0.55rem;
  justify-items: stretch;
  align-self: end;
}

.map-stage__dock {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: calc(1rem + (var(--commons-page-gap, 1rem) * 0.65));
  z-index: 6;
  pointer-events: none;
  transition: opacity 160ms ease, transform 180ms ease;
}

.map-controls__block {
  width: 100%;
  display: grid;
  gap: 0.55rem;
  pointer-events: auto;
}

.map-controls__label {
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  color: rgba(29, 37, 34, 0.84);
  text-transform: uppercase;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.filter-chip {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid color-mix(in srgb, var(--category-color) 35%, rgba(23, 29, 27, 0.16));
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  color: #171717;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    opacity 160ms ease;
}

.filter-chip--active {
  background: color-mix(in srgb, var(--category-color) 14%, white);
  border-color: var(--category-color);
  color: var(--category-color);
}

.identifier-wrapper {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid rgba(16, 22, 20, 0.16);
  border-radius: 22px;
  background: rgba(248, 246, 241, 0.96);
  backdrop-filter: blur(10px);
  box-shadow: 0 16px 38px rgba(12, 18, 17, 0.16);
}

.identifier-nav {
  width: 40px;
  height: 40px;
  border: 1px solid var(--commons-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  color: #171717;
  cursor: pointer;
}

.identifier-track {
  display: flex;
  gap: 0.9rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.identifier-track::-webkit-scrollbar {
  display: none;
}

.identifier {
  min-width: 240px;
  display: grid;
  gap: 0.34rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid color-mix(in srgb, var(--category-color) 26%, rgba(18, 24, 22, 0.14));
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  text-align: left;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    opacity 160ms ease;
}

.identifier--active {
  border-color: var(--category-color);
  background: color-mix(in srgb, var(--category-color) 18%, white);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--category-color) 34%, transparent),
    0 14px 28px rgba(17, 17, 17, 0.12);
}

.identifier__title {
  font-size: 1.05rem;
  line-height: 1.12;
}

.identifier__meta {
  font-size: 0.84rem;
  color: rgba(58, 66, 63, 0.86);
  line-height: 1.3;
}

.map-ol-target .ol-viewport,
.map-ol-target .ol-overlaycontainer,
.map-ol-target .ol-overlaycontainer-stopevent,
.map-ol-target .ol-layers,
.map-ol-target .ol-layer {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
}

.map-ol-target .ol-viewport,
.map-ol-target .ol-overlaycontainer,
.map-ol-target .ol-overlaycontainer-stopevent,
.map-ol-target .ol-layers,
.map-ol-target .ol-layer {
  border-radius: 0;
}

/* GANZ WICHTIG: canvas NICHT zwangsweise auf 100% strecken */
.map-ol-target canvas {
  max-width: none !important;
  max-height: none !important;
}

.ol-zoom {
  display: none !important;
}

.map-stage__attribution-fallback[hidden] {
  display: none !important;
}

.map-ol-target .ol-attribution,
.map-stage__attribution-fallback {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  left: auto;
  top: auto;
  z-index: 5;
  max-width: calc(100% - 2rem);
  width: auto;
  height: auto;
  padding: 0.42rem 0.68rem;
  border: 1px solid rgba(23, 29, 27, 0.12);
  border-radius: 999px;
  background: rgba(249, 247, 241, 0.92);
  color: rgba(23, 29, 27, 0.78);
  font-size: 0.72rem;
  line-height: 1.2;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 20px rgba(17, 17, 17, 0.08);
}

.map-ol-target .ol-attribution {
  inset: auto !important;
  top: auto !important;
  right: 1rem !important;
  bottom: 1rem !important;
  left: auto !important;
  width: auto !important;
  height: auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  pointer-events: auto !important;
}

.map-ol-target .ol-attribution.ol-collapsed,
.map-ol-target .ol-attribution:not(.ol-collapsed) {
  background: rgba(249, 247, 241, 0.92);
}

.map-ol-target .ol-attribution ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.map-ol-target .ol-attribution li {
  margin: 0;
}

.map-ol-target .ol-attribution button {
  display: none !important;
}

@media (max-width: 1180px) {
  .map-stage {
    min-height: var(--commons-stage-min-height);
  }

  .map-stage__dock {
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(var(--commons-footer-height, 56px) + 5rem + env(safe-area-inset-bottom, 0px));
  }

  .map-controls__label {
    font-size: 0.72rem;
  }

  .identifier-wrapper {
    gap: 0.5rem;
    padding: 0.65rem;
    background: rgba(248, 246, 241, 0.94);
  }

  .identifier {
    min-width: 190px;
    background: rgba(255, 255, 255, 0.92);
  }

  .commons-map-page.is-mobile-filters-open .map-controls,
  .commons-map-page.is-mobile-detail-open .map-controls {
    opacity: 0;
    transform: translateY(0.9rem);
    pointer-events: none;
  }
}

@media (max-width: 720px) {
  .map-stage__status,
  .map-ol-target .ol-attribution,
  .map-stage__attribution-fallback {
    right: 0.75rem;
  }

  .map-stage {
    border-radius: 0;
    min-height: var(--commons-stage-min-height);
  }

  .map-stage__dock {
    left: 0.5rem;
    right: 0.5rem;
    bottom: calc(var(--commons-footer-height, 56px) + 4.6rem + env(safe-area-inset-bottom, 0px));
  }

  .identifier-wrapper {
    gap: 0.35rem;
    padding: 0.5rem;
    border-radius: 18px;
  }

  .identifier-nav {
    width: 34px;
    height: 34px;
  }

  .identifier {
    min-width: 142px;
    padding: 0.58rem 0.62rem;
  }

  .identifier__title {
    font-size: 0.94rem;
  }

  .identifier__meta {
    font-size: 0.76rem;
  }

  .map-ol-target .ol-attribution,
  .map-stage__attribution-fallback {
    right: 0.75rem;
    bottom: 0.75rem;
    max-width: calc(100% - 1.5rem);
  }
}

.map-ol-target .ol-attribution a,
.map-stage__attribution-fallback a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}
