/* ═══════════════════════════════════════════════════════════════
   OSINT Map Template - Stylesheet
   Self-contained: lives alongside index.html in map-template/
   ═══════════════════════════════════════════════════════════════ */

/* ── Theme Variables ─────────────────────────────────── */
:root {
  --theme-bg: #0a0e1a;
  --theme-text: #c8d6e5;
  --theme-accent: #00ff64;
  --theme-accent-rgb: 0, 255, 100;
  --theme-label: #5a6a7a;
  --theme-meta: #6b7b8a;
  --theme-muted: #7b8b9a;
  --theme-border: rgba(0, 255, 100, 0.15);
  --theme-border-subtle: rgba(0, 255, 100, 0.1);
  --theme-border-faint: rgba(0, 255, 100, 0.05);
  --theme-glow: rgba(0, 255, 100, 0.4);
  --theme-glow-soft: rgba(0, 255, 100, 0.3);
  --theme-hover: rgba(0, 255, 100, 0.1);
  --theme-hover-subtle: rgba(0, 255, 100, 0.03);
  --theme-surface: rgba(10, 14, 26, 0.92);
  --theme-surface-solid: rgba(10, 14, 26, 0.95);
  --theme-surface-dim: rgba(10, 14, 26, 0.9);
  --theme-record: #dc2626;
  --theme-record-rgb: 220, 38, 38;
  --theme-warn: #ff6b6b;
  --theme-success: #00ff64;
  --theme-warning: #fbbf24;
  --theme-cyan: #22d3ee;
  --theme-verified: #22c55e;
  --theme-accent-dim: rgba(0, 255, 100, 0.08);

  /* Glow default — transparent prevents green blob when clustering (S410) */
  --glow-color: transparent;

  /* State colors - visual states for markers/badges */
  --state-unverified: #94a3b8;
  --state-inactive: #64748b;
  --state-inactive-dark: #2d3748;
  --state-developing: #4a5568;
  --state-fallback: #999;

  /* Nuclear risk tier colors */
  --nuclear-high: #dc2626;
  --nuclear-elevated: #f97316;
  --nuclear-default: #eab308;

  /* Font stacks */
  --font-display: 'Orbitron', monospace;
  --font-mono: 'Share Tech Mono', monospace;

  /* Border radius scale */
  --radius-sm: 3px;
  --radius-md: 4px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  --sidebar-width: 320px;
  --sidebar-toggle-gap: 10px;
  --hud-height: 44px;
  --brand-height: 70px;
  --sidebar-top: calc(var(--hud-height) + var(--brand-height));
  --marker-size: 30px;
}

/* ── Reset ────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-mono);
  background: var(--theme-bg);
  color: var(--theme-text);
  overflow: hidden;
}

/* ── Map Container ───────────────────────────────────── */
#map {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1;
  overflow: visible !important;
}
.leaflet-pane, .leaflet-tooltip-pane { overflow: visible !important; }

/* ── Tile smoothness: themed background eliminates white/dark flashes ── */
.leaflet-container { background: var(--tile-bg, #0a0e1a) !important; }
.leaflet-tile-pane { background: var(--tile-bg, #0a0e1a); will-change: transform; contain: layout style; }
.leaflet-marker-pane { will-change: transform; }
.leaflet-tile { transition-duration: 0.1s !important; }

/* ── Recording mode: pause expensive animations for GPU headroom ── */
body.recording .marker-ring { animation: none !important; }
body.recording #scan-overlay::after { animation: none !important; }
body.recording .animated-path { animation: none !important; }
body.recording .missile-trajectory { animation: none !important; }
body.recording .threat-blink { animation-play-state: paused !important; }

/* ── Scan Line Overlay ───────────────────────────────── */
#scan-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 999;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(var(--theme-accent-rgb), 0.015) 2px,
    rgba(var(--theme-accent-rgb), 0.015) 4px
  );
  mix-blend-mode: screen;
}

#scan-overlay::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(var(--theme-accent-rgb), 0.12), transparent);
  animation: scanSweep 8s linear infinite;
}

@keyframes scanSweep {
  0% { top: 0; }
  100% { top: 100%; }
}

/* ── HUD Header Bar ──────────────────────────────────── */
#hud-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--hud-height);
  background: linear-gradient(180deg, var(--theme-surface-solid) 0%, rgba(10, 14, 26, 0.85) 100%);
  border-bottom: 1px solid var(--theme-border);
  z-index: 1002;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 14px;
  letter-spacing: 1px;
}

.hud-section {
  display: flex;
  align-items: center;
  gap: 20px;
}

.hud-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--theme-accent);
  text-shadow: 0 0 10px var(--theme-glow);
}

.hud-divider {
  width: 1px;
  height: 20px;
  background: rgba(var(--theme-accent-rgb), 0.2);
}

.hud-stat {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-stat-label {
  color: var(--theme-label);
  font-size: 11px;
  text-transform: uppercase;
}

.hud-stat-value {
  color: var(--theme-text);
  font-weight: 700;
}

/* HUD stat value color variants */
.hud-stat-value--active {
  color: var(--theme-accent);
}

.hud-stat-value--developing {
  color: var(--state-unverified);
}

.hud-threat-level {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border: 1px solid;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.hud-threat-level.blink {
  animation: threatBlink 1s ease-in-out infinite;
}

@keyframes threatBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.hud-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: dotPulse 2s ease-in-out infinite;
}

/* HUD dot - system online default */
.hud-dot--online {
  color: var(--theme-accent);
  background: var(--theme-accent);
}

@keyframes dotPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 4px currentColor; }
  50% { opacity: 0.4; box-shadow: 0 0 8px currentColor; }
}

.hud-clock {
  color: var(--theme-accent);
  font-size: 13px;
  text-shadow: 0 0 6px var(--theme-glow-soft);
}

/* HUD watermark toggle button */
.hud-wm-toggle {
  background: none;
  border: 1px solid rgba(var(--theme-accent-rgb), 0.2);
  color: var(--theme-accent);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.2s;
}

/* ── Sidebar ─────────────────────────────────────────── */
#sidebar {
  position: absolute;
  top: var(--sidebar-top); left: 0;
  width: var(--sidebar-width);
  height: calc(100% - var(--sidebar-top));
  background: var(--theme-surface);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  border-right: 1px solid var(--theme-border-subtle);
}

#sidebar.collapsed {
  transform: translateX(calc(-1 * var(--sidebar-width)));
}

