.karte-page {
  --karte-bg-a: #eff6ff;
  --karte-bg-b: #ecfdf5;
  --karte-card: #ffffff;
  --karte-border: rgba(15, 23, 42, 0.12);
  --karte-shadow: 0 18px 42px rgba(2, 6, 23, 0.09);
  --karte-text: #0f172a;
  --karte-accent: #2563eb;
  --karte-accent-deep: #1d4ed8;
  --karte-marker: #e3006e;
  --karte-marker-deep: #c1005f;
  --karte-marker-light: #ff4fa0;

  display: flex;
  flex-direction: column;
  gap: 11px;
  color: var(--karte-text);
  background:
    radial-gradient(1200px 540px at 100% 0%, rgba(124, 58, 237, 0.16), transparent 66%),
    radial-gradient(860px 480px at 0% 8%, rgba(16, 185, 129, 0.14), transparent 68%),
    linear-gradient(140deg, var(--karte-bg-a), var(--karte-bg-b));
  border-radius: 18px;
  border: 1px solid var(--karte-border);
  box-shadow: var(--karte-shadow);
  padding: 13px;
  overflow: hidden;
}

.karte-head {
  display: flex;
  flex-direction: column;
}

.karte-title {
  margin: 0;
  font-size: 27px;
  font-weight: 850;
  letter-spacing: 0.01em;
}

.karte-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 13px;
  padding: 8px 10px;
  backdrop-filter: blur(4px);
}

.karte-toolbar-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.karte-toolbar-row-main {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 10px;
}

.karte-filter-group {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  justify-self: start;
}

.karte-filter-label {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  font-size: 14px;
  font-weight: 800;
  color: rgba(15, 23, 42, 0.72);
  margin-right: 2px;
  line-height: 1;
}

.karte-filter-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.karte-filter-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.karte-filter-pill span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(100, 116, 139, 0.33);
  background: linear-gradient(180deg, #f8fafc 0%, #e8f3ee 100%);
  color: #166534;
  font-size: 12px;
  font-weight: 800;
  transition:
    transform 0.12s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.karte-filter-pill input:not(:checked) + span {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.88);
}

.karte-filter-pill input:checked + span {
  border-color: rgba(21, 128, 61, 0.88);
  background: linear-gradient(180deg, #1fb95f 0%, #15914a 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    0 2px 6px rgba(21, 128, 61, 0.22);
  color: #ffffff;
}

.karte-filter-pill:hover span {
  transform: translateY(-1px);
  filter: saturate(1.03);
}

.karte-filter-pill input:not(:checked) + span:hover {
  border-color: rgba(22, 163, 74, 0.5);
  background: linear-gradient(180deg, #f8fafc 0%, #dff1e8 100%);
}

.karte-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    transform 0.14s ease,
    filter 0.14s ease,
    box-shadow 0.2s ease;
}

.karte-btn [data-lucide],
.karte-btn svg {
  width: 22px !important;
  height: 22px !important;
}

.karte-btn:hover {
  transform: translateY(-1px);
  filter: brightness(0.98);
}

.karte-btn:disabled {
  cursor: default;
  opacity: 0.6;
  transform: none;
}

.karte-btn-reload {
  border-color: rgba(15, 23, 42, 0.2);
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
  color: #334155;
}

.karte-search-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  justify-self: center;
}

.karte-search-input {
  height: 34px;
  width: clamp(240px, 36vw, 390px);
  min-width: 180px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.2);
  background: rgba(255, 255, 255, 0.94);
  padding: 0 10px;
  font-size: 12px;
  color: #0f172a;
  outline: none;
}

.karte-search-input:focus {
  border-color: rgba(124, 58, 237, 0.45);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.karte-btn-search {
  border-color: rgba(15, 23, 42, 0.2);
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
  color: #334155;
}

.karte-summary {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
}

.karte-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(15, 23, 42, 0.11);
  background: rgba(15, 23, 42, 0.04);
}

.karte-pill strong {
  color: #0f172a;
}

.karte-map-card {
  position: relative;
  background: var(--karte-card);
  border-radius: 16px;
  border: 1px solid var(--karte-border);
  box-shadow: 0 14px 30px rgba(2, 6, 23, 0.09);
  padding: 10px;
}

.karte-map {
  height: min(66vh, 760px);
  min-height: 460px;
  border-radius: 13px;
  border: 1px solid var(--karte-border);
}

.karte-map .leaflet-control-zoom a {
  font-weight: 700;
}

.karte-map .leaflet-popup-content-wrapper {
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.15);
}

.karte-popup {
  min-width: 176px;
  color: #0f172a;
}

.karte-popup-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 800;
}

.karte-popup-sub {
  margin: 0;
  color: rgba(15, 23, 42, 0.75);
  font-size: 12px;
}

.karte-popup-sub-accent {
  display: inline-flex;
  align-items: center;
  margin-top: 2px;
  padding: 2px 8px;
  border-radius: 7px;
  color: #166534;
  font-weight: 800;
  font-size: 12.5px;
  line-height: 1.3;
  letter-spacing: 0.01em;
  border: 1px solid rgba(22, 163, 74, 0.24);
  background: rgba(187, 247, 208, 0.46);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
}

.karte-popup-meta {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(15, 23, 42, 0.9);
  line-height: 1.42;
}

