:root {
  --bg: #0a0e14;
  --panel: rgba(16, 21, 31, 0.86);
  --panel-solid: #10151f;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e6edf3;
  --muted: #8b97a7;
  --provisional: #f59e0b;
  --likely: #f97316;
  --confirmed: #ef4444;
  --accent: #ff3b30;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  /* deliberate 3-step corner-radius scale — sm for chips/pills, md for tiles &
     cards, lg for the floating panels. Keeps radii systematic instead of ad hoc. */
  --r-sm: 7px;
  --r-md: 10px;
  --r-lg: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
#map { position: absolute; inset: 0; }

/* Subtle depth: a radial vignette darkens the map corners so the floating
   panels read as sitting *over* a scene rather than pasted on a flat fill, and
   the eye is drawn gently toward the center where events cluster. Purely
   cosmetic — never intercepts input. */
#map-vignette {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(ellipse 120% 120% at 50% 42%,
    transparent 55%, rgba(4, 6, 10, 0.28) 82%, rgba(4, 6, 10, 0.55) 100%);
}

/* ---------------- boot overlay (Aceternity loader-one, ported to vanilla) ---
   Three bouncing dots — same geometry, timing, and gradient as the original
   shadcn component (h-4 w-4, gap-2, neutral-400→300, 1s ease-in-out, 0.2s
   stagger, y: 0→10→0). Centered on the existing dark theme with a wordmark and
   status line. Fades out once the map's first paint completes (app.js). */
#boot {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  background: var(--bg);
  transition: opacity 0.55s ease, visibility 0.55s ease;
}
#boot.ready { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-stack { display: flex; flex-direction: column; align-items: center; gap: 30px; }
.boot-brand { display: flex; flex-direction: column; align-items: center; line-height: 1.05; }
.boot-mark { font-weight: 800; font-size: 30px; letter-spacing: -0.5px; color: var(--text); }
.boot-mark .dot { color: var(--accent); }
.boot-sub { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 3px; margin-top: 6px; }
.boot-loader { display: flex; align-items: center; gap: 8px; height: 26px; }
.boot-dot {
  width: 16px; height: 16px; border-radius: 9999px;
  border: 1px solid #d4d4d4;                                 /* neutral-300 */
  background: linear-gradient(180deg, #a3a3a3, #d4d4d4);     /* neutral-400 -> neutral-300 */
  animation: boot-bounce 1s ease-in-out infinite;
  will-change: transform;
}
.boot-dot:nth-child(2) { animation-delay: 0.2s; }
.boot-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes boot-bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(10px); }
}
.boot-msg { font-size: 10px; color: var(--muted); letter-spacing: 2.5px;
  text-transform: uppercase; font-weight: 600; opacity: 0.85;
  animation: boot-msg-fade 2.2s ease-in-out infinite; }
@keyframes boot-msg-fade { 0%,100% { opacity: 0.55; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .boot-dot, .boot-msg { animation: none; }
}

/* keep the dark basemap looking deep */
.maplibregl-canvas { filter: saturate(0.9) brightness(0.92); }

/* Keep the map's own controls & attribution crisp above the vignette overlay
   (the vignette should dim the scene, not the chrome). These corner containers
   are already absolutely positioned by MapLibre, so z-index alone is safe. */
.maplibregl-ctrl-top-left, .maplibregl-ctrl-top-right,
.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { z-index: 3; }

/* ---- MapLibre nav controls: match dark theme ---- */
.maplibregl-ctrl-group {
  background: var(--panel) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow) !important;
  backdrop-filter: blur(14px);
}
.maplibregl-ctrl-group button { background-color: transparent !important; }
.maplibregl-ctrl-group button + button { border-top-color: var(--border) !important; }
.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon,
.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon { filter: invert(1) opacity(0.65); }

/* ---------------- top bar ---------------- */
#topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; gap: 16px;
  background: linear-gradient(180deg, rgba(8,11,17,0.95) 0%, rgba(8,11,17,0.22) 100%);
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }
/* extend the header fade a little below itself so a map marker poking up into
   the header band reads as "behind the glass" rather than colliding with the
   stats. Non-interactive. Must start at the SAME opacity where #topbar's own
   gradient ends (0.22) — otherwise the two gradients don't connect and the
   jump reads as a visible hard line under the header. */
#topbar::after {
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 40px;
  background: linear-gradient(180deg, rgba(8,11,17,0.22) 0%, rgba(8,11,17,0.0) 100%);
  pointer-events: none;
}
.brand { display: flex; flex-direction: column; line-height: 1.05; }
.brand-mark { font-weight: 800; font-size: 22px; letter-spacing: -0.5px; }
.brand-mark .dot { color: var(--accent); }
.brand-sub { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 2px; margin-top: 2px; }

.stats { display: flex; align-items: center; gap: 10px; }
/* EVENTS + CONFIRMED are one cohesive object (matching the pill language that
   flanks them) instead of two bare numbers floating between rounded pills */
.stat-cluster {
  display: flex; align-items: stretch;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 999px; backdrop-filter: blur(8px);
}
.stat { display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 5px 15px; }
.stat + .stat { border-left: 1px solid var(--border); }
.stat-num { font-size: 17px; font-weight: 650; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.2px; margin-top: 1px; }
/* air-alerts toggle pill in the top bar */
.alerts-toggle { display: flex; align-items: center; gap: 7px; font: inherit; font-size: 12px;
  color: var(--text); background: var(--panel); border: 1px solid var(--border);
  padding: 6px 10px 6px 9px; border-radius: 999px; cursor: pointer; backdrop-filter: blur(8px);
  transition: opacity 0.15s, border-color 0.15s; }
.alerts-toggle:hover { border-color: rgba(255,255,255,0.18); }
.alerts-toggle .al-glow { width: 9px; height: 9px; border-radius: 50%; background: #fbbf24;
  box-shadow: 0 0 0 0 rgba(217,119,6,0.6); animation: al-pulse 1.6s infinite; }