#sidebar-toggle {
  position: absolute;
  top: calc(var(--sidebar-top) + var(--sidebar-toggle-gap));
  left: calc(var(--sidebar-width) + var(--sidebar-toggle-gap));
  z-index: 1001;
  width: 32px;
  height: 32px;
  background: var(--theme-surface-dim);
  border: 1px solid rgba(var(--theme-accent-rgb), 0.2);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--theme-accent);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: left 0.3s ease;
}

#sidebar.collapsed + #sidebar-toggle {
  left: var(--sidebar-toggle-gap);
  border-radius: var(--radius-md);
}

#sidebar-toggle:hover {
  background: var(--theme-hover);
}

.sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--theme-border-subtle);
  flex-shrink: 0;
}

.sidebar-header h1 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--theme-accent);
  text-shadow: 0 0 8px var(--theme-glow-soft);
  margin-bottom: 2px;
  letter-spacing: 2px;
}

.sidebar-header p {
  font-size: 13px;
  color: var(--theme-muted);
  letter-spacing: 1px;
}

/* ── Sidebar Tabs ────────────────────────────────────── */
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--theme-border-subtle);
  flex-shrink: 0;
}

.sidebar-tabs button {
  flex: 1;
  padding: 10px 6px;
  background: none;
  border: none;
  color: var(--theme-label);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}

.sidebar-tabs button.active {
  color: var(--theme-accent);
  border-bottom-color: var(--theme-accent);
  text-shadow: 0 0 6px var(--theme-glow-soft);
}

.sidebar-tabs button:hover {
  color: var(--theme-text);
}

.tab-content {
  display: none;
  padding: 12px 16px;
  overflow-y: auto;
  flex: 1;
}

.tab-content.active {
  display: block;
}

/* Scrollbar styling */
.tab-content::-webkit-scrollbar {
  width: 4px;
}
.tab-content::-webkit-scrollbar-track {
  background: transparent;
}
.tab-content::-webkit-scrollbar-thumb {
  background: rgba(var(--theme-accent-rgb), 0.2);
  border-radius: 2px;
}

/* ── Layer Controls ──────────────────────────────────── */
.layer-group {
  margin-bottom: 16px;
}

.layer-group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--theme-meta);
  margin-bottom: 8px;
  display: block;
  border-bottom: 1px solid var(--theme-border-faint);
  padding-bottom: 4px;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
}

.layer-item:hover {
  padding-left: 4px;
}

.layer-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}

.layer-item input[type="checkbox"] {
  display: none;
}

.layer-item.disabled .layer-label {
  text-decoration: line-through;
  opacity: 0.3;
}

.layer-item.disabled .layer-dot {
  opacity: 0.2;
  box-shadow: none;
}

.layer-label {
  font-size: 14px;
  flex: 1;
}

.layer-count {
  font-size: 11px;
  color: var(--theme-accent);
  background: rgba(var(--theme-accent-rgb), 0.1);
  padding: 1px 6px;
  border-radius: 2px;
  border: 1px solid var(--theme-border);
}

/* ── Layer Dot Variants (for JS-generated layer items) ── */
.layer-dot--threat-rings {
  background: var(--theme-record);
}

.layer-dot--connections {
  background: var(--theme-accent);
}

.layer-dot--heatmap {
  background: linear-gradient(135deg, #22c55e, #dc2626);
}

.layer-dot--developing {
  background: var(--state-developing);
  border: 1px dashed var(--state-unverified);
}

.layer-dot--resolved {
  background: var(--state-inactive-dark);
  border: 1px solid var(--state-inactive);
  opacity: 0.5;
}

.layer-dot--aor-master {
  background: linear-gradient(135deg, #22c55e, #3b82f6);
}

/* Layer icon (category icons in sidebar) */
.layer-cat-icon {
  font-size: 12px;
  flex-shrink: 0;
}

/* ── Events List ─────────────────────────────────────── */
.event-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--theme-border-faint);
  cursor: pointer;
  transition: all 0.15s;
}

.event-item:hover {
  background: var(--theme-hover-subtle);
  padding-left: 6px;
}

.event-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.event-active-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  animation: dotPulse 1.5s ease-in-out infinite;
}

.event-meta {
  font-size: 12px;
  color: var(--theme-meta);
  letter-spacing: 0.5px;
}

.event-severity {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  margin-left: 4px;
  letter-spacing: 1px;
}

/* Event icon in sidebar list */
.event-cat-icon {
  font-size: 10px;
}

/* ── Event Status Tags (base + modifiers) ────────────── */
.event-status-tag {
  display: inline-block;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
  margin-left: 4px;
  vertical-align: middle;
}

.event-status-tag--inactive,
.event-inactive-tag {
  background: rgba(100, 116, 139, 0.1);
  color: var(--state-inactive);
  border: 1px solid rgba(100, 116, 139, 0.2);
}

.event-status-tag--developing,
.event-developing-tag {
  background: rgba(148, 163, 184, 0.15);
  color: var(--state-unverified);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

/* Resolved tag variant */
.event-status-tag--resolved,
.event-resolved-tag {
  background: rgba(100, 116, 139, 0.15);
  color: var(--state-inactive);
}

/* ── Legend ───────────────────────────────────────────── */
.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 14px;
}

.legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}

.legend-icon {
  width: 24px;
  text-align: center;
  font-size: 14px;
}

/* Legend - verification status swatches */
.legend-swatch--verified {
  background: var(--theme-verified);
  border: 2px solid rgba(34, 197, 94, 0.6);
}

.legend-swatch--developing {
  background: var(--state-developing);
  border: 2px dashed rgba(148, 163, 184, 0.7);
  opacity: 0.7;
}

.legend-swatch--resolved {
  background: var(--state-inactive-dark);
  border: 2px solid rgba(100, 116, 139, 0.5);
  opacity: 0.45;
}

/* Legend - map symbols section */
.legend-symbols-text {
  color: var(--theme-label);
}

.legend-symbol--threat {
  color: var(--theme-record);
  opacity: 0.3;
}

.legend-symbol--missile {
  color: #ff4444;
}

.legend-symbol--connection {
  color: var(--theme-accent);
}

.legend-symbol--active-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--theme-accent);
  animation: dotPulse 1.5s infinite;
}

