
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  height: 100dvh; /* dynamic viewport height — kein iOS-Adressleisten-Bug */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header ── */
#header {
  background: #16213e;
  border-bottom: 2px solid #e25822;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  z-index: 1000;
}

#header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#header h1 {
  font-size: 1rem;
  font-weight: 700;
  color: #ff6b35;
  white-space: nowrap;
}
#header h1 span { color: #e0e0e0; font-weight: 400; }

#header-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ── Status ── */
#last-update {
  font-size: 0.72rem;
  color: #aaa;
  white-space: nowrap;
}
#error-banner {
  font-size: 0.72rem;
  color: #ff4444;
  background: #2a1010;
  border: 1px solid #ff4444;
  border-radius: 4px;
  padding: 2px 7px;
  display: none;
}
#error-banner.visible { display: block; }

/* ── Buttons (alle gemeinsam) ── */
.ctrl-btn {
  border: none;
  border-radius: 5px;
  padding: 7px 13px;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s, opacity .2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  min-height: 36px; /* touch target */
}

/* ── Layer-Toggles ── */
#layer-toggles {
  display: flex;
  gap: 4px;
}
.layer-toggle {
  background: #0f3460;
  color: #eee;
  border: 1px solid #3a6090;
}
.layer-toggle:hover, .layer-toggle:active { background: #1a4a80; }
.layer-toggle.layer-off {
  background: #1a1a2e;
  color: #555;
  border: 1px solid #333;
  text-decoration: line-through;
}

/* ── Range-Tabs ── */
#range-tabs {
  display: flex;
  gap: 4px;
}
.range-tab {
  background: #0f3460;
  color: #aaa;
  border: 1px solid #0f3460;
}
.range-tab.active {
  background: #e25822;
  color: #fff;
  border-color: #e25822;
}
.range-tab:hover, .range-tab:active { opacity: 0.85; }

/* ── Refresh-Button ── */
#refresh-btn {
  background: #e25822;
  color: #fff;
  margin-left: auto;
}
#refresh-btn:hover, #refresh-btn:active { background: #ff6b35; }
#refresh-btn:disabled { background: #555; cursor: not-allowed; }

/* ── Karte ── */
#map {
  flex: 1;
  min-height: 0;
}

/* ── Attribution-Footer ── */
#attribution-footer {
  background: #16213e;
  border-top: 1px solid #333;
  padding: 4px 12px;
  font-size: 0.65rem;
  color: #777;
  flex-shrink: 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  line-height: 1.4;
}
#attribution-footer a { color: #ff8c5a; text-decoration: none; }
#attribution-footer a:hover { text-decoration: underline; }

/* ── Leaflet-Popup ── */
.leaflet-popup-content-wrapper {
  background: #1e2a3a;
  color: #e0e0e0;
  border: 1px solid #e25822;
  border-radius: 6px;
}
.leaflet-popup-tip { background: #1e2a3a; }
.leaflet-popup-content {
  font-size: 0.8rem;
  line-height: 1.5;
  margin: 10px 14px;
}
.popup-title { font-weight: 700; color: #ff8c5a; margin-bottom: 4px; font-size: 0.85rem; }
.popup-row { display: flex; justify-content: space-between; gap: 10px; }
.popup-row .label { color: #aaa; flex-shrink: 0; }
.popup-source { margin-top: 6px; font-size: 0.68rem; color: #666; border-top: 1px solid #333; padding-top: 4px; }

/* ── Legende ── */
.legend {
  background: #1e2a3a;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 8px 12px;
  line-height: 1.7;
  font-size: 0.75rem;
  color: #ddd;
  min-width: 150px;
}
.legend-title { font-weight: 700; color: #ff8c5a; margin-bottom: 4px; font-size: 0.78rem; }
.legend-dot {
  display: inline-block;
  width: 11px; height: 11px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.legend-rect {
  display: inline-block;
  width: 13px; height: 9px;
  margin-right: 5px;
  vertical-align: middle;
  opacity: 0.7;
}

/* ══════════════════════════════════════
   MOBILE  (≤ 600px)
══════════════════════════════════════ */
@media (max-width: 600px) {

  #header {
    padding: 6px 10px;
    gap: 5px;
  }

  #header h1 { font-size: 0.88rem; }

  #header-controls {
    gap: 5px;
  }

  .ctrl-btn {
    padding: 6px 10px;
    font-size: 0.75rem;
    min-height: 38px; /* größerer Touch-Bereich */
  }

  /* Legende auf Mobilgeräten ausblenden — zu wenig Platz */
  .legend { display: none; }

  /* Leaflet-Zoom-Buttons größer */
  .leaflet-control-zoom a {
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    font-size: 18px !important;
  }

  /* Popup etwas breiter auf Handy */
  .leaflet-popup-content-wrapper {
    max-width: calc(100vw - 40px);
  }

  #attribution-footer {
    font-size: 0.6rem;
    padding: 3px 8px;
    gap: 6px;
  }
}

/* ══════════════════════════════════════
   SEHR KLEIN  (≤ 380px — z.B. iPhone SE)
══════════════════════════════════════ */
@media (max-width: 380px) {
  #header h1 span { display: none; } /* "Deutschland" ausblenden */

  .ctrl-btn { padding: 5px 8px; font-size: 0.72rem; }
}
