:root {
  --bg: #12141c;
  --panel: rgba(22, 25, 36, .94);
  --panel-solid: #161924;
  --line: #2a2f42;
  --text: #e8eaf2;
  --muted: #8b91a8;
  --accent: #e94560;
  --ok: #3ddc97;
  --warn: #ffb020;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden;
  -webkit-tap-highlight-color: transparent; }
#map { position: absolute; inset: 0; background: #0b0d13; }
.hidden { display: none !important; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }

/* ---------- Kopfzeile */
.topbar { position: absolute; z-index: 1003; top: calc(8px + var(--safe-t)); left: 8px; right: 8px;
  display: flex; gap: 8px; align-items: center; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.brand { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px;
  white-space: nowrap; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.brand b { color: var(--accent); }
.brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.brand .dot.err { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.search { position: relative; flex: 1; max-width: 420px; }
.search input { width: 100%; background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 9px 12px; font-size: 16px; outline: none; }
.search input:focus { border-color: var(--accent); }
.results { position: absolute; top: 44px; left: 0; right: 0; background: var(--panel-solid); border: 1px solid var(--line);
  border-radius: 10px; max-height: 60vh; overflow: auto; box-shadow: 0 8px 24px #0008; }
.results .it { padding: 8px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px;
  border-bottom: 1px solid var(--line); }
.results .it:last-child { border-bottom: 0; }
.results .it:hover, .results .it.sel { background: #22273a; }
.results .it small { color: var(--muted); }
.results .more { padding: 8px 12px; color: var(--accent); cursor: pointer; }
.count { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px;
  font-variant-numeric: tabular-nums; white-space: nowrap; margin-left: auto; }

/* ---------- Schaltflächen rechts */
.fabs { position: absolute; z-index: 1000; right: 10px; top: calc(64px + var(--safe-t)); display: flex;
  flex-direction: column; gap: 8px; }
.fab { width: 44px; height: 44px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line);
  display: grid; place-items: center; cursor: pointer; position: relative; padding: 0; }
.fab svg { width: 22px; height: 22px; stroke: var(--text); stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.fab.on { border-color: var(--accent); }
.fab.on svg { stroke: var(--accent); }
.badge { position: absolute; top: -5px; right: -5px; background: var(--accent); color: #fff; font-size: 11px;
  border-radius: 9px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; }

/* ---------- Seitenpanels */
.panel { position: absolute; z-index: 1001; right: 62px; top: calc(64px + var(--safe-t)); width: 270px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px 14px 14px;
  max-height: calc(100% - 140px); overflow: auto; box-shadow: 0 8px 24px #0008; }
.panel h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 12px 0 8px; }
.row { display: flex; align-items: center; gap: 8px; padding: 5px 0; cursor: pointer; }
.row.col { flex-direction: column; align-items: stretch; gap: 4px; }
.row.col b { color: var(--accent); font-weight: 600; }
.row input[type=checkbox] { accent-color: var(--accent); width: 17px; height: 17px; }
input[type=range] { accent-color: var(--accent); width: 100%; }
input[type=text] { background: #0e1018; border: 1px solid var(--line); color: var(--text); border-radius: 8px;
  padding: 7px 9px; font-size: 15px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { flex: 1; background: transparent; border: 0; padding: 7px 4px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--accent); color: #fff; }
.btn { display: block; width: 100%; margin-top: 8px; padding: 9px; border-radius: 9px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--accent); }
.list .it { padding: 7px 0; border-bottom: 1px solid var(--line); cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.list .it small { color: var(--muted); }
.muted { color: var(--muted); }
.near-src { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); border-radius: 14px; padding: 3px 9px; font-size: 12px; cursor: pointer; background: #0e1018; }
.chip b { color: var(--accent); margin-left: 4px; }
.chip.on { background: var(--accent); border-color: var(--accent); }
.chip.on b { color: #fff; }
.list .it .al { color: var(--muted); font-size: 11px; display: block; }
#panel-near .list { max-height: 40vh; overflow: auto; }

/* ---------- Flugzeug-Symbole */
.ac-icon { background: none; border: 0; }
.ac { position: relative; width: 30px; height: 30px; }
.ac svg { width: 30px; height: 30px; display: block; filter: drop-shadow(0 0 1.5px #000c); transition: transform .3s; }
.ac .lbl { position: absolute; left: 26px; top: 4px; white-space: nowrap; font-size: 11px; line-height: 1.15;
  background: #0c0e15d0; color: #fff; padding: 1px 4px; border-radius: 4px; pointer-events: none; display: none; }
.ac .lbl small { color: #aab; }
.show-labels .ac .lbl { display: block; }
.ac.sel svg { filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 6px var(--accent)); }
.ac.sel .lbl { display: block; background: var(--accent); }
.ac.emg svg { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }

.ap-lbl { background: none; border: 0; color: #c9cde0; font-size: 10px; font-weight: 600; text-shadow: 0 0 3px #000, 0 0 3px #000; white-space: nowrap; }

/* ---------- Detailansicht */
.detail { position: absolute; z-index: 1002; left: 10px; top: calc(64px + var(--safe-t)); bottom: 28px; width: 370px;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: 14px; overflow: auto;
  box-shadow: 0 10px 30px #000a; overscroll-behavior: contain; }
.detail .grab { display: none; }
.detail .x { position: sticky; top: 8px; float: right; margin: 8px 8px -40px 0; z-index: 3; width: 32px; height: 32px;
  border-radius: 50%; border: 0; background: #000a; color: #fff; font-size: 22px; line-height: 30px; cursor: pointer; }
.d-photo { position: relative; aspect-ratio: 16/9; background: #0b0d13 center/cover no-repeat; }
.d-photo.none { display: grid; place-items: center; color: var(--muted); aspect-ratio: auto; height: 70px; }
.d-photo .cr { position: absolute; right: 6px; bottom: 6px; font-size: 10px; background: #000b; color: #ddd;
  padding: 2px 6px; border-radius: 4px; text-decoration: none; }
.d-head { padding: 12px 14px 4px; }
.d-head .cs { font-size: 22px; font-weight: 700; letter-spacing: .02em; }
.d-head .cs .iata { color: var(--muted); font-size: 15px; font-weight: 500; margin-left: 8px; }
.d-head .al { color: var(--muted); }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 9px; margin: 4px 4px 0 0; border: 1px solid var(--line); }
.tag.red { border-color: var(--accent); color: var(--accent); }
.tag.mil { border-color: #9bb65a; color: #b9d47a; }
.d-route { margin: 8px 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #11141d; }
.d-route .ends { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.d-route .ap { max-width: 45%; }
.d-route .ap.r { text-align: right; }
.d-route .code { font-size: 26px; font-weight: 700; }
.d-route .city { color: var(--muted); font-size: 12px; }
.d-route .mid { color: var(--accent); font-size: 20px; padding-top: 6px; }
.prog { height: 6px; background: #2a2f42; border-radius: 3px; margin: 10px 0 6px; position: relative; }
.prog > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 3px; }
.prog-txt { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.d-route .warn { color: var(--warn); font-size: 12px; margin-top: 6px; }
.d-sec { padding: 4px 14px 8px; }
.d-sec h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 12px 0 6px;
  border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.grid div small { display: block; color: var(--muted); font-size: 11px; }
.grid div span { font-variant-numeric: tabular-nums; }
.d-actions { display: flex; gap: 8px; padding: 10px 14px 14px; flex-wrap: wrap; }
.d-actions .btn { width: auto; flex: 1; margin: 0; text-align: center; text-decoration: none; font-size: 13px; }
.vr-up { color: var(--ok); } .vr-dn { color: var(--warn); }

/* ---------- Hinweise / Status */
.hint { position: absolute; z-index: 999; left: 50%; transform: translateX(-50%); bottom: calc(34px + var(--safe-b));
  background: var(--panel); border: 1px solid var(--line); padding: 7px 12px; border-radius: 10px; font-size: 12px;
  color: var(--muted); max-width: 90%; text-align: center; }
.status { position: absolute; z-index: 999; left: 10px; bottom: calc(6px + var(--safe-b)); font-size: 11px; color: var(--muted);
  text-shadow: 0 0 3px #000; }
.attr-src { position: absolute; z-index: 999; right: 6px; bottom: calc(20px + var(--safe-b)); font-size: 10px; color: var(--muted); text-shadow: 0 0 3px #000; }
.attr-src a { color: #aab; text-decoration: none; }
.leaflet-control-attribution { background: #0009 !important; color: #889 !important; font-size: 9px !important; }
.leaflet-control-attribution a { color: #aab !important; }
.leaflet-control-zoom { display: none; }
.leaflet-tooltip.ap-tip { background: var(--panel-solid); color: var(--text); border: 1px solid var(--line); }
.me-dot { width: 14px; height: 14px; border-radius: 50%; background: #3b8cff; border: 2px solid #fff; box-shadow: 0 0 0 6px #3b8cff40; }

/* ---------- Handy: Detail als Bottom-Sheet */
@media (max-width: 700px) {
  .brand { padding: 8px 10px; }
  .brand .t { display: none; }
  .count { padding: 8px 10px; }
  .count .w { display: none; }
  .detail { left: 0; right: 0; width: auto; top: auto; bottom: 0; max-height: 62vh; border-radius: 16px 16px 0 0;
    padding-bottom: var(--safe-b); border-bottom: 0; }
  .detail.full { max-height: calc(100% - 60px - var(--safe-t)); }
  .detail .grab { display: block; position: sticky; top: 0; height: 18px; z-index: 2; background: var(--panel-solid); }
  .detail .grab::after { content: ""; position: absolute; left: 50%; top: 7px; width: 40px; height: 4px; margin-left: -20px;
    border-radius: 2px; background: #555c75; }
  .detail .x { top: 22px; margin-top: 4px; }
  .d-photo { aspect-ratio: 21/9; }
  .panel { left: 10px; right: 62px; width: auto; }
  .results { position: fixed; left: 8px; right: 8px; top: calc(54px + var(--safe-t)); }
  .attr-src { display: none; }
}

/* ---------- Flughäfen */
.ap-lbl span { display: inline-block; background: #0c0e15d9; color: #fff; font-size: 11px; font-weight: 700; padding: 0 4px;
  border-radius: 4px; border: 1px solid #3b7dd8; text-shadow: none; line-height: 14px; }
.results .sec { padding: 6px 12px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  background: #0e1018; border-bottom: 1px solid var(--line); }
.results .it.apt b { color: #6fa8ff; margin-right: 4px; }
.apt-head .cs .iata { font-size: 14px; }
.apt-tabs { margin: 8px 14px; }
.apt-tabs button { font-size: 13px; }
.apt-list { padding: 0 14px; }
.apt-list .it small { text-align: right; }
.apt-list .it small b { color: var(--text); }
.d-sec.note { font-size: 11px; color: var(--muted); padding-top: 10px; padding-bottom: 14px; }
.d-back { padding: 10px 14px 8px; background: var(--panel-solid); }
.d-back .link { font-size: 14px; }