/* ── About / Stats ───────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.stat-card {
  background: var(--theme-hover-subtle);
  border: 1px solid rgba(var(--theme-accent-rgb), 0.08);
  border-radius: var(--radius-md);
  padding: 10px;
  text-align: center;
}

.stat-card-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--theme-accent);
  text-shadow: 0 0 10px var(--theme-glow-soft);
}

.stat-card-value--active {
  color: var(--theme-accent);
}

.stat-card-value--verified {
  color: var(--theme-verified);
}

.stat-card-value--developing {
  color: var(--state-unverified);
}

.stat-card-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--theme-meta);
  margin-top: 4px;
}

.about-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--theme-muted);
  margin-bottom: 12px;
}

/* ── Zoom Slider Control ─────────────────────────────── */
#zoom-slider-control {
  position: absolute;
  top: 60px;
  right: 10px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  background: var(--theme-surface);
  border: 1px solid rgba(var(--theme-accent-rgb), 0.2);
  border-radius: var(--radius-md);
  padding: 4px;
  backdrop-filter: blur(8px);
}

#zoom-slider-control button {
  width: 30px;
  height: 30px;
  background: var(--theme-surface-dim);
  color: var(--theme-accent);
  border: 1px solid rgba(var(--theme-accent-rgb), 0.2);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  border-radius: 2px;
}

#zoom-slider-control button:hover {
  background: var(--theme-hover);
  box-shadow: 0 0 8px rgba(var(--theme-accent-rgb), 0.15);
}

#zoom-slider-control button:active {
  background: rgba(var(--theme-accent-rgb), 0.2);
}

#zoom-slider {
  -webkit-appearance: none;
  appearance: none;
  writing-mode: vertical-lr;
  direction: rtl;
  width: 6px;
  height: 150px;
  margin: 6px 0;
  background: transparent;
  cursor: pointer;
}

#zoom-slider::-webkit-slider-runnable-track {
  width: 6px;
  height: 150px;
  background: rgba(var(--theme-accent-rgb), 0.1);
  border: 1px solid rgba(var(--theme-accent-rgb), 0.2);
  border-radius: var(--radius-sm);
}

#zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 10px;
  background: var(--theme-accent);
  border-radius: 2px;
  cursor: pointer;
  margin-left: -5px;
  box-shadow: 0 0 6px var(--theme-glow);
}

#zoom-slider::-moz-range-track {
  width: 6px;
  height: 150px;
  background: rgba(var(--theme-accent-rgb), 0.1);
  border: 1px solid rgba(var(--theme-accent-rgb), 0.2);
  border-radius: var(--radius-sm);
}

#zoom-slider::-moz-range-thumb {
  width: 16px;
  height: 10px;
  background: var(--theme-accent);
  border: none;
  border-radius: 2px;
  cursor: pointer;
  box-shadow: 0 0 6px var(--theme-glow);
}

#zoom-level-display {
  font-family: var(--font-display);
  font-size: 9px;
  color: var(--theme-label);
  letter-spacing: 1px;
  margin-top: 2px;
}

/* ── Map Controls Override ───────────────────────────── */
/* Layer selector hidden - using HUD dropdown instead */
.leaflet-control-layers { display: none !important; }

#hud-layer-select {
  background: rgba(10, 14, 26, 0.8);
  color: var(--theme-accent);
  border: 1px solid rgba(var(--theme-accent-rgb), 0.3);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2300ff64'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  padding-right: 20px;
}
#hud-layer-select:hover {
  border-color: rgba(var(--theme-accent-rgb), 0.6);
  background-color: rgba(var(--theme-accent-rgb), 0.05);
}
#hud-layer-select option {
  background: var(--theme-bg);
  color: var(--theme-text);
}

.leaflet-control-zoom a {
  background: var(--theme-surface-dim) !important;
  color: var(--theme-accent) !important;
  border-color: rgba(var(--theme-accent-rgb), 0.2) !important;
  font-family: var(--font-mono) !important;
}

.leaflet-control-zoom a:hover {
  background: var(--theme-hover) !important;
}

/* ── Popups ──────────────────────────────────────────── */
.leaflet-popup-content-wrapper {
  background: var(--theme-surface-solid);
  color: var(--theme-text);
  border-radius: var(--radius-md);
  border: 1px solid rgba(var(--theme-accent-rgb), 0.2);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6), 0 0 20px rgba(var(--theme-accent-rgb), 0.05);
  font-family: var(--font-mono);
}

.leaflet-popup-tip {
  background: var(--theme-surface-solid);
  border: 1px solid rgba(var(--theme-accent-rgb), 0.2);
}

.leaflet-popup-close-button {
  color: var(--theme-label) !important;
  font-size: 18px !important;
}

.popup-header {
  border-bottom: 1px solid var(--theme-border-subtle);
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.popup-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--theme-accent);
  text-shadow: 0 0 6px rgba(var(--theme-accent-rgb), 0.2);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
  line-height: 1.3;
}

.popup-date {
  font-size: 13px;
  color: var(--theme-meta);
  letter-spacing: 1px;
}

.popup-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.popup-category {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 2px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
}

.popup-desc {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 10px;
  color: #a8b2c8;
}

.popup-source {
  font-size: 12px;
  color: var(--theme-muted);
  border-top: 1px solid var(--theme-border-subtle);
  padding-top: 8px;
  letter-spacing: 0.5px;
}

.popup-source a {
  color: var(--theme-accent);
  text-decoration: none;
}

.popup-source a:hover {
  text-decoration: underline;
}

.popup-verified {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
}

.verified-true  { background: rgba(34, 197, 94, 0.2); color: var(--theme-verified); border: 1px solid rgba(34, 197, 94, 0.3); }
.verified-false { background: rgba(148, 163, 184, 0.2); color: var(--state-unverified); border: 1px solid rgba(148, 163, 184, 0.3); }
.verified-null  { background: rgba(100, 116, 139, 0.2); color: var(--state-inactive); border: 1px solid rgba(100, 116, 139, 0.3); }

/* ── Popup Content - JS-generated classes ────────────── */
.popup-container {
  min-width: 260px;
  max-width: 400px;
}

/* Nuclear risk badge */
.popup-nuclear-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