@keyframes al-pulse { 0% { box-shadow: 0 0 0 0 rgba(217,119,6,0.55);} 70% { box-shadow: 0 0 0 7px rgba(217,119,6,0);} 100% { box-shadow: 0 0 0 0 rgba(217,119,6,0);} }
.alerts-toggle .al-count { min-width: 18px; text-align: center; font-variant-numeric: tabular-nums;
  font-weight: 700; font-size: 11px; padding: 1px 5px; border-radius: 6px;
  background: rgba(255,255,255,0.06); color: var(--muted); }
.alerts-toggle .al-count.live { background: rgba(217,119,6,0.22); color: #fcd34d; }
.alerts-toggle.off { opacity: 0.5; }
.alerts-toggle.off .al-glow { background: var(--muted); animation: none; box-shadow: none; }

.live { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted);
  background: var(--panel); border: 1px solid var(--border); padding: 7px 11px; border-radius: 999px; backdrop-filter: blur(8px); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
/* Honest freshness: the dot only pulses green while the data is genuinely
   recent (one pipeline cycle). Once it ages it settles to a calm, un-animated
   neutral so the UI stops implying "real-time" when it isn't — and a stalled
   fetch turns it amber. Never alarming red for merely-quiet news. */
.live.fresh .live-dot { background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,0.6); animation: live 2s infinite; }
.live.resting .live-dot { background: #6b7686; animation: none; box-shadow: none; }
.live.stalled { color: #d9a441; }
.live.stalled .live-dot { background: #d9a441; animation: none; box-shadow: none; }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5);} 70% { box-shadow: 0 0 0 7px rgba(34,197,94,0);} 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0);} }

/* ---------------- side panel ---------------- */
#panel {
  position: absolute; top: 74px; right: 14px; z-index: 9; width: 330px; max-height: calc(100% - 150px);
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow); backdrop-filter: blur(14px); overflow: hidden;
  transition: max-height 0.25s ease;
}
#panel.collapsed { max-height: 48px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.panel-head h2 { margin: 0; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); }
#panel-toggle { background: none; border: none; color: var(--muted); font-size: 14px; cursor: pointer; padding: 2px 6px; }
.ph-btns { display: flex; align-items: center; gap: 4px; }
#top-events-btn {
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: var(--r-sm);
  background: transparent; border: 1px solid rgba(255,255,255,0.12);
  color: var(--muted); cursor: pointer; letter-spacing: 0.03em; white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
#top-events-btn:hover { color: #fff; border-color: rgba(255,255,255,0.28); }
#top-events-btn.active {
  background: rgba(251,191,36,0.12); border-color: rgba(251,191,36,0.45); color: #fbbf24;
}
#trends-btn {
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: var(--r-sm);
  background: transparent; border: 1px solid rgba(255,255,255,0.12);
  color: var(--muted); cursor: pointer; letter-spacing: 0.03em; white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
#trends-btn:hover { color: #fff; border-color: rgba(255,255,255,0.28); }
#trends-btn.active {
  background: rgba(96,165,250,0.12); border-color: rgba(96,165,250,0.45); color: #93c5fd;
}
/* panel heading suffix while in top-events mode */
#panel.top-mode .panel-head h2::after {
  content: " · 14 days"; font-size: 0.78em; opacity: 0.5; font-weight: 400;
  letter-spacing: 0; text-transform: none;
}
/* historic markers: dimmed, no pulse ring */
.ww-historic { opacity: 0.6; }
.ww-historic .pulse { display: none; }

/* ---------------- trends / stats panel ---------------- */
#trends-panel {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -46%);
  z-index: 20; width: 560px; max-width: calc(100vw - 32px);
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow); backdrop-filter: blur(18px);
  padding: 18px 20px 16px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
