/* Sichere, scoped responsive Ergänzungen. Keine globalen html/body-Overrides. */
.twgp img, .twgp svg, .tw-post-card img, .tw-page-wrapper img {max-width:100%;height:auto;}
.twgp, .twgp * {min-width:0;}
.twgp-event-grid {min-width:0;}
@media(max-width:767px) {
 .twgp .twgp-event-grid {display:grid;grid-template-columns:minmax(0,1fr);}
 .twgp #twgp-map {min-height:clamp(300px,55dvh,520px);}
 .twgp .twgp-side {min-width:0;}
}
@media(prefers-reduced-motion:reduce){.twgp *, .tw-page-wrapper *, .tw-app-wrapper * {scroll-behavior:auto!important;}}

/* Keep map overlays inside the usable viewport, including phone cutouts. */
body.tw-country-light {
  --tw-view-top: max(8px, env(safe-area-inset-top));
  --tw-view-right: max(8px, env(safe-area-inset-right));
  --tw-view-bottom: max(8px, env(safe-area-inset-bottom));
  --tw-view-left: max(8px, env(safe-area-inset-left));
}
html body.tw-country-light .tw-page-wrapper:has(#mainContent #twCountryRail),
html body.tw-country-light #appWrapper:has(> #mainContent #twCountryRail),
html body.tw-country-light #appWrapper > #mainContent.tw-main-content:has(#twCountryRail) {
  box-sizing: border-box;
  width: 100%;
  height: 100vh !important;
  height: 100dvh !important;
  min-height: 0 !important;
  max-height: 100dvh !important;
  overflow: hidden !important;
}
html body.tw-country-light #mainContent #leftPane .cyber-map-container,
html body.tw-country-light #mainContent #leftPane #map {
  width: 100%;
  height: 100% !important;
  min-height: 0 !important;
}
html body.tw-country-light #mainContent.tw-main-content {
  --tw-rail-edge: var(--tw-view-right);
  --tw-panel-width: min(clamp(390px, 36vw, 580px), calc(100% - var(--tw-panel-offset) - var(--tw-view-left)));
}
html body.tw-country-light #mainContent #twCountryRail {
  max-height: calc(100% - var(--tw-view-top) - var(--tw-view-bottom));
  top: calc(50% + (var(--tw-view-top) - var(--tw-view-bottom)) / 2);
}
html body.tw-country-light #twLoginPopup .tw-login-card {
  box-sizing: border-box;
  max-width: calc(100vw - var(--tw-view-left) - var(--tw-view-right));
  max-height: calc(100dvh - var(--tw-view-top) - var(--tw-view-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
}
html body.tw-country-light #scrollContainer :is(.tw-tab-pane, .tw-wysiwyg-content, .tw-stat-expandable) {
  min-width: 0;
  overflow-wrap: anywhere;
}
html body.tw-country-light :is(#scrollContainer, #twSingleFlyout, #twModalBody)
:is(.tw-wysiwyg-content, .entry-content) :is(img, video, iframe) { max-width: 100%; }
html body.tw-country-light #scrollContainer #twCountryPanelClose { min-width: 44px; min-height: 44px; flex-shrink: 0; }
html body.tw-country-light #scrollContainer .tw-stat-topic-nav button { min-height: 44px; }

@media (max-width: 600px), (max-height: 520px) {
  html body.tw-country-light #mainContent > #scrollContainer.tw-right-pane {
    position: fixed !important;
    inset: auto var(--tw-view-right) var(--tw-view-bottom) var(--tw-view-left) !important;
    width: auto !important;
    max-height: calc(100dvh - var(--tw-view-top) - var(--tw-view-bottom)) !important;
    transform: none !important;
    z-index: 1352 !important;
  }
  html body.tw-country-light #mainContent #scrollContainer #twCountryPanelHeader {
    position: sticky;
    top: 0;
    z-index: 5;
  }
  html body.tw-country-light #mainContent #scrollContainer > .tw-tabs-content {
    padding-inline: clamp(10px, 3vw, 18px);
  }
  html body.tw-country-light #twUniversalPopup .tw-modal-content {
    box-sizing: border-box;
    inset: var(--tw-view-top) var(--tw-view-right) auto var(--tw-view-left) !important;
    width: auto !important;
    height: auto !important;
    max-height: calc(100dvh - var(--tw-view-top) - var(--tw-view-bottom)) !important;
    transform: none !important;
    overflow-y: auto;
  }
  html body.tw-country-light #mainContent > #twSingleFlyout.tw-open {
    inset: var(--tw-view-top) var(--tw-view-right) auto var(--tw-view-left) !important;
    width: auto !important;
    min-height: 0 !important;
    transform: none !important;
    max-height: calc(100dvh - var(--tw-view-top) - var(--tw-view-bottom)) !important;
  }
  html body.tw-country-light #mainContent #twMobileFilterPanel.tw-map-region-filter {
    inset: var(--tw-view-top) var(--tw-panel-offset) auto var(--tw-view-left) !important;
    width: min(370px, calc(100% - var(--tw-panel-offset) - var(--tw-view-left))) !important;
    max-height: calc(100dvh - var(--tw-view-top) - var(--tw-view-bottom));
  }
  html body.tw-country-light #mainContent #twMobileFilterPanel .tw-filter-top-row { flex-wrap: wrap; }
  html body.tw-country-light #mainContent #twMobileFilterPanel .tw-filter-row-item { min-width: 0; max-width: 100%; }
  html body.tw-country-light #mainContent #twMobileFilterPanel select { max-width: 100%; }
}
@media (max-width: 360px) {
  #scrollContainer #subtab-data .tw-stat-topic-nav,
  #scrollContainer #counter-subtab-data .tw-stat-topic-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-height: 520px) {
  #scrollContainer .tw-chart-dialog > header { padding-block: 3px; }
  #scrollContainer .tw-chart-dialog-content { padding: clamp(12px, 3vw, 22px); }
}

/* Standard WordPress article and page content. Leave map canvases alone. */
#wrapper #content { min-width: 0; overflow-wrap: anywhere; }
#wrapper #content :is(.entry-content, .wp-block-image) :is(img, video) { max-width: 100%; height: auto; }
#wrapper #content .entry-content :is(iframe, embed, object) { max-width: 100%; }
#wrapper #content .entry-content :is(pre, .wp-block-table) { max-width: 100%; overflow-x: auto; }
@media (max-width: 600px) {
  #wrapper #content .entry-content > table { display: block; max-width: 100%; overflow-x: auto; }
}
@media (pointer: coarse) {
  html body.tw-country-light #mainContent #twCountryRail :is(button, a) {
    min-inline-size: 44px;
    min-block-size: 44px;
  }
}
@media (min-width: 601px) and (max-height: 520px) {
  #scrollContainer :is(#subtab-data, #counter-subtab-data) .tw-stat-topic-nav {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  }
}