/* Parties row (conflict popups) */
.popup-parties {
  margin: 6px 0 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.popup-party-tag {
  background: rgba(255, 255, 255, 0.08);
  color: var(--theme-text);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Cyber attacker/target line */
.popup-cyber-line {
  margin: 6px 0 4px;
  font-size: 11px;
  color: var(--state-unverified);
}

.popup-cyber-arrow {
  color: #ff4444;
}

.popup-cyber-crosshair {
  color: #ff4444;
}

.popup-confidence--confirmed {
  color: var(--theme-verified);
}

.popup-confidence--unconfirmed {
  color: #f59e0b;
}

.popup-state-backed {
  color: var(--theme-record);
}

/* Casualties / displaced row */
.popup-casualties {
  margin: 6px 0 2px;
  font-size: 11px;
  color: var(--state-unverified);
}

.popup-icon--casualties {
  color: var(--theme-record);
  width: 14px;
}

.popup-icon--displaced {
  color: var(--nuclear-elevated);
  width: 14px;
}

/* Nuclear risk reason */
.popup-nuclear-reason {
  margin: 4px 0;
  font-size: 10px;
  color: #f59e0b;
  font-style: italic;
}

.popup-icon--nuclear {
  width: 14px;
}

/* International involvement */
.popup-intl-involvement {
  margin: 4px 0;
  font-size: 10px;
  color: var(--theme-muted);
}

.popup-icon--globe {
  width: 14px;
}

/* Snapshot summary */
.popup-snapshot {
  margin: 6px 0;
  padding: 6px 8px;
  background: rgba(var(--theme-accent-rgb), 0.03);
  border-left: 2px solid rgba(var(--theme-accent-rgb), 0.2);
  font-size: 10px;
  color: #8b9bab;
}

/* Alert link count */
.popup-alert-link {
  margin: 4px 0;
  font-size: 10px;
  color: var(--theme-accent);
}

.popup-icon--alert {
  width: 14px;
}

/* Action buttons row */
.popup-actions {
  margin: 8px 0 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.popup-action-link {
  font-size: 10px;
  text-decoration: none;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

.popup-action-link--analysis {
  color: var(--theme-accent);
  border: 1px solid rgba(var(--theme-accent-rgb), 0.2);
}

.popup-action-link--alerts {
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.popup-action-link--report {
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

/* ── Marker Visual States ────────────────────────────── */

/* Developing/Monitoring marker - grayscale with dashed border */
.marker-developing .marker-icon-bg {
  background: var(--state-developing) !important;
  border: 2px dashed rgba(148, 163, 184, 0.7) !important;
  opacity: 0.7;
}
.marker-developing .fa-icon {
  color: var(--state-unverified) !important;
}
.marker-developing .marker-ring {
  display: none;
}

/* Inactive marker - faded with solid border (distinct from developing's dashed) */
.marker-inactive .marker-icon-bg {
  background: var(--state-inactive-dark) !important;
  border: 2px solid rgba(100, 116, 139, 0.5) !important;
  opacity: 0.45;
}
.marker-inactive .fa-icon {
  color: var(--state-inactive) !important;
  opacity: 0.6;
}
.marker-inactive .marker-ring {
  display: none;
}

/* ── Search Box ──────────────────────────────────────── */
#search-box {
  position: absolute;
  top: 54px;
  right: 10px;
  z-index: 1000;
}

#search-box input {
  width: 220px;
  padding: 7px 12px;
  background: var(--theme-surface-dim);
  border: 1px solid rgba(var(--theme-accent-rgb), 0.2);
  border-radius: var(--radius-sm);
  color: var(--theme-text);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  letter-spacing: 0.5px;
}

#search-box input::placeholder {
  color: var(--theme-meta);
}

#search-box input:focus {
  border-color: var(--theme-accent);
  box-shadow: 0 0 8px rgba(var(--theme-accent-rgb), 0.15);
}

#search-results {
  background: var(--theme-surface-solid);
  border: 1px solid rgba(var(--theme-accent-rgb), 0.2);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  display: none;
}

.search-result-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--theme-border-faint);
}

.search-result-item:hover {
  background: var(--theme-accent-dim);
}

/* Search result icon */
.search-result-icon {
  margin-right: 6px;
}

/* ── Pulsing Marker Animations ───────────────────────── */
@keyframes markerPulse {
  0% { box-shadow: 0 0 4px var(--glow-color), 0 0 8px var(--glow-color); transform: scale(1); }
  50% { box-shadow: 0 0 10px var(--glow-color), 0 0 25px var(--glow-color); transform: scale(1.15); }
  100% { box-shadow: 0 0 4px var(--glow-color), 0 0 8px var(--glow-color); transform: scale(1); }
}

@keyframes markerRing {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(3); opacity: 0; }
}

.marker-pulse {
  animation: markerPulse 2s ease-in-out infinite;
}

.marker-ring {
  position: absolute;
  top: 50%; left: 50%;
  width: 100%; height: 100%;
  border-radius: 50%;
  border: 1px solid var(--glow-color);
  transform: translate(-50%, -50%);
  animation: markerRing 2.5s ease-out infinite;
  pointer-events: none;
}

