:root {
  --bg: #0b0f14; --card: rgba(16, 22, 30, .92); --line: rgba(255, 255, 255, .08); --text: #e8edf3; --dim: #8b97a6;
  --accent: #3ee0a1; --alert: #ff3b3b; --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 var(--font); }
#map { position: fixed; inset: 0; background: var(--bg); }
.leaflet-container { background: var(--bg); font: inherit; }
.tiles-dark { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.35); }
.leaflet-control-attribution { background: rgba(11, 15, 20, .7) !important; color: var(--dim) !important; font-size: 10px; }
.leaflet-control-attribution a { color: var(--dim) !important; }
.leaflet-control-zoom a { background: var(--card) !important; color: var(--text) !important; border-color: var(--line) !important; }
a { color: var(--accent); }

.brand { position: fixed; top: max(12px, env(safe-area-inset-top)); left: 12px; z-index: 1000; display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 14px 8px 10px; backdrop-filter: blur(8px); }
.brand h1 { margin: 0; font-size: 18px; letter-spacing: .02em; }
.brand p { margin: 0; color: var(--dim); font-size: 12px; }
.brand p a { color: var(--dim); }
.logo { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--accent); position: relative; overflow: hidden; }
.logo span { position: absolute; inset: 0; background: conic-gradient(from 0deg, rgba(62, 224, 161, .55), transparent 25%); animation: sweep 3s linear infinite; }
@keyframes sweep { to { transform: rotate(360deg); } }
.live { margin-left: 8px; display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 12px; white-space: nowrap; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: #666; }
.live.ok i { background: var(--accent); box-shadow: 0 0 0 0 rgba(62, 224, 161, .6); animation: ping 2s infinite; }
.live.err i { background: var(--alert); }
@keyframes ping { 70% { box-shadow: 0 0 0 8px rgba(62, 224, 161, 0); } 100% { box-shadow: 0 0 0 0 rgba(62, 224, 161, 0); } }

.mapbtns { position: fixed; z-index: 1000; left: 12px; bottom: max(24px, env(safe-area-inset-bottom)); display: flex; gap: 6px; }
.mapbtns button { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font: inherit; cursor: pointer; }
.mapbtns button:hover { border-color: var(--accent); }

.panel { position: fixed; z-index: 1000; top: 12px; right: 12px; bottom: 12px; width: 360px; overflow: auto; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; backdrop-filter: blur(10px); padding: 6px 16px 16px; }
.panel section { padding: 10px 0; border-bottom: 1px solid var(--line); }
.panel h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); margin: 4px 0 8px; font-weight: 600; }
.row { display: flex; align-items: center; justify-content: space-between; }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: rgba(255, 255, 255, .08); color: var(--text); text-align: center; }
.tgl { color: var(--dim); font-size: 12px; cursor: pointer; user-select: none; }
.grip { display: none; }
ol, ul { list-style: none; margin: 0; padding: 0; }
.empty, .hint { color: var(--dim); font-size: 12px; margin: 6px 0 0; }

.targets li { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 9px 8px; border-radius: 12px; cursor: pointer; }
.targets li:hover, .targets li.sel { background: rgba(255, 255, 255, .05); }
.targets li.ghost { opacity: .62; }
.targets .ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; }
.targets li.ghost .ic { background: transparent !important; border: 2px dashed currentColor; }
.targets .t1 { font-weight: 600; }
.targets .t2 { color: var(--dim); font-size: 12px; }
.targets .age { color: var(--dim); font-size: 12px; text-align: right; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip { font-size: 10.5px; padding: 1px 6px; border-radius: 6px; background: rgba(255, 255, 255, .07); color: var(--text); border-left: 3px solid var(--c, #888); }
.more { color: var(--dim); font-size: 12px; padding: 6px 8px; }
.detail { grid-column: 1 / -1; font-size: 12px; color: var(--dim); border-left: 2px solid var(--line); margin: 2px 0 0 16px; padding-left: 10px; }
.detail a { color: var(--dim); }
.detail div { padding: 2px 0; }

.events li { padding: 6px 0; font-size: 12.5px; display: grid; grid-template-columns: 44px 1fr; gap: 8px; }
.events time { color: var(--dim); }
.events .src { color: var(--dim); font-size: 11px; }

.sources li { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; }
.sources input { accent-color: var(--accent); }
.sources .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.sources .st { margin-left: auto; color: var(--dim); font-size: 11px; }
.sources .st.bad { color: var(--alert); }
.legend li { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 12.5px; color: var(--dim); }
.legend .sw { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; color: #000; }
.fine { color: var(--dim); font-size: 11px; padding-top: 10px; }
.fine p { margin: 6px 0; }

/* map markers */
.tgt { position: relative; }
.tgt .core { position: absolute; left: -15px; top: -15px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-size: 15px; color: #0b0f14; box-shadow: 0 0 0 2px rgba(0, 0, 0, .5); }
.tgt.ghost .core { background: transparent !important; border: 2px dashed var(--c); color: var(--c); box-shadow: none; opacity: .8; }
.tgt .arrow { position: absolute; left: -2px; top: -34px; width: 4px; height: 20px; transform-origin: 2px 34px; }
.tgt .arrow::before { content: ""; position: absolute; left: -5px; top: -4px; border: 7px solid transparent; border-bottom: 10px solid var(--c); border-top: 0; }
.tgt .arrow::after { content: ""; position: absolute; left: 0; top: 5px; width: 4px; height: 14px; background: var(--c); border-radius: 2px; }
.tgt.fresh .core::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--c); animation: halo 1.6s ease-out infinite; }
@keyframes halo { from { transform: scale(1); opacity: .9; } to { transform: scale(2.4); opacity: 0; } }
.tgt .lbl { position: absolute; left: 18px; top: -10px; white-space: nowrap; font-size: 11.5px; font-weight: 600; color: var(--text);
  text-shadow: 0 1px 2px #000, 0 0 6px #000; pointer-events: none; }
.tgt .lbl small { display: block; font-weight: 400; color: var(--dim); }
.ghostpt { font-size: 10.5px; color: var(--c); white-space: nowrap; text-shadow: 0 1px 2px #000; }
.ghostpt i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 2px dashed var(--c); margin: -5px 4px 0 -5px; vertical-align: middle; }
.leaflet-tooltip.obl { background: rgba(11, 15, 20, .85); color: var(--text); border: 1px solid var(--line); }

@media (max-width: 760px) {
  .brand { right: 12px; }
  .brand .live { margin-left: auto; }
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 34vh; border-radius: 18px 18px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); transition: max-height .25s; }
  .panel.open { max-height: 82vh; }
  .grip { display: block; width: 100%; background: none; border: 0; padding: 6px 0 2px; cursor: pointer; }
  .grip span { display: block; margin: 0 auto; width: 40px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .25); }
  .mapbtns { bottom: calc(34vh + 10px); }
  .leaflet-control-zoom { display: none; }
}
@media (prefers-reduced-motion: reduce) { .logo span, .tgt.fresh .core::after, .live.ok i { animation: none; } }