.karte-map .leaflet-popup-close-button {
  top: 7px !important;
  right: 7px !important;
  width: 26px !important;
  height: 26px !important;
  padding: 0 !important;
  box-sizing: border-box;
  border-radius: 8px;
  display: grid !important;
  place-items: center;
  text-align: center;
  font-size: 0 !important;
  line-height: 1 !important;
  font-weight: 700;
  color: #14532d !important;
  background: rgba(187, 247, 208, 0.55);
  border: 1px solid rgba(22, 163, 74, 0.28);
  transition:
    transform 0.14s ease,
    background 0.18s ease,
    box-shadow 0.2s ease,
    color 0.18s ease;
}

.karte-map .leaflet-popup-close-button::before {
  content: "×";
  display: block;
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
  transform: translateY(-1px);
}

.karte-map .leaflet-popup-close-button:hover {
  transform: translateY(-1px);
  color: #ffffff !important;
  background: #f35454;
  border-color: #ce3d3d;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
}

.karte-map .leaflet-popup-close-button:focus-visible {
  outline: 2px solid rgba(22, 163, 74, 0.45);
  outline-offset: 1px;
}

.karte-country-outline,
.karte-outside-mask {
  pointer-events: none;
}

.karte-house-marker {
  width: 22px;
  height: 22px;
  margin-left: -11px;
  margin-top: -11px;
}

.karte-house-marker .karte-marker-core {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: linear-gradient(
    180deg,
    var(--karte-marker-light) 0%,
    var(--karte-marker) 64%,
    var(--karte-marker-deep) 100%
  );
  border: 1px solid rgba(136, 0, 66, 0.62);
  box-shadow:
    0 5px 10px rgba(227, 0, 110, 0.32),
    0 0 0 1px rgba(255, 255, 255, 0.68);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: rotate(45deg);
  transition:
    transform 0.14s ease,
    box-shadow 0.16s ease,
    filter 0.16s ease;
}

.karte-house-marker svg {
  width: 12px;
  height: 12px;
  transform: rotate(-45deg);
}

.karte-house-marker.is-plz .karte-marker-core {
  background: linear-gradient(180deg, #ff7cb9 0%, #ff2f92 66%, #cf005f 100%);
}

.karte-house-marker.is-hover .karte-marker-core,
.karte-house-marker:hover .karte-marker-core {
  transform: rotate(45deg) scale(1.08);
  filter: saturate(1.08);
  box-shadow:
    0 8px 14px rgba(227, 0, 110, 0.45),
    0 0 0 2px rgba(255, 255, 255, 0.76);
}

.karte-house-marker.is-focus .karte-marker-core {
  box-shadow:
    0 0 0 3px rgba(227, 0, 110, 0.28),
    0 8px 14px rgba(227, 0, 110, 0.45),
    0 0 16px rgba(227, 0, 110, 0.42);
  transform: rotate(45deg) scale(1.12);
}

.karte-cluster {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 126, 184, 0.95), rgba(227, 0, 110, 0.95));
  border: 1px solid rgba(136, 0, 66, 0.72);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.75),
    0 0 11px rgba(227, 0, 110, 0.42),
    0 7px 13px rgba(136, 0, 66, 0.4);
  overflow: hidden;
}

.karte-cluster span {
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transform: translateY(-0.5px);
}

.karte-fullscreen-btn {
  width: 42px !important;
  height: 42px !important;
  line-height: 42px !important;
  padding: 0 !important;
  border-radius: 10px;
  border: 1px solid rgba(227, 0, 110, 0.66);
  background: linear-gradient(180deg, rgba(255, 126, 184, 0.96), rgba(227, 0, 110, 0.95));
  color: #fff;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.8),
    0 0 14px rgba(227, 0, 110, 0.52),
    0 7px 12px rgba(136, 0, 66, 0.42);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.karte-fullscreen-btn:hover {
  transform: translateY(-1px) scale(1.03);
}

.karte-fullscreen-btn svg {
  width: 34px !important;
  height: 34px !important;
  display: block;
}

.leaflet-bar .karte-fullscreen-btn {
  width: 42px !important;
  height: 42px !important;
  line-height: 42px !important;
  padding: 0 !important;
}

.karte-map-card:fullscreen {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
}

.karte-map-card:fullscreen .karte-map {
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  border: 0;
  border-radius: 0;
}

.karte-map-card:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
}

.karte-map-card:-webkit-full-screen .karte-map {
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
}

@media (max-width: 1000px) {
  .karte-toolbar-row-main {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .karte-filter-group,
  .karte-search-wrap,
  .karte-summary {
    justify-self: stretch;
  }

  .karte-search-wrap,
  .karte-summary {
    justify-content: flex-start;
  }

  .karte-map {
    min-height: 420px;
    height: 60vh;
  }
}

@media (max-width: 760px) {
  .karte-page {
    padding: 11px;
    border-radius: 15px;
  }

  .karte-title {
    font-size: 23px;
  }

  .karte-search-input {
    width: min(62vw, 320px);
  }

  .karte-map {
    min-height: 390px;
    height: 56vh;
  }
}

@media (max-width: 560px) {
  .karte-filter-group,
  .karte-search-wrap {
    width: 100%;
  }

  .karte-search-input {
    flex: 1;
    width: auto;
  }

  .karte-summary {
    width: 100%;
  }
}