/* Recency glow - features newer than CONFIG.recency.glowHours */
.marker-recent {
  filter: drop-shadow(0 0 8px var(--recency-color, #00ff64)) drop-shadow(0 0 16px var(--recency-color, #00ff64));
}
.marker-recent::after {
  content: "NEW";
  position: absolute;
  top: -8px; right: -12px;
  background: var(--recency-color, #00ff64);
  color: var(--theme-bg);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 1px 3px;
  border-radius: var(--radius-sm);
  pointer-events: none;
  z-index: 10;
}

/* ── Staleness Visual States ─────────────────────────── */
.marker-aging .marker-icon-bg {
  opacity: 0.7;
}
.marker-aging .fa-icon {
  opacity: 0.8;
}
.marker-aging .marker-ring {
  opacity: 0.5;
}

.marker-stale .marker-icon-bg {
  opacity: 0.45;
  filter: saturate(0.5);
}
.marker-stale .fa-icon {
  opacity: 0.6;
  filter: saturate(0.5);
}
.marker-stale .marker-ring {
  display: none;
}

.marker-archive .marker-icon-bg {
  opacity: 0.25;
  filter: saturate(0.2);
}
.marker-archive .fa-icon {
  opacity: 0.35;
  filter: saturate(0.2);
}
.marker-archive .marker-ring {
  display: none;
}

/* Staleness age badge */
.marker-stale-badge {
  position: absolute;
  bottom: -6px; left: 50%;
  transform: translateX(-50%);
  font-size: 6px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 0px 3px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
}
.marker-stale-badge.aging {
  background: rgba(255, 170, 0, 0.8);
  color: var(--theme-bg);
}
.marker-stale-badge.stale {
  background: rgba(150, 150, 150, 0.6);
  color: var(--theme-bg);
}
.marker-stale-badge.archive {
  background: rgba(100, 100, 100, 0.4);
  color: #aaa;
}

/* ── Marker Container — override Leaflet defaults ───── */
.custom-marker-icon {
  background: transparent;
  border: none;
}
.missile-arrow {
  background: transparent;
  border: none;
}

/* ── Marker Icon ─────────────────────────────────────── */
.marker-icon-inner {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.marker-icon-inner .fa-icon {
  font-size: 15px;
  color: #fff;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 0 3px rgba(0,0,0,0.8));
}

.marker-icon-bg {
  position: absolute;
  top: 0; left: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.6);
  z-index: 1;
  opacity: 0.85;
  background: var(--marker-bg);
}

/* Missile arrow target marker */
.missile-arrow-icon {
  font-size: 18px;
}

/* ── Cluster Override ────────────────────────────────── */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background: rgba(var(--theme-accent-rgb), 0.15) !important;
  border: 1px solid rgba(var(--theme-accent-rgb), 0.3);
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background: rgba(var(--theme-accent-rgb), 0.4) !important;
  color: #fff !important;
  font-family: var(--font-mono);
  font-weight: 700;
}

/* ── Connection Line Animation ───────────────────────── */
.animated-path {
  stroke-dasharray: 8 12;
  animation: dashFlow 1.5s linear infinite;
}

@keyframes dashFlow {
  to { stroke-dashoffset: -40; }
}

/* ── Missile Trajectory Lines ──────────────────────────── */
.missile-trajectory {
  stroke-dasharray: 12 6;
  animation: missileFlow 1s linear infinite;
  filter: drop-shadow(0 0 3px currentColor);
}
@keyframes missileFlow {
  to { stroke-dashoffset: -36; }
}

/* ── Flash Briefing Tooltips ───────────────────────────── */
.flash-tooltip {
  background: var(--theme-surface) !important;
  border: 1px solid rgba(var(--theme-accent-rgb), 0.25) !important;
  border-radius: var(--radius-md) !important;
  padding: 0 !important;
  font-family: var(--font-mono) !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.6) !important;
  white-space: nowrap !important;
  opacity: 0;
  animation: flashIn 0.3s ease-out forwards;
}
.flash-tooltip::before { display: none !important; }
.flash-tooltip .flash-content {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px;
}
.flash-tooltip .flash-badge {
  font-size: 12px; font-weight: 700; letter-spacing: 0.5px;
  padding: 3px 8px; border-radius: var(--radius-sm);
  text-transform: uppercase; flex-shrink: 0;
}
.flash-tooltip .flash-title {
  font-size: 15px; color: #e2e8f0; max-width: 380px;
  overflow: hidden; text-overflow: ellipsis;
}
.flash-tooltip .flash-severity {
  font-size: 12px; font-weight: 700; padding: 2px 7px;
  border-radius: var(--radius-sm); flex-shrink: 0;
}
@keyframes flashIn {
  0% { opacity: 0; transform: translateY(4px); }
  100% { opacity: 1; transform: translateY(0); }
}
.flash-tooltip-exit {
  animation: flashOut 0.3s ease-in forwards !important;
}
@keyframes flashOut {
  0% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-4px); }
}

/* ── Flash Briefing Summary Popups ──────────────────────── */
.flash-summary-popup .leaflet-popup-content-wrapper {
  background: var(--theme-surface-solid) !important;
  border: 1px solid rgba(var(--theme-accent-rgb), 0.3) !important;
  border-radius: 6px !important;
  max-width: 520px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7) !important;
  animation: summaryContentIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.flash-summary-popup .leaflet-popup-content { margin: 16px 18px !important; }
.flash-summary-popup .leaflet-popup-tip {
  background: var(--theme-surface-solid) !important;
  border: 1px solid rgba(var(--theme-accent-rgb), 0.2) !important;
  animation: summaryContentIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes summaryContentIn {
  0% { opacity: 0; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1); }
}
.flash-summary-exit .leaflet-popup-content-wrapper,
.flash-summary-exit .leaflet-popup-tip {
  animation: summaryContentOut 0.45s cubic-bezier(0.55, 0, 1, 0.45) forwards !important;
}
@keyframes summaryContentOut {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.92); }
}
.flash-summary { font-family: var(--font-mono); }
.flash-summary-header {
  font-family: var(--font-display); font-size: 17px; font-weight: 700;
  color: var(--theme-accent); letter-spacing: 2px; margin-bottom: 6px;
  border-bottom: 1px solid rgba(var(--theme-accent-rgb), 0.2); padding-bottom: 6px;
}
.flash-summary-meta { font-size: 14px; color: var(--theme-meta); margin-bottom: 10px; }
.flash-summary-list { list-style: none; padding: 0; margin: 0; }
.flash-summary-list li {
  display: flex; align-items: center; gap: 8px; padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.flash-summary-list li:last-child { border-bottom: none; }
.flash-summary-list .fs-badge {
  font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: var(--radius-sm);
  text-transform: uppercase; flex-shrink: 0;
}
.flash-summary-list .fs-title { font-size: 15px; color: var(--theme-text); }
.flash-summary-list .fs-sev {
  font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: var(--radius-sm);
  margin-left: auto; flex-shrink: 0;
}
.flash-summary-stats {
  margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--theme-border);
  font-size: 13px; color: var(--theme-label); display: flex; gap: 14px; flex-wrap: wrap;
}
.flash-summary-stats span { color: var(--state-unverified); }

/* ── Preview Mode ─────────────────────────────────────── */
body.preview-mode #sidebar,
body.preview-mode #sidebar-toggle,
body.preview-mode .leaflet-control-zoom,
body.preview-mode #scan-overlay,
body.preview-mode #conflict-stats-bar,
body.preview-mode .time-range-section { display: none !important; }
body.preview-mode #hud-header { pointer-events: none; }
body.preview-mode .hud-controls { display: none !important; }
body.preview-mode #preview-cta {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
  height: 60px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(transparent, var(--theme-surface-solid));
  font-family: var(--font-mono); font-size: 13px;
  color: var(--theme-accent); letter-spacing: 2px; text-transform: uppercase;
  cursor: pointer; text-decoration: none;
}
body.preview-mode #preview-cta:hover { color: #fff; }

/* ── AoR Tooltip ─────────────────────────────────────── */
.aor-tooltip {
  background: var(--theme-surface-dim) !important;
  color: var(--theme-accent) !important;
  border: 1px solid rgba(var(--theme-accent-rgb), 0.3) !important;
  font-family: var(--font-display) !important;
  font-size: 11px !important;
  letter-spacing: 2px !important;
  padding: 4px 10px !important;
}

/* ── No Events Message ───────────────────────────────── */
.events-empty {
  color: var(--theme-label);
  font-size: 12px;
}

/* ── Config Error Message ────────────────────────────── */
.config-error {
  color: var(--theme-warn);
  padding: 40px;
  font-family: monospace;
}

/* ── Data Loading State ──────────────────────────────── */
.data-loading-msg {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  color: var(--theme-accent);
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 2px;
}