#trends-panel.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }
.tp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.tp-head h3 { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: 0.2px; }
#trends-close {
  background: none; border: none; color: var(--muted); font-size: 14px; cursor: pointer;
  padding: 4px 7px; border-radius: 6px; transition: color 0.15s, background 0.15s;
}
#trends-close:hover { color: var(--text); background: rgba(255,255,255,0.08); }
.tp-summary { display: flex; gap: 10px; margin-bottom: 16px; }
.tp-stat {
  flex: 1; background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 10px 12px; text-align: center;
}
.tp-stat-num { display: block; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tp-stat-label { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 3px; }
.tp-chart-wrap { position: relative; height: 220px; margin-bottom: 8px; }
.tp-legend { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; font-size: 11px; color: var(--text); margin-top: 10px; }
.tp-legend .swatch { width: 9px; height: 9px; }
.tp-sw-high { background: #fbbf24; }
.tp-sw-medium { background: var(--likely); }
.tp-sw-normal { background: #9aa7b8; }
.tp-sw-aircraft { background: #8b5cf6; }
.tp-line-swatch {
  display: inline-block; width: 14px; height: 0; margin-right: 2px;
  border-top: 2px dashed rgba(255,255,255,0.6); vertical-align: middle;
}
.tp-line-swatch.solid { border-top-style: solid; border-top-color: #38bdf8; }
.tp-caption { text-align: center; font-size: 10.5px; color: var(--muted); margin: 10px 0 0; line-height: 1.4; }

/* weekly situation brief — grounded numbers turned into 3-4 short bullets,
   see pipeline/briefing.py. Sits above the chart; "degraded" state (no AI
   this cycle) gets a subtly dimmer AUTO tag rather than hiding the content. */
.tp-brief {
  background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 10px 12px; margin-bottom: 12px;
}
.tp-brief-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
#tp-brief-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.tp-brief-age { font-size: 10px; color: var(--muted); }
.tp-brief.degraded #tp-brief-label::after {
  content: "AUTO"; margin-left: 6px; font-size: 8px; padding: 1px 4px; border-radius: 3px;
  background: rgba(139,151,167,0.18); color: var(--muted); letter-spacing: 0.5px; vertical-align: middle;
}
.tp-brief-list { list-style: none; margin: 0; padding: 0; }
.tp-brief-list li {
  font-size: 12px; line-height: 1.4; color: #c5cfdb; padding-left: 13px; position: relative; margin-bottom: 4px;
}
.tp-brief-list li::before { content: "—"; position: absolute; left: 0; color: var(--muted); }
.tp-brief-outlook { margin: 6px 0 0; padding-top: 6px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); font-style: italic; line-height: 1.4; }

/* day drill-down — reuses .event-row from the side panel for visual consistency */
.tp-dd-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tp-dd-back {
  background: none; border: none; color: var(--muted); font: inherit; font-size: 12px;
  cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.tp-dd-back:hover { color: var(--text); background: rgba(255,255,255,0.08); }
.tp-dd-date { font-size: 12px; color: var(--muted); font-weight: 600; }
.tp-dd-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.tp-dd-empty { text-align: center; padding: 28px 16px; color: var(--muted); font-size: 12px; }

@media (max-width: 720px) {
  #trends-panel { padding: 16px 14px 14px; }
  .tp-chart-wrap { height: 180px; }
  .tp-stat-num { font-size: 18px; }
}
/* ------------ theater (region) switcher — floats centered in the topbar ------------ */
#theater-switcher {
  position: absolute; top: 13px; left: 50%; transform: translateX(-50%);
  z-index: 11; display: flex; align-items: center;
  background: rgba(10, 14, 21, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px; padding: 3px; gap: 1px;
  backdrop-filter: blur(18px);
  box-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
}
.theater-btn {
  padding: 7px 22px; border-radius: 999px; border: none;
  font: inherit; font-size: 11px; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase;
  cursor: pointer; color: var(--muted); background: transparent;
  transition: color 0.18s, background 0.18s;
  white-space: nowrap;
}
.theater-btn:hover { color: var(--text); }
.theater-btn[data-region="ukraine"].active  { color: #93c5fd; background: rgba(96,165,250,0.2); }
.theater-btn[data-region="mideast"].active  { color: #fcd34d; background: rgba(251,191,36,0.17); }
.theater-btn[data-region="taiwan"].active   { color: #6ee7b7; background: rgba(52,211,153,0.17); }

/* legend territory section hidden outside Ukraine mode */
#legend.me-mode .legend-territory,
#legend.taiwan-mode .legend-territory { display: none; }

/* panel event-type filter chips */
.pf-wrap {
  display: flex; align-items: stretch; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.pf-arrow {
  flex: none; background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 0 9px; font-size: 18px; line-height: 1;
  transition: color 0.15s, opacity 0.15s;
}
.pf-arrow:hover { color: var(--text); }
.pf-arrow.pf-hidden { opacity: 0; pointer-events: none; }
.panel-filters {
  display: flex; gap: 5px; padding: 8px 2px; flex: 1 1 0; min-width: 0;
  overflow-x: auto; scrollbar-width: none;
}
.panel-filters::-webkit-scrollbar { display: none; }
.pf-chip {
  flex: none; font: inherit; font-size: 11px; font-weight: 600;
  padding: 4px 11px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03); color: var(--muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pf-chip:hover { background: rgba(255,255,255,0.07); color: var(--text); }
.pf-chip[data-filter="all"].active        { background: rgba(255,255,255,0.1);    color: var(--text);  border-color: rgba(255,255,255,0.22); }
.pf-chip[data-filter="confirmed"].active  { background: rgba(239,68,68,0.15);   color: #f87171; border-color: rgba(239,68,68,0.4); }
.pf-chip[data-filter="high"].active       { background: rgba(251,191,36,0.15);  color: #fbbf24; border-color: rgba(251,191,36,0.45); }
.pf-chip[data-filter="infrastructure"].active { background: rgba(34,211,238,0.12); color: #22d3ee; border-color: rgba(34,211,238,0.38); }
.pf-chip[data-filter="drones"].active     { background: rgba(96,165,250,0.14);  color: #60a5fa; border-color: rgba(96,165,250,0.4); }
.pf-chip[data-filter="political"].active  { background: rgba(14,165,233,0.14);  color: #38bdf8; border-color: rgba(14,165,233,0.4); }
/* same chip slot, relabeled "PLA Activity" for Taiwan — matches the violet
   gray-zone marker color instead of the drone/air blue */
.pf-chip.pf-chip-taiwan.active { background: rgba(139,92,246,0.14); color: #a78bfa; border-color: rgba(139,92,246,0.4); }
/* empty-filter state message in event list */
.pf-empty { list-style: none; text-align: center; padding: 28px 16px; color: var(--muted); font-size: 12px; }
#event-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.event-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: start;
  padding: 10px; border-radius: var(--r-md); cursor: pointer; transition: background 0.15s; }
.event-row:hover { background: rgba(255,255,255,0.05); }
.event-ic { width: 34px; height: 34px; border-radius: var(--r-md); display: grid; place-items: center; }
.event-ic svg { width: 18px; height: 18px; }
.event-body { min-width: 0; }
.event-title { font-size: 13px; font-weight: 550; line-height: 1.25; margin: 0 0 3px; }
.event-meta { font-size: 11px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.event-place { color: var(--text); opacity: 0.8; }
/* Confidence is carried once, boldly, by the colored icon tile (same color
   language as the map markers). In the row we no longer restate it as a loud
   filled pill; instead the right column surfaces IMPORTANCE (the thing worth
   scanning for) and only *uncertainty* is flagged, quietly, inside the meta
   line — so a confirmed routine event has a calm, empty right edge. */
.ev-conf { font-weight: 650; text-transform: capitalize; }
.ev-conf.provisional { color: var(--provisional); }
.ev-conf.likely { color: var(--likely); }
.ev-tag { align-self: center; font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; padding: 3px 7px; border-radius: var(--r-sm); white-space: nowrap; }
.ev-tag-high { background: rgba(251,191,36,0.14); color: #fbbf24; }
.ev-tag-rollup { background: rgba(239,68,68,0.16); color: #ff8a80; }
.conf-pill { font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px; padding: 2px 6px; border-radius: var(--r-sm); font-weight: 700; white-space: nowrap; }
.conf-pill.provisional { background: rgba(245,158,11,0.16); color: var(--provisional); }
.conf-pill.likely { background: rgba(249,115,22,0.16); color: var(--likely); }
.conf-pill.confirmed { background: rgba(239,68,68,0.16); color: var(--confirmed); }

/* ---------------- legend ---------------- */
#legend { position: absolute; bottom: 44px; left: 14px; z-index: 9;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 0; overflow: hidden;
  box-shadow: var(--shadow); backdrop-filter: blur(14px); font-size: 11px;
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.legend-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 10px 10px 14px; cursor: default;
}
.legend-head-label { display: flex; align-items: center; gap: 8px; min-width: 0; }
.legend-head-icon { width: 13px; height: 13px; flex: none; color: var(--muted); opacity: 0.85; transition: color 0.18s, opacity 0.18s; }
.legend-head-title {
  color: var(--muted); text-transform: uppercase; letter-spacing: 1.6px;
  font-size: 10px; font-weight: 700; transition: color 0.18s;
}
#legend-collapse {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 24px; height: 24px; margin: -4px;
  background: none; border: none; color: var(--muted); cursor: pointer;
  border-radius: 6px; transition: background 0.15s, color 0.15s;
}
#legend-collapse svg { width: 12px; height: 12px; transition: transform 0.28s cubic-bezier(0.4,0,0.2,1); }
#legend-collapse:hover { background: rgba(255,255,255,0.09); color: var(--text); }
/* chevron points down (invites expand) while collapsed, flips to point up
   once open — the rotation itself communicates state, no glyph-swap in JS */
#legend:not(.leg-collapsed) #legend-collapse svg { transform: rotate(180deg); }

/* collapsed = a real button, not a squashed panel: brighter label, a clear
   hover lift, and the whole bar (not just the chevron) is the click target */
#legend.leg-collapsed { cursor: pointer; }
#legend.leg-collapsed .legend-head { cursor: pointer; }
#legend.leg-collapsed .legend-head-title { color: var(--text); }
#legend.leg-collapsed .legend-head-icon { color: var(--text); opacity: 1; }
#legend.leg-collapsed:hover {
  border-color: rgba(255,255,255,0.22);
  box-shadow: 0 10px 32px rgba(0,0,0,0.5);
  transform: translateY(-1px);
}
#legend.leg-collapsed:hover .legend-head-icon { color: #fbbf24; }

.legend-body {
  padding: 0 14px 12px;
  overflow: hidden;
  max-height: 600px; opacity: 1;
  transition: max-height 0.32s cubic-bezier(0.4,0,0.2,1), opacity 0.22s ease;
  border-top: 1px solid var(--border);
}
#legend.leg-collapsed .legend-body { max-height: 0; opacity: 0; border-top-color: transparent; }
.legend-title { display: block; color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px; font-size: 10px; margin-bottom: 8px; margin-top: 10px; }
.lg { display: flex; align-items: center; gap: 8px; margin: 5px 0; color: var(--text); }
.swatch { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.swatch.conf-provisional { background: var(--provisional); }
.swatch.conf-likely { background: var(--likely); }
.swatch.conf-confirmed { background: var(--confirmed); }
.swatch.sq { border-radius: 2px; }
.swatch.terr-annexed   { background: #7f1010; border: 1px solid #b91c1c; }
.swatch.terr-occupied  { background: rgba(239,68,68,0.55); border: 1px solid #ff5a4d; }
.swatch.terr-contested { background: rgba(245,158,11,0.4); border: 1px solid rgba(245,158,11,0.6); }
.swatch.terr-hezbollah { background: rgba(190,24,93,0.45); border: 1px solid #f472b6; }
.swatch.terr-idf       { background: rgba(79,70,229,0.55); border: 1px solid #818cf8; }
.swatch.line { width: 14px; height: 0; border-radius: 0; background: none; border-top: 2px dashed #a78bfa; }
.swatch.terr-gray-zone { background: rgba(139,92,246,0.5); border: 1px solid #a78bfa; }
#legend .legend-territory-me   { display: none; }
#legend.me-mode .legend-territory-me { display: block; }
#legend .legend-territory-taiwan { display: none; }
#legend.taiwan-mode .legend-territory-taiwan { display: block; }
.legend-group + .legend-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.legend-group:last-child { padding-bottom: 0; }
.swatch.aged { opacity: 0.38; filter: saturate(45%); }
.legend-asof { display: block; margin-top: 7px; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* importance filter chips */
.imp-chip { display: flex; align-items: center; gap: 8px; width: 100%; margin: 4px 0;
  padding: 4px 6px; border: 1px solid transparent; border-radius: 7px; background: none;
  color: var(--text); font: inherit; font-size: 11px; cursor: pointer; text-align: left;
  transition: background 0.15s, opacity 0.15s; }
.imp-chip:hover { background: rgba(255,255,255,0.05); }
.imp-chip.off { opacity: 0.4; }
.imp-chip.off .imp-dot { filter: grayscale(1); }
.imp-chip.off::after { content: "hidden"; margin-left: auto; font-size: 8px; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--muted); }
.imp-dot { flex: none; border-radius: 50%; background: #9aa7b8; }
.imp-dot.high { width: 12px; height: 12px; background: var(--confirmed); box-shadow: 0 0 0 2px #fbbf24; }
.imp-dot.medium { width: 11px; height: 11px; background: var(--likely); }
.imp-dot.normal { width: 8px; height: 8px; background: #9aa7b8; }

/* importance pill in popups + accent on high-value list rows */
.imp-pill { margin-left: auto; padding: 2px 6px; border-radius: var(--r-sm); font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.4px; white-space: nowrap; }
.imp-pill.imp-high { background: rgba(251,191,36,0.18); color: #fbbf24; }
.imp-pill.imp-medium { background: rgba(249,115,22,0.16); color: var(--likely); }
.imp-pill.imp-normal { background: rgba(154,167,184,0.14); color: #9aa7b8; }
.event-row.imp-high { box-shadow: inset 2px 0 0 #fbbf24; }

/* ---------------- map markers ---------------- */
/* IMPORTANT: do not set position/size/transform on .ww-marker — MapLibre owns
   the root element (it must stay position:absolute with MapLibre's transform to
   stay pinned to lng/lat). All sizing, the positioning context, and the
   severity scale live on the inner wrapper instead. */
.ww-marker { cursor: pointer; }
.ww-marker .ww-inner { position: relative; width: 30px; height: 30px; }
/* gold ring marks high-value (strategic) targets */
.ww-marker .imp-ring {
  position: absolute; inset: -5px; border-radius: 50%;
  border: 2px solid #fbbf24; box-shadow: 0 0 8px rgba(251,191,36,0.5);
  pointer-events: none;
}
.ww-marker .disc {
  position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid rgba(255,255,255,0.85); box-shadow: 0 2px 8px rgba(0,0,0,0.5); color: #fff;
  transition: transform 0.15s;
}
.ww-marker:hover .disc { transform: scale(1.15); }
.ww-marker .disc svg { width: 16px; height: 16px; }
.ww-marker.provisional .disc { background: var(--provisional); }
.ww-marker.likely .disc { background: var(--likely); }
.ww-marker.confirmed .disc { background: var(--confirmed); }
/* political events use teal regardless of confidence tier */
.ww-marker[data-type="political"] .disc { background: #0ea5e9; }
.ww-marker[data-type="political"] .pulse { background: #0ea5e9; }
.ww-marker[data-type="political"] .imp-ring { border-color: #7dd3fc; }
/* gray-zone / surveillance activity (Taiwan) — presence & tension, not
   violence, so it gets its own hue rather than borrowing the kinetic-strike
   confidence colors (red/orange/amber) or political's teal */
.ww-marker[data-type="adiz_incursion"] .disc,
.ww-marker[data-type="naval_transit"] .disc,
.ww-marker[data-type="military_exercise"] .disc { background: #8b5cf6; }
.ww-marker[data-type="adiz_incursion"] .pulse,
.ww-marker[data-type="naval_transit"] .pulse,
.ww-marker[data-type="military_exercise"] .pulse { background: #8b5cf6; }
.ww-marker[data-type="adiz_incursion"] .imp-ring,
.ww-marker[data-type="naval_transit"] .imp-ring,
.ww-marker[data-type="military_exercise"] .imp-ring { border-color: #c4b5fd; }
/* clustered (co-located) events: one count badge, click to fan out */
.ww-cluster { cursor: pointer; }
.ww-cluster .cl-disc {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(16, 21, 31, 0.92); border: 2px solid var(--confirmed); color: #fff;
  font-weight: 700; font-size: 13px; box-shadow: 0 2px 10px rgba(0,0,0,0.55);
  transition: transform 0.12s;
}
.ww-cluster.provisional .cl-disc { border-color: var(--provisional); }
.ww-cluster.likely .cl-disc { border-color: var(--likely); }
.ww-cluster.confirmed .cl-disc { border-color: var(--confirmed); }
.ww-cluster.has-high .cl-disc { box-shadow: 0 0 0 2px #fbbf24, 0 2px 10px rgba(0,0,0,0.55); }
.ww-cluster:hover .cl-disc { transform: scale(1.12); }
.ww-cluster.expanded .cl-disc { opacity: 0.45; }
/* connector lines while a cluster is fanned out */
.spider-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.spider-lines line { stroke: rgba(255,255,255,0.55); stroke-width: 1.5; stroke-dasharray: 3 3; }

/* regional rollup marker — a "mass attack" bubble standing in for the flood */
.ww-rollup { width: 46px; height: 46px; cursor: pointer; }
.ww-rollup .rb-aura { position: absolute; inset: 0; border-radius: 50%; background: var(--confirmed);
  opacity: 0.35; animation: rb-pulse 1.8s ease-out infinite; }
@keyframes rb-pulse { 0% { transform: scale(0.7); opacity: 0.5; } 100% { transform: scale(1.5); opacity: 0; } }
.ww-rollup .rb-disc { position: absolute; inset: 6px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, #ff5a4d, #c81e10); border: 2px solid rgba(255,255,255,0.9);
  color: #fff; box-shadow: 0 3px 12px rgba(0,0,0,0.55); }
.ww-rollup .rb-disc svg { width: 17px; height: 17px; }
.ww-rollup .rb-count { position: absolute; top: -7px; right: -7px; min-width: 19px; height: 19px; padding: 0 4px;
  background: #fff; color: #c81e10; border-radius: 999px; font-size: 11px; font-weight: 800;
  display: grid; place-items: center; box-shadow: 0 1px 4px rgba(0,0,0,0.5); }
.ww-rollup:hover .rb-disc { transform: scale(1.08); }

/* rollup popup: list of struck places */
.pop-rollup .rollup-list { list-style: none; margin: 4px 0 10px; padding: 0; max-height: 190px; overflow-y: auto; }
.pop-rollup .rollup-list li { display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
  padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.pop-rollup .rollup-list li:last-child { border-bottom: none; }
.rl-place { color: var(--text); }
.rl-time { color: var(--muted); font-size: 11px; white-space: nowrap; }

/* rollup row in the side list */
.event-ic.rollup { background: radial-gradient(circle at 50% 35%, #ff5a4d, #c81e10); }
.conf-pill.rollup { background: rgba(239,68,68,0.2); color: #ff8a80; }
.event-row.is-rollup { box-shadow: inset 2px 0 0 var(--confirmed); }

/* pulsing ring for unconfirmed events */
.ww-marker.provisional .pulse {
  position: absolute; inset: 0; border-radius: 50%; background: var(--provisional);
  animation: pulse 1.8s ease-out infinite; z-index: -1;
}
@keyframes pulse { 0% { transform: scale(1); opacity: 0.55; } 100% { transform: scale(2.6); opacity: 0; } }

/* aged events (>24 h) — de-emphasize without changing size or layout */
.ww-marker.ww-aged { opacity: 0.38; filter: saturate(45%); }

/* ---------------- popup ---------------- */
.maplibregl-popup-content { background: var(--panel-solid); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 0; overflow: hidden; max-width: 300px; }
.maplibregl-popup-close-button { color: var(--muted); font-size: 18px; padding: 4px 8px; }
.maplibregl-popup-tip { display: none; }
.pop { padding: 14px 16px; }
.pop-type { display: flex; align-items: center; gap: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 8px; }
.pop-type .tic { width: 22px; height: 22px; border-radius: var(--r-sm); display: grid; place-items: center; }
.pop-type .tic svg { width: 13px; height: 13px; }
.pop h3 { margin: 0 0 6px; font-size: 15px; line-height: 1.3; }
.pop p { margin: 0 0 10px; font-size: 13px; color: #c5cfdb; line-height: 1.45; }
.pop-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 10px; }
.pop-foot .upd { color: #5fd08a; }
.pop-sources { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: flex-start; }
.pop-sources .src-more { width: 100%; }
.pop-sources .src-more summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center;
  font-size: 11px; color: var(--muted); padding: 2px 7px; border-radius: 5px;
  background: rgba(255,255,255,0.04); user-select: none; transition: color 0.12s, background 0.12s; }
.pop-sources .src-more summary::-webkit-details-marker { display: none; }
.pop-sources .src-more summary:hover { color: var(--text); background: rgba(255,255,255,0.08); }
.pop-sources .src-more[open] summary { color: var(--text); }
.pop-sources .src-expanded { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pop-sources a { font-size: 11px; color: #7fb2ff; text-decoration: none; background: rgba(127,178,255,0.1); padding: 3px 7px; border-radius: 5px; }
.pop-sources a.authoritative { color: #fbbf24; background: rgba(251,191,36,0.14); font-weight: 600; }
.pop-sources a.reliable { color: #7dd3fc; background: rgba(125,211,252,0.13); font-weight: 600; }
.pop-sources .src-ev { display: inline-block; margin-left: 6px; padding: 1px 5px; border-radius: 3px; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; vertical-align: middle; }
.pop-sources .src-ev.footage { background: rgba(96,165,250,0.22); color: #93c5fd; }
.pop-sources .src-ev.official { background: rgba(167,139,250,0.22); color: #c4b5fd; }
.sev { display: inline-flex; gap: 2px; }
.sev i { width: 5px; height: 11px; border-radius: 1px; background: rgba(255,255,255,0.18); }
.sev i.on { background: var(--accent); }

/* ---- event share: button in the popup footer + two-option menu ---- */
.pop-foot-r { display: inline-flex; align-items: center; gap: 8px; }
.pop-share-wrap { position: relative; display: inline-flex; }
.pop-share { display: grid; place-items: center; width: 22px; height: 22px; padding: 0;
  background: none; border: none; border-radius: var(--r-sm); color: var(--muted); cursor: pointer;
  transition: color 0.12s, background 0.12s; }
.pop-share svg { width: 13px; height: 13px; }
.pop-share:hover, .pop-share[aria-expanded="true"] { color: var(--text); background: rgba(255,255,255,0.08); }
/* opens upward from the footer so it stays inside the popup's overflow:hidden box */
.share-menu { position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 5; min-width: 150px;
  background: var(--panel-solid); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow); padding: 4px; }
.share-opt { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 9px;
  background: none; border: none; border-radius: var(--r-sm); color: var(--text);
  font: inherit; font-size: 12px; cursor: pointer; text-align: left; white-space: nowrap; }
.share-opt svg { width: 13px; height: 13px; flex: none; color: var(--muted); }
.share-opt:hover { background: rgba(255,255,255,0.07); }
.share-opt:hover svg { color: var(--text); }

/* toast — currently only deep-link misses ("event no longer available") */
.ww-toast { position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 8px); z-index: 60;
  max-width: min(420px, 86vw); padding: 10px 16px; border-radius: var(--r-md);
  background: var(--panel-solid); border: 1px solid var(--border); box-shadow: var(--shadow);
  color: var(--text); font-size: 12.5px; line-height: 1.4; opacity: 0; pointer-events: none;
  transition: opacity 0.3s, transform 0.3s; }
.ww-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- cascade ("Global impact") tree — collapsed by default, same native
   <details> pattern as the source fold. Likelihood is text, not our
   confidence pills — projections must never look like confirmed facts. ---- */
.cascade { margin: 0 0 10px; }
.cascade summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
  font-size: 11px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase;
  color: var(--muted); padding: 4px 9px; border-radius: 6px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  user-select: none; transition: color 0.12s, background 0.12s; }
.cascade summary::-webkit-details-marker { display: none; }
.cascade summary:hover { color: var(--text); background: rgba(255,255,255,0.08); }
.cascade[open] summary { color: var(--text); }
.cascade summary svg { width: 12px; height: 12px; }
.cascade .cs-sim { font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 3px;
  background: rgba(139,151,167,0.18); color: var(--muted); letter-spacing: 0.5px; }
.cs-body { margin-top: 8px; max-height: 230px; overflow-y: auto; }
.cs-head { font-size: 11px; color: var(--muted); line-height: 1.4; margin-bottom: 7px; }
.cs-trend { font-size: 11px; color: #fbbf24; line-height: 1.4; margin-bottom: 8px; padding: 5px 8px;
  background: rgba(251,191,36,0.08); border-radius: 5px; border-left: 2px solid rgba(251,191,36,0.5); }
.cs-tree, .cs-tree ul { list-style: none; margin: 0; padding: 0; }
.cs-tree ul { margin-left: 5px; padding-left: 11px; border-left: 1px solid var(--border); }
.cs-n { margin: 0 0 5px; }
.cs-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cs-lbl { font-size: 12px; line-height: 1.35; color: #c5cfdb; }
.cs-prob { flex-shrink: 0; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.cs-likely .cs-row > .cs-prob { color: var(--provisional); }
.cs-possible .cs-row > .cs-prob { color: #8b97a7; }
.cs-speculative .cs-row > .cs-prob { color: #5c6774; }
.cs-speculative > .cs-row > .cs-lbl { color: #8b97a7; }
.cs-note { font-size: 10px; color: #5c6774; line-height: 1.4; margin-top: 7px;
  border-top: 1px solid var(--border); padding-top: 7px; }

/* ---- legend toggle button (visible only on mobile) ---- */
#legend-btn {
  display: none;
  position: absolute; z-index: 9;
  width: 36px; height: 36px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-md);
  backdrop-filter: blur(14px); box-shadow: var(--shadow);
  align-items: center; justify-content: center;
  cursor: pointer; color: var(--muted);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
#legend-btn:hover { color: var(--text); border-color: rgba(255,255,255,0.18); }
#legend-btn.active { color: var(--text); background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.2); }

@media (max-width: 720px) {
  /* ══ TOP BAR — minimal chrome, map is the product ════════════════ */
  #topbar { padding: 0 16px; height: 52px; gap: 0; }
  /* 11px, not the old 16px: "WW3Map.online" (added 2026-07-11, was
     "WW3.online") is 3 chars longer and the centered #theater-switcher pill's
     left edge is fixed regardless of brand width — the old size left almost
     no headroom (verified: switcher's left edge sits ~98px from the topbar's
     left padding) and the longer name collided with it. Checked against the
     live viewport rather than guessing: 11px is the largest size that clears
     the switcher with a comfortable gap at 375px width. */
  .brand-mark { font-size: 11px; letter-spacing: -0.2px; }
  .brand-sub { display: none; }
  /* hide stat pills — event count lives in the panel */
  .stat-cluster { display: none; }
  /* alerts toggle: amber pulse dot only, no pill chrome */
  .alerts-toggle {
    padding: 4px 8px; gap: 0;
    background: transparent; border-color: transparent; box-shadow: none;
  }
  .alerts-toggle .al-text { display: none; }
  .alerts-toggle .al-count { display: none; }
  /* live: green dot only */
  .live { padding: 4px 6px; gap: 0; background: transparent; border-color: transparent; }
  #updated { display: none; }

  /* ══ THEATER SWITCHER — float inside topbar height ═══════════════ */
  #theater-switcher { top: 10px; }
  /* abbreviate button labels: "Ukraine" → "UA", "Middle East" → "ME" */
  .theater-btn { font-size: 0; letter-spacing: 0; padding: 6px 14px; }
  .theater-btn::after {
    font-size: 10px; font-weight: 700;
    letter-spacing: 0.07em; text-transform: uppercase;
  }
  .theater-btn[data-region="ukraine"]::after { content: "UA"; }
  .theater-btn[data-region="mideast"]::after  { content: "ME"; }
  .theater-btn[data-region="taiwan"]::after   { content: "TW"; }

  /* ══ PANEL — taller bottom sheet, cleaner chrome ═════════════════ */
  #panel {
    top: auto; bottom: 0; left: 0; right: 0; width: 100%;
    max-height: 65vh;
    border-radius: 22px 22px 0 0;
    border-bottom: 0; border-left: 0; border-right: 0;
  }
  #panel.collapsed { max-height: 52px; }
  /* drag handle */
  .panel-head { position: relative; padding: 20px 16px 12px; }
  .panel-head::before {
    content: ""; position: absolute; top: 9px; left: 50%;
    transform: translateX(-50%);
    width: 36px; height: 4px; border-radius: 2px;
    background: rgba(255,255,255,0.2);
  }
  .panel-head h2 { font-size: 11px; }
  /* #panel-toggle (below) is absolutely positioned INSIDE .ph-btns, not a sibling
     of it — so it paints over its own sibling buttons regardless of .ph-btns'
     own z-index (that only matters relative to elements outside .ph-btns). Each
     real button needs its own stacking position to win. */
  .ph-btns { position: relative; z-index: 2; }
  #top-events-btn, #trends-btn { position: relative; z-index: 3; font-size: 10px; padding: 3px 7px; }
  /* invisible tap overlay — no visible arrow needed, handle communicates gesture */
  #panel-toggle {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    font-size: 0;
    border: none; background: none; cursor: pointer;
  }
  #legend-btn.panel-open { display: none !important; }

  /* ══ FILTER CHIPS — no scroll arrows, generous touch targets ═════ */
  .pf-arrow { display: none; }
  .panel-filters { padding: 8px 12px; gap: 6px; }
  .pf-chip { padding: 6px 13px; font-size: 11px; }

  /* ══ EVENT ROWS — single-line scan layout ════════════════════════ */
  .event-row { padding: 11px 10px; }
  /* one line only — truncate long titles */
  .event-title {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-size: 13px; margin-bottom: 3px;
  }
  /* confidence: small colored dot instead of text badge */
  .conf-pill {
    width: 6px; height: 6px; border-radius: 50%;
    padding: 0; font-size: 0; letter-spacing: 0;
    flex-shrink: 0; align-self: center;
    background: var(--muted);
  }
  .conf-pill.provisional { background: var(--provisional); }
  .conf-pill.likely      { background: var(--likely); }
  .conf-pill.confirmed   { background: var(--confirmed); }
  .conf-pill.rollup      { background: #ff8a80; }

  /* ══ LEGEND ══════════════════════════════════════════════════════ */
  #legend {
    display: none; bottom: 110px;
    right: 14px; left: auto;
    max-width: calc(100vw - 28px);
  }
  #legend.mobile-open { display: block; }
  #legend-btn { display: flex; bottom: 62px; right: 14px; width: 40px; height: 40px; border-radius: 11px; }

  /* ══ MAP CHROME ══════════════════════════════════════════════════ */
  .maplibregl-ctrl-bottom-right .maplibregl-ctrl-group { display: none !important; }
  .maplibregl-ctrl-bottom-left  { bottom: 58px !important; }
  .maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner,
  .maplibregl-ctrl-attrib .maplibregl-ctrl-attrib-inner { display: none !important; }
  .maplibregl-ctrl-attrib-button { display: block !important; opacity: 0.6; }
  .maplibregl-ctrl-attrib.maplibregl-compact { background: transparent !important; box-shadow: none !important; }
}

/* ============================================================
   Strike Range Tool
   ============================================================ */

#range-btn {
  position: absolute; top: 74px; left: 14px; z-index: 9;
  display: flex; align-items: center; gap: 7px;
  font: inherit; font-size: 12px; color: var(--muted);
  background: var(--panel); border: 1px solid var(--border);
  padding: 6px 11px 6px 9px; border-radius: 999px; cursor: pointer;
  backdrop-filter: blur(8px); box-shadow: var(--shadow);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
#range-btn:hover { color: var(--text); border-color: rgba(255,255,255,0.18); }
#range-btn.active { color: #60a5fa; border-color: rgba(96,165,250,0.5); background: rgba(96,165,250,0.1); }

#range-panel {
  position: absolute; top: 116px; left: 14px; z-index: 9;
  width: 288px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow); backdrop-filter: blur(14px); overflow: hidden;
  max-height: 0; opacity: 0; pointer-events: none;
  transition: max-height 0.28s cubic-bezier(0.4,0,0.2,1), opacity 0.18s ease;
}
#range-panel.open { max-height: calc(100vh - 130px); opacity: 1; pointer-events: auto; }

.rp-head { padding: 8px 8px 8px; border-bottom: 1px solid var(--border); }
.rp-side-toggle {
  display: flex; gap: 3px;
  background: rgba(255,255,255,0.04); border-radius: var(--r-md); padding: 3px;
}
.rst-btn {
  flex: 1; border: none; border-radius: var(--r-sm); padding: 5px 8px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; color: var(--muted); background: transparent;
  transition: background 0.15s, color 0.15s;
}
.rst-btn:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.rst-btn.rst-ua.active { background: rgba(96,165,250,0.18); color: #93c5fd; }
.rst-btn.rst-ru.active { background: rgba(248,113,113,0.18); color: #fca5a5; }
.rst-btn.rst-il.active { background: rgba(96,165,250,0.18); color: #93c5fd; }
.rst-btn.rst-ir.active { background: rgba(248,113,113,0.18); color: #fca5a5; }
/* empty weapon list in a theater with no data yet */
.rp-empty-theater {
  padding: 28px 16px; text-align: center;
  color: var(--muted); font-size: 12px; line-height: 1.6;
}
.rp-weapons { overflow-y: auto; max-height: calc(100vh - 300px); padding: 5px 6px 3px; }
.rp-hint {
  padding: 9px 12px 11px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--muted);
  display: flex; align-items: center; gap: 8px; line-height: 1.4;
}

/* weapon cards */
.wp-card {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 8px 7px 6px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; margin-bottom: 2px;
  transition: background 0.12s, border-color 0.12s;
}
.wp-card:hover { background: rgba(255,255,255,0.05); }
.wp-card.selected { background: rgba(96,165,250,0.09); border-color: rgba(96,165,250,0.38); }
.wp-icon {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; flex: none;
}
.wp-body { flex: 1; min-width: 0; }
.wp-name { font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.2; }
.wp-cat  { font-size: 10px; color: var(--muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.4px; }
.wp-range-badge {
  font-size: 11px; font-weight: 700; color: var(--muted);
  background: rgba(255,255,255,0.07); border-radius: 6px;
  padding: 2px 7px; white-space: nowrap; flex: none;
  font-variant-numeric: tabular-nums;
}
.wp-card.selected .wp-range-badge { background: rgba(96,165,250,0.2); color: #93c5fd; }

/* launch marker */
.range-launch-marker {
  width: 30px; height: 30px; position: relative; cursor: grab;
}
.range-launch-marker:active { cursor: grabbing; }
.rlm-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px dashed rgba(96,165,250,0.75);
  animation: rlm-rotate 10s linear infinite;
}
@keyframes rlm-rotate { to { transform: rotate(360deg); } }
.rlm-inner {
  position: absolute; inset: 8px; border-radius: 50%;
  background: #60a5fa;
  box-shadow: 0 0 10px rgba(96,165,250,0.65), 0 0 0 2px rgba(96,165,250,0.25);
}
.rlm-h { position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: rgba(96,165,250,0.4); transform: translateY(-50%); }
.rlm-v { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: rgba(96,165,250,0.4); transform: translateX(-50%); }

/* hide the legend when range panel is open to avoid overlap */
#legend.range-hidden { display: none !important; }

@media (max-width: 720px) {
  /* theater-switcher top already set in main mobile block above */
  #range-btn { top: 62px; padding: 8px 10px; gap: 0; }
  #range-btn span { display: none; }  /* icon only on mobile */
  #range-panel { top: 112px; left: 14px; width: calc(100vw - 28px); }
  .rp-weapons { max-height: 200px; }
}
