/* ───────────── WorldTrace · Karten-App ─────────────
   Ruhige, flache Oberfläche: Flächen statt Rahmen, wenig Effekte.
   Farben über Variablen. */
:root {
  --bg: #0b0d10; --surface: rgba(20, 23, 28, .96); --surface-solid: #14171c; --surface-2: #1d2128; --surface-3: #262b33;
  --hover: rgba(255, 255, 255, .05); --sep: rgba(255, 255, 255, .07);
  --text: #e7e9ec; --muted: #9ba3ad; --dim: #6c747e;
  --accent: #4fd1a5; --accent-ink: #06231a; --accent-soft: rgba(79, 209, 165, .14);
  --warn: #f2b14c; --danger: #f0616f; --mil: #f08a45; --gold: #e9c46a; --violet: #ad8bf0;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .55);
  --scrim: rgba(5, 7, 10, .55);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; --head: 'Inter', system-ui, sans-serif; --mono: 'JetBrains Mono', ui-monospace, monospace;
  --r: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
#map { position: fixed; inset: 0; }
.glass { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); }
.mono { font-family: var(--mono); } .muted { color: var(--muted); } .dim { color: var(--dim); }
.hidden { display: none !important; }

/* Kopfzeile */
.topbar { position: fixed; top: 12px; left: 12px; right: 12px; z-index: 20; display: flex; align-items: center; gap: 8px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.tb-brand { display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 14px; font-weight: 700; letter-spacing: .08em; font-size: 13px; }
.search { position: relative; flex: 1; max-width: 520px; margin: 0 auto; }
.search input { width: 100%; height: 40px; padding: 0 40px 0 40px; border-radius: 10px; border: 0; background: var(--surface); color: var(--text); font: 14px var(--font); outline: none; box-shadow: var(--shadow); }
.search input::placeholder { color: var(--dim); }
.search input:focus { box-shadow: var(--shadow), 0 0 0 2px var(--accent-soft); }
.search svg { position: absolute; left: 13px; top: 11px; width: 18px; height: 18px; color: var(--dim); }
.search kbd { position: absolute; right: 12px; top: 10px; font: 11px var(--mono); color: var(--dim); background: var(--surface-2); border-radius: 5px; padding: 1px 6px; }
.results { position: absolute; top: 46px; left: 0; right: 0; max-height: 60vh; overflow: auto; padding: 6px; }
.results .grp { font-size: 11px; font-weight: 600; color: var(--dim); padding: 10px 10px 4px; }
.results .it { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.results .it:hover, .results .it.sel { background: var(--hover); }
.results .it small { color: var(--dim); margin-left: auto; font-size: 12px; white-space: nowrap; }
.results .it span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-right { display: flex; align-items: center; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px; border-radius: 10px; border: 0; background: var(--surface); box-shadow: var(--shadow); font-weight: 600; font-size: 13px; white-space: nowrap; }
.pill:hover { background: var(--surface-solid); }
.pill.accent { background: var(--accent); color: var(--accent-ink); }
.pill.icon { width: 40px; padding: 0; justify-content: center; }
.pill svg { width: 17px; height: 17px; }
.plan-badge { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.plan-badge.free { background: var(--surface-2); color: var(--muted); }

/* Ebenen-Panel */
.panel { position: fixed; top: 64px; left: 12px; bottom: 50px; width: 280px; z-index: 15; display: flex; flex-direction: column; overflow: hidden; transition: transform .25s ease; }
.panel.closed { transform: translateX(calc(-100% - 20px)); }
.panel-scroll { overflow-y: auto; padding: 6px 6px 12px; scrollbar-width: thin; }
.p-sec { padding: 14px 10px 4px; font-size: 11.5px; font-weight: 600; color: var(--dim); display: flex; justify-content: space-between; }
.p-sec:first-child { padding-top: 8px; }
.lyr { display: flex; align-items: center; gap: 11px; padding: 6px 10px; border-radius: 8px; cursor: pointer; user-select: none; }
.lyr:hover { background: var(--hover); }
.lyr .sw { width: 18px; height: 18px; display: grid; place-items: center; flex: none; color: var(--c); font-size: 13px; opacity: .55; transition: opacity .15s; }
.lyr.on .sw { opacity: 1; }
.lyr .sw svg { width: 16px; height: 16px; }
.lyr .nm { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.lyr .nm b { font-weight: 500; font-size: 13.5px; white-space: nowrap; }
.lyr:not(.on) .nm b { color: var(--muted); }
.lyr .nm small { color: var(--dim); font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-left: auto; }
.tgl { width: 26px; height: 15px; border-radius: 999px; background: var(--surface-3); position: relative; flex: none; transition: background .2s; }
.tgl::after { content: ''; position: absolute; left: 2px; top: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--surface-solid); transition: transform .2s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.lyr.on .tgl { background: var(--accent); } .lyr.on .tgl::after { transform: translateX(11px); background: #fff; }
.lyr .lock { font-size: 10px; color: var(--gold); }
.subopt { display: flex; gap: 2px; flex-wrap: wrap; padding: 0 8px 6px 39px; }
.chip { font-size: 12px; padding: 3px 8px; border-radius: 6px; border: 0; background: transparent; color: var(--dim); }
.chip:hover { color: var(--text); background: var(--hover); }
.chip.on { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; margin: 4px 8px 6px; border-radius: 9px; background: var(--surface-2); }
.seg button { border: 0; background: transparent; padding: 6px 4px; border-radius: 7px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.seg button.on { background: var(--surface-solid); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.tools { display: flex; flex-direction: column; padding: 0 0 4px; }
.tool { display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: 8px; border: 0; background: transparent; font-size: 13.5px; text-align: left; color: var(--text); }
.tool:hover { background: var(--hover); }
.tool svg { width: 17px; height: 17px; color: var(--muted); flex: none; }

/* Detail-Schublade */
.drawer { position: fixed; top: 64px; right: 12px; bottom: 50px; width: 370px; z-index: 16; display: flex; flex-direction: column; overflow: hidden; transform: translateX(calc(100% + 20px)); transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
.drawer.open { transform: none; }
.dr-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 16px 6px; }
.dr-head .ttl { flex: 1; min-width: 0; }
.dr-head h2 { font: 650 18px var(--head); margin: 0; letter-spacing: -.01em; overflow-wrap: anywhere; }
.dr-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.dr-head .kind { font-size: 12px; font-weight: 500; color: var(--dim); margin-bottom: 2px; display: block; }
.icon-btn { width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; flex: none; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.on { color: var(--gold); }
.dr-body { overflow-y: auto; padding: 8px 16px 18px; flex: 1; scrollbar-width: thin; }
.media { position: relative; border-radius: 10px; overflow: hidden; background: #000; aspect-ratio: 16/10; }
.media img, .media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media .live { position: absolute; top: 8px; left: 8px; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; background: var(--danger); color: #fff; padding: 2px 6px; border-radius: 4px; }
.media .age { position: absolute; bottom: 8px; right: 8px; font-size: 11px; background: rgba(0, 0, 0, .6); color: #fff; padding: 2px 7px; border-radius: 4px; }
.media .err { position: absolute; inset: 0; display: grid; place-items: center; color: #9ba3ad; font-size: 13px; text-align: center; padding: 20px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 14px; background: var(--sep); border-radius: 10px; overflow: hidden; }
.kv { padding: 9px 12px; background: var(--surface-2); min-width: 0; }
.kv span { display: block; font-size: 11.5px; color: var(--dim); }
.kv b { display: block; font-weight: 600; font-size: 14.5px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kv.wide { grid-column: span 2; }
.grid2 > .kv:last-child:nth-child(odd) { grid-column: span 2; }
.route { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); }
.route .ap { flex: 1; min-width: 0; } .route .ap:last-child { text-align: right; }
.route .ap b { font: 700 22px var(--head); display: block; letter-spacing: -.01em; } .route .ap small { color: var(--muted); font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route svg { color: var(--dim); flex: none; }
.btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 8px; border: 0; background: var(--surface-2); font-weight: 500; font-size: 13px; color: var(--text); }
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: default; }
.src { margin-top: 14px; font-size: 12px; color: var(--dim); }
.src a { color: var(--muted); text-decoration: underline; text-decoration-color: var(--sep); text-underline-offset: 2px; }
.tagline { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 2px 7px; border-radius: 5px; margin: 6px 6px 0 0; }
.tag-mil { background: color-mix(in srgb, var(--mil) 15%, transparent); color: var(--mil); } .tag-warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.tag-ok { background: var(--accent-soft); color: var(--accent); } .tag-dim { background: var(--surface-2); color: var(--muted); }
.tag-danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.news { display: flex; flex-direction: column; margin-top: 6px; }
.news a { display: block; padding: 9px 4px; border-bottom: 1px solid var(--sep); }
.news a:last-of-type { border-bottom: 0; }
.news a:hover b { color: var(--accent); }
.news a b { display: block; font-weight: 500; font-size: 13.5px; line-height: 1.35; }
.news a small { color: var(--dim); font-size: 12px; }
.h3 { font-size: 12px; font-weight: 600; margin: 20px 0 2px; color: var(--dim); }
.bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.brief { font-size: 14px; line-height: 1.6; color: var(--text); }
.brief h1, .brief h2, .brief h3 { font-size: 15px; font-weight: 650; margin: 16px 0 6px; }
.brief ul { padding-left: 18px; margin: 8px 0; } .brief li { margin-bottom: 6px; }
.brief p { margin: 8px 0; }
.skeleton { height: 13px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; margin: 10px 0; }
@keyframes sk { to { background-position: -200% 0; } }

/* Statusleiste */
.statusbar { position: fixed; left: 12px; right: 12px; bottom: 10px; height: 30px; z-index: 14; display: flex; align-items: center; gap: 16px; padding: 0 12px; font-size: 12px; color: var(--muted); border-radius: 9px; overflow: hidden; white-space: nowrap; font-variant-numeric: tabular-nums; }
.statusbar b { color: var(--text); font-weight: 500; }
.statusbar .sp { flex: 1; }
.statusbar .attr { color: var(--dim); overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.statusbar .attr a { color: var(--dim); }
.ldot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; margin-right: 6px; vertical-align: 1px; animation: pl 2s infinite; }
@keyframes pl { 50% { opacity: .35; } }

/* Kartensteuerung */
.mapctl { position: fixed; right: 12px; bottom: 52px; z-index: 13; display: flex; flex-direction: column; gap: 8px; transition: right .28s; }
body.drawer-open .mapctl { right: 394px; }
.mapctl .grp { display: flex; flex-direction: column; background: var(--surface); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.mapctl button { width: 36px; height: 36px; border: 0; background: var(--surface); display: grid; place-items: center; font-size: 15px; font-weight: 600; color: var(--text); border-radius: 10px; box-shadow: var(--shadow); }
.mapctl .grp button { box-shadow: none; border-radius: 0; background: transparent; }
.mapctl .grp button + button { border-top: 1px solid var(--sep); }
.mapctl button:hover { background: var(--hover); }
.mapctl button.on { color: var(--accent); }
.maplibregl-ctrl-attrib { display: none !important; }
.maplibregl-canvas { outline: none; }

/* Hover-Tooltip */
.tip { position: fixed; z-index: 30; pointer-events: none; padding: 6px 9px; border-radius: 8px; background: var(--surface-solid); box-shadow: var(--shadow); font-size: 12.5px; max-width: 260px; transform: translate(12px, 12px); }
.tip b { display: block; font-weight: 600; } .tip small { color: var(--muted); font-size: 11.5px; }

/* Modale Fenster */
.modal-bg { position: fixed; inset: 0; z-index: 40; background: var(--scrim); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; animation: fi .18s; }
@keyframes fi { from { opacity: 0; } }
.modal { width: min(500px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface-solid); border-radius: 14px; padding: 24px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5); position: relative; }
.modal.wide { width: min(1400px, 100%); height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal h2 { font-size: 21px; font-weight: 700; margin: 0 0 6px; letter-spacing: -.015em; }
.modal p { color: var(--muted); margin: 0 0 16px; }
.modal .x { position: absolute; top: 14px; right: 14px; }
.pw-plan { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 10px; margin-bottom: 6px; background: var(--surface-2); }
.pw-plan:hover { background: var(--surface-3); }
.pw-plan.hot { background: var(--accent-soft); }
.pw-plan b { font-size: 15px; font-weight: 650; } .pw-plan small { display: block; color: var(--muted); font-size: 12px; }
.pw-plan .pr { font-size: 19px; font-weight: 700; text-align: right; } .pw-plan .pr small { font-size: 11px; font-weight: 400; }
.wall { flex: 1; display: grid; gap: 6px; margin-top: 14px; min-height: 0; }
.wall .tile { position: relative; border-radius: 8px; overflow: hidden; background: #000; min-height: 0; }
.wall .tile img { width: 100%; height: 100%; object-fit: cover; }
.wall .tile span { position: absolute; left: 8px; bottom: 8px; right: 40px; font-size: 11.5px; color: #fff; background: rgba(0, 0, 0, .6); padding: 2px 7px; border-radius: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wall .tile button { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 6px; border: 0; background: rgba(0, 0, 0, .55); color: #fff; }
.wall .empty { display: grid; place-items: center; color: var(--dim); font-size: 13px; text-align: center; padding: 10px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.field input[type=text], .field input[type=number] { width: 100%; padding: 9px 11px; border-radius: 8px; border: 0; background: var(--surface-2); color: var(--text); font: 14px var(--font); outline: none; }
.field input:focus { box-shadow: 0 0 0 2px var(--accent-soft); }
.field input[type=range] { width: 100%; accent-color: var(--accent); }
.gf-item { display: flex; align-items: center; gap: 8px; padding: 9px 4px; border-bottom: 1px solid var(--sep); }
.gf-item div { flex: 1; min-width: 0; } .gf-item small { color: var(--dim); font-size: 12px; display: block; }

/* Toasts */
.toasts { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 50; display: grid; gap: 6px; width: min(400px, calc(100% - 24px)); }
.toast { padding: 10px 13px; border-radius: 10px; background: var(--surface-solid); box-shadow: var(--shadow); font-size: 13px; display: flex; gap: 10px; align-items: flex-start; animation: ti .22s; cursor: pointer; }
.toast.alert { box-shadow: var(--shadow), inset 3px 0 0 var(--warn); }
@keyframes ti { from { opacity: 0; transform: translateY(-6px); } }
.picking, .picking .maplibregl-canvas { cursor: crosshair !important; }

/* Erdbeben-Pulse */
.pulse { width: var(--s); height: var(--s); border-radius: 50%; border: 1.5px solid var(--warn); pointer-events: none; animation: qp 2.2s ease-out infinite; }
@keyframes qp { from { transform: scale(.4); opacity: .9; } to { transform: scale(2.2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; opacity: .5; } }

/* Mobil */
.mob-only { display: none; }
@media (max-width: 820px) {
  .mob-only { display: inline-flex; }
  .tb-brand span, .search kbd, .tb-right .hide-m { display: none; }
  .topbar { gap: 6px; top: 8px; left: 8px; right: 8px; }
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 72vh; border-radius: 16px 16px 0 0; z-index: 25; }
  .panel.closed { transform: translateY(calc(100% + 20px)); }
  .drawer { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 68vh; border-radius: 16px 16px 0 0; transform: translateY(calc(100% + 20px)); z-index: 26; }
  .drawer.open { transform: none; }
  .statusbar .hide-m { display: none; }
  .statusbar .legal.show-m { display: inline; }
  .statusbar { left: 8px; right: 8px; bottom: 8px; }
  body.drawer-open .mapctl { right: 12px; }
  .mapctl { bottom: 48px; }
}


/* Unterordner „Kameratypen“ */
.folder { padding: 2px 8px 8px 39px; }
.folder > .chip { margin-left: -8px; }
.fsec { font-size: 11px; font-weight: 600; color: var(--dim); margin: 8px 0 4px; }
.fchips { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 2px; }
.chip.cf { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); color: var(--dim); }
.chip.cf small { color: var(--dim); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.chip.cf.on { background: var(--accent-soft); color: var(--text); }
.chip.cf:not(.on) .cdot { opacity: .35; }
.cdot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* Kamerabild erst zeigen, wenn es geladen ist (kein Alternativtext-Aufblitzen) */
#camImg:not([src]) { visibility: hidden; }
.statusbar .legal { flex-shrink: 0; }
.statusbar .show-m { display: none; }