/* ── Utility: Hidden ─────────────────────────────────── */
.is-hidden {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════
   ANIMATION + VIDEO EXPORT SYSTEM
   ═══════════════════════════════════════════════════════════════ */

/* ── Animation Controls ──────────────────────────────── */
#anim-controls {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
}

#btn-record {
  padding: 10px 20px;
  background: rgba(var(--theme-record-rgb), 0.8);
  color: #fff;
  border: 1px solid rgba(var(--theme-record-rgb), 0.6);
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s;
}

#btn-record:hover {
  background: rgba(var(--theme-record-rgb), 1);
  box-shadow: 0 0 15px rgba(var(--theme-record-rgb), 0.4);
}

#btn-record:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#btn-record.recording {
  animation: recBlink 1s infinite;
}

@keyframes recBlink {
  50% { opacity: 0.5; }
}

#anim-status {
  background: var(--theme-surface-dim);
  border: 1px solid rgba(var(--theme-accent-rgb), 0.2);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  color: var(--theme-text);
  font-size: 11px;
}

#anim-progress-bar {
  width: 150px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin-bottom: 4px;
}

#anim-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--theme-accent);
  border-radius: 2px;
  transition: width 0.3s;
}

/* ── Date Overlay ────────────────────────────────────── */
#anim-date-overlay {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1500;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--theme-accent);
  text-shadow: 0 0 20px rgba(var(--theme-accent-rgb), 0.5);
  letter-spacing: 3px;
  pointer-events: none;
  padding: 12px 30px;
  background: rgba(10, 14, 26, 0.7);
  border: 1px solid rgba(var(--theme-accent-rgb), 0.3);
  border-radius: var(--radius-md);
  backdrop-filter: blur(4px);
}

/* ── Stats Overlay ───────────────────────────────────── */
#anim-stats-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1500;
  font-family: var(--font-display);
  text-align: center;
  pointer-events: none;
  padding: 45px 70px;
  background: var(--theme-surface-dim);
  border: 2px solid rgba(var(--theme-accent-rgb), 0.4);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(8px);
  box-shadow: 0 0 40px rgba(var(--theme-accent-rgb), 0.15), inset 0 0 60px rgba(var(--theme-accent-rgb), 0.03);
}

#anim-stats-overlay .stat-line {
  font-size: 24px;
  color: var(--theme-text);
  margin: 12px 0;
  letter-spacing: 2px;
}

#anim-stats-overlay .stat-line .val {
  color: var(--theme-accent);
  font-size: 32px;
  font-weight: 700;
  text-shadow: 0 0 12px rgba(var(--theme-accent-rgb), 0.4);
}

#anim-stats-overlay .stat-title {
  font-size: 16px;
  color: var(--theme-label);
  letter-spacing: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(var(--theme-accent-rgb), 0.2);
  padding-bottom: 12px;
}

#anim-stats-overlay .stat-critical {
  font-size: 38px;
  color: var(--theme-record);
  font-weight: 700;
  margin: 16px 0 8px;
  letter-spacing: 6px;
  text-shadow: 0 0 20px rgba(var(--theme-record-rgb), 0.5);
  animation: criticalPulse 1.5s ease-in-out infinite;
}

@keyframes criticalPulse {
  0%, 100% { opacity: 1; text-shadow: 0 0 20px rgba(var(--theme-record-rgb), 0.5); }
  50% { opacity: 0.8; text-shadow: 0 0 40px rgba(var(--theme-record-rgb), 0.8); }
}

/* Stats overlay - summary line styles */
.stats-subtitle {
  font-size: 14px;
  color: var(--theme-label);
  margin-top: 20px;
  letter-spacing: 3px;
}

.stats-url {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--theme-meta);
  margin-top: 12px;
  letter-spacing: 2px;
}

.stats-logo {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(255, 204, 0, 0.4);
  margin-bottom: 16px;
}

.marker-flash {
  animation: markerFlash 0.6s ease-out;
}

@keyframes markerFlash {
  0% { transform: scale(2.5); opacity: 0; }
  40% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ── Brand Watermark ─────────────────────────────────── */
#anim-brand {
  position: fixed;
  top: var(--hud-height);
  left: 0;
  z-index: 1001;
  width: var(--sidebar-width);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--theme-surface-solid);
  border-bottom: 1px solid rgba(var(--theme-accent-rgb), 0.12);
  padding: 12px 14px;
}

#anim-brand .brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(255, 204, 0, 0.3);
}

#anim-brand .brand-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: 3px;
}

#anim-brand .brand-sub {
  font-size: 10px;
  color: var(--theme-accent);
  letter-spacing: 2px;
  margin-top: 2px;
}

#anim-brand .brand-url {
  font-size: 12px;
  color: #a8b2c8;
  letter-spacing: 2px;
  margin-top: 3px;
}

#map-watermark {
  display: none !important;
}

#map-watermark-center {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  z-index: 1000;
  pointer-events: none;
  user-select: none;
}

#map-watermark-center .wm-inner {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: flex-start;
  gap: 0;
  transform: rotate(-25deg);
}

#map-watermark-center .wm-tile {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.025);
  letter-spacing: 10px;
  white-space: nowrap;
  padding: 50px 30px;
  transition: all 0.3s ease;
}

/* ── Watermark Style Variants ──────────────────────── */
/* Light: more transparent, smaller text */
#map-watermark-center.wm-style-light .wm-tile {
  font-size: 28px;
  color: rgba(255, 255, 255, 0.015);
  letter-spacing: 14px;
  padding: 60px 40px;
}

/* Dense: larger, tighter, more visible - anti-screenshot */
#map-watermark-center.wm-style-dense .wm-tile {
  font-size: 44px;
  color: rgba(255, 255, 255, 0.04);
  letter-spacing: 6px;
  padding: 35px 20px;
}

/* Diagonal: steeper angle, medium visibility */
#map-watermark-center.wm-style-diagonal .wm-inner {
  transform: rotate(-45deg);
}
#map-watermark-center.wm-style-diagonal .wm-tile {
  font-size: 32px;
  color: rgba(255, 255, 255, 0.03);
  letter-spacing: 12px;
  padding: 45px 35px;
}

#brand-switch {
  background: none;
  border: none;
  color: #3a4a5a;
  font-size: 14px;
  cursor: pointer;
  margin-left: auto;
  padding: 4px;
  transition: color 0.2s;
  line-height: 1;
}

#brand-switch:hover {
  color: var(--theme-accent);
}

#brand-ghost {
  position: fixed;
  top: 50px;
  left: 290px;
  z-index: 1003;
  background: rgba(10, 14, 26, 0.8);
  border: 1px solid rgba(var(--theme-accent-rgb), 0.2);
  color: #3a4a5a;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

#brand-ghost:hover {
  color: var(--theme-accent);
}

.hud-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 204, 0, 0.25);
}

/* ── Lower-Third HUD Bar ─────────────────────────────── */
#anim-hud {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1500;
  width: 90%;
  max-width: 820px;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  font-family: var(--font-mono);
  background: rgba(8, 12, 24, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--theme-border);
  border-radius: 10px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5), 0 0 1px rgba(var(--theme-accent-rgb), 0.2);
}

#hud-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 10px 20px;
  gap: 12px;
  border-bottom: 1px solid var(--theme-border-subtle);
}

#hud-date {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--theme-accent);
  letter-spacing: 2px;
}

#hud-count {
  margin-left: auto;
  font-size: 13px;
  color: #7a8a9a;
  letter-spacing: 2px;
}

#hud-center {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  overflow: hidden;
  max-height: 170px;
  padding: 10px 20px 12px;
}

.hud-incident {
  display: flex;
  align-items: center;
  gap: 12px;
  animation: hudSlideIn 0.35s ease-out both;
  padding: 4px 0;
  min-width: 0;
}

.hud-incident-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  white-space: nowrap;
  flex-shrink: 0;
  text-transform: uppercase;
}

.hud-incident-title {
  font-size: 15px;
  color: #e8edf3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

@keyframes hudSlideIn {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

#hud-right {
  display: none;
}

/* HUD Legend (shown in animation lower-third) */
.hud-section-title {
  font-size: 11px;
  color: var(--theme-label);
  letter-spacing: 2px;
  margin-bottom: 4px;
}

.hud-legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}

.hud-legend-text {
  font-size: 11px;
  color: #8a9aaa;
}

/* Animation phase label */
.anim-phase-label {
  color: var(--theme-accent);
  font-size: 12px;
  letter-spacing: 2px;
}

/* Animation region label */
.anim-region-label {
  color: var(--theme-accent);
  font-size: 13px;
  letter-spacing: 2px;
  font-family: var(--font-display);
  font-weight: 700;
}

.anim-region-count {
  color: var(--theme-meta);
  font-size: 11px;
  margin-top: 2px;
}

/* ── Manual Recording Controls ─────────────────────────── */
.manual-stop-btn {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 3000;
  padding: 14px 28px;
  background: rgba(var(--theme-record-rgb), 0.9);
  color: #fff;
  border: 2px solid var(--theme-warn);
  border-radius: var(--radius-lg);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  animation: recBlink 1s infinite;
  box-shadow: 0 0 20px rgba(var(--theme-record-rgb), 0.5);
}

.manual-timer {
  position: fixed;
  bottom: 130px;
  right: 20px;
  z-index: 3000;
  padding: 8px 16px;
  background: var(--theme-surface-dim);
  border: 1px solid rgba(var(--theme-record-rgb), 0.4);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--theme-warn);
  letter-spacing: 2px;
}

/* ── Video Player Overlay ──────────────────────────────── */
.video-player-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.video-player-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 15px;
  letter-spacing: 2px;
}

.video-player-title--recorded,
.video-player-title--green {
  color: var(--theme-accent);
}

.video-player-title--manual,
.video-player-title--yellow {
  color: var(--theme-warning);
}

.video-player-video,
#recorded-video {
  max-width: 85vw;
  max-height: 70vh;
  border-radius: var(--radius-lg);
}

.video-player-video--green {
  border: 2px solid var(--theme-accent);
}

.video-player-video--yellow {
  border: 2px solid var(--theme-warning);
}

.video-player-actions {
  margin-top: 15px;
  display: flex;
  gap: 15px;
}

.video-player-save,
.video-btn--save {
  padding: 10px 25px;
  color: var(--theme-bg);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 1px;
}

.video-player-save--green,
.video-btn--save-green {
  background: var(--theme-accent);
}

.video-player-save--yellow,
.video-btn--save-yellow {
  background: var(--theme-warning);
}

.video-player-close,
.video-btn--close {
  padding: 10px 25px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--theme-text);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 13px;
  cursor: pointer;
  letter-spacing: 1px;
}

.video-player-hint {
  color: var(--theme-label);
  font-family: var(--font-mono);
  font-size: 11px;
  margin-top: 12px;
}

/* ── Modal Base Styles ───────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-panel {
  background: var(--theme-bg);
  border: 2px solid var(--theme-accent);
  border-radius: var(--radius-xl);
  padding: 36px 44px;
  max-width: 480px;
  font-family: var(--font-display);
}

.modal-panel--scrollable {
  max-height: 90vh;
  overflow-y: auto;
  max-width: 520px;
}

.modal-title {
  color: var(--theme-accent);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: 2px;
}

.modal-title--warning {
  color: var(--theme-warning);
  font-size: 20px;
  margin-bottom: 20px;
}

.modal-title--large {
  color: var(--theme-accent);
  font-size: 20px;
  margin-bottom: 20px;
}

.modal-subtitle {
  color: var(--theme-label);
  font-size: 11px;
  margin-bottom: 22px;
  font-family: var(--font-mono);
}

.modal-btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  margin: 8px 0;
  background: var(--theme-accent-dim);
  border: 1px solid rgba(var(--theme-accent-rgb), 0.25);
  border-radius: var(--radius-lg);
  color: var(--theme-text);
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1.5;
}

.modal-btn:hover {
  border-color: var(--theme-accent);
  background: rgba(var(--theme-accent-rgb), 0.15);
}

/* Modal button labels - base + color modifiers */
.modal-btn-label {
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--theme-accent);
}

.modal-btn-label--warning {
  color: var(--theme-warning);
}

.modal-btn-label--cyan {
  color: var(--theme-cyan);
}

.modal-btn-desc {
  font-size: 11px;
  color: var(--theme-label);
}

.modal-btn--cancel {
  display: block;
  width: 100%;
  padding: 10px;
  margin-top: 14px;
  background: none;
  border: 1px solid rgba(255, 100, 100, 0.3);
  border-radius: 6px;
  color: var(--theme-warn);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  letter-spacing: 1px;
}

.modal-rec-badge {
  color: var(--theme-accent);
  font-size: 9px;
  vertical-align: middle;
}

.modal-time-tag {
  float: right;
  color: var(--theme-label);
  font-size: 10px;
  font-family: var(--font-mono);
}

.modal-divider {
  border-top: 1px solid var(--theme-border);
  margin: 16px 0 8px;
  padding-top: 8px;
}

.modal-section-label {
  color: var(--theme-label);
  font-size: 10px;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

/* ── Headless Capture - Cyan Theme ────────────────────── */
.modal-title--cyan {
  color: var(--theme-cyan);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  font-family: var(--font-display);
  letter-spacing: 2px;
}

.headless-mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0;
  padding: 8px 12px;
  background: rgba(34, 211, 238, 0.06);
  border: 1px solid rgba(34, 211, 238, 0.15);
  border-radius: 6px;
}

.headless-mode-label {
  color: var(--theme-text);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}

.headless-select {
  background: var(--theme-bg);
  color: var(--theme-cyan);
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
}

.headless-select:hover {
  border-color: rgba(34, 211, 238, 0.6);
}

.headless-select:focus {
  outline: none;
  border-color: var(--theme-cyan);
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.3);
}

.headless-instructions {
  margin: 20px 0;
  text-align: left;
}

.headless-step {
  color: var(--theme-text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(34, 211, 238, 0.1);
}

.headless-step code {
  color: var(--theme-cyan);
  background: rgba(34, 211, 238, 0.1);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.headless-output-path {
  color: var(--theme-cyan);
  font-family: var(--font-mono);
  font-size: 12px;
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: 6px;
  padding: 12px 16px;
  margin: 16px 0;
  word-break: break-all;
}

/* ── Share Instructions Modal ────────────────────────── */
.share-instructions-panel {
  background: var(--theme-bg);
  border-radius: var(--radius-xl);
  padding: 40px 50px;
  max-width: 500px;
  text-align: center;
  font-family: var(--font-display);
}

.share-instructions-panel--green {
  border: 2px solid var(--theme-accent);
}

.share-instructions-panel--yellow {
  border: 2px solid var(--theme-warning);
}

.share-instructions-text {
  color: var(--theme-text);
  font-size: 15px;
  line-height: 1.8;
  margin-bottom: 10px;
}

.share-instructions-highlight {
  font-weight: 700;
}

.share-instructions-highlight--green {
  color: var(--theme-accent);
}

.share-instructions-highlight--yellow {
  color: var(--theme-warning);
}

.share-instructions-highlight--red {
  color: var(--theme-warn);
}

.share-instructions-warning {
  color: var(--theme-warn);
  font-size: 13px;
  margin-top: 15px;
}

.share-instructions-countdown {
  color: var(--theme-label);
  font-size: 11px;
  margin-top: 15px;
}

/* ═══════════════════════════════════════════════════════════════
   PROGRESS BAR STATE CLASSES
   ═══════════════════════════════════════════════════════════════ */
#anim-progress-fill.progress-success { background: var(--theme-success); }
#anim-progress-fill.progress-error   { background: var(--theme-record); }
#anim-progress-fill.progress-recording { background: var(--theme-warn); }

/* ═══════════════════════════════════════════════════════════════
   WATERMARK TOGGLE STATE
   ═══════════════════════════════════════════════════════════════ */
.hud-wm-toggle.wm-inactive {
  color: #3a4a5a;
  border-color: rgba(255, 255, 255, 0.1);
}

/* ═══════════════════════════════════════════════════════════════
   EMBED MODE - ?embed=true
   Strips all UI chrome for clean iframe embedding.
   Parent page controls map via window.mapAPI or PostMessage.
   ═══════════════════════════════════════════════════════════════ */
body.embed-mode #hud-header,
body.embed-mode #sidebar,
body.embed-mode #sidebar-toggle,
body.embed-mode #search-box,
body.embed-mode #zoom-slider-control,
body.embed-mode #scan-overlay,
body.embed-mode #anim-controls,
body.embed-mode #anim-brand,
body.embed-mode #brand-ghost,
body.embed-mode #map-watermark-center,
body.embed-mode #conflict-stats-bar,
body.embed-mode .time-range-section,
body.embed-mode #preview-cta { display: none !important; }

body.embed-mode #map {
  top: 0 !important;
}

body.embed-mode .leaflet-control-zoom { display: block !important; }

/* ── Highlight Ring (mapAPI.highlight) ────────────────────── */
.highlight-ring {
  animation: highlight-pulse 1.5s ease-in-out infinite;
}

@keyframes highlight-pulse {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 0.4; }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════════════════════ */

/* Tablet - sidebar becomes overlay */
@media (max-width: 1024px) {
  #sidebar {
    position: fixed;
    z-index: 1100;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  }
  #sidebar-toggle {
    z-index: 1101;
  }
  /* Start collapsed on tablet */
  body.responsive-init #sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
  body.responsive-init #sidebar-toggle { left: var(--sidebar-toggle-gap); border-radius: var(--radius-md); }
}

@media (max-width: 768px) {
  #sidebar { width: 280px; }
  #sidebar-toggle { left: 290px; }
  #sidebar.collapsed + #sidebar-toggle { left: 10px; }
  #search-box input { width: 160px; }
  .hud-section.hud-center { display: none; }
}

/* Mobile - bottom sheet + compact HUD */
@media (max-width: 480px) {
  :root {
    --sidebar-width: 100vw;
    --hud-height: 36px;
  }

  #sidebar {
    position: fixed;
    top: auto !important;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 55vh;
    border-right: none;
    border-top: 1px solid var(--theme-border);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s ease;
  }

  #sidebar.collapsed {
    transform: translateY(100%);
  }

  #sidebar:not(.collapsed) {
    transform: translateY(0);
  }

  #sidebar-toggle {
    position: fixed;
    top: auto !important;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 28px;
    border-radius: 14px;
    z-index: 1101;
  }

  #sidebar.collapsed + #sidebar-toggle {
    left: 50%;
  }

  #hud-header {
    height: var(--hud-height);
    padding: 0 8px;
    font-size: 11px;
  }

  .hud-title { font-size: 10px; letter-spacing: 0.5px; }
  .hud-divider { display: none; }
  .hud-section.hud-center { display: none; }
  .hud-clock { font-size: 10px; }
  .hud-wm-toggle { display: none; }
  #hud-layer-select { font-size: 10px; padding: 1px 4px; }

  #search-box {
    top: calc(var(--hud-height) + 6px);
    right: 6px;
    left: 6px;
  }
  #search-box input { width: 100%; }

  #zoom-slider-control { top: calc(var(--hud-height) + 50px); right: 6px; }
  #zoom-slider { height: 80px; }

  /* Animation HUD compact for mobile */
  #anim-hud {
    width: 96%;
    bottom: 12px;
    font-size: 12px;
  }
  #hud-date { font-size: 16px; }
  #hud-count { font-size: 11px; }
}
