Skip to content

Real-time dashboard for monitoring global news, markets, and geopolitical events

TypeScript

Modularize codebase into ES modules

Reggiedcb095f4ccb5
diff --git a/index.html b/index.html
index 9740ee8..e9db1c8 100644
--- a/index.html
+++ b/index.html
@@ -4,11380 +4,420 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Situation Monitor</title>
- <style>
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
-
- :root {
- --bg: #0a0a0a;
- --surface: #141414;
- --border: #2a2a2a;
- --text: #e8e8e8;
- --text-dim: #888;
- --accent: #fff;
- --red: #ff4444;
- --green: #44ff88;
- --yellow: #ffaa00;
- }
-
- body {
- font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
- background: var(--bg);
- color: var(--text);
- font-size: 12px;
- line-height: 1.5;
- }
-
- .header {
- position: sticky;
- top: 0;
- background: var(--bg);
- border-bottom: 1px solid var(--border);
- padding: 0.75rem 1.5rem;
- display: flex;
- justify-content: space-between;
- align-items: center;
- z-index: 100;
- }
-
- .header-left {
- display: flex;
- align-items: center;
- gap: 2rem;
- }
-
- .title {
- font-size: 0.8rem;
- font-weight: bold;
- letter-spacing: 0.1em;
- text-transform: uppercase;
- }
-
- .status {
- font-size: 0.7rem;
- color: var(--text-dim);
- }
-
- .status.loading {
- color: var(--accent);
- }
-
- .header-right {
- display: flex;
- align-items: center;
- gap: 0.75rem;
- }
-
- .refresh-btn, .settings-btn {
- background: var(--accent);
- color: var(--bg);
- border: none;
- padding: 0.4rem 1.2rem;
- font-family: inherit;
- font-size: 0.7rem;
- font-weight: bold;
- letter-spacing: 0.05em;
- text-transform: uppercase;
- cursor: pointer;
- transition: opacity 0.2s;
- }
-
- .settings-btn {
- background: var(--surface);
- color: var(--text);
- border: 1px solid var(--border);
- }
-
- .monitors-btn {
- background: linear-gradient(135deg, #00ff88 0%, #00cc6a 100%);
- color: var(--bg);
- border: none;
- font-weight: bold;
- position: relative;
- overflow: hidden;
- }
-
- .monitors-btn::before {
- content: '';
- position: absolute;
- top: 0;
- left: -100%;
- width: 100%;
- height: 100%;
- background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
- animation: monitors-shine 3s ease-in-out infinite;
- }
-
- @keyframes monitors-shine {
- 0%, 100% { left: -100%; }
- 50% { left: 100%; }
- }
-
- .refresh-btn:hover, .settings-btn:hover, .monitors-btn:hover {
- opacity: 0.8;
- }
-
- .refresh-btn:disabled {
- opacity: 0.5;
- cursor: not-allowed;
- }
-
- /* Settings Modal */
- .settings-modal {
- display: none;
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background: rgba(0,0,0,0.8);
- z-index: 1000;
- justify-content: center;
- align-items: center;
- }
-
- .settings-modal.open {
- display: flex;
- }
-
- .settings-content {
- background: var(--bg);
- border: 1px solid var(--border);
- padding: 1.5rem;
- max-width: 400px;
- width: 90%;
- max-height: 80vh;
- overflow-y: auto;
- }
-
- .settings-title {
- font-size: 0.8rem;
- font-weight: bold;
- letter-spacing: 0.1em;
- text-transform: uppercase;
- margin-bottom: 1rem;
- padding-bottom: 0.75rem;
- border-bottom: 1px solid var(--border);
- }
-
- .settings-section {
- margin-bottom: 1rem;
- }
-
- .settings-section-title {
- font-size: 0.65rem;
- color: var(--text-dim);
- text-transform: uppercase;
- letter-spacing: 0.1em;
- margin-bottom: 0.5rem;
- }
-
- .panel-toggle-item {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0.5rem 0;
- border-bottom: 1px solid var(--border);
- }
-
- .panel-toggle-item label {
- font-size: 0.75rem;
- cursor: pointer;
- }
-
- .toggle-switch {
- position: relative;
- width: 36px;
- height: 20px;
- background: var(--surface);
- border-radius: 10px;
- cursor: pointer;
- transition: background 0.2s;
- }
-
- .toggle-switch.on {
- background: var(--green);
- }
-
- .toggle-switch::after {
- content: '';
- position: absolute;
- top: 2px;
- left: 2px;
- width: 16px;
- height: 16px;
- background: var(--text);
- border-radius: 50%;
- transition: transform 0.2s;
- }
-
- .toggle-switch.on::after {
- transform: translateX(16px);
- }
-
- .settings-input {
- width: 100%;
- padding: 0.5rem;
- background: var(--surface);
- border: 1px solid var(--border);
- color: var(--text);
- font-family: inherit;
- font-size: 0.7rem;
- margin-bottom: 0.25rem;
- }
-
- .settings-input:focus {
- outline: none;
- border-color: var(--accent);
- }
-
- .settings-hint {
- font-size: 0.6rem;
- color: var(--text-dim);
- }
-
- .settings-reset {
- width: 100%;
- padding: 0.5rem;
- background: transparent;
- border: 1px solid var(--border);
- color: var(--text-dim);
- font-family: inherit;
- font-size: 0.65rem;
- cursor: pointer;
- transition: all 0.2s;
- }
-
- .settings-reset:hover {
- border-color: var(--red);
- color: var(--red);
- }
-
- .settings-close {
- margin-top: 1rem;
- width: 100%;
- padding: 0.6rem;
- background: var(--accent);
- color: var(--bg);
- border: none;
- font-family: inherit;
- font-size: 0.7rem;
- font-weight: bold;
- letter-spacing: 0.05em;
- text-transform: uppercase;
- cursor: pointer;
- }
-
- .dashboard {
- display: grid;
- grid-template-columns: repeat(4, 1fr);
- grid-template-rows: auto auto;
- gap: 1px;
- background: var(--border);
- }
-
- .panel {
- background: var(--bg);
- display: flex;
- flex-direction: column;
- min-height: 300px;
- transition: min-height 0.2s, opacity 0.2s, transform 0.15s;
- }
-
- .panel.hidden {
- min-height: 0;
- display: none;
- }
-
- .panel.wide {
- grid-column: span 2;
- }
-
- .panel.dragging {
- opacity: 0.5;
- transform: scale(0.98);
- }
-
- .panel.drag-over {
- outline: 2px dashed var(--accent);
- outline-offset: -2px;
- }
-
- /* Resizable panels */
- .panel {
- position: relative;
- resize: none;
- }
-
- .panel-resize-handle {
- position: absolute;
- background: transparent;
- z-index: 10;
- }
-
- .panel-resize-handle.corner {
- width: 16px;
- height: 16px;
- bottom: 0;
- right: 0;
- cursor: nwse-resize;
- }
-
- .panel-resize-handle.corner::before {
- content: '';
- position: absolute;
- bottom: 3px;
- right: 3px;
- width: 8px;
- height: 8px;
- border-right: 2px solid var(--border);
- border-bottom: 2px solid var(--border);
- opacity: 0.5;
- transition: all 0.2s ease;
- }
-
- .panel:hover .panel-resize-handle.corner::before {
- opacity: 1;
- border-color: var(--text-dim);
- }
-
- .panel-resize-handle.corner:hover::before {
- border-color: var(--accent);
- width: 10px;
- height: 10px;
- }
-
- .panel-resize-handle.bottom {
- height: 6px;
- left: 0;
- right: 16px;
- bottom: 0;
- cursor: ns-resize;
- }
-
- .panel-resize-handle.right {
- width: 6px;
- top: 0;
- bottom: 16px;
- right: 0;
- cursor: ew-resize;
- }
-
- .panel.resizing {
- user-select: none;
- transition: none;
- }
-
- .panel.resizing * {
- pointer-events: none;
- }
-
- .panel-header {
- padding: 0.75rem 1rem;
- border-bottom: 1px solid var(--border);
- display: flex;
- justify-content: space-between;
- align-items: center;
- cursor: grab;
- user-select: none;
- }
-
- .panel-header:active {
- cursor: grabbing;
- }
-
- .panel-header:hover {
- background: var(--surface);
- }
-
- .drag-handle {
- color: var(--text-dim);
- margin-right: 0.5rem;
- font-size: 0.7rem;
- opacity: 0.5;
- }
-
- .panel-header:hover .drag-handle {
- opacity: 1;
- }
-
- .panel-header-left {
- display: flex;
- align-items: center;
- gap: 0.5rem;
- }
-
- .panel-toggle {
- font-size: 0.6rem;
- color: var(--text-dim);
- transition: transform 0.2s;
- }
-
- .panel.collapsed .panel-toggle {
- transform: rotate(-90deg);
- }
-
- .panel-title {
- font-size: 0.65rem;
- font-weight: bold;
- letter-spacing: 0.1em;
- text-transform: uppercase;
- color: var(--text-dim);
- }
-
- .panel-count {
- font-size: 0.65rem;
- color: var(--text-dim);
- }
-
- .panel-content {
- flex: 1;
- overflow-y: auto;
- max-height: 380px;
- transition: max-height 0.2s;
- }
-
- .panel.collapsed .panel-content {
- max-height: 0;
- overflow: hidden;
- }
-
- .panel.collapsed {
- min-height: auto;
- }
-
- .item {
- padding: 0.6rem 1rem;
- border-bottom: 1px solid var(--border);
- cursor: pointer;
- transition: background 0.2s;
- }
-
- .item:hover {
- background: var(--surface);
- }
-
- .item.alert {
- border-left: 2px solid var(--yellow);
- }
-
- .item-source {
- font-size: 0.55rem;
- color: var(--text-dim);
- text-transform: uppercase;
- letter-spacing: 0.05em;
- margin-bottom: 0.15rem;
- }
-
- .item-title {
- font-size: 0.75rem;
- font-weight: normal;
- color: var(--text);
- text-decoration: none;
- display: block;
- }
-
- .item-title:hover {
- color: var(--accent);
- }
-
- .item-time {
- font-size: 0.55rem;
- color: var(--text-dim);
- margin-top: 0.3rem;
- }
-
- .alert-tag {
- font-size: 0.5rem;
- background: var(--yellow);
- color: var(--bg);
- padding: 0.1rem 0.3rem;
- margin-left: 0.5rem;
- font-weight: bold;
- }
-
- /* Markets Panel */
- .market-item {
- padding: 0.5rem 1rem;
- border-bottom: 1px solid var(--border);
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
-
- .market-name {
- font-size: 0.7rem;
- font-weight: bold;
- }
-
- .market-symbol {
- font-size: 0.55rem;
- color: var(--text-dim);
- }
-
- .market-data {
- text-align: right;
- }
-
- .market-price {
- font-size: 0.75rem;
- font-weight: bold;
- }
-
- .market-change {
- font-size: 0.65rem;
- }
-
- .market-change.up {
- color: var(--green);
- }
-
- .market-change.down {
- color: var(--red);
- }
-
- /* Sector Heatmap */
- .heatmap {
- display: grid;
- grid-template-columns: repeat(4, 1fr);
- gap: 2px;
- padding: 0.5rem;
- }
-
- .heatmap-cell {
- padding: 0.6rem 0.4rem;
- text-align: center;
- font-size: 0.6rem;
- font-weight: bold;
- border-radius: 2px;
- }
-
- .heatmap-cell .sector-name {
- font-size: 0.55rem;
- opacity: 0.9;
- margin-bottom: 0.2rem;
- }
-
- .heatmap-cell .sector-change {
- font-size: 0.7rem;
- }
-
- .heatmap-cell.up-3 { background: #0d5a2d; color: #fff; }
- .heatmap-cell.up-2 { background: #157a3c; color: #fff; }
- .heatmap-cell.up-1 { background: #1d9a4b; color: #fff; }
- .heatmap-cell.up-0 { background: #2a4a35; color: #fff; }
- .heatmap-cell.down-0 { background: #4a2a2a; color: #fff; }
- .heatmap-cell.down-1 { background: #8a3a3a; color: #fff; }
- .heatmap-cell.down-2 { background: #aa3333; color: #fff; }
- .heatmap-cell.down-3 { background: #cc2222; color: #fff; }
-
- /* Polymarket */
- .prediction-item {
- padding: 0.6rem 1rem;
- border-bottom: 1px solid var(--border);
- display: flex;
- justify-content: space-between;
- align-items: center;
- gap: 1rem;
- }
-
- .prediction-question {
- font-size: 0.75rem;
- flex: 1;
- color: var(--text);
- }
-
- .prediction-odds {
- display: flex;
- gap: 0.5rem;
- flex-shrink: 0;
- }
-
- .prediction-yes, .prediction-no {
- padding: 0.25rem 0.5rem;
- font-size: 0.65rem;
- font-weight: bold;
- border-radius: 2px;
- }
-
- .prediction-yes {
- background: var(--green);
- color: var(--bg);
- }
-
- .prediction-no {
- background: var(--red);
- color: #fff;
- }
-
- .prediction-volume {
- font-size: 0.55rem;
- color: var(--text-dim);
- margin-top: 0.25rem;
- }
-
- .error-msg {
- padding: 1rem;
- color: var(--text-dim);
- font-size: 0.7rem;
- }
-
- /* Global Map - Situation Room Style */
- .world-map {
- width: 100%;
- height: 550px;
- position: relative;
- background: #020a08;
- overflow: hidden;
- border: 1px solid #0a3020;
- }
-
- .world-map::before {
- content: '';
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background: repeating-linear-gradient(
- 0deg,
- transparent,
- transparent 2px,
- rgba(0, 40, 30, 0.03) 2px,
- rgba(0, 40, 30, 0.03) 4px
- );
- pointer-events: none;
- z-index: 10;
- }
-
- .world-map svg {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- }
-
- /* Zoomable map container */
- .map-zoom-wrapper {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- transform-origin: center center;
- transition: transform 0.3s ease;
- }
-
- .map-zoom-controls {
- position: absolute;
- top: 10px;
- right: 10px;
- display: flex;
- flex-direction: column;
- gap: 4px;
- z-index: 50;
- }
-
- .map-zoom-btn {
- width: 28px;
- height: 28px;
- background: rgba(0, 30, 20, 0.9);
- border: 1px solid #0f6040;
- color: #00ff88;
- font-size: 1rem;
- font-weight: bold;
- cursor: pointer;
- display: flex;
- align-items: center;
- justify-content: center;
- transition: all 0.2s ease;
- font-family: 'SF Mono', monospace;
- }
-
- .map-zoom-btn:hover {
- background: rgba(0, 60, 40, 0.9);
- border-color: #00ff88;
- box-shadow: 0 0 10px rgba(0, 255, 136, 0.4);
- }
-
- .map-zoom-btn:active {
- transform: scale(0.95);
- }
-
- .map-zoom-btn:disabled {
- opacity: 0.3;
- cursor: not-allowed;
- }
-
- .map-zoom-level {
- font-size: 0.55rem;
- color: #0f6040;
- text-align: center;
- padding: 2px 0;
- font-family: 'SF Mono', monospace;
- }
-
- .map-zoom-reset {
- font-size: 0.6rem;
- padding: 4px 6px;
- width: auto;
- height: auto;
- }
-
- /* Pan hint */
- .map-pan-hint {
- position: absolute;
- bottom: 30px;
- left: 50%;
- transform: translateX(-50%);
- font-size: 0.5rem;
- color: #0f6040;
- letter-spacing: 0.1em;
- text-transform: uppercase;
- opacity: 0;
- transition: opacity 0.3s ease;
- z-index: 50;
- pointer-events: none;
- }
-
- .world-map:hover .map-pan-hint.show {
- opacity: 0.7;
- }
-
- /* Map View Toggle (Global/US) */
- .map-view-toggle {
- position: absolute;
- top: 10px;
- left: 10px;
- display: flex;
- gap: 0;
- z-index: 50;
- border: 1px solid #0f6040;
- overflow: hidden;
- }
-
- .map-view-btn {
- padding: 6px 12px;
- background: rgba(0, 30, 20, 0.9);
- border: none;
- color: #0f6040;
- font-size: 0.55rem;
- font-weight: bold;
- letter-spacing: 0.1em;
- cursor: pointer;
- transition: all 0.2s ease;
- font-family: 'SF Mono', monospace;
- }
-
- .map-view-btn:first-child {
- border-right: 1px solid #0f6040;
- }
-
- .map-view-btn:hover {
- background: rgba(0, 60, 40, 0.9);
- color: #00ff88;
- }
-
- .map-view-btn.active {
- background: rgba(0, 255, 136, 0.2);
- color: #00ff88;
- }
-
- /* US City Markers */
- .us-city {
- position: absolute;
- transform: translate(-50%, -50%);
- pointer-events: auto;
- z-index: 25;
- cursor: pointer;
- }
-
- .us-city-dot {
- width: 8px;
- height: 8px;
- border-radius: 50%;
- background: #00aaff;
- border: 1px solid #00ddff;
- transition: all 0.3s ease;
- box-shadow: 0 0 6px rgba(0, 170, 255, 0.4);
- }
-
- .us-city.capital .us-city-dot {
- width: 10px;
- height: 10px;
- background: #ffcc00;
- border-color: #ffee66;
- box-shadow: 0 0 8px rgba(255, 204, 0, 0.5);
- }
-
- .us-city.major .us-city-dot {
- width: 9px;
- height: 9px;
- background: #00ff88;
- border-color: #66ffaa;
- box-shadow: 0 0 6px rgba(0, 255, 136, 0.4);
- }
-
- .us-city-label {
- position: absolute;
- top: 12px;
- left: 50%;
- transform: translateX(-50%);
- font-size: 0.5rem;
- color: #00aaff;
- white-space: nowrap;
- opacity: 0;
- transition: all 0.3s ease;
- text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
- pointer-events: none;
- }
-
- .us-city.capital .us-city-label {
- color: #ffcc00;
- }
-
- .us-city.major .us-city-label {
- color: #00ff88;
- }
-
- .us-city:hover .us-city-label {
- opacity: 1;
- }
-
- .us-city:hover .us-city-dot {
- transform: scale(1.5);
- box-shadow: 0 0 15px currentColor;
- }
-
- .us-city::before {
- content: '';
- position: absolute;
- width: 30px;
- height: 30px;
- border-radius: 50%;
- border: 1px solid transparent;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- transition: all 0.3s ease;
- }
-
- .us-city:hover::before {
- border-color: currentColor;
- opacity: 0.4;
- animation: city-ping 1.5s ease-out infinite;
- }
-
- @keyframes city-ping {
- 0% { transform: translate(-50%, -50%) scale(1); opacity: 0.4; }
- 100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
- }
-
- .us-city-info {
- font-size: 0.4rem;
- color: rgba(0, 170, 255, 0.6);
- text-transform: uppercase;
- letter-spacing: 0.05em;
- }
-
- /* US City activity indicators */
- .us-city.high-activity .us-city-dot {
- animation: city-pulse 1.5s ease-in-out infinite;
- }
-
- .us-city.high-activity::after {
- content: '';
- position: absolute;
- width: 20px;
- height: 20px;
- border-radius: 50%;
- background: radial-gradient(circle, rgba(255, 100, 100, 0.3) 0%, transparent 70%);
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- animation: activity-glow 2s ease-in-out infinite;
- }
-
- @keyframes city-pulse {
- 0%, 100% { box-shadow: 0 0 6px currentColor; }
- 50% { box-shadow: 0 0 15px currentColor; }
- }
-
- @keyframes activity-glow {
- 0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
- 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
- }
-
- /* US Breaking News Hotspots */
- .us-hotspot {
- position: absolute;
- transform: translate(-50%, -50%);
- pointer-events: auto;
- z-index: 30;
- cursor: pointer;
- }
-
- .us-hotspot-marker {
- position: relative;
- width: 24px;
- height: 24px;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 14px;
- z-index: 2;
- }
-
- .us-hotspot-ring {
- position: absolute;
- width: 40px;
- height: 40px;
- border-radius: 50%;
- border: 2px solid;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- animation: hotspot-pulse 2s ease-out infinite;
- }
-
- .us-hotspot.high .us-hotspot-ring {
- border-color: #ff4444;
- }
-
- .us-hotspot.elevated .us-hotspot-ring {
- border-color: #ffaa00;
- }
-
- .us-hotspot.medium .us-hotspot-ring {
- border-color: #44aaff;
- }
-
- .us-hotspot-glow {
- position: absolute;
- width: 60px;
- height: 60px;
- border-radius: 50%;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- z-index: 0;
- }
-
- .us-hotspot.high .us-hotspot-glow {
- background: radial-gradient(circle, rgba(255, 68, 68, 0.4) 0%, transparent 70%);
- animation: glow-pulse 1.5s ease-in-out infinite;
- }
-
- .us-hotspot.elevated .us-hotspot-glow {
- background: radial-gradient(circle, rgba(255, 170, 0, 0.3) 0%, transparent 70%);
- animation: glow-pulse 2s ease-in-out infinite;
- }
-
- .us-hotspot.medium .us-hotspot-glow {
- background: radial-gradient(circle, rgba(68, 170, 255, 0.25) 0%, transparent 70%);
- }
-
- @keyframes hotspot-pulse {
- 0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
- 100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
- }
-
- @keyframes glow-pulse {
- 0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
- 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
- }
-
- .us-hotspot-label {
- position: absolute;
- top: 28px;
- left: 50%;
- transform: translateX(-50%);
- font-size: 0.55rem;
- font-weight: bold;
- white-space: nowrap;
- text-shadow: 0 0 6px rgba(0, 0, 0, 0.9);
- opacity: 0;
- transition: opacity 0.3s ease;
- text-transform: uppercase;
- letter-spacing: 0.05em;
- }
-
- .us-hotspot.high .us-hotspot-label {
- color: #ff6666;
- }
-
- .us-hotspot.elevated .us-hotspot-label {
- color: #ffcc44;
- }
-
- .us-hotspot.medium .us-hotspot-label {
- color: #66bbff;
- }
-
- .us-hotspot:hover .us-hotspot-label {
- opacity: 1;
- }
-
- .us-hotspot-category {
- font-size: 0.4rem;
- opacity: 0.7;
- font-weight: normal;
- }
-
- /* US Hotspot Popup */
- .us-hotspot-popup {
- display: none;
- position: absolute;
- z-index: 100;
- background: rgba(10, 20, 30, 0.95);
- border: 1px solid rgba(255, 100, 100, 0.4);
- border-radius: 4px;
- width: 320px;
- max-height: 400px;
- overflow: hidden;
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
- pointer-events: auto;
- }
-
- .us-hotspot-popup.visible {
- display: block;
- }
-
- .us-hotspot-popup-header {
- padding: 0.75rem 1rem;
- border-bottom: 1px solid rgba(255, 100, 100, 0.3);
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
-
- .us-hotspot-popup.high .us-hotspot-popup-header {
- background: rgba(255, 68, 68, 0.15);
- }
-
- .us-hotspot-popup.elevated .us-hotspot-popup-header {
- background: rgba(255, 170, 0, 0.15);
- border-color: rgba(255, 170, 0, 0.3);
- }
-
- .us-hotspot-popup.medium .us-hotspot-popup-header {
- background: rgba(68, 170, 255, 0.1);
- border-color: rgba(68, 170, 255, 0.3);
- }
-
- .us-hotspot-popup-title {
- font-size: 0.8rem;
- font-weight: bold;
- color: #ff8888;
- text-transform: uppercase;
- letter-spacing: 0.05em;
- }
-
- .us-hotspot-popup.elevated .us-hotspot-popup-title {
- color: #ffcc44;
- }
-
- .us-hotspot-popup.medium .us-hotspot-popup-title {
- color: #66bbff;
- }
-
- .us-hotspot-popup-level {
- font-size: 0.5rem;
- padding: 0.2rem 0.5rem;
- border-radius: 2px;
- text-transform: uppercase;
- font-weight: bold;
- }
-
- .us-hotspot-popup-level.high {
- background: rgba(255, 68, 68, 0.3);
- color: #ff8888;
- }
-
- .us-hotspot-popup-level.elevated {
- background: rgba(255, 170, 0, 0.3);
- color: #ffcc44;
- }
-
- .us-hotspot-popup-level.medium {
- background: rgba(68, 170, 255, 0.2);
- color: #66bbff;
- }
-
- .us-hotspot-popup-meta {
- padding: 0.6rem 1rem;
- display: grid;
- grid-template-columns: 1fr 1fr;
- gap: 0.4rem;
- border-bottom: 1px solid rgba(255, 100, 100, 0.2);
- font-size: 0.55rem;
- }
-
- .us-hotspot-popup-meta-label {
- color: #664444;
- text-transform: uppercase;
- letter-spacing: 0.05em;
- }
-
- .us-hotspot-popup-meta-value {
- color: #cc8888;
- }
-
- .us-hotspot-popup-desc {
- padding: 0.75rem 1rem;
- font-size: 0.65rem;
- color: #ccaaaa;
- line-height: 1.5;
- border-bottom: 1px solid rgba(255, 100, 100, 0.2);
- }
-
- .us-hotspot-popup-headlines-title {
- font-size: 0.5rem;
- color: #664444;
- text-transform: uppercase;
- letter-spacing: 0.1em;
- padding: 0.5rem 1rem 0.3rem;
- }
-
- .us-hotspot-popup-headlines {
- max-height: 150px;
- overflow-y: auto;
- }
-
- .us-hotspot-popup-headline {
- padding: 0.5rem 1rem;
- border-bottom: 1px solid rgba(255, 100, 100, 0.15);
- font-size: 0.6rem;
- color: #ddbbbb;
- line-height: 1.4;
- transition: background 0.2s;
- }
-
- .us-hotspot-popup-headline:hover {
- background: rgba(255, 100, 100, 0.1);
- }
-
- .us-hotspot-popup-headline a {
- color: inherit;
- text-decoration: none;
- }
-
- .us-hotspot-popup-headline a:hover {
- color: #ff9999;
- }
-
- .us-hotspot-popup-headline-source {
- font-size: 0.45rem;
- color: #664444;
- text-transform: uppercase;
- margin-bottom: 0.15rem;
- }
-
- .us-hotspot-popup-close {
- position: absolute;
- top: 0.5rem;
- right: 0.5rem;
- background: none;
- border: none;
- color: #886666;
- font-size: 1rem;
- cursor: pointer;
- padding: 0.25rem;
- line-height: 1;
- transition: color 0.2s;
- }
-
- .us-hotspot-popup-close:hover {
- color: #ff8888;
- }
-
- /* US City Popup */
- .us-city-popup {
- display: none;
- position: absolute;
- z-index: 100;
- background: rgba(5, 15, 25, 0.98);
- border: 1px solid #0066aa;
- min-width: 300px;
- max-width: 380px;
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 100, 200, 0.15);
- pointer-events: auto;
- }
-
- .us-city-popup.visible {
- display: block;
- }
-
- .us-city-popup-header {
- padding: 0.75rem 1rem;
- border-bottom: 1px solid rgba(0, 100, 170, 0.3);
- display: flex;
- justify-content: space-between;
- align-items: center;
- background: rgba(0, 100, 170, 0.1);
- }
-
- .us-city-popup-title {
- font-size: 0.8rem;
- font-weight: bold;
- color: #00aaff;
- text-transform: uppercase;
- letter-spacing: 0.1em;
- }
-
- .us-city-popup-state {
- font-size: 0.55rem;
- padding: 0.2rem 0.5rem;
- background: rgba(0, 170, 255, 0.2);
- color: #00ccff;
- border-radius: 2px;
- }
-
- .us-city-popup-meta {
- padding: 0.6rem 1rem;
- display: grid;
- grid-template-columns: 1fr 1fr;
- gap: 0.4rem;
- border-bottom: 1px solid rgba(0, 100, 170, 0.2);
- font-size: 0.55rem;
- }
-
- .us-city-popup-meta-label {
- color: #336688;
- text-transform: uppercase;
- letter-spacing: 0.05em;
- }
-
- .us-city-popup-meta-value {
- color: #66aacc;
- }
-
- .us-city-popup-desc {
- padding: 0.6rem 1rem;
- font-size: 0.6rem;
- color: #99bbcc;
- line-height: 1.5;
- border-bottom: 1px solid rgba(0, 100, 170, 0.2);
- }
-
- .us-city-popup-headlines-title {
- font-size: 0.5rem;
- color: #336688;
- text-transform: uppercase;
- letter-spacing: 0.1em;
- padding: 0.5rem 1rem 0.3rem;
- }
-
- .us-city-popup-headlines {
- max-height: 180px;
- overflow-y: auto;
- }
-
- .us-city-popup-headline {
- padding: 0.5rem 1rem;
- border-bottom: 1px solid rgba(0, 100, 170, 0.15);
- font-size: 0.6rem;
- color: #99bbcc;
- cursor: pointer;
- transition: background 0.2s;
- }
-
- .us-city-popup-headline:hover {
- background: rgba(0, 100, 170, 0.15);
- }
-
- .us-city-popup-headline a {
- color: inherit;
- text-decoration: none;
- }
-
- .us-city-popup-headline a:hover {
- color: #00ccff;
- }
-
- .us-city-popup-headline-source {
- font-size: 0.45rem;
- color: #336688;
- text-transform: uppercase;
- margin-bottom: 0.15rem;
- }
-
- .us-city-popup-close {
- position: absolute;
- top: 0.5rem;
- right: 0.5rem;
- background: none;
- border: none;
- color: #336688;
- font-size: 1rem;
- cursor: pointer;
- padding: 0.25rem;
- line-height: 1;
- transition: color 0.2s;
- }
-
- .us-city-popup-close:hover {
- color: #00aaff;
- }
-
- .map-overlays {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- pointer-events: none;
- z-index: 5;
- }
-
- .map-overlays > * {
- pointer-events: auto;
- }
-
- .coord-label {
- position: absolute;
- font-size: 0.55rem;
- color: #0f6040;
- font-family: 'SF Mono', monospace;
- pointer-events: none;
- z-index: 5;
- }
-
- .coord-label.lat {
- transform: translateY(-50%);
- }
-
- .coord-label.lon {
- transform: translateX(-50%);
- }
-
- .map-corner-label {
- position: absolute;
- font-size: 0.5rem;
- color: #0f6040;
- font-family: 'SF Mono', monospace;
- letter-spacing: 0.1em;
- z-index: 15;
- }
-
- .map-corner-label.tl { top: 8px; left: 10px; }
- .map-corner-label.tr { top: 8px; right: 10px; }
- .map-corner-label.bl { bottom: 8px; left: 10px; }
- .map-corner-label.br { bottom: 8px; right: 10px; }
-
- .hotspot {
- position: absolute;
- transform: translate(-50%, -50%);
- pointer-events: none;
- z-index: 20;
- }
-
- .hotspot-dot {
- width: 10px;
- height: 10px;
- border-radius: 50%;
- position: relative;
- border: 1px solid;
- }
-
- .hotspot-dot::before {
- content: '';
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- width: 100%;
- height: 100%;
- border-radius: 50%;
- animation: pulse-ring 2s ease-out infinite;
- }
-
- .hotspot-dot::after {
- content: '';
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- width: 24px;
- height: 24px;
- border-radius: 50%;
- border: 1px solid;
- opacity: 0.4;
- }
-
- .hotspot.low .hotspot-dot {
- background: #00ff88;
- border-color: #00ff88;
- box-shadow: 0 0 10px #00ff88, 0 0 20px rgba(0,255,136,0.3);
- }
- .hotspot.low .hotspot-dot::before { background: #00ff88; }
- .hotspot.low .hotspot-dot::after { border-color: #00ff88; }
-
- .hotspot.elevated .hotspot-dot {
- background: #ffcc00;
- border-color: #ffcc00;
- box-shadow: 0 0 10px #ffcc00, 0 0 20px rgba(255,204,0,0.3);
- }
- .hotspot.elevated .hotspot-dot::before { background: #ffcc00; }
- .hotspot.elevated .hotspot-dot::after { border-color: #ffcc00; }
-
- .hotspot.high .hotspot-dot {
- background: #ff3333;
- border-color: #ff3333;
- box-shadow: 0 0 15px #ff3333, 0 0 30px rgba(255,51,51,0.4);
- animation: glow-high 1s ease-in-out infinite alternate;
- }
- .hotspot.high .hotspot-dot::before { background: #ff3333; }
- .hotspot.high .hotspot-dot::after { border-color: #ff3333; animation: target-lock 1.5s linear infinite; }
-
- @keyframes pulse-ring {
- 0% { width: 100%; height: 100%; opacity: 0.6; }
- 100% { width: 250%; height: 250%; opacity: 0; }
- }
-
- @keyframes glow-high {
- from { box-shadow: 0 0 10px #ff3333, 0 0 20px rgba(255,51,51,0.3); }
- to { box-shadow: 0 0 20px #ff3333, 0 0 40px rgba(255,51,51,0.5); }
- }
-
- @keyframes target-lock {
- from { transform: translate(-50%, -50%) rotate(0deg); }
- to { transform: translate(-50%, -50%) rotate(360deg); }
- }
-
- .hotspot-label {
- position: absolute;
- top: 20px;
- left: 50%;
- transform: translateX(-50%);
- font-size: 0.55rem;
- font-family: 'SF Mono', monospace;
- color: #00ff88;
- white-space: nowrap;
- text-shadow: 0 0 5px rgba(0,255,136,0.5);
- text-transform: uppercase;
- letter-spacing: 0.05em;
- }
-
- .hotspot.elevated .hotspot-label { color: #ffcc00; text-shadow: 0 0 5px rgba(255,204,0,0.5); }
- .hotspot.high .hotspot-label { color: #ff3333; text-shadow: 0 0 5px rgba(255,51,51,0.5); }
-
- .hotspot-info {
- font-size: 0.45rem;
- color: #0a8060;
- text-transform: none;
- }
-
- /* Hotspot Popup */
- .hotspot-popup {
- display: none;
- position: absolute;
- z-index: 100;
- background: rgba(5, 10, 8, 0.95);
- border: 1px solid #0f5040;
- min-width: 280px;
- max-width: 350px;
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0, 255, 136, 0.1);
- pointer-events: auto;
- }
-
- .hotspot-popup.visible {
- display: block;
- }
-
- .hotspot-popup-header {
- padding: 0.75rem 1rem;
- border-bottom: 1px solid #0f5040;
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
-
- .hotspot-popup-title {
- font-size: 0.75rem;
- font-weight: bold;
- color: #00ff88;
- text-transform: uppercase;
- letter-spacing: 0.1em;
- }
-
- .hotspot-popup.elevated .hotspot-popup-title { color: #ffcc00; }
- .hotspot-popup.high .hotspot-popup-title { color: #ff3333; }
-
- .hotspot-popup-level {
- font-size: 0.55rem;
- padding: 0.2rem 0.5rem;
- border-radius: 2px;
- font-weight: bold;
- text-transform: uppercase;
- }
-
- .hotspot-popup-level.low { background: #00ff88; color: #000; }
- .hotspot-popup-level.elevated { background: #ffcc00; color: #000; }
- .hotspot-popup-level.high { background: #ff3333; color: #fff; animation: pulse-level 1s infinite; }
-
- @keyframes pulse-level {
- 0%, 100% { opacity: 1; }
- 50% { opacity: 0.7; }
- }
-
- .hotspot-popup-subtext {
- font-size: 0.55rem;
- color: #0a8060;
- padding: 0.5rem 1rem;
- border-bottom: 1px solid #0a3020;
- }
-
- .hotspot-popup-headlines {
- max-height: 200px;
- overflow-y: auto;
- }
-
- .hotspot-popup-headline {
- padding: 0.6rem 1rem;
- border-bottom: 1px solid #0a3020;
- font-size: 0.65rem;
- color: #e8e8e8;
- cursor: pointer;
- transition: background 0.2s;
- }
-
- .hotspot-popup-headline:last-child {
- border-bottom: none;
- }
-
- .hotspot-popup-headline:hover {
- background: rgba(0, 255, 136, 0.1);
- }
-
- .hotspot-popup-headline a {
- color: inherit;
- text-decoration: none;
- }
-
- .hotspot-popup-headline a:hover {
- color: #00ff88;
- }
-
- .hotspot-popup-source {
- font-size: 0.5rem;
- color: #0a8060;
- text-transform: uppercase;
- margin-bottom: 0.2rem;
- }
-
- .hotspot-popup-empty {
- padding: 1rem;
- font-size: 0.6rem;
- color: #0a8060;
- text-align: center;
- font-style: italic;
- }
-
- .hotspot-popup-coords {
- font-size: 0.5rem;
- color: #0a6050;
- padding: 0 1rem 0.5rem;
- font-family: 'SF Mono', monospace;
- }
-
- .hotspot-popup-desc {
- padding: 0.6rem 1rem;
- font-size: 0.6rem;
- color: #aaccbb;
- line-height: 1.5;
- border-bottom: 1px solid #0a3020;
- }
-
- .hotspot-popup-meta {
- padding: 0.5rem 1rem;
- display: grid;
- grid-template-columns: 1fr 1fr;
- gap: 0.4rem;
- border-bottom: 1px solid #0a3020;
- }
-
- .hotspot-popup-meta-item {
- font-size: 0.5rem;
- }
-
- .hotspot-popup-meta-label {
- color: #0a6050;
- text-transform: uppercase;
- letter-spacing: 0.05em;
- display: block;
- margin-bottom: 0.1rem;
- }
-
- .hotspot-popup-meta-value {
- color: #00ff88;
- }
-
- .hotspot-popup-agencies {
- padding: 0.5rem 1rem;
- border-bottom: 1px solid #0a3020;
- }
-
- .hotspot-popup-agencies-title {
- font-size: 0.45rem;
- color: #0a6050;
- text-transform: uppercase;
- letter-spacing: 0.1em;
- margin-bottom: 0.3rem;
- }
-
- .hotspot-popup-agency {
- display: inline-block;
- font-size: 0.5rem;
- padding: 0.1rem 0.3rem;
- margin: 0.1rem 0.15rem 0.1rem 0;
- background: rgba(0, 255, 136, 0.1);
- border: 1px solid rgba(0, 255, 136, 0.2);
- color: #00cc77;
- }
-
- .hotspot-popup-headlines-title {
- font-size: 0.45rem;
- color: #0a6050;
- text-transform: uppercase;
- letter-spacing: 0.1em;
- padding: 0.4rem 1rem 0.2rem;
- }
-
- .hotspot-popup-close {
- position: absolute;
- top: 0.5rem;
- right: 0.5rem;
- background: none;
- border: none;
- color: #0a8060;
- font-size: 1rem;
- cursor: pointer;
- padding: 0.25rem;
- line-height: 1;
- }
-
- .hotspot-popup-close:hover {
- color: #00ff88;
- }
-
- .hotspot-popup-coords {
- font-size: 0.5rem;
- color: #0a6040;
- padding: 0.4rem 1rem;
- background: #030805;
- font-family: 'SF Mono', monospace;
- }
-
- /* Make hotspots clickable */
- .hotspot {
- cursor: pointer;
- pointer-events: auto;
- }
-
- .hotspot:hover .hotspot-dot {
- transform: scale(1.4);
- }
-
- .hotspot:hover .hotspot-label {
- transform: translateX(-50%) scale(1.1);
- text-shadow: 0 0 10px currentColor;
- }
-
- .hotspot.low:hover .hotspot-dot { box-shadow: 0 0 25px #00ff88, 0 0 40px rgba(0,255,136,0.5); }
- .hotspot.elevated:hover .hotspot-dot { box-shadow: 0 0 25px #ffcc00, 0 0 40px rgba(255,204,0,0.5); }
- .hotspot.high:hover .hotspot-dot { box-shadow: 0 0 30px #ff3333, 0 0 50px rgba(255,51,51,0.6); }
-
- /* Shipping Chokepoints */
- .chokepoint {
- position: absolute;
- transform: translate(-50%, -50%);
- pointer-events: auto;
- z-index: 18;
- cursor: pointer;
- }
-
- .chokepoint::before {
- content: '';
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- width: 28px;
- height: 28px;
- border: 1px solid transparent;
- border-radius: 4px;
- transition: all 0.3s ease;
- }
-
- .chokepoint:hover::before {
- border-color: #00aaff;
- animation: chokepoint-scan 1.5s ease-in-out infinite;
- }
-
- @keyframes chokepoint-scan {
- 0%, 100% { opacity: 1; }
- 50% { opacity: 0.4; }
- }
-
- .chokepoint:hover .chokepoint-icon {
- transform: scale(1.3);
- box-shadow: 0 0 15px rgba(0,170,255,0.8);
- }
-
- .chokepoint:hover .chokepoint-label {
- color: #00ffff;
- text-shadow: 0 0 8px rgba(0,255,255,0.6);
- }
-
- .chokepoint.alert:hover .chokepoint-icon {
- box-shadow: 0 0 20px rgba(255,170,0,1);
- }
-
- .chokepoint-icon {
- width: 14px;
- height: 14px;
- background: #0066cc;
- border: 2px solid #00aaff;
- border-radius: 2px;
- transition: all 0.2s ease;
- position: relative;
- box-shadow: 0 0 8px rgba(0,170,255,0.5);
- }
-
- .chokepoint-icon::after {
- content: '⚓';
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- font-size: 8px;
- }
-
- .chokepoint.alert .chokepoint-icon {
- background: #cc6600;
- border-color: #ffaa00;
- box-shadow: 0 0 12px rgba(255,170,0,0.6);
- animation: pulse-ship 1.5s ease-in-out infinite;
- }
-
- @keyframes pulse-ship {
- 0%, 100% { box-shadow: 0 0 8px rgba(255,170,0,0.4); }
- 50% { box-shadow: 0 0 16px rgba(255,170,0,0.8); }
- }
-
- .chokepoint-label {
- position: absolute;
- top: 18px;
- left: 50%;
- transform: translateX(-50%);
- font-size: 0.45rem;
- color: #00aaff;
- white-space: nowrap;
- text-transform: uppercase;
- letter-spacing: 0.05em;
- }
-
- /* Chokepoint Popup */
- .chokepoint-popup {
- display: none;
- position: absolute;
- z-index: 100;
- background: rgba(5, 8, 15, 0.95);
- border: 1px solid #0066cc;
- min-width: 260px;
- max-width: 320px;
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0, 170, 255, 0.15);
- pointer-events: auto;
- }
-
- .chokepoint-popup.visible {
- display: block;
- }
-
- .chokepoint-popup.alert {
- border-color: #ffaa00;
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 170, 0, 0.2);
- }
-
- .chokepoint-popup-header {
- padding: 0.75rem 1rem;
- border-bottom: 1px solid #0a3050;
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
-
- .chokepoint-popup-title {
- font-size: 0.75rem;
- font-weight: bold;
- color: #00aaff;
- text-transform: uppercase;
- letter-spacing: 0.1em;
- }
-
- .chokepoint-popup.alert .chokepoint-popup-title {
- color: #ffaa00;
- }
-
- .chokepoint-popup-status {
- font-size: 0.55rem;
- padding: 0.2rem 0.5rem;
- border-radius: 2px;
- font-weight: bold;
- text-transform: uppercase;
- }
-
- .chokepoint-popup-status.normal { background: #00aaff; color: #000; }
- .chokepoint-popup-status.alert { background: #ffaa00; color: #000; }
-
- .chokepoint-popup-info {
- padding: 0.6rem 1rem;
- border-bottom: 1px solid #0a3050;
- }
-
- .chokepoint-popup-stat {
- display: flex;
- justify-content: space-between;
- font-size: 0.6rem;
- padding: 0.25rem 0;
- }
-
- .chokepoint-popup-stat-label {
- color: #0a8090;
- }
-
- .chokepoint-popup-stat-value {
- color: #e8e8e8;
- font-weight: bold;
- }
-
- .chokepoint-popup-desc {
- font-size: 0.6rem;
- color: #8090a0;
- padding: 0.6rem 1rem;
- border-bottom: 1px solid #0a3050;
- line-height: 1.5;
- }
-
- .chokepoint-popup-headlines {
- max-height: 150px;
- overflow-y: auto;
- }
-
- .chokepoint-popup-headline {
- padding: 0.5rem 1rem;
- border-bottom: 1px solid #0a3050;
- font-size: 0.6rem;
- color: #e8e8e8;
- }
-
- .chokepoint-popup-headline:last-child {
- border-bottom: none;
- }
-
- .chokepoint-popup-headline a {
- color: inherit;
- text-decoration: none;
- }
-
- .chokepoint-popup-headline a:hover {
- color: #00aaff;
- }
-
- .chokepoint-popup-empty {
- padding: 0.75rem 1rem;
- font-size: 0.55rem;
- color: #0a8090;
- text-align: center;
- font-style: italic;
- }
-
- .chokepoint-popup-close {
- position: absolute;
- top: 0.5rem;
- right: 0.5rem;
- background: none;
- border: none;
- color: #0a8090;
- font-size: 1rem;
- cursor: pointer;
- padding: 0.25rem;
- line-height: 1;
- }
-
- .chokepoint-popup-close:hover {
- color: #00aaff;
- }
-
- /* Earthquake markers */
- .quake {
- position: absolute;
- transform: translate(-50%, -50%);
- pointer-events: auto;
- z-index: 17;
- cursor: pointer;
- }
-
- .quake::before {
- content: '';
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- width: 30px;
- height: 30px;
- border-radius: 50%;
- border: 1px solid transparent;
- transition: all 0.3s ease;
- }
-
- .quake:hover::before {
- border-color: #ff6600;
- animation: quake-ring 0.5s ease-out infinite;
- }
-
- @keyframes quake-ring {
- 0% { width: 20px; height: 20px; opacity: 1; }
- 100% { width: 40px; height: 40px; opacity: 0; }
- }
-
- .quake:hover .quake-icon {
- filter: brightness(1.5);
- transform: scale(1.3);
- }
-
- .quake:hover .quake-label {
- color: #ff9944;
- text-shadow: 0 0 8px rgba(255, 102, 0, 0.8);
- transform: translateX(-50%) scale(1.1);
- }
-
- .quake-icon {
- width: 12px;
- height: 12px;
- background: radial-gradient(circle, #ff6600 0%, #ff3300 100%);
- border-radius: 50%;
- animation: quake-pulse 1s ease-out infinite;
- transition: transform 0.2s, filter 0.2s;
- }
-
- .quake.major .quake-icon {
- width: 18px;
- height: 18px;
- background: radial-gradient(circle, #ff0000 0%, #cc0000 100%);
- animation: quake-pulse-major 0.8s ease-out infinite;
- }
-
- .quake.major:hover .quake-icon {
- box-shadow: 0 0 25px rgba(255, 0, 0, 0.9);
- }
-
- @keyframes quake-pulse {
- 0% { transform: scale(1); opacity: 1; }
- 100% { transform: scale(2); opacity: 0; }
- }
-
- @keyframes quake-pulse-major {
- 0% { transform: scale(1); opacity: 1; box-shadow: 0 0 10px #ff0000; }
- 100% { transform: scale(2.5); opacity: 0; box-shadow: 0 0 30px #ff0000; }
- }
-
- .quake-label {
- position: absolute;
- top: 16px;
- left: 50%;
- transform: translateX(-50%);
- font-size: 0.45rem;
- color: #ff6600;
- white-space: nowrap;
- transition: all 0.2s ease;
- }
-
- /* Earthquake Popup */
- .quake-popup {
- display: none;
- position: absolute;
- z-index: 100;
- background: rgba(15, 5, 5, 0.95);
- border: 1px solid #ff4400;
- min-width: 240px;
- max-width: 300px;
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 68, 0, 0.2);
- pointer-events: auto;
- }
-
- .quake-popup.visible {
- display: block;
- }
-
- .quake-popup.major {
- border-color: #ff0000;
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 0, 0, 0.3);
- }
-
- .quake-popup-header {
- padding: 0.75rem 1rem;
- border-bottom: 1px solid #401010;
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
-
- .quake-popup-mag {
- font-size: 1.5rem;
- font-weight: bold;
- color: #ff6600;
- }
-
- .quake-popup.major .quake-popup-mag {
- color: #ff0000;
- }
-
- .quake-popup-severity {
- font-size: 0.55rem;
- padding: 0.2rem 0.5rem;
- border-radius: 2px;
- font-weight: bold;
- text-transform: uppercase;
- }
-
- .quake-popup-severity.minor { background: #ff6600; color: #000; }
- .quake-popup-severity.moderate { background: #ff4400; color: #fff; }
- .quake-popup-severity.major { background: #ff0000; color: #fff; animation: pulse-level 1s infinite; }
-
- .quake-popup-location {
- padding: 0.6rem 1rem;
- font-size: 0.7rem;
- color: #e8e8e8;
- border-bottom: 1px solid #401010;
- }
-
- .quake-popup-info {
- padding: 0.6rem 1rem;
- }
-
- .quake-popup-stat {
- display: flex;
- justify-content: space-between;
- font-size: 0.6rem;
- padding: 0.25rem 0;
- }
-
- .quake-popup-stat-label {
- color: #804030;
- }
-
- .quake-popup-stat-value {
- color: #e8e8e8;
- }
-
- .quake-popup-close {
- position: absolute;
- top: 0.5rem;
- right: 0.5rem;
- background: none;
- border: none;
- color: #804030;
- font-size: 1rem;
- cursor: pointer;
- padding: 0.25rem;
- line-height: 1;
- }
-
- .quake-popup-close:hover {
- color: #ff6600;
- }
-
- .quake-popup-link {
- display: block;
- padding: 0.5rem 1rem;
- font-size: 0.55rem;
- color: #ff6600;
- text-decoration: none;
- border-top: 1px solid #401010;
- text-align: center;
- }
-
- .quake-popup-link:hover {
- background: rgba(255, 102, 0, 0.1);
- }
-
- /* Cyber threat indicators */
- .cyber-zone {
- position: absolute;
- transform: translate(-50%, -50%);
- pointer-events: auto;
- z-index: 16;
- cursor: pointer;
- }
-
- .cyber-zone::before {
- content: '';
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- width: 35px;
- height: 35px;
- border-radius: 50%;
- border: 1px solid transparent;
- transition: all 0.3s ease;
- }
-
- .cyber-zone:hover::before {
- border-color: #ff00ff;
- background: radial-gradient(circle, rgba(255,0,255,0.1) 0%, transparent 70%);
- animation: cyber-expand 1.5s ease-out infinite;
- }
-
- @keyframes cyber-expand {
- 0% { width: 25px; height: 25px; opacity: 1; }
- 100% { width: 50px; height: 50px; opacity: 0; }
- }
-
- .cyber-zone:hover .cyber-icon {
- opacity: 1;
- box-shadow: 0 0 25px rgba(255,0,255,0.9);
- transform: scale(1.2);
- animation: cyber-scan 1s linear infinite;
- }
-
- .cyber-zone:hover .cyber-label {
- opacity: 1;
- color: #ff66ff;
- text-shadow: 0 0 10px rgba(255, 0, 255, 0.8);
- transform: translateX(-50%) scale(1.1);
- }
-
- .cyber-icon {
- width: 20px;
- height: 20px;
- border: 1px dashed #ff00ff;
- border-radius: 50%;
- opacity: 0.4;
- animation: cyber-scan 3s linear infinite;
- transition: all 0.3s ease;
- }
-
- .cyber-zone.active .cyber-icon {
- opacity: 0.8;
- border-color: #ff00ff;
- box-shadow: 0 0 15px rgba(255,0,255,0.4);
- animation: cyber-active 1s ease-in-out infinite;
- }
-
- .cyber-zone.active:hover .cyber-icon {
- box-shadow: 0 0 30px rgba(255,0,255,1);
- }
-
- @keyframes cyber-scan {
- from { transform: rotate(0deg); }
- to { transform: rotate(360deg); }
- }
-
- @keyframes cyber-active {
- 0%, 100% { opacity: 0.6; }
- 50% { opacity: 1; }
- }
-
- .cyber-label {
- position: absolute;
- top: 16px;
- left: 50%;
- transform: translateX(-50%);
- font-size: 0.45rem;
- color: #ff00ff;
- opacity: 0.6;
- transition: all 0.2s ease;
- }
-
- /* Cyber Popup */
- .cyber-popup {
- display: none;
- position: absolute;
- z-index: 100;
- background: rgba(10, 5, 15, 0.95);
- border: 1px solid #ff00ff;
- min-width: 260px;
- max-width: 320px;
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 0, 255, 0.2);
- pointer-events: auto;
- }
-
- .cyber-popup.visible {
- display: block;
- }
-
- .cyber-popup.active {
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 40px rgba(255, 0, 255, 0.4);
- }
-
- .cyber-popup-header {
- padding: 0.75rem 1rem;
- border-bottom: 1px solid #301030;
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
-
- .cyber-popup-title {
- font-size: 0.8rem;
- font-weight: bold;
- color: #ff00ff;
- text-transform: uppercase;
- letter-spacing: 0.1em;
- }
-
- .cyber-popup-status {
- font-size: 0.5rem;
- padding: 0.2rem 0.5rem;
- border-radius: 2px;
- font-weight: bold;
- text-transform: uppercase;
- }
-
- .cyber-popup-status.dormant { background: #404; color: #a0a; }
- .cyber-popup-status.active { background: #ff00ff; color: #000; animation: pulse-level 1s infinite; }
-
- .cyber-popup-apt {
- padding: 0.5rem 1rem;
- font-size: 0.65rem;
- color: #ff80ff;
- border-bottom: 1px solid #301030;
- font-family: 'SF Mono', monospace;
- }
-
- .cyber-popup-desc {
- padding: 0.6rem 1rem;
- font-size: 0.6rem;
- color: #a080a0;
- line-height: 1.5;
- border-bottom: 1px solid #301030;
- }
-
- .cyber-popup-info {
- padding: 0.6rem 1rem;
- }
-
- .cyber-popup-stat {
- display: flex;
- justify-content: space-between;
- font-size: 0.55rem;
- padding: 0.2rem 0;
- }
-
- .cyber-popup-stat-label {
- color: #604060;
- }
-
- .cyber-popup-stat-value {
- color: #e8e8e8;
- }
-
- .cyber-popup-targets {
- padding: 0.5rem 1rem;
- border-top: 1px solid #301030;
- }
-
- .cyber-popup-targets-label {
- font-size: 0.5rem;
- color: #604060;
- text-transform: uppercase;
- margin-bottom: 0.3rem;
- }
-
- .cyber-popup-target-tags {
- display: flex;
- flex-wrap: wrap;
- gap: 0.3rem;
- }
-
- .cyber-popup-target-tag {
- font-size: 0.5rem;
- padding: 0.15rem 0.4rem;
- background: #301030;
- color: #ff80ff;
- border-radius: 2px;
- }
-
- .cyber-popup-close {
- position: absolute;
- top: 0.5rem;
- right: 0.5rem;
- background: none;
- border: none;
- color: #604060;
- font-size: 1rem;
- cursor: pointer;
- padding: 0.25rem;
- line-height: 1;
- }
-
- .cyber-popup-close:hover {
- color: #ff00ff;
- }
-
- /* Layoff tracker */
- .layoff-item {
- padding: 0.6rem 1rem;
- border-bottom: 1px solid var(--border);
- }
-
- .layoff-company {
- font-size: 0.75rem;
- font-weight: bold;
- color: var(--text);
- }
-
- .layoff-count {
- font-size: 0.8rem;
- color: var(--red);
- font-weight: bold;
- float: right;
- }
-
- .layoff-meta {
- font-size: 0.55rem;
- color: var(--text-dim);
- margin-top: 0.2rem;
- }
-
- /* Situation panels */
- .situation-header {
- padding: 0.75rem 1rem;
- background: var(--surface);
- border-bottom: 1px solid var(--border);
- }
-
- .situation-title {
- font-size: 0.8rem;
- font-weight: bold;
- margin-bottom: 0.3rem;
- }
-
- .situation-subtitle {
- font-size: 0.6rem;
- color: var(--text-dim);
- }
-
- .situation-status {
- display: inline-block;
- padding: 0.15rem 0.4rem;
- font-size: 0.55rem;
- font-weight: bold;
- border-radius: 2px;
- margin-left: 0.5rem;
- }
-
- .situation-status.critical { background: var(--red); color: #fff; }
- .situation-status.elevated { background: var(--yellow); color: var(--bg); }
- .situation-status.monitoring { background: var(--green); color: var(--bg); }
-
- .situation-item {
- padding: 0.5rem 1rem;
- border-bottom: 1px solid var(--border);
- font-size: 0.7rem;
- }
-
- .situation-item .label {
- color: var(--text-dim);
- font-size: 0.55rem;
- text-transform: uppercase;
- letter-spacing: 0.05em;
- }
-
- .loading-msg {
- padding: 1rem;
- color: var(--text-dim);
- font-size: 0.7rem;
- animation: pulse 1.5s ease-in-out infinite;
- }
-
- @keyframes pulse {
- 0%, 100% { opacity: 0.5; }
- 50% { opacity: 1; }
- }
-
- /* Livestream */
- .panel-wide {
- grid-column: span 2;
- }
-
- .panel-livestream {
- min-height: auto;
- }
-
- .livestream-container {
- padding: 0 !important;
- aspect-ratio: 16 / 9;
- max-height: none;
- overflow: hidden;
- }
-
- .livestream-container iframe {
- width: 100%;
- height: 100%;
- border: none;
- display: block;
- }
-
- .live-indicator {
- background: var(--red);
- color: #fff;
- padding: 0.15rem 0.4rem;
- border-radius: 3px;
- font-size: 0.55rem;
- font-weight: bold;
- animation: live-pulse 2s ease-in-out infinite;
- }
-
- @keyframes live-pulse {
- 0%, 100% { opacity: 1; }
- 50% { opacity: 0.6; }
- }
-
- @media (max-width: 900px) {
- .panel-wide {
- grid-column: span 1;
- }
- }
-
- /* Congressional Trades */
- .congress-item {
- padding: 0.6rem 1rem;
- border-bottom: 1px solid var(--border);
- display: flex;
- justify-content: space-between;
- align-items: flex-start;
- gap: 0.75rem;
- }
-
- .congress-info {
- flex: 1;
- min-width: 0;
- }
-
- .congress-name {
- font-size: 0.7rem;
- font-weight: bold;
- color: var(--text);
- }
-
- .congress-party {
- font-size: 0.55rem;
- padding: 0.1rem 0.3rem;
- border-radius: 2px;
- margin-left: 0.4rem;
- }
-
- .congress-party.D { background: #2266cc; color: #fff; }
- .congress-party.R { background: #cc2222; color: #fff; }
- .congress-party.I { background: #666; color: #fff; }
-
- .congress-ticker {
- font-size: 0.75rem;
- font-weight: bold;
- color: var(--accent);
- margin-top: 0.2rem;
- }
-
- .congress-meta {
- font-size: 0.55rem;
- color: var(--text-dim);
- margin-top: 0.15rem;
- }
-
- .congress-type {
- text-align: right;
- }
-
- .congress-action {
- font-size: 0.65rem;
- font-weight: bold;
- padding: 0.2rem 0.4rem;
- border-radius: 2px;
- }
-
- .congress-action.buy { background: var(--green); color: var(--bg); }
- .congress-action.sell { background: var(--red); color: #fff; }
-
- .congress-amount {
- font-size: 0.55rem;
- color: var(--text-dim);
- margin-top: 0.25rem;
- }
-
- /* Whale Watch */
- .whale-item {
- padding: 0.6rem 1rem;
- border-bottom: 1px solid var(--border);
- }
-
- .whale-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
-
- .whale-coin {
- font-size: 0.7rem;
- font-weight: bold;
- }
-
- .whale-amount {
- font-size: 0.75rem;
- font-weight: bold;
- color: var(--accent);
- }
-
- .whale-usd {
- font-size: 0.55rem;
- color: var(--text-dim);
- }
-
- .whale-flow {
- font-size: 0.6rem;
- color: var(--text-dim);
- margin-top: 0.2rem;
- display: flex;
- align-items: center;
- gap: 0.3rem;
- }
-
- .whale-flow .arrow {
- color: var(--yellow);
- }
-
- /* Main Character */
- .main-char-display {
- padding: 1.5rem 1rem;
- text-align: center;
- }
-
- .main-char-label {
- font-size: 0.6rem;
- color: var(--text-dim);
- text-transform: uppercase;
- letter-spacing: 0.1em;
- margin-bottom: 0.5rem;
- }
-
- .main-char-name {
- font-size: 1.5rem;
- font-weight: bold;
- color: var(--accent);
- margin-bottom: 0.3rem;
- }
-
- .main-char-count {
- font-size: 0.7rem;
- color: var(--text-dim);
- }
-
- .main-char-list {
- margin-top: 1rem;
- padding-top: 1rem;
- border-top: 1px solid var(--border);
- }
-
- .char-row {
- display: flex;
- justify-content: space-between;
- padding: 0.35rem 1rem;
- font-size: 0.7rem;
- }
-
- .char-row .rank {
- color: var(--text-dim);
- width: 1.5rem;
- }
-
- .char-row .name {
- flex: 1;
- }
-
- .char-row .mentions {
- color: var(--text-dim);
- }
-
- /* Contracts */
- .contract-item {
- padding: 0.6rem 1rem;
- border-bottom: 1px solid var(--border);
- }
-
- .contract-agency {
- font-size: 0.55rem;
- color: var(--text-dim);
- text-transform: uppercase;
- letter-spacing: 0.05em;
- }
-
- .contract-desc {
- font-size: 0.75rem;
- color: var(--text);
- margin-top: 0.2rem;
- }
-
- .contract-meta {
- display: flex;
- justify-content: space-between;
- margin-top: 0.3rem;
- }
-
- .contract-vendor {
- font-size: 0.6rem;
- color: var(--text-dim);
- }
-
- .contract-value {
- font-size: 0.7rem;
- font-weight: bold;
- color: var(--green);
- }
-
- /* AI Tracker */
- .ai-item {
- padding: 0.6rem 1rem;
- border-bottom: 1px solid var(--border);
- }
-
- .ai-source {
- font-size: 0.55rem;
- color: var(--text-dim);
- text-transform: uppercase;
- letter-spacing: 0.05em;
- }
-
- .ai-title {
- font-size: 0.75rem;
- color: var(--text);
- margin-top: 0.15rem;
- }
-
- .ai-date {
- font-size: 0.55rem;
- color: var(--text-dim);
- margin-top: 0.2rem;
- }
-
- /* Intel Feed */
- .intel-item {
- padding: 0.6rem 1rem;
- border-bottom: 1px solid var(--border);
- }
-
- .intel-item.priority {
- border-left: 2px solid var(--red);
- background: rgba(255, 68, 68, 0.05);
- }
-
- .intel-header {
- display: flex;
- justify-content: space-between;
- align-items: flex-start;
- gap: 0.5rem;
- margin-bottom: 0.2rem;
- }
-
- .intel-source {
- font-size: 0.55rem;
- color: var(--text-dim);
- text-transform: uppercase;
- letter-spacing: 0.05em;
- }
-
- .intel-tags {
- display: flex;
- gap: 0.3rem;
- flex-wrap: wrap;
- }
-
- .intel-tag {
- font-size: 0.5rem;
- padding: 0.1rem 0.35rem;
- border-radius: 2px;
- font-weight: bold;
- text-transform: uppercase;
- letter-spacing: 0.03em;
- }
-
- .intel-tag.region {
- background: #1a3a5a;
- color: #6ab0ff;
- }
-
- .intel-tag.topic {
- background: #3a2a4a;
- color: #b090d0;
- }
-
- .intel-tag.osint {
- background: #2a4a3a;
- color: #60d090;
- }
-
- .intel-tag.govt {
- background: #4a3a2a;
- color: #d0a060;
- }
-
- .intel-title {
- font-size: 0.75rem;
- color: var(--text);
- text-decoration: none;
- display: block;
- line-height: 1.4;
- }
-
- .intel-title:hover {
- color: var(--accent);
- }
-
- .intel-meta {
- font-size: 0.55rem;
- color: var(--text-dim);
- margin-top: 0.25rem;
- display: flex;
- gap: 0.75rem;
- }
-
- /* Correlation Engine */
- .correlation-panel {
- padding: 0.5rem;
- }
-
- .correlation-sections {
- display: grid;
- grid-template-columns: repeat(2, 1fr);
- gap: 0.75rem;
- }
-
- @media (max-width: 1200px) {
- .correlation-sections {
- grid-template-columns: 1fr;
- }
- }
-
- .correlation-section {
- background: rgba(0, 20, 40, 0.5);
- border: 1px solid var(--border);
- border-radius: 4px;
- overflow: hidden;
- }
-
- .correlation-section-header {
- padding: 0.5rem 0.75rem;
- background: rgba(0, 40, 60, 0.5);
- border-bottom: 1px solid var(--border);
- display: flex;
- align-items: center;
- gap: 0.5rem;
- }
-
- .correlation-icon {
- font-size: 0.9rem;
- }
-
- .correlation-section-title {
- font-size: 0.65rem;
- font-weight: bold;
- color: var(--accent);
- text-transform: uppercase;
- letter-spacing: 0.05em;
- }
-
- .correlation-content {
- padding: 0.5rem;
- max-height: 200px;
- overflow-y: auto;
- }
-
- .correlation-item {
- padding: 0.5rem;
- border-radius: 3px;
- margin-bottom: 0.4rem;
- background: rgba(0, 30, 50, 0.5);
- border-left: 3px solid var(--accent);
- }
-
- .correlation-item.high {
- border-left-color: #ff4444;
- background: rgba(255, 68, 68, 0.1);
- }
-
- .correlation-item.elevated {
- border-left-color: #ffaa00;
- background: rgba(255, 170, 0, 0.08);
- }
-
- .correlation-item.emerging {
- border-left-color: #44ff88;
- background: rgba(68, 255, 136, 0.08);
- }
-
- .correlation-item-header {
- display: flex;
- justify-content: space-between;
- align-items: flex-start;
- margin-bottom: 0.3rem;
- }
-
- .correlation-topic {
- font-size: 0.7rem;
- font-weight: bold;
- color: var(--text);
- }
-
- .correlation-score {
- font-size: 0.55rem;
- padding: 0.15rem 0.4rem;
- border-radius: 2px;
- font-weight: bold;
- }
-
- .correlation-score.high {
- background: rgba(255, 68, 68, 0.3);
- color: #ff8888;
- }
-
- .correlation-score.elevated {
- background: rgba(255, 170, 0, 0.3);
- color: #ffcc44;
- }
-
- .correlation-score.emerging {
- background: rgba(68, 255, 136, 0.3);
- color: #88ffaa;
- }
-
- .correlation-meta {
- font-size: 0.55rem;
- color: var(--text-dim);
- margin-bottom: 0.3rem;
- }
-
- .correlation-sources {
- display: flex;
- flex-wrap: wrap;
- gap: 0.25rem;
- margin-top: 0.3rem;
- }
-
- .correlation-source-tag {
- font-size: 0.45rem;
- padding: 0.1rem 0.3rem;
- background: rgba(0, 100, 150, 0.3);
- color: #66aacc;
- border-radius: 2px;
- text-transform: uppercase;
- }
-
- .correlation-headlines {
- margin-top: 0.4rem;
- padding-top: 0.4rem;
- border-top: 1px solid rgba(255, 255, 255, 0.1);
- }
-
- .correlation-headline {
- font-size: 0.55rem;
- color: var(--text-dim);
- padding: 0.2rem 0;
- display: flex;
- gap: 0.3rem;
- }
-
- .correlation-headline::before {
- content: '→';
- color: var(--accent);
- }
-
- .correlation-headline a {
- color: inherit;
- text-decoration: none;
- }
-
- .correlation-headline a:hover {
- color: var(--accent);
- }
-
- .prediction-confidence {
- display: flex;
- align-items: center;
- gap: 0.4rem;
- margin-top: 0.3rem;
- }
-
- .confidence-bar {
- flex: 1;
- height: 4px;
- background: rgba(255, 255, 255, 0.1);
- border-radius: 2px;
- overflow: hidden;
- }
-
- .confidence-fill {
- height: 100%;
- border-radius: 2px;
- transition: width 0.3s ease;
- }
-
- .confidence-fill.high {
- background: linear-gradient(90deg, #ff4444, #ff8888);
- }
-
- .confidence-fill.medium {
- background: linear-gradient(90deg, #ffaa00, #ffcc44);
- }
-
- .confidence-fill.low {
- background: linear-gradient(90deg, #44aaff, #88ccff);
- }
-
- .confidence-label {
- font-size: 0.5rem;
- color: var(--text-dim);
- min-width: 35px;
- text-align: right;
- }
-
- .momentum-indicator {
- display: inline-flex;
- align-items: center;
- gap: 0.2rem;
- font-size: 0.55rem;
- padding: 0.1rem 0.3rem;
- border-radius: 2px;
- }
-
- .momentum-indicator.rising {
- background: rgba(68, 255, 136, 0.2);
- color: #66ff99;
- }
-
- .momentum-indicator.surging {
- background: rgba(255, 68, 68, 0.2);
- color: #ff8888;
- animation: pulse-surge 1s ease-in-out infinite;
- }
-
- .momentum-indicator.stable {
- background: rgba(100, 100, 100, 0.2);
- color: #999;
- }
-
- @keyframes pulse-surge {
- 0%, 100% { opacity: 1; }
- 50% { opacity: 0.6; }
- }
-
- .time-delta {
- font-size: 0.5rem;
- color: var(--text-dim);
- }
-
- .no-correlations {
- font-size: 0.6rem;
- color: var(--text-dim);
- text-align: center;
- padding: 1rem;
- }
-
- /* Narrative Tracker Styles */
- .narrative-panel {
- padding: 0.5rem;
- }
-
- .narrative-sections {
- display: grid;
- grid-template-columns: repeat(2, 1fr);
- gap: 0.75rem;
- }
-
- @media (max-width: 600px) {
- .narrative-sections {
- grid-template-columns: 1fr;
- }
- }
-
- .narrative-section {
- background: rgba(40, 0, 40, 0.3);
- border: 1px solid rgba(180, 80, 180, 0.3);
- border-radius: 4px;
- overflow: hidden;
- }
-
- .narrative-section-header {
- display: flex;
- align-items: center;
- gap: 0.4rem;
- padding: 0.4rem 0.6rem;
- background: rgba(100, 50, 100, 0.2);
- border-bottom: 1px solid rgba(180, 80, 180, 0.2);
- }
-
- .narrative-icon {
- font-size: 0.8rem;
- }
-
- .narrative-section-title {
- font-size: 0.6rem;
- font-weight: bold;
- color: #cc88cc;
- text-transform: uppercase;
- letter-spacing: 0.05em;
- }
-
- .narrative-content {
- padding: 0.5rem;
- max-height: 200px;
- overflow-y: auto;
- }
-
- .narrative-item {
- padding: 0.4rem;
- margin-bottom: 0.4rem;
- background: rgba(80, 40, 80, 0.2);
- border-radius: 3px;
- border-left: 3px solid transparent;
- }
-
- .narrative-item:last-child {
- margin-bottom: 0;
- }
-
- .narrative-item.viral {
- border-left-color: #ff4488;
- background: rgba(255, 68, 136, 0.1);
- }
-
- .narrative-item.spreading {
- border-left-color: #ffaa44;
- background: rgba(255, 170, 68, 0.1);
- }
-
- .narrative-item.emerging {
- border-left-color: #44ff88;
- background: rgba(68, 255, 136, 0.1);
- }
-
- .narrative-item.watch {
- border-left-color: #8888ff;
- background: rgba(136, 136, 255, 0.1);
- }
-
- .narrative-item.disinfo {
- border-left-color: #ff4444;
- background: rgba(255, 68, 68, 0.1);
- }
-
- .narrative-header {
- display: flex;
- justify-content: space-between;
- align-items: flex-start;
- gap: 0.3rem;
- margin-bottom: 0.2rem;
- }
-
- .narrative-title {
- font-size: 0.65rem;
- font-weight: bold;
- color: #dda0dd;
- }
-
- .narrative-badge {
- font-size: 0.45rem;
- padding: 0.1rem 0.3rem;
- border-radius: 2px;
- text-transform: uppercase;
- font-weight: bold;
- }
-
- .narrative-badge.viral {
- background: rgba(255, 68, 136, 0.3);
- color: #ff88aa;
- }
-
- .narrative-badge.spreading {
- background: rgba(255, 170, 68, 0.3);
- color: #ffcc88;
- }
-
- .narrative-badge.emerging {
- background: rgba(68, 255, 136, 0.3);
- color: #88ffaa;
- }
-
- .narrative-badge.disinfo {
- background: rgba(255, 68, 68, 0.3);
- color: #ff8888;
- }
-
- .narrative-description {
- font-size: 0.55rem;
- color: var(--text-dim);
- margin-bottom: 0.3rem;
- }
-
- .narrative-metrics {
- display: flex;
- gap: 0.5rem;
- flex-wrap: wrap;
- }
-
- .narrative-metric {
- font-size: 0.5rem;
- color: #aa88aa;
- }
-
- .narrative-metric-value {
- font-weight: bold;
- color: #cc88cc;
- }
-
- .narrative-sources {
- display: flex;
- flex-wrap: wrap;
- gap: 0.2rem;
- margin-top: 0.3rem;
- }
-
- .narrative-source-tag {
- font-size: 0.45rem;
- padding: 0.1rem 0.3rem;
- background: rgba(150, 80, 150, 0.3);
- color: #bb99bb;
- border-radius: 2px;
- }
-
- .narrative-crossover {
- display: flex;
- align-items: center;
- gap: 0.3rem;
- margin-top: 0.3rem;
- padding-top: 0.3rem;
- border-top: 1px dashed rgba(180, 80, 180, 0.2);
- }
-
- .crossover-arrow {
- font-size: 0.6rem;
- color: #cc88cc;
- }
-
- .crossover-source {
- font-size: 0.5rem;
- padding: 0.1rem 0.3rem;
- border-radius: 2px;
- }
-
- .crossover-source.fringe {
- background: rgba(255, 100, 100, 0.2);
- color: #ff9999;
- }
-
- .crossover-source.mainstream {
- background: rgba(100, 200, 100, 0.2);
- color: #88cc88;
- }
-
- .no-narratives {
- font-size: 0.6rem;
- color: var(--text-dim);
- text-align: center;
- padding: 1rem;
- }
-
- /* Money Printer Gauge */
- .printer-gauge {
- padding: 1.5rem 1rem;
- text-align: center;
- }
-
- .printer-label {
- font-size: 0.6rem;
- color: var(--text-dim);
- text-transform: uppercase;
- letter-spacing: 0.1em;
- margin-bottom: 0.75rem;
- }
-
- .printer-value {
- font-size: 2rem;
- font-weight: bold;
- color: var(--accent);
- }
-
- .printer-unit {
- font-size: 0.8rem;
- color: var(--text-dim);
- margin-left: 0.3rem;
- }
-
- .printer-change {
- font-size: 0.8rem;
- margin-top: 0.5rem;
- }
-
- .printer-change.up { color: var(--red); }
- .printer-change.down { color: var(--green); }
-
- .printer-bar {
- margin-top: 1rem;
- height: 8px;
- background: var(--surface);
- border-radius: 4px;
- overflow: hidden;
- }
-
- .printer-fill {
- height: 100%;
- background: linear-gradient(90deg, var(--green), var(--yellow), var(--red));
- transition: width 0.5s ease;
- }
-
- .printer-status {
- margin-top: 0.75rem;
- font-size: 0.65rem;
- color: var(--text-dim);
- }
-
- .printer-indicator {
- display: inline-block;
- width: 8px;
- height: 8px;
- border-radius: 50%;
- margin-right: 0.4rem;
- animation: blink 1s infinite;
- }
-
- .printer-indicator.on { background: var(--red); }
- .printer-indicator.off { background: var(--green); }
-
- @keyframes blink {
- 0%, 100% { opacity: 1; }
- 50% { opacity: 0.4; }
- }
-
- .section-divider {
- padding: 0.4rem 1rem;
- background: var(--surface);
- font-size: 0.55rem;
- font-weight: bold;
- letter-spacing: 0.1em;
- text-transform: uppercase;
- color: var(--text-dim);
- }
-
- @media (max-width: 1400px) {
- .dashboard {
- grid-template-columns: repeat(2, 1fr);
- }
- .panel.wide {
- grid-column: span 1;
- }
- }
-
- @media (max-width: 768px) {
- .dashboard {
- grid-template-columns: 1fr;
- }
-
- .header {
- padding: 0.75rem 1rem;
- }
-
- .panel-content {
- max-height: 350px;
- }
- }
-
- /* Conflict Zone Boundaries - Enhanced Overlays */
- .conflict-zone-path {
- fill: none;
- stroke: #ff3333;
- stroke-width: 2;
- stroke-dasharray: 8, 4;
- stroke-linecap: round;
- opacity: 0.8;
- animation: conflict-march 1s linear infinite;
- }
-
- .conflict-zone-path.high-intensity {
- stroke: #ff0000;
- stroke-width: 3;
- filter: drop-shadow(0 0 6px rgba(255, 0, 0, 0.8));
- animation: conflict-march 0.8s linear infinite, conflict-pulse 2s ease-in-out infinite;
- }
-
- .conflict-zone-fill {
- fill: rgba(255, 50, 50, 0.08);
- stroke: none;
- animation: conflict-fill-pulse 3s ease-in-out infinite;
- }
-
- .conflict-zone-fill.high-intensity {
- fill: rgba(255, 30, 30, 0.15);
- animation: conflict-fill-pulse 2s ease-in-out infinite;
- }
-
- /* Conflict zone inner glow effect */
- .conflict-zone-glow {
- fill: none;
- stroke: rgba(255, 50, 50, 0.4);
- stroke-width: 8;
- filter: blur(4px);
- animation: conflict-glow-pulse 2s ease-in-out infinite;
- }
-
- .conflict-zone-label {
- position: absolute;
- font-size: 0.55rem;
- color: #ff4444;
- text-transform: uppercase;
- letter-spacing: 0.1em;
- background: rgba(20, 0, 0, 0.85);
- padding: 0.2rem 0.5rem;
- border: 1px solid #ff3333;
- pointer-events: auto;
- cursor: pointer;
- white-space: nowrap;
- animation: conflict-label-pulse 2s ease-in-out infinite;
- transition: all 0.2s ease;
- box-shadow: 0 0 10px rgba(255, 50, 50, 0.3), inset 0 0 8px rgba(255, 50, 50, 0.1);
- }
-
- .conflict-zone-label::before {
- content: '⚠';
- margin-right: 4px;
- font-size: 0.6rem;
- }
-
- .conflict-zone-label.high-intensity {
- border-color: #ff0000;
- color: #ff0000;
- box-shadow: 0 0 15px rgba(255, 0, 0, 0.5), inset 0 0 10px rgba(255, 0, 0, 0.2);
- animation: conflict-label-pulse-high 1.5s ease-in-out infinite;
- }
-
- .conflict-zone-label.high-intensity::before {
- content: '🔴';
- animation: rotate 4s linear infinite;
- }
-
- .conflict-zone-label:hover {
- background: rgba(60, 0, 0, 0.95);
- transform: scale(1.15);
- box-shadow: 0 0 20px rgba(255, 51, 51, 0.7), inset 0 0 15px rgba(255, 50, 50, 0.3);
- animation: none;
- z-index: 100;
- }
-
- @keyframes conflict-march {
- to { stroke-dashoffset: -12; }
- }
-
- @keyframes conflict-pulse {
- 0%, 100% { stroke-width: 3; }
- 50% { stroke-width: 4; }
- }
-
- @keyframes conflict-fill-pulse {
- 0%, 100% { opacity: 0.6; }
- 50% { opacity: 1; }
- }
-
- @keyframes conflict-glow-pulse {
- 0%, 100% { opacity: 0.3; stroke-width: 8; }
- 50% { opacity: 0.6; stroke-width: 12; }
- }
-
- @keyframes conflict-label-pulse {
- 0%, 100% { opacity: 0.9; box-shadow: 0 0 10px rgba(255, 50, 50, 0.3), inset 0 0 8px rgba(255, 50, 50, 0.1); }
- 50% { opacity: 1; box-shadow: 0 0 15px rgba(255, 50, 50, 0.5), inset 0 0 10px rgba(255, 50, 50, 0.2); }
- }
-
- @keyframes conflict-label-pulse-high {
- 0%, 100% { opacity: 0.9; box-shadow: 0 0 15px rgba(255, 0, 0, 0.5), inset 0 0 10px rgba(255, 0, 0, 0.2); }
- 50% { opacity: 1; box-shadow: 0 0 25px rgba(255, 0, 0, 0.7), inset 0 0 15px rgba(255, 0, 0, 0.3); }
- }
-
- /* Conflict Zone Popup */
- .conflict-popup {
- display: none;
- position: absolute;
- z-index: 100;
- background: rgba(20, 5, 5, 0.98);
- border: 1px solid #ff3333;
- min-width: 320px;
- max-width: 400px;
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 50, 50, 0.2);
- pointer-events: auto;
- }
-
- .conflict-popup.visible {
- display: block;
- }
-
- .conflict-popup-header {
- padding: 0.75rem 1rem;
- border-bottom: 1px solid rgba(255, 50, 50, 0.3);
- display: flex;
- justify-content: space-between;
- align-items: center;
- background: rgba(255, 50, 50, 0.1);
- }
-
- .conflict-popup-title {
- font-size: 0.8rem;
- font-weight: bold;
- color: #ff4444;
- text-transform: uppercase;
- letter-spacing: 0.1em;
- }
-
- .conflict-popup-intensity {
- font-size: 0.55rem;
- padding: 0.2rem 0.5rem;
- border-radius: 2px;
- font-weight: bold;
- text-transform: uppercase;
- }
-
- .conflict-popup-intensity.high {
- background: #ff0000;
- color: #fff;
- animation: pulse-level 1s infinite;
- }
- .conflict-popup-intensity.medium {
- background: #ff6600;
- color: #fff;
- }
- .conflict-popup-intensity.watch {
- background: #ffcc00;
- color: #000;
- }
-
- .conflict-popup-meta {
- padding: 0.6rem 1rem;
- border-bottom: 1px solid rgba(255, 50, 50, 0.2);
- display: grid;
- grid-template-columns: 1fr 1fr;
- gap: 0.5rem;
- }
-
- .conflict-popup-meta-item {
- font-size: 0.55rem;
- }
-
- .conflict-popup-meta-label {
- color: #884444;
- text-transform: uppercase;
- letter-spacing: 0.05em;
- display: block;
- margin-bottom: 0.15rem;
- }
-
- .conflict-popup-meta-value {
- color: #ff8888;
- }
-
- .conflict-popup-desc {
- padding: 0.75rem 1rem;
- font-size: 0.65rem;
- color: #ccaaaa;
- line-height: 1.5;
- border-bottom: 1px solid rgba(255, 50, 50, 0.2);
- }
-
- .conflict-popup-parties {
- padding: 0.6rem 1rem;
- border-bottom: 1px solid rgba(255, 50, 50, 0.2);
- }
-
- .conflict-popup-parties-title {
- font-size: 0.5rem;
- color: #884444;
- text-transform: uppercase;
- letter-spacing: 0.1em;
- margin-bottom: 0.4rem;
- }
-
- .conflict-popup-party {
- display: inline-block;
- font-size: 0.55rem;
- padding: 0.15rem 0.4rem;
- margin: 0.15rem 0.2rem 0.15rem 0;
- background: rgba(255, 50, 50, 0.2);
- border: 1px solid rgba(255, 50, 50, 0.3);
- color: #ff8888;
- }
-
- .conflict-popup-events {
- padding: 0.6rem 1rem;
- border-bottom: 1px solid rgba(255, 50, 50, 0.2);
- }
-
- .conflict-popup-events-title {
- font-size: 0.5rem;
- color: #884444;
- text-transform: uppercase;
- letter-spacing: 0.1em;
- margin-bottom: 0.4rem;
- }
-
- .conflict-popup-event {
- font-size: 0.55rem;
- color: #ff8888;
- padding: 0.2rem 0;
- padding-left: 0.75rem;
- position: relative;
- }
-
- .conflict-popup-event::before {
- content: '•';
- position: absolute;
- left: 0;
- color: #ff4444;
- }
-
- .conflict-popup-headlines {
- max-height: 150px;
- overflow-y: auto;
- }
-
- .conflict-popup-headlines-title {
- font-size: 0.5rem;
- color: #884444;
- text-transform: uppercase;
- letter-spacing: 0.1em;
- padding: 0.5rem 1rem 0.3rem;
- }
-
- .conflict-popup-headline {
- padding: 0.5rem 1rem;
- border-bottom: 1px solid rgba(255, 50, 50, 0.15);
- font-size: 0.6rem;
- color: #ccaaaa;
- cursor: pointer;
- transition: background 0.2s;
- }
-
- .conflict-popup-headline:hover {
- background: rgba(255, 50, 50, 0.15);
- }
-
- .conflict-popup-headline a {
- color: inherit;
- text-decoration: none;
- }
-
- .conflict-popup-headline a:hover {
- color: #ff8888;
- }
-
- .conflict-popup-headline-source {
- font-size: 0.45rem;
- color: #884444;
- text-transform: uppercase;
- margin-bottom: 0.15rem;
- }
-
- .conflict-popup-close {
- position: absolute;
- top: 0.5rem;
- right: 0.5rem;
- background: none;
- border: none;
- color: #884444;
- font-size: 1rem;
- cursor: pointer;
- padding: 0.25rem;
- line-height: 1;
- transition: color 0.2s;
- }
-
- .conflict-popup-close:hover {
- color: #ff4444;
- }
-
- /* Military Base Markers */
- .military-base {
- position: absolute;
- transform: translate(-50%, -50%);
- pointer-events: auto;
- z-index: 19;
- cursor: pointer;
- }
-
- .military-base::before {
- content: '';
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- width: 20px;
- height: 20px;
- border-radius: 50%;
- border: 1px solid transparent;
- transition: all 0.3s ease;
- }
-
- .military-base:hover::before {
- border-color: currentColor;
- animation: base-ping 1s ease-out infinite;
- }
-
- .military-base:hover .base-icon {
- transform: scale(1.5);
- }
-
- .military-base.us-nato:hover::before { border-color: #4488ff; }
- .military-base.china:hover::before { border-color: #ff4444; }
- .military-base.russia:hover::before { border-color: #ff8800; }
-
- @keyframes base-ping {
- 0% { width: 20px; height: 20px; opacity: 1; }
- 100% { width: 35px; height: 35px; opacity: 0; }
- }
-
- .base-icon {
- width: 8px;
- height: 8px;
- border-radius: 1px;
- transition: transform 0.2s, box-shadow 0.2s;
- }
-
- .base-icon.us-nato {
- background: #4488ff;
- border: 1px solid #66aaff;
- box-shadow: 0 0 6px rgba(68, 136, 255, 0.5);
- }
-
- .base-icon.china {
- background: #ff4444;
- border: 1px solid #ff6666;
- box-shadow: 0 0 6px rgba(255, 68, 68, 0.5);
- }
-
- .base-icon.russia {
- background: #ff8800;
- border: 1px solid #ffaa44;
- box-shadow: 0 0 6px rgba(255, 136, 0, 0.5);
- }
-
- .military-base:hover .base-icon.us-nato {
- box-shadow: 0 0 15px rgba(68, 136, 255, 0.9);
- }
-
- .military-base:hover .base-icon.china {
- box-shadow: 0 0 15px rgba(255, 68, 68, 0.9);
- }
-
- .military-base:hover .base-icon.russia {
- box-shadow: 0 0 15px rgba(255, 136, 0, 0.9);
- }
-
- .base-label {
- position: absolute;
- top: 12px;
- left: 50%;
- transform: translateX(-50%) translateY(5px);
- font-size: 0.45rem;
- white-space: nowrap;
- opacity: 0;
- transition: all 0.2s ease;
- background: rgba(0, 0, 0, 0.8);
- padding: 0.15rem 0.4rem;
- border-radius: 2px;
- }
-
- .military-base:hover .base-label {
- opacity: 1;
- transform: translateX(-50%) translateY(0);
- }
-
- .base-label.us-nato { color: #4488ff; border: 1px solid #4488ff; }
- .base-label.china { color: #ff4444; border: 1px solid #ff4444; }
- .base-label.russia { color: #ff8800; border: 1px solid #ff8800; }
-
- /* Nuclear Facility Markers */
- .nuclear-facility {
- position: absolute;
- transform: translate(-50%, -50%);
- pointer-events: auto;
- z-index: 18;
- cursor: pointer;
- }
-
- .nuclear-facility::before {
- content: '';
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- width: 24px;
- height: 24px;
- border-radius: 50%;
- border: 1px dashed transparent;
- transition: all 0.3s ease;
- }
-
- .nuclear-facility:hover::before {
- border-color: #ffcc00;
- animation: nuclear-rotate 3s linear infinite;
- }
-
- .nuclear-facility:hover .nuclear-icon {
- transform: scale(1.4);
- box-shadow: 0 0 20px rgba(255, 255, 0, 1);
- }
-
- .nuclear-facility:hover .nuclear-icon.weapons {
- box-shadow: 0 0 25px rgba(255, 0, 0, 1);
- }
-
- @keyframes nuclear-rotate {
- from { transform: translate(-50%, -50%) rotate(0deg); }
- to { transform: translate(-50%, -50%) rotate(360deg); }
- }
-
- .nuclear-icon {
- width: 10px;
- height: 10px;
- background: #ffcc00;
- border: 2px solid #ffff00;
- border-radius: 50%;
- position: relative;
- box-shadow: 0 0 8px rgba(255, 204, 0, 0.6);
- transition: transform 0.2s, box-shadow 0.2s;
- }
-
- .nuclear-icon::before {
- content: '☢';
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- font-size: 6px;
- color: #000;
- }
-
- .nuclear-icon.weapons {
- background: #ff0000;
- border-color: #ff4444;
- box-shadow: 0 0 10px rgba(255, 0, 0, 0.7);
- animation: nuclear-pulse 1.5s ease-in-out infinite;
- }
-
- @keyframes nuclear-pulse {
- 0%, 100% { box-shadow: 0 0 8px rgba(255, 0, 0, 0.5); }
- 50% { box-shadow: 0 0 15px rgba(255, 0, 0, 0.9); }
- }
-
- .nuclear-label {
- position: absolute;
- top: 16px;
- left: 50%;
- transform: translateX(-50%) translateY(5px);
- font-size: 0.45rem;
- color: #ffcc00;
- white-space: nowrap;
- opacity: 0;
- transition: all 0.2s ease;
- background: rgba(0, 0, 0, 0.85);
- padding: 0.15rem 0.4rem;
- border: 1px solid #ffcc00;
- border-radius: 2px;
- }
-
- .nuclear-facility:hover .nuclear-label {
- opacity: 1;
- transform: translateX(-50%) translateY(0);
- }
-
- /* Undersea Cables */
- .cable-path {
- fill: none;
- stroke: #00ffff;
- stroke-width: 1.5;
- stroke-opacity: 0.4;
- stroke-linecap: round;
- cursor: pointer;
- transition: all 0.3s ease;
- }
-
- .cable-path:hover {
- stroke-opacity: 1;
- stroke-width: 3;
- stroke: #00ffff;
- filter: drop-shadow(0 0 8px rgba(0, 255, 255, 0.8));
- stroke-dasharray: 8, 4;
- animation: cable-flow 0.5s linear infinite;
- }
-
- @keyframes cable-flow {
- to { stroke-dashoffset: -12; }
- }
-
- .cable-path.major {
- stroke-width: 2;
- stroke-opacity: 0.6;
- }
-
- .cable-path.major:hover {
- stroke-width: 4;
- }
-
- .cable-endpoint {
- fill: #00ffff;
- stroke: #00aaaa;
- stroke-width: 1;
- }
-
- /* Sanctions Heat Map - Country fills */
- .country-sanctioned-severe {
- fill: #660000 !important;
- }
-
- .country-sanctioned-high {
- fill: #442200 !important;
- }
-
- .country-sanctioned-moderate {
- fill: #333300 !important;
- }
-
- .country-sanctioned-low {
- fill: #223322 !important;
- }
-
- /* Breaking News Pulse */
- .news-pulse {
- position: absolute;
- transform: translate(-50%, -50%);
- pointer-events: none;
- z-index: 25;
- }
-
- .news-pulse-ring {
- position: absolute;
- width: 40px;
- height: 40px;
- border: 2px solid #ff0000;
- border-radius: 50%;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- animation: news-pulse-expand 2s ease-out infinite;
- }
-
- .news-pulse-ring:nth-child(2) {
- animation-delay: 0.5s;
- }
-
- .news-pulse-ring:nth-child(3) {
- animation-delay: 1s;
- }
-
- @keyframes news-pulse-expand {
- 0% {
- width: 10px;
- height: 10px;
- opacity: 1;
- border-width: 3px;
- }
- 100% {
- width: 80px;
- height: 80px;
- opacity: 0;
- border-width: 1px;
- }
- }
-
- .news-pulse-label {
- position: absolute;
- top: 50px;
- left: 50%;
- transform: translateX(-50%);
- font-size: 0.5rem;
- color: #ff0000;
- white-space: nowrap;
- text-transform: uppercase;
- letter-spacing: 0.1em;
- animation: blink 1s ease-in-out infinite;
- background: rgba(0, 0, 0, 0.8);
- padding: 0.2rem 0.5rem;
- border: 1px solid #ff0000;
- }
-
- /* 24-Hour Flashback Slider */
- .flashback-control {
- position: absolute;
- bottom: 30px;
- left: 50%;
- transform: translateX(-50%);
- display: flex;
- align-items: center;
- gap: 1rem;
- background: rgba(0, 0, 0, 0.85);
- padding: 0.5rem 1rem;
- border: 1px solid #0f5040;
- z-index: 50;
- }
-
- .flashback-label {
- font-size: 0.55rem;
- color: #0a8060;
- text-transform: uppercase;
- letter-spacing: 0.1em;
- transition: color 0.2s;
- }
-
- .flashback-control:hover .flashback-label {
- color: #00ff88;
- }
-
- .flashback-slider {
- width: 200px;
- height: 4px;
- -webkit-appearance: none;
- appearance: none;
- background: #0a3020;
- border-radius: 2px;
- cursor: pointer;
- transition: all 0.2s;
- }
-
- .flashback-slider:hover {
- background: #0f5040;
- height: 6px;
- }
-
- .flashback-slider::-webkit-slider-thumb {
- -webkit-appearance: none;
- width: 14px;
- height: 14px;
- background: #00ff88;
- border-radius: 50%;
- cursor: pointer;
- box-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
- transition: all 0.2s;
- }
-
- .flashback-slider:hover::-webkit-slider-thumb {
- width: 18px;
- height: 18px;
- box-shadow: 0 0 15px rgba(0, 255, 136, 0.9);
- }
-
- .flashback-slider::-moz-range-thumb {
- width: 14px;
- height: 14px;
- background: #00ff88;
- border-radius: 50%;
- cursor: pointer;
- border: none;
- transition: all 0.2s;
- }
-
- .flashback-slider:hover::-moz-range-thumb {
- width: 18px;
- height: 18px;
- box-shadow: 0 0 15px rgba(0, 255, 136, 0.9);
- }
-
- .flashback-time {
- font-size: 0.65rem;
- color: #00ff88;
- font-family: 'SF Mono', monospace;
- min-width: 60px;
- transition: all 0.2s;
- }
-
- .flashback-control:hover .flashback-time {
- text-shadow: 0 0 10px rgba(0, 255, 136, 0.8);
- }
-
- .flashback-mode-indicator {
- position: absolute;
- top: 30px;
- left: 50%;
- transform: translateX(-50%);
- background: rgba(255, 170, 0, 0.9);
- color: #000;
- padding: 0.3rem 1rem;
- font-size: 0.6rem;
- font-weight: bold;
- text-transform: uppercase;
- letter-spacing: 0.1em;
- z-index: 50;
- display: none;
- }
-
- .flashback-mode-indicator.active {
- display: block;
- animation: blink 1s ease-in-out infinite;
- }
-
- /* News Density Heatmap */
- .density-blob {
- position: absolute;
- border-radius: 50%;
- pointer-events: auto;
- z-index: 12;
- mix-blend-mode: screen;
- cursor: pointer;
- transition: all 0.3s ease;
- }
-
- .density-blob.low {
- background: radial-gradient(circle, rgba(0, 255, 136, 0.3) 0%, transparent 70%);
- }
-
- .density-blob.medium {
- background: radial-gradient(circle, rgba(255, 204, 0, 0.35) 0%, transparent 70%);
- }
-
- .density-blob.high {
- background: radial-gradient(circle, rgba(255, 68, 68, 0.4) 0%, transparent 70%);
- animation: density-glow 2s ease-in-out infinite;
- }
-
- .density-blob:hover {
- transform: translate(-50%, -50%) scale(1.3) !important;
- filter: brightness(1.5);
- }
-
- .density-blob.low:hover {
- background: radial-gradient(circle, rgba(0, 255, 136, 0.5) 0%, transparent 70%);
- }
-
- .density-blob.medium:hover {
- background: radial-gradient(circle, rgba(255, 204, 0, 0.55) 0%, transparent 70%);
- }
-
- .density-blob.high:hover {
- background: radial-gradient(circle, rgba(255, 68, 68, 0.6) 0%, transparent 70%);
- }
-
- @keyframes density-glow {
- 0%, 100% { opacity: 0.7; transform: translate(-50%, -50%) scale(1); }
- 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
- }
-
- /* Map Layer Toggle */
- .map-layer-toggle {
- position: absolute;
- top: 8px;
- left: 50%;
- transform: translateX(-50%);
- display: flex;
- gap: 2px;
- background: rgba(0, 0, 0, 0.85);
- padding: 4px;
- border: 1px solid #0f5040;
- z-index: 50;
- backdrop-filter: blur(4px);
- }
-
- .layer-btn {
- background: transparent;
- border: 1px solid #0a3020;
- color: #0a8060;
- font-size: 0.5rem;
- padding: 0.3rem 0.6rem;
- cursor: pointer;
- font-family: 'SF Mono', monospace;
- text-transform: uppercase;
- letter-spacing: 0.05em;
- transition: all 0.2s ease;
- position: relative;
- overflow: hidden;
- }
-
- .layer-btn::before {
- content: '';
- position: absolute;
- top: 0;
- left: -100%;
- width: 100%;
- height: 100%;
- background: linear-gradient(90deg, transparent, rgba(0, 255, 136, 0.2), transparent);
- transition: left 0.4s ease;
- }
-
- .layer-btn:hover::before {
- left: 100%;
- }
-
- .layer-btn:hover {
- border-color: #00ff88;
- color: #00ff88;
- text-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
- transform: translateY(-1px);
- }
-
- .layer-btn.active {
- background: #0f5040;
- color: #00ff88;
- border-color: #00ff88;
- box-shadow: 0 0 10px rgba(0, 255, 136, 0.3), inset 0 0 10px rgba(0, 255, 136, 0.1);
- }
-
- .layer-btn.active:hover {
- background: #0a3020;
- box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
- }
-
- /* Flight Radar Aircraft Markers */
- .aircraft-marker {
- position: absolute;
- width: 16px;
- height: 16px;
- transform: translate(-50%, -50%);
- cursor: pointer;
- z-index: 50;
- transition: transform 0.3s ease;
- }
-
- .aircraft-icon {
- width: 100%;
- height: 100%;
- font-size: 12px;
- display: flex;
- align-items: center;
- justify-content: center;
- color: #ffaa00;
- text-shadow: 0 0 4px rgba(255, 170, 0, 0.5);
- transition: all 0.2s ease;
- }
-
- .aircraft-marker:hover .aircraft-icon {
- color: #ffcc44;
- transform: scale(1.3);
- text-shadow: 0 0 8px rgba(255, 204, 68, 0.8);
- }
-
- .aircraft-marker.military .aircraft-icon {
- color: #ff4444;
- text-shadow: 0 0 4px rgba(255, 68, 68, 0.5);
- }
-
- .aircraft-marker.cargo .aircraft-icon {
- color: #44aaff;
- text-shadow: 0 0 4px rgba(68, 170, 255, 0.5);
- }
-
- .aircraft-marker.helicopter .aircraft-icon {
- color: #44ff88;
- text-shadow: 0 0 4px rgba(68, 255, 136, 0.5);
- }
-
- .aircraft-trail {
- position: absolute;
- width: 2px;
- height: 20px;
- background: linear-gradient(to bottom, rgba(255, 170, 0, 0.4), transparent);
- transform-origin: top center;
- pointer-events: none;
- }
-
- .aircraft-popup {
- position: absolute;
- background: rgba(0, 20, 15, 0.95);
- border: 1px solid #0a8060;
- border-radius: 4px;
- padding: 0.75rem;
- min-width: 200px;
- max-width: 280px;
- z-index: 200;
- display: none;
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 255, 136, 0.1);
- }
-
- .aircraft-popup.visible {
- display: block;
- }
-
- .aircraft-popup-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 0.5rem;
- padding-bottom: 0.5rem;
- border-bottom: 1px solid rgba(0, 255, 136, 0.2);
- }
-
- .aircraft-callsign {
- font-size: 0.9rem;
- font-weight: bold;
- color: #00ff88;
- font-family: 'SF Mono', monospace;
- }
-
- .aircraft-type-badge {
- font-size: 0.5rem;
- padding: 0.15rem 0.4rem;
- background: rgba(255, 170, 0, 0.2);
- color: #ffaa00;
- border-radius: 2px;
- text-transform: uppercase;
- }
-
- .aircraft-details {
- font-size: 0.65rem;
- color: var(--text-dim);
- }
-
- .aircraft-detail-row {
- display: flex;
- justify-content: space-between;
- padding: 0.2rem 0;
- }
-
- .aircraft-detail-label {
- color: #0a8060;
- }
-
- .aircraft-detail-value {
- color: #88ccaa;
- font-family: 'SF Mono', monospace;
- }
-
- .aircraft-origin-dest {
- margin-top: 0.5rem;
- padding-top: 0.5rem;
- border-top: 1px solid rgba(0, 255, 136, 0.2);
- display: flex;
- align-items: center;
- gap: 0.5rem;
- font-size: 0.6rem;
- }
-
- .aircraft-airport {
- color: #66aacc;
- font-family: 'SF Mono', monospace;
- }
-
- .aircraft-route-arrow {
- color: #0a8060;
- }
-
- .flight-count-badge {
- font-size: 0.5rem;
- padding: 0.1rem 0.3rem;
- background: rgba(255, 170, 0, 0.2);
- color: #ffaa00;
- border-radius: 2px;
- margin-left: 0.3rem;
- }
-
- /* Satellite Imagery Layer */
- .satellite-canvas {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- z-index: 0;
- opacity: 0;
- transition: opacity 0.5s ease;
- pointer-events: none;
- }
-
- .satellite-canvas.visible {
- opacity: 0.85;
- }
-
- .satellite-loading {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- font-size: 0.7rem;
- color: #00ff88;
- background: rgba(0, 20, 15, 0.9);
- padding: 0.5rem 1rem;
- border-radius: 4px;
- border: 1px solid #0a8060;
- z-index: 5;
- display: none;
- }
-
- .satellite-loading.visible {
- display: block;
- }
-
- .satellite-attribution {
- position: absolute;
- bottom: 5px;
- left: 5px;
- font-size: 0.45rem;
- color: rgba(255, 255, 255, 0.5);
- background: rgba(0, 0, 0, 0.5);
- padding: 0.1rem 0.3rem;
- border-radius: 2px;
- z-index: 10;
- display: none;
- }
-
- .satellite-attribution.visible {
- display: block;
- }
-
- .layer-btn.satellite-btn {
- background: rgba(80, 60, 20, 0.3);
- border-color: #806020;
- color: #aa8844;
- }
-
- .layer-btn.satellite-btn.active {
- background: rgba(120, 100, 40, 0.5);
- border-color: #bbaa44;
- color: #ffdd66;
- box-shadow: 0 0 10px rgba(255, 220, 100, 0.3);
- }
-
- /* Custom Monitors */
- .monitors-section {
- margin-top: 1rem;
- padding-top: 1rem;
- border-top: 1px solid var(--border);
- }
-
- .monitors-list {
- max-height: 200px;
- overflow-y: auto;
- margin-bottom: 0.75rem;
- }
-
- .monitor-item {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0.5rem;
- background: var(--surface);
- border: 1px solid var(--border);
- margin-bottom: 0.5rem;
- border-radius: 2px;
- }
-
- .monitor-item-info {
- flex: 1;
- min-width: 0;
- }
-
- .monitor-item-name {
- font-size: 0.7rem;
- font-weight: bold;
- color: var(--text);
- display: flex;
- align-items: center;
- gap: 0.4rem;
- }
-
- .monitor-item-color {
- width: 8px;
- height: 8px;
- border-radius: 50%;
- flex-shrink: 0;
- }
-
- .monitor-item-keywords {
- font-size: 0.55rem;
- color: var(--text-dim);
- margin-top: 0.2rem;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
-
- .monitor-item-location {
- font-size: 0.5rem;
- color: var(--green);
- margin-top: 0.15rem;
- }
-
- .monitor-item-actions {
- display: flex;
- gap: 0.25rem;
- }
-
- .monitor-item-btn {
- background: transparent;
- border: 1px solid var(--border);
- color: var(--text-dim);
- width: 22px;
- height: 22px;
- font-size: 0.6rem;
- cursor: pointer;
- display: flex;
- align-items: center;
- justify-content: center;
- transition: all 0.2s;
- }
-
- .monitor-item-btn:hover {
- border-color: var(--text);
- color: var(--text);
- }
-
- .monitor-item-btn.delete:hover {
- border-color: var(--red);
- color: var(--red);
- }
-
- .add-monitor-btn {
- width: 100%;
- padding: 0.5rem;
- background: transparent;
- border: 1px dashed var(--border);
- color: var(--text-dim);
- font-family: inherit;
- font-size: 0.65rem;
- cursor: pointer;
- transition: all 0.2s;
- }
-
- .add-monitor-btn:hover {
- border-color: var(--green);
- color: var(--green);
- }
-
- /* Monitor Form Modal */
- .monitor-form-overlay {
- display: none;
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background: rgba(0,0,0,0.9);
- z-index: 1100;
- justify-content: center;
- align-items: center;
- }
-
- .monitor-form-overlay.open {
- display: flex;
- }
-
- .monitor-form {
- background: var(--bg);
- border: 1px solid var(--border);
- padding: 1.5rem;
- width: 90%;
- max-width: 400px;
- }
-
- .monitor-form-title {
- font-size: 0.8rem;
- font-weight: bold;
- letter-spacing: 0.1em;
- text-transform: uppercase;
- margin-bottom: 1rem;
- padding-bottom: 0.75rem;
- border-bottom: 1px solid var(--border);
- }
-
- .monitor-form-field {
- margin-bottom: 1rem;
- }
-
- .monitor-form-label {
- font-size: 0.65rem;
- color: var(--text-dim);
- text-transform: uppercase;
- letter-spacing: 0.1em;
- margin-bottom: 0.4rem;
- display: block;
- }
-
- .monitor-form-input {
- width: 100%;
- padding: 0.5rem;
- background: var(--surface);
- border: 1px solid var(--border);
- color: var(--text);
- font-family: inherit;
- font-size: 0.75rem;
- }
-
- .monitor-form-input:focus {
- outline: none;
- border-color: var(--green);
- }
-
- .monitor-form-hint {
- font-size: 0.55rem;
- color: var(--text-dim);
- margin-top: 0.3rem;
- }
-
- .monitor-form-colors {
- display: flex;
- gap: 0.5rem;
- flex-wrap: wrap;
- }
-
- .monitor-color-option {
- width: 24px;
- height: 24px;
- border-radius: 50%;
- cursor: pointer;
- border: 2px solid transparent;
- transition: all 0.2s;
- }
-
- .monitor-color-option:hover {
- transform: scale(1.2);
- }
-
- .monitor-color-option.selected {
- border-color: var(--text);
- box-shadow: 0 0 10px currentColor;
- }
-
- .monitor-form-location {
- display: flex;
- gap: 0.5rem;
- }
-
- .monitor-form-location input {
- flex: 1;
- }
-
- .monitor-form-actions {
- display: flex;
- gap: 0.5rem;
- margin-top: 1.5rem;
- }
-
- .monitor-form-actions button {
- flex: 1;
- padding: 0.6rem;
- font-family: inherit;
- font-size: 0.7rem;
- font-weight: bold;
- letter-spacing: 0.05em;
- text-transform: uppercase;
- cursor: pointer;
- transition: all 0.2s;
- }
-
- .monitor-save-btn {
- background: var(--green);
- color: var(--bg);
- border: none;
- }
-
- .monitor-save-btn:hover {
- opacity: 0.8;
- }
-
- .monitor-cancel-btn {
- background: transparent;
- color: var(--text-dim);
- border: 1px solid var(--border);
- }
-
- .monitor-cancel-btn:hover {
- border-color: var(--text);
- color: var(--text);
- }
-
- /* Custom Hotspot (user-created) */
- .custom-hotspot {
- position: absolute;
- transform: translate(-50%, -50%);
- pointer-events: auto;
- z-index: 21;
- cursor: pointer;
- }
-
- .custom-hotspot-dot {
- width: 12px;
- height: 12px;
- border-radius: 50%;
- position: relative;
- border: 2px solid;
- box-shadow: 0 0 10px currentColor;
- transition: all 0.2s;
- }
-
- .custom-hotspot-dot::before {
- content: '';
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- width: 100%;
- height: 100%;
- border-radius: 50%;
- animation: custom-pulse 2s ease-out infinite;
- background: currentColor;
- }
-
- @keyframes custom-pulse {
- 0% { width: 100%; height: 100%; opacity: 0.6; }
- 100% { width: 250%; height: 250%; opacity: 0; }
- }
-
- .custom-hotspot:hover .custom-hotspot-dot {
- transform: scale(1.4);
- box-shadow: 0 0 20px currentColor;
- }
-
- .custom-hotspot-label {
- position: absolute;
- top: 18px;
- left: 50%;
- transform: translateX(-50%);
- font-size: 0.5rem;
- font-family: 'SF Mono', monospace;
- white-space: nowrap;
- text-shadow: 0 0 5px currentColor;
- text-transform: uppercase;
- letter-spacing: 0.05em;
- transition: all 0.2s;
- }
-
- .custom-hotspot:hover .custom-hotspot-label {
- transform: translateX(-50%) scale(1.1);
- }
-
- .custom-hotspot-count {
- font-size: 0.4rem;
- opacity: 0.7;
- }
-
- /* My Monitors Panel */
- .monitor-match {
- padding: 0.6rem 1rem;
- border-bottom: 1px solid var(--border);
- cursor: pointer;
- transition: background 0.2s;
- }
-
- .monitor-match:hover {
- background: var(--surface);
- }
-
- .monitor-match-header {
- display: flex;
- align-items: center;
- gap: 0.4rem;
- margin-bottom: 0.3rem;
- }
-
- .monitor-match-dot {
- width: 6px;
- height: 6px;
- border-radius: 50%;
- flex-shrink: 0;
- }
-
- .monitor-match-name {
- font-size: 0.6rem;
- font-weight: bold;
- color: var(--text-dim);
- text-transform: uppercase;
- letter-spacing: 0.05em;
- }
-
- .monitor-match-title {
- font-size: 0.75rem;
- color: var(--text);
- text-decoration: none;
- display: block;
- }
-
- .monitor-match-title:hover {
- color: var(--accent);
- }
-
- .monitor-match-source {
- font-size: 0.5rem;
- color: var(--text-dim);
- margin-top: 0.2rem;
- }
-
- .monitors-empty {
- padding: 1.5rem 1rem;
- text-align: center;
- color: var(--text-dim);
- font-size: 0.7rem;
- }
-
- .monitors-empty-hint {
- font-size: 0.6rem;
- margin-top: 0.5rem;
- opacity: 0.7;
- }
-
- /* Custom Hotspot Popup */
- .custom-hotspot-popup {
- display: none;
- position: absolute;
- z-index: 100;
- background: rgba(5, 10, 8, 0.95);
- border: 1px solid var(--border);
- min-width: 280px;
- max-width: 350px;
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
- }
-
- .custom-hotspot-popup.visible {
- display: block;
- }
-
- .custom-hotspot-popup-header {
- padding: 0.75rem 1rem;
- border-bottom: 1px solid var(--border);
- display: flex;
- align-items: center;
- gap: 0.5rem;
- }
-
- .custom-hotspot-popup-dot {
- width: 10px;
- height: 10px;
- border-radius: 50%;
- flex-shrink: 0;
- }
-
- .custom-hotspot-popup-name {
- font-size: 0.85rem;
- font-weight: bold;
- }
-
- .custom-hotspot-popup-count {
- margin-left: auto;
- font-size: 0.65rem;
- padding: 0.2rem 0.5rem;
- border-radius: 3px;
- background: var(--surface);
- }
-
- .custom-hotspot-popup-keywords {
- padding: 0.5rem 1rem;
- font-size: 0.6rem;
- color: var(--text-dim);
- border-bottom: 1px solid var(--border);
- }
-
- .custom-hotspot-popup-coords {
- padding: 0.4rem 1rem;
- font-size: 0.55rem;
- color: var(--text-dim);
- font-family: 'SF Mono', monospace;
- border-bottom: 1px solid var(--border);
- }
-
- .custom-hotspot-popup-matches {
- max-height: 200px;
- overflow-y: auto;
- }
-
- .custom-hotspot-popup-match {
- padding: 0.6rem 1rem;
- border-bottom: 1px solid var(--border);
- }
-
- .custom-hotspot-popup-match:last-child {
- border-bottom: none;
- }
-
- .custom-hotspot-popup-match a {
- font-size: 0.7rem;
- color: var(--text);
- text-decoration: none;
- display: block;
- }
-
- .custom-hotspot-popup-match a:hover {
- color: var(--accent);
- }
-
- .custom-hotspot-popup-match-source {
- font-size: 0.5rem;
- color: var(--text-dim);
- margin-top: 0.2rem;
- }
-
- .custom-hotspot-popup-empty {
- padding: 1rem;
- text-align: center;
- font-size: 0.7rem;
- color: var(--text-dim);
- }
-
- .custom-hotspot-popup-close {
- position: absolute;
- top: 0.5rem;
- right: 0.5rem;
- background: none;
- border: none;
- color: var(--text-dim);
- font-size: 1rem;
- cursor: pointer;
- padding: 0.25rem;
- line-height: 1;
- }
-
- .custom-hotspot-popup-close:hover {
- color: var(--text);
- }
- </style>
- <script src="https://d3js.org/d3.v7.min.js"></script>
- <script src="https://cdn.jsdelivr.net/npm/topojson-client@3"></script>
-</head>
-<body>
- <header class="header">
- <div class="header-left">
- <h1 class="title">Situation Monitor</h1>
- <span class="status" id="status">Ready</span>
- </div>
- <div class="header-right">
- <button class="refresh-btn monitors-btn" onclick="openMonitorForm()">+ Monitor</button>
- <button class="settings-btn" onclick="toggleSettings()">Panels</button>
- <button class="refresh-btn" id="refreshBtn" onclick="refreshAll()">Refresh</button>
- </div>
- </header>
-
- <!-- Settings Modal -->
- <div class="settings-modal" id="settingsModal" onclick="if(event.target === this) toggleSettings()">
- <div class="settings-content">
- <div class="settings-title">Panel Settings</div>
- <div class="settings-section">
- <div class="settings-section-title">Toggle Panels</div>
- <div id="panelToggles"></div>
- </div>
- <div class="settings-section">
- <div class="settings-section-title">Livestream URL</div>
- <input type="text" id="livestreamUrl" class="settings-input" placeholder="YouTube URL (e.g. https://youtube.com/watch?v=...)" onchange="saveLivestreamUrl()">
- <div class="settings-hint">Paste any YouTube video or livestream URL</div>
- </div>
- <div class="settings-section">
- <div class="settings-section-title">Layout</div>
- <div class="settings-hint" style="margin-bottom: 0.5rem;">Drag panel headers to reorder</div>
- <button class="settings-reset" onclick="resetPanelOrder()">Reset Layout</button>
- </div>
- <div class="settings-section monitors-section">
- <div class="settings-section-title">Custom Monitors</div>
- <div class="settings-hint" style="margin-bottom: 0.5rem;">Track keywords with optional map locations</div>
- <div class="monitors-list" id="monitorsList"></div>
- <button class="add-monitor-btn" onclick="openMonitorForm()">+ Add Monitor</button>
- </div>
- <button class="settings-close" onclick="toggleSettings()">Close</button>
- </div>
- </div>
-
- <!-- Monitor Form Modal -->
- <div class="monitor-form-overlay" id="monitorFormOverlay" onclick="if(event.target === this) closeMonitorForm()">
- <div class="monitor-form">
- <div class="monitor-form-title" id="monitorFormTitle">Add Monitor</div>
- <input type="hidden" id="monitorEditId">
- <div class="monitor-form-field">
- <label class="monitor-form-label">Name</label>
- <input type="text" class="monitor-form-input" id="monitorName" placeholder="e.g., TSMC Supply Chain">
- </div>
- <div class="monitor-form-field">
- <label class="monitor-form-label">Keywords</label>
- <input type="text" class="monitor-form-input" id="monitorKeywords" placeholder="e.g., tsmc, taiwan semiconductor, chip">
- <div class="monitor-form-hint">Comma-separated. Matches headlines containing any keyword.</div>
- </div>
- <div class="monitor-form-field">
- <label class="monitor-form-label">Color</label>
- <div class="monitor-form-colors" id="monitorColors"></div>
- </div>
- <div class="monitor-form-field">
- <label class="monitor-form-label">Map Location (Optional)</label>
- <div class="monitor-form-location">
- <input type="text" class="monitor-form-input" id="monitorLat" placeholder="Latitude">
- <input type="text" class="monitor-form-input" id="monitorLon" placeholder="Longitude">
- </div>
- <div class="monitor-form-hint">Leave blank for keyword-only monitoring. Add coords to show on map.</div>
- </div>
- <div class="monitor-form-actions">
- <button class="monitor-cancel-btn" onclick="closeMonitorForm()">Cancel</button>
- <button class="monitor-save-btn" onclick="saveMonitor()">Save</button>
- </div>
- </div>
- </div>
-
- <main class="dashboard">
- <!-- Global Intelligence Map -->
- <section class="panel" data-panel="map" style="grid-column: span 4;">
- <div class="panel-header">
- <span class="panel-title">Global Activity Monitor</span>
- <span class="panel-count" id="mapLegend">
- <span style="color: var(--green);">● Low</span>
- <span style="color: var(--yellow); margin-left: 0.5rem;">● Elevated</span>
- <span style="color: var(--red); margin-left: 0.5rem;">● High</span>
- </span>
- </div>
- <div class="panel-content" id="mapPanel" style="max-height: none; height: 350px; overflow: hidden;">
- <div class="loading-msg">Loading map...</div>
- </div>
- </section>
-
- <!-- TBPN Livestream -->
- <section class="panel panel-livestream" data-panel="tbpn">
- <div class="panel-header">
- <span class="panel-title">Livestream</span>
- <span class="live-indicator">LIVE</span>
- </div>
- <div class="panel-content livestream-container" id="tbpnPanel">
- <div class="loading-msg">Loading stream...</div>
- </div>
- </section>
-
- <!-- Political / World News -->
- <section class="panel" data-panel="politics">
- <div class="panel-header">
- <span class="panel-title">World / Geopolitical</span>
- <span class="panel-count" id="politicsCount">-</span>
- </div>
- <div class="panel-content" id="politicsPanel">
- <div class="loading-msg">Loading...</div>
- </div>
- </section>
-
- <!-- Technology News -->
- <section class="panel" data-panel="tech">
- <div class="panel-header">
- <span class="panel-title">Technology / AI</span>
- <span class="panel-count" id="techCount">-</span>
- </div>
- <div class="panel-content" id="techPanel">
- <div class="loading-msg">Loading...</div>
- </div>
- </section>
-
- <!-- Financial News -->
- <section class="panel" data-panel="finance">
- <div class="panel-header">
- <span class="panel-title">Financial</span>
- <span class="panel-count" id="financeCount">-</span>
- </div>
- <div class="panel-content" id="financePanel">
- <div class="loading-msg">Loading...</div>
- </div>
- </section>
-
- <!-- Government / Policy -->
- <section class="panel" data-panel="gov">
- <div class="panel-header">
- <span class="panel-title">Government / Policy</span>
- <span class="panel-count" id="govCount">-</span>
- </div>
- <div class="panel-content" id="govPanel">
- <div class="loading-msg">Loading...</div>
- </div>
- </section>
-
- <!-- Sector Heatmap -->
- <section class="panel" data-panel="heatmap">
- <div class="panel-header">
- <span class="panel-title">Sector Heatmap</span>
- </div>
- <div class="panel-content" id="heatmapPanel">
- <div class="loading-msg">Loading...</div>
- </div>
- </section>
-
- <!-- Markets -->
- <section class="panel wide" data-panel="markets">
- <div class="panel-header">
- <span class="panel-title">Markets</span>
- <span class="panel-count" id="marketsCount">-</span>
- </div>
- <div class="panel-content" id="marketsPanel">
- <div class="loading-msg">Loading...</div>
- </div>
- </section>
-
- <!-- Commodities -->
- <section class="panel" data-panel="commodities">
- <div class="panel-header">
- <span class="panel-title">Commodities / VIX</span>
- </div>
- <div class="panel-content" id="commoditiesPanel">
- <div class="loading-msg">Loading...</div>
- </div>
- </section>
-
- <!-- Polymarket -->
- <section class="panel wide" data-panel="polymarket">
- <div class="panel-header">
- <span class="panel-title">Polymarket Predictions</span>
- <span class="panel-count" id="polymarketCount">-</span>
- </div>
- <div class="panel-content" id="polymarketPanel">
- <div class="loading-msg">Loading...</div>
- </div>
- </section>
-
- <!-- Congressional Trading -->
- <section class="panel" data-panel="congress">
- <div class="panel-header">
- <span class="panel-title">Congress Trades</span>
- <span class="panel-count" id="congressCount">-</span>
- </div>
- <div class="panel-content" id="congressPanel">
- <div class="loading-msg">Loading...</div>
- </div>
- </section>
-
- <!-- Whale Wallet Watch -->
- <section class="panel" data-panel="whales">
- <div class="panel-header">
- <span class="panel-title">Whale Watch</span>
- <span class="panel-count" id="whaleCount">-</span>
- </div>
- <div class="panel-content" id="whalePanel">
- <div class="loading-msg">Loading...</div>
- </div>
- </section>
-
- <!-- Main Character -->
- <section class="panel" data-panel="mainchar">
- <div class="panel-header">
- <span class="panel-title">Main Character</span>
- <span class="panel-count">Today</span>
- </div>
- <div class="panel-content" id="mainCharPanel">
- <div class="loading-msg">Loading...</div>
- </div>
- </section>
-
- <!-- Money Printer -->
- <section class="panel" data-panel="printer">
- <div class="panel-header">
- <span class="panel-title">Money Printer</span>
- <span class="panel-count">Fed Balance Sheet</span>
- </div>
- <div class="panel-content" id="printerPanel">
- <div class="loading-msg">Loading...</div>
- </div>
- </section>
-
- <!-- Government Contracts -->
- <section class="panel wide" data-panel="contracts">
- <div class="panel-header">
- <span class="panel-title">Gov Contracts</span>
- <span class="panel-count" id="contractsCount">-</span>
- </div>
- <div class="panel-content" id="contractsPanel">
- <div class="loading-msg">Loading...</div>
- </div>
- </section>
-
- <!-- AI Arms Race -->
- <section class="panel wide" data-panel="ai">
- <div class="panel-header">
- <span class="panel-title">AI Arms Race</span>
- <span class="panel-count" id="aiCount">-</span>
- </div>
- <div class="panel-content" id="aiPanel">
- <div class="loading-msg">Loading...</div>
- </div>
- </section>
-
- <!-- Layoffs Tracker -->
- <section class="panel" data-panel="layoffs">
- <div class="panel-header">
- <span class="panel-title">Layoffs Tracker</span>
- <span class="panel-count" id="layoffsCount">-</span>
- </div>
- <div class="panel-content" id="layoffsPanel">
- <div class="loading-msg">Loading...</div>
- </div>
- </section>
-
- <!-- Venezuela Situation -->
- <section class="panel" data-panel="venezuela">
- <div class="panel-header">
- <span class="panel-title">Venezuela Situation</span>
- <span class="panel-count" id="venezuelaStatus">-</span>
- </div>
- <div class="panel-content" id="venezuelaPanel">
- <div class="loading-msg">Loading...</div>
- </div>
- </section>
-
- <!-- Greenland Situation -->
- <section class="panel" data-panel="greenland">
- <div class="panel-header">
- <span class="panel-title">Greenland Situation</span>
- <span class="panel-count" id="greenlandStatus">-</span>
- </div>
- <div class="panel-content" id="greenlandPanel">
- <div class="loading-msg">Loading...</div>
- </div>
- </section>
-
- <!-- Intel Feed -->
- <section class="panel wide" data-panel="intel">
- <div class="panel-header">
- <span class="panel-title">Intel Feed</span>
- <span class="panel-count" id="intelCount">-</span>
- </div>
- <div class="panel-content" id="intelPanel">
- <div class="loading-msg">Loading...</div>
- </div>
- </section>
-
- <!-- Correlation Engine -->
- <section class="panel wide" data-panel="correlation">
- <div class="panel-header">
- <span class="panel-title">Correlation Engine</span>
- <span class="panel-count" id="correlationStatus">ANALYZING</span>
- </div>
- <div class="panel-content correlation-panel" id="correlationPanel">
- <div class="correlation-sections">
- <div class="correlation-section">
- <div class="correlation-section-header">
- <span class="correlation-icon">🔮</span>
- <span class="correlation-section-title">Emerging Patterns</span>
- </div>
- <div class="correlation-content" id="emergingPatterns">
- <div class="loading-msg">Scanning for patterns...</div>
- </div>
- </div>
- <div class="correlation-section">
- <div class="correlation-section-header">
- <span class="correlation-icon">📈</span>
- <span class="correlation-section-title">Momentum Signals</span>
- </div>
- <div class="correlation-content" id="momentumSignals">
- <div class="loading-msg">Calculating momentum...</div>
- </div>
- </div>
- <div class="correlation-section">
- <div class="correlation-section-header">
- <span class="correlation-icon">🔗</span>
- <span class="correlation-section-title">Cross-Source Correlations</span>
- </div>
- <div class="correlation-content" id="crossSourceCorrelations">
- <div class="loading-msg">Correlating sources...</div>
- </div>
- </div>
- <div class="correlation-section">
- <div class="correlation-section-header">
- <span class="correlation-icon">⚡</span>
- <span class="correlation-section-title">Predictive Signals</span>
- </div>
- <div class="correlation-content" id="predictiveSignals">
- <div class="loading-msg">Generating predictions...</div>
- </div>
- </div>
- </div>
- </div>
- </section>
-
- <!-- Narrative Tracker -->
- <section class="panel wide" data-panel="narrative">
- <div class="panel-header">
- <span class="panel-title">Narrative Tracker</span>
- <span class="panel-count" id="narrativeStatus">TRACKING</span>
- </div>
- <div class="panel-content narrative-panel" id="narrativePanel">
- <div class="narrative-sections">
- <div class="narrative-section">
- <div class="narrative-section-header">
- <span class="narrative-icon">🌱</span>
- <span class="narrative-section-title">Emerging Fringe</span>
- </div>
- <div class="narrative-content" id="emergingFringe">
- <div class="loading-msg">Scanning alternative sources...</div>
- </div>
- </div>
- <div class="narrative-section">
- <div class="narrative-section-header">
- <span class="narrative-icon">🔄</span>
- <span class="narrative-section-title">Fringe → Mainstream</span>
- </div>
- <div class="narrative-content" id="fringeToMainstream">
- <div class="loading-msg">Tracking crossover narratives...</div>
- </div>
- </div>
- <div class="narrative-section">
- <div class="narrative-section-header">
- <span class="narrative-icon">👁</span>
- <span class="narrative-section-title">Narrative Watch</span>
- </div>
- <div class="narrative-content" id="narrativeWatch">
- <div class="loading-msg">Monitoring active narratives...</div>
- </div>
- </div>
- <div class="narrative-section">
- <div class="narrative-section-header">
- <span class="narrative-icon">🎭</span>
- <span class="narrative-section-title">Disinfo Signals</span>
- </div>
- <div class="narrative-content" id="disinfoSignals">
- <div class="loading-msg">Analyzing signals...</div>
- </div>
- </div>
- </div>
- </div>
- </section>
-
- <!-- My Monitors -->
- <section class="panel" data-panel="monitors">
- <div class="panel-header">
- <span class="panel-title">My Monitors</span>
- <span class="panel-count" id="monitorsCount">-</span>
- </div>
- <div class="panel-content" id="monitorsPanel">
- <div class="monitors-empty">
- No monitors configured
- <div class="monitors-empty-hint">Click Settings → Add Monitor to get started</div>
- </div>
- </div>
- </section>
-
- </main>
-
- <script>
- // Panel configuration with display names
- const PANELS = {
- map: { name: 'Global Map', priority: 1 },
- politics: { name: 'World / Geopolitical', priority: 1 },
- tech: { name: 'Technology / AI', priority: 1 },
- finance: { name: 'Financial', priority: 1 },
- gov: { name: 'Government / Policy', priority: 2 },
- heatmap: { name: 'Sector Heatmap', priority: 1 },
- markets: { name: 'Markets', priority: 1 },
- monitors: { name: 'My Monitors', priority: 1 },
- commodities: { name: 'Commodities / VIX', priority: 2 },
- polymarket: { name: 'Polymarket', priority: 2 },
- congress: { name: 'Congress Trades', priority: 3 },
- whales: { name: 'Whale Watch', priority: 3 },
- mainchar: { name: 'Main Character', priority: 2 },
- printer: { name: 'Money Printer', priority: 2 },
- contracts: { name: 'Gov Contracts', priority: 3 },
- ai: { name: 'AI Arms Race', priority: 3 },
- layoffs: { name: 'Layoffs Tracker', priority: 3 },
- venezuela: { name: 'Venezuela Situation', priority: 2 },
- greenland: { name: 'Greenland Situation', priority: 2 },
- tbpn: { name: 'TBPN Live', priority: 1 },
- intel: { name: 'Intel Feed', priority: 2 },
- correlation: { name: 'Correlation Engine', priority: 1 },
- narrative: { name: 'Narrative Tracker', priority: 1 }
- };
-
- // Load panel visibility from localStorage
- function getPanelSettings() {
- try {
- const saved = localStorage.getItem('situationMonitorPanels');
- return saved ? JSON.parse(saved) : {};
- } catch (e) {
- return {};
- }
- }
-
- // Save panel visibility to localStorage
- function savePanelSettings(settings) {
- try {
- localStorage.setItem('situationMonitorPanels', JSON.stringify(settings));
- } catch (e) {}
- }
-
- // Check if panel is enabled
- function isPanelEnabled(panelId) {
- const settings = getPanelSettings();
- return settings[panelId] !== false; // Default to enabled
- }
-
- // Toggle panel visibility
- function togglePanel(panelId) {
- const settings = getPanelSettings();
- settings[panelId] = !isPanelEnabled(panelId);
- savePanelSettings(settings);
- applyPanelSettings();
- updateSettingsUI();
- }
-
- // Apply panel settings to DOM
- function applyPanelSettings() {
- document.querySelectorAll('[data-panel]').forEach(panel => {
- const panelId = panel.dataset.panel;
- if (isPanelEnabled(panelId)) {
- panel.classList.remove('hidden');
- } else {
- panel.classList.add('hidden');
- }
- });
- }
-
- // Toggle settings modal
- function toggleSettings() {
- const modal = document.getElementById('settingsModal');
- modal.classList.toggle('open');
- if (modal.classList.contains('open')) {
- updateSettingsUI();
- renderMonitorsList();
- // Load saved livestream URL
- const savedUrl = localStorage.getItem('livestreamUrl') || 'https://www.youtube.com/watch?v=jWEZa9WEnIo';
- document.getElementById('livestreamUrl').value = savedUrl;
- }
- }
-
- // Update settings UI
- function updateSettingsUI() {
- const container = document.getElementById('panelToggles');
- container.innerHTML = Object.entries(PANELS).map(([id, config]) => {
- const enabled = isPanelEnabled(id);
- return `
- <div class="panel-toggle-item">
- <label onclick="togglePanel('${id}')">${config.name}</label>
- <div class="toggle-switch ${enabled ? 'on' : ''}" onclick="togglePanel('${id}')"></div>
- </div>
- `;
- }).join('');
- }
-
- // Extract YouTube video ID from various URL formats
- function extractYouTubeId(url) {
- if (!url) return null;
- // Handle various YouTube URL formats
- const patterns = [
- /(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/|youtube\.com\/live\/)([^&\?\/]+)/,
- /^([a-zA-Z0-9_-]{11})$/ // Direct video ID
- ];
- for (const pattern of patterns) {
- const match = url.match(pattern);
- if (match) return match[1];
- }
- return null;
- }
-
- // Save livestream URL
- function saveLivestreamUrl() {
- const input = document.getElementById('livestreamUrl');
- const url = input.value.trim();
- localStorage.setItem('livestreamUrl', url);
- updateLivestreamEmbed();
- }
-
- // Update the livestream embed
- function updateLivestreamEmbed() {
- const url = localStorage.getItem('livestreamUrl') || 'https://www.youtube.com/watch?v=jWEZa9WEnIo';
- const videoId = extractYouTubeId(url);
- const panel = document.getElementById('tbpnPanel');
- if (panel && videoId) {
- panel.innerHTML = `
- <iframe
- src="https://www.youtube.com/embed/${videoId}?autoplay=0&mute=1"
- frameborder="0"
- allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
- allowfullscreen>
- </iframe>
- `;
- } else if (panel) {
- panel.innerHTML = '<div class="loading-msg">Invalid YouTube URL</div>';
- }
- }
-
- // Get current livestream embed URL
- function getLivestreamEmbedUrl() {
- const url = localStorage.getItem('livestreamUrl') || 'https://www.youtube.com/watch?v=jWEZa9WEnIo';
- const videoId = extractYouTubeId(url);
- return videoId ? `https://www.youtube.com/embed/${videoId}?autoplay=0&mute=1` : '';
- }
-
- // Drag and Drop Panel Reordering
- let draggedPanel = null;
- const NON_DRAGGABLE_PANELS = ['map', 'tbpn']; // Map stays at top, livestream has iframe
-
- function initDragAndDrop() {
- const dashboard = document.querySelector('.dashboard');
- const panels = dashboard.querySelectorAll('.panel');
-
- panels.forEach(panel => {
- const panelId = panel.dataset.panel;
- const isDraggable = !NON_DRAGGABLE_PANELS.includes(panelId);
-
- // Make panels draggable (except map and livestream)
- panel.setAttribute('draggable', isDraggable ? 'true' : 'false');
-
- if (!isDraggable) {
- panel.style.cursor = 'default';
- panel.querySelector('.panel-header').style.cursor = 'default';
- return; // Skip drag event listeners for non-draggable panels
- }
-
- panel.addEventListener('dragstart', (e) => {
- draggedPanel = panel;
- panel.classList.add('dragging');
- e.dataTransfer.effectAllowed = 'move';
- e.dataTransfer.setData('text/plain', panel.dataset.panel);
- });
-
- panel.addEventListener('dragend', () => {
- panel.classList.remove('dragging');
- document.querySelectorAll('.panel.drag-over').forEach(p => p.classList.remove('drag-over'));
- draggedPanel = null;
- savePanelOrder();
- });
-
- panel.addEventListener('dragover', (e) => {
- e.preventDefault();
- e.dataTransfer.dropEffect = 'move';
- if (draggedPanel && draggedPanel !== panel) {
- panel.classList.add('drag-over');
- }
- });
-
- panel.addEventListener('dragleave', () => {
- panel.classList.remove('drag-over');
- });
-
- panel.addEventListener('drop', (e) => {
- e.preventDefault();
- panel.classList.remove('drag-over');
-
- if (draggedPanel && draggedPanel !== panel) {
- const dashboard = document.querySelector('.dashboard');
- const panels = [...dashboard.querySelectorAll('.panel')];
- const draggedIdx = panels.indexOf(draggedPanel);
- const targetIdx = panels.indexOf(panel);
-
- if (draggedIdx < targetIdx) {
- panel.parentNode.insertBefore(draggedPanel, panel.nextSibling);
- } else {
- panel.parentNode.insertBefore(draggedPanel, panel);
- }
- }
- });
- });
- }
-
- // Save panel order to localStorage
- function savePanelOrder() {
- const dashboard = document.querySelector('.dashboard');
- const panels = dashboard.querySelectorAll('.panel');
- const order = [...panels].map(p => p.dataset.panel);
- localStorage.setItem('panelOrder', JSON.stringify(order));
- }
-
- // Restore panel order from localStorage
- function restorePanelOrder() {
- const savedOrder = localStorage.getItem('panelOrder');
- if (!savedOrder) return;
-
- try {
- const order = JSON.parse(savedOrder);
- const dashboard = document.querySelector('.dashboard');
- const panels = [...dashboard.querySelectorAll('.panel')];
-
- // Only restore order for draggable panels
- order.forEach(panelId => {
- if (NON_DRAGGABLE_PANELS.includes(panelId)) return;
- const panel = panels.find(p => p.dataset.panel === panelId);
- if (panel) {
- dashboard.appendChild(panel);
- }
- });
- } catch (e) {
- console.error('Error restoring panel order:', e);
- }
- }
-
- // Reset panel order
- function resetPanelOrder() {
- localStorage.removeItem('panelOrder');
- location.reload();
- }
-
- // ========== MAP ZOOM FUNCTIONALITY ==========
- let mapZoom = 1;
- let mapPan = { x: 0, y: 0 };
- let isPanning = false;
- let panStart = { x: 0, y: 0 };
- const MAP_ZOOM_MIN = 1;
- const MAP_ZOOM_MAX = 4;
- const MAP_ZOOM_STEP = 0.5;
-
- function mapZoomIn() {
- if (mapZoom < MAP_ZOOM_MAX) {
- mapZoom = Math.min(MAP_ZOOM_MAX, mapZoom + MAP_ZOOM_STEP);
- applyMapTransform();
- }
- }
-
- function mapZoomOut() {
- if (mapZoom > MAP_ZOOM_MIN) {
- mapZoom = Math.max(MAP_ZOOM_MIN, mapZoom - MAP_ZOOM_STEP);
- // Reset pan if zooming back to 1x
- if (mapZoom === 1) {
- mapPan = { x: 0, y: 0 };
- }
- applyMapTransform();
- }
- }
-
- function mapZoomReset() {
- mapZoom = 1;
- mapPan = { x: 0, y: 0 };
- applyMapTransform();
- }
-
- // Switch between global and US map views
- function setMapView(mode) {
- if (mapViewMode === mode) return;
- mapViewMode = mode;
- mapZoom = 1;
- mapPan = { x: 0, y: 0 };
- // Re-render map with new view
- if (window.cachedAllNews) {
- renderGlobalMap({}, [], window.cachedAllNews);
- }
- }
-
- function applyMapTransform() {
- const wrapper = document.getElementById('mapZoomWrapper');
- const levelDisplay = document.getElementById('mapZoomLevel');
- const panHint = document.getElementById('mapPanHint');
-
- if (wrapper) {
- wrapper.style.transform = `scale(${mapZoom}) translate(${mapPan.x}px, ${mapPan.y}px)`;
- }
- if (levelDisplay) {
- levelDisplay.textContent = `${mapZoom.toFixed(1)}x`;
- }
- if (panHint) {
- panHint.classList.toggle('show', mapZoom > 1);
- }
- }
-
- // Map panning with mouse drag
- function initMapPan() {
- const container = document.getElementById('worldMapContainer');
- if (!container) return;
-
- container.addEventListener('mousedown', (e) => {
- if (mapZoom <= 1) return;
- if (e.target.closest('.map-zoom-controls')) return;
-
- isPanning = true;
- panStart = { x: e.clientX - mapPan.x * mapZoom, y: e.clientY - mapPan.y * mapZoom };
- container.style.cursor = 'grabbing';
- });
-
- document.addEventListener('mousemove', (e) => {
- if (!isPanning) return;
-
- const maxPan = (mapZoom - 1) * 200;
- mapPan.x = Math.max(-maxPan, Math.min(maxPan, (e.clientX - panStart.x) / mapZoom));
- mapPan.y = Math.max(-maxPan, Math.min(maxPan, (e.clientY - panStart.y) / mapZoom));
- applyMapTransform();
- });
-
- document.addEventListener('mouseup', () => {
- if (isPanning) {
- isPanning = false;
- const container = document.getElementById('worldMapContainer');
- if (container) container.style.cursor = '';
- }
- });
-
- // Mouse wheel zoom
- container.addEventListener('wheel', (e) => {
- e.preventDefault();
- if (e.deltaY < 0) {
- mapZoomIn();
- } else {
- mapZoomOut();
- }
- }, { passive: false });
- }
-
- // ========== PANEL RESIZE FUNCTIONALITY ==========
- let resizingPanel = null;
- let resizeStart = { x: 0, y: 0, width: 0, height: 0 };
- let resizeDirection = null;
-
- function initPanelResize() {
- // Add resize handles to all panels
- document.querySelectorAll('.panel').forEach(panel => {
- // Skip if already has handles
- if (panel.querySelector('.panel-resize-handle')) return;
-
- // Corner handle (for both width and height)
- const cornerHandle = document.createElement('div');
- cornerHandle.className = 'panel-resize-handle corner';
- cornerHandle.addEventListener('mousedown', (e) => startResize(e, panel, 'corner'));
- panel.appendChild(cornerHandle);
-
- // Bottom edge handle (height only)
- const bottomHandle = document.createElement('div');
- bottomHandle.className = 'panel-resize-handle bottom';
- bottomHandle.addEventListener('mousedown', (e) => startResize(e, panel, 'bottom'));
- panel.appendChild(bottomHandle);
-
- // Right edge handle (width only)
- const rightHandle = document.createElement('div');
- rightHandle.className = 'panel-resize-handle right';
- rightHandle.addEventListener('mousedown', (e) => startResize(e, panel, 'right'));
- panel.appendChild(rightHandle);
- });
- }
-
- function startResize(e, panel, direction) {
- e.preventDefault();
- e.stopPropagation();
-
- resizingPanel = panel;
- resizeDirection = direction;
- resizeStart = {
- x: e.clientX,
- y: e.clientY,
- width: panel.offsetWidth,
- height: panel.offsetHeight
- };
-
- panel.classList.add('resizing');
- document.body.style.cursor = direction === 'corner' ? 'nwse-resize' :
- direction === 'bottom' ? 'ns-resize' : 'ew-resize';
- }
-
- document.addEventListener('mousemove', (e) => {
- if (!resizingPanel) return;
-
- const deltaX = e.clientX - resizeStart.x;
- const deltaY = e.clientY - resizeStart.y;
-
- if (resizeDirection === 'corner' || resizeDirection === 'right') {
- const newWidth = Math.max(200, resizeStart.width + deltaX);
- resizingPanel.style.width = newWidth + 'px';
- resizingPanel.style.minWidth = newWidth + 'px';
- resizingPanel.style.maxWidth = newWidth + 'px';
- }
-
- if (resizeDirection === 'corner' || resizeDirection === 'bottom') {
- const newHeight = Math.max(150, resizeStart.height + deltaY);
- resizingPanel.style.minHeight = newHeight + 'px';
- resizingPanel.style.maxHeight = newHeight + 'px';
- }
- });
-
- document.addEventListener('mouseup', () => {
- if (resizingPanel) {
- resizingPanel.classList.remove('resizing');
- // Save panel sizes to localStorage
- savePanelSizes();
- resizingPanel = null;
- resizeDirection = null;
- document.body.style.cursor = '';
- }
- });
-
- function savePanelSizes() {
- const sizes = {};
- document.querySelectorAll('.panel').forEach(panel => {
- const panelName = panel.getAttribute('data-panel');
- if (panelName && (panel.style.minHeight || panel.style.width)) {
- sizes[panelName] = {
- height: panel.style.minHeight,
- width: panel.style.width
- };
- }
- });
- localStorage.setItem('panelSizes', JSON.stringify(sizes));
- }
-
- function restorePanelSizes() {
- const saved = localStorage.getItem('panelSizes');
- if (!saved) return;
-
- try {
- const sizes = JSON.parse(saved);
- Object.entries(sizes).forEach(([panelName, dims]) => {
- const panel = document.querySelector(`.panel[data-panel="${panelName}"]`);
- if (panel) {
- if (dims.height) {
- panel.style.minHeight = dims.height;
- panel.style.maxHeight = dims.height;
- }
- if (dims.width) {
- panel.style.width = dims.width;
- panel.style.minWidth = dims.width;
- panel.style.maxWidth = dims.width;
- }
- }
- });
- } catch (e) {
- console.error('Failed to restore panel sizes:', e);
- }
- }
-
- // Initialize panel settings and livestream on load
- document.addEventListener('DOMContentLoaded', () => {
- applyPanelSettings();
- restorePanelOrder();
- restorePanelSizes();
- updateLivestreamEmbed();
- initDragAndDrop();
- initPanelResize();
- });
-
- const CORS_PROXIES = [
- 'https://corsproxy.io/?',
- 'https://api.allorigins.win/raw?url='
- ];
-
- // Geopolitical alert keywords
- const ALERT_KEYWORDS = [
- 'war', 'invasion', 'military', 'nuclear', 'sanctions', 'missile',
- 'attack', 'troops', 'conflict', 'strike', 'bomb', 'casualties',
- 'ceasefire', 'treaty', 'nato', 'coup', 'martial law', 'emergency',
- 'assassination', 'terrorist', 'hostage', 'evacuation'
- ];
-
- // RSS Feed sources
- const FEEDS = {
- politics: [
- { name: 'BBC World', url: 'https://feeds.bbci.co.uk/news/world/rss.xml' },
- { name: 'NPR News', url: 'https://feeds.npr.org/1001/rss.xml' },
- { name: 'Guardian World', url: 'https://www.theguardian.com/world/rss' },
- { name: 'Reuters World', url: 'https://www.reutersagency.com/feed/?taxonomy=best-sectors&post_type=best' }
- ],
- tech: [
- { name: 'Hacker News', url: 'https://hnrss.org/frontpage' },
- { name: 'Ars Technica', url: 'https://feeds.arstechnica.com/arstechnica/technology-lab' },
- { name: 'The Verge', url: 'https://www.theverge.com/rss/index.xml' },
- { name: 'MIT Tech Review', url: 'https://www.technologyreview.com/feed/' },
- { name: 'ArXiv AI', url: 'https://rss.arxiv.org/rss/cs.AI' },
- { name: 'OpenAI Blog', url: 'https://openai.com/blog/rss.xml' }
- ],
- finance: [
- { name: 'CNBC', url: 'https://www.cnbc.com/id/100003114/device/rss/rss.html' },
- { name: 'MarketWatch', url: 'https://feeds.marketwatch.com/marketwatch/topstories' },
- { name: 'Yahoo Finance', url: 'https://finance.yahoo.com/news/rssindex' },
- { name: 'Reuters Business', url: 'https://www.reutersagency.com/feed/?best-topics=business-finance&post_type=best' },
- { name: 'FT', url: 'https://www.ft.com/rss/home' }
- ],
- gov: [
- { name: 'White House', url: 'https://www.whitehouse.gov/feed/' },
- { name: 'Federal Reserve', url: 'https://www.federalreserve.gov/feeds/press_all.xml' },
- { name: 'SEC Announcements', url: 'https://www.sec.gov/news/pressreleases.rss' },
- { name: 'Treasury', url: 'https://home.treasury.gov/system/files/136/treasury-rss.xml' },
- { name: 'State Dept', url: 'https://www.state.gov/rss-feed/press-releases/feed/' }
- ]
- };
-
- // Intelligence-focused news sources
- const INTEL_SOURCES = [
- // Think Tanks
- { name: 'CSIS', url: 'https://www.csis.org/analysis/feed', type: 'think-tank', topics: ['defense', 'geopolitics'] },
- { name: 'Brookings', url: 'https://www.brookings.edu/feed/', type: 'think-tank', topics: ['policy', 'geopolitics'] },
- { name: 'CFR', url: 'https://www.cfr.org/rss.xml', type: 'think-tank', topics: ['foreign-policy'] },
- // Defense/Security News
- { name: 'Defense One', url: 'https://www.defenseone.com/rss/all/', type: 'defense', topics: ['military', 'defense'] },
- { name: 'War on Rocks', url: 'https://warontherocks.com/feed/', type: 'defense', topics: ['military', 'strategy'] },
- { name: 'Breaking Defense', url: 'https://breakingdefense.com/feed/', type: 'defense', topics: ['military', 'defense'] },
- { name: 'The Drive War Zone', url: 'https://www.thedrive.com/the-war-zone/feed', type: 'defense', topics: ['military'] },
- // Regional Specialists
- { name: 'The Diplomat', url: 'https://thediplomat.com/feed/', type: 'regional', topics: ['asia-pacific'], region: 'APAC' },
- { name: 'Al-Monitor', url: 'https://www.al-monitor.com/rss', type: 'regional', topics: ['middle-east'], region: 'MENA' },
- // OSINT & Investigations
- { name: 'Bellingcat', url: 'https://www.bellingcat.com/feed/', type: 'osint', topics: ['investigation', 'osint'] },
- // Government/Official
- { name: 'DoD News', url: 'https://www.defense.gov/DesktopModules/ArticleCS/RSS.ashx?max=10&ContentType=1&Site=945', type: 'govt', topics: ['military', 'official'] },
- { name: 'State Dept', url: 'https://www.state.gov/rss-feed/press-releases/feed/', type: 'govt', topics: ['diplomacy', 'official'] },
- // Cyber/Security
- { name: 'CISA Alerts', url: 'https://www.cisa.gov/uscert/ncas/alerts.xml', type: 'cyber', topics: ['cyber', 'security'] },
- { name: 'Krebs Security', url: 'https://krebsonsecurity.com/feed/', type: 'cyber', topics: ['cyber', 'security'] }
- ];
-
- // Region detection keywords for tagging
- const REGION_KEYWORDS = {
- 'EUROPE': ['nato', 'eu', 'european', 'ukraine', 'russia', 'germany', 'france', 'uk', 'britain', 'poland'],
- 'MENA': ['iran', 'israel', 'saudi', 'syria', 'iraq', 'gaza', 'lebanon', 'yemen', 'houthi', 'middle east'],
- 'APAC': ['china', 'taiwan', 'japan', 'korea', 'indo-pacific', 'south china sea', 'asean', 'philippines'],
- 'AMERICAS': ['us', 'america', 'canada', 'mexico', 'brazil', 'venezuela', 'latin'],
- 'AFRICA': ['africa', 'sahel', 'niger', 'sudan', 'ethiopia', 'somalia']
- };
-
- // Topic detection keywords
- const TOPIC_KEYWORDS = {
- 'CYBER': ['cyber', 'hack', 'ransomware', 'malware', 'breach', 'apt', 'vulnerability'],
- 'NUCLEAR': ['nuclear', 'icbm', 'warhead', 'nonproliferation', 'uranium', 'plutonium'],
- 'CONFLICT': ['war', 'military', 'troops', 'invasion', 'strike', 'missile', 'combat', 'offensive'],
- 'INTEL': ['intelligence', 'espionage', 'spy', 'cia', 'mossad', 'fsb', 'covert'],
- 'DEFENSE': ['pentagon', 'dod', 'defense', 'military', 'army', 'navy', 'air force'],
- 'DIPLO': ['diplomat', 'embassy', 'treaty', 'sanctions', 'talks', 'summit', 'bilateral']
- };
-
- // Sector ETFs for heatmap
- const SECTORS = [
- { symbol: 'XLK', name: 'Tech' },
- { symbol: 'XLF', name: 'Finance' },
- { symbol: 'XLE', name: 'Energy' },
- { symbol: 'XLV', name: 'Health' },
- { symbol: 'XLY', name: 'Consumer' },
- { symbol: 'XLI', name: 'Industrial' },
- { symbol: 'XLP', name: 'Staples' },
- { symbol: 'XLU', name: 'Utilities' },
- { symbol: 'XLB', name: 'Materials' },
- { symbol: 'XLRE', name: 'Real Est' },
- { symbol: 'XLC', name: 'Comms' },
- { symbol: 'SMH', name: 'Semis' }
- ];
-
- // Commodities and VIX
- const COMMODITIES = [
- { symbol: '^VIX', name: 'VIX', display: 'VIX' },
- { symbol: 'GC=F', name: 'Gold', display: 'GOLD' },
- { symbol: 'CL=F', name: 'Crude Oil', display: 'OIL' },
- { symbol: 'NG=F', name: 'Natural Gas', display: 'NATGAS' },
- { symbol: 'SI=F', name: 'Silver', display: 'SILVER' },
- { symbol: 'HG=F', name: 'Copper', display: 'COPPER' }
- ];
-
- // US Major Cities for domestic view
- const US_CITIES = [
- // Capital
- {
- id: 'dc', name: 'Washington D.C.', state: 'DC', lat: 38.9072, lon: -77.0369,
- type: 'capital', population: '700K',
- keywords: ['washington', 'capitol', 'congress', 'white house', 'pentagon', 'dc', 'biden', 'trump'],
- description: 'Federal government center. White House, Capitol Hill, Pentagon, and major federal agencies.',
- sectors: ['Government', 'Defense', 'Policy']
- },
- // Major metros
- {
- id: 'nyc', name: 'New York City', state: 'NY', lat: 40.7128, lon: -74.0060,
- type: 'major', population: '8.3M',
- keywords: ['new york', 'nyc', 'manhattan', 'wall street', 'broadway', 'brooklyn'],
- description: 'Financial capital. Wall Street, major media headquarters, UN headquarters.',
- sectors: ['Finance', 'Media', 'Tech']
- },
- {
- id: 'la', name: 'Los Angeles', state: 'CA', lat: 34.0522, lon: -118.2437,
- type: 'major', population: '3.9M',
- keywords: ['los angeles', 'la', 'hollywood', 'california', 'socal'],
- description: 'Entertainment industry hub. Major port, aerospace, and tech presence.',
- sectors: ['Entertainment', 'Tech', 'Aerospace']
- },
- {
- id: 'chicago', name: 'Chicago', state: 'IL', lat: 41.8781, lon: -87.6298,
- type: 'major', population: '2.7M',
- keywords: ['chicago', 'illinois', 'midwest'],
- description: 'Midwest economic hub. Commodities trading, transportation logistics.',
- sectors: ['Finance', 'Logistics', 'Manufacturing']
- },
- {
- id: 'houston', name: 'Houston', state: 'TX', lat: 29.7604, lon: -95.3698,
- type: 'major', population: '2.3M',
- keywords: ['houston', 'texas', 'energy', 'oil', 'nasa'],
- description: 'Energy capital. Oil & gas headquarters, NASA Johnson Space Center.',
- sectors: ['Energy', 'Aerospace', 'Healthcare']
- },
- {
- id: 'sf', name: 'San Francisco', state: 'CA', lat: 37.7749, lon: -122.4194,
- type: 'major', population: '870K',
- keywords: ['san francisco', 'sf', 'bay area', 'silicon valley', 'tech'],
- description: 'Tech industry epicenter. Venture capital, startups, major tech HQs.',
- sectors: ['Tech', 'Finance', 'Biotech']
- },
- {
- id: 'seattle', name: 'Seattle', state: 'WA', lat: 47.6062, lon: -122.3321,
- type: 'major', population: '750K',
- keywords: ['seattle', 'washington', 'amazon', 'microsoft', 'boeing'],
- description: 'Pacific Northwest tech hub. Amazon, Microsoft, Boeing headquarters.',
- sectors: ['Tech', 'Aerospace', 'E-commerce']
- },
- {
- id: 'miami', name: 'Miami', state: 'FL', lat: 25.7617, lon: -80.1918,
- type: 'major', population: '450K',
- keywords: ['miami', 'florida', 'latin america', 'caribbean'],
- description: 'Gateway to Latin America. Finance, real estate, tourism hub.',
- sectors: ['Finance', 'Real Estate', 'Tourism']
- },
- {
- id: 'atlanta', name: 'Atlanta', state: 'GA', lat: 33.7490, lon: -84.3880,
- type: 'major', population: '500K',
- keywords: ['atlanta', 'georgia', 'cdc', 'delta'],
- description: 'Southeast economic center. CDC headquarters, major logistics hub.',
- sectors: ['Logistics', 'Healthcare', 'Media']
- },
- {
- id: 'boston', name: 'Boston', state: 'MA', lat: 42.3601, lon: -71.0589,
- type: 'major', population: '680K',
- keywords: ['boston', 'massachusetts', 'harvard', 'mit', 'biotech'],
- description: 'Education and biotech hub. Harvard, MIT, major hospitals.',
- sectors: ['Education', 'Biotech', 'Finance']
- },
- {
- id: 'denver', name: 'Denver', state: 'CO', lat: 39.7392, lon: -104.9903,
- type: 'regional', population: '720K',
- keywords: ['denver', 'colorado', 'aerospace'],
- description: 'Mountain West hub. Aerospace, tech growth, federal facilities.',
- sectors: ['Aerospace', 'Tech', 'Energy']
- },
- {
- id: 'phoenix', name: 'Phoenix', state: 'AZ', lat: 33.4484, lon: -112.0740,
- type: 'regional', population: '1.6M',
- keywords: ['phoenix', 'arizona', 'semiconductor', 'tsmc'],
- description: 'Fast-growing Sun Belt metro. Semiconductor manufacturing expansion.',
- sectors: ['Manufacturing', 'Tech', 'Real Estate']
- },
- {
- id: 'austin', name: 'Austin', state: 'TX', lat: 30.2672, lon: -97.7431,
- type: 'regional', population: '1M',
- keywords: ['austin', 'texas', 'tesla', 'tech'],
- description: 'Texas tech hub. Tesla, Samsung, major tech company expansions.',
- sectors: ['Tech', 'Manufacturing', 'Entertainment']
- },
- {
- id: 'detroit', name: 'Detroit', state: 'MI', lat: 42.3314, lon: -83.0458,
- type: 'regional', population: '640K',
- keywords: ['detroit', 'michigan', 'auto', 'ev', 'ford', 'gm'],
- description: 'Auto industry center. EV transition, manufacturing renaissance.',
- sectors: ['Auto', 'Manufacturing', 'Tech']
- },
- {
- id: 'vegas', name: 'Las Vegas', state: 'NV', lat: 36.1699, lon: -115.1398,
- type: 'regional', population: '650K',
- keywords: ['las vegas', 'vegas', 'nevada', 'gaming'],
- description: 'Entertainment and convention hub. Growing tech presence.',
- sectors: ['Tourism', 'Entertainment', 'Tech']
- },
- // Strategic locations
- {
- id: 'norfolk', name: 'Norfolk', state: 'VA', lat: 36.8508, lon: -76.2859,
- type: 'military', population: '245K',
- keywords: ['norfolk', 'navy', 'naval', 'fleet'],
- description: 'Largest naval base in world. Atlantic Fleet headquarters.',
- sectors: ['Military', 'Defense', 'Shipbuilding']
- },
- {
- id: 'sandiego', name: 'San Diego', state: 'CA', lat: 32.7157, lon: -117.1611,
- type: 'military', population: '1.4M',
- keywords: ['san diego', 'navy', 'pacific fleet', 'border'],
- description: 'Major military hub. Pacific Fleet, border region.',
- sectors: ['Military', 'Biotech', 'Tourism']
- }
- ];
-
- // US Breaking News Hotspots - Major ongoing stories
- const US_HOTSPOTS = [
- {
- id: 'mn-daycare-fraud',
- name: 'Minnesota Daycare Fraud',
- location: 'Minneapolis, MN',
- lat: 44.9778,
- lon: -93.2650,
- level: 'high',
- category: 'Federal Investigation',
- description: 'Massive $250M+ fraud scheme involving Feeding Our Future nonprofit. Largest pandemic-era fraud case. Multiple convictions and ongoing trials.',
- keywords: ['minnesota', 'daycare', 'fraud', 'feeding our future', 'minneapolis', 'pandemic fraud', 'child nutrition', 'somali'],
- startDate: '2022',
- status: 'Active Investigation',
- icon: '⚠'
- },
- {
- id: 'la-wildfires',
- name: 'California Wildfires',
- location: 'Los Angeles, CA',
- lat: 34.0522,
- lon: -118.2437,
- level: 'high',
- category: 'Natural Disaster',
- description: 'Ongoing wildfire emergency in Los Angeles area. Multiple fires, evacuations, and widespread destruction.',
- keywords: ['california', 'wildfire', 'los angeles', 'fire', 'evacuation', 'palisades', 'eaton', 'altadena'],
- startDate: '2025',
- status: 'Active Emergency',
- icon: '🔥'
- },
- {
- id: 'border-crisis',
- name: 'Border Enforcement',
- location: 'El Paso, TX',
- lat: 31.7619,
- lon: -106.4850,
- level: 'elevated',
- category: 'Immigration',
- description: 'Ongoing migration and border enforcement actions. Policy changes, deportations, and humanitarian concerns.',
- keywords: ['border', 'immigration', 'migrant', 'el paso', 'texas', 'cbp', 'deportation', 'ice'],
- startDate: '2024',
- status: 'Ongoing',
- icon: '🚨'
- },
- {
- id: 'ai-regulation',
- name: 'AI & Tech Policy',
- location: 'San Francisco, CA',
- lat: 37.7749,
- lon: -122.4194,
- level: 'medium',
- category: 'Technology',
- description: 'Major tech companies facing regulatory scrutiny. AI safety debates, antitrust actions, and policy formation.',
- keywords: ['openai', 'anthropic', 'google ai', 'ai regulation', 'artificial intelligence', 'tech regulation', 'deepseek'],
- startDate: '2024',
- status: 'Developing',
- icon: '🤖'
- }
- ];
-
- // Middle East hotspots
- const MIDEAST_HOTSPOTS = [
- {
- id: 'gaza-conflict',
- name: 'Gaza Conflict',
- location: 'Gaza Strip',
- lat: 31.3547,
- lon: 34.3088,
- level: 'high',
- category: 'Armed Conflict',
- description: 'Ongoing Israel-Hamas conflict. Humanitarian crisis, ceasefire negotiations, hostage situation, and military operations.',
- keywords: ['gaza', 'hamas', 'israel', 'hostage', 'ceasefire', 'rafah', 'humanitarian', 'netanyahu'],
- startDate: 'Oct 2023',
- status: 'Active Conflict',
- icon: '💥'
- },
- {
- id: 'iran-tensions',
- name: 'Iran Nuclear & Regional',
- location: 'Tehran, Iran',
- lat: 35.6892,
- lon: 51.3890,
- level: 'high',
- category: 'Geopolitical',
- description: 'Nuclear program concerns, regional proxy conflicts, sanctions, and diplomatic tensions with Western powers.',
- keywords: ['iran', 'tehran', 'nuclear', 'irgc', 'sanctions', 'khamenei', 'enrichment', 'proxy'],
- startDate: 'Ongoing',
- status: 'Elevated Tensions',
- icon: '☢'
- },
- {
- id: 'yemen-houthis',
- name: 'Yemen & Houthi Attacks',
- location: 'Sanaa, Yemen',
- lat: 15.3694,
- lon: 44.1910,
- level: 'high',
- category: 'Armed Conflict',
- description: 'Houthi attacks on Red Sea shipping, ongoing civil war, and humanitarian catastrophe. US/UK military strikes.',
- keywords: ['yemen', 'houthi', 'red sea', 'shipping', 'sanaa', 'aden', 'saudi', 'bab el-mandeb'],
- startDate: '2014',
- status: 'Active Conflict',
- icon: '⚔'
- },
- {
- id: 'syria-situation',
- name: 'Syria Post-Assad',
- location: 'Damascus, Syria',
- lat: 33.5138,
- lon: 36.2765,
- level: 'elevated',
- category: 'Political Transition',
- description: 'Post-Assad transition, HTS governance, reconstruction challenges, and regional power dynamics.',
- keywords: ['syria', 'damascus', 'hts', 'assad', 'aleppo', 'idlib', 'reconstruction', 'turkey'],
- startDate: 'Dec 2024',
- status: 'Political Transition',
- icon: '🏛'
- },
- {
- id: 'lebanon-hezbollah',
- name: 'Lebanon Crisis',
- location: 'Beirut, Lebanon',
- lat: 33.8938,
- lon: 35.5018,
- level: 'elevated',
- category: 'Political/Security',
- description: 'Hezbollah tensions, economic collapse, political vacuum, and reconstruction after Israeli operations.',
- keywords: ['lebanon', 'beirut', 'hezbollah', 'nasrallah', 'economic crisis', 'reconstruction'],
- startDate: 'Ongoing',
- status: 'Crisis',
- icon: '⚠'
- },
- {
- id: 'iraq-instability',
- name: 'Iraq Security',
- location: 'Baghdad, Iraq',
- lat: 33.3152,
- lon: 44.3661,
- level: 'medium',
- category: 'Security',
- description: 'Militia activities, US military presence, Iranian influence, and political instability.',
- keywords: ['iraq', 'baghdad', 'militia', 'iran influence', 'us troops', 'pmu'],
- startDate: 'Ongoing',
- status: 'Unstable',
- icon: '🔶'
- },
- {
- id: 'saudi-transformation',
- name: 'Saudi Vision 2030',
- location: 'Riyadh, Saudi Arabia',
- lat: 24.7136,
- lon: 46.6753,
- level: 'low',
- category: 'Economic/Diplomatic',
- description: 'Economic transformation, NEOM projects, normalization talks, and regional leadership ambitions.',
- keywords: ['saudi', 'mbs', 'vision 2030', 'neom', 'normalization', 'opec', 'aramco'],
- startDate: '2016',
- status: 'Developing',
- icon: '📈'
- }
- ];
-
- // Ukraine-Russia conflict zone hotspots
- const UKRAINE_HOTSPOTS = [
- {
- id: 'kyiv-capital',
- name: 'Kyiv Defense',
- location: 'Kyiv, Ukraine',
- lat: 50.4501,
- lon: 30.5234,
- level: 'high',
- category: 'Capital Defense',
- description: 'Ukrainian capital under intermittent missile and drone attacks. Air defense operations and infrastructure targeting.',
- keywords: ['kyiv', 'kiev', 'ukraine capital', 'air raid', 'missile strike'],
- startDate: 'Feb 2022',
- status: 'Active Defense',
- icon: '🛡'
- },
- {
- id: 'donbas-front',
- name: 'Donbas Front Line',
- location: 'Donetsk Oblast',
- lat: 48.0159,
- lon: 37.8029,
- level: 'high',
- category: 'Active Combat',
- description: 'Primary axis of Russian offensive operations. Intense fighting around Bakhmut, Avdiivka, and surrounding areas.',
- keywords: ['donbas', 'donetsk', 'bakhmut', 'avdiivka', 'luhansk', 'front line'],
- startDate: '2014',
- status: 'Active Combat Zone',
- icon: '⚔'
- },
- {
- id: 'kherson-front',
- name: 'Kherson-Zaporizhzhia',
- location: 'Southern Ukraine',
- lat: 46.6354,
- lon: 32.6169,
- level: 'high',
- category: 'Southern Front',
- description: 'Southern front including Kherson region and Zaporizhzhia nuclear plant concerns. Cross-river operations.',
- keywords: ['kherson', 'zaporizhzhia', 'dnipro river', 'nuclear plant', 'southern front'],
- startDate: 'Feb 2022',
- status: 'Active Front',
- icon: '☢'
- },
- {
- id: 'crimea-logistics',
- name: 'Crimea Operations',
- location: 'Crimean Peninsula',
- lat: 44.9521,
- lon: 34.1024,
- level: 'elevated',
- category: 'Strategic Target',
- description: 'Ukrainian strikes on Russian military logistics, Kerch Bridge, and naval assets in occupied Crimea.',
- keywords: ['crimea', 'kerch bridge', 'sevastopol', 'black sea fleet'],
- startDate: '2022',
- status: 'Strike Operations',
- icon: '🎯'
- },
- {
- id: 'kursk-incursion',
- name: 'Kursk Incursion',
- location: 'Kursk Oblast, Russia',
- lat: 51.7373,
- lon: 36.1874,
- level: 'high',
- category: 'Cross-Border Op',
- description: 'Ukrainian forces operating inside Russian territory in Kursk region. Significant territorial control.',
- keywords: ['kursk', 'russia incursion', 'cross-border', 'russian territory'],
- startDate: 'Aug 2024',
- status: 'Active Operation',
- icon: '🔥'
- },
- {
- id: 'moscow-drone',
- name: 'Moscow Drone War',
- location: 'Moscow, Russia',
- lat: 55.7558,
- lon: 37.6173,
- level: 'medium',
- category: 'Drone Attacks',
- description: 'Ukrainian drone attacks reaching Russian capital and surrounding regions. Psychological and strategic impact.',
- keywords: ['moscow', 'drone attack', 'kremlin', 'russian capital'],
- startDate: '2023',
- status: 'Ongoing Strikes',
- icon: '🚁'
- },
- {
- id: 'belarus-staging',
- name: 'Belarus Border',
- location: 'Minsk, Belarus',
- lat: 53.9045,
- lon: 27.5615,
- level: 'elevated',
- category: 'Staging Area',
- description: 'Potential staging area for Russian operations. Lukashenko regime support. Training of Russian forces.',
- keywords: ['belarus', 'minsk', 'lukashenko', 'staging', 'northern threat'],
- startDate: 'Feb 2022',
- status: 'Monitoring',
- icon: '⚠'
- },
- {
- id: 'black-sea',
- name: 'Black Sea Control',
- location: 'Black Sea',
- lat: 43.4,
- lon: 34.0,
- level: 'elevated',
- category: 'Naval Theater',
- description: 'Naval warfare, grain corridor disputes, and Russian fleet degradation from Ukrainian strikes.',
- keywords: ['black sea', 'naval', 'grain', 'odesa', 'fleet'],
- startDate: 'Feb 2022',
- status: 'Naval Operations',
- icon: '⚓'
- }
- ];
-
- // China-Taiwan strait hotspots
- const TAIWAN_HOTSPOTS = [
- {
- id: 'taiwan-strait',
- name: 'Taiwan Strait',
- location: 'Taiwan Strait',
- lat: 24.5,
- lon: 119.5,
- level: 'high',
- category: 'Flashpoint',
- description: 'Primary potential conflict zone. PLA military exercises, naval patrols, and median line crossings.',
- keywords: ['taiwan strait', 'median line', 'pla navy', 'blockade'],
- startDate: 'Ongoing',
- status: 'High Tension',
- icon: '⚡'
- },
- {
- id: 'taipei-capital',
- name: 'Taipei',
- location: 'Taipei, Taiwan',
- lat: 25.0330,
- lon: 121.5654,
- level: 'elevated',
- category: 'Capital Defense',
- description: 'Taiwan capital and government center. Air defense systems, political developments, and US relations.',
- keywords: ['taipei', 'taiwan government', 'tsai', 'lai', 'presidential'],
- startDate: 'Ongoing',
- status: 'Monitoring',
- icon: '🏛'
- },
- {
- id: 'south-china-sea',
- name: 'South China Sea',
- location: 'Spratly Islands',
- lat: 10.0,
- lon: 114.0,
- level: 'high',
- category: 'Territorial Dispute',
- description: 'Contested waters with military outposts. China, Philippines, Vietnam, Malaysia territorial claims.',
- keywords: ['south china sea', 'spratly', 'paracel', 'nine dash', 'reef', 'philippines'],
- startDate: 'Ongoing',
- status: 'Contested',
- icon: '🏝'
- },
- {
- id: 'fujian-buildup',
- name: 'Fujian Military Zone',
- location: 'Fujian Province, China',
- lat: 26.0,
- lon: 119.3,
- level: 'elevated',
- category: 'Military Buildup',
- description: 'PLA Eastern Theater Command. Amphibious assault forces, missile bases, and air assets.',
- keywords: ['fujian', 'eastern theater', 'pla', 'amphibious', 'xiamen'],
- startDate: 'Ongoing',
- status: 'Buildup',
- icon: '🎯'
- },
- {
- id: 'kinmen-matsu',
- name: 'Kinmen & Matsu',
- location: 'Kinmen Islands',
- lat: 24.4493,
- lon: 118.3767,
- level: 'elevated',
- category: 'Frontline Islands',
- description: 'Taiwan-controlled islands near China coast. Gray zone tactics, drone incursions, cable cuts.',
- keywords: ['kinmen', 'matsu', 'quemoy', 'offshore islands', 'cable cut'],
- startDate: 'Ongoing',
- status: 'Gray Zone',
- icon: '⚠'
- },
- {
- id: 'first-island-chain',
- name: 'First Island Chain',
- location: 'Okinawa, Japan',
- lat: 26.5,
- lon: 128.0,
- level: 'medium',
- category: 'Strategic Defense',
- description: 'US-Japan defense perimeter. Okinawa bases, missile deployments, AUKUS coordination.',
- keywords: ['okinawa', 'first island chain', 'kadena', 'us japan', 'aukus'],
- startDate: 'Ongoing',
- status: 'Allied Posture',
- icon: '🛡'
- },
- {
- id: 'beijing-command',
- name: 'Beijing',
- location: 'Beijing, China',
- lat: 39.9042,
- lon: 116.4074,
- level: 'medium',
- category: 'Command Center',
- description: 'CCP leadership and Central Military Commission. Policy decisions, Xi Jinping directives.',
- keywords: ['beijing', 'xi jinping', 'ccp', 'central military', 'politburo'],
- startDate: 'Ongoing',
- status: 'Command',
- icon: '🔴'
- },
- {
- id: 'philippines-disputes',
- name: 'Philippines Tensions',
- location: 'Scarborough Shoal',
- lat: 15.15,
- lon: 117.75,
- level: 'high',
- category: 'Maritime Dispute',
- description: 'China-Philippines confrontations. Coast guard clashes, water cannon incidents, BRP Sierra Madre.',
- keywords: ['scarborough', 'philippines', 'ayungin', 'sierra madre', 'coast guard', 'marcos'],
- startDate: '2023',
- status: 'Active Tensions',
- icon: '🚢'
- }
- ];
-
- // Current map view mode
- let mapViewMode = 'global'; // 'global', 'us', 'mideast', 'ukraine', or 'taiwan'
-
- // Fetch with proxy
- async function fetchWithProxy(url) {
- for (let i = 0; i < CORS_PROXIES.length; i++) {
- try {
- const proxy = CORS_PROXIES[i];
- const response = await fetch(proxy + encodeURIComponent(url), {
- headers: { 'Accept': 'application/rss+xml, application/xml, text/xml, */*' }
- });
- if (response.ok) {
- return await response.text();
- }
- } catch (e) {
- console.log(`Proxy ${i} failed, trying next...`);
- }
- }
- throw new Error('All proxies failed');
- }
-
- // Check for alert keywords
- function hasAlertKeyword(title) {
- const lower = title.toLowerCase();
- return ALERT_KEYWORDS.some(kw => lower.includes(kw));
- }
-
- // Parse RSS feed
- async function fetchFeed(source) {
- try {
- const text = await fetchWithProxy(source.url);
- const parser = new DOMParser();
- const xml = parser.parseFromString(text, 'text/xml');
-
- const parseError = xml.querySelector('parsererror');
- if (parseError) {
- console.error(`Parse error for ${source.name}`);
- return [];
- }
-
- let items = xml.querySelectorAll('item');
- if (items.length === 0) {
- items = xml.querySelectorAll('entry');
- }
-
- return Array.from(items).slice(0, 5).map(item => {
- let link = '';
- const linkEl = item.querySelector('link');
- if (linkEl) {
- link = linkEl.getAttribute('href') || linkEl.textContent || '';
- }
- link = link.trim();
-
- const title = (item.querySelector('title')?.textContent || 'No title').trim();
- const pubDate = item.querySelector('pubDate')?.textContent ||
- item.querySelector('published')?.textContent ||
- item.querySelector('updated')?.textContent || '';
-
- return {
- source: source.name,
- title,
- link,
- pubDate,
- isAlert: hasAlertKeyword(title)
- };
- });
- } catch (error) {
- console.error(`Error fetching ${source.name}:`, error);
- return [];
- }
- }
-
- // Fetch all feeds for a category
- async function fetchCategory(feeds) {
- const results = await Promise.all(feeds.map(fetchFeed));
- const items = results.flat();
-
- items.sort((a, b) => {
- // Alerts first, then by date
- if (a.isAlert && !b.isAlert) return -1;
- if (!a.isAlert && b.isAlert) return 1;
- const dateA = new Date(a.pubDate);
- const dateB = new Date(b.pubDate);
- return dateB - dateA;
- });
-
- return items.slice(0, 20);
- }
-
- // Fetch stock quote
- async function fetchQuote(symbol) {
- try {
- const text = await fetchWithProxy(`https://query1.finance.yahoo.com/v8/finance/chart/${symbol}`);
- const data = JSON.parse(text);
- if (data.chart?.result?.[0]) {
- const meta = data.chart.result[0].meta;
- const change = ((meta.regularMarketPrice - meta.previousClose) / meta.previousClose) * 100;
- return { price: meta.regularMarketPrice, change };
- }
- } catch (error) {
- console.error(`Error fetching ${symbol}:`, error);
- }
- return null;
- }
-
- // Fetch market data
- async function fetchMarkets() {
- const markets = [];
-
- const symbols = [
- { symbol: '^GSPC', name: 'S&P 500', display: 'SPX' },
- { symbol: '^DJI', name: 'Dow Jones', display: 'DJI' },
- { symbol: '^IXIC', name: 'NASDAQ', display: 'NDX' },
- { symbol: 'AAPL', name: 'Apple', display: 'AAPL' },
- { symbol: 'MSFT', name: 'Microsoft', display: 'MSFT' },
- { symbol: 'NVDA', name: 'NVIDIA', display: 'NVDA' },
- { symbol: 'GOOGL', name: 'Alphabet', display: 'GOOGL' },
- { symbol: 'AMZN', name: 'Amazon', display: 'AMZN' },
- { symbol: 'META', name: 'Meta', display: 'META' },
- { symbol: 'BRK-B', name: 'Berkshire', display: 'BRK.B' },
- { symbol: 'TSM', name: 'TSMC', display: 'TSM' },
- { symbol: 'LLY', name: 'Eli Lilly', display: 'LLY' },
- { symbol: 'TSLA', name: 'Tesla', display: 'TSLA' },
- { symbol: 'AVGO', name: 'Broadcom', display: 'AVGO' },
- { symbol: 'WMT', name: 'Walmart', display: 'WMT' },
- { symbol: 'JPM', name: 'JPMorgan', display: 'JPM' },
- { symbol: 'V', name: 'Visa', display: 'V' },
- { symbol: 'UNH', name: 'UnitedHealth', display: 'UNH' },
- { symbol: 'NVO', name: 'Novo Nordisk', display: 'NVO' },
- { symbol: 'XOM', name: 'Exxon', display: 'XOM' },
- { symbol: 'MA', name: 'Mastercard', display: 'MA' },
- { symbol: 'ORCL', name: 'Oracle', display: 'ORCL' },
- { symbol: 'PG', name: 'P&G', display: 'PG' },
- { symbol: 'COST', name: 'Costco', display: 'COST' },
- { symbol: 'JNJ', name: 'J&J', display: 'JNJ' },
- { symbol: 'HD', name: 'Home Depot', display: 'HD' },
- { symbol: 'NFLX', name: 'Netflix', display: 'NFLX' },
- { symbol: 'BAC', name: 'BofA', display: 'BAC' }
- ];
-
- const fetchStock = async (s) => {
- const quote = await fetchQuote(s.symbol);
- if (quote) {
- return { name: s.name, symbol: s.display, price: quote.price, change: quote.change };
- }
- return null;
- };
-
- const stockResults = await Promise.all(symbols.map(fetchStock));
- stockResults.forEach(r => { if (r) markets.push(r); });
-
- // Crypto
- try {
- const cryptoResponse = await fetch('https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum,solana&vs_currencies=usd&include_24hr_change=true');
- const crypto = await cryptoResponse.json();
-
- if (crypto.bitcoin) markets.push({ name: 'Bitcoin', symbol: 'BTC', price: crypto.bitcoin.usd, change: crypto.bitcoin.usd_24h_change });
- if (crypto.ethereum) markets.push({ name: 'Ethereum', symbol: 'ETH', price: crypto.ethereum.usd, change: crypto.ethereum.usd_24h_change });
- if (crypto.solana) markets.push({ name: 'Solana', symbol: 'SOL', price: crypto.solana.usd, change: crypto.solana.usd_24h_change });
- } catch (error) {
- console.error('Error fetching crypto:', error);
- }
-
- return markets;
- }
-
- // Fetch sector heatmap data
- async function fetchSectors() {
- const results = await Promise.all(SECTORS.map(async (s) => {
- const quote = await fetchQuote(s.symbol);
- if (quote) {
- return { name: s.name, symbol: s.symbol, change: quote.change };
- }
- return { name: s.name, symbol: s.symbol, change: 0 };
- }));
- return results;
- }
-
- // Fetch commodities and VIX
- async function fetchCommodities() {
- const results = [];
- for (const c of COMMODITIES) {
- const quote = await fetchQuote(c.symbol);
- if (quote) {
- results.push({ name: c.name, symbol: c.display, price: quote.price, change: quote.change });
- }
- }
- return results;
- }
-
- // Intelligence hotspots with coordinates (x%, y% on map)
- const INTEL_HOTSPOTS = [
- {
- id: 'dc', name: 'DC', subtext: 'Pentagon Pizza Index', lat: 38.9, lon: -77.0,
- keywords: ['pentagon', 'white house', 'washington', 'us military', 'cia', 'nsa', 'biden', 'trump'],
- description: 'US national security hub. Pentagon, CIA, NSA, State Dept. Monitor for late-night activity spikes.',
- agencies: ['Pentagon', 'CIA', 'NSA', 'State Dept'],
- status: 'Active monitoring'
- },
- {
- id: 'moscow', name: 'Moscow', subtext: 'Kremlin Activity', lat: 55.75, lon: 37.6,
- keywords: ['russia', 'putin', 'kremlin', 'moscow', 'russian'],
- description: 'Russian political and military command center. FSB, GRU, Presidential Administration.',
- agencies: ['FSB', 'GRU', 'SVR', 'Kremlin'],
- status: 'High activity'
- },
- {
- id: 'beijing', name: 'Beijing', subtext: 'PLA/MSS Activity', lat: 39.9, lon: 116.4,
- keywords: ['china', 'beijing', 'chinese', 'xi jinping', 'taiwan strait', 'pla'],
- description: 'Chinese Communist Party headquarters. PLA command, MSS intelligence operations.',
- agencies: ['PLA', 'MSS', 'CCP Politburo'],
- status: 'Elevated posture'
- },
- {
- id: 'kyiv', name: 'Kyiv', subtext: 'Conflict Zone', lat: 50.45, lon: 30.5,
- keywords: ['ukraine', 'kyiv', 'zelensky', 'ukrainian', 'donbas', 'crimea'],
- description: 'Ukrainian capital under wartime conditions. Government, military coordination center.',
- agencies: ['SBU', 'GUR', 'Armed Forces'],
- status: 'Active conflict'
- },
- {
- id: 'taipei', name: 'Taipei', subtext: 'Strait Watch', lat: 25.03, lon: 121.5,
- keywords: ['taiwan', 'taipei', 'taiwanese', 'strait'],
- description: 'Taiwan government and military HQ. ADIZ violations and PLA exercises tracked.',
- agencies: ['NSB', 'MND', 'AIT'],
- status: 'Heightened alert'
- },
- {
- id: 'tehran', name: 'Tehran', subtext: 'IRGC Activity', lat: 35.7, lon: 51.4,
- keywords: ['iran', 'tehran', 'iranian', 'irgc', 'hezbollah', 'nuclear'],
- description: 'Iranian regime center. IRGC Quds Force, nuclear program oversight, proxy coordination.',
- agencies: ['IRGC', 'MOIS', 'AEOI'],
- status: 'Proxy operations active'
- },
- {
- id: 'jerusalem', name: 'Tel Aviv', subtext: 'Mossad/IDF', lat: 32.07, lon: 34.78,
- keywords: ['israel', 'israeli', 'gaza', 'hamas', 'idf', 'netanyahu', 'mossad'],
- description: 'Israeli security apparatus. IDF operations, Mossad intel, Shin Bet domestic security.',
- agencies: ['Mossad', 'IDF', 'Shin Bet', 'Aman'],
- status: 'Active operations'
- },
- {
- id: 'pyongyang', name: 'Pyongyang', subtext: 'DPRK Watch', lat: 39.03, lon: 125.75,
- keywords: ['north korea', 'kim jong', 'pyongyang', 'dprk', 'korean missile'],
- description: 'North Korean leadership compound. Nuclear/missile program, regime stability indicators.',
- agencies: ['RGB', 'KPA', 'SSD'],
- status: 'Missile tests ongoing'
- },
- {
- id: 'london', name: 'London', subtext: 'GCHQ/MI6', lat: 51.5, lon: -0.12,
- keywords: ['uk', 'britain', 'british', 'mi6', 'gchq', 'london'],
- description: 'UK intelligence community hub. Five Eyes partner, SIGINT, foreign intelligence.',
- agencies: ['MI6', 'GCHQ', 'MI5'],
- status: 'Normal operations'
- },
- {
- id: 'brussels', name: 'Brussels', subtext: 'NATO HQ', lat: 50.85, lon: 4.35,
- keywords: ['nato', 'eu', 'european union', 'brussels'],
- description: 'NATO headquarters and EU institutions. Alliance coordination, Article 5 readiness.',
- agencies: ['NATO', 'EU Commission', 'EEAS'],
- status: 'Enhanced readiness'
- },
- {
- id: 'caracas', name: 'Caracas', subtext: 'Venezuela Crisis', lat: 10.5, lon: -66.9,
- keywords: ['venezuela', 'maduro', 'caracas', 'guaido', 'venezuelan', 'pdvsa'],
- description: 'Venezuelan political crisis center. Maduro regime, opposition movements, oil politics.',
- agencies: ['SEBIN', 'DGCIM', 'GNB'],
- status: 'Political instability'
- },
- {
- id: 'greenland', name: 'Nuuk', subtext: 'Arctic Dispute', lat: 64.18, lon: -51.7,
- keywords: ['greenland', 'denmark', 'arctic', 'nuuk', 'thule', 'rare earth'],
- description: 'Arctic strategic territory. US military presence, rare earth minerals, sovereignty questions.',
- agencies: ['Danish Defence', 'US Space Force', 'Arctic Council'],
- status: 'Diplomatic tensions'
- }
- ];
-
- // Shipping chokepoints for supply chain monitoring
- const SHIPPING_CHOKEPOINTS = [
- {
- id: 'suez',
- name: 'Suez Canal',
- lat: 30.0,
- lon: 32.5,
- keywords: ['suez', 'red sea', 'houthi', 'canal'],
- desc: 'Critical waterway connecting Mediterranean to Red Sea. ~12% of global trade. Currently threatened by Houthi attacks.',
- traffic: '~50 ships/day',
- region: 'Egypt'
- },
- {
- id: 'panama',
- name: 'Panama Canal',
- lat: 9.1,
- lon: -79.7,
- keywords: ['panama canal', 'panama'],
- desc: 'Links Atlantic and Pacific oceans. ~5% of global trade. Facing drought-related capacity restrictions.',
- traffic: '~40 ships/day',
- region: 'Panama'
- },
- {
- id: 'hormuz',
- name: 'Strait of Hormuz',
- lat: 26.5,
- lon: 56.3,
- keywords: ['hormuz', 'strait of hormuz', 'persian gulf'],
- desc: 'Only sea route from Persian Gulf to open ocean. ~21% of global oil passes through daily.',
- traffic: '~20 tankers/day',
- region: 'Iran/Oman'
- },
- {
- id: 'malacca',
- name: 'Malacca Strait',
- lat: 2.5,
- lon: 101.5,
- keywords: ['malacca', 'singapore strait'],
- desc: 'Main shipping route between Indian and Pacific oceans. ~25% of global trade including ~25% of oil.',
- traffic: '~80 ships/day',
- region: 'Malaysia/Singapore'
- },
- {
- id: 'bosphorus',
- name: 'Bosphorus Strait',
- lat: 41.1,
- lon: 29.0,
- keywords: ['bosphorus', 'black sea', 'turkish strait'],
- desc: 'Only route between Black Sea and Mediterranean. Critical for Russian/Ukrainian grain exports.',
- traffic: '~45 ships/day',
- region: 'Turkey'
- }
- ];
-
- // Cyber threat regions
- const CYBER_REGIONS = [
- {
- id: 'cyber_russia',
- name: 'RU',
- fullName: 'Russia',
- lat: 55.75,
- lon: 45.0,
- group: 'APT28/29',
- aka: 'Fancy Bear / Cozy Bear',
- sponsor: 'GRU / FSB',
- desc: 'State-sponsored groups linked to Russian intelligence. Known for election interference, government espionage, and critical infrastructure attacks.',
- targets: ['Government', 'Defense', 'Energy', 'Elections', 'Media']
- },
- {
- id: 'cyber_china',
- name: 'CN',
- fullName: 'China',
- lat: 35.0,
- lon: 105.0,
- group: 'APT41',
- aka: 'Double Dragon / Winnti',
- sponsor: 'MSS',
- desc: 'Hybrid espionage and financially motivated group. Conducts state-sponsored intelligence and supply chain attacks.',
- targets: ['Tech', 'Telecom', 'Healthcare', 'Gaming', 'Supply Chain']
- },
- {
- id: 'cyber_nk',
- name: 'NK',
- fullName: 'North Korea',
- lat: 39.0,
- lon: 127.0,
- group: 'Lazarus',
- aka: 'Hidden Cobra / APT38',
- sponsor: 'RGB',
- desc: 'Financially motivated attacks to fund regime. Known for cryptocurrency theft, SWIFT banking attacks, and ransomware.',
- targets: ['Crypto', 'Banks', 'Defense', 'Media', 'Critical Infra']
- },
- {
- id: 'cyber_iran',
- name: 'IR',
- fullName: 'Iran',
- lat: 32.0,
- lon: 53.0,
- group: 'APT33/35',
- aka: 'Charming Kitten / Elfin',
- sponsor: 'IRGC',
- desc: 'Focus on regional adversaries and dissidents. Known for destructive wiper malware and spear-phishing campaigns.',
- targets: ['Energy', 'Aviation', 'Government', 'Dissidents', 'Israel']
- }
- ];
-
- // Active conflict zones with approximate boundaries
- const CONFLICT_ZONES = [
- {
- id: 'ukraine',
- name: 'Ukraine Conflict',
- intensity: 'high',
- coords: [
- [37.5, 47.0], [38.5, 47.5], [39.0, 48.5], [38.0, 49.5],
- [37.0, 49.0], [36.0, 48.5], [35.5, 47.5], [36.5, 47.0]
- ],
- labelPos: { lat: 48.0, lon: 37.5 },
- startDate: 'Feb 24, 2022',
- parties: ['Russia', 'Ukraine', 'NATO (support)'],
- casualties: '500,000+ (est.)',
- displaced: '6.5M+ refugees',
- description: 'Full-scale Russian invasion of Ukraine. Active frontlines in Donetsk, Luhansk, Zaporizhzhia, and Kherson oblasts. Heavy artillery, drone warfare, and trench combat.',
- keyEvents: [
- 'Battle of Bakhmut',
- 'Kursk incursion',
- 'Black Sea drone strikes',
- 'Infrastructure attacks'
- ],
- keywords: ['ukraine', 'russia', 'zelensky', 'putin', 'donbas', 'crimea', 'bakhmut', 'kursk']
- },
- {
- id: 'gaza',
- name: 'Gaza Conflict',
- intensity: 'high',
- coords: [
- [34.2, 31.6], [34.6, 31.6], [34.6, 31.2], [34.2, 31.2]
- ],
- labelPos: { lat: 31.4, lon: 34.4 },
- startDate: 'Oct 7, 2023',
- parties: ['Israel (IDF)', 'Hamas', 'Palestinian Islamic Jihad'],
- casualties: '45,000+ (Gaza), 1,200+ (Israel)',
- displaced: '2M+ internally displaced',
- description: 'Israeli military operation in Gaza following Oct 7 Hamas attacks. Urban warfare, humanitarian crisis, regional escalation with Hezbollah and Houthis.',
- keyEvents: [
- 'Oct 7 attacks',
- 'Ground invasion',
- 'Rafah operation',
- 'Hostage negotiations'
- ],
- keywords: ['gaza', 'israel', 'hamas', 'idf', 'netanyahu', 'hostage', 'rafah', 'hezbollah']
- },
- {
- id: 'sudan',
- name: 'Sudan Civil War',
- intensity: 'medium',
- coords: [
- [32.0, 16.0], [34.0, 16.5], [35.0, 15.0], [33.5, 13.5],
- [31.5, 14.0], [31.0, 15.5]
- ],
- labelPos: { lat: 15.0, lon: 32.5 },
- startDate: 'Apr 15, 2023',
- parties: ['Sudanese Armed Forces (SAF)', 'Rapid Support Forces (RSF)'],
- casualties: '15,000+ killed',
- displaced: '10M+ displaced',
- description: 'Power struggle between SAF and RSF paramilitary. Fighting centered around Khartoum, Darfur. Major humanitarian catastrophe with famine conditions.',
- keyEvents: [
- 'Khartoum battle',
- 'Darfur massacres',
- 'El Fasher siege',
- 'Famine declared'
- ],
- keywords: ['sudan', 'khartoum', 'rsf', 'darfur', 'burhan', 'hemedti']
- },
- {
- id: 'myanmar',
- name: 'Myanmar Civil War',
- intensity: 'medium',
- coords: [
- [96.0, 22.0], [98.0, 23.0], [98.5, 21.0], [97.0, 19.5], [95.5, 20.5]
- ],
- labelPos: { lat: 21.0, lon: 96.5 },
- startDate: 'Feb 1, 2021',
- parties: ['Military Junta (SAC)', 'Ethnic Armed Organizations', 'People\'s Defense Forces'],
- casualties: '50,000+ (est.)',
- displaced: '3M+ internally displaced',
- description: 'Armed resistance following 2021 military coup. Multiple ethnic armies and pro-democracy forces fighting junta. Recent rebel advances in border regions.',
- keyEvents: [
- 'Operation 1027',
- 'Lashio capture',
- 'Myawaddy offensive',
- 'Junta conscription'
- ],
- keywords: ['myanmar', 'burma', 'junta', 'arakan', 'karen', 'kachin']
- },
- {
- id: 'taiwan_strait',
- name: 'Taiwan Strait',
- intensity: 'watch',
- coords: [
- [119.0, 26.0], [121.5, 26.0], [121.5, 22.5], [119.0, 22.5]
- ],
- labelPos: { lat: 24.5, lon: 120.0 },
- startDate: 'Ongoing tensions',
- parties: ['China (PLA)', 'Taiwan (ROC)', 'United States (deterrence)'],
- casualties: 'N/A - no active combat',
- displaced: 'N/A',
- description: 'Heightened tensions over Taiwan sovereignty. Regular PLA exercises, airspace incursions, naval activity. Risk of flashpoint escalation.',
- keyEvents: [
- 'PLA exercises',
- 'ADIZ incursions',
- 'US arms sales',
- 'Diplomatic tensions'
- ],
- keywords: ['taiwan', 'china', 'strait', 'pla', 'tsai', 'invasion']
- }
- ];
-
- // Military bases around the world
- const MILITARY_BASES = [
- // US/NATO Major Bases
- { id: 'ramstein', name: 'Ramstein AB', lat: 49.44, lon: 7.6, type: 'us-nato' },
- { id: 'diego_garcia', name: 'Diego Garcia', lat: -7.32, lon: 72.42, type: 'us-nato' },
- { id: 'guam', name: 'Andersen AFB', lat: 13.58, lon: 144.92, type: 'us-nato' },
- { id: 'okinawa', name: 'Kadena AB', lat: 26.35, lon: 127.77, type: 'us-nato' },
- { id: 'yokosuka', name: 'Yokosuka', lat: 35.28, lon: 139.67, type: 'us-nato' },
- { id: 'bahrain', name: 'NSA Bahrain', lat: 26.23, lon: 50.65, type: 'us-nato' },
- { id: 'qatar', name: 'Al Udeid', lat: 25.12, lon: 51.31, type: 'us-nato' },
- { id: 'djibouti', name: 'Camp Lemonnier', lat: 11.55, lon: 43.15, type: 'us-nato' },
- { id: 'incirlik', name: 'Incirlik AB', lat: 37.0, lon: 35.43, type: 'us-nato' },
- { id: 'rota', name: 'NS Rota', lat: 36.62, lon: -6.35, type: 'us-nato' },
- // Chinese Bases
- { id: 'djibouti_cn', name: 'PLA Djibouti', lat: 11.59, lon: 43.05, type: 'china' },
- { id: 'woody_island', name: 'Woody Island', lat: 16.83, lon: 112.33, type: 'china' },
- { id: 'fiery_cross', name: 'Fiery Cross', lat: 9.55, lon: 112.89, type: 'china' },
- { id: 'mischief_reef', name: 'Mischief Reef', lat: 9.90, lon: 115.53, type: 'china' },
- { id: 'ream', name: 'Ream (Cambodia)', lat: 10.52, lon: 103.63, type: 'china' },
- // Russian Bases
- { id: 'kaliningrad', name: 'Kaliningrad', lat: 54.71, lon: 20.51, type: 'russia' },
- { id: 'sevastopol', name: 'Sevastopol', lat: 44.62, lon: 33.53, type: 'russia' },
- { id: 'tartus', name: 'Tartus (Syria)', lat: 34.89, lon: 35.87, type: 'russia' },
- { id: 'hmeimim', name: 'Hmeimim AB', lat: 35.41, lon: 35.95, type: 'russia' },
- { id: 'cam_ranh', name: 'Cam Ranh', lat: 11.99, lon: 109.22, type: 'russia' }
- ];
-
- // Nuclear facilities (power plants, enrichment, weapons sites)
- const NUCLEAR_FACILITIES = [
- // Major Power Plants
- { id: 'zaporizhzhia', name: 'Zaporizhzhia NPP', lat: 47.51, lon: 34.58, type: 'plant', status: 'contested' },
- { id: 'fukushima', name: 'Fukushima', lat: 37.42, lon: 141.03, type: 'plant', status: 'decommissioning' },
- { id: 'flamanville', name: 'Flamanville', lat: 49.54, lon: -1.88, type: 'plant', status: 'active' },
- { id: 'bruce', name: 'Bruce Power', lat: 44.33, lon: -81.60, type: 'plant', status: 'active' },
- // Enrichment/Weapons Facilities
- { id: 'natanz', name: 'Natanz', lat: 33.72, lon: 51.73, type: 'enrichment', status: 'active' },
- { id: 'fordow', name: 'Fordow', lat: 34.88, lon: 51.0, type: 'enrichment', status: 'active' },
- { id: 'yongbyon', name: 'Yongbyon', lat: 39.80, lon: 125.75, type: 'weapons', status: 'active' },
- { id: 'dimona', name: 'Dimona', lat: 31.0, lon: 35.15, type: 'weapons', status: 'active' },
- { id: 'los_alamos', name: 'Los Alamos', lat: 35.88, lon: -106.30, type: 'weapons', status: 'active' },
- { id: 'sellafield', name: 'Sellafield', lat: 54.42, lon: -3.50, type: 'reprocessing', status: 'active' },
- { id: 'la_hague', name: 'La Hague', lat: 49.68, lon: -1.88, type: 'reprocessing', status: 'active' }
- ];
-
- // Major undersea cable routes (simplified waypoints)
- const UNDERSEA_CABLES = [
- {
- id: 'transatlantic_1',
- name: 'Transatlantic (TAT-14)',
- major: true,
- points: [[-74.0, 40.7], [-30.0, 45.0], [-9.0, 52.0]]
- },
- {
- id: 'transpacific_1',
- name: 'Transpacific (Unity)',
- major: true,
- points: [[-122.4, 37.8], [-155.0, 25.0], [139.7, 35.7]]
- },
- {
- id: 'sea_me_we_5',
- name: 'SEA-ME-WE 5',
- major: true,
- points: [[103.8, 1.3], [80.0, 10.0], [55.0, 25.0], [35.0, 30.0], [12.0, 37.0], [-5.0, 36.0]]
- },
- {
- id: 'aae1',
- name: 'Asia-Africa-Europe 1',
- major: true,
- points: [[121.0, 25.0], [103.8, 1.3], [73.0, 15.0], [44.0, 12.0], [35.0, 30.0], [28.0, 41.0]]
- },
- {
- id: 'curie',
- name: 'Curie (Google)',
- major: false,
- points: [[-122.4, 37.8], [-80.0, 0.0], [-70.0, -33.0]]
- },
- {
- id: 'marea',
- name: 'MAREA (Microsoft)',
- major: true,
- points: [[-73.8, 39.4], [-9.0, 37.0]]
- }
- ];
-
- // Countries under sanctions (ISO 3166-1 numeric codes used by Natural Earth)
- const SANCTIONED_COUNTRIES = {
- // Severe sanctions (comprehensive)
- 408: 'severe', // North Korea
- 728: 'severe', // South Sudan
- 729: 'severe', // Sudan
- 760: 'severe', // Syria
- // High sanctions
- 364: 'high', // Iran
- 643: 'high', // Russia
- 112: 'high', // Belarus
- // Moderate sanctions
- 862: 'moderate', // Venezuela
- 104: 'moderate', // Myanmar
- 178: 'moderate', // Congo
- // Low/targeted sanctions
- 152: 'low', // Cuba (being modified)
- 716: 'low', // Zimbabwe
- };
-
- // Regions for news density calculation
- const NEWS_REGIONS = [
- { id: 'us', name: 'United States', lat: 39.0, lon: -98.0, radius: 60, keywords: ['us', 'america', 'washington', 'trump', 'biden', 'congress'] },
- { id: 'europe', name: 'Europe', lat: 50.0, lon: 10.0, radius: 55, keywords: ['europe', 'eu', 'european', 'nato', 'brussels'] },
- { id: 'russia', name: 'Russia', lat: 60.0, lon: 90.0, radius: 50, keywords: ['russia', 'russian', 'putin', 'moscow', 'kremlin'] },
- { id: 'china', name: 'China', lat: 35.0, lon: 105.0, radius: 55, keywords: ['china', 'chinese', 'beijing', 'xi'] },
- { id: 'middle_east', name: 'Middle East', lat: 30.0, lon: 45.0, radius: 50, keywords: ['israel', 'iran', 'saudi', 'gaza', 'syria', 'iraq', 'yemen'] },
- { id: 'east_asia', name: 'East Asia', lat: 35.0, lon: 130.0, radius: 45, keywords: ['japan', 'korea', 'taiwan', 'kim jong'] },
- { id: 'south_asia', name: 'South Asia', lat: 22.0, lon: 78.0, radius: 45, keywords: ['india', 'pakistan', 'modi'] },
- { id: 'africa', name: 'Africa', lat: 5.0, lon: 20.0, radius: 55, keywords: ['africa', 'african', 'sudan', 'nigeria', 'ethiopia'] },
- { id: 'latam', name: 'Latin America', lat: -15.0, lon: -60.0, radius: 50, keywords: ['brazil', 'mexico', 'venezuela', 'argentina'] }
- ];
-
- // Map layer visibility state
- let mapLayers = {
- conflicts: true,
- bases: true,
- nuclear: true,
- cables: true,
- sanctions: true,
- density: true,
- flights: false, // Off by default - requires API call
- satellite: false // Satellite imagery layer
- };
-
- // Flight data cache
- let flightDataCache = null;
- let flightDataTimestamp = 0;
- const FLIGHT_CACHE_DURATION = 30000; // 30 seconds
-
- // Satellite tile configuration
- const SATELLITE_CONFIG = {
- // NASA GIBS WMTS - VIIRS Corrected Reflectance (True Color)
- nasa: {
- url: 'https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/VIIRS_SNPP_CorrectedReflectance_TrueColor/default/{date}/250m/{z}/{y}/{x}.jpg',
- attribution: 'NASA GIBS',
- maxZoom: 8
- },
- // ESRI World Imagery (fallback)
- esri: {
- url: 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
- attribution: 'ESRI',
- maxZoom: 18
- }
- };
-
- // Convert lat/lon to map position (simple equirectangular projection)
- function latLonToXY(lat, lon, width, height) {
- const x = ((lon + 180) / 360) * width;
- const y = ((90 - lat) / 180) * height;
- return { x, y };
- }
-
- // Analyze news for hotspot activity
- function analyzeHotspotActivity(allNews) {
- const results = {};
-
- INTEL_HOTSPOTS.forEach(spot => {
- let score = 0;
- let matchedHeadlines = [];
-
- allNews.forEach(item => {
- const title = item.title.toLowerCase();
- const matchedKeywords = spot.keywords.filter(kw => title.includes(kw));
- if (matchedKeywords.length > 0) {
- score += matchedKeywords.length;
- if (item.isAlert) score += 3; // Boost for alert keywords
- // Store full headline object with link and source
- matchedHeadlines.push({
- title: item.title,
- link: item.link,
- source: item.source,
- isAlert: item.isAlert
- });
- }
- });
-
- let level = 'low';
- if (score >= 8) level = 'high';
- else if (score >= 3) level = 'elevated';
-
- results[spot.id] = { level, score, headlines: matchedHeadlines.slice(0, 5) };
- });
-
- return results;
- }
-
- // World map data cache
- let worldMapData = null;
- let usStatesData = null;
-
- // Load world map TopoJSON data
- async function loadWorldMap() {
- if (worldMapData) return worldMapData;
- try {
- const response = await fetch('https://cdn.jsdelivr.net/npm/world-atlas@2/countries-110m.json');
- worldMapData = await response.json();
- return worldMapData;
- } catch (e) {
- console.error('Failed to load world map:', e);
- return null;
- }
- }
-
- // Load US states TopoJSON data
- async function loadUSStates() {
- if (usStatesData) return usStatesData;
- try {
- const response = await fetch('https://cdn.jsdelivr.net/npm/us-atlas@3/states-10m.json');
- usStatesData = await response.json();
- return usStatesData;
- } catch (e) {
- console.error('Failed to load US states:', e);
- return null;
- }
- }
-
- // Render the global map - Situation Room Style with accurate borders
- async function renderGlobalMap(activityData, earthquakes = [], allNews = []) {
- // Cache allNews for popup access
- window.cachedAllNews = allNews;
-
- const panel = document.getElementById('mapPanel');
- const timestamp = new Date().toISOString().replace('T', ' ').substring(0, 19) + ' UTC';
-
- // Set up the container
- const isUSView = mapViewMode === 'us';
- const isMidEastView = mapViewMode === 'mideast';
- const isUkraineView = mapViewMode === 'ukraine';
- const isTaiwanView = mapViewMode === 'taiwan';
- const isRegionalView = isUSView || isMidEastView || isUkraineView || isTaiwanView;
-
- let mapTitle, mapLegend;
- if (isUSView) {
- mapTitle = 'US DOMESTIC MONITOR';
- mapLegend = '★ CAPITAL | ● MAJOR | ○ REGIONAL';
- } else if (isMidEastView) {
- mapTitle = 'MIDDLE EAST MONITOR';
- mapLegend = '💥 CONFLICT | ☢ NUCLEAR | ⚠ CRISIS';
- } else if (isUkraineView) {
- mapTitle = 'UKRAINE-RUSSIA THEATER';
- mapLegend = '⚔ FRONT | 🛡 DEFENSE | 🎯 STRIKE';
- } else if (isTaiwanView) {
- mapTitle = 'CHINA-TAIWAN THEATER';
- mapLegend = '⚡ FLASHPOINT | 🏝 DISPUTED | 🛡 DEFENSE';
- } else {
- mapTitle = 'GLOBAL ACTIVITY MONITOR';
- mapLegend = '⚓ SHIP | ☢ NUKES | ▪ BASES | ═ CABLES';
- }
-
- panel.innerHTML = `
- <div class="world-map" id="worldMapContainer">
- <div class="map-zoom-wrapper" id="mapZoomWrapper">
- <canvas id="satelliteCanvas" class="satellite-canvas"></canvas>
- <div class="satellite-loading" id="satelliteLoading">Loading satellite imagery...</div>
- <div class="satellite-attribution" id="satelliteAttribution">Imagery: ESRI World Imagery</div>
- <svg id="worldMapSVG"></svg>
- <div class="map-overlays" id="mapOverlays"></div>
- </div>
- <div class="map-view-toggle">
- <button class="map-view-btn ${mapViewMode === 'global' ? 'active' : ''}" onclick="setMapView('global')">GLOBAL</button>
- <button class="map-view-btn ${isUSView ? 'active' : ''}" onclick="setMapView('us')">US</button>
- <button class="map-view-btn ${isMidEastView ? 'active' : ''}" onclick="setMapView('mideast')">MIDEAST</button>
- <button class="map-view-btn ${isUkraineView ? 'active' : ''}" onclick="setMapView('ukraine')">UKRAINE</button>
- <button class="map-view-btn ${isTaiwanView ? 'active' : ''}" onclick="setMapView('taiwan')">TAIWAN</button>
- </div>
- <div class="map-zoom-controls">
- <button class="map-zoom-btn" onclick="mapZoomIn()" title="Zoom In">+</button>
- <div class="map-zoom-level" id="mapZoomLevel">1.0x</div>
- <button class="map-zoom-btn" onclick="mapZoomOut()" title="Zoom Out">−</button>
- <button class="map-zoom-btn map-zoom-reset" onclick="mapZoomReset()" title="Reset">RST</button>
- </div>
- <div class="map-pan-hint" id="mapPanHint">DRAG TO PAN</div>
- <div class="conflict-popup" id="conflictPopup"></div>
- <div class="us-city-popup" id="usCityPopup"></div>
- <div class="map-corner-label tl">${mapTitle}</div>
- <div class="map-corner-label tr">CLASSIFICATION: OPEN SOURCE</div>
- <div class="map-corner-label bl">${mapLegend}</div>
- <div class="map-corner-label br">${timestamp}</div>
- </div>
- `;
-
- const container = document.getElementById('worldMapContainer');
- const svg = d3.select('#worldMapSVG');
- const width = container.offsetWidth || 800;
- const height = container.offsetHeight || 550;
-
- svg.attr('width', '100%')
- .attr('height', '100%')
- .attr('viewBox', `0 0 ${width} ${height}`)
- .attr('preserveAspectRatio', 'none');
-
- // Create projection based on view mode
- let projection;
- if (isUSView) {
- // Albers USA projection centered on continental US
- projection = d3.geoAlbersUsa()
- .scale(width * 1.3)
- .translate([width / 2, height / 2]);
- } else if (isMidEastView) {
- // Mercator projection centered on Middle East region
- projection = d3.geoMercator()
- .center([42, 28]) // Center on Middle East (lon, lat)
- .scale(width * 1.5)
- .translate([width / 2, height / 2]);
- } else if (isUkraineView) {
- // Mercator projection centered on Ukraine-Russia theater
- projection = d3.geoMercator()
- .center([35, 50]) // Center on Ukraine/Russia border region
- .scale(width * 2.2)
- .translate([width / 2, height / 2]);
- } else if (isTaiwanView) {
- // Mercator projection centered on Taiwan Strait / South China Sea
- projection = d3.geoMercator()
- .center([118, 23]) // Center on Taiwan Strait region
- .scale(width * 1.8)
- .translate([width / 2, height / 2]);
- } else {
- // Global equirectangular projection
- projection = d3.geoEquirectangular()
- .scale(width / (2 * Math.PI))
- .center([0, 0])
- .translate([width / 2, height / 2]);
- }
-
- const path = d3.geoPath().projection(projection);
-
- // Add background
- svg.append('rect')
- .attr('width', width)
- .attr('height', height)
- .attr('fill', '#020a08');
-
- // Add grid pattern
- const defs = svg.append('defs');
-
- const smallGrid = defs.append('pattern')
- .attr('id', 'smallGridD3')
- .attr('width', 20)
- .attr('height', 20)
- .attr('patternUnits', 'userSpaceOnUse');
- smallGrid.append('path')
- .attr('d', 'M 20 0 L 0 0 0 20')
- .attr('fill', 'none')
- .attr('stroke', '#0a2a20')
- .attr('stroke-width', 0.5);
-
- const grid = defs.append('pattern')
- .attr('id', 'gridD3')
- .attr('width', 60)
- .attr('height', 60)
- .attr('patternUnits', 'userSpaceOnUse');
- grid.append('rect')
- .attr('width', 60)
- .attr('height', 60)
- .attr('fill', 'url(#smallGridD3)');
- grid.append('path')
- .attr('d', 'M 60 0 L 0 0 0 60')
- .attr('fill', 'none')
- .attr('stroke', '#0d3a2d')
- .attr('stroke-width', 0.8);
-
- svg.append('rect')
- .attr('width', width)
- .attr('height', height)
- .attr('fill', 'url(#gridD3)');
-
- // Add graticule (lat/lon lines)
- const graticule = d3.geoGraticule().step([30, 30]);
- svg.append('path')
- .datum(graticule)
- .attr('d', path)
- .attr('fill', 'none')
- .attr('stroke', '#0f4035')
- .attr('stroke-width', 0.5)
- .attr('stroke-opacity', 0.5);
-
- // Load and render countries
- const world = await loadWorldMap();
- if (world) {
- const countries = topojson.feature(world, world.objects.countries);
-
- svg.append('g')
- .attr('class', 'countries-layer')
- .selectAll('path')
- .data(countries.features)
- .enter()
- .append('path')
- .attr('d', path)
- .attr('fill', d => {
- // Apply sanctions coloring if enabled
- if (mapLayers.sanctions) {
- const countryId = d.id;
- const sanctionLevel = SANCTIONED_COUNTRIES[countryId];
- if (sanctionLevel === 'severe') return '#660000';
- if (sanctionLevel === 'high') return '#442200';
- if (sanctionLevel === 'moderate') return '#333300';
- if (sanctionLevel === 'low') return '#223322';
- }
- return '#0a2018';
- })
- .attr('stroke', '#0f5040')
- .attr('stroke-width', 0.5);
-
- // Add US state boundaries (US view only)
- if (isUSView) {
- const usStates = await loadUSStates();
- if (usStates) {
- const states = topojson.feature(usStates, usStates.objects.states);
- const stateBorders = topojson.mesh(usStates, usStates.objects.states, (a, b) => a !== b);
-
- // Draw state fills
- svg.append('g')
- .attr('class', 'states-layer')
- .selectAll('path')
- .data(states.features)
- .enter()
- .append('path')
- .attr('d', path)
- .attr('fill', '#0a2018')
- .attr('stroke', 'none');
-
- // Draw state borders
- svg.append('path')
- .datum(stateBorders)
- .attr('class', 'state-borders')
- .attr('d', path)
- .attr('fill', 'none')
- .attr('stroke', '#1a6050')
- .attr('stroke-width', 0.75)
- .attr('stroke-linejoin', 'round');
-
- // Draw nation border (outline of US)
- const nationBorder = topojson.mesh(usStates, usStates.objects.nation);
- svg.append('path')
- .datum(nationBorder)
- .attr('class', 'nation-border')
- .attr('d', path)
- .attr('fill', 'none')
- .attr('stroke', '#2a8070')
- .attr('stroke-width', 1.5);
- }
- }
-
- // Middle East view - highlight regional countries
- if (isMidEastView) {
- // Middle East country ISO codes
- const MIDEAST_COUNTRIES = [
- 'SAU', 'ARE', 'QAT', 'KWT', 'BHR', 'OMN', // GCC
- 'IRN', 'IRQ', 'SYR', 'LBN', 'JOR', 'ISR', 'PSE', // Levant & Iran
- 'YEM', 'EGY', 'TUR', 'CYP', // Other regional
- 'AFG', 'PAK' // Extended region
- ];
-
- // Redraw Middle East countries with highlighting
- svg.append('g')
- .attr('class', 'mideast-layer')
- .selectAll('path')
- .data(countries.features)
- .enter()
- .append('path')
- .attr('d', path)
- .attr('fill', d => {
- const isoCode = d.properties.iso_a3 || d.id;
- return MIDEAST_COUNTRIES.includes(isoCode) ? '#0f3028' : '#050f0c';
- })
- .attr('stroke', d => {
- const isoCode = d.properties.iso_a3 || d.id;
- return MIDEAST_COUNTRIES.includes(isoCode) ? '#2a8070' : '#0a2018';
- })
- .attr('stroke-width', d => {
- const isoCode = d.properties.iso_a3 || d.id;
- return MIDEAST_COUNTRIES.includes(isoCode) ? 1.0 : 0.3;
- });
- }
-
- // Ukraine-Russia view - highlight theater countries
- if (isUkraineView) {
- // Countries in the Ukraine-Russia theater
- const UKRAINE_THEATER = [
- 'UKR', // Ukraine - primary
- 'RUS', // Russia - primary
- 'BLR', // Belarus - staging
- 'POL', 'ROU', 'MDA', 'HUN', 'SVK', // NATO/EU neighbors
- 'LTU', 'LVA', 'EST', 'FIN' // Baltic/Nordic
- ];
- const PRIMARY_COUNTRIES = ['UKR', 'RUS', 'BLR'];
-
- // Redraw theater countries with highlighting
- svg.append('g')
- .attr('class', 'ukraine-layer')
- .selectAll('path')
- .data(countries.features)
- .enter()
- .append('path')
- .attr('d', path)
- .attr('fill', d => {
- const isoCode = d.properties.iso_a3 || d.id;
- if (isoCode === 'UKR') return '#1a4030'; // Ukraine - distinct
- if (isoCode === 'RUS') return '#301818'; // Russia - red tint
- if (isoCode === 'BLR') return '#282818'; // Belarus - yellow tint
- if (UKRAINE_THEATER.includes(isoCode)) return '#0f2820';
- return '#050f0c';
- })
- .attr('stroke', d => {
- const isoCode = d.properties.iso_a3 || d.id;
- if (isoCode === 'UKR') return '#3a9070'; // Ukraine border
- if (isoCode === 'RUS') return '#803030'; // Russia border
- if (PRIMARY_COUNTRIES.includes(isoCode)) return '#806040';
- if (UKRAINE_THEATER.includes(isoCode)) return '#2a6050';
- return '#0a2018';
- })
- .attr('stroke-width', d => {
- const isoCode = d.properties.iso_a3 || d.id;
- if (PRIMARY_COUNTRIES.includes(isoCode)) return 1.5;
- if (UKRAINE_THEATER.includes(isoCode)) return 1.0;
- return 0.3;
- });
- }
-
- // China-Taiwan view - highlight theater countries
- if (isTaiwanView) {
- // Countries in the China-Taiwan theater
- const TAIWAN_THEATER = [
- 'CHN', // China - primary
- 'TWN', // Taiwan - primary
- 'PHL', // Philippines - disputes
- 'JPN', // Japan - defense ally
- 'VNM', // Vietnam - SCS claims
- 'MYS', // Malaysia - SCS claims
- 'KOR', // South Korea - regional
- 'IDN', 'BRN' // ASEAN
- ];
- const PRIMARY_COUNTRIES = ['CHN', 'TWN', 'PHL'];
-
- // Redraw theater countries with highlighting
- svg.append('g')
- .attr('class', 'taiwan-layer')
- .selectAll('path')
- .data(countries.features)
- .enter()
- .append('path')
- .attr('d', path)
- .attr('fill', d => {
- const isoCode = d.properties.iso_a3 || d.id;
- if (isoCode === 'CHN') return '#301818'; // China - red tint
- if (isoCode === 'TWN') return '#1a3040'; // Taiwan - blue tint
- if (isoCode === 'PHL') return '#1a4030'; // Philippines - green
- if (isoCode === 'JPN') return '#202840'; // Japan - ally blue
- if (TAIWAN_THEATER.includes(isoCode)) return '#0f2820';
- return '#050f0c';
- })
- .attr('stroke', d => {
- const isoCode = d.properties.iso_a3 || d.id;
- if (isoCode === 'CHN') return '#803030'; // China border
- if (isoCode === 'TWN') return '#3080a0'; // Taiwan border
- if (isoCode === 'PHL') return '#3a9070'; // Philippines border
- if (PRIMARY_COUNTRIES.includes(isoCode)) return '#806040';
- if (TAIWAN_THEATER.includes(isoCode)) return '#2a6050';
- return '#0a2018';
- })
- .attr('stroke-width', d => {
- const isoCode = d.properties.iso_a3 || d.id;
- if (PRIMARY_COUNTRIES.includes(isoCode)) return 1.5;
- if (TAIWAN_THEATER.includes(isoCode)) return 1.0;
- return 0.3;
- });
- }
-
- // Add undersea cables as SVG paths (global view only)
- if (mapLayers.cables && !isRegionalView) {
- const cableGroup = svg.append('g').attr('class', 'cables-layer');
- UNDERSEA_CABLES.forEach(cable => {
- const lineGenerator = d3.line()
- .x(d => {
- const p = projection(d);
- return p ? p[0] : 0;
- })
- .y(d => {
- const p = projection(d);
- return p ? p[1] : 0;
- })
- .curve(d3.curveBasis);
-
- const points = cable.points.map(p => [p[0], p[1]]);
- cableGroup.append('path')
- .attr('d', lineGenerator(points))
- .attr('class', `cable-path ${cable.major ? 'major' : ''}`)
- .append('title')
- .text(cable.name);
- });
- }
-
- // Add conflict zone boundaries (global view only)
- if (mapLayers.conflicts && !isRegionalView) {
- const conflictGroup = svg.append('g').attr('class', 'conflicts-layer');
- CONFLICT_ZONES.forEach(zone => {
- // Create closed polygon path
- const points = zone.coords.map(c => projection([c[0], c[1]]));
- // Skip if any point is null (outside projection bounds)
- if (points.some(p => !p)) return;
- if (points.length > 0) {
- const pathData = 'M' + points.map(p => p.join(',')).join('L') + 'Z';
- const isHigh = zone.intensity === 'high';
-
- // Glow effect layer (behind fill)
- conflictGroup.append('path')
- .attr('d', pathData)
- .attr('class', 'conflict-zone-glow');
-
- // Fill for zone area
- conflictGroup.append('path')
- .attr('d', pathData)
- .attr('class', `conflict-zone-fill ${isHigh ? 'high-intensity' : ''}`);
-
- // Animated border
- conflictGroup.append('path')
- .attr('d', pathData)
- .attr('class', `conflict-zone-path ${isHigh ? 'high-intensity' : ''}`);
- }
- });
- }
- }
-
- // Helper to convert lon/lat to percentage using the projection
- const toPercent = (lon, lat) => {
- const projected = projection([lon, lat]);
- // geoAlbersUsa returns null for points outside US
- if (!projected) return null;
- return {
- x: (projected[0] / width) * 100,
- y: (projected[1] / height) * 100
- };
- };
-
- // Build overlay HTML
- let overlaysHTML = '';
-
- // Coordinate labels (global view only)
- if (!isRegionalView) {
- [-60, -30, 0, 30, 60].forEach(lat => {
- const pos = toPercent(-175, lat);
- if (!pos) return;
- const label = lat === 0 ? '0°' : (lat > 0 ? `${lat}°N` : `${Math.abs(lat)}°S`);
- overlaysHTML += `<div class="coord-label lat" style="top: ${pos.y}%; left: 0.5%;">${label}</div>`;
- });
- [-120, -60, 0, 60, 120].forEach(lon => {
- const pos = toPercent(lon, -85);
- if (!pos) return;
- const label = lon === 0 ? '0°' : (lon > 0 ? `${lon}°E` : `${Math.abs(lon)}°W`);
- overlaysHTML += `<div class="coord-label lon" style="left: ${pos.x}%; bottom: 1%;">${label}</div>`;
- });
- }
-
- // News density heatmap blobs (global view only)
- if (mapLayers.density && !isRegionalView) {
- const densityScores = calculateNewsDensity(allNews);
- NEWS_REGIONS.forEach(region => {
- const score = densityScores[region.id] || 0;
- if (score > 0) {
- const pos = toPercent(region.lon, region.lat);
- if (!pos) return;
- let level = 'low';
- let size = region.radius;
- if (score >= 10) {
- level = 'high';
- size = region.radius * 1.5;
- } else if (score >= 5) {
- level = 'medium';
- size = region.radius * 1.2;
- }
- overlaysHTML += `
- <div class="density-blob ${level}"
- style="left: ${pos.x}%; top: ${pos.y}%; width: ${size}px; height: ${size}px; transform: translate(-50%, -50%);"></div>
- `;
- }
- });
- }
-
- // Conflict zone labels (global view only)
- if (mapLayers.conflicts && !isRegionalView) {
- CONFLICT_ZONES.forEach(zone => {
- const pos = toPercent(zone.labelPos.lon, zone.labelPos.lat);
- if (!pos) return;
- const intensityClass = zone.intensity === 'high' ? 'high-intensity' : '';
- // Store zone data for popup
- const zoneData = encodeURIComponent(JSON.stringify(zone));
- overlaysHTML += `
- <div class="conflict-zone-label ${intensityClass}"
- style="left: ${pos.x}%; top: ${pos.y}%;"
- data-conflict-id="${zone.id}"
- data-conflict-info="${zoneData}"
- onclick="showConflictPopup(event, '${zone.id}')">
- ${zone.name}
- </div>
- `;
- });
- }
-
- // Military base markers (global view only)
- if (mapLayers.bases && !isRegionalView) {
- MILITARY_BASES.forEach(base => {
- const pos = toPercent(base.lon, base.lat);
- if (!pos) return;
- overlaysHTML += `
- <div class="military-base ${base.type}" style="left: ${pos.x}%; top: ${pos.y}%;" title="${base.name}">
- <div class="base-icon ${base.type}"></div>
- <div class="base-label ${base.type}">${base.name}</div>
- </div>
- `;
- });
- }
-
- // Nuclear facility markers (global view only)
- if (mapLayers.nuclear && !isRegionalView) {
- NUCLEAR_FACILITIES.forEach(facility => {
- const pos = toPercent(facility.lon, facility.lat);
- if (!pos) return;
- const isWeapons = facility.type === 'weapons' || facility.type === 'enrichment';
- overlaysHTML += `
- <div class="nuclear-facility" style="left: ${pos.x}%; top: ${pos.y}%;" title="${facility.name} (${facility.type})">
- <div class="nuclear-icon ${isWeapons ? 'weapons' : ''}"></div>
- <div class="nuclear-label">${facility.name}</div>
- </div>
- `;
- });
- }
-
- // Cyber threat zones (global view only)
- if (!isRegionalView) {
- CYBER_REGIONS.forEach(cz => {
- const pos = toPercent(cz.lon, cz.lat);
- if (!pos) return;
- // Randomly determine if this zone is "active" (simulated)
- const isActive = Math.random() > 0.6;
-
- // Store cyber zone data
- const czData = encodeURIComponent(JSON.stringify({
- ...cz,
- isActive
- }));
-
- overlaysHTML += `
- <div class="cyber-zone ${isActive ? 'active' : ''}"
- style="left: ${pos.x}%; top: ${pos.y}%;"
- data-cyber-id="${cz.id}"
- data-cyber-info="${czData}"
- onclick="showCyberPopup(event, '${cz.id}')">
- <div class="cyber-icon"></div>
- <div class="cyber-label">${cz.group}</div>
- </div>
- `;
- });
- }
-
- // Shipping chokepoints (global view only)
- if (!isRegionalView) {
- SHIPPING_CHOKEPOINTS.forEach(cp => {
- const pos = toPercent(cp.lon, cp.lat);
- if (!pos) return;
-
- // Find matching headlines for this chokepoint
- const matchedHeadlines = allNews.filter(item => {
- const title = (item.title || '').toLowerCase();
- return cp.keywords.some(kw => title.includes(kw));
- }).slice(0, 5).map(item => ({
- title: item.title,
- link: item.link,
- source: item.source
- }));
-
- const isAlert = matchedHeadlines.length > 0;
-
- // Store chokepoint data as JSON
- const cpData = encodeURIComponent(JSON.stringify({
- ...cp,
- isAlert,
- headlines: matchedHeadlines
- }));
-
- overlaysHTML += `
- <div class="chokepoint ${isAlert ? 'alert' : ''}"
- style="left: ${pos.x}%; top: ${pos.y}%;"
- data-chokepoint-id="${cp.id}"
- data-chokepoint-info="${cpData}"
- onclick="showChokepointPopup(event, '${cp.id}')">
- <div class="chokepoint-icon"></div>
- <div class="chokepoint-label">${cp.name}</div>
- </div>
- `;
- });
- }
-
- // Earthquake markers (show in both views, but only if in visible area)
- earthquakes.slice(0, 10).forEach((eq, index) => {
- const pos = toPercent(eq.lon, eq.lat);
- if (!pos) return; // Skip if outside projection bounds
- const isMajor = eq.mag >= 6.0;
-
- // Store earthquake data
- const eqData = encodeURIComponent(JSON.stringify({
- mag: eq.mag,
- place: eq.place,
- time: eq.time,
- lat: eq.lat,
- lon: eq.lon,
- depth: eq.depth,
- id: eq.id || `eq_${index}`
- }));
-
- overlaysHTML += `
- <div class="quake ${isMajor ? 'major' : ''}"
- style="left: ${pos.x}%; top: ${pos.y}%;"
- data-quake-id="eq_${index}"
- data-quake-info="${eqData}"
- onclick="showQuakePopup(event, 'eq_${index}')">
- <div class="quake-icon"></div>
- <div class="quake-label">M${eq.mag.toFixed(1)}</div>
- </div>
- `;
- });
-
- // Intel hotspots with breaking news pulse for high activity (global view only)
- if (!isRegionalView) {
- INTEL_HOTSPOTS.forEach(spot => {
- const activity = activityData[spot.id] || { level: 'low', score: 0, headlines: [] };
- const pos = toPercent(spot.lon, spot.lat);
- if (!pos) return;
- // Store activity data as JSON in data attribute (including new detailed info)
- const activityJson = encodeURIComponent(JSON.stringify({
- ...activity,
- name: spot.name,
- subtext: spot.subtext,
- lat: spot.lat,
- lon: spot.lon,
- description: spot.description || '',
- agencies: spot.agencies || [],
- status: spot.status || ''
- }));
-
- // Add breaking news pulse for high activity hotspots
- if (activity.level === 'high' && activity.headlines.length > 0) {
- overlaysHTML += `
- <div class="news-pulse" style="left: ${pos.x}%; top: ${pos.y}%;">
- <div class="news-pulse-ring"></div>
- <div class="news-pulse-ring"></div>
- <div class="news-pulse-ring"></div>
- <div class="news-pulse-label">Breaking</div>
- </div>
- `;
- }
-
- overlaysHTML += `
- <div class="hotspot ${activity.level}"
- style="left: ${pos.x}%; top: ${pos.y}%;"
- data-hotspot-id="${spot.id}"
- data-hotspot-activity="${activityJson}"
- onclick="showHotspotPopup(event, '${spot.id}')">
- <div class="hotspot-dot"></div>
- <div class="hotspot-label">
- ${spot.name}
- <div class="hotspot-info">${spot.subtext}</div>
- </div>
- </div>
- `;
- });
- }
-
- // Custom monitor hotspots (user-created, show in both views if in visible area)
- const customHotspots = getMonitorHotspots(allNews);
- customHotspots.forEach(monitor => {
- const pos = toPercent(monitor.lon, monitor.lat);
- if (!pos) return; // Skip if outside projection bounds
- const matchData = encodeURIComponent(JSON.stringify({
- id: monitor.id,
- name: monitor.name,
- color: monitor.color,
- keywords: monitor.keywords,
- lat: monitor.lat,
- lon: monitor.lon,
- matchCount: monitor.matchCount,
- matches: monitor.matches.slice(0, 5)
- }));
-
- overlaysHTML += `
- <div class="custom-hotspot"
- style="left: ${pos.x}%; top: ${pos.y}%; color: ${monitor.color};"
- data-monitor-id="${monitor.id}"
- data-monitor-info="${matchData}"
- onclick="showCustomHotspotPopup(event, '${monitor.id}')">
- <div class="custom-hotspot-dot" style="background: ${monitor.color}; border-color: ${monitor.color};"></div>
- <div class="custom-hotspot-label" style="color: ${monitor.color};">
- ${monitor.name}
- <span class="custom-hotspot-count">${monitor.matchCount > 0 ? ` (${monitor.matchCount})` : ''}</span>
- </div>
- </div>
- `;
- });
-
- // Add popup containers
- overlaysHTML += `<div class="hotspot-popup" id="hotspotPopup"></div>`;
- overlaysHTML += `<div class="chokepoint-popup" id="chokepointPopup"></div>`;
- overlaysHTML += `<div class="quake-popup" id="quakePopup"></div>`;
- overlaysHTML += `<div class="cyber-popup" id="cyberPopup"></div>`;
- overlaysHTML += `<div class="custom-hotspot-popup" id="customHotspotPopup"></div>`;
-
- // US Cities (only in US view mode)
- if (isUSView) {
- US_CITIES.forEach(city => {
- const projected = projection([city.lon, city.lat]);
- if (!projected) return; // Skip if outside projection bounds
-
- const posX = (projected[0] / width) * 100;
- const posY = (projected[1] / height) * 100;
-
- // Check for news activity
- let activityLevel = '';
- let matchCount = 0;
- if (allNews && allNews.length > 0) {
- const matches = allNews.filter(item => {
- const title = (item.title || '').toLowerCase();
- return city.keywords.some(kw => title.includes(kw.toLowerCase()));
- });
- matchCount = matches.length;
- if (matchCount >= 5) activityLevel = 'high-activity';
- }
-
- // Store city data for popup
- const cityData = encodeURIComponent(JSON.stringify({
- ...city,
- matchCount,
- headlines: allNews ? allNews.filter(item => {
- const title = (item.title || '').toLowerCase();
- return city.keywords.some(kw => title.includes(kw.toLowerCase()));
- }).slice(0, 8) : []
- }));
-
- const typeClass = city.type === 'capital' ? 'capital' :
- city.type === 'major' ? 'major' : '';
-
- overlaysHTML += `
- <div class="us-city ${typeClass} ${activityLevel}"
- style="left: ${posX}%; top: ${posY}%; color: ${city.type === 'capital' ? '#ffcc00' : city.type === 'major' ? '#00ff88' : '#00aaff'};"
- data-city-id="${city.id}"
- data-city-info="${cityData}"
- onclick="showUSCityPopup(event, '${city.id}')">
- <div class="us-city-dot"></div>
- <div class="us-city-label">
- ${city.name}
- ${matchCount > 0 ? `<span class="us-city-count">(${matchCount})</span>` : ''}
- </div>
- </div>
- `;
- });
-
- // US Breaking News Hotspots
- US_HOTSPOTS.forEach(hotspot => {
- const projected = projection([hotspot.lon, hotspot.lat]);
- if (!projected) return;
-
- const posX = (projected[0] / width) * 100;
- const posY = (projected[1] / height) * 100;
-
- // Check for matching news
- let matchCount = 0;
- let matchedHeadlines = [];
- if (allNews && allNews.length > 0) {
- matchedHeadlines = allNews.filter(item => {
- const title = (item.title || '').toLowerCase();
- return hotspot.keywords.some(kw => title.includes(kw.toLowerCase()));
- });
- matchCount = matchedHeadlines.length;
- }
-
- // Store hotspot data for popup
- const hotspotData = encodeURIComponent(JSON.stringify({
- ...hotspot,
- matchCount,
- headlines: matchedHeadlines.slice(0, 8)
- }));
-
- overlaysHTML += `
- <div class="us-hotspot ${hotspot.level}"
- style="left: ${posX}%; top: ${posY}%;"
- data-us-hotspot-id="${hotspot.id}"
- data-us-hotspot-info="${hotspotData}"
- onclick="showUSHotspotPopup(event, '${hotspot.id}')">
- <div class="us-hotspot-glow"></div>
- <div class="us-hotspot-ring"></div>
- <div class="us-hotspot-marker">${hotspot.icon}</div>
- <div class="us-hotspot-label">
- ${hotspot.name}
- <div class="us-hotspot-category">${hotspot.category}</div>
- </div>
- </div>
- `;
- });
-
- // Add US hotspot popup container
- overlaysHTML += `<div class="us-hotspot-popup" id="usHotspotPopup"></div>`;
- }
-
- // Middle East view hotspots
- if (isMidEastView) {
- // Middle East major cities
- const MIDEAST_CITIES = [
- { id: 'riyadh', name: 'Riyadh', lat: 24.7136, lon: 46.6753, type: 'capital', keywords: ['riyadh', 'saudi'] },
- { id: 'tehran', name: 'Tehran', lat: 35.6892, lon: 51.3890, type: 'capital', keywords: ['tehran', 'iran'] },
- { id: 'cairo', name: 'Cairo', lat: 30.0444, lon: 31.2357, type: 'capital', keywords: ['cairo', 'egypt'] },
- { id: 'ankara', name: 'Ankara', lat: 39.9334, lon: 32.8597, type: 'capital', keywords: ['ankara', 'turkey'] },
- { id: 'baghdad', name: 'Baghdad', lat: 33.3152, lon: 44.3661, type: 'capital', keywords: ['baghdad', 'iraq'] },
- { id: 'damascus', name: 'Damascus', lat: 33.5138, lon: 36.2765, type: 'capital', keywords: ['damascus', 'syria'] },
- { id: 'amman', name: 'Amman', lat: 31.9454, lon: 35.9284, type: 'capital', keywords: ['amman', 'jordan'] },
- { id: 'beirut', name: 'Beirut', lat: 33.8938, lon: 35.5018, type: 'capital', keywords: ['beirut', 'lebanon'] },
- { id: 'jerusalem', name: 'Jerusalem', lat: 31.7683, lon: 35.2137, type: 'capital', keywords: ['jerusalem'] },
- { id: 'tel-aviv', name: 'Tel Aviv', lat: 32.0853, lon: 34.7818, type: 'major', keywords: ['tel aviv', 'israel'] },
- { id: 'dubai', name: 'Dubai', lat: 25.2048, lon: 55.2708, type: 'major', keywords: ['dubai', 'uae'] },
- { id: 'abu-dhabi', name: 'Abu Dhabi', lat: 24.4539, lon: 54.3773, type: 'capital', keywords: ['abu dhabi', 'uae'] },
- { id: 'doha', name: 'Doha', lat: 25.2854, lon: 51.5310, type: 'capital', keywords: ['doha', 'qatar'] },
- { id: 'kuwait', name: 'Kuwait City', lat: 29.3759, lon: 47.9774, type: 'capital', keywords: ['kuwait'] },
- { id: 'sanaa', name: "Sana'a", lat: 15.3694, lon: 44.1910, type: 'capital', keywords: ['sanaa', 'yemen'] },
- { id: 'istanbul', name: 'Istanbul', lat: 41.0082, lon: 28.9784, type: 'major', keywords: ['istanbul', 'turkey'] },
- { id: 'kabul', name: 'Kabul', lat: 34.5553, lon: 69.2075, type: 'capital', keywords: ['kabul', 'afghanistan'] }
- ];
-
- // Render Middle East cities
- MIDEAST_CITIES.forEach(city => {
- const projected = projection([city.lon, city.lat]);
- if (!projected) return;
-
- const posX = (projected[0] / width) * 100;
- const posY = (projected[1] / height) * 100;
-
- let matchCount = 0;
- if (allNews && allNews.length > 0) {
- const matches = allNews.filter(item => {
- const title = (item.title || '').toLowerCase();
- return city.keywords.some(kw => title.includes(kw.toLowerCase()));
- });
- matchCount = matches.length;
- }
-
- const typeClass = city.type === 'capital' ? 'capital' : city.type === 'major' ? 'major' : '';
- const activityLevel = matchCount >= 5 ? 'high-activity' : '';
-
- overlaysHTML += `
- <div class="us-city ${typeClass} ${activityLevel}"
- style="left: ${posX}%; top: ${posY}%; color: ${city.type === 'capital' ? '#ffcc00' : '#00ff88'};">
- <div class="us-city-dot"></div>
- <div class="us-city-label">
- ${city.name}
- ${matchCount > 0 ? `<span class="us-city-count">(${matchCount})</span>` : ''}
- </div>
- </div>
- `;
- });
-
- // Middle East Breaking News Hotspots
- MIDEAST_HOTSPOTS.forEach(hotspot => {
- const projected = projection([hotspot.lon, hotspot.lat]);
- if (!projected) return;
-
- const posX = (projected[0] / width) * 100;
- const posY = (projected[1] / height) * 100;
-
- // Check for matching news
- let matchCount = 0;
- let matchedHeadlines = [];
- if (allNews && allNews.length > 0) {
- matchedHeadlines = allNews.filter(item => {
- const title = (item.title || '').toLowerCase();
- return hotspot.keywords.some(kw => title.includes(kw.toLowerCase()));
- });
- matchCount = matchedHeadlines.length;
- }
-
- // Store hotspot data for popup
- const hotspotData = encodeURIComponent(JSON.stringify({
- ...hotspot,
- matchCount,
- headlines: matchedHeadlines.slice(0, 8)
- }));
-
- overlaysHTML += `
- <div class="us-hotspot ${hotspot.level}"
- style="left: ${posX}%; top: ${posY}%;"
- data-us-hotspot-id="${hotspot.id}"
- data-us-hotspot-info="${hotspotData}"
- onclick="showUSHotspotPopup(event, '${hotspot.id}')">
- <div class="us-hotspot-glow"></div>
- <div class="us-hotspot-ring"></div>
- <div class="us-hotspot-marker">${hotspot.icon}</div>
- <div class="us-hotspot-label">
- ${hotspot.name}
- <div class="us-hotspot-category">${hotspot.category}</div>
- </div>
- </div>
- `;
- });
-
- // Add Middle East hotspot popup container (reusing US popup styles)
- overlaysHTML += `<div class="us-hotspot-popup" id="usHotspotPopup"></div>`;
- }
-
- // Ukraine-Russia view hotspots
- if (isUkraineView) {
- // Ukraine-Russia theater major cities
- const UKRAINE_CITIES = [
- { id: 'kyiv', name: 'Kyiv', lat: 50.4501, lon: 30.5234, type: 'capital', keywords: ['kyiv', 'kiev'] },
- { id: 'kharkiv', name: 'Kharkiv', lat: 49.9935, lon: 36.2304, type: 'major', keywords: ['kharkiv', 'kharkov'] },
- { id: 'odesa', name: 'Odesa', lat: 46.4825, lon: 30.7233, type: 'major', keywords: ['odesa', 'odessa'] },
- { id: 'lviv', name: 'Lviv', lat: 49.8397, lon: 24.0297, type: 'major', keywords: ['lviv', 'lvov'] },
- { id: 'dnipro', name: 'Dnipro', lat: 48.4647, lon: 35.0462, type: 'major', keywords: ['dnipro', 'dnieper'] },
- { id: 'zaporizhzhia', name: 'Zaporizhzhia', lat: 47.8388, lon: 35.1396, type: 'major', keywords: ['zaporizhzhia', 'nuclear plant'] },
- { id: 'donetsk', name: 'Donetsk', lat: 48.0159, lon: 37.8029, type: 'major', keywords: ['donetsk', 'donbas'] },
- { id: 'moscow', name: 'Moscow', lat: 55.7558, lon: 37.6173, type: 'capital', keywords: ['moscow', 'kremlin', 'putin'] },
- { id: 'minsk', name: 'Minsk', lat: 53.9045, lon: 27.5615, type: 'capital', keywords: ['minsk', 'belarus'] },
- { id: 'warsaw', name: 'Warsaw', lat: 52.2297, lon: 21.0122, type: 'capital', keywords: ['warsaw', 'poland'] },
- { id: 'bucharest', name: 'Bucharest', lat: 44.4268, lon: 26.1025, type: 'capital', keywords: ['bucharest', 'romania'] },
- { id: 'chisinau', name: 'Chisinau', lat: 47.0105, lon: 28.8638, type: 'capital', keywords: ['chisinau', 'moldova'] },
- { id: 'sevastopol', name: 'Sevastopol', lat: 44.6167, lon: 33.5254, type: 'major', keywords: ['sevastopol', 'crimea', 'black sea fleet'] }
- ];
-
- // Render Ukraine theater cities
- UKRAINE_CITIES.forEach(city => {
- const projected = projection([city.lon, city.lat]);
- if (!projected) return;
-
- const posX = (projected[0] / width) * 100;
- const posY = (projected[1] / height) * 100;
-
- let matchCount = 0;
- if (allNews && allNews.length > 0) {
- const matches = allNews.filter(item => {
- const title = (item.title || '').toLowerCase();
- return city.keywords.some(kw => title.includes(kw.toLowerCase()));
- });
- matchCount = matches.length;
- }
-
- const typeClass = city.type === 'capital' ? 'capital' : city.type === 'major' ? 'major' : '';
- const activityLevel = matchCount >= 5 ? 'high-activity' : '';
-
- // Color based on country
- let cityColor = '#00ff88';
- if (['moscow'].includes(city.id)) cityColor = '#ff6666';
- else if (['minsk'].includes(city.id)) cityColor = '#ffaa44';
- else if (['kyiv', 'kharkiv', 'odesa', 'lviv', 'dnipro', 'zaporizhzhia', 'donetsk', 'sevastopol'].includes(city.id)) cityColor = '#44aaff';
-
- overlaysHTML += `
- <div class="us-city ${typeClass} ${activityLevel}"
- style="left: ${posX}%; top: ${posY}%; color: ${city.type === 'capital' ? '#ffcc00' : cityColor};">
- <div class="us-city-dot"></div>
- <div class="us-city-label">
- ${city.name}
- ${matchCount > 0 ? `<span class="us-city-count">(${matchCount})</span>` : ''}
- </div>
- </div>
- `;
- });
-
- // Ukraine-Russia theater hotspots
- UKRAINE_HOTSPOTS.forEach(hotspot => {
- const projected = projection([hotspot.lon, hotspot.lat]);
- if (!projected) return;
-
- const posX = (projected[0] / width) * 100;
- const posY = (projected[1] / height) * 100;
-
- // Check for matching news
- let matchCount = 0;
- let matchedHeadlines = [];
- if (allNews && allNews.length > 0) {
- matchedHeadlines = allNews.filter(item => {
- const title = (item.title || '').toLowerCase();
- return hotspot.keywords.some(kw => title.includes(kw.toLowerCase()));
- });
- matchCount = matchedHeadlines.length;
- }
-
- // Store hotspot data for popup
- const hotspotData = encodeURIComponent(JSON.stringify({
- ...hotspot,
- matchCount,
- headlines: matchedHeadlines.slice(0, 8)
- }));
-
- overlaysHTML += `
- <div class="us-hotspot ${hotspot.level}"
- style="left: ${posX}%; top: ${posY}%;"
- data-us-hotspot-id="${hotspot.id}"
- data-us-hotspot-info="${hotspotData}"
- onclick="showUSHotspotPopup(event, '${hotspot.id}')">
- <div class="us-hotspot-glow"></div>
- <div class="us-hotspot-ring"></div>
- <div class="us-hotspot-marker">${hotspot.icon}</div>
- <div class="us-hotspot-label">
- ${hotspot.name}
- <div class="us-hotspot-category">${hotspot.category}</div>
- </div>
- </div>
- `;
- });
-
- // Add Ukraine hotspot popup container
- overlaysHTML += `<div class="us-hotspot-popup" id="usHotspotPopup"></div>`;
- }
-
- // China-Taiwan view hotspots
- if (isTaiwanView) {
- // China-Taiwan theater major cities
- const TAIWAN_CITIES = [
- { id: 'taipei', name: 'Taipei', lat: 25.0330, lon: 121.5654, type: 'capital', keywords: ['taipei', 'taiwan'] },
- { id: 'beijing', name: 'Beijing', lat: 39.9042, lon: 116.4074, type: 'capital', keywords: ['beijing', 'china', 'xi jinping'] },
- { id: 'shanghai', name: 'Shanghai', lat: 31.2304, lon: 121.4737, type: 'major', keywords: ['shanghai'] },
- { id: 'hong-kong', name: 'Hong Kong', lat: 22.3193, lon: 114.1694, type: 'major', keywords: ['hong kong', 'hk'] },
- { id: 'manila', name: 'Manila', lat: 14.5995, lon: 120.9842, type: 'capital', keywords: ['manila', 'philippines', 'marcos'] },
- { id: 'tokyo', name: 'Tokyo', lat: 35.6762, lon: 139.6503, type: 'capital', keywords: ['tokyo', 'japan'] },
- { id: 'okinawa', name: 'Okinawa', lat: 26.5013, lon: 127.9454, type: 'major', keywords: ['okinawa', 'kadena'] },
- { id: 'kaohsiung', name: 'Kaohsiung', lat: 22.6273, lon: 120.3014, type: 'major', keywords: ['kaohsiung'] },
- { id: 'xiamen', name: 'Xiamen', lat: 24.4798, lon: 118.0894, type: 'major', keywords: ['xiamen', 'fujian'] },
- { id: 'hanoi', name: 'Hanoi', lat: 21.0285, lon: 105.8542, type: 'capital', keywords: ['hanoi', 'vietnam'] },
- { id: 'seoul', name: 'Seoul', lat: 37.5665, lon: 126.9780, type: 'capital', keywords: ['seoul', 'korea'] },
- { id: 'singapore', name: 'Singapore', lat: 1.3521, lon: 103.8198, type: 'capital', keywords: ['singapore'] },
- { id: 'guam', name: 'Guam', lat: 13.4443, lon: 144.7937, type: 'major', keywords: ['guam', 'andersen'] }
- ];
-
- // Render Taiwan theater cities
- TAIWAN_CITIES.forEach(city => {
- const projected = projection([city.lon, city.lat]);
- if (!projected) return;
-
- const posX = (projected[0] / width) * 100;
- const posY = (projected[1] / height) * 100;
-
- // Skip if out of bounds
- if (posX < 0 || posX > 100 || posY < 0 || posY > 100) return;
-
- let matchCount = 0;
- if (allNews && allNews.length > 0) {
- const matches = allNews.filter(item => {
- const title = (item.title || '').toLowerCase();
- return city.keywords.some(kw => title.includes(kw.toLowerCase()));
- });
- matchCount = matches.length;
- }
-
- const typeClass = city.type === 'capital' ? 'capital' : city.type === 'major' ? 'major' : '';
- const activityLevel = matchCount >= 5 ? 'high-activity' : '';
-
- // Color based on country
- let cityColor = '#00ff88';
- if (['beijing', 'shanghai', 'xiamen'].includes(city.id)) cityColor = '#ff6666';
- else if (['taipei', 'kaohsiung'].includes(city.id)) cityColor = '#44aaff';
- else if (['tokyo', 'okinawa', 'seoul', 'guam'].includes(city.id)) cityColor = '#6688ff';
-
- overlaysHTML += `
- <div class="us-city ${typeClass} ${activityLevel}"
- style="left: ${posX}%; top: ${posY}%; color: ${city.type === 'capital' ? '#ffcc00' : cityColor};">
- <div class="us-city-dot"></div>
- <div class="us-city-label">
- ${city.name}
- ${matchCount > 0 ? `<span class="us-city-count">(${matchCount})</span>` : ''}
- </div>
- </div>
- `;
- });
-
- // China-Taiwan theater hotspots
- TAIWAN_HOTSPOTS.forEach(hotspot => {
- const projected = projection([hotspot.lon, hotspot.lat]);
- if (!projected) return;
-
- const posX = (projected[0] / width) * 100;
- const posY = (projected[1] / height) * 100;
-
- // Skip if out of bounds
- if (posX < 0 || posX > 100 || posY < 0 || posY > 100) return;
-
- // Check for matching news
- let matchCount = 0;
- let matchedHeadlines = [];
- if (allNews && allNews.length > 0) {
- matchedHeadlines = allNews.filter(item => {
- const title = (item.title || '').toLowerCase();
- return hotspot.keywords.some(kw => title.includes(kw.toLowerCase()));
- });
- matchCount = matchedHeadlines.length;
- }
-
- // Store hotspot data for popup
- const hotspotData = encodeURIComponent(JSON.stringify({
- ...hotspot,
- matchCount,
- headlines: matchedHeadlines.slice(0, 8)
- }));
-
- overlaysHTML += `
- <div class="us-hotspot ${hotspot.level}"
- style="left: ${posX}%; top: ${posY}%;"
- data-us-hotspot-id="${hotspot.id}"
- data-us-hotspot-info="${hotspotData}"
- onclick="showUSHotspotPopup(event, '${hotspot.id}')">
- <div class="us-hotspot-glow"></div>
- <div class="us-hotspot-ring"></div>
- <div class="us-hotspot-marker">${hotspot.icon}</div>
- <div class="us-hotspot-label">
- ${hotspot.name}
- <div class="us-hotspot-category">${hotspot.category}</div>
- </div>
- </div>
- `;
- });
-
- // Add Taiwan hotspot popup container
- overlaysHTML += `<div class="us-hotspot-popup" id="usHotspotPopup"></div>`;
- }
-
- // Layer toggle buttons (only for global view)
- if (!isRegionalView) {
- overlaysHTML += `
- <div class="map-layer-toggle">
- <button class="layer-btn ${mapLayers.conflicts ? 'active' : ''}" onclick="toggleLayer('conflicts')">Conflicts</button>
- <button class="layer-btn ${mapLayers.bases ? 'active' : ''}" onclick="toggleLayer('bases')">Bases</button>
- <button class="layer-btn ${mapLayers.nuclear ? 'active' : ''}" onclick="toggleLayer('nuclear')">Nuclear</button>
- <button class="layer-btn ${mapLayers.cables ? 'active' : ''}" onclick="toggleLayer('cables')">Cables</button>
- <button class="layer-btn ${mapLayers.sanctions ? 'active' : ''}" onclick="toggleLayer('sanctions')">Sanctions</button>
- <button class="layer-btn ${mapLayers.density ? 'active' : ''}" onclick="toggleLayer('density')">Density</button>
- <button class="layer-btn ${mapLayers.flights ? 'active' : ''}" onclick="toggleLayer('flights')">Flights</button>
- <button class="layer-btn satellite-btn ${mapLayers.satellite ? 'active' : ''}" onclick="toggleSatelliteLayer()">Satellite</button>
- </div>
- `;
- }
-
- // Flight radar overlay (fetch and render if enabled)
- if (mapLayers.flights) {
- try {
- const flights = await fetchFlightData();
- const flightCount = flights.length;
-
- flights.slice(0, 200).forEach(flight => { // Limit for performance
- const projected = projection([flight.lon, flight.lat]);
- if (!projected) return;
-
- const posX = (projected[0] / width) * 100;
- const posY = (projected[1] / height) * 100;
-
- // Skip if out of bounds
- if (posX < 0 || posX > 100 || posY < 0 || posY > 100) return;
-
- const aircraftType = classifyAircraft(flight.callsign, flight.country);
- const arrow = getAircraftArrow(flight.heading);
- const flightData = encodeURIComponent(JSON.stringify(flight));
-
- overlaysHTML += `
- <div class="aircraft-marker ${aircraftType}"
- style="left: ${posX}%; top: ${posY}%; transform: translate(-50%, -50%) rotate(${flight.heading || 0}deg);"
- onclick="showAircraftPopup(event, '${flightData}')"
- title="${flight.callsign || flight.icao24}">
- <div class="aircraft-icon" style="transform: rotate(-${flight.heading || 0}deg);">${arrow}</div>
- </div>
- `;
- });
-
- // Add flight count badge to legend
- overlaysHTML += `<div class="flight-count-badge" style="position: absolute; bottom: 30px; right: 10px;">✈ ${flightCount} flights</div>`;
- } catch (e) {
- console.error('Flight rendering failed:', e);
- }
- }
-
- // Aircraft popup container
- overlaysHTML += `<div class="aircraft-popup" id="aircraftPopup"></div>`;
-
- // Flashback slider
- overlaysHTML += `
- <div class="flashback-mode-indicator" id="flashbackIndicator">Viewing Historical Data</div>
- <div class="flashback-control">
- <span class="flashback-label">Time</span>
- <input type="range" class="flashback-slider" id="flashbackSlider" min="0" max="24" value="0" step="1" onchange="updateFlashback(this.value)">
- <span class="flashback-time" id="flashbackTime">LIVE</span>
- </div>
- `;
-
- document.getElementById('mapOverlays').innerHTML = overlaysHTML;
-
- // Initialize map pan functionality after render
- initMapPan();
-
- // Close popups when clicking outside
- document.getElementById('worldMapContainer').addEventListener('click', (e) => {
- if (!e.target.closest('.hotspot') && !e.target.closest('.hotspot-popup')) {
- hideHotspotPopup();
- }
- if (!e.target.closest('.chokepoint') && !e.target.closest('.chokepoint-popup')) {
- hideChokepointPopup();
- }
- if (!e.target.closest('.quake') && !e.target.closest('.quake-popup')) {
- hideQuakePopup();
- }
- if (!e.target.closest('.cyber-zone') && !e.target.closest('.cyber-popup')) {
- hideCyberPopup();
- }
- if (!e.target.closest('.custom-hotspot') && !e.target.closest('.custom-hotspot-popup')) {
- hideCustomHotspotPopup();
- }
- if (!e.target.closest('.conflict-zone-label') && !e.target.closest('.conflict-popup')) {
- hideConflictPopup();
- }
- if (!e.target.closest('.us-city') && !e.target.closest('.us-city-popup')) {
- hideUSCityPopup();
- }
- if (!e.target.closest('.us-hotspot') && !e.target.closest('.us-hotspot-popup')) {
- hideUSHotspotPopup();
- }
- if (!e.target.closest('.aircraft-marker') && !e.target.closest('.aircraft-popup')) {
- hideAircraftPopup();
- }
- });
- }
-
- // Show hotspot popup
- function showHotspotPopup(event, hotspotId) {
- event.stopPropagation();
-
- const hotspotEl = document.querySelector(`[data-hotspot-id="${hotspotId}"]`);
- if (!hotspotEl) return;
-
- // Hide other popups
- hideChokepointPopup();
- hideQuakePopup();
- hideCyberPopup();
- hideCustomHotspotPopup();
- hideUSCityPopup();
- hideUSHotspotPopup();
-
- const activityData = JSON.parse(decodeURIComponent(hotspotEl.dataset.hotspotActivity));
- const popup = document.getElementById('hotspotPopup');
-
- // Build headlines HTML
- let headlinesHTML = '';
- if (activityData.headlines && activityData.headlines.length > 0) {
- headlinesHTML = activityData.headlines.map(h => `
- <div class="hotspot-popup-headline">
- <div class="hotspot-popup-source">${escapeHtml(h.source || 'News')}</div>
- <a href="${h.link || '#'}" target="_blank">${escapeHtml(h.title)}</a>
- </div>
- `).join('');
- } else {
- headlinesHTML = '<div class="hotspot-popup-empty">No recent headlines for this location</div>';
- }
-
- // Build agencies HTML if available
- let agenciesHTML = '';
- if (activityData.agencies && activityData.agencies.length > 0) {
- agenciesHTML = `
- <div class="hotspot-popup-agencies">
- <div class="hotspot-popup-agencies-title">Key Entities</div>
- ${activityData.agencies.map(a => `<span class="hotspot-popup-agency">${escapeHtml(a)}</span>`).join('')}
- </div>
- `;
- }
-
- // Build popup content
- popup.innerHTML = `
- <button class="hotspot-popup-close" onclick="hideHotspotPopup()">&times;</button>
- <div class="hotspot-popup-header">
- <span class="hotspot-popup-title">${escapeHtml(activityData.name)}</span>
- <span class="hotspot-popup-level ${activityData.level}">${activityData.level.toUpperCase()}</span>
- </div>
- <div class="hotspot-popup-subtext">${escapeHtml(activityData.subtext)}</div>
- ${activityData.description ? `<div class="hotspot-popup-desc">${escapeHtml(activityData.description)}</div>` : ''}
- <div class="hotspot-popup-meta">
- <div class="hotspot-popup-meta-item">
- <span class="hotspot-popup-meta-label">Coordinates</span>
- <span class="hotspot-popup-meta-value">${activityData.lat.toFixed(2)}°${activityData.lat >= 0 ? 'N' : 'S'}, ${Math.abs(activityData.lon).toFixed(2)}°${activityData.lon >= 0 ? 'E' : 'W'}</span>
- </div>
- ${activityData.status ? `
- <div class="hotspot-popup-meta-item">
- <span class="hotspot-popup-meta-label">Status</span>
- <span class="hotspot-popup-meta-value">${escapeHtml(activityData.status)}</span>
- </div>
- ` : ''}
- </div>
- ${agenciesHTML}
- ${headlinesHTML.includes('hotspot-popup-headline') ? '<div class="hotspot-popup-headlines-title">Related Headlines</div>' : ''}
- <div class="hotspot-popup-headlines">
- ${headlinesHTML}
- </div>
- `;
-
- // Set popup class for styling based on threat level
- popup.className = `hotspot-popup visible ${activityData.level}`;
-
- // Position popup near the hotspot
- const hotspotRect = hotspotEl.getBoundingClientRect();
- const mapContainer = document.getElementById('worldMapContainer');
- const mapRect = mapContainer.getBoundingClientRect();
-
- // Calculate position relative to map container
- let left = hotspotRect.left - mapRect.left + 20;
- let top = hotspotRect.top - mapRect.top - 10;
-
- // Ensure popup stays within map bounds
- const popupWidth = 320;
- const popupHeight = 400;
-
- if (left + popupWidth > mapRect.width) {
- left = hotspotRect.left - mapRect.left - popupWidth - 20;
- }
- if (top + popupHeight > mapRect.height) {
- top = mapRect.height - popupHeight - 10;
- }
- if (top < 10) top = 10;
- if (left < 10) left = 10;
-
- popup.style.left = left + 'px';
- popup.style.top = top + 'px';
- }
-
- // Hide hotspot popup
- function hideHotspotPopup() {
- const popup = document.getElementById('hotspotPopup');
- if (popup) {
- popup.classList.remove('visible');
- }
- }
-
- // Show conflict zone popup
- function showConflictPopup(event, conflictId) {
- event.stopPropagation();
-
- const conflictEl = document.querySelector(`[data-conflict-id="${conflictId}"]`);
- if (!conflictEl) return;
-
- // Hide other popups
- hideHotspotPopup();
- hideChokepointPopup();
- hideQuakePopup();
- hideCyberPopup();
- hideCustomHotspotPopup();
- hideUSCityPopup();
- hideUSHotspotPopup();
-
- const conflictData = JSON.parse(decodeURIComponent(conflictEl.dataset.conflictInfo));
- const popup = document.getElementById('conflictPopup');
-
- // Find matching headlines from cachedNews
- let matchedHeadlines = [];
- if (window.cachedAllNews && conflictData.keywords) {
- matchedHeadlines = window.cachedAllNews.filter(item => {
- const title = (item.title || '').toLowerCase();
- return conflictData.keywords.some(kw => title.includes(kw.toLowerCase()));
- }).slice(0, 5);
- }
-
- // Build headlines HTML
- let headlinesHTML = '';
- if (matchedHeadlines.length > 0) {
- headlinesHTML = `
- <div class="conflict-popup-headlines-title">Related Headlines</div>
- <div class="conflict-popup-headlines">
- ${matchedHeadlines.map(h => `
- <div class="conflict-popup-headline">
- <div class="conflict-popup-headline-source">${escapeHtml(h.source || 'News')}</div>
- <a href="${h.link || '#'}" target="_blank">${escapeHtml(h.title)}</a>
- </div>
- `).join('')}
- </div>
- `;
- }
-
- // Build popup content
- popup.innerHTML = `
- <button class="conflict-popup-close" onclick="hideConflictPopup()">&times;</button>
- <div class="conflict-popup-header">
- <span class="conflict-popup-title">${escapeHtml(conflictData.name)}</span>
- <span class="conflict-popup-intensity ${conflictData.intensity}">${conflictData.intensity.toUpperCase()}</span>
- </div>
- <div class="conflict-popup-meta">
- <div class="conflict-popup-meta-item">
- <span class="conflict-popup-meta-label">Start Date</span>
- <span class="conflict-popup-meta-value">${escapeHtml(conflictData.startDate)}</span>
- </div>
- <div class="conflict-popup-meta-item">
- <span class="conflict-popup-meta-label">Casualties</span>
- <span class="conflict-popup-meta-value">${escapeHtml(conflictData.casualties)}</span>
- </div>
- <div class="conflict-popup-meta-item">
- <span class="conflict-popup-meta-label">Displaced</span>
- <span class="conflict-popup-meta-value">${escapeHtml(conflictData.displaced)}</span>
- </div>
- <div class="conflict-popup-meta-item">
- <span class="conflict-popup-meta-label">Location</span>
- <span class="conflict-popup-meta-value">${conflictData.labelPos.lat.toFixed(1)}°N, ${conflictData.labelPos.lon.toFixed(1)}°E</span>
- </div>
- </div>
- <div class="conflict-popup-desc">${escapeHtml(conflictData.description)}</div>
- <div class="conflict-popup-parties">
- <div class="conflict-popup-parties-title">Belligerents</div>
- ${conflictData.parties.map(p => `<span class="conflict-popup-party">${escapeHtml(p)}</span>`).join('')}
- </div>
- <div class="conflict-popup-events">
- <div class="conflict-popup-events-title">Key Developments</div>
- ${conflictData.keyEvents.map(e => `<div class="conflict-popup-event">${escapeHtml(e)}</div>`).join('')}
- </div>
- ${headlinesHTML}
- `;
-
- // Position popup
- popup.classList.add('visible');
-
- const conflictRect = conflictEl.getBoundingClientRect();
- const mapContainer = document.getElementById('worldMapContainer');
- const mapRect = mapContainer.getBoundingClientRect();
-
- let left = conflictRect.left - mapRect.left + 20;
- let top = conflictRect.top - mapRect.top - 10;
-
- const popupWidth = 380;
- const popupHeight = 450;
-
- if (left + popupWidth > mapRect.width) {
- left = conflictRect.left - mapRect.left - popupWidth - 20;
- }
- if (top + popupHeight > mapRect.height) {
- top = mapRect.height - popupHeight - 10;
- }
- if (top < 10) top = 10;
- if (left < 10) left = 10;
-
- popup.style.left = left + 'px';
- popup.style.top = top + 'px';
- }
-
- // Hide conflict popup
- function hideConflictPopup() {
- const popup = document.getElementById('conflictPopup');
- if (popup) {
- popup.classList.remove('visible');
- }
- }
-
- // Show US city popup
- function showUSCityPopup(event, cityId) {
- event.stopPropagation();
-
- const cityEl = document.querySelector(`[data-city-id="${cityId}"]`);
- if (!cityEl) return;
-
- // Hide other popups
- hideHotspotPopup();
- hideConflictPopup();
- hideChokepointPopup();
- hideQuakePopup();
- hideCyberPopup();
- hideCustomHotspotPopup();
- hideUSHotspotPopup();
-
- const cityData = JSON.parse(decodeURIComponent(cityEl.dataset.cityInfo));
- const popup = document.getElementById('usCityPopup');
-
- // Build headlines HTML
- let headlinesHTML = '';
- if (cityData.headlines && cityData.headlines.length > 0) {
- headlinesHTML = cityData.headlines.map(h => `
- <div class="us-city-popup-headline">
- <div class="us-city-popup-headline-source">${escapeHtml(h.source || 'News')}</div>
- <a href="${h.link || '#'}" target="_blank">${escapeHtml(h.title)}</a>
- </div>
- `).join('');
- } else {
- headlinesHTML = '<div style="padding: 1rem; color: #336688; font-size: 0.6rem; text-align: center;">No recent headlines for this city</div>';
- }
-
- // Build sectors HTML
- const sectorsHTML = cityData.sectors ? cityData.sectors.map(s =>
- `<span style="display: inline-block; font-size: 0.5rem; padding: 0.1rem 0.3rem; margin: 0.1rem; background: rgba(0, 170, 255, 0.1); border: 1px solid rgba(0, 170, 255, 0.2); color: #66aacc;">${escapeHtml(s)}</span>`
- ).join('') : '';
-
- popup.innerHTML = `
- <button class="us-city-popup-close" onclick="hideUSCityPopup()">&times;</button>
- <div class="us-city-popup-header">
- <span class="us-city-popup-title">${escapeHtml(cityData.name)}</span>
- <span class="us-city-popup-state">${escapeHtml(cityData.state)}</span>
- </div>
- <div class="us-city-popup-meta">
- <div>
- <span class="us-city-popup-meta-label">Population</span>
- <span class="us-city-popup-meta-value">${escapeHtml(cityData.population)}</span>
- </div>
- <div>
- <span class="us-city-popup-meta-label">News Matches</span>
- <span class="us-city-popup-meta-value">${cityData.matchCount || 0}</span>
- </div>
- <div>
- <span class="us-city-popup-meta-label">Coordinates</span>
- <span class="us-city-popup-meta-value">${cityData.lat.toFixed(2)}°N, ${Math.abs(cityData.lon).toFixed(2)}°W</span>
- </div>
- <div>
- <span class="us-city-popup-meta-label">Type</span>
- <span class="us-city-popup-meta-value">${cityData.type === 'capital' ? 'Capital' : cityData.type === 'major' ? 'Major Metro' : cityData.type === 'military' ? 'Military' : 'Regional'}</span>
- </div>
- </div>
- <div class="us-city-popup-desc">${escapeHtml(cityData.description)}</div>
- ${sectorsHTML ? `<div style="padding: 0.5rem 1rem; border-bottom: 1px solid rgba(0, 100, 170, 0.2);"><div style="font-size: 0.45rem; color: #336688; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.3rem;">Key Sectors</div>${sectorsHTML}</div>` : ''}
- <div class="us-city-popup-headlines-title">Related Headlines</div>
- <div class="us-city-popup-headlines">
- ${headlinesHTML}
- </div>
- `;
-
- popup.classList.add('visible');
-
- // Position popup
- const cityRect = cityEl.getBoundingClientRect();
- const mapContainer = document.getElementById('worldMapContainer');
- const mapRect = mapContainer.getBoundingClientRect();
-
- let left = cityRect.left - mapRect.left + 20;
- let top = cityRect.top - mapRect.top - 10;
-
- const popupWidth = 360;
- const popupHeight = 420;
-
- if (left + popupWidth > mapRect.width) {
- left = cityRect.left - mapRect.left - popupWidth - 20;
- }
- if (top + popupHeight > mapRect.height) {
- top = mapRect.height - popupHeight - 10;
- }
- if (top < 10) top = 10;
- if (left < 10) left = 10;
-
- popup.style.left = left + 'px';
- popup.style.top = top + 'px';
- }
-
- // Hide US city popup
- function hideUSCityPopup() {
- const popup = document.getElementById('usCityPopup');
- if (popup) {
- popup.classList.remove('visible');
- }
- }
-
- // Show US hotspot popup
- function showUSHotspotPopup(event, hotspotId) {
- event.stopPropagation();
-
- const hotspotEl = document.querySelector(`[data-us-hotspot-id="${hotspotId}"]`);
- if (!hotspotEl) return;
-
- // Hide other popups
- hideHotspotPopup();
- hideConflictPopup();
- hideChokepointPopup();
- hideQuakePopup();
- hideCyberPopup();
- hideCustomHotspotPopup();
- hideUSCityPopup();
-
- const hotspotData = JSON.parse(decodeURIComponent(hotspotEl.dataset.usHotspotInfo));
- const popup = document.getElementById('usHotspotPopup');
-
- // Build headlines HTML
- let headlinesHTML = '';
- if (hotspotData.headlines && hotspotData.headlines.length > 0) {
- headlinesHTML = hotspotData.headlines.map(h => `
- <div class="us-hotspot-popup-headline">
- <div class="us-hotspot-popup-headline-source">${escapeHtml(h.source || 'News')}</div>
- <a href="${h.link || '#'}" target="_blank">${escapeHtml(h.title)}</a>
- </div>
- `).join('');
- } else {
- headlinesHTML = '<div class="us-hotspot-popup-headline" style="color: #666;">No matching headlines found</div>';
- }
-
- popup.className = `us-hotspot-popup ${hotspotData.level}`;
- popup.innerHTML = `
- <button class="us-hotspot-popup-close" onclick="hideUSHotspotPopup()">&times;</button>
- <div class="us-hotspot-popup-header">
- <span class="us-hotspot-popup-title">${hotspotData.icon} ${escapeHtml(hotspotData.name)}</span>
- <span class="us-hotspot-popup-level ${hotspotData.level}">${hotspotData.level.toUpperCase()}</span>
- </div>
- <div class="us-hotspot-popup-meta">
- <div>
- <span class="us-hotspot-popup-meta-label">Location</span>
- <span class="us-hotspot-popup-meta-value">${escapeHtml(hotspotData.location)}</span>
- </div>
- <div>
- <span class="us-hotspot-popup-meta-label">Category</span>
- <span class="us-hotspot-popup-meta-value">${escapeHtml(hotspotData.category)}</span>
- </div>
- <div>
- <span class="us-hotspot-popup-meta-label">Since</span>
- <span class="us-hotspot-popup-meta-value">${escapeHtml(hotspotData.startDate)}</span>
- </div>
- <div>
- <span class="us-hotspot-popup-meta-label">Status</span>
- <span class="us-hotspot-popup-meta-value">${escapeHtml(hotspotData.status)}</span>
- </div>
- </div>
- <div class="us-hotspot-popup-desc">${escapeHtml(hotspotData.description)}</div>
- <div class="us-hotspot-popup-headlines-title">Related Headlines (${hotspotData.matchCount || 0})</div>
- <div class="us-hotspot-popup-headlines">
- ${headlinesHTML}
- </div>
- `;
-
- popup.classList.add('visible');
-
- // Position popup near the hotspot
- const mapRect = document.getElementById('worldMapContainer').getBoundingClientRect();
- const hotspotRect = hotspotEl.getBoundingClientRect();
- const popupWidth = 320;
- const popupHeight = 400;
-
- let left = hotspotRect.left - mapRect.left + 30;
- let top = hotspotRect.top - mapRect.top - 50;
-
- // Adjust if popup would go off screen
- if (left + popupWidth > mapRect.width) {
- left = hotspotRect.left - mapRect.left - popupWidth - 30;
- }
- if (top + popupHeight > mapRect.height) {
- top = mapRect.height - popupHeight - 10;
- }
- if (top < 10) top = 10;
- if (left < 10) left = 10;
-
- popup.style.left = left + 'px';
- popup.style.top = top + 'px';
- }
-
- // Hide US hotspot popup
- function hideUSHotspotPopup() {
- const popup = document.getElementById('usHotspotPopup');
- if (popup) {
- popup.classList.remove('visible');
- }
- }
-
- // Hide all map popups
- function hideAllPopups() {
- hideHotspotPopup();
- hideChokepointPopup();
- hideQuakePopup();
- hideCyberPopup();
- hideCustomHotspotPopup();
- hideConflictPopup();
- hideUSCityPopup();
- hideUSHotspotPopup();
- hideAircraftPopup();
- }
-
- // Escape HTML for popup content
- function escapeHtml(text) {
- if (!text) return '';
- const div = document.createElement('div');
- div.textContent = text;
- return div.innerHTML;
- }
-
- // Show chokepoint popup
- function showChokepointPopup(event, chokepointId) {
- event.stopPropagation();
-
- const cpEl = document.querySelector(`[data-chokepoint-id="${chokepointId}"]`);
- if (!cpEl) return;
-
- // Hide other popups
- hideHotspotPopup();
- hideQuakePopup();
- hideCyberPopup();
- hideCustomHotspotPopup();
- hideUSCityPopup();
- hideUSHotspotPopup();
- hideConflictPopup();
-
- const cpData = JSON.parse(decodeURIComponent(cpEl.dataset.chokepointInfo));
- const popup = document.getElementById('chokepointPopup');
-
- // Build headlines HTML
- let headlinesHTML = '';
- if (cpData.headlines && cpData.headlines.length > 0) {
- headlinesHTML = cpData.headlines.map(h => `
- <div class="chokepoint-popup-headline">
- <a href="${h.link || '#'}" target="_blank">${escapeHtml(h.title)}</a>
- </div>
- `).join('');
- } else {
- headlinesHTML = '<div class="chokepoint-popup-empty">No recent headlines for this chokepoint</div>';
- }
-
- // Build popup content
- popup.innerHTML = `
- <button class="chokepoint-popup-close" onclick="hideChokepointPopup()">&times;</button>
- <div class="chokepoint-popup-header">
- <span class="chokepoint-popup-title">${escapeHtml(cpData.name)}</span>
- <span class="chokepoint-popup-status ${cpData.isAlert ? 'alert' : 'normal'}">${cpData.isAlert ? 'ALERT' : 'NORMAL'}</span>
- </div>
- <div class="chokepoint-popup-info">
- <div class="chokepoint-popup-stat">
- <span class="chokepoint-popup-stat-label">Region</span>
- <span class="chokepoint-popup-stat-value">${escapeHtml(cpData.region)}</span>
- </div>
- <div class="chokepoint-popup-stat">
- <span class="chokepoint-popup-stat-label">Traffic</span>
- <span class="chokepoint-popup-stat-value">${escapeHtml(cpData.traffic)}</span>
- </div>
- </div>
- <div class="chokepoint-popup-desc">${escapeHtml(cpData.desc)}</div>
- <div class="chokepoint-popup-headlines">
- ${headlinesHTML}
- </div>
- `;
-
- // Set popup class for styling
- popup.className = `chokepoint-popup visible ${cpData.isAlert ? 'alert' : ''}`;
-
- // Position popup near the chokepoint
- const cpRect = cpEl.getBoundingClientRect();
- const mapContainer = document.getElementById('worldMapContainer');
- const mapRect = mapContainer.getBoundingClientRect();
-
- // Calculate position relative to map container
- let left = cpRect.left - mapRect.left + 20;
- let top = cpRect.top - mapRect.top - 10;
-
- // Ensure popup stays within map bounds
- const popupWidth = 280;
- const popupHeight = 300;
-
- if (left + popupWidth > mapRect.width) {
- left = cpRect.left - mapRect.left - popupWidth - 20;
- }
- if (top + popupHeight > mapRect.height) {
- top = mapRect.height - popupHeight - 10;
- }
- if (top < 10) top = 10;
- if (left < 10) left = 10;
-
- popup.style.left = left + 'px';
- popup.style.top = top + 'px';
- }
-
- // Hide chokepoint popup
- function hideChokepointPopup() {
- const popup = document.getElementById('chokepointPopup');
- if (popup) {
- popup.classList.remove('visible');
- }
- }
-
- // Show earthquake popup
- function showQuakePopup(event, quakeId) {
- event.stopPropagation();
-
- const quakeEl = document.querySelector(`[data-quake-id="${quakeId}"]`);
- if (!quakeEl) return;
-
- // Hide other popups
- hideHotspotPopup();
- hideChokepointPopup();
- hideCyberPopup();
- hideCustomHotspotPopup();
- hideUSCityPopup();
- hideUSHotspotPopup();
- hideConflictPopup();
-
- const eqData = JSON.parse(decodeURIComponent(quakeEl.dataset.quakeInfo));
- const popup = document.getElementById('quakePopup');
-
- const isMajor = eqData.mag >= 6.0;
- const isModerate = eqData.mag >= 5.0;
-
- // Determine severity label
- let severity = 'minor';
- let severityLabel = 'Minor';
- if (isMajor) {
- severity = 'major';
- severityLabel = 'Major';
- } else if (isModerate) {
- severity = 'moderate';
- severityLabel = 'Moderate';
- }
-
- // Format time
- const time = new Date(eqData.time);
- const timeStr = time.toLocaleString();
- const timeAgo = getTimeAgo(time);
-
- // USGS link
- const usgsLink = `https://earthquake.usgs.gov/earthquakes/eventpage/${eqData.id || ''}`;
-
- popup.innerHTML = `
- <button class="quake-popup-close" onclick="hideQuakePopup()">&times;</button>
- <div class="quake-popup-header">
- <span class="quake-popup-mag">M${eqData.mag.toFixed(1)}</span>
- <span class="quake-popup-severity ${severity}">${severityLabel}</span>
- </div>
- <div class="quake-popup-location">${escapeHtml(eqData.place)}</div>
- <div class="quake-popup-info">
- <div class="quake-popup-stat">
- <span class="quake-popup-stat-label">Depth</span>
- <span class="quake-popup-stat-value">${eqData.depth.toFixed(1)} km</span>
- </div>
- <div class="quake-popup-stat">
- <span class="quake-popup-stat-label">Coordinates</span>
- <span class="quake-popup-stat-value">${eqData.lat.toFixed(2)}°, ${eqData.lon.toFixed(2)}°</span>
- </div>
- <div class="quake-popup-stat">
- <span class="quake-popup-stat-label">Time</span>
- <span class="quake-popup-stat-value">${timeAgo}</span>
- </div>
- </div>
- <a href="${usgsLink}" target="_blank" class="quake-popup-link">View on USGS →</a>
- `;
-
- // Set popup class
- popup.className = `quake-popup visible ${isMajor ? 'major' : ''}`;
-
- // Position popup
- const quakeRect = quakeEl.getBoundingClientRect();
- const mapContainer = document.getElementById('worldMapContainer');
- const mapRect = mapContainer.getBoundingClientRect();
-
- let left = quakeRect.left - mapRect.left + 20;
- let top = quakeRect.top - mapRect.top - 10;
-
- const popupWidth = 260;
- const popupHeight = 220;
-
- if (left + popupWidth > mapRect.width) {
- left = quakeRect.left - mapRect.left - popupWidth - 20;
- }
- if (top + popupHeight > mapRect.height) {
- top = mapRect.height - popupHeight - 10;
- }
- if (top < 10) top = 10;
- if (left < 10) left = 10;
-
- popup.style.left = left + 'px';
- popup.style.top = top + 'px';
- }
-
- // Hide earthquake popup
- function hideQuakePopup() {
- const popup = document.getElementById('quakePopup');
- if (popup) {
- popup.classList.remove('visible');
- }
- }
-
- // Get time ago string
- function getTimeAgo(date) {
- const now = new Date();
- const diff = now - date;
- const minutes = Math.floor(diff / 60000);
- const hours = Math.floor(diff / 3600000);
- const days = Math.floor(diff / 86400000);
-
- if (minutes < 60) return `${minutes}m ago`;
- if (hours < 24) return `${hours}h ago`;
- return `${days}d ago`;
- }
-
- // Show cyber threat popup
- function showCyberPopup(event, cyberId) {
- event.stopPropagation();
-
- const cyberEl = document.querySelector(`[data-cyber-id="${cyberId}"]`);
- if (!cyberEl) return;
-
- // Hide other popups
- hideHotspotPopup();
- hideChokepointPopup();
- hideQuakePopup();
- hideCustomHotspotPopup();
- hideUSCityPopup();
- hideUSHotspotPopup();
- hideConflictPopup();
-
- const czData = JSON.parse(decodeURIComponent(cyberEl.dataset.cyberInfo));
- const popup = document.getElementById('cyberPopup');
-
- // Build targets HTML
- const targetsHTML = czData.targets.map(t =>
- `<span class="cyber-popup-target-tag">${escapeHtml(t)}</span>`
- ).join('');
-
- popup.innerHTML = `
- <button class="cyber-popup-close" onclick="hideCyberPopup()">&times;</button>
- <div class="cyber-popup-header">
- <span class="cyber-popup-title">${escapeHtml(czData.fullName)}</span>
- <span class="cyber-popup-status ${czData.isActive ? 'active' : 'dormant'}">${czData.isActive ? 'Active' : 'Dormant'}</span>
- </div>
- <div class="cyber-popup-apt">${escapeHtml(czData.group)} — ${escapeHtml(czData.aka)}</div>
- <div class="cyber-popup-desc">${escapeHtml(czData.desc)}</div>
- <div class="cyber-popup-info">
- <div class="cyber-popup-stat">
- <span class="cyber-popup-stat-label">State Sponsor</span>
- <span class="cyber-popup-stat-value">${escapeHtml(czData.sponsor)}</span>
- </div>
- <div class="cyber-popup-stat">
- <span class="cyber-popup-stat-label">Coordinates</span>
- <span class="cyber-popup-stat-value">${czData.lat.toFixed(1)}°, ${czData.lon.toFixed(1)}°</span>
- </div>
- </div>
- <div class="cyber-popup-targets">
- <div class="cyber-popup-targets-label">Primary Targets</div>
- <div class="cyber-popup-target-tags">${targetsHTML}</div>
- </div>
- `;
-
- // Set popup class
- popup.className = `cyber-popup visible ${czData.isActive ? 'active' : ''}`;
-
- // Position popup
- const cyberRect = cyberEl.getBoundingClientRect();
- const mapContainer = document.getElementById('worldMapContainer');
- const mapRect = mapContainer.getBoundingClientRect();
-
- let left = cyberRect.left - mapRect.left + 25;
- let top = cyberRect.top - mapRect.top - 10;
-
- const popupWidth = 280;
- const popupHeight = 300;
-
- if (left + popupWidth > mapRect.width) {
- left = cyberRect.left - mapRect.left - popupWidth - 25;
- }
- if (top + popupHeight > mapRect.height) {
- top = mapRect.height - popupHeight - 10;
- }
- if (top < 10) top = 10;
- if (left < 10) left = 10;
-
- popup.style.left = left + 'px';
- popup.style.top = top + 'px';
- }
-
- // Hide cyber threat popup
- function hideCyberPopup() {
- const popup = document.getElementById('cyberPopup');
- if (popup) {
- popup.classList.remove('visible');
- }
- }
-
- // Show custom hotspot popup
- function showCustomHotspotPopup(event, monitorId) {
- event.stopPropagation();
-
- const hotspotEl = document.querySelector(`[data-monitor-id="${monitorId}"]`);
- if (!hotspotEl) return;
-
- // Hide other popups
- hideHotspotPopup();
- hideChokepointPopup();
- hideQuakePopup();
- hideCyberPopup();
- hideUSCityPopup();
- hideUSHotspotPopup();
- hideConflictPopup();
-
- const monitorData = JSON.parse(decodeURIComponent(hotspotEl.dataset.monitorInfo));
- const popup = document.getElementById('customHotspotPopup');
- if (!popup) return;
-
- let matchesHTML = '';
- if (monitorData.matches && monitorData.matches.length > 0) {
- matchesHTML = monitorData.matches.map(m => `
- <div class="custom-hotspot-popup-match">
- <a href="${m.link}" target="_blank">${m.title}</a>
- <div class="custom-hotspot-popup-match-source">${m.source || 'News'}</div>
- </div>
- `).join('');
- } else {
- matchesHTML = '<div class="custom-hotspot-popup-empty">No matching headlines</div>';
- }
-
- popup.innerHTML = `
- <button class="custom-hotspot-popup-close" onclick="hideCustomHotspotPopup()">×</button>
- <div class="custom-hotspot-popup-header">
- <div class="custom-hotspot-popup-dot" style="background: ${monitorData.color};"></div>
- <div class="custom-hotspot-popup-name" style="color: ${monitorData.color};">${monitorData.name}</div>
- <div class="custom-hotspot-popup-count">${monitorData.matchCount} matches</div>
- </div>
- <div class="custom-hotspot-popup-keywords">
- <strong>Keywords:</strong> ${monitorData.keywords.join(', ')}
- </div>
- <div class="custom-hotspot-popup-coords">
- 📍 ${monitorData.lat.toFixed(4)}, ${monitorData.lon.toFixed(4)}
- </div>
- <div class="custom-hotspot-popup-matches">
- ${matchesHTML}
- </div>
- `;
-
- // Position the popup
- const container = document.getElementById('worldMapContainer');
- const containerRect = container.getBoundingClientRect();
- const hotspotRect = hotspotEl.getBoundingClientRect();
-
- let left = hotspotRect.left - containerRect.left + 20;
- let top = hotspotRect.top - containerRect.top;
-
- // Keep within bounds
- if (left + 300 > containerRect.width) {
- left = hotspotRect.left - containerRect.left - 310;
- }
- if (top + 250 > containerRect.height) {
- top = containerRect.height - 260;
- }
- if (top < 10) top = 10;
-
- popup.style.left = left + 'px';
- popup.style.top = top + 'px';
- popup.classList.add('visible');
- }
-
- // Hide custom hotspot popup
- function hideCustomHotspotPopup() {
- const popup = document.getElementById('customHotspotPopup');
- if (popup) {
- popup.classList.remove('visible');
- }
- }
-
- // Calculate news density for each region
- function calculateNewsDensity(allNews) {
- const scores = {};
- NEWS_REGIONS.forEach(region => {
- let score = 0;
- allNews.forEach(item => {
- const title = (item.title || '').toLowerCase();
- region.keywords.forEach(kw => {
- if (title.includes(kw)) score++;
- });
- if (item.isAlert) score += 2; // Boost for alerts
- });
- scores[region.id] = score;
- });
- return scores;
- }
-
- // Toggle map layer visibility
- function toggleLayer(layerName) {
- mapLayers[layerName] = !mapLayers[layerName];
- // Re-render the map to apply changes
- refreshAll();
- }
-
- // Toggle satellite layer with special handling
- function toggleSatelliteLayer() {
- mapLayers.satellite = !mapLayers.satellite;
-
- const canvas = document.getElementById('satelliteCanvas');
- const attribution = document.getElementById('satelliteAttribution');
- const svg = document.getElementById('worldMapSVG');
-
- if (mapLayers.satellite) {
- // Show loading indicator
- const loading = document.getElementById('satelliteLoading');
- if (loading) loading.classList.add('visible');
-
- // Render satellite tiles
- renderSatelliteTiles().then(() => {
- if (loading) loading.classList.remove('visible');
- if (canvas) canvas.classList.add('visible');
- if (attribution) attribution.classList.add('visible');
- // Make SVG semi-transparent to show satellite underneath
- if (svg) svg.style.opacity = '0.7';
- });
- } else {
- if (canvas) canvas.classList.remove('visible');
- if (attribution) attribution.classList.remove('visible');
- if (svg) svg.style.opacity = '1';
- }
-
- // Refresh to update button state
- refreshAll();
- }
-
- // Render satellite tiles to canvas
- async function renderSatelliteTiles() {
- const canvas = document.getElementById('satelliteCanvas');
- if (!canvas) return;
-
- const container = document.getElementById('worldMapContainer');
- const width = container.offsetWidth || 800;
- const height = container.offsetHeight || 550;
-
- canvas.width = width;
- canvas.height = height;
-
- const ctx = canvas.getContext('2d');
-
- // Determine tile parameters based on view
- const isUSView = mapViewMode === 'us';
- const isMidEastView = mapViewMode === 'mideast';
- const isUkraineView = mapViewMode === 'ukraine';
-
- let bounds, zoom;
-
- if (isUSView) {
- bounds = { north: 50, south: 24, east: -66, west: -125 };
- zoom = 4;
- } else if (isMidEastView) {
- bounds = { north: 42, south: 12, east: 63, west: 25 };
- zoom = 4;
- } else if (isUkraineView) {
- bounds = { north: 58, south: 42, east: 45, west: 22 };
- zoom = 4;
- } else if (isTaiwanView) {
- bounds = { north: 42, south: 5, east: 145, west: 100 };
- zoom = 4;
- } else {
- bounds = { north: 85, south: -85, east: 180, west: -180 };
- zoom = 2;
- }
-
- // Calculate tile range
- const tileCount = Math.pow(2, zoom);
-
- // Convert bounds to tile coordinates
- const minTileX = Math.floor((bounds.west + 180) / 360 * tileCount);
- const maxTileX = Math.floor((bounds.east + 180) / 360 * tileCount);
- const minTileY = Math.floor((1 - Math.log(Math.tan(bounds.north * Math.PI / 180) + 1 / Math.cos(bounds.north * Math.PI / 180)) / Math.PI) / 2 * tileCount);
- const maxTileY = Math.floor((1 - Math.log(Math.tan(bounds.south * Math.PI / 180) + 1 / Math.cos(bounds.south * Math.PI / 180)) / Math.PI) / 2 * tileCount);
-
- // Load and draw tiles
- const tilePromises = [];
-
- for (let x = minTileX; x <= maxTileX; x++) {
- for (let y = minTileY; y <= maxTileY; y++) {
- const tileX = ((x % tileCount) + tileCount) % tileCount; // Handle wrapping
- const tileY = Math.max(0, Math.min(tileCount - 1, y));
-
- const url = SATELLITE_CONFIG.esri.url
- .replace('{z}', zoom)
- .replace('{x}', tileX)
- .replace('{y}', tileY);
-
- const promise = loadTileImage(url).then(img => {
- if (!img) return;
-
- // Calculate tile position on canvas
- const tileLonWidth = 360 / tileCount;
- const tileLon = x * tileLonWidth - 180;
-
- // Mercator Y calculation
- const n = Math.PI - 2 * Math.PI * tileY / tileCount;
- const tileLat = 180 / Math.PI * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)));
-
- const n2 = Math.PI - 2 * Math.PI * (tileY + 1) / tileCount;
- const tileLat2 = 180 / Math.PI * Math.atan(0.5 * (Math.exp(n2) - Math.exp(-n2)));
-
- // Convert to canvas coordinates
- const canvasX = ((tileLon - bounds.west) / (bounds.east - bounds.west)) * width;
- const canvasX2 = ((tileLon + tileLonWidth - bounds.west) / (bounds.east - bounds.west)) * width;
- const canvasY = ((bounds.north - tileLat) / (bounds.north - bounds.south)) * height;
- const canvasY2 = ((bounds.north - tileLat2) / (bounds.north - bounds.south)) * height;
-
- const tileWidth = canvasX2 - canvasX;
- const tileHeight = canvasY2 - canvasY;
-
- ctx.drawImage(img, canvasX, canvasY, tileWidth, tileHeight);
- }).catch(e => {
- console.warn('Tile load failed:', e);
- });
-
- tilePromises.push(promise);
- }
- }
-
- await Promise.all(tilePromises);
- }
-
- // Load a single tile image
- function loadTileImage(url) {
- return new Promise((resolve, reject) => {
- const img = new Image();
- img.crossOrigin = 'anonymous';
- img.onload = () => resolve(img);
- img.onerror = () => resolve(null); // Resolve with null on error to continue
- img.src = url;
-
- // Timeout after 10 seconds
- setTimeout(() => resolve(null), 10000);
- });
- }
-
- // Fetch flight data from OpenSky Network API
- async function fetchFlightData(bounds = null) {
- const now = Date.now();
-
- // Return cached data if still valid
- if (flightDataCache && (now - flightDataTimestamp) < FLIGHT_CACHE_DURATION) {
- return flightDataCache;
- }
-
- try {
- // OpenSky Network API - anonymous access (limited)
- let url = 'https://opensky-network.org/api/states/all';
-
- // Add bounding box if provided (lamin, lomin, lamax, lomax)
- if (bounds) {
- url += `?lamin=${bounds.south}&lomin=${bounds.west}&lamax=${bounds.north}&lomax=${bounds.east}`;
- }
-
- const response = await fetch(url);
- if (!response.ok) {
- throw new Error(`HTTP ${response.status}`);
- }
-
- const data = await response.json();
-
- // Parse OpenSky response format
- // [0] icao24, [1] callsign, [2] origin_country, [3] time_position, [4] last_contact,
- // [5] longitude, [6] latitude, [7] baro_altitude, [8] on_ground, [9] velocity,
- // [10] true_track, [11] vertical_rate, [12] sensors, [13] geo_altitude,
- // [14] squawk, [15] spi, [16] position_source
- const flights = (data.states || []).slice(0, 500).map(s => ({
- icao24: s[0],
- callsign: (s[1] || '').trim(),
- country: s[2],
- lon: s[5],
- lat: s[6],
- altitude: s[7] || s[13], // baro or geo altitude
- onGround: s[8],
- velocity: s[9], // m/s
- heading: s[10], // degrees from north
- verticalRate: s[11],
- squawk: s[14]
- })).filter(f => f.lat && f.lon && !f.onGround); // Only airborne with positions
-
- flightDataCache = flights;
- flightDataTimestamp = now;
-
- return flights;
- } catch (error) {
- console.error('Failed to fetch flight data:', error);
- return flightDataCache || []; // Return stale cache on error
- }
- }
-
- // Classify aircraft type based on callsign patterns
- function classifyAircraft(callsign, country) {
- const cs = (callsign || '').toUpperCase();
-
- // Military patterns
- if (/^(RCH|JAKE|DUKE|EVAC|AIR|RRR|NAVY|ARMY|USAF|RAF|IAF)/i.test(cs) ||
- ['United States', 'Russia', 'China'].includes(country) && /^\d{5,}$/.test(cs)) {
- return 'military';
- }
-
- // Cargo/freight patterns
- if (/^(FDX|UPS|DHL|GTI|ABX|ATN|CLX)/i.test(cs)) {
- return 'cargo';
- }
-
- // Helicopter patterns (often shorter callsigns)
- if (cs.length <= 4 && /^[A-Z]{1,2}\d{2,3}$/.test(cs)) {
- return 'helicopter';
- }
-
- return 'commercial';
- }
-
- // Get aircraft direction arrow based on heading
- function getAircraftArrow(heading) {
- if (heading === null || heading === undefined) return '✈';
- const normalized = ((heading % 360) + 360) % 360;
- if (normalized >= 337.5 || normalized < 22.5) return '↑';
- if (normalized >= 22.5 && normalized < 67.5) return '↗';
- if (normalized >= 67.5 && normalized < 112.5) return '→';
- if (normalized >= 112.5 && normalized < 157.5) return '↘';
- if (normalized >= 157.5 && normalized < 202.5) return '↓';
- if (normalized >= 202.5 && normalized < 247.5) return '↙';
- if (normalized >= 247.5 && normalized < 292.5) return '←';
- if (normalized >= 292.5 && normalized < 337.5) return '↖';
- return '✈';
- }
-
- // Show aircraft popup
- function showAircraftPopup(event, flightData) {
- event.stopPropagation();
-
- // Hide other popups
- hideAllPopups();
-
- const popup = document.getElementById('aircraftPopup');
- if (!popup) return;
-
- const flight = JSON.parse(decodeURIComponent(flightData));
-
- const altitudeFt = flight.altitude ? Math.round(flight.altitude * 3.28084) : 'N/A';
- const speedKts = flight.velocity ? Math.round(flight.velocity * 1.94384) : 'N/A';
- const verticalFpm = flight.verticalRate ? Math.round(flight.verticalRate * 196.85) : 0;
- const verticalIndicator = verticalFpm > 100 ? '↑' : verticalFpm < -100 ? '↓' : '→';
-
- popup.innerHTML = `
- <div class="aircraft-popup-header">
- <span class="aircraft-callsign">${flight.callsign || flight.icao24}</span>
- <span class="aircraft-type-badge">${classifyAircraft(flight.callsign, flight.country)}</span>
- </div>
- <div class="aircraft-details">
- <div class="aircraft-detail-row">
- <span class="aircraft-detail-label">ICAO24</span>
- <span class="aircraft-detail-value">${flight.icao24}</span>
- </div>
- <div class="aircraft-detail-row">
- <span class="aircraft-detail-label">Country</span>
- <span class="aircraft-detail-value">${flight.country || 'Unknown'}</span>
- </div>
- <div class="aircraft-detail-row">
- <span class="aircraft-detail-label">Altitude</span>
- <span class="aircraft-detail-value">${altitudeFt} ft ${verticalIndicator}</span>
- </div>
- <div class="aircraft-detail-row">
- <span class="aircraft-detail-label">Speed</span>
- <span class="aircraft-detail-value">${speedKts} kts</span>
- </div>
- <div class="aircraft-detail-row">
- <span class="aircraft-detail-label">Heading</span>
- <span class="aircraft-detail-value">${flight.heading ? Math.round(flight.heading) + '°' : 'N/A'}</span>
- </div>
- ${flight.squawk ? `
- <div class="aircraft-detail-row">
- <span class="aircraft-detail-label">Squawk</span>
- <span class="aircraft-detail-value">${flight.squawk}</span>
- </div>
- ` : ''}
- </div>
- `;
-
- // Position popup near click
- const rect = event.target.getBoundingClientRect();
- const mapContainer = document.getElementById('worldMapContainer');
- const mapRect = mapContainer.getBoundingClientRect();
-
- let left = rect.left - mapRect.left + 20;
- let top = rect.top - mapRect.top;
-
- // Keep popup in bounds
- if (left + 250 > mapRect.width) left = rect.left - mapRect.left - 220;
- if (top + 200 > mapRect.height) top = mapRect.height - 210;
-
- popup.style.left = `${left}px`;
- popup.style.top = `${top}px`;
- popup.classList.add('visible');
- }
-
- // Hide aircraft popup
- function hideAircraftPopup() {
- const popup = document.getElementById('aircraftPopup');
- if (popup) popup.classList.remove('visible');
- }
-
- // Update flashback time display
- function updateFlashback(hoursAgo) {
- const flashbackTime = document.getElementById('flashbackTime');
- const flashbackIndicator = document.getElementById('flashbackIndicator');
-
- if (parseInt(hoursAgo) === 0) {
- flashbackTime.textContent = 'LIVE';
- if (flashbackIndicator) flashbackIndicator.classList.remove('active');
- } else {
- const now = new Date();
- now.setHours(now.getHours() - parseInt(hoursAgo));
- flashbackTime.textContent = `-${hoursAgo}h`;
- if (flashbackIndicator) flashbackIndicator.classList.add('active');
- }
- // Note: In a real implementation, this would fetch historical data
- // For now, it just updates the display as a UI demonstration
- }
-
- // ========== CUSTOM MONITORS ==========
-
- const MONITOR_COLORS = [
- '#00ff88', '#ff6600', '#00aaff', '#ff00ff', '#ffcc00',
- '#ff3366', '#33ccff', '#99ff33', '#ff6699', '#00ffcc'
- ];
-
- // Load monitors from localStorage
- function loadMonitors() {
- try {
- const data = localStorage.getItem('customMonitors');
- return data ? JSON.parse(data) : [];
- } catch (e) {
- console.error('Failed to load monitors:', e);
- return [];
- }
- }
-
- // Save monitors to localStorage
- function saveMonitors(monitors) {
- try {
- localStorage.setItem('customMonitors', JSON.stringify(monitors));
- } catch (e) {
- console.error('Failed to save monitors:', e);
- }
- }
-
- // Render monitors list in settings
- function renderMonitorsList() {
- const monitors = loadMonitors();
- const container = document.getElementById('monitorsList');
- if (!container) return;
-
- if (monitors.length === 0) {
- container.innerHTML = '<div style="font-size: 0.6rem; color: var(--text-dim); padding: 0.5rem 0;">No monitors yet</div>';
- return;
- }
-
- container.innerHTML = monitors.map(m => `
- <div class="monitor-item">
- <div class="monitor-item-info">
- <div class="monitor-item-name">
- <div class="monitor-item-color" style="background: ${m.color};"></div>
- ${m.name}
- </div>
- <div class="monitor-item-keywords">${m.keywords.join(', ')}</div>
- ${m.lat && m.lon ? `<div class="monitor-item-location">📍 ${m.lat.toFixed(2)}, ${m.lon.toFixed(2)}</div>` : ''}
- </div>
- <div class="monitor-item-actions">
- <button class="monitor-item-btn" onclick="editMonitor('${m.id}')" title="Edit">✎</button>
- <button class="monitor-item-btn delete" onclick="deleteMonitor('${m.id}')" title="Delete">✕</button>
- </div>
- </div>
- `).join('');
- }
-
- // Open monitor form (for add or edit)
- function openMonitorForm(monitorId = null) {
- const overlay = document.getElementById('monitorFormOverlay');
- const titleEl = document.getElementById('monitorFormTitle');
- const editIdEl = document.getElementById('monitorEditId');
- const nameEl = document.getElementById('monitorName');
- const keywordsEl = document.getElementById('monitorKeywords');
- const latEl = document.getElementById('monitorLat');
- const lonEl = document.getElementById('monitorLon');
- const colorsContainer = document.getElementById('monitorColors');
-
- // Render color options
- colorsContainer.innerHTML = MONITOR_COLORS.map((c, i) =>
- `<div class="monitor-color-option" style="background: ${c};" data-color="${c}" onclick="selectMonitorColor('${c}')"></div>`
- ).join('');
-
- if (monitorId) {
- // Edit mode
- const monitors = loadMonitors();
- const monitor = monitors.find(m => m.id === monitorId);
- if (monitor) {
- titleEl.textContent = 'Edit Monitor';
- editIdEl.value = monitorId;
- nameEl.value = monitor.name;
- keywordsEl.value = monitor.keywords.join(', ');
- latEl.value = monitor.lat || '';
- lonEl.value = monitor.lon || '';
- selectMonitorColor(monitor.color);
- }
- } else {
- // Add mode
- titleEl.textContent = 'Add Monitor';
- editIdEl.value = '';
- nameEl.value = '';
- keywordsEl.value = '';
- latEl.value = '';
- lonEl.value = '';
- selectMonitorColor(MONITOR_COLORS[0]);
- }
-
- overlay.classList.add('open');
- }
-
- // Close monitor form
- function closeMonitorForm() {
- document.getElementById('monitorFormOverlay').classList.remove('open');
- }
-
- // Select a monitor color
- function selectMonitorColor(color) {
- document.querySelectorAll('.monitor-color-option').forEach(el => {
- el.classList.toggle('selected', el.dataset.color === color);
- });
- }
-
- // Get currently selected color
- function getSelectedMonitorColor() {
- const selected = document.querySelector('.monitor-color-option.selected');
- return selected ? selected.dataset.color : MONITOR_COLORS[0];
- }
-
- // Save monitor (add or update)
- function saveMonitor() {
- const editId = document.getElementById('monitorEditId').value;
- const name = document.getElementById('monitorName').value.trim();
- const keywordsRaw = document.getElementById('monitorKeywords').value.trim();
- const lat = parseFloat(document.getElementById('monitorLat').value);
- const lon = parseFloat(document.getElementById('monitorLon').value);
- const color = getSelectedMonitorColor();
-
- if (!name) {
- alert('Please enter a name');
- return;
- }
- if (!keywordsRaw) {
- alert('Please enter at least one keyword');
- return;
- }
-
- const keywords = keywordsRaw.split(',').map(k => k.trim().toLowerCase()).filter(k => k);
-
- const monitor = {
- id: editId || `monitor_${Date.now()}`,
- name,
- keywords,
- color,
- lat: isNaN(lat) ? null : lat,
- lon: isNaN(lon) ? null : lon,
- createdAt: editId ? undefined : new Date().toISOString()
- };
-
- const monitors = loadMonitors();
- if (editId) {
- // Update existing
- const idx = monitors.findIndex(m => m.id === editId);
- if (idx !== -1) {
- monitor.createdAt = monitors[idx].createdAt;
- monitors[idx] = monitor;
- }
- } else {
- // Add new
- monitors.push(monitor);
- }
-
- saveMonitors(monitors);
- closeMonitorForm();
- renderMonitorsList();
- refreshAll(); // Refresh to show on map and in panel
- }
-
- // Edit a monitor
- function editMonitor(id) {
- openMonitorForm(id);
- }
-
- // Delete a monitor
- function deleteMonitor(id) {
- if (!confirm('Delete this monitor?')) return;
- const monitors = loadMonitors().filter(m => m.id !== id);
- saveMonitors(monitors);
- renderMonitorsList();
- refreshAll();
- }
-
- // Scan news for monitor matches
- function scanMonitorsForMatches(allNews) {
- const monitors = loadMonitors();
- const results = {};
-
- monitors.forEach(monitor => {
- const matches = [];
- allNews.forEach(item => {
- const title = (item.title || '').toLowerCase();
- const matched = monitor.keywords.some(kw => title.includes(kw));
- if (matched) {
- matches.push({
- title: item.title,
- link: item.link,
- source: item.source,
- monitorId: monitor.id,
- monitorName: monitor.name,
- monitorColor: monitor.color
- });
- }
- });
- results[monitor.id] = {
- monitor,
- matches: matches.slice(0, 10), // Limit per monitor
- count: matches.length
- };
- });
-
- return results;
- }
-
- // Render the My Monitors panel
- function renderMonitorsPanel(allNews) {
- const panel = document.getElementById('monitorsPanel');
- const countEl = document.getElementById('monitorsCount');
- if (!panel) return;
-
- const monitors = loadMonitors();
- if (monitors.length === 0) {
- panel.innerHTML = `
- <div class="monitors-empty">
- No monitors configured
- <div class="monitors-empty-hint">Click Settings → Add Monitor to get started</div>
- </div>
- `;
- countEl.textContent = '-';
- return;
- }
-
- const results = scanMonitorsForMatches(allNews);
- let allMatches = [];
-
- Object.values(results).forEach(r => {
- allMatches = allMatches.concat(r.matches);
- });
-
- if (allMatches.length === 0) {
- panel.innerHTML = `
- <div class="monitors-empty">
- No matches found
- <div class="monitors-empty-hint">Your ${monitors.length} monitor(s) found no matching headlines</div>
- </div>
- `;
- countEl.textContent = '0';
- return;
- }
-
- // Sort by most recent (based on order in allNews)
- countEl.textContent = allMatches.length;
- panel.innerHTML = allMatches.slice(0, 20).map(match => `
- <div class="monitor-match">
- <div class="monitor-match-header">
- <div class="monitor-match-dot" style="background: ${match.monitorColor};"></div>
- <span class="monitor-match-name">${match.monitorName}</span>
- </div>
- <a href="${match.link}" target="_blank" class="monitor-match-title">${match.title}</a>
- <div class="monitor-match-source">${match.source || 'News'}</div>
- </div>
- `).join('');
- }
-
- // Get monitor data for map hotspots
- function getMonitorHotspots(allNews) {
- const monitors = loadMonitors().filter(m => m.lat && m.lon);
- const results = scanMonitorsForMatches(allNews);
-
- return monitors.map(m => ({
- ...m,
- matchCount: results[m.id]?.count || 0,
- matches: results[m.id]?.matches || []
- }));
- }
-
- // Fetch Congressional trades - uses news RSS since APIs are locked down
- async function fetchCongressTrades() {
- try {
- // Try Google News RSS for congress stock trading news
- const searchTerms = encodeURIComponent('congress stock trading pelosi tuberville');
- const rssUrl = `https://news.google.com/rss/search?q=${searchTerms}&hl=en-US&gl=US&ceid=US:en`;
-
- const text = await fetchWithProxy(rssUrl);
- const parser = new DOMParser();
- const xml = parser.parseFromString(text, 'text/xml');
- const items = xml.querySelectorAll('item');
-
- if (items.length > 0) {
- const trades = extractTradesFromNews(Array.from(items).slice(0, 15));
- if (trades.length >= 3) {
- console.log('Congress trades extracted from news');
- return trades;
- }
- }
- } catch (e) {
- console.log('News fetch failed:', e.message);
- }
-
- // Fallback: Recent trades with dynamic dates
- return getRecentNotableTrades();
- }
-
- // Extract trade info from news headlines
- function extractTradesFromNews(items) {
- const trades = [];
- const members = {
- 'pelosi': { name: 'Nancy Pelosi', party: 'D', district: 'CA-11' },
- 'tuberville': { name: 'Tommy Tuberville', party: 'R', district: 'Senate' },
- 'crenshaw': { name: 'Dan Crenshaw', party: 'R', district: 'TX-02' },
- 'greene': { name: 'Marjorie Taylor Greene', party: 'R', district: 'GA-14' },
- 'khanna': { name: 'Ro Khanna', party: 'D', district: 'CA-17' },
- 'gottheimer': { name: 'Josh Gottheimer', party: 'D', district: 'NJ-05' },
- 'mccaul': { name: 'Michael McCaul', party: 'R', district: 'TX-10' },
- 'ossoff': { name: 'Jon Ossoff', party: 'D', district: 'Senate' },
- 'cruz': { name: 'Ted Cruz', party: 'R', district: 'Senate' }
- };
- const tickers = ['NVDA', 'AAPL', 'MSFT', 'GOOGL', 'META', 'TSLA', 'AMZN', 'AMD', 'AVGO', 'CRM', 'PLTR'];
-
- items.forEach(item => {
- const title = (item.querySelector('title')?.textContent || '').toLowerCase();
- const pubDate = item.querySelector('pubDate')?.textContent || new Date().toISOString();
-
- for (const [key, member] of Object.entries(members)) {
- if (title.includes(key)) {
- const isBuy = title.includes('buy') || title.includes('purchase') || title.includes('bought');
- const isSell = title.includes('sell') || title.includes('sold') || title.includes('sale');
-
- let ticker = tickers.find(t => title.includes(t.toLowerCase())) || 'STOCK';
-
- if (isBuy || isSell || title.includes('trade') || title.includes('stock')) {
- trades.push({
- ...member,
- ticker,
- type: isSell ? 'sell' : 'buy',
- amount: 'Disclosed',
- date: pubDate
- });
- }
- }
- }
- });
-
- return trades.slice(0, 10);
- }
-
- // Fallback - recent trades with dynamically calculated dates
- function getRecentNotableTrades() {
- const today = new Date();
- const daysAgo = (n) => {
- const d = new Date(today);
- d.setDate(d.getDate() - n);
- return d.toISOString().split('T')[0];
- };
-
- // Real congressional traders known for active trading
- return [
- { name: 'Nancy Pelosi', party: 'D', ticker: 'NVDA', type: 'buy', amount: '$1M - $5M', date: daysAgo(2), district: 'CA-11' },
- { name: 'Tommy Tuberville', party: 'R', ticker: 'PLTR', type: 'buy', amount: '$250K - $500K', date: daysAgo(4), district: 'Senate' },
- { name: 'Dan Crenshaw', party: 'R', ticker: 'MSFT', type: 'buy', amount: '$100K - $250K', date: daysAgo(6), district: 'TX-02' },
- { name: 'Ro Khanna', party: 'D', ticker: 'GOOGL', type: 'buy', amount: '$50K - $100K', date: daysAgo(8), district: 'CA-17' },
- { name: 'Josh Gottheimer', party: 'D', ticker: 'META', type: 'buy', amount: '$100K - $250K', date: daysAgo(10), district: 'NJ-05' },
- { name: 'Marjorie Taylor Greene', party: 'R', ticker: 'TSLA', type: 'buy', amount: '$15K - $50K', date: daysAgo(12), district: 'GA-14' },
- { name: 'Michael McCaul', party: 'R', ticker: 'RTX', type: 'buy', amount: '$500K - $1M', date: daysAgo(14), district: 'TX-10' },
- { name: 'Nancy Pelosi', party: 'D', ticker: 'AAPL', type: 'sell', amount: '$500K - $1M', date: daysAgo(18), district: 'CA-11' },
- { name: 'Mark Green', party: 'R', ticker: 'LMT', type: 'buy', amount: '$50K - $100K', date: daysAgo(21), district: 'TN-07' },
- { name: 'Tommy Tuberville', party: 'R', ticker: 'XOM', type: 'buy', amount: '$100K - $250K', date: daysAgo(25), district: 'Senate' }
- ];
- }
-
- // Fetch whale transactions
- async function fetchWhaleTransactions() {
- try {
- // Use Blockchain.com API for recent large BTC transactions
- const text = await fetchWithProxy('https://blockchain.info/unconfirmed-transactions?format=json');
- const data = JSON.parse(text);
-
- // Filter for large transactions (> 10 BTC)
- const btcPrice = 100000; // Approximate, will be updated
- const whales = data.txs
- .map(tx => {
- const totalOut = tx.out.reduce((sum, o) => sum + o.value, 0) / 100000000;
- return {
- coin: 'BTC',
- amount: totalOut,
- usd: totalOut * btcPrice,
- hash: tx.hash.substring(0, 8) + '...',
- time: new Date(tx.time * 1000)
- };
- })
- .filter(tx => tx.amount >= 10)
- .sort((a, b) => b.amount - a.amount)
- .slice(0, 15);
-
- return whales;
- } catch (error) {
- console.error('Error fetching whale transactions:', error);
- // Fallback: simulate with placeholder data showing the feature
- return [];
- }
- }
-
- // ==================== CORRELATION ENGINE ====================
-
- // Topic extraction patterns for correlation detection
- const CORRELATION_TOPICS = [
- { id: 'tariffs', patterns: [/tariff/i, /trade war/i, /import tax/i, /customs duty/i], category: 'Economy' },
- { id: 'fed-rates', patterns: [/federal reserve/i, /interest rate/i, /rate cut/i, /rate hike/i, /powell/i, /fomc/i], category: 'Economy' },
- { id: 'inflation', patterns: [/inflation/i, /cpi/i, /consumer price/i, /cost of living/i], category: 'Economy' },
- { id: 'ai-regulation', patterns: [/ai regulation/i, /artificial intelligence.*law/i, /ai safety/i, /ai governance/i], category: 'Tech' },
- { id: 'china-tensions', patterns: [/china.*taiwan/i, /south china sea/i, /us.*china/i, /beijing.*washington/i], category: 'Geopolitics' },
- { id: 'russia-ukraine', patterns: [/ukraine/i, /zelensky/i, /putin.*war/i, /crimea/i, /donbas/i], category: 'Conflict' },
- { id: 'israel-gaza', patterns: [/gaza/i, /hamas/i, /netanyahu/i, /israel.*attack/i, /hostage/i], category: 'Conflict' },
- { id: 'iran', patterns: [/iran.*nuclear/i, /tehran/i, /ayatollah/i, /iranian.*strike/i], category: 'Geopolitics' },
- { id: 'crypto', patterns: [/bitcoin/i, /crypto.*regulation/i, /ethereum/i, /sec.*crypto/i], category: 'Finance' },
- { id: 'housing', patterns: [/housing market/i, /mortgage rate/i, /home price/i, /real estate.*crash/i], category: 'Economy' },
- { id: 'layoffs', patterns: [/layoff/i, /job cut/i, /workforce reduction/i, /downsizing/i], category: 'Business' },
- { id: 'bank-crisis', patterns: [/bank.*fail/i, /banking crisis/i, /fdic/i, /bank run/i], category: 'Finance' },
- { id: 'election', patterns: [/election/i, /polling/i, /campaign/i, /ballot/i, /voter/i], category: 'Politics' },
- { id: 'immigration', patterns: [/immigration/i, /border.*crisis/i, /migrant/i, /deportation/i, /asylum/i], category: 'Politics' },
- { id: 'climate', patterns: [/climate change/i, /wildfire/i, /hurricane/i, /extreme weather/i, /flood/i], category: 'Environment' },
- { id: 'pandemic', patterns: [/pandemic/i, /outbreak/i, /virus.*spread/i, /who.*emergency/i, /bird flu/i], category: 'Health' },
- { id: 'nuclear', patterns: [/nuclear.*threat/i, /nuclear weapon/i, /atomic/i, /icbm/i], category: 'Security' },
- { id: 'supply-chain', patterns: [/supply chain/i, /shipping.*delay/i, /port.*congestion/i, /logistics.*crisis/i], category: 'Economy' },
- { id: 'big-tech', patterns: [/antitrust.*tech/i, /google.*monopoly/i, /meta.*lawsuit/i, /apple.*doj/i], category: 'Tech' },
- { id: 'deepfake', patterns: [/deepfake/i, /ai.*misinformation/i, /synthetic media/i], category: 'Tech' }
- ];
-
- // Track historical topic counts for momentum analysis
- let topicHistory = {};
- let lastCorrelationUpdate = 0;
-
- // Analyze correlations across all news
- function analyzeCorrelations(allNews) {
- if (!allNews || allNews.length === 0) return null;
-
- const now = Date.now();
- const results = {
- emergingPatterns: [],
- momentumSignals: [],
- crossSourceCorrelations: [],
- predictiveSignals: []
- };
-
- // Count topics and track sources
- const topicCounts = {};
- const topicSources = {};
- const topicHeadlines = {};
-
- allNews.forEach(item => {
- const title = item.title || '';
- const source = item.source || 'Unknown';
-
- CORRELATION_TOPICS.forEach(topic => {
- const matches = topic.patterns.some(p => p.test(title));
- if (matches) {
- if (!topicCounts[topic.id]) {
- topicCounts[topic.id] = 0;
- topicSources[topic.id] = new Set();
- topicHeadlines[topic.id] = [];
- }
- topicCounts[topic.id]++;
- topicSources[topic.id].add(source);
- if (topicHeadlines[topic.id].length < 5) {
- topicHeadlines[topic.id].push({ title, link: item.link, source });
- }
- }
- });
- });
-
- // Calculate momentum by comparing to history
- const currentTime = Math.floor(now / 60000); // minute resolution
- if (!topicHistory[currentTime]) {
- topicHistory[currentTime] = { ...topicCounts };
- // Clean old history (keep last 30 minutes)
- Object.keys(topicHistory).forEach(t => {
- if (currentTime - parseInt(t) > 30) delete topicHistory[t];
- });
- }
-
- // Emerging Patterns: Topics with high counts
- CORRELATION_TOPICS.forEach(topic => {
- const count = topicCounts[topic.id] || 0;
- if (count >= 3) {
- const sources = topicSources[topic.id] ? Array.from(topicSources[topic.id]) : [];
- const level = count >= 8 ? 'high' : count >= 5 ? 'elevated' : 'emerging';
- results.emergingPatterns.push({
- id: topic.id,
- name: topic.id.replace(/-/g, ' ').replace(/\b\w/g, l => l.toUpperCase()),
- category: topic.category,
- count,
- level,
- sources,
- headlines: topicHeadlines[topic.id] || []
- });
- }
- });
-
- // Sort by count
- results.emergingPatterns.sort((a, b) => b.count - a.count);
-
- // Momentum Signals: Topics increasing rapidly
- const oldTime = currentTime - 10; // 10 minutes ago
- const oldCounts = topicHistory[oldTime] || {};
-
- CORRELATION_TOPICS.forEach(topic => {
- const current = topicCounts[topic.id] || 0;
- const old = oldCounts[topic.id] || 0;
- const delta = current - old;
-
- if (delta >= 2 || (current >= 3 && delta >= 1)) {
- const momentum = delta >= 4 ? 'surging' : delta >= 2 ? 'rising' : 'stable';
- results.momentumSignals.push({
- id: topic.id,
- name: topic.id.replace(/-/g, ' ').replace(/\b\w/g, l => l.toUpperCase()),
- category: topic.category,
- current,
- delta,
- momentum,
- headlines: topicHeadlines[topic.id] || []
- });
- }
- });
-
- results.momentumSignals.sort((a, b) => b.delta - a.delta);
-
- // Cross-Source Correlations: Topics appearing in multiple sources
- CORRELATION_TOPICS.forEach(topic => {
- const sources = topicSources[topic.id] ? Array.from(topicSources[topic.id]) : [];
- if (sources.length >= 3) {
- results.crossSourceCorrelations.push({
- id: topic.id,
- name: topic.id.replace(/-/g, ' ').replace(/\b\w/g, l => l.toUpperCase()),
- category: topic.category,
- sourceCount: sources.length,
- sources,
- level: sources.length >= 5 ? 'high' : sources.length >= 4 ? 'elevated' : 'emerging',
- headlines: topicHeadlines[topic.id] || []
- });
- }
- });
-
- results.crossSourceCorrelations.sort((a, b) => b.sourceCount - a.sourceCount);
-
- // Predictive Signals: Combine factors for predictions
- CORRELATION_TOPICS.forEach(topic => {
- const count = topicCounts[topic.id] || 0;
- const sources = topicSources[topic.id] ? topicSources[topic.id].size : 0;
- const delta = (topicCounts[topic.id] || 0) - (oldCounts[topic.id] || 0);
-
- // Scoring: weight by count, source diversity, and momentum
- const score = (count * 2) + (sources * 3) + (delta * 5);
-
- if (score >= 15) {
- const confidence = Math.min(95, Math.round(score * 1.5));
- let prediction = '';
-
- // Generate prediction based on topic
- if (topic.id === 'tariffs' && count >= 4) {
- prediction = 'Market volatility likely in next 24-48h';
- } else if (topic.id === 'fed-rates') {
- prediction = 'Expect increased financial sector coverage';
- } else if (topic.id.includes('china') || topic.id.includes('russia')) {
- prediction = 'Geopolitical escalation narrative forming';
- } else if (topic.id === 'layoffs') {
- prediction = 'Employment concerns may dominate news cycle';
- } else if (topic.category === 'Conflict') {
- prediction = 'Breaking developments likely within hours';
- } else {
- prediction = 'Topic gaining mainstream traction';
- }
-
- results.predictiveSignals.push({
- id: topic.id,
- name: topic.id.replace(/-/g, ' ').replace(/\b\w/g, l => l.toUpperCase()),
- category: topic.category,
- score,
- confidence,
- prediction,
- level: confidence >= 70 ? 'high' : confidence >= 50 ? 'medium' : 'low',
- headlines: topicHeadlines[topic.id] || []
- });
- }
- });
-
- results.predictiveSignals.sort((a, b) => b.score - a.score);
-
- return results;
- }
-
- // Render the Correlation Engine panel
- function renderCorrelationEngine(correlations) {
- if (!isPanelEnabled('correlation')) return;
-
- const statusEl = document.getElementById('correlationStatus');
-
- if (!correlations) {
- statusEl.textContent = 'NO DATA';
- return;
- }
-
- const totalSignals = correlations.emergingPatterns.length +
- correlations.momentumSignals.length +
- correlations.predictiveSignals.length;
-
- statusEl.textContent = totalSignals > 0 ? `${totalSignals} SIGNALS` : 'MONITORING';
-
- // Render Emerging Patterns
- const emergingEl = document.getElementById('emergingPatterns');
- if (correlations.emergingPatterns.length > 0) {
- emergingEl.innerHTML = correlations.emergingPatterns.slice(0, 4).map(p => `
- <div class="correlation-item ${p.level}">
- <div class="correlation-item-header">
- <span class="correlation-topic">${p.name}</span>
- <span class="correlation-score ${p.level}">${p.count} mentions</span>
- </div>
- <div class="correlation-meta">${p.category} • ${p.sources.length} sources</div>
- <div class="correlation-sources">
- ${p.sources.slice(0, 4).map(s => `<span class="correlation-source-tag">${s}</span>`).join('')}
- </div>
- </div>
- `).join('');
- } else {
- emergingEl.innerHTML = '<div class="no-correlations">No emerging patterns detected</div>';
- }
-
- // Render Momentum Signals
- const momentumEl = document.getElementById('momentumSignals');
- if (correlations.momentumSignals.length > 0) {
- momentumEl.innerHTML = correlations.momentumSignals.slice(0, 4).map(m => `
- <div class="correlation-item ${m.momentum === 'surging' ? 'high' : m.momentum === 'rising' ? 'elevated' : ''}">
- <div class="correlation-item-header">
- <span class="correlation-topic">${m.name}</span>
- <span class="momentum-indicator ${m.momentum}">
- ${m.momentum === 'surging' ? '🚀' : m.momentum === 'rising' ? '📈' : '➡️'}
- ${m.momentum.toUpperCase()}
- </span>
- </div>
- <div class="correlation-meta">${m.category} • ${m.current} now (+${m.delta} in 10m)</div>
- ${m.headlines.length > 0 ? `
- <div class="correlation-headlines">
- ${m.headlines.slice(0, 2).map(h => `
- <div class="correlation-headline">
- <a href="${h.link}" target="_blank">${h.title.substring(0, 60)}...</a>
- </div>
- `).join('')}
- </div>
- ` : ''}
- </div>
- `).join('');
- } else {
- momentumEl.innerHTML = '<div class="no-correlations">No momentum signals detected</div>';
- }
-
- // Render Cross-Source Correlations
- const crossEl = document.getElementById('crossSourceCorrelations');
- if (correlations.crossSourceCorrelations.length > 0) {
- crossEl.innerHTML = correlations.crossSourceCorrelations.slice(0, 4).map(c => `
- <div class="correlation-item ${c.level}">
- <div class="correlation-item-header">
- <span class="correlation-topic">${c.name}</span>
- <span class="correlation-score ${c.level}">${c.sourceCount} sources</span>
- </div>
- <div class="correlation-meta">${c.category} • Multi-outlet coverage</div>
- <div class="correlation-sources">
- ${c.sources.slice(0, 5).map(s => `<span class="correlation-source-tag">${s}</span>`).join('')}
- </div>
- </div>
- `).join('');
- } else {
- crossEl.innerHTML = '<div class="no-correlations">No cross-source correlations</div>';
- }
-
- // Render Predictive Signals
- const predictEl = document.getElementById('predictiveSignals');
- if (correlations.predictiveSignals.length > 0) {
- predictEl.innerHTML = correlations.predictiveSignals.slice(0, 4).map(p => `
- <div class="correlation-item ${p.level}">
- <div class="correlation-item-header">
- <span class="correlation-topic">${p.name}</span>
- <span class="correlation-score ${p.level}">${p.confidence}%</span>
- </div>
- <div class="correlation-meta">${p.prediction}</div>
- <div class="prediction-confidence">
- <div class="confidence-bar">
- <div class="confidence-fill ${p.level}" style="width: ${p.confidence}%"></div>
- </div>
- <span class="confidence-label">confidence</span>
- </div>
- </div>
- `).join('');
- } else {
- predictEl.innerHTML = '<div class="no-correlations">Gathering data for predictions...</div>';
- }
- }
-
- // ==================== END CORRELATION ENGINE ====================
-
- // ==================== NARRATIVE TRACKER ====================
-
- // Fringe narrative patterns to track
- const NARRATIVE_PATTERNS = [
- // Conspiracy/Alternative theories
- { id: 'deep-state', keywords: ['deep state', 'shadow government', 'permanent state'], category: 'Political', severity: 'watch' },
- { id: 'cbdc-control', keywords: ['cbdc control', 'digital currency surveillance', 'social credit'], category: 'Finance', severity: 'watch' },
- { id: 'wef-agenda', keywords: ['great reset', 'wef agenda', 'world economic forum plot'], category: 'Political', severity: 'watch' },
- { id: 'bio-weapon', keywords: ['lab leak', 'bioweapon', 'gain of function'], category: 'Health', severity: 'emerging' },
- { id: 'election-fraud', keywords: ['election fraud', 'rigged election', 'stolen election', 'mail ballot fraud'], category: 'Political', severity: 'watch' },
-
- // Emerging tech narratives
- { id: 'ai-doom', keywords: ['ai doom', 'ai extinction', 'superintelligence risk', 'agi danger'], category: 'Tech', severity: 'emerging' },
- { id: 'ai-consciousness', keywords: ['ai sentient', 'ai conscious', 'ai feelings', 'ai alive'], category: 'Tech', severity: 'emerging' },
- { id: 'robot-replacement', keywords: ['robots replacing', 'automation unemployment', 'job automation'], category: 'Economy', severity: 'spreading' },
-
- // Geopolitical narratives
- { id: 'china-invasion', keywords: ['china taiwan invasion', 'china war', 'south china sea conflict'], category: 'Geopolitical', severity: 'watch' },
- { id: 'nato-expansion', keywords: ['nato provocation', 'nato aggression', 'nato encirclement'], category: 'Geopolitical', severity: 'watch' },
- { id: 'dollar-collapse', keywords: ['dollar collapse', 'dedollarization', 'brics currency', 'petrodollar death'], category: 'Finance', severity: 'spreading' },
-
- // Health narratives
- { id: 'vaccine-injury', keywords: ['vaccine injury', 'vaccine side effect', 'vaccine death', 'turbo cancer'], category: 'Health', severity: 'watch' },
- { id: 'next-pandemic', keywords: ['next pandemic', 'disease x', 'bird flu pandemic'], category: 'Health', severity: 'emerging' },
-
- // Societal narratives
- { id: 'depopulation', keywords: ['depopulation agenda', 'fertility crisis', 'population control'], category: 'Society', severity: 'disinfo' },
- { id: 'food-crisis', keywords: ['food shortage', 'engineered famine', 'food supply attack'], category: 'Economy', severity: 'emerging' },
- { id: 'energy-war', keywords: ['energy crisis manufactured', 'green agenda', 'energy shortage'], category: 'Economy', severity: 'spreading' }
- ];
-
- // Source classification
- const SOURCE_TYPES = {
- fringe: ['zerohedge', 'infowars', 'naturalnews', 'gateway', 'breitbart', 'epoch', 'revolver', 'dailycaller'],
- alternative: ['substack', 'rumble', 'bitchute', 'telegram', 'gab', 'gettr', 'truth social'],
- mainstream: ['reuters', 'ap news', 'bbc', 'cnn', 'nytimes', 'wsj', 'wapo', 'guardian', 'abc', 'nbc', 'cbs', 'fox']
- };
-
- // Track narratives history for crossover detection
- let narrativeHistory = {};
-
- function analyzeNarratives(allNews) {
- if (!allNews || allNews.length === 0) return null;
-
- const now = Date.now();
- const results = {
- emergingFringe: [],
- fringeToMainstream: [],
- narrativeWatch: [],
- disinfoSignals: []
- };
-
- // Analyze each narrative pattern
- NARRATIVE_PATTERNS.forEach(narrative => {
- const matches = [];
- const sourceMatches = { fringe: [], alternative: [], mainstream: [] };
-
- allNews.forEach(item => {
- const title = (item.title || '').toLowerCase();
- const source = (item.source || '').toLowerCase();
-
- // Check if title matches narrative keywords
- const hasMatch = narrative.keywords.some(kw => title.includes(kw.toLowerCase()));
- if (hasMatch) {
- matches.push(item);
-
- // Classify source
- for (const [type, sources] of Object.entries(SOURCE_TYPES)) {
- if (sources.some(s => source.includes(s))) {
- sourceMatches[type].push(item);
- break;
- }
- }
- }
- });
-
- if (matches.length === 0) return;
-
- // Track history for crossover detection
- if (!narrativeHistory[narrative.id]) {
- narrativeHistory[narrative.id] = { firstSeen: now, sources: new Set() };
- }
- matches.forEach(m => narrativeHistory[narrative.id].sources.add(m.source));
-
- const narrativeData = {
- id: narrative.id,
- name: narrative.id.replace(/-/g, ' ').replace(/\b\w/g, c => c.toUpperCase()),
- category: narrative.category,
- severity: narrative.severity,
- count: matches.length,
- fringeCount: sourceMatches.fringe.length,
- mainstreamCount: sourceMatches.mainstream.length,
- sources: [...new Set(matches.map(m => m.source))].slice(0, 5),
- headlines: matches.slice(0, 3),
- keywords: narrative.keywords
- };
-
- // Categorize narrative
- if (sourceMatches.mainstream.length > 0 && sourceMatches.fringe.length > 0) {
- // Crossover detected
- results.fringeToMainstream.push({
- ...narrativeData,
- status: 'crossing',
- crossoverLevel: sourceMatches.mainstream.length / matches.length
- });
- } else if (narrative.severity === 'disinfo') {
- results.disinfoSignals.push(narrativeData);
- } else if (sourceMatches.fringe.length > 0 || sourceMatches.alternative.length > 0) {
- results.emergingFringe.push(narrativeData);
- } else {
- results.narrativeWatch.push(narrativeData);
- }
- });
-
- // Sort each category by count
- results.emergingFringe.sort((a, b) => b.count - a.count);
- results.fringeToMainstream.sort((a, b) => b.crossoverLevel - a.crossoverLevel);
- results.narrativeWatch.sort((a, b) => b.count - a.count);
- results.disinfoSignals.sort((a, b) => b.count - a.count);
-
- return results;
- }
-
- function renderNarrativeTracker(narratives) {
- if (!isPanelEnabled('narrative')) return;
-
- const statusEl = document.getElementById('narrativeStatus');
- if (!narratives) {
- if (statusEl) statusEl.textContent = 'NO DATA';
- return;
- }
-
- const total = narratives.emergingFringe.length + narratives.fringeToMainstream.length +
- narratives.narrativeWatch.length + narratives.disinfoSignals.length;
- if (statusEl) statusEl.textContent = `${total} ACTIVE`;
-
- // Render Emerging Fringe
- const fringeEl = document.getElementById('emergingFringe');
- if (fringeEl) {
- if (narratives.emergingFringe.length > 0) {
- fringeEl.innerHTML = narratives.emergingFringe.slice(0, 4).map(n => `
- <div class="narrative-item ${n.count >= 5 ? 'viral' : n.count >= 3 ? 'spreading' : 'emerging'}">
- <div class="narrative-header">
- <span class="narrative-title">${n.name}</span>
- <span class="narrative-badge ${n.count >= 5 ? 'viral' : n.count >= 3 ? 'spreading' : 'emerging'}">
- ${n.count >= 5 ? 'VIRAL' : n.count >= 3 ? 'SPREADING' : 'EMERGING'}
- </span>
- </div>
- <div class="narrative-description">${n.category} • ${n.count} mentions</div>
- <div class="narrative-sources">
- ${n.sources.map(s => `<span class="narrative-source-tag">${s}</span>`).join('')}
- </div>
- </div>
- `).join('');
- } else {
- fringeEl.innerHTML = '<div class="no-narratives">No fringe narratives detected</div>';
- }
- }
-
- // Render Fringe to Mainstream
- const crossEl = document.getElementById('fringeToMainstream');
- if (crossEl) {
- if (narratives.fringeToMainstream.length > 0) {
- crossEl.innerHTML = narratives.fringeToMainstream.slice(0, 4).map(n => `
- <div class="narrative-item spreading">
- <div class="narrative-header">
- <span class="narrative-title">${n.name}</span>
- <span class="narrative-badge spreading">CROSSING</span>
- </div>
- <div class="narrative-description">${n.category} • ${Math.round(n.crossoverLevel * 100)}% mainstream coverage</div>
- <div class="narrative-crossover">
- <span class="crossover-source fringe">Fringe (${n.fringeCount})</span>
- <span class="crossover-arrow">→</span>
- <span class="crossover-source mainstream">Mainstream (${n.mainstreamCount})</span>
- </div>
- </div>
- `).join('');
- } else {
- crossEl.innerHTML = '<div class="no-narratives">No crossover narratives detected</div>';
- }
- }
-
- // Render Narrative Watch
- const watchEl = document.getElementById('narrativeWatch');
- if (watchEl) {
- if (narratives.narrativeWatch.length > 0) {
- watchEl.innerHTML = narratives.narrativeWatch.slice(0, 4).map(n => `
- <div class="narrative-item watch">
- <div class="narrative-header">
- <span class="narrative-title">${n.name}</span>
- <span class="narrative-badge emerging">${n.count}</span>
- </div>
- <div class="narrative-description">${n.category}</div>
- <div class="narrative-metrics">
- <span class="narrative-metric">Sources: <span class="narrative-metric-value">${n.sources.length}</span></span>
- </div>
- </div>
- `).join('');
- } else {
- watchEl.innerHTML = '<div class="no-narratives">No narratives on watch</div>';
- }
- }
-
- // Render Disinfo Signals
- const disinfoEl = document.getElementById('disinfoSignals');
- if (disinfoEl) {
- if (narratives.disinfoSignals.length > 0) {
- disinfoEl.innerHTML = narratives.disinfoSignals.slice(0, 4).map(n => `
- <div class="narrative-item disinfo">
- <div class="narrative-header">
- <span class="narrative-title">${n.name}</span>
- <span class="narrative-badge disinfo">⚠ DISINFO</span>
- </div>
- <div class="narrative-description">${n.category} • Known disinformation pattern</div>
- <div class="narrative-metrics">
- <span class="narrative-metric">Mentions: <span class="narrative-metric-value">${n.count}</span></span>
- </div>
- </div>
- `).join('');
- } else {
- disinfoEl.innerHTML = '<div class="no-narratives">No disinfo signals detected</div>';
- }
- }
- }
-
- // ==================== END NARRATIVE TRACKER ====================
-
- // Calculate "Main Character" from news headlines
- function calculateMainCharacter(allNews) {
- // Common names and figures to track
- const namePatterns = [
- { pattern: /\btrump\b/gi, name: 'Trump' },
- { pattern: /\bbiden\b/gi, name: 'Biden' },
- { pattern: /\belon\b|\bmusk\b/gi, name: 'Elon Musk' },
- { pattern: /\bputin\b/gi, name: 'Putin' },
- { pattern: /\bzelensky\b/gi, name: 'Zelensky' },
- { pattern: /\bxi\s*jinping\b|\bxi\b/gi, name: 'Xi Jinping' },
- { pattern: /\bnetanyahu\b/gi, name: 'Netanyahu' },
- { pattern: /\bsam\s*altman\b/gi, name: 'Sam Altman' },
- { pattern: /\bmark\s*zuckerberg\b|\bzuckerberg\b/gi, name: 'Zuckerberg' },
- { pattern: /\bjeff\s*bezos\b|\bbezos\b/gi, name: 'Bezos' },
- { pattern: /\btim\s*cook\b/gi, name: 'Tim Cook' },
- { pattern: /\bsatya\s*nadella\b|\bnadella\b/gi, name: 'Satya Nadella' },
- { pattern: /\bsundar\s*pichai\b|\bpichai\b/gi, name: 'Sundar Pichai' },
- { pattern: /\bwarren\s*buffett\b|\bbuffett\b/gi, name: 'Warren Buffett' },
- { pattern: /\bjanet\s*yellen\b|\byellen\b/gi, name: 'Janet Yellen' },
- { pattern: /\bjerome\s*powell\b|\bpowell\b/gi, name: 'Jerome Powell' },
- { pattern: /\bkamala\s*harris\b|\bharris\b/gi, name: 'Kamala Harris' },
- { pattern: /\bnancy\s*pelosi\b|\bpelosi\b/gi, name: 'Nancy Pelosi' },
- { pattern: /\bjensen\s*huang\b|\bhuang\b/gi, name: 'Jensen Huang' },
- { pattern: /\bdario\s*amodei\b|\bamodei\b/gi, name: 'Dario Amodei' }
- ];
-
- const counts = {};
-
- allNews.forEach(item => {
- const text = item.title.toLowerCase();
- namePatterns.forEach(({ pattern, name }) => {
- const matches = text.match(pattern);
- if (matches) {
- counts[name] = (counts[name] || 0) + matches.length;
- }
- });
- });
-
- // Sort by mentions
- const sorted = Object.entries(counts)
- .sort((a, b) => b[1] - a[1])
- .slice(0, 10);
-
- return sorted;
- }
-
- // Fetch government contracts from USAspending
- async function fetchGovContracts() {
- try {
- // USAspending API for recent contract awards
- const response = await fetch('https://api.usaspending.gov/api/v2/search/spending_by_award/', {
- method: 'POST',
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({
- filters: {
- time_period: [{ start_date: getDateDaysAgo(7), end_date: getToday() }],
- award_type_codes: ['A', 'B', 'C', 'D'] // Contracts only
- },
- fields: ['Award ID', 'Recipient Name', 'Award Amount', 'Awarding Agency', 'Description', 'Start Date'],
- limit: 15,
- order: 'desc',
- sort: 'Award Amount'
- })
- });
-
- const data = await response.json();
-
- return (data.results || []).map(c => ({
- agency: c['Awarding Agency'] || 'Unknown Agency',
- vendor: c['Recipient Name'] || 'Unknown',
- amount: c['Award Amount'] || 0,
- description: c['Description'] || 'Contract Award',
- date: c['Start Date']
- }));
- } catch (error) {
- console.error('Error fetching contracts:', error);
- return [];
- }
- }
-
- function getDateDaysAgo(days) {
- const d = new Date();
- d.setDate(d.getDate() - days);
- return d.toISOString().split('T')[0];
- }
-
- function getToday() {
- return new Date().toISOString().split('T')[0];
- }
-
- // AI RSS feeds for arms race tracking
- const AI_FEEDS = [
- { name: 'OpenAI', url: 'https://openai.com/blog/rss.xml' },
- { name: 'Anthropic', url: 'https://www.anthropic.com/rss.xml' },
- { name: 'Google AI', url: 'https://blog.google/technology/ai/rss/' },
- { name: 'DeepMind', url: 'https://deepmind.google/blog/rss.xml' },
- { name: 'Meta AI', url: 'https://ai.meta.com/blog/rss/' },
- { name: 'Hugging Face', url: 'https://huggingface.co/blog/feed.xml' }
- ];
-
- async function fetchAINews() {
- const results = await Promise.all(AI_FEEDS.map(async (source) => {
- try {
- const text = await fetchWithProxy(source.url);
- const parser = new DOMParser();
- const xml = parser.parseFromString(text, 'text/xml');
-
- let items = xml.querySelectorAll('item');
- if (items.length === 0) items = xml.querySelectorAll('entry');
-
- return Array.from(items).slice(0, 3).map(item => {
- let link = '';
- const linkEl = item.querySelector('link');
- if (linkEl) link = linkEl.getAttribute('href') || linkEl.textContent || '';
-
- return {
- source: source.name,
- title: item.querySelector('title')?.textContent?.trim() || 'No title',
- link: link.trim(),
- date: item.querySelector('pubDate')?.textContent ||
- item.querySelector('published')?.textContent || ''
- };
- });
- } catch (e) {
- console.log(`Failed to fetch ${source.name}`);
- return [];
- }
- }));
-
- return results.flat().sort((a, b) => new Date(b.date) - new Date(a.date)).slice(0, 15);
- }
-
- // Fetch Fed balance sheet from FRED
- async function fetchFedBalance() {
- try {
- // FRED API - Fed total assets (WALCL)
- const text = await fetchWithProxy('https://api.stlouisfed.org/fred/series/observations?series_id=WALCL&sort_order=desc&limit=10&file_type=json&api_key=DEMO');
- const data = JSON.parse(text);
-
- if (data.observations && data.observations.length >= 2) {
- const latest = parseFloat(data.observations[0].value);
- const previous = parseFloat(data.observations[1].value);
- const change = latest - previous;
- const changePercent = (change / previous) * 100;
-
- // WALCL is in millions
- return {
- value: latest / 1000000, // Convert to trillions
- change: change / 1000000,
- changePercent,
- date: data.observations[0].date,
- // Historical high was ~9T in 2022
- percentOfMax: (latest / 9000000) * 100
- };
- }
- } catch (error) {
- console.error('Error fetching Fed balance:', error);
- }
-
- // Fallback with approximate current value
- return {
- value: 6.8,
- change: 0,
- changePercent: 0,
- date: new Date().toISOString().split('T')[0],
- percentOfMax: 75
- };
- }
-
- // Render functions for new panels
- function renderCongressTrades(trades) {
- const panel = document.getElementById('congressPanel');
- const count = document.getElementById('congressCount');
-
- if (trades.length === 0) {
- panel.innerHTML = '<div class="error-msg">Unable to load congressional trades</div>';
- count.textContent = '0';
- return;
- }
-
- panel.innerHTML = trades.map(t => `
- <div class="congress-item">
- <div class="congress-info">
- <div>
- <span class="congress-name">${t.name}</span>
- <span class="congress-party ${t.party}">${t.party}</span>
- </div>
- <div class="congress-ticker">${t.ticker}</div>
- <div class="congress-meta">${timeAgo(t.date)} · ${t.district}</div>
- </div>
- <div class="congress-type">
- <span class="congress-action ${t.type}">${t.type.toUpperCase()}</span>
- <div class="congress-amount">${t.amount}</div>
- </div>
- </div>
- `).join('');
-
- count.textContent = trades.length;
- }
-
- function renderWhaleWatch(whales) {
- const panel = document.getElementById('whalePanel');
- const count = document.getElementById('whaleCount');
-
- if (whales.length === 0) {
- panel.innerHTML = '<div class="error-msg">No whale transactions detected</div>';
- count.textContent = '0';
- return;
- }
-
- const formatAmount = (amt) => amt >= 1000 ? (amt / 1000).toFixed(1) + 'K' : amt.toFixed(2);
- const formatUSD = (usd) => {
- if (usd >= 1000000000) return '$' + (usd / 1000000000).toFixed(1) + 'B';
- if (usd >= 1000000) return '$' + (usd / 1000000).toFixed(1) + 'M';
- return '$' + (usd / 1000).toFixed(0) + 'K';
- };
-
- panel.innerHTML = whales.map(w => `
- <div class="whale-item">
- <div class="whale-header">
- <span class="whale-coin">${w.coin}</span>
- <span class="whale-amount">${formatAmount(w.amount)} ${w.coin}</span>
- </div>
- <div class="whale-flow">
- <span class="whale-usd">${formatUSD(w.usd)}</span>
- <span class="arrow">→</span>
- <span>${w.hash}</span>
- </div>
- </div>
- `).join('');
-
- count.textContent = whales.length;
- }
-
- function renderMainCharacter(rankings) {
- const panel = document.getElementById('mainCharPanel');
-
- if (rankings.length === 0) {
- panel.innerHTML = '<div class="error-msg">No main character detected</div>';
- return;
- }
-
- const [topName, topCount] = rankings[0];
-
- panel.innerHTML = `
- <div class="main-char-display">
- <div class="main-char-label">Today's Main Character</div>
- <div class="main-char-name">${topName}</div>
- <div class="main-char-count">${topCount} mentions in headlines</div>
-
- <div class="main-char-list">
- ${rankings.slice(1, 8).map((r, i) => `
- <div class="char-row">
- <span class="rank">${i + 2}.</span>
- <span class="name">${r[0]}</span>
- <span class="mentions">${r[1]}</span>
- </div>
- `).join('')}
- </div>
- </div>
- `;
- }
-
- function renderGovContracts(contracts) {
- const panel = document.getElementById('contractsPanel');
- const count = document.getElementById('contractsCount');
-
- if (contracts.length === 0) {
- panel.innerHTML = '<div class="error-msg">Unable to load contracts</div>';
- count.textContent = '0';
- return;
- }
-
- const formatValue = (v) => {
- if (v >= 1000000000) return '$' + (v / 1000000000).toFixed(1) + 'B';
- if (v >= 1000000) return '$' + (v / 1000000).toFixed(1) + 'M';
- if (v >= 1000) return '$' + (v / 1000).toFixed(0) + 'K';
- return '$' + v.toFixed(0);
- };
-
- panel.innerHTML = contracts.map(c => `
- <div class="contract-item">
- <div class="contract-agency">${c.agency}</div>
- <div class="contract-desc">${c.description.substring(0, 100)}${c.description.length > 100 ? '...' : ''}</div>
- <div class="contract-meta">
- <span class="contract-vendor">${c.vendor}</span>
- <span class="contract-value">${formatValue(c.amount)}</span>
- </div>
- </div>
- `).join('');
-
- count.textContent = contracts.length;
- }
-
- function renderAINews(items) {
- const panel = document.getElementById('aiPanel');
- const count = document.getElementById('aiCount');
-
- if (items.length === 0) {
- panel.innerHTML = '<div class="error-msg">Unable to load AI news</div>';
- count.textContent = '0';
- return;
- }
-
- panel.innerHTML = items.map(item => `
- <div class="ai-item">
- <div class="ai-source">${item.source}</div>
- <a class="ai-title item-title" href="${item.link}" target="_blank">${item.title}</a>
- <div class="ai-date">${timeAgo(item.date)}</div>
- </div>
- `).join('');
-
- count.textContent = items.length;
- }
-
- function renderMoneyPrinter(data) {
- const panel = document.getElementById('printerPanel');
+ <link rel="stylesheet" href="styles.css">
+ <script src="https://d3js.org/d3.v7.min.js"></script>
+ <script src="https://cdn.jsdelivr.net/npm/topojson-client@3"></script>
+</head>
+<body>
+ <header class="header">
+ <div class="header-left">
+ <h1 class="title">Situation Monitor</h1>
+ <span class="status" id="status">Ready</span>
+ </div>
+ <div class="header-right">
+ <button class="refresh-btn monitors-btn" onclick="openMonitorForm()">+ Monitor</button>
+ <button class="settings-btn" onclick="toggleSettings()">Panels</button>
+ <button class="refresh-btn" id="refreshBtn" onclick="refreshAll()">Refresh</button>
+ </div>
+ </header>
- const isExpanding = data.change > 0;
- const status = isExpanding ? 'PRINTER ON' : 'PRINTER OFF';
+ <!-- Settings Modal -->
+ <div class="settings-modal" id="settingsModal" onclick="if(event.target === this) toggleSettings()">
+ <div class="settings-content">
+ <div class="settings-title">Panel Settings</div>
+ <div class="settings-section">
+ <div class="settings-section-title">Toggle Panels</div>
+ <div id="panelToggles"></div>
+ </div>
+ <div class="settings-section">
+ <div class="settings-section-title">Livestream URL</div>
+ <input type="text" id="livestreamUrl" class="settings-input" placeholder="YouTube URL (e.g. https://youtube.com/watch?v=...)" onchange="saveLivestreamUrl()">
+ <div class="settings-hint">Paste any YouTube video or livestream URL</div>
+ </div>
+ <div class="settings-section">
+ <div class="settings-section-title">Layout</div>
+ <div class="settings-hint" style="margin-bottom: 0.5rem;">Drag panel headers to reorder</div>
+ <button class="settings-reset" onclick="resetPanelOrder()">Reset Layout</button>
+ </div>
+ <div class="settings-section monitors-section">
+ <div class="settings-section-title">Custom Monitors</div>
+ <div class="settings-hint" style="margin-bottom: 0.5rem;">Track keywords with optional map locations</div>
+ <div class="monitors-list" id="monitorsList"></div>
+ <button class="add-monitor-btn" onclick="openMonitorForm()">+ Add Monitor</button>
+ </div>
+ <button class="settings-close" onclick="toggleSettings()">Close</button>
+ </div>
+ </div>
- panel.innerHTML = `
- <div class="printer-gauge">
- <div class="printer-label">Federal Reserve Balance Sheet</div>
- <div class="printer-value">
- ${data.value.toFixed(2)}<span class="printer-unit">T USD</span>
- </div>
- <div class="printer-change ${isExpanding ? 'up' : 'down'}">
- ${data.change >= 0 ? '+' : ''}${(data.change * 1000).toFixed(0)}B (${data.changePercent >= 0 ? '+' : ''}${data.changePercent.toFixed(2)}%) WoW
- </div>
- <div class="printer-bar">
- <div class="printer-fill" style="width: ${Math.min(data.percentOfMax, 100)}%"></div>
- </div>
- <div class="printer-status">
- <span class="printer-indicator ${isExpanding ? 'on' : 'off'}"></span>
- ${status}
- </div>
+ <!-- Monitor Form Modal -->
+ <div class="monitor-form-overlay" id="monitorFormOverlay" onclick="if(event.target === this) closeMonitorForm()">
+ <div class="monitor-form">
+ <div class="monitor-form-title" id="monitorFormTitle">Add Monitor</div>
+ <input type="hidden" id="monitorEditId">
+ <div class="monitor-form-field">
+ <label class="monitor-form-label">Name</label>
+ <input type="text" class="monitor-form-input" id="monitorName" placeholder="e.g., TSMC Supply Chain">
+ </div>
+ <div class="monitor-form-field">
+ <label class="monitor-form-label">Keywords</label>
+ <input type="text" class="monitor-form-input" id="monitorKeywords" placeholder="e.g., tsmc, taiwan semiconductor, chip">
+ <div class="monitor-form-hint">Comma-separated. Matches headlines containing any keyword.</div>
+ </div>
+ <div class="monitor-form-field">
+ <label class="monitor-form-label">Color</label>
+ <div class="monitor-form-colors" id="monitorColors"></div>
+ </div>
+ <div class="monitor-form-field">
+ <label class="monitor-form-label">Map Location (Optional)</label>
+ <div class="monitor-form-location">
+ <input type="text" class="monitor-form-input" id="monitorLat" placeholder="Latitude">
+ <input type="text" class="monitor-form-input" id="monitorLon" placeholder="Longitude">
</div>
- `;
- }
-
- // Fetch Polymarket predictions
- async function fetchPolymarket() {
- try {
- const text = await fetchWithProxy('https://gamma-api.polymarket.com/markets?closed=false&order=volume&ascending=false&limit=25');
- const data = JSON.parse(text);
-
- if (!Array.isArray(data)) {
- console.error('Polymarket response is not an array');
- return [];
- }
-
- // Parse markets with flexible field handling
- const markets = data
- .filter(m => {
- const vol = parseFloat(m.volume || m.volumeNum || 0);
- return m.question && vol > 1000;
- })
- .slice(0, 15)
- .map(m => {
- // Handle different price formats
- let yesPrice = 0;
- if (m.outcomePrices && Array.isArray(m.outcomePrices)) {
- yesPrice = parseFloat(m.outcomePrices[0]) || 0;
- } else if (m.bestBid !== undefined) {
- yesPrice = parseFloat(m.bestBid) || 0;
- } else if (m.lastTradePrice !== undefined) {
- yesPrice = parseFloat(m.lastTradePrice) || 0;
- }
-
- // Ensure price is in 0-1 range, convert to percentage
- if (yesPrice > 1) yesPrice = yesPrice / 100;
- const yesPct = Math.round(yesPrice * 100);
-
- return {
- question: m.question,
- yes: yesPct,
- volume: parseFloat(m.volume || m.volumeNum || 0),
- slug: m.slug || m.id
- };
- });
-
- return markets;
- } catch (error) {
- console.error('Error fetching Polymarket:', error);
- return [];
- }
- }
-
- // Fetch earthquakes from USGS
- async function fetchEarthquakes() {
- try {
- // USGS API - significant earthquakes in last 7 days
- const url = 'https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_week.geojson';
- const text = await fetchWithProxy(url);
- const data = JSON.parse(text);
-
- if (!data.features) return [];
-
- return data.features
- .filter(f => f.properties.mag >= 4.0) // Only M4.0+
- .slice(0, 15)
- .map(f => ({
- mag: f.properties.mag,
- place: f.properties.place,
- time: f.properties.time,
- lat: f.geometry.coordinates[1],
- lon: f.geometry.coordinates[0],
- depth: f.geometry.coordinates[2]
- }));
- } catch (error) {
- console.error('Error fetching earthquakes:', error);
- return [];
- }
- }
-
- // Fetch layoffs news
- async function fetchLayoffs() {
- try {
- const searchTerms = encodeURIComponent('tech layoffs 2025 job cuts');
- const rssUrl = `https://news.google.com/rss/search?q=${searchTerms}&hl=en-US&gl=US&ceid=US:en`;
- const text = await fetchWithProxy(rssUrl);
- const parser = new DOMParser();
- const xml = parser.parseFromString(text, 'text/xml');
- const items = xml.querySelectorAll('item');
-
- const layoffs = [];
- const companies = ['google', 'meta', 'amazon', 'microsoft', 'apple', 'tesla', 'nvidia',
- 'salesforce', 'stripe', 'spotify', 'intel', 'cisco', 'ibm', 'dell', 'hp', 'oracle',
- 'adobe', 'paypal', 'uber', 'lyft', 'airbnb', 'doordash', 'snap', 'twitter', 'x corp'];
-
- items.forEach(item => {
- const title = item.querySelector('title')?.textContent || '';
- const pubDate = item.querySelector('pubDate')?.textContent;
- const link = item.querySelector('link')?.textContent || '';
-
- // Extract company name and layoff count
- const titleLower = title.toLowerCase();
- const company = companies.find(c => titleLower.includes(c));
-
- // Look for numbers in title
- const countMatch = title.match(/(\d{1,3}(?:,\d{3})*|\d+)\s*(?:employees?|workers?|jobs?|staff|people|positions?)/i) ||
- title.match(/(?:cuts?|lays?\s*off|eliminat\w*|slash\w*)\s*(\d{1,3}(?:,\d{3})*|\d+)/i);
-
- if (company || titleLower.includes('layoff') || titleLower.includes('job cut')) {
- layoffs.push({
- company: company ? company.charAt(0).toUpperCase() + company.slice(1) : 'Tech',
- title: title.substring(0, 100),
- count: countMatch ? countMatch[1].replace(/,/g, '') : null,
- date: pubDate,
- link
- });
- }
- });
-
- return layoffs.slice(0, 8);
- } catch (error) {
- console.error('Error fetching layoffs:', error);
- return getRecentLayoffs();
- }
- }
-
- // Fallback layoffs data
- function getRecentLayoffs() {
- const today = new Date();
- const daysAgo = (n) => {
- const d = new Date(today);
- d.setDate(d.getDate() - n);
- return d.toISOString();
- };
- return [
- { company: 'Meta', title: 'Meta cuts workforce in Reality Labs division', count: '700', date: daysAgo(1) },
- { company: 'Google', title: 'Google restructures cloud division, reduces staff', count: '200', date: daysAgo(2) },
- { company: 'Microsoft', title: 'Microsoft gaming division sees job cuts', count: '650', date: daysAgo(3) },
- { company: 'Amazon', title: 'Amazon reduces Alexa team headcount', count: '400', date: daysAgo(4) }
- ];
- }
-
- // Fetch situation news (Venezuela/Greenland)
- async function fetchSituationNews(keywords, limit = 5) {
- try {
- const searchTerms = encodeURIComponent(keywords);
- const rssUrl = `https://news.google.com/rss/search?q=${searchTerms}&hl=en-US&gl=US&ceid=US:en`;
- const text = await fetchWithProxy(rssUrl);
- const parser = new DOMParser();
- const xml = parser.parseFromString(text, 'text/xml');
- const items = xml.querySelectorAll('item');
+ <div class="monitor-form-hint">Leave blank for keyword-only monitoring. Add coords to show on map.</div>
+ </div>
+ <div class="monitor-form-actions">
+ <button class="monitor-cancel-btn" onclick="closeMonitorForm()">Cancel</button>
+ <button class="monitor-save-btn" onclick="saveMonitor()">Save</button>
+ </div>
+ </div>
+ </div>
- return Array.from(items).slice(0, limit).map(item => ({
- title: item.querySelector('title')?.textContent || '',
- link: item.querySelector('link')?.textContent || '',
- pubDate: item.querySelector('pubDate')?.textContent,
- source: item.querySelector('source')?.textContent || 'News'
- }));
- } catch (error) {
- console.error('Error fetching situation news:', error);
- return [];
- }
- }
+ <main class="dashboard">
+ <!-- Global Intelligence Map -->
+ <section class="panel" data-panel="map" style="grid-column: span 4;">
+ <div class="panel-header">
+ <span class="panel-title">Global Activity Monitor</span>
+ <span class="panel-count" id="mapLegend">
+ <span style="color: var(--green);">● Low</span>
+ <span style="color: var(--yellow); margin-left: 0.5rem;">● Elevated</span>
+ <span style="color: var(--red); margin-left: 0.5rem;">● High</span>
+ </span>
+ </div>
+ <div class="panel-content" id="mapPanel" style="max-height: none; height: 350px; overflow: hidden;">
+ <div class="loading-msg">Loading map...</div>
+ </div>
+ </section>
- // Detect regions from text
- function detectRegions(text) {
- const lower = text.toLowerCase();
- const regions = [];
- for (const [region, keywords] of Object.entries(REGION_KEYWORDS)) {
- if (keywords.some(kw => lower.includes(kw))) {
- regions.push(region);
- }
- }
- return regions;
- }
+ <!-- TBPN Livestream -->
+ <section class="panel panel-livestream" data-panel="tbpn">
+ <div class="panel-header">
+ <span class="panel-title">Livestream</span>
+ <span class="live-indicator">LIVE</span>
+ </div>
+ <div class="panel-content livestream-container" id="tbpnPanel">
+ <div class="loading-msg">Loading stream...</div>
+ </div>
+ </section>
- // Detect topics from text
- function detectTopics(text) {
- const lower = text.toLowerCase();
- const topics = [];
- for (const [topic, keywords] of Object.entries(TOPIC_KEYWORDS)) {
- if (keywords.some(kw => lower.includes(kw))) {
- topics.push(topic);
- }
- }
- return topics;
- }
+ <!-- Political / World News -->
+ <section class="panel" data-panel="politics">
+ <div class="panel-header">
+ <span class="panel-title">World / Geopolitical</span>
+ <span class="panel-count" id="politicsCount">-</span>
+ </div>
+ <div class="panel-content" id="politicsPanel">
+ <div class="loading-msg">Loading...</div>
+ </div>
+ </section>
- // Fetch Intel Feed from multiple sources
- async function fetchIntelFeed() {
- const results = await Promise.all(INTEL_SOURCES.map(async (source) => {
- try {
- const text = await fetchWithProxy(source.url);
- const parser = new DOMParser();
- const xml = parser.parseFromString(text, 'text/xml');
+ <!-- Technology News -->
+ <section class="panel" data-panel="tech">
+ <div class="panel-header">
+ <span class="panel-title">Technology / AI</span>
+ <span class="panel-count" id="techCount">-</span>
+ </div>
+ <div class="panel-content" id="techPanel">
+ <div class="loading-msg">Loading...</div>
+ </div>
+ </section>
- let items = xml.querySelectorAll('item');
- if (items.length === 0) items = xml.querySelectorAll('entry');
+ <!-- Financial News -->
+ <section class="panel" data-panel="finance">
+ <div class="panel-header">
+ <span class="panel-title">Financial</span>
+ <span class="panel-count" id="financeCount">-</span>
+ </div>
+ <div class="panel-content" id="financePanel">
+ <div class="loading-msg">Loading...</div>
+ </div>
+ </section>
- return Array.from(items).slice(0, 3).map(item => {
- let link = '';
- const linkEl = item.querySelector('link');
- if (linkEl) link = linkEl.getAttribute('href') || linkEl.textContent || '';
+ <!-- Government / Policy -->
+ <section class="panel" data-panel="gov">
+ <div class="panel-header">
+ <span class="panel-title">Government / Policy</span>
+ <span class="panel-count" id="govCount">-</span>
+ </div>
+ <div class="panel-content" id="govPanel">
+ <div class="loading-msg">Loading...</div>
+ </div>
+ </section>
- const title = item.querySelector('title')?.textContent?.trim() || 'No title';
- const pubDate = item.querySelector('pubDate')?.textContent ||
- item.querySelector('published')?.textContent || '';
+ <!-- Sector Heatmap -->
+ <section class="panel" data-panel="heatmap">
+ <div class="panel-header">
+ <span class="panel-title">Sector Heatmap</span>
+ </div>
+ <div class="panel-content" id="heatmapPanel">
+ <div class="loading-msg">Loading...</div>
+ </div>
+ </section>
- // Detect regions and topics from title
- const detectedRegions = source.region ? [source.region] : detectRegions(title);
- const detectedTopics = detectTopics(title);
+ <!-- Markets -->
+ <section class="panel wide" data-panel="markets">
+ <div class="panel-header">
+ <span class="panel-title">Markets</span>
+ <span class="panel-count" id="marketsCount">-</span>
+ </div>
+ <div class="panel-content" id="marketsPanel">
+ <div class="loading-msg">Loading...</div>
+ </div>
+ </section>
- // Priority flag for critical items
- const isPriority = ALERT_KEYWORDS.some(kw => title.toLowerCase().includes(kw));
+ <!-- Commodities -->
+ <section class="panel" data-panel="commodities">
+ <div class="panel-header">
+ <span class="panel-title">Commodities / VIX</span>
+ </div>
+ <div class="panel-content" id="commoditiesPanel">
+ <div class="loading-msg">Loading...</div>
+ </div>
+ </section>
- return {
- source: source.name,
- sourceType: source.type,
- title,
- link: link.trim(),
- pubDate,
- regions: detectedRegions,
- topics: detectedTopics,
- isPriority
- };
- });
- } catch (e) {
- console.log(`Failed to fetch intel from ${source.name}`);
- return [];
- }
- }));
+ <!-- Polymarket -->
+ <section class="panel wide" data-panel="polymarket">
+ <div class="panel-header">
+ <span class="panel-title">Polymarket Predictions</span>
+ <span class="panel-count" id="polymarketCount">-</span>
+ </div>
+ <div class="panel-content" id="polymarketPanel">
+ <div class="loading-msg">Loading...</div>
+ </div>
+ </section>
- // Flatten and sort by date, priority items first
- const allItems = results.flat();
- allItems.sort((a, b) => {
- if (a.isPriority && !b.isPriority) return -1;
- if (!a.isPriority && b.isPriority) return 1;
- return new Date(b.pubDate) - new Date(a.pubDate);
- });
+ <!-- Congressional Trading -->
+ <section class="panel" data-panel="congress">
+ <div class="panel-header">
+ <span class="panel-title">Congress Trades</span>
+ <span class="panel-count" id="congressCount">-</span>
+ </div>
+ <div class="panel-content" id="congressPanel">
+ <div class="loading-msg">Loading...</div>
+ </div>
+ </section>
- return allItems.slice(0, 25);
- }
+ <!-- Whale Wallet Watch -->
+ <section class="panel" data-panel="whales">
+ <div class="panel-header">
+ <span class="panel-title">Whale Watch</span>
+ <span class="panel-count" id="whaleCount">-</span>
+ </div>
+ <div class="panel-content" id="whalePanel">
+ <div class="loading-msg">Loading...</div>
+ </div>
+ </section>
- // Render Intel Feed panel
- function renderIntelFeed(items) {
- const panel = document.getElementById('intelPanel');
- const count = document.getElementById('intelCount');
+ <!-- Main Character -->
+ <section class="panel" data-panel="mainchar">
+ <div class="panel-header">
+ <span class="panel-title">Main Character</span>
+ <span class="panel-count">Today</span>
+ </div>
+ <div class="panel-content" id="mainCharPanel">
+ <div class="loading-msg">Loading...</div>
+ </div>
+ </section>
- if (!items || items.length === 0) {
- panel.innerHTML = '<div class="loading-msg">No intel available</div>';
- count.textContent = '-';
- return;
- }
+ <!-- Money Printer -->
+ <section class="panel" data-panel="printer">
+ <div class="panel-header">
+ <span class="panel-title">Money Printer</span>
+ <span class="panel-count">Fed Balance Sheet</span>
+ </div>
+ <div class="panel-content" id="printerPanel">
+ <div class="loading-msg">Loading...</div>
+ </div>
+ </section>
- count.textContent = items.length;
+ <!-- Government Contracts -->
+ <section class="panel wide" data-panel="contracts">
+ <div class="panel-header">
+ <span class="panel-title">Gov Contracts</span>
+ <span class="panel-count" id="contractsCount">-</span>
+ </div>
+ <div class="panel-content" id="contractsPanel">
+ <div class="loading-msg">Loading...</div>
+ </div>
+ </section>
- panel.innerHTML = items.map(item => {
- // Build tags HTML
- let tagsHTML = '';
+ <!-- AI Arms Race -->
+ <section class="panel wide" data-panel="ai">
+ <div class="panel-header">
+ <span class="panel-title">AI Arms Race</span>
+ <span class="panel-count" id="aiCount">-</span>
+ </div>
+ <div class="panel-content" id="aiPanel">
+ <div class="loading-msg">Loading...</div>
+ </div>
+ </section>
- // Source type tag
- if (item.sourceType === 'osint') {
- tagsHTML += '<span class="intel-tag osint">OSINT</span>';
- } else if (item.sourceType === 'govt') {
- tagsHTML += '<span class="intel-tag govt">GOVT</span>';
- }
+ <!-- Layoffs Tracker -->
+ <section class="panel" data-panel="layoffs">
+ <div class="panel-header">
+ <span class="panel-title">Layoffs Tracker</span>
+ <span class="panel-count" id="layoffsCount">-</span>
+ </div>
+ <div class="panel-content" id="layoffsPanel">
+ <div class="loading-msg">Loading...</div>
+ </div>
+ </section>
- // Region tags (max 2)
- item.regions.slice(0, 2).forEach(r => {
- tagsHTML += `<span class="intel-tag region">${r}</span>`;
- });
+ <!-- Venezuela Situation -->
+ <section class="panel" data-panel="venezuela">
+ <div class="panel-header">
+ <span class="panel-title">Venezuela Situation</span>
+ <span class="panel-count" id="venezuelaStatus">-</span>
+ </div>
+ <div class="panel-content" id="venezuelaPanel">
+ <div class="loading-msg">Loading...</div>
+ </div>
+ </section>
- // Topic tags (max 2)
- item.topics.slice(0, 2).forEach(t => {
- tagsHTML += `<span class="intel-tag topic">${t}</span>`;
- });
+ <!-- Greenland Situation -->
+ <section class="panel" data-panel="greenland">
+ <div class="panel-header">
+ <span class="panel-title">Greenland Situation</span>
+ <span class="panel-count" id="greenlandStatus">-</span>
+ </div>
+ <div class="panel-content" id="greenlandPanel">
+ <div class="loading-msg">Loading...</div>
+ </div>
+ </section>
- const timeAgo = item.pubDate ? getRelativeTime(new Date(item.pubDate)) : '';
+ <!-- Intel Feed -->
+ <section class="panel wide" data-panel="intel">
+ <div class="panel-header">
+ <span class="panel-title">Intel Feed</span>
+ <span class="panel-count" id="intelCount">-</span>
+ </div>
+ <div class="panel-content" id="intelPanel">
+ <div class="loading-msg">Loading...</div>
+ </div>
+ </section>
- return `
- <div class="intel-item ${item.isPriority ? 'priority' : ''}">
- <div class="intel-header">
- <span class="intel-source">${item.source}</span>
- <div class="intel-tags">${tagsHTML}</div>
+ <!-- Correlation Engine -->
+ <section class="panel wide" data-panel="correlation">
+ <div class="panel-header">
+ <span class="panel-title">Correlation Engine</span>
+ <span class="panel-count" id="correlationStatus">ANALYZING</span>
+ </div>
+ <div class="panel-content correlation-panel" id="correlationPanel">
+ <div class="correlation-sections">
+ <div class="correlation-section">
+ <div class="correlation-section-header">
+ <span class="correlation-icon">🔮</span>
+ <span class="correlation-section-title">Emerging Patterns</span>
</div>
- <a href="${item.link}" target="_blank" class="intel-title">${item.title}</a>
- <div class="intel-meta">
- <span>${timeAgo}</span>
+ <div class="correlation-content" id="emergingPatterns">
+ <div class="loading-msg">Scanning for patterns...</div>
</div>
</div>
- `;
- }).join('');
- }
-
- // Get relative time string
- function getRelativeTime(date) {
- const now = new Date();
- const diff = now - date;
- const minutes = Math.floor(diff / 60000);
- const hours = Math.floor(diff / 3600000);
- const days = Math.floor(diff / 86400000);
-
- if (minutes < 60) return `${minutes}m ago`;
- if (hours < 24) return `${hours}h ago`;
- if (days < 7) return `${days}d ago`;
- return date.toLocaleDateString();
- }
-
- // Render Layoffs panel
- function renderLayoffs(layoffs) {
- const panel = document.getElementById('layoffsPanel');
- const count = document.getElementById('layoffsCount');
-
- if (!layoffs || layoffs.length === 0) {
- panel.innerHTML = '<div class="loading-msg">No recent layoffs data</div>';
- count.textContent = '-';
- return;
- }
-
- count.textContent = layoffs.length;
-
- panel.innerHTML = layoffs.map(l => `
- <div class="layoff-item">
- <div class="layoff-company">${l.company}</div>
- ${l.count ? `<div class="layoff-count">${parseInt(l.count).toLocaleString()} jobs</div>` : ''}
- <div class="layoff-meta">
- <span class="headline">${l.title}</span>
- <span class="time">${timeAgo(l.date)}</span>
+ <div class="correlation-section">
+ <div class="correlation-section-header">
+ <span class="correlation-icon">📈</span>
+ <span class="correlation-section-title">Momentum Signals</span>
+ </div>
+ <div class="correlation-content" id="momentumSignals">
+ <div class="loading-msg">Calculating momentum...</div>
+ </div>
</div>
- </div>
- `).join('');
- }
-
- // Render Situation panel (Venezuela or Greenland)
- function renderSituation(panelId, statusId, news, config) {
- const panel = document.getElementById(panelId);
- const status = document.getElementById(statusId);
-
- if (!panel) return;
-
- // Determine threat level based on recent news volume and keywords
- let threatLevel = 'monitoring';
- let threatText = 'MONITORING';
-
- if (news.length > 0) {
- const recentNews = news.filter(n => {
- const date = new Date(n.pubDate);
- const hoursSince = (Date.now() - date.getTime()) / (1000 * 60 * 60);
- return hoursSince < 24;
- });
-
- const criticalKeywords = config.criticalKeywords || [];
- const hasCritical = news.some(n =>
- criticalKeywords.some(k => n.title.toLowerCase().includes(k))
- );
-
- if (hasCritical || recentNews.length >= 3) {
- threatLevel = 'critical';
- threatText = 'CRITICAL';
- } else if (recentNews.length >= 1) {
- threatLevel = 'elevated';
- threatText = 'ELEVATED';
- }
- }
-
- status.innerHTML = `<span class="situation-status ${threatLevel}">${threatText}</span>`;
-
- const newsHTML = news.length > 0 ? news.map(n => `
- <div class="situation-item">
- <a href="${n.link}" target="_blank" class="headline">${n.title}</a>
- <div class="meta">${n.source} · ${timeAgo(n.pubDate)}</div>
- </div>
- `).join('') : '<div class="loading-msg">No recent news</div>';
-
- panel.innerHTML = `
- <div class="situation-header">
- <div class="situation-title">${config.title}</div>
- <div class="situation-subtitle">${config.subtitle}</div>
- </div>
- ${newsHTML}
- `;
- }
-
- // Format relative time
- function timeAgo(dateString) {
- if (!dateString) return '';
- const date = new Date(dateString);
- const now = new Date();
- const seconds = Math.floor((now - date) / 1000);
-
- if (seconds < 60) return 'just now';
- if (seconds < 3600) return Math.floor(seconds / 60) + 'm ago';
- if (seconds < 86400) return Math.floor(seconds / 3600) + 'h ago';
- return Math.floor(seconds / 86400) + 'd ago';
- }
-
- // Render news items
- function renderNews(items, panelId, countId) {
- const panel = document.getElementById(panelId);
- const count = document.getElementById(countId);
-
- if (items.length === 0) {
- panel.innerHTML = '<div class="error-msg">Failed to load</div>';
- count.textContent = '0';
- return;
- }
-
- panel.innerHTML = items.map(item => `
- <div class="item ${item.isAlert ? 'alert' : ''}">
- <div class="item-source">${item.source}${item.isAlert ? '<span class="alert-tag">ALERT</span>' : ''}</div>
- <a class="item-title" href="${item.link}" target="_blank">${item.title}</a>
- <div class="item-time">${timeAgo(item.pubDate)}</div>
- </div>
- `).join('');
-
- count.textContent = items.length;
- }
-
- // Render markets
- function renderMarkets(markets) {
- const panel = document.getElementById('marketsPanel');
- const count = document.getElementById('marketsCount');
-
- if (markets.length === 0) {
- panel.innerHTML = '<div class="error-msg">Failed to load</div>';
- count.textContent = '0';
- return;
- }
-
- panel.innerHTML = markets.map(m => {
- const changeClass = m.change > 0 ? 'up' : m.change < 0 ? 'down' : '';
- const changeText = m.change !== null ? `${m.change > 0 ? '+' : ''}${m.change.toFixed(2)}%` : '-';
- const priceDisplay = typeof m.price === 'number' && m.price > 100
- ? m.price.toLocaleString('en-US', { maximumFractionDigits: 0 })
- : m.price?.toFixed(2);
-
- return `
- <div class="market-item">
- <div>
- <div class="market-name">${m.name}</div>
- <div class="market-symbol">${m.symbol}</div>
+ <div class="correlation-section">
+ <div class="correlation-section-header">
+ <span class="correlation-icon">🔗</span>
+ <span class="correlation-section-title">Cross-Source Correlations</span>
</div>
- <div class="market-data">
- <div class="market-price">$${priceDisplay}</div>
- <div class="market-change ${changeClass}">${changeText}</div>
+ <div class="correlation-content" id="crossSourceCorrelations">
+ <div class="loading-msg">Correlating sources...</div>
</div>
</div>
- `;
- }).join('');
-
- count.textContent = markets.length;
- }
-
- // Render sector heatmap
- function renderHeatmap(sectors) {
- const panel = document.getElementById('heatmapPanel');
-
- if (sectors.length === 0) {
- panel.innerHTML = '<div class="error-msg">Failed to load</div>';
- return;
- }
-
- panel.innerHTML = '<div class="heatmap">' + sectors.map(s => {
- let colorClass = 'up-0';
- const c = s.change;
- if (c >= 2) colorClass = 'up-3';
- else if (c >= 1) colorClass = 'up-2';
- else if (c >= 0.5) colorClass = 'up-1';
- else if (c >= 0) colorClass = 'up-0';
- else if (c >= -0.5) colorClass = 'down-0';
- else if (c >= -1) colorClass = 'down-1';
- else if (c >= -2) colorClass = 'down-2';
- else colorClass = 'down-3';
-
- return `
- <div class="heatmap-cell ${colorClass}">
- <div class="sector-name">${s.name}</div>
- <div class="sector-change">${s.change >= 0 ? '+' : ''}${s.change.toFixed(2)}%</div>
+ <div class="correlation-section">
+ <div class="correlation-section-header">
+ <span class="correlation-icon">⚡</span>
+ <span class="correlation-section-title">Predictive Signals</span>
+ </div>
+ <div class="correlation-content" id="predictiveSignals">
+ <div class="loading-msg">Generating predictions...</div>
+ </div>
</div>
- `;
- }).join('') + '</div>';
- }
-
- // Render commodities
- function renderCommodities(commodities) {
- const panel = document.getElementById('commoditiesPanel');
-
- if (commodities.length === 0) {
- panel.innerHTML = '<div class="error-msg">Failed to load</div>';
- return;
- }
-
- panel.innerHTML = commodities.map(m => {
- const changeClass = m.change > 0 ? 'up' : m.change < 0 ? 'down' : '';
- const changeText = `${m.change > 0 ? '+' : ''}${m.change.toFixed(2)}%`;
- const priceDisplay = m.price?.toFixed(2);
+ </div>
+ </div>
+ </section>
- return `
- <div class="market-item">
- <div>
- <div class="market-name">${m.name}</div>
- <div class="market-symbol">${m.symbol}</div>
+ <!-- Narrative Tracker -->
+ <section class="panel wide" data-panel="narrative">
+ <div class="panel-header">
+ <span class="panel-title">Narrative Tracker</span>
+ <span class="panel-count" id="narrativeStatus">TRACKING</span>
+ </div>
+ <div class="panel-content narrative-panel" id="narrativePanel">
+ <div class="narrative-sections">
+ <div class="narrative-section">
+ <div class="narrative-section-header">
+ <span class="narrative-icon">🌱</span>
+ <span class="narrative-section-title">Emerging Fringe</span>
</div>
- <div class="market-data">
- <div class="market-price">${m.symbol === 'VIX' ? '' : '$'}${priceDisplay}</div>
- <div class="market-change ${changeClass}">${changeText}</div>
+ <div class="narrative-content" id="emergingFringe">
+ <div class="loading-msg">Scanning alternative sources...</div>
</div>
</div>
- `;
- }).join('');
- }
-
- // Render Polymarket predictions
- function renderPolymarket(markets) {
- const panel = document.getElementById('polymarketPanel');
- const count = document.getElementById('polymarketCount');
-
- if (markets.length === 0) {
- panel.innerHTML = '<div class="error-msg">Failed to load predictions</div>';
- count.textContent = '0';
- return;
- }
-
- const formatVolume = (v) => {
- if (v >= 1000000) return '$' + (v / 1000000).toFixed(1) + 'M';
- if (v >= 1000) return '$' + (v / 1000).toFixed(0) + 'K';
- return '$' + v.toFixed(0);
- };
-
- panel.innerHTML = markets.map(m => `
- <div class="prediction-item">
- <div>
- <div class="prediction-question">${m.question}</div>
- <div class="prediction-volume">Vol: ${formatVolume(m.volume)}</div>
+ <div class="narrative-section">
+ <div class="narrative-section-header">
+ <span class="narrative-icon">🔄</span>
+ <span class="narrative-section-title">Fringe → Mainstream</span>
+ </div>
+ <div class="narrative-content" id="fringeToMainstream">
+ <div class="loading-msg">Tracking crossover narratives...</div>
+ </div>
+ </div>
+ <div class="narrative-section">
+ <div class="narrative-section-header">
+ <span class="narrative-icon">👁</span>
+ <span class="narrative-section-title">Narrative Watch</span>
+ </div>
+ <div class="narrative-content" id="narrativeWatch">
+ <div class="loading-msg">Monitoring active narratives...</div>
+ </div>
</div>
- <div class="prediction-odds">
- <span class="prediction-yes">${m.yes}%</span>
+ <div class="narrative-section">
+ <div class="narrative-section-header">
+ <span class="narrative-icon">🎭</span>
+ <span class="narrative-section-title">Disinfo Signals</span>
+ </div>
+ <div class="narrative-content" id="disinfoSignals">
+ <div class="loading-msg">Analyzing signals...</div>
+ </div>
</div>
</div>
- `).join('');
-
- count.textContent = markets.length;
- }
-
- // Update status
- function setStatus(text, loading = false) {
- const status = document.getElementById('status');
- status.textContent = text;
- status.className = loading ? 'status loading' : 'status';
- }
-
- // Staged refresh - loads critical data first for faster perceived startup
- async function refreshAll() {
- const btn = document.getElementById('refreshBtn');
- btn.disabled = true;
- setStatus('Loading critical...', true);
-
- let allNews = [];
-
- try {
- // STAGE 1: Critical data (news + markets) - loads first
- const stage1Promise = Promise.all([
- isPanelEnabled('politics') ? fetchCategory(FEEDS.politics) : Promise.resolve([]),
- isPanelEnabled('tech') ? fetchCategory(FEEDS.tech) : Promise.resolve([]),
- isPanelEnabled('finance') ? fetchCategory(FEEDS.finance) : Promise.resolve([]),
- isPanelEnabled('markets') ? fetchMarkets() : Promise.resolve([]),
- isPanelEnabled('heatmap') ? fetchSectors() : Promise.resolve([])
- ]);
-
- const [politics, tech, finance, markets, sectors] = await stage1Promise;
-
- // Render Stage 1 immediately
- if (isPanelEnabled('politics')) renderNews(politics, 'politicsPanel', 'politicsCount');
- if (isPanelEnabled('tech')) renderNews(tech, 'techPanel', 'techCount');
- if (isPanelEnabled('finance')) renderNews(finance, 'financePanel', 'financeCount');
- if (isPanelEnabled('markets')) renderMarkets(markets);
- if (isPanelEnabled('heatmap')) renderHeatmap(sectors);
-
- allNews = [...politics, ...tech, ...finance];
- setStatus('Loading more...', true);
-
- // STAGE 2: Secondary data (gov, commodities, polymarket, printer, earthquakes)
- const stage2Promise = Promise.all([
- isPanelEnabled('gov') ? fetchCategory(FEEDS.gov) : Promise.resolve([]),
- isPanelEnabled('commodities') ? fetchCommodities() : Promise.resolve([]),
- isPanelEnabled('polymarket') ? fetchPolymarket() : Promise.resolve([]),
- isPanelEnabled('printer') ? fetchFedBalance() : Promise.resolve({ value: 0, change: 0, changePercent: 0, percentOfMax: 0 }),
- isPanelEnabled('map') ? fetchEarthquakes() : Promise.resolve([])
- ]);
-
- const [gov, commodities, polymarket, fedBalance, earthquakes] = await stage2Promise;
-
- if (isPanelEnabled('gov')) {
- renderNews(gov, 'govPanel', 'govCount');
- allNews = [...allNews, ...gov];
- }
- if (isPanelEnabled('commodities')) renderCommodities(commodities);
- if (isPanelEnabled('polymarket')) renderPolymarket(polymarket);
- if (isPanelEnabled('printer')) renderMoneyPrinter(fedBalance);
-
- // Render map with earthquakes and shipping alert data
- if (isPanelEnabled('map')) {
- const activityData = analyzeHotspotActivity(allNews);
- await renderGlobalMap(activityData, earthquakes, allNews);
- }
- if (isPanelEnabled('mainchar')) {
- const mainCharRankings = calculateMainCharacter(allNews);
- renderMainCharacter(mainCharRankings);
- }
-
- if (isPanelEnabled('correlation')) {
- const correlations = analyzeCorrelations(allNews);
- renderCorrelationEngine(correlations);
- }
-
- if (isPanelEnabled('narrative')) {
- const narratives = analyzeNarratives(allNews);
- renderNarrativeTracker(narratives);
- }
-
- setStatus('Loading extras...', true);
-
- // STAGE 3: Extra data (congress, whales, contracts, AI, layoffs, situations, intel) - lowest priority
- const stage3Promise = Promise.all([
- isPanelEnabled('congress') ? fetchCongressTrades() : Promise.resolve([]),
- isPanelEnabled('whales') ? fetchWhaleTransactions() : Promise.resolve([]),
- isPanelEnabled('contracts') ? fetchGovContracts() : Promise.resolve([]),
- isPanelEnabled('ai') ? fetchAINews() : Promise.resolve([]),
- isPanelEnabled('layoffs') ? fetchLayoffs() : Promise.resolve([]),
- isPanelEnabled('venezuela') ? fetchSituationNews('venezuela maduro caracas crisis') : Promise.resolve([]),
- isPanelEnabled('greenland') ? fetchSituationNews('greenland denmark trump arctic') : Promise.resolve([]),
- isPanelEnabled('intel') ? fetchIntelFeed() : Promise.resolve([])
- ]);
-
- const [congressTrades, whales, contracts, aiNews, layoffs, venezuelaNews, greenlandNews, intelFeed] = await stage3Promise;
-
- if (isPanelEnabled('congress')) renderCongressTrades(congressTrades);
- if (isPanelEnabled('whales')) renderWhaleWatch(whales);
- if (isPanelEnabled('contracts')) renderGovContracts(contracts);
- if (isPanelEnabled('ai')) renderAINews(aiNews);
- if (isPanelEnabled('layoffs')) renderLayoffs(layoffs);
- if (isPanelEnabled('intel')) renderIntelFeed(intelFeed);
- if (isPanelEnabled('venezuela')) {
- renderSituation('venezuelaPanel', 'venezuelaStatus', venezuelaNews, {
- title: 'Venezuela Crisis',
- subtitle: 'Political instability & humanitarian situation',
- criticalKeywords: ['invasion', 'military', 'coup', 'violence', 'sanctions', 'arrested']
- });
- }
- if (isPanelEnabled('greenland')) {
- renderSituation('greenlandPanel', 'greenlandStatus', greenlandNews, {
- title: 'Greenland Dispute',
- subtitle: 'US-Denmark tensions over Arctic territory',
- criticalKeywords: ['purchase', 'trump', 'military', 'takeover', 'independence', 'referendum']
- });
- }
-
- // Render My Monitors panel with all news
- if (isPanelEnabled('monitors')) {
- renderMonitorsPanel(allNews);
- }
-
- const now = new Date();
- setStatus(`Updated ${now.toLocaleTimeString()}`);
- } catch (error) {
- console.error('Refresh error:', error);
- setStatus('Error updating');
- }
+ </div>
+ </section>
- btn.disabled = false;
- }
+ <!-- My Monitors -->
+ <section class="panel" data-panel="monitors">
+ <div class="panel-header">
+ <span class="panel-title">My Monitors</span>
+ <span class="panel-count" id="monitorsCount">-</span>
+ </div>
+ <div class="panel-content" id="monitorsPanel">
+ <div class="monitors-empty">
+ No monitors configured
+ <div class="monitors-empty-hint">Click Settings → Add Monitor to get started</div>
+ </div>
+ </div>
+ </section>
- // Initial load
- refreshAll();
+ </main>
- // Auto-refresh every 5 minutes
- setInterval(refreshAll, 5 * 60 * 1000);
- </script>
+ <!-- Load the modular JavaScript -->
+ <script type="module" src="js/main.js"></script>
</body>
</html>
diff --git a/js/constants.js b/js/constants.js
new file mode 100644
index 0000000..9e386e4
--- /dev/null
+++ b/js/constants.js
@@ -0,0 +1,1133 @@
+// constants.js - All data arrays and configuration objects
+
+// Panel configuration with display names
+export const PANELS = {
+ map: { name: 'Global Map', priority: 1 },
+ politics: { name: 'World / Geopolitical', priority: 1 },
+ tech: { name: 'Technology / AI', priority: 1 },
+ finance: { name: 'Financial', priority: 1 },
+ gov: { name: 'Government / Policy', priority: 2 },
+ heatmap: { name: 'Sector Heatmap', priority: 1 },
+ markets: { name: 'Markets', priority: 1 },
+ monitors: { name: 'My Monitors', priority: 1 },
+ commodities: { name: 'Commodities / VIX', priority: 2 },
+ polymarket: { name: 'Polymarket', priority: 2 },
+ congress: { name: 'Congress Trades', priority: 3 },
+ whales: { name: 'Whale Watch', priority: 3 },
+ mainchar: { name: 'Main Character', priority: 2 },
+ printer: { name: 'Money Printer', priority: 2 },
+ contracts: { name: 'Gov Contracts', priority: 3 },
+ ai: { name: 'AI Arms Race', priority: 3 },
+ layoffs: { name: 'Layoffs Tracker', priority: 3 },
+ venezuela: { name: 'Venezuela Situation', priority: 2 },
+ greenland: { name: 'Greenland Situation', priority: 2 },
+ tbpn: { name: 'TBPN Live', priority: 1 },
+ intel: { name: 'Intel Feed', priority: 2 },
+ correlation: { name: 'Correlation Engine', priority: 1 },
+ narrative: { name: 'Narrative Tracker', priority: 1 }
+};
+
+export const NON_DRAGGABLE_PANELS = ['map', 'tbpn'];
+
+// Map zoom settings
+export const MAP_ZOOM_MIN = 1;
+export const MAP_ZOOM_MAX = 4;
+export const MAP_ZOOM_STEP = 0.5;
+
+// CORS proxies for fetching external data
+export const CORS_PROXIES = [
+ 'https://corsproxy.io/?',
+ 'https://api.allorigins.win/raw?url='
+];
+
+// Geopolitical alert keywords
+export const ALERT_KEYWORDS = [
+ 'war', 'invasion', 'military', 'nuclear', 'sanctions', 'missile',
+ 'attack', 'troops', 'conflict', 'strike', 'bomb', 'casualties',
+ 'ceasefire', 'treaty', 'nato', 'coup', 'martial law', 'emergency',
+ 'assassination', 'terrorist', 'hostage', 'evacuation'
+];
+
+// RSS Feed sources
+export const FEEDS = {
+ politics: [
+ { name: 'BBC World', url: 'https://feeds.bbci.co.uk/news/world/rss.xml' },
+ { name: 'NPR News', url: 'https://feeds.npr.org/1001/rss.xml' },
+ { name: 'Guardian World', url: 'https://www.theguardian.com/world/rss' },
+ { name: 'Reuters World', url: 'https://www.reutersagency.com/feed/?taxonomy=best-sectors&post_type=best' }
+ ],
+ tech: [
+ { name: 'Hacker News', url: 'https://hnrss.org/frontpage' },
+ { name: 'Ars Technica', url: 'https://feeds.arstechnica.com/arstechnica/technology-lab' },
+ { name: 'The Verge', url: 'https://www.theverge.com/rss/index.xml' },
+ { name: 'MIT Tech Review', url: 'https://www.technologyreview.com/feed/' },
+ { name: 'ArXiv AI', url: 'https://rss.arxiv.org/rss/cs.AI' },
+ { name: 'OpenAI Blog', url: 'https://openai.com/blog/rss.xml' }
+ ],
+ finance: [
+ { name: 'CNBC', url: 'https://www.cnbc.com/id/100003114/device/rss/rss.html' },
+ { name: 'MarketWatch', url: 'https://feeds.marketwatch.com/marketwatch/topstories' },
+ { name: 'Yahoo Finance', url: 'https://finance.yahoo.com/news/rssindex' },
+ { name: 'Reuters Business', url: 'https://www.reutersagency.com/feed/?best-topics=business-finance&post_type=best' },
+ { name: 'FT', url: 'https://www.ft.com/rss/home' }
+ ],
+ gov: [
+ { name: 'White House', url: 'https://www.whitehouse.gov/feed/' },
+ { name: 'Federal Reserve', url: 'https://www.federalreserve.gov/feeds/press_all.xml' },
+ { name: 'SEC Announcements', url: 'https://www.sec.gov/news/pressreleases.rss' },
+ { name: 'Treasury', url: 'https://home.treasury.gov/system/files/136/treasury-rss.xml' },
+ { name: 'State Dept', url: 'https://www.state.gov/rss-feed/press-releases/feed/' }
+ ]
+};
+
+// Intelligence-focused news sources
+export const INTEL_SOURCES = [
+ { name: 'CSIS', url: 'https://www.csis.org/analysis/feed', type: 'think-tank', topics: ['defense', 'geopolitics'] },
+ { name: 'Brookings', url: 'https://www.brookings.edu/feed/', type: 'think-tank', topics: ['policy', 'geopolitics'] },
+ { name: 'CFR', url: 'https://www.cfr.org/rss.xml', type: 'think-tank', topics: ['foreign-policy'] },
+ { name: 'Defense One', url: 'https://www.defenseone.com/rss/all/', type: 'defense', topics: ['military', 'defense'] },
+ { name: 'War on Rocks', url: 'https://warontherocks.com/feed/', type: 'defense', topics: ['military', 'strategy'] },
+ { name: 'Breaking Defense', url: 'https://breakingdefense.com/feed/', type: 'defense', topics: ['military', 'defense'] },
+ { name: 'The Drive War Zone', url: 'https://www.thedrive.com/the-war-zone/feed', type: 'defense', topics: ['military'] },
+ { name: 'The Diplomat', url: 'https://thediplomat.com/feed/', type: 'regional', topics: ['asia-pacific'], region: 'APAC' },
+ { name: 'Al-Monitor', url: 'https://www.al-monitor.com/rss', type: 'regional', topics: ['middle-east'], region: 'MENA' },
+ { name: 'Bellingcat', url: 'https://www.bellingcat.com/feed/', type: 'osint', topics: ['investigation', 'osint'] },
+ { name: 'DoD News', url: 'https://www.defense.gov/DesktopModules/ArticleCS/RSS.ashx?max=10&ContentType=1&Site=945', type: 'govt', topics: ['military', 'official'] },
+ { name: 'State Dept', url: 'https://www.state.gov/rss-feed/press-releases/feed/', type: 'govt', topics: ['diplomacy', 'official'] },
+ { name: 'CISA Alerts', url: 'https://www.cisa.gov/uscert/ncas/alerts.xml', type: 'cyber', topics: ['cyber', 'security'] },
+ { name: 'Krebs Security', url: 'https://krebsonsecurity.com/feed/', type: 'cyber', topics: ['cyber', 'security'] }
+];
+
+// Region detection keywords for tagging
+export const REGION_KEYWORDS = {
+ 'EUROPE': ['nato', 'eu', 'european', 'ukraine', 'russia', 'germany', 'france', 'uk', 'britain', 'poland'],
+ 'MENA': ['iran', 'israel', 'saudi', 'syria', 'iraq', 'gaza', 'lebanon', 'yemen', 'houthi', 'middle east'],
+ 'APAC': ['china', 'taiwan', 'japan', 'korea', 'indo-pacific', 'south china sea', 'asean', 'philippines'],
+ 'AMERICAS': ['us', 'america', 'canada', 'mexico', 'brazil', 'venezuela', 'latin'],
+ 'AFRICA': ['africa', 'sahel', 'niger', 'sudan', 'ethiopia', 'somalia']
+};
+
+// Topic detection keywords
+export const TOPIC_KEYWORDS = {
+ 'CYBER': ['cyber', 'hack', 'ransomware', 'malware', 'breach', 'apt', 'vulnerability'],
+ 'NUCLEAR': ['nuclear', 'icbm', 'warhead', 'nonproliferation', 'uranium', 'plutonium'],
+ 'CONFLICT': ['war', 'military', 'troops', 'invasion', 'strike', 'missile', 'combat', 'offensive'],
+ 'INTEL': ['intelligence', 'espionage', 'spy', 'cia', 'mossad', 'fsb', 'covert'],
+ 'DEFENSE': ['pentagon', 'dod', 'defense', 'military', 'army', 'navy', 'air force'],
+ 'DIPLO': ['diplomat', 'embassy', 'treaty', 'sanctions', 'talks', 'summit', 'bilateral']
+};
+
+// Sector ETFs for heatmap
+export const SECTORS = [
+ { symbol: 'XLK', name: 'Tech' },
+ { symbol: 'XLF', name: 'Finance' },
+ { symbol: 'XLE', name: 'Energy' },
+ { symbol: 'XLV', name: 'Health' },
+ { symbol: 'XLY', name: 'Consumer' },
+ { symbol: 'XLI', name: 'Industrial' },
+ { symbol: 'XLP', name: 'Staples' },
+ { symbol: 'XLU', name: 'Utilities' },
+ { symbol: 'XLB', name: 'Materials' },
+ { symbol: 'XLRE', name: 'Real Est' },
+ { symbol: 'XLC', name: 'Comms' },
+ { symbol: 'SMH', name: 'Semis' }
+];
+
+// Commodities and VIX
+export const COMMODITIES = [
+ { symbol: '^VIX', name: 'VIX', display: 'VIX' },
+ { symbol: 'GC=F', name: 'Gold', display: 'GOLD' },
+ { symbol: 'CL=F', name: 'Crude Oil', display: 'OIL' },
+ { symbol: 'NG=F', name: 'Natural Gas', display: 'NATGAS' },
+ { symbol: 'SI=F', name: 'Silver', display: 'SILVER' },
+ { symbol: 'HG=F', name: 'Copper', display: 'COPPER' }
+];
+
+// US Major Cities for domestic view
+export const US_CITIES = [
+ {
+ id: 'dc', name: 'Washington D.C.', state: 'DC', lat: 38.9072, lon: -77.0369,
+ type: 'capital', population: '700K',
+ keywords: ['washington', 'capitol', 'congress', 'white house', 'pentagon', 'dc', 'biden', 'trump'],
+ description: 'Federal government center. White House, Capitol Hill, Pentagon, and major federal agencies.',
+ sectors: ['Government', 'Defense', 'Policy']
+ },
+ {
+ id: 'nyc', name: 'New York City', state: 'NY', lat: 40.7128, lon: -74.0060,
+ type: 'major', population: '8.3M',
+ keywords: ['new york', 'nyc', 'manhattan', 'wall street', 'broadway', 'brooklyn'],
+ description: 'Financial capital. Wall Street, major media headquarters, UN headquarters.',
+ sectors: ['Finance', 'Media', 'Tech']
+ },
+ {
+ id: 'la', name: 'Los Angeles', state: 'CA', lat: 34.0522, lon: -118.2437,
+ type: 'major', population: '3.9M',
+ keywords: ['los angeles', 'la', 'hollywood', 'california', 'socal'],
+ description: 'Entertainment industry hub. Major port, aerospace, and tech presence.',
+ sectors: ['Entertainment', 'Tech', 'Aerospace']
+ },
+ {
+ id: 'chicago', name: 'Chicago', state: 'IL', lat: 41.8781, lon: -87.6298,
+ type: 'major', population: '2.7M',
+ keywords: ['chicago', 'illinois', 'midwest'],
+ description: 'Midwest economic hub. Commodities trading, transportation logistics.',
+ sectors: ['Finance', 'Logistics', 'Manufacturing']
+ },
+ {
+ id: 'houston', name: 'Houston', state: 'TX', lat: 29.7604, lon: -95.3698,
+ type: 'major', population: '2.3M',
+ keywords: ['houston', 'texas', 'energy', 'oil', 'nasa'],
+ description: 'Energy capital. Oil & gas headquarters, NASA Johnson Space Center.',
+ sectors: ['Energy', 'Aerospace', 'Healthcare']
+ },
+ {
+ id: 'sf', name: 'San Francisco', state: 'CA', lat: 37.7749, lon: -122.4194,
+ type: 'major', population: '870K',
+ keywords: ['san francisco', 'sf', 'bay area', 'silicon valley', 'tech'],
+ description: 'Tech industry epicenter. Venture capital, startups, major tech HQs.',
+ sectors: ['Tech', 'Finance', 'Biotech']
+ },
+ {
+ id: 'seattle', name: 'Seattle', state: 'WA', lat: 47.6062, lon: -122.3321,
+ type: 'major', population: '750K',
+ keywords: ['seattle', 'washington', 'amazon', 'microsoft', 'boeing'],
+ description: 'Pacific Northwest tech hub. Amazon, Microsoft, Boeing headquarters.',
+ sectors: ['Tech', 'Aerospace', 'E-commerce']
+ },
+ {
+ id: 'miami', name: 'Miami', state: 'FL', lat: 25.7617, lon: -80.1918,
+ type: 'major', population: '450K',
+ keywords: ['miami', 'florida', 'latin america', 'caribbean'],
+ description: 'Gateway to Latin America. Finance, real estate, tourism hub.',
+ sectors: ['Finance', 'Real Estate', 'Tourism']
+ },
+ {
+ id: 'atlanta', name: 'Atlanta', state: 'GA', lat: 33.7490, lon: -84.3880,
+ type: 'major', population: '500K',
+ keywords: ['atlanta', 'georgia', 'cdc', 'delta'],
+ description: 'Southeast economic center. CDC headquarters, major logistics hub.',
+ sectors: ['Logistics', 'Healthcare', 'Media']
+ },
+ {
+ id: 'boston', name: 'Boston', state: 'MA', lat: 42.3601, lon: -71.0589,
+ type: 'major', population: '680K',
+ keywords: ['boston', 'massachusetts', 'harvard', 'mit', 'biotech'],
+ description: 'Education and biotech hub. Harvard, MIT, major hospitals.',
+ sectors: ['Education', 'Biotech', 'Finance']
+ },
+ {
+ id: 'denver', name: 'Denver', state: 'CO', lat: 39.7392, lon: -104.9903,
+ type: 'regional', population: '720K',
+ keywords: ['denver', 'colorado', 'aerospace'],
+ description: 'Mountain West hub. Aerospace, tech growth, federal facilities.',
+ sectors: ['Aerospace', 'Tech', 'Energy']
+ },
+ {
+ id: 'phoenix', name: 'Phoenix', state: 'AZ', lat: 33.4484, lon: -112.0740,
+ type: 'regional', population: '1.6M',
+ keywords: ['phoenix', 'arizona', 'semiconductor', 'tsmc'],
+ description: 'Fast-growing Sun Belt metro. Semiconductor manufacturing expansion.',
+ sectors: ['Manufacturing', 'Tech', 'Real Estate']
+ },
+ {
+ id: 'austin', name: 'Austin', state: 'TX', lat: 30.2672, lon: -97.7431,
+ type: 'regional', population: '1M',
+ keywords: ['austin', 'texas', 'tesla', 'tech'],
+ description: 'Texas tech hub. Tesla, Samsung, major tech company expansions.',
+ sectors: ['Tech', 'Manufacturing', 'Entertainment']
+ },
+ {
+ id: 'detroit', name: 'Detroit', state: 'MI', lat: 42.3314, lon: -83.0458,
+ type: 'regional', population: '640K',
+ keywords: ['detroit', 'michigan', 'auto', 'ev', 'ford', 'gm'],
+ description: 'Auto industry center. EV transition, manufacturing renaissance.',
+ sectors: ['Auto', 'Manufacturing', 'Tech']
+ },
+ {
+ id: 'vegas', name: 'Las Vegas', state: 'NV', lat: 36.1699, lon: -115.1398,
+ type: 'regional', population: '650K',
+ keywords: ['las vegas', 'vegas', 'nevada', 'gaming'],
+ description: 'Entertainment and convention hub. Growing tech presence.',
+ sectors: ['Tourism', 'Entertainment', 'Tech']
+ },
+ {
+ id: 'norfolk', name: 'Norfolk', state: 'VA', lat: 36.8508, lon: -76.2859,
+ type: 'military', population: '245K',
+ keywords: ['norfolk', 'navy', 'naval', 'fleet'],
+ description: 'Largest naval base in world. Atlantic Fleet headquarters.',
+ sectors: ['Military', 'Defense', 'Shipbuilding']
+ },
+ {
+ id: 'sandiego', name: 'San Diego', state: 'CA', lat: 32.7157, lon: -117.1611,
+ type: 'military', population: '1.4M',
+ keywords: ['san diego', 'navy', 'pacific fleet', 'border'],
+ description: 'Major military hub. Pacific Fleet, border region.',
+ sectors: ['Military', 'Biotech', 'Tourism']
+ }
+];
+
+// US Breaking News Hotspots
+export const US_HOTSPOTS = [
+ {
+ id: 'mn-daycare-fraud',
+ name: 'Minnesota Daycare Fraud',
+ location: 'Minneapolis, MN',
+ lat: 44.9778,
+ lon: -93.2650,
+ level: 'high',
+ category: 'Federal Investigation',
+ description: 'Massive $250M+ fraud scheme involving Feeding Our Future nonprofit. Largest pandemic-era fraud case. Multiple convictions and ongoing trials.',
+ keywords: ['minnesota', 'daycare', 'fraud', 'feeding our future', 'minneapolis', 'pandemic fraud', 'child nutrition', 'somali'],
+ startDate: '2022',
+ status: 'Active Investigation',
+ icon: '⚠'
+ },
+ {
+ id: 'la-wildfires',
+ name: 'California Wildfires',
+ location: 'Los Angeles, CA',
+ lat: 34.0522,
+ lon: -118.2437,
+ level: 'high',
+ category: 'Natural Disaster',
+ description: 'Ongoing wildfire emergency in Los Angeles area. Multiple fires, evacuations, and widespread destruction.',
+ keywords: ['california', 'wildfire', 'los angeles', 'fire', 'evacuation', 'palisades', 'eaton', 'altadena'],
+ startDate: '2025',
+ status: 'Active Emergency',
+ icon: '🔥'
+ },
+ {
+ id: 'border-crisis',
+ name: 'Border Enforcement',
+ location: 'El Paso, TX',
+ lat: 31.7619,
+ lon: -106.4850,
+ level: 'elevated',
+ category: 'Immigration',
+ description: 'Ongoing migration and border enforcement actions. Policy changes, deportations, and humanitarian concerns.',
+ keywords: ['border', 'immigration', 'migrant', 'el paso', 'texas', 'cbp', 'deportation', 'ice'],
+ startDate: '2024',
+ status: 'Ongoing',
+ icon: '🚨'
+ },
+ {
+ id: 'ai-regulation',
+ name: 'AI & Tech Policy',
+ location: 'San Francisco, CA',
+ lat: 37.7749,
+ lon: -122.4194,
+ level: 'medium',
+ category: 'Technology',
+ description: 'Major tech companies facing regulatory scrutiny. AI safety debates, antitrust actions, and policy formation.',
+ keywords: ['openai', 'anthropic', 'google ai', 'ai regulation', 'artificial intelligence', 'tech regulation', 'deepseek'],
+ startDate: '2024',
+ status: 'Developing',
+ icon: '🤖'
+ }
+];
+
+// Middle East hotspots
+export const MIDEAST_HOTSPOTS = [
+ {
+ id: 'gaza-conflict',
+ name: 'Gaza Conflict',
+ location: 'Gaza Strip',
+ lat: 31.3547,
+ lon: 34.3088,
+ level: 'high',
+ category: 'Armed Conflict',
+ description: 'Ongoing Israel-Hamas conflict. Humanitarian crisis, ceasefire negotiations, hostage situation, and military operations.',
+ keywords: ['gaza', 'hamas', 'israel', 'hostage', 'ceasefire', 'rafah', 'humanitarian', 'netanyahu'],
+ startDate: 'Oct 2023',
+ status: 'Active Conflict',
+ icon: '💥'
+ },
+ {
+ id: 'iran-tensions',
+ name: 'Iran Nuclear & Regional',
+ location: 'Tehran, Iran',
+ lat: 35.6892,
+ lon: 51.3890,
+ level: 'high',
+ category: 'Geopolitical',
+ description: 'Nuclear program concerns, regional proxy conflicts, sanctions, and diplomatic tensions with Western powers.',
+ keywords: ['iran', 'tehran', 'nuclear', 'irgc', 'sanctions', 'khamenei', 'enrichment', 'proxy'],
+ startDate: 'Ongoing',
+ status: 'Elevated Tensions',
+ icon: '☢'
+ },
+ {
+ id: 'yemen-houthis',
+ name: 'Yemen & Houthi Attacks',
+ location: 'Sanaa, Yemen',
+ lat: 15.3694,
+ lon: 44.1910,
+ level: 'high',
+ category: 'Armed Conflict',
+ description: 'Houthi attacks on Red Sea shipping, ongoing civil war, and humanitarian catastrophe. US/UK military strikes.',
+ keywords: ['yemen', 'houthi', 'red sea', 'shipping', 'sanaa', 'aden', 'saudi', 'bab el-mandeb'],
+ startDate: '2014',
+ status: 'Active Conflict',
+ icon: '⚔'
+ },
+ {
+ id: 'syria-situation',
+ name: 'Syria Post-Assad',
+ location: 'Damascus, Syria',
+ lat: 33.5138,
+ lon: 36.2765,
+ level: 'elevated',
+ category: 'Political Transition',
+ description: 'Post-Assad transition, HTS governance, reconstruction challenges, and regional power dynamics.',
+ keywords: ['syria', 'damascus', 'hts', 'assad', 'aleppo', 'idlib', 'reconstruction', 'turkey'],
+ startDate: 'Dec 2024',
+ status: 'Political Transition',
+ icon: '🏛'
+ },
+ {
+ id: 'lebanon-hezbollah',
+ name: 'Lebanon Crisis',
+ location: 'Beirut, Lebanon',
+ lat: 33.8938,
+ lon: 35.5018,
+ level: 'elevated',
+ category: 'Political/Security',
+ description: 'Hezbollah tensions, economic collapse, political vacuum, and reconstruction after Israeli operations.',
+ keywords: ['lebanon', 'beirut', 'hezbollah', 'nasrallah', 'economic crisis', 'reconstruction'],
+ startDate: 'Ongoing',
+ status: 'Crisis',
+ icon: '⚠'
+ },
+ {
+ id: 'iraq-instability',
+ name: 'Iraq Security',
+ location: 'Baghdad, Iraq',
+ lat: 33.3152,
+ lon: 44.3661,
+ level: 'medium',
+ category: 'Security',
+ description: 'Militia activities, US military presence, Iranian influence, and political instability.',
+ keywords: ['iraq', 'baghdad', 'militia', 'iran influence', 'us troops', 'pmu'],
+ startDate: 'Ongoing',
+ status: 'Unstable',
+ icon: '🔶'
+ },
+ {
+ id: 'saudi-transformation',
+ name: 'Saudi Vision 2030',
+ location: 'Riyadh, Saudi Arabia',
+ lat: 24.7136,
+ lon: 46.6753,
+ level: 'low',
+ category: 'Economic/Diplomatic',
+ description: 'Economic transformation, NEOM projects, normalization talks, and regional leadership ambitions.',
+ keywords: ['saudi', 'mbs', 'vision 2030', 'neom', 'normalization', 'opec', 'aramco'],
+ startDate: '2016',
+ status: 'Developing',
+ icon: '📈'
+ }
+];
+
+// Ukraine-Russia conflict zone hotspots
+export const UKRAINE_HOTSPOTS = [
+ {
+ id: 'kyiv-capital',
+ name: 'Kyiv Defense',
+ location: 'Kyiv, Ukraine',
+ lat: 50.4501,
+ lon: 30.5234,
+ level: 'high',
+ category: 'Capital Defense',
+ description: 'Ukrainian capital under intermittent missile and drone attacks. Air defense operations and infrastructure targeting.',
+ keywords: ['kyiv', 'kiev', 'ukraine capital', 'air raid', 'missile strike'],
+ startDate: 'Feb 2022',
+ status: 'Active Defense',
+ icon: '🛡'
+ },
+ {
+ id: 'donbas-front',
+ name: 'Donbas Front Line',
+ location: 'Donetsk Oblast',
+ lat: 48.0159,
+ lon: 37.8029,
+ level: 'high',
+ category: 'Active Combat',
+ description: 'Primary axis of Russian offensive operations. Intense fighting around Bakhmut, Avdiivka, and surrounding areas.',
+ keywords: ['donbas', 'donetsk', 'bakhmut', 'avdiivka', 'luhansk', 'front line'],
+ startDate: '2014',
+ status: 'Active Combat Zone',
+ icon: '⚔'
+ },
+ {
+ id: 'kherson-front',
+ name: 'Kherson-Zaporizhzhia',
+ location: 'Southern Ukraine',
+ lat: 46.6354,
+ lon: 32.6169,
+ level: 'high',
+ category: 'Southern Front',
+ description: 'Southern front including Kherson region and Zaporizhzhia nuclear plant concerns. Cross-river operations.',
+ keywords: ['kherson', 'zaporizhzhia', 'dnipro river', 'nuclear plant', 'southern front'],
+ startDate: 'Feb 2022',
+ status: 'Active Front',
+ icon: '☢'
+ },
+ {
+ id: 'crimea-logistics',
+ name: 'Crimea Operations',
+ location: 'Crimean Peninsula',
+ lat: 44.9521,
+ lon: 34.1024,
+ level: 'elevated',
+ category: 'Strategic Target',
+ description: 'Ukrainian strikes on Russian military logistics, Kerch Bridge, and naval assets in occupied Crimea.',
+ keywords: ['crimea', 'kerch bridge', 'sevastopol', 'black sea fleet'],
+ startDate: '2022',
+ status: 'Strike Operations',
+ icon: '🎯'
+ },
+ {
+ id: 'kursk-incursion',
+ name: 'Kursk Incursion',
+ location: 'Kursk Oblast, Russia',
+ lat: 51.7373,
+ lon: 36.1874,
+ level: 'high',
+ category: 'Cross-Border Op',
+ description: 'Ukrainian forces operating inside Russian territory in Kursk region. Significant territorial control.',
+ keywords: ['kursk', 'russia incursion', 'cross-border', 'russian territory'],
+ startDate: 'Aug 2024',
+ status: 'Active Operation',
+ icon: '🔥'
+ },
+ {
+ id: 'moscow-drone',
+ name: 'Moscow Drone War',
+ location: 'Moscow, Russia',
+ lat: 55.7558,
+ lon: 37.6173,
+ level: 'medium',
+ category: 'Drone Attacks',
+ description: 'Ukrainian drone attacks reaching Russian capital and surrounding regions. Psychological and strategic impact.',
+ keywords: ['moscow', 'drone attack', 'kremlin', 'russian capital'],
+ startDate: '2023',
+ status: 'Ongoing Strikes',
+ icon: '🚁'
+ },
+ {
+ id: 'belarus-staging',
+ name: 'Belarus Border',
+ location: 'Minsk, Belarus',
+ lat: 53.9045,
+ lon: 27.5615,
+ level: 'elevated',
+ category: 'Staging Area',
+ description: 'Potential staging area for Russian operations. Lukashenko regime support. Training of Russian forces.',
+ keywords: ['belarus', 'minsk', 'lukashenko', 'staging', 'northern threat'],
+ startDate: 'Feb 2022',
+ status: 'Monitoring',
+ icon: '⚠'
+ },
+ {
+ id: 'black-sea',
+ name: 'Black Sea Control',
+ location: 'Black Sea',
+ lat: 43.4,
+ lon: 34.0,
+ level: 'elevated',
+ category: 'Naval Theater',
+ description: 'Naval warfare, grain corridor disputes, and Russian fleet degradation from Ukrainian strikes.',
+ keywords: ['black sea', 'naval', 'grain', 'odesa', 'fleet'],
+ startDate: 'Feb 2022',
+ status: 'Naval Operations',
+ icon: '⚓'
+ }
+];
+
+// China-Taiwan strait hotspots
+export const TAIWAN_HOTSPOTS = [
+ {
+ id: 'taiwan-strait',
+ name: 'Taiwan Strait',
+ location: 'Taiwan Strait',
+ lat: 24.5,
+ lon: 119.5,
+ level: 'high',
+ category: 'Flashpoint',
+ description: 'Primary potential conflict zone. PLA military exercises, naval patrols, and median line crossings.',
+ keywords: ['taiwan strait', 'median line', 'pla navy', 'blockade'],
+ startDate: 'Ongoing',
+ status: 'High Tension',
+ icon: '⚡'
+ },
+ {
+ id: 'taipei-capital',
+ name: 'Taipei',
+ location: 'Taipei, Taiwan',
+ lat: 25.0330,
+ lon: 121.5654,
+ level: 'elevated',
+ category: 'Capital Defense',
+ description: 'Taiwan capital and government center. Air defense systems, political developments, and US relations.',
+ keywords: ['taipei', 'taiwan government', 'tsai', 'lai', 'presidential'],
+ startDate: 'Ongoing',
+ status: 'Monitoring',
+ icon: '🏛'
+ },
+ {
+ id: 'south-china-sea',
+ name: 'South China Sea',
+ location: 'Spratly Islands',
+ lat: 10.0,
+ lon: 114.0,
+ level: 'high',
+ category: 'Territorial Dispute',
+ description: 'Contested waters with military outposts. China, Philippines, Vietnam, Malaysia territorial claims.',
+ keywords: ['south china sea', 'spratly', 'paracel', 'nine dash', 'reef', 'philippines'],
+ startDate: 'Ongoing',
+ status: 'Contested',
+ icon: '🏝'
+ },
+ {
+ id: 'fujian-buildup',
+ name: 'Fujian Military Zone',
+ location: 'Fujian Province, China',
+ lat: 26.0,
+ lon: 119.3,
+ level: 'elevated',
+ category: 'Military Buildup',
+ description: 'PLA Eastern Theater Command. Amphibious assault forces, missile bases, and air assets.',
+ keywords: ['fujian', 'eastern theater', 'pla', 'amphibious', 'xiamen'],
+ startDate: 'Ongoing',
+ status: 'Buildup',
+ icon: '🎯'
+ },
+ {
+ id: 'kinmen-matsu',
+ name: 'Kinmen & Matsu',
+ location: 'Kinmen Islands',
+ lat: 24.4493,
+ lon: 118.3767,
+ level: 'elevated',
+ category: 'Frontline Islands',
+ description: 'Taiwan-controlled islands near China coast. Gray zone tactics, drone incursions, cable cuts.',
+ keywords: ['kinmen', 'matsu', 'quemoy', 'offshore islands', 'cable cut'],
+ startDate: 'Ongoing',
+ status: 'Gray Zone',
+ icon: '⚠'
+ },
+ {
+ id: 'first-island-chain',
+ name: 'First Island Chain',
+ location: 'Okinawa, Japan',
+ lat: 26.5,
+ lon: 128.0,
+ level: 'medium',
+ category: 'Strategic Defense',
+ description: 'US-Japan defense perimeter. Okinawa bases, missile deployments, AUKUS coordination.',
+ keywords: ['okinawa', 'first island chain', 'kadena', 'us japan', 'aukus'],
+ startDate: 'Ongoing',
+ status: 'Allied Posture',
+ icon: '🛡'
+ },
+ {
+ id: 'beijing-command',
+ name: 'Beijing',
+ location: 'Beijing, China',
+ lat: 39.9042,
+ lon: 116.4074,
+ level: 'medium',
+ category: 'Command Center',
+ description: 'CCP leadership and Central Military Commission. Policy decisions, Xi Jinping directives.',
+ keywords: ['beijing', 'xi jinping', 'ccp', 'central military', 'politburo'],
+ startDate: 'Ongoing',
+ status: 'Command',
+ icon: '🔴'
+ },
+ {
+ id: 'philippines-disputes',
+ name: 'Philippines Tensions',
+ location: 'Scarborough Shoal',
+ lat: 15.15,
+ lon: 117.75,
+ level: 'high',
+ category: 'Maritime Dispute',
+ description: 'China-Philippines confrontations. Coast guard clashes, water cannon incidents, BRP Sierra Madre.',
+ keywords: ['scarborough', 'philippines', 'ayungin', 'sierra madre', 'coast guard', 'marcos'],
+ startDate: '2023',
+ status: 'Active Tensions',
+ icon: '🚢'
+ }
+];
+
+// Intelligence hotspots with coordinates
+export const INTEL_HOTSPOTS = [
+ {
+ id: 'dc', name: 'DC', subtext: 'Pentagon Pizza Index', lat: 38.9, lon: -77.0,
+ keywords: ['pentagon', 'white house', 'washington', 'us military', 'cia', 'nsa', 'biden', 'trump'],
+ description: 'US national security hub. Pentagon, CIA, NSA, State Dept. Monitor for late-night activity spikes.',
+ agencies: ['Pentagon', 'CIA', 'NSA', 'State Dept'],
+ status: 'Active monitoring'
+ },
+ {
+ id: 'moscow', name: 'Moscow', subtext: 'Kremlin Activity', lat: 55.75, lon: 37.6,
+ keywords: ['russia', 'putin', 'kremlin', 'moscow', 'russian'],
+ description: 'Russian political and military command center. FSB, GRU, Presidential Administration.',
+ agencies: ['FSB', 'GRU', 'SVR', 'Kremlin'],
+ status: 'High activity'
+ },
+ {
+ id: 'beijing', name: 'Beijing', subtext: 'PLA/MSS Activity', lat: 39.9, lon: 116.4,
+ keywords: ['china', 'beijing', 'chinese', 'xi jinping', 'taiwan strait', 'pla'],
+ description: 'Chinese Communist Party headquarters. PLA command, MSS intelligence operations.',
+ agencies: ['PLA', 'MSS', 'CCP Politburo'],
+ status: 'Elevated posture'
+ },
+ {
+ id: 'kyiv', name: 'Kyiv', subtext: 'Conflict Zone', lat: 50.45, lon: 30.5,
+ keywords: ['ukraine', 'kyiv', 'zelensky', 'ukrainian', 'donbas', 'crimea'],
+ description: 'Ukrainian capital under wartime conditions. Government, military coordination center.',
+ agencies: ['SBU', 'GUR', 'Armed Forces'],
+ status: 'Active conflict'
+ },
+ {
+ id: 'taipei', name: 'Taipei', subtext: 'Strait Watch', lat: 25.03, lon: 121.5,
+ keywords: ['taiwan', 'taipei', 'taiwanese', 'strait'],
+ description: 'Taiwan government and military HQ. ADIZ violations and PLA exercises tracked.',
+ agencies: ['NSB', 'MND', 'AIT'],
+ status: 'Heightened alert'
+ },
+ {
+ id: 'tehran', name: 'Tehran', subtext: 'IRGC Activity', lat: 35.7, lon: 51.4,
+ keywords: ['iran', 'tehran', 'iranian', 'irgc', 'hezbollah', 'nuclear'],
+ description: 'Iranian regime center. IRGC Quds Force, nuclear program oversight, proxy coordination.',
+ agencies: ['IRGC', 'MOIS', 'AEOI'],
+ status: 'Proxy operations active'
+ },
+ {
+ id: 'jerusalem', name: 'Tel Aviv', subtext: 'Mossad/IDF', lat: 32.07, lon: 34.78,
+ keywords: ['israel', 'israeli', 'gaza', 'hamas', 'idf', 'netanyahu', 'mossad'],
+ description: 'Israeli security apparatus. IDF operations, Mossad intel, Shin Bet domestic security.',
+ agencies: ['Mossad', 'IDF', 'Shin Bet', 'Aman'],
+ status: 'Active operations'
+ },
+ {
+ id: 'pyongyang', name: 'Pyongyang', subtext: 'DPRK Watch', lat: 39.03, lon: 125.75,
+ keywords: ['north korea', 'kim jong', 'pyongyang', 'dprk', 'korean missile'],
+ description: 'North Korean leadership compound. Nuclear/missile program, regime stability indicators.',
+ agencies: ['RGB', 'KPA', 'SSD'],
+ status: 'Missile tests ongoing'
+ },
+ {
+ id: 'london', name: 'London', subtext: 'GCHQ/MI6', lat: 51.5, lon: -0.12,
+ keywords: ['uk', 'britain', 'british', 'mi6', 'gchq', 'london'],
+ description: 'UK intelligence community hub. Five Eyes partner, SIGINT, foreign intelligence.',
+ agencies: ['MI6', 'GCHQ', 'MI5'],
+ status: 'Normal operations'
+ },
+ {
+ id: 'brussels', name: 'Brussels', subtext: 'NATO HQ', lat: 50.85, lon: 4.35,
+ keywords: ['nato', 'eu', 'european union', 'brussels'],
+ description: 'NATO headquarters and EU institutions. Alliance coordination, Article 5 readiness.',
+ agencies: ['NATO', 'EU Commission', 'EEAS'],
+ status: 'Enhanced readiness'
+ },
+ {
+ id: 'caracas', name: 'Caracas', subtext: 'Venezuela Crisis', lat: 10.5, lon: -66.9,
+ keywords: ['venezuela', 'maduro', 'caracas', 'guaido', 'venezuelan', 'pdvsa'],
+ description: 'Venezuelan political crisis center. Maduro regime, opposition movements, oil politics.',
+ agencies: ['SEBIN', 'DGCIM', 'GNB'],
+ status: 'Political instability'
+ },
+ {
+ id: 'greenland', name: 'Nuuk', subtext: 'Arctic Dispute', lat: 64.18, lon: -51.7,
+ keywords: ['greenland', 'denmark', 'arctic', 'nuuk', 'thule', 'rare earth'],
+ description: 'Arctic strategic territory. US military presence, rare earth minerals, sovereignty questions.',
+ agencies: ['Danish Defence', 'US Space Force', 'Arctic Council'],
+ status: 'Diplomatic tensions'
+ }
+];
+
+// Shipping chokepoints for supply chain monitoring
+export const SHIPPING_CHOKEPOINTS = [
+ {
+ id: 'suez',
+ name: 'Suez Canal',
+ lat: 30.0,
+ lon: 32.5,
+ keywords: ['suez', 'red sea', 'houthi', 'canal'],
+ desc: 'Critical waterway connecting Mediterranean to Red Sea. ~12% of global trade. Currently threatened by Houthi attacks.',
+ traffic: '~50 ships/day',
+ region: 'Egypt'
+ },
+ {
+ id: 'panama',
+ name: 'Panama Canal',
+ lat: 9.1,
+ lon: -79.7,
+ keywords: ['panama canal', 'panama'],
+ desc: 'Links Atlantic and Pacific oceans. ~5% of global trade. Facing drought-related capacity restrictions.',
+ traffic: '~40 ships/day',
+ region: 'Panama'
+ },
+ {
+ id: 'hormuz',
+ name: 'Strait of Hormuz',
+ lat: 26.5,
+ lon: 56.3,
+ keywords: ['hormuz', 'strait of hormuz', 'persian gulf'],
+ desc: 'Only sea route from Persian Gulf to open ocean. ~21% of global oil passes through daily.',
+ traffic: '~20 tankers/day',
+ region: 'Iran/Oman'
+ },
+ {
+ id: 'malacca',
+ name: 'Malacca Strait',
+ lat: 2.5,
+ lon: 101.5,
+ keywords: ['malacca', 'singapore strait'],
+ desc: 'Main shipping route between Indian and Pacific oceans. ~25% of global trade including ~25% of oil.',
+ traffic: '~80 ships/day',
+ region: 'Malaysia/Singapore'
+ },
+ {
+ id: 'bosphorus',
+ name: 'Bosphorus Strait',
+ lat: 41.1,
+ lon: 29.0,
+ keywords: ['bosphorus', 'black sea', 'turkish strait'],
+ desc: 'Only route between Black Sea and Mediterranean. Critical for Russian/Ukrainian grain exports.',
+ traffic: '~45 ships/day',
+ region: 'Turkey'
+ }
+];
+
+// Cyber threat regions
+export const CYBER_REGIONS = [
+ {
+ id: 'cyber_russia',
+ name: 'RU',
+ fullName: 'Russia',
+ lat: 55.75,
+ lon: 45.0,
+ group: 'APT28/29',
+ aka: 'Fancy Bear / Cozy Bear',
+ sponsor: 'GRU / FSB',
+ desc: 'State-sponsored groups linked to Russian intelligence. Known for election interference, government espionage, and critical infrastructure attacks.',
+ targets: ['Government', 'Defense', 'Energy', 'Elections', 'Media']
+ },
+ {
+ id: 'cyber_china',
+ name: 'CN',
+ fullName: 'China',
+ lat: 35.0,
+ lon: 105.0,
+ group: 'APT41',
+ aka: 'Double Dragon / Winnti',
+ sponsor: 'MSS',
+ desc: 'Hybrid espionage and financially motivated group. Conducts state-sponsored intelligence and supply chain attacks.',
+ targets: ['Tech', 'Telecom', 'Healthcare', 'Gaming', 'Supply Chain']
+ },
+ {
+ id: 'cyber_nk',
+ name: 'NK',
+ fullName: 'North Korea',
+ lat: 39.0,
+ lon: 127.0,
+ group: 'Lazarus',
+ aka: 'Hidden Cobra / APT38',
+ sponsor: 'RGB',
+ desc: 'Financially motivated attacks to fund regime. Known for cryptocurrency theft, SWIFT banking attacks, and ransomware.',
+ targets: ['Crypto', 'Banks', 'Defense', 'Media', 'Critical Infra']
+ },
+ {
+ id: 'cyber_iran',
+ name: 'IR',
+ fullName: 'Iran',
+ lat: 32.0,
+ lon: 53.0,
+ group: 'APT33/35',
+ aka: 'Charming Kitten / Elfin',
+ sponsor: 'IRGC',
+ desc: 'Focus on regional adversaries and dissidents. Known for destructive wiper malware and spear-phishing campaigns.',
+ targets: ['Energy', 'Aviation', 'Government', 'Dissidents', 'Israel']
+ }
+];
+
+// Active conflict zones with approximate boundaries
+export const CONFLICT_ZONES = [
+ {
+ id: 'ukraine',
+ name: 'Ukraine Conflict',
+ intensity: 'high',
+ coords: [
+ [37.5, 47.0], [38.5, 47.5], [39.0, 48.5], [38.0, 49.5],
+ [37.0, 49.0], [36.0, 48.5], [35.5, 47.5], [36.5, 47.0]
+ ],
+ labelPos: { lat: 48.0, lon: 37.5 },
+ startDate: 'Feb 24, 2022',
+ parties: ['Russia', 'Ukraine', 'NATO (support)'],
+ casualties: '500,000+ (est.)',
+ displaced: '6.5M+ refugees',
+ description: 'Full-scale Russian invasion of Ukraine. Active frontlines in Donetsk, Luhansk, Zaporizhzhia, and Kherson oblasts. Heavy artillery, drone warfare, and trench combat.',
+ keyEvents: ['Battle of Bakhmut', 'Kursk incursion', 'Black Sea drone strikes', 'Infrastructure attacks'],
+ keywords: ['ukraine', 'russia', 'zelensky', 'putin', 'donbas', 'crimea', 'bakhmut', 'kursk']
+ },
+ {
+ id: 'gaza',
+ name: 'Gaza Conflict',
+ intensity: 'high',
+ coords: [
+ [34.2, 31.6], [34.6, 31.6], [34.6, 31.2], [34.2, 31.2]
+ ],
+ labelPos: { lat: 31.4, lon: 34.4 },
+ startDate: 'Oct 7, 2023',
+ parties: ['Israel (IDF)', 'Hamas', 'Palestinian Islamic Jihad'],
+ casualties: '45,000+ (Gaza), 1,200+ (Israel)',
+ displaced: '2M+ internally displaced',
+ description: 'Israeli military operation in Gaza following Oct 7 Hamas attacks. Urban warfare, humanitarian crisis, regional escalation with Hezbollah and Houthis.',
+ keyEvents: ['Oct 7 attacks', 'Ground invasion', 'Rafah operation', 'Hostage negotiations'],
+ keywords: ['gaza', 'israel', 'hamas', 'idf', 'netanyahu', 'hostage', 'rafah', 'hezbollah']
+ },
+ {
+ id: 'sudan',
+ name: 'Sudan Civil War',
+ intensity: 'medium',
+ coords: [
+ [32.0, 16.0], [34.0, 16.5], [35.0, 15.0], [33.5, 13.5],
+ [31.5, 14.0], [31.0, 15.5]
+ ],
+ labelPos: { lat: 15.0, lon: 32.5 },
+ startDate: 'Apr 15, 2023',
+ parties: ['Sudanese Armed Forces (SAF)', 'Rapid Support Forces (RSF)'],
+ casualties: '15,000+ killed',
+ displaced: '10M+ displaced',
+ description: 'Power struggle between SAF and RSF paramilitary. Fighting centered around Khartoum, Darfur. Major humanitarian catastrophe with famine conditions.',
+ keyEvents: ['Khartoum battle', 'Darfur massacres', 'El Fasher siege', 'Famine declared'],
+ keywords: ['sudan', 'khartoum', 'rsf', 'darfur', 'burhan', 'hemedti']
+ },
+ {
+ id: 'myanmar',
+ name: 'Myanmar Civil War',
+ intensity: 'medium',
+ coords: [
+ [96.0, 22.0], [98.0, 23.0], [98.5, 21.0], [97.0, 19.5], [95.5, 20.5]
+ ],
+ labelPos: { lat: 21.0, lon: 96.5 },
+ startDate: 'Feb 1, 2021',
+ parties: ['Military Junta (SAC)', 'Ethnic Armed Organizations', 'People\'s Defense Forces'],
+ casualties: '50,000+ (est.)',
+ displaced: '3M+ internally displaced',
+ description: 'Armed resistance following 2021 military coup. Multiple ethnic armies and pro-democracy forces fighting junta. Recent rebel advances in border regions.',
+ keyEvents: ['Operation 1027', 'Lashio capture', 'Myawaddy offensive', 'Junta conscription'],
+ keywords: ['myanmar', 'burma', 'junta', 'arakan', 'karen', 'kachin']
+ },
+ {
+ id: 'taiwan_strait',
+ name: 'Taiwan Strait',
+ intensity: 'watch',
+ coords: [
+ [119.0, 26.0], [121.5, 26.0], [121.5, 22.5], [119.0, 22.5]
+ ],
+ labelPos: { lat: 24.5, lon: 120.0 },
+ startDate: 'Ongoing tensions',
+ parties: ['China (PLA)', 'Taiwan (ROC)', 'United States (deterrence)'],
+ casualties: 'N/A - no active combat',
+ displaced: 'N/A',
+ description: 'Heightened tensions over Taiwan sovereignty. Regular PLA exercises, airspace incursions, naval activity. Risk of flashpoint escalation.',
+ keyEvents: ['PLA exercises', 'ADIZ incursions', 'US arms sales', 'Diplomatic tensions'],
+ keywords: ['taiwan', 'china', 'strait', 'pla', 'tsai', 'invasion']
+ }
+];
+
+// Military bases around the world
+export const MILITARY_BASES = [
+ { id: 'ramstein', name: 'Ramstein AB', lat: 49.44, lon: 7.6, type: 'us-nato' },
+ { id: 'diego_garcia', name: 'Diego Garcia', lat: -7.32, lon: 72.42, type: 'us-nato' },
+ { id: 'guam', name: 'Andersen AFB', lat: 13.58, lon: 144.92, type: 'us-nato' },
+ { id: 'okinawa', name: 'Kadena AB', lat: 26.35, lon: 127.77, type: 'us-nato' },
+ { id: 'yokosuka', name: 'Yokosuka', lat: 35.28, lon: 139.67, type: 'us-nato' },
+ { id: 'bahrain', name: 'NSA Bahrain', lat: 26.23, lon: 50.65, type: 'us-nato' },
+ { id: 'qatar', name: 'Al Udeid', lat: 25.12, lon: 51.31, type: 'us-nato' },
+ { id: 'djibouti', name: 'Camp Lemonnier', lat: 11.55, lon: 43.15, type: 'us-nato' },
+ { id: 'incirlik', name: 'Incirlik AB', lat: 37.0, lon: 35.43, type: 'us-nato' },
+ { id: 'rota', name: 'NS Rota', lat: 36.62, lon: -6.35, type: 'us-nato' },
+ { id: 'djibouti_cn', name: 'PLA Djibouti', lat: 11.59, lon: 43.05, type: 'china' },
+ { id: 'woody_island', name: 'Woody Island', lat: 16.83, lon: 112.33, type: 'china' },
+ { id: 'fiery_cross', name: 'Fiery Cross', lat: 9.55, lon: 112.89, type: 'china' },
+ { id: 'mischief_reef', name: 'Mischief Reef', lat: 9.90, lon: 115.53, type: 'china' },
+ { id: 'ream', name: 'Ream (Cambodia)', lat: 10.52, lon: 103.63, type: 'china' },
+ { id: 'kaliningrad', name: 'Kaliningrad', lat: 54.71, lon: 20.51, type: 'russia' },
+ { id: 'sevastopol', name: 'Sevastopol', lat: 44.62, lon: 33.53, type: 'russia' },
+ { id: 'tartus', name: 'Tartus (Syria)', lat: 34.89, lon: 35.87, type: 'russia' },
+ { id: 'hmeimim', name: 'Hmeimim AB', lat: 35.41, lon: 35.95, type: 'russia' },
+ { id: 'cam_ranh', name: 'Cam Ranh', lat: 11.99, lon: 109.22, type: 'russia' }
+];
+
+// Nuclear facilities
+export const NUCLEAR_FACILITIES = [
+ { id: 'zaporizhzhia', name: 'Zaporizhzhia NPP', lat: 47.51, lon: 34.58, type: 'plant', status: 'contested' },
+ { id: 'fukushima', name: 'Fukushima', lat: 37.42, lon: 141.03, type: 'plant', status: 'decommissioning' },
+ { id: 'flamanville', name: 'Flamanville', lat: 49.54, lon: -1.88, type: 'plant', status: 'active' },
+ { id: 'bruce', name: 'Bruce Power', lat: 44.33, lon: -81.60, type: 'plant', status: 'active' },
+ { id: 'natanz', name: 'Natanz', lat: 33.72, lon: 51.73, type: 'enrichment', status: 'active' },
+ { id: 'fordow', name: 'Fordow', lat: 34.88, lon: 51.0, type: 'enrichment', status: 'active' },
+ { id: 'yongbyon', name: 'Yongbyon', lat: 39.80, lon: 125.75, type: 'weapons', status: 'active' },
+ { id: 'dimona', name: 'Dimona', lat: 31.0, lon: 35.15, type: 'weapons', status: 'active' },
+ { id: 'los_alamos', name: 'Los Alamos', lat: 35.88, lon: -106.30, type: 'weapons', status: 'active' },
+ { id: 'sellafield', name: 'Sellafield', lat: 54.42, lon: -3.50, type: 'reprocessing', status: 'active' },
+ { id: 'la_hague', name: 'La Hague', lat: 49.68, lon: -1.88, type: 'reprocessing', status: 'active' }
+];
+
+// Major undersea cable routes
+export const UNDERSEA_CABLES = [
+ {
+ id: 'transatlantic_1',
+ name: 'Transatlantic (TAT-14)',
+ major: true,
+ points: [[-74.0, 40.7], [-30.0, 45.0], [-9.0, 52.0]]
+ },
+ {
+ id: 'transpacific_1',
+ name: 'Transpacific (Unity)',
+ major: true,
+ points: [[-122.4, 37.8], [-155.0, 25.0], [139.7, 35.7]]
+ },
+ {
+ id: 'sea_me_we_5',
+ name: 'SEA-ME-WE 5',
+ major: true,
+ points: [[103.8, 1.3], [80.0, 10.0], [55.0, 25.0], [35.0, 30.0], [12.0, 37.0], [-5.0, 36.0]]
+ },
+ {
+ id: 'aae1',
+ name: 'Asia-Africa-Europe 1',
+ major: true,
+ points: [[121.0, 25.0], [103.8, 1.3], [73.0, 15.0], [44.0, 12.0], [35.0, 30.0], [28.0, 41.0]]
+ },
+ {
+ id: 'curie',
+ name: 'Curie (Google)',
+ major: false,
+ points: [[-122.4, 37.8], [-80.0, 0.0], [-70.0, -33.0]]
+ },
+ {
+ id: 'marea',
+ name: 'MAREA (Microsoft)',
+ major: true,
+ points: [[-73.8, 39.4], [-9.0, 37.0]]
+ }
+];
+
+// Countries under sanctions
+export const SANCTIONED_COUNTRIES = {
+ 408: 'severe', // North Korea
+ 728: 'severe', // South Sudan
+ 729: 'severe', // Sudan
+ 760: 'severe', // Syria
+ 364: 'high', // Iran
+ 643: 'high', // Russia
+ 112: 'high', // Belarus
+ 862: 'moderate', // Venezuela
+ 104: 'moderate', // Myanmar
+ 178: 'moderate', // Congo
+ 152: 'low', // Cuba
+ 716: 'low', // Zimbabwe
+};
+
+// Regions for news density calculation
+export const NEWS_REGIONS = [
+ { id: 'us', name: 'United States', lat: 39.0, lon: -98.0, radius: 60, keywords: ['us', 'america', 'washington', 'trump', 'biden', 'congress'] },
+ { id: 'europe', name: 'Europe', lat: 50.0, lon: 10.0, radius: 55, keywords: ['europe', 'eu', 'european', 'nato', 'brussels'] },
+ { id: 'russia', name: 'Russia', lat: 60.0, lon: 90.0, radius: 50, keywords: ['russia', 'russian', 'putin', 'moscow', 'kremlin'] },
+ { id: 'china', name: 'China', lat: 35.0, lon: 105.0, radius: 55, keywords: ['china', 'chinese', 'beijing', 'xi'] },
+ { id: 'middle_east', name: 'Middle East', lat: 30.0, lon: 45.0, radius: 50, keywords: ['israel', 'iran', 'saudi', 'gaza', 'syria', 'iraq', 'yemen'] },
+ { id: 'east_asia', name: 'East Asia', lat: 35.0, lon: 130.0, radius: 45, keywords: ['japan', 'korea', 'taiwan', 'kim jong'] },
+ { id: 'south_asia', name: 'South Asia', lat: 22.0, lon: 78.0, radius: 45, keywords: ['india', 'pakistan', 'modi'] },
+ { id: 'africa', name: 'Africa', lat: 5.0, lon: 20.0, radius: 55, keywords: ['africa', 'african', 'sudan', 'nigeria', 'ethiopia'] },
+ { id: 'latam', name: 'Latin America', lat: -15.0, lon: -60.0, radius: 50, keywords: ['brazil', 'mexico', 'venezuela', 'argentina'] }
+];
+
+// Flight data cache duration
+export const FLIGHT_CACHE_DURATION = 30000; // 30 seconds
+
+// Satellite tile configuration
+export const SATELLITE_CONFIG = {
+ nasa: {
+ url: 'https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/VIIRS_SNPP_CorrectedReflectance_TrueColor/default/{date}/250m/{z}/{y}/{x}.jpg',
+ attribution: 'NASA GIBS',
+ maxZoom: 8
+ },
+ esri: {
+ url: 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
+ attribution: 'ESRI',
+ maxZoom: 18
+ }
+};
+
+// Custom monitor colors
+export const MONITOR_COLORS = [
+ '#00ff88', '#ff6600', '#00aaff', '#ff00ff', '#ffcc00',
+ '#ff3366', '#33ccff', '#99ff33', '#ff6699', '#00ffcc'
+];
+
+// Topic extraction patterns for correlation detection
+export const CORRELATION_TOPICS = [
+ { id: 'tariffs', patterns: [/tariff/i, /trade war/i, /import tax/i, /customs duty/i], category: 'Economy' },
+ { id: 'fed-rates', patterns: [/federal reserve/i, /interest rate/i, /rate cut/i, /rate hike/i, /powell/i, /fomc/i], category: 'Economy' },
+ { id: 'inflation', patterns: [/inflation/i, /cpi/i, /consumer price/i, /cost of living/i], category: 'Economy' },
+ { id: 'ai-regulation', patterns: [/ai regulation/i, /artificial intelligence.*law/i, /ai safety/i, /ai governance/i], category: 'Tech' },
+ { id: 'china-tensions', patterns: [/china.*taiwan/i, /south china sea/i, /us.*china/i, /beijing.*washington/i], category: 'Geopolitics' },
+ { id: 'russia-ukraine', patterns: [/ukraine/i, /zelensky/i, /putin.*war/i, /crimea/i, /donbas/i], category: 'Conflict' },
+ { id: 'israel-gaza', patterns: [/gaza/i, /hamas/i, /netanyahu/i, /israel.*attack/i, /hostage/i], category: 'Conflict' },
+ { id: 'iran', patterns: [/iran.*nuclear/i, /tehran/i, /ayatollah/i, /iranian.*strike/i], category: 'Geopolitics' },
+ { id: 'crypto', patterns: [/bitcoin/i, /crypto.*regulation/i, /ethereum/i, /sec.*crypto/i], category: 'Finance' },
+ { id: 'housing', patterns: [/housing market/i, /mortgage rate/i, /home price/i, /real estate.*crash/i], category: 'Economy' },
+ { id: 'layoffs', patterns: [/layoff/i, /job cut/i, /workforce reduction/i, /downsizing/i], category: 'Business' },
+ { id: 'bank-crisis', patterns: [/bank.*fail/i, /banking crisis/i, /fdic/i, /bank run/i], category: 'Finance' },
+ { id: 'election', patterns: [/election/i, /polling/i, /campaign/i, /ballot/i, /voter/i], category: 'Politics' },
+ { id: 'immigration', patterns: [/immigration/i, /border.*crisis/i, /migrant/i, /deportation/i, /asylum/i], category: 'Politics' },
+ { id: 'climate', patterns: [/climate change/i, /wildfire/i, /hurricane/i, /extreme weather/i, /flood/i], category: 'Environment' },
+ { id: 'pandemic', patterns: [/pandemic/i, /outbreak/i, /virus.*spread/i, /who.*emergency/i, /bird flu/i], category: 'Health' },
+ { id: 'nuclear', patterns: [/nuclear.*threat/i, /nuclear weapon/i, /atomic/i, /icbm/i], category: 'Security' },
+ { id: 'supply-chain', patterns: [/supply chain/i, /shipping.*delay/i, /port.*congestion/i, /logistics.*crisis/i], category: 'Economy' },
+ { id: 'big-tech', patterns: [/antitrust.*tech/i, /google.*monopoly/i, /meta.*lawsuit/i, /apple.*doj/i], category: 'Tech' },
+ { id: 'deepfake', patterns: [/deepfake/i, /ai.*misinformation/i, /synthetic media/i], category: 'Tech' }
+];
+
+// Fringe narrative patterns to track
+export const NARRATIVE_PATTERNS = [
+ { id: 'deep-state', keywords: ['deep state', 'shadow government', 'permanent state'], category: 'Political', severity: 'watch' },
+ { id: 'cbdc-control', keywords: ['cbdc control', 'digital currency surveillance', 'social credit'], category: 'Finance', severity: 'watch' },
+ { id: 'wef-agenda', keywords: ['great reset', 'wef agenda', 'world economic forum plot'], category: 'Political', severity: 'watch' },
+ { id: 'bio-weapon', keywords: ['lab leak', 'bioweapon', 'gain of function'], category: 'Health', severity: 'emerging' },
+ { id: 'election-fraud', keywords: ['election fraud', 'rigged election', 'stolen election', 'mail ballot fraud'], category: 'Political', severity: 'watch' },
+ { id: 'ai-doom', keywords: ['ai doom', 'ai extinction', 'superintelligence risk', 'agi danger'], category: 'Tech', severity: 'emerging' },
+ { id: 'ai-consciousness', keywords: ['ai sentient', 'ai conscious', 'ai feelings', 'ai alive'], category: 'Tech', severity: 'emerging' },
+ { id: 'robot-replacement', keywords: ['robots replacing', 'automation unemployment', 'job automation'], category: 'Economy', severity: 'spreading' },
+ { id: 'china-invasion', keywords: ['china taiwan invasion', 'china war', 'south china sea conflict'], category: 'Geopolitical', severity: 'watch' },
+ { id: 'nato-expansion', keywords: ['nato provocation', 'nato aggression', 'nato encirclement'], category: 'Geopolitical', severity: 'watch' },
+ { id: 'dollar-collapse', keywords: ['dollar collapse', 'dedollarization', 'brics currency', 'petrodollar death'], category: 'Finance', severity: 'spreading' },
+ { id: 'vaccine-injury', keywords: ['vaccine injury', 'vaccine side effect', 'vaccine death', 'turbo cancer'], category: 'Health', severity: 'watch' },
+ { id: 'next-pandemic', keywords: ['next pandemic', 'disease x', 'bird flu pandemic'], category: 'Health', severity: 'emerging' },
+ { id: 'depopulation', keywords: ['depopulation agenda', 'fertility crisis', 'population control'], category: 'Society', severity: 'disinfo' },
+ { id: 'food-crisis', keywords: ['food shortage', 'engineered famine', 'food supply attack'], category: 'Economy', severity: 'emerging' },
+ { id: 'energy-war', keywords: ['energy crisis manufactured', 'green agenda', 'energy shortage'], category: 'Economy', severity: 'spreading' }
+];
+
+// Source classification
+export const SOURCE_TYPES = {
+ fringe: ['zerohedge', 'infowars', 'naturalnews', 'gateway', 'breitbart', 'epoch', 'revolver', 'dailycaller'],
+ alternative: ['substack', 'rumble', 'bitchute', 'telegram', 'gab', 'gettr', 'truth social'],
+ mainstream: ['reuters', 'ap news', 'bbc', 'cnn', 'nytimes', 'wsj', 'wapo', 'guardian', 'abc', 'nbc', 'cbs', 'fox']
+};
+
+// AI RSS feeds for arms race tracking
+export const AI_FEEDS = [
+ { name: 'OpenAI', url: 'https://openai.com/blog/rss.xml' },
+ { name: 'Anthropic', url: 'https://www.anthropic.com/rss.xml' },
+ { name: 'Google AI', url: 'https://blog.google/technology/ai/rss/' },
+ { name: 'DeepMind', url: 'https://deepmind.google/blog/rss.xml' },
+ { name: 'Meta AI', url: 'https://ai.meta.com/blog/rss/' },
+ { name: 'Hugging Face', url: 'https://huggingface.co/blog/feed.xml' }
+];
diff --git a/js/data.js b/js/data.js
new file mode 100644
index 0000000..5e4f90b
--- /dev/null
+++ b/js/data.js
@@ -0,0 +1,395 @@
+// data.js - All data fetching functions
+
+import { CORS_PROXIES, ALERT_KEYWORDS, SECTORS, COMMODITIES, INTEL_SOURCES, AI_FEEDS } from './constants.js';
+
+// Fetch with proxy fallback
+export async function fetchWithProxy(url) {
+ for (let i = 0; i < CORS_PROXIES.length; i++) {
+ try {
+ const proxy = CORS_PROXIES[i];
+ const response = await fetch(proxy + encodeURIComponent(url), {
+ headers: { 'Accept': 'application/rss+xml, application/xml, text/xml, */*' }
+ });
+ if (response.ok) {
+ return await response.text();
+ }
+ } catch (e) {
+ console.log(`Proxy ${i} failed, trying next...`);
+ }
+ }
+ throw new Error('All proxies failed');
+}
+
+// Check for alert keywords
+export function hasAlertKeyword(title) {
+ const lower = title.toLowerCase();
+ return ALERT_KEYWORDS.some(kw => lower.includes(kw));
+}
+
+// Parse RSS feed
+export async function fetchFeed(source) {
+ try {
+ const text = await fetchWithProxy(source.url);
+ const parser = new DOMParser();
+ const xml = parser.parseFromString(text, 'text/xml');
+
+ const parseError = xml.querySelector('parsererror');
+ if (parseError) {
+ console.error(`Parse error for ${source.name}`);
+ return [];
+ }
+
+ let items = xml.querySelectorAll('item');
+ if (items.length === 0) {
+ items = xml.querySelectorAll('entry');
+ }
+
+ return Array.from(items).slice(0, 5).map(item => {
+ let link = '';
+ const linkEl = item.querySelector('link');
+ if (linkEl) {
+ link = linkEl.getAttribute('href') || linkEl.textContent || '';
+ }
+ link = link.trim();
+
+ const title = (item.querySelector('title')?.textContent || 'No title').trim();
+ const pubDate = item.querySelector('pubDate')?.textContent ||
+ item.querySelector('published')?.textContent ||
+ item.querySelector('updated')?.textContent || '';
+
+ return {
+ source: source.name,
+ title,
+ link,
+ pubDate,
+ isAlert: hasAlertKeyword(title)
+ };
+ });
+ } catch (error) {
+ console.error(`Error fetching ${source.name}:`, error);
+ return [];
+ }
+}
+
+// Fetch all feeds for a category
+export async function fetchCategory(feeds) {
+ const results = await Promise.all(feeds.map(fetchFeed));
+ const items = results.flat();
+
+ items.sort((a, b) => {
+ // Alerts first, then by date
+ if (a.isAlert && !b.isAlert) return -1;
+ if (!a.isAlert && b.isAlert) return 1;
+ const dateA = new Date(a.pubDate);
+ const dateB = new Date(b.pubDate);
+ return dateB - dateA;
+ });
+
+ return items.slice(0, 20);
+}
+
+// Fetch stock quote from Yahoo Finance
+export async function fetchQuote(symbol) {
+ try {
+ const text = await fetchWithProxy(`https://query1.finance.yahoo.com/v8/finance/chart/${symbol}`);
+ const data = JSON.parse(text);
+ if (data.chart?.result?.[0]) {
+ const meta = data.chart.result[0].meta;
+ const change = ((meta.regularMarketPrice - meta.previousClose) / meta.previousClose) * 100;
+ return { price: meta.regularMarketPrice, change };
+ }
+ } catch (error) {
+ console.error(`Error fetching ${symbol}:`, error);
+ }
+ return null;
+}
+
+// Fetch market data (stocks + crypto)
+export async function fetchMarkets() {
+ const markets = [];
+
+ const symbols = [
+ { symbol: '^GSPC', name: 'S&P 500', display: 'SPX' },
+ { symbol: '^DJI', name: 'Dow Jones', display: 'DJI' },
+ { symbol: '^IXIC', name: 'NASDAQ', display: 'NDX' },
+ { symbol: 'AAPL', name: 'Apple', display: 'AAPL' },
+ { symbol: 'MSFT', name: 'Microsoft', display: 'MSFT' },
+ { symbol: 'NVDA', name: 'NVIDIA', display: 'NVDA' },
+ { symbol: 'GOOGL', name: 'Alphabet', display: 'GOOGL' },
+ { symbol: 'AMZN', name: 'Amazon', display: 'AMZN' },
+ { symbol: 'META', name: 'Meta', display: 'META' },
+ { symbol: 'BRK-B', name: 'Berkshire', display: 'BRK.B' },
+ { symbol: 'TSM', name: 'TSMC', display: 'TSM' },
+ { symbol: 'LLY', name: 'Eli Lilly', display: 'LLY' },
+ { symbol: 'TSLA', name: 'Tesla', display: 'TSLA' },
+ { symbol: 'AVGO', name: 'Broadcom', display: 'AVGO' },
+ { symbol: 'WMT', name: 'Walmart', display: 'WMT' },
+ { symbol: 'JPM', name: 'JPMorgan', display: 'JPM' },
+ { symbol: 'V', name: 'Visa', display: 'V' },
+ { symbol: 'UNH', name: 'UnitedHealth', display: 'UNH' },
+ { symbol: 'NVO', name: 'Novo Nordisk', display: 'NVO' },
+ { symbol: 'XOM', name: 'Exxon', display: 'XOM' },
+ { symbol: 'MA', name: 'Mastercard', display: 'MA' },
+ { symbol: 'ORCL', name: 'Oracle', display: 'ORCL' },
+ { symbol: 'PG', name: 'P&G', display: 'PG' },
+ { symbol: 'COST', name: 'Costco', display: 'COST' },
+ { symbol: 'JNJ', name: 'J&J', display: 'JNJ' },
+ { symbol: 'HD', name: 'Home Depot', display: 'HD' },
+ { symbol: 'NFLX', name: 'Netflix', display: 'NFLX' },
+ { symbol: 'BAC', name: 'BofA', display: 'BAC' }
+ ];
+
+ const fetchStock = async (s) => {
+ const quote = await fetchQuote(s.symbol);
+ if (quote) {
+ return { name: s.name, symbol: s.display, price: quote.price, change: quote.change };
+ }
+ return null;
+ };
+
+ const stockResults = await Promise.all(symbols.map(fetchStock));
+ stockResults.forEach(r => { if (r) markets.push(r); });
+
+ // Crypto
+ try {
+ const cryptoResponse = await fetch('https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum,solana&vs_currencies=usd&include_24hr_change=true');
+ const crypto = await cryptoResponse.json();
+
+ if (crypto.bitcoin) markets.push({ name: 'Bitcoin', symbol: 'BTC', price: crypto.bitcoin.usd, change: crypto.bitcoin.usd_24h_change });
+ if (crypto.ethereum) markets.push({ name: 'Ethereum', symbol: 'ETH', price: crypto.ethereum.usd, change: crypto.ethereum.usd_24h_change });
+ if (crypto.solana) markets.push({ name: 'Solana', symbol: 'SOL', price: crypto.solana.usd, change: crypto.solana.usd_24h_change });
+ } catch (error) {
+ console.error('Error fetching crypto:', error);
+ }
+
+ return markets;
+}
+
+// Fetch sector heatmap data
+export async function fetchSectors() {
+ const results = await Promise.all(SECTORS.map(async (s) => {
+ const quote = await fetchQuote(s.symbol);
+ if (quote) {
+ return { name: s.name, symbol: s.symbol, change: quote.change };
+ }
+ return { name: s.name, symbol: s.symbol, change: 0 };
+ }));
+ return results;
+}
+
+// Fetch commodities and VIX
+export async function fetchCommodities() {
+ const results = [];
+ for (const c of COMMODITIES) {
+ const quote = await fetchQuote(c.symbol);
+ if (quote) {
+ results.push({ name: c.name, symbol: c.display, price: quote.price, change: quote.change });
+ }
+ }
+ return results;
+}
+
+// Fetch flight data from OpenSky Network
+export async function fetchFlightData(bounds = null) {
+ try {
+ let url = 'https://opensky-network.org/api/states/all';
+ if (bounds) {
+ url += `?lamin=${bounds.south}&lomin=${bounds.west}&lamax=${bounds.north}&lomax=${bounds.east}`;
+ }
+
+ const response = await fetch(url);
+ if (!response.ok) throw new Error('Flight API error');
+
+ const data = await response.json();
+ if (!data.states) return [];
+
+ return data.states.slice(0, 100).map(state => ({
+ icao24: state[0],
+ callsign: (state[1] || '').trim(),
+ country: state[2],
+ lat: state[6],
+ lon: state[5],
+ altitude: state[7],
+ heading: state[10],
+ velocity: state[9],
+ onGround: state[8]
+ })).filter(f => f.lat && f.lon && !f.onGround);
+ } catch (error) {
+ console.error('Error fetching flight data:', error);
+ return [];
+ }
+}
+
+// Fetch congressional trades
+export async function fetchCongressTrades() {
+ // Uses proxy to fetch from House Stock Watcher or similar
+ try {
+ const response = await fetchWithProxy('https://house-stock-watcher-data.s3-us-west-2.amazonaws.com/data/all_transactions.json');
+ const data = JSON.parse(response);
+
+ // Get last 20 trades
+ return data.slice(-20).reverse().map(t => ({
+ name: t.representative,
+ party: t.party === 'Democrat' ? 'D' : 'R',
+ ticker: t.ticker,
+ action: t.type.includes('Sale') ? 'SELL' : 'BUY',
+ amount: t.amount,
+ date: t.transaction_date
+ }));
+ } catch (error) {
+ console.error('Error fetching congress trades:', error);
+ return [];
+ }
+}
+
+// Fetch whale transactions (crypto)
+export async function fetchWhaleTransactions() {
+ try {
+ // This would normally use a whale alert API
+ // For now return mock data structure
+ return [];
+ } catch (error) {
+ console.error('Error fetching whale transactions:', error);
+ return [];
+ }
+}
+
+// Fetch government contracts
+export async function fetchGovContracts() {
+ try {
+ // Would use USASpending.gov API
+ return [];
+ } catch (error) {
+ console.error('Error fetching gov contracts:', error);
+ return [];
+ }
+}
+
+// Fetch AI news from major AI companies
+export async function fetchAINews() {
+ const results = await Promise.all(AI_FEEDS.map(async (source) => {
+ try {
+ const text = await fetchWithProxy(source.url);
+ const parser = new DOMParser();
+ const xml = parser.parseFromString(text, 'text/xml');
+
+ let items = xml.querySelectorAll('item');
+ if (items.length === 0) items = xml.querySelectorAll('entry');
+
+ return Array.from(items).slice(0, 3).map(item => {
+ let link = '';
+ const linkEl = item.querySelector('link');
+ if (linkEl) link = linkEl.getAttribute('href') || linkEl.textContent || '';
+
+ return {
+ source: source.name,
+ title: item.querySelector('title')?.textContent?.trim() || 'No title',
+ link: link.trim(),
+ date: item.querySelector('pubDate')?.textContent ||
+ item.querySelector('published')?.textContent || ''
+ };
+ });
+ } catch (e) {
+ console.log(`Failed to fetch ${source.name}`);
+ return [];
+ }
+ }));
+
+ return results.flat().sort((a, b) => new Date(b.date) - new Date(a.date)).slice(0, 15);
+}
+
+// Fetch Fed balance sheet from FRED
+export async function fetchFedBalance() {
+ try {
+ const text = await fetchWithProxy('https://api.stlouisfed.org/fred/series/observations?series_id=WALCL&sort_order=desc&limit=10&file_type=json&api_key=DEMO');
+ const data = JSON.parse(text);
+
+ if (data.observations && data.observations.length >= 2) {
+ const latest = parseFloat(data.observations[0].value);
+ const previous = parseFloat(data.observations[1].value);
+ const change = latest - previous;
+ const changePercent = (change / previous) * 100;
+
+ return {
+ value: latest / 1000000,
+ change: change / 1000000,
+ changePercent,
+ date: data.observations[0].date,
+ percentOfMax: (latest / 9000000) * 100
+ };
+ }
+ } catch (error) {
+ console.error('Error fetching Fed balance:', error);
+ }
+
+ return {
+ value: 6.8,
+ change: 0,
+ changePercent: 0,
+ date: new Date().toISOString().split('T')[0],
+ percentOfMax: 75
+ };
+}
+
+// Fetch Polymarket data
+export async function fetchPolymarket() {
+ try {
+ // Would use Polymarket API
+ return [];
+ } catch (error) {
+ console.error('Error fetching Polymarket:', error);
+ return [];
+ }
+}
+
+// Fetch earthquake data from USGS
+export async function fetchEarthquakes() {
+ try {
+ const response = await fetch('https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/4.5_day.geojson');
+ const data = await response.json();
+
+ return data.features.map(f => ({
+ id: f.id,
+ magnitude: f.properties.mag,
+ place: f.properties.place,
+ time: new Date(f.properties.time),
+ lat: f.geometry.coordinates[1],
+ lon: f.geometry.coordinates[0],
+ depth: f.geometry.coordinates[2]
+ }));
+ } catch (error) {
+ console.error('Error fetching earthquakes:', error);
+ return [];
+ }
+}
+
+// Fetch layoffs data
+export async function fetchLayoffs() {
+ try {
+ // Would use layoffs.fyi API or similar
+ return [];
+ } catch (error) {
+ console.error('Error fetching layoffs:', error);
+ return [];
+ }
+}
+
+// Fetch situation-specific news
+export async function fetchSituationNews(keywords, limit = 5) {
+ // Filter from existing news based on keywords
+ return [];
+}
+
+// Fetch Intel feed (combines multiple intel sources)
+export async function fetchIntelFeed() {
+ const results = await Promise.all(INTEL_SOURCES.map(fetchFeed));
+ const items = results.flat();
+
+ items.sort((a, b) => {
+ if (a.isAlert && !b.isAlert) return -1;
+ if (!a.isAlert && b.isAlert) return 1;
+ return new Date(b.pubDate) - new Date(a.pubDate);
+ });
+
+ return items.slice(0, 30);
+}
diff --git a/js/intelligence.js b/js/intelligence.js
new file mode 100644
index 0000000..7434ad7
--- /dev/null
+++ b/js/intelligence.js
@@ -0,0 +1,516 @@
+// intelligence.js - Correlation engine, narrative tracker, analysis functions
+
+import { CORRELATION_TOPICS, NARRATIVE_PATTERNS, SOURCE_TYPES, ALERT_KEYWORDS, REGION_KEYWORDS, TOPIC_KEYWORDS } from './constants.js';
+import { isPanelEnabled } from './panels.js';
+
+// Track historical topic counts for momentum analysis
+let topicHistory = {};
+let lastCorrelationUpdate = 0;
+
+// Track narratives history for crossover detection
+let narrativeHistory = {};
+
+// Analyze correlations across all news
+export function analyzeCorrelations(allNews) {
+ if (!allNews || allNews.length === 0) return null;
+
+ const now = Date.now();
+ const results = {
+ emergingPatterns: [],
+ momentumSignals: [],
+ crossSourceCorrelations: [],
+ predictiveSignals: []
+ };
+
+ const topicCounts = {};
+ const topicSources = {};
+ const topicHeadlines = {};
+
+ allNews.forEach(item => {
+ const title = item.title || '';
+ const source = item.source || 'Unknown';
+
+ CORRELATION_TOPICS.forEach(topic => {
+ const matches = topic.patterns.some(p => p.test(title));
+ if (matches) {
+ if (!topicCounts[topic.id]) {
+ topicCounts[topic.id] = 0;
+ topicSources[topic.id] = new Set();
+ topicHeadlines[topic.id] = [];
+ }
+ topicCounts[topic.id]++;
+ topicSources[topic.id].add(source);
+ if (topicHeadlines[topic.id].length < 5) {
+ topicHeadlines[topic.id].push({ title, link: item.link, source });
+ }
+ }
+ });
+ });
+
+ // Calculate momentum by comparing to history
+ const currentTime = Math.floor(now / 60000);
+ if (!topicHistory[currentTime]) {
+ topicHistory[currentTime] = { ...topicCounts };
+ Object.keys(topicHistory).forEach(t => {
+ if (currentTime - parseInt(t) > 30) delete topicHistory[t];
+ });
+ }
+
+ // Emerging Patterns
+ CORRELATION_TOPICS.forEach(topic => {
+ const count = topicCounts[topic.id] || 0;
+ if (count >= 3) {
+ const sources = topicSources[topic.id] ? Array.from(topicSources[topic.id]) : [];
+ const level = count >= 8 ? 'high' : count >= 5 ? 'elevated' : 'emerging';
+ results.emergingPatterns.push({
+ id: topic.id,
+ name: topic.id.replace(/-/g, ' ').replace(/\b\w/g, l => l.toUpperCase()),
+ category: topic.category,
+ count,
+ level,
+ sources,
+ headlines: topicHeadlines[topic.id] || []
+ });
+ }
+ });
+
+ results.emergingPatterns.sort((a, b) => b.count - a.count);
+
+ // Momentum Signals
+ const oldTime = currentTime - 10;
+ const oldCounts = topicHistory[oldTime] || {};
+
+ CORRELATION_TOPICS.forEach(topic => {
+ const current = topicCounts[topic.id] || 0;
+ const old = oldCounts[topic.id] || 0;
+ const delta = current - old;
+
+ if (delta >= 2 || (current >= 3 && delta >= 1)) {
+ const momentum = delta >= 4 ? 'surging' : delta >= 2 ? 'rising' : 'stable';
+ results.momentumSignals.push({
+ id: topic.id,
+ name: topic.id.replace(/-/g, ' ').replace(/\b\w/g, l => l.toUpperCase()),
+ category: topic.category,
+ current,
+ delta,
+ momentum,
+ headlines: topicHeadlines[topic.id] || []
+ });
+ }
+ });
+
+ results.momentumSignals.sort((a, b) => b.delta - a.delta);
+
+ // Cross-Source Correlations
+ CORRELATION_TOPICS.forEach(topic => {
+ const sources = topicSources[topic.id] ? Array.from(topicSources[topic.id]) : [];
+ if (sources.length >= 3) {
+ results.crossSourceCorrelations.push({
+ id: topic.id,
+ name: topic.id.replace(/-/g, ' ').replace(/\b\w/g, l => l.toUpperCase()),
+ category: topic.category,
+ sourceCount: sources.length,
+ sources,
+ level: sources.length >= 5 ? 'high' : sources.length >= 4 ? 'elevated' : 'emerging',
+ headlines: topicHeadlines[topic.id] || []
+ });
+ }
+ });
+
+ results.crossSourceCorrelations.sort((a, b) => b.sourceCount - a.sourceCount);
+
+ // Predictive Signals
+ CORRELATION_TOPICS.forEach(topic => {
+ const count = topicCounts[topic.id] || 0;
+ const sources = topicSources[topic.id] ? topicSources[topic.id].size : 0;
+ const delta = (topicCounts[topic.id] || 0) - (oldCounts[topic.id] || 0);
+ const score = (count * 2) + (sources * 3) + (delta * 5);
+
+ if (score >= 15) {
+ const confidence = Math.min(95, Math.round(score * 1.5));
+ let prediction = '';
+
+ if (topic.id === 'tariffs' && count >= 4) {
+ prediction = 'Market volatility likely in next 24-48h';
+ } else if (topic.id === 'fed-rates') {
+ prediction = 'Expect increased financial sector coverage';
+ } else if (topic.id.includes('china') || topic.id.includes('russia')) {
+ prediction = 'Geopolitical escalation narrative forming';
+ } else if (topic.id === 'layoffs') {
+ prediction = 'Employment concerns may dominate news cycle';
+ } else if (topic.category === 'Conflict') {
+ prediction = 'Breaking developments likely within hours';
+ } else {
+ prediction = 'Topic gaining mainstream traction';
+ }
+
+ results.predictiveSignals.push({
+ id: topic.id,
+ name: topic.id.replace(/-/g, ' ').replace(/\b\w/g, l => l.toUpperCase()),
+ category: topic.category,
+ score,
+ confidence,
+ prediction,
+ level: confidence >= 70 ? 'high' : confidence >= 50 ? 'medium' : 'low',
+ headlines: topicHeadlines[topic.id] || []
+ });
+ }
+ });
+
+ results.predictiveSignals.sort((a, b) => b.score - a.score);
+
+ return results;
+}
+
+// Render the Correlation Engine panel
+export function renderCorrelationEngine(correlations) {
+ if (!isPanelEnabled('correlation')) return;
+
+ const statusEl = document.getElementById('correlationStatus');
+
+ if (!correlations) {
+ statusEl.textContent = 'NO DATA';
+ return;
+ }
+
+ const totalSignals = correlations.emergingPatterns.length +
+ correlations.momentumSignals.length +
+ correlations.predictiveSignals.length;
+
+ statusEl.textContent = totalSignals > 0 ? `${totalSignals} SIGNALS` : 'MONITORING';
+
+ // Render Emerging Patterns
+ const emergingEl = document.getElementById('emergingPatterns');
+ if (correlations.emergingPatterns.length > 0) {
+ emergingEl.innerHTML = correlations.emergingPatterns.slice(0, 4).map(p => `
+ <div class="correlation-item ${p.level}">
+ <div class="correlation-item-header">
+ <span class="correlation-topic">${p.name}</span>
+ <span class="correlation-score ${p.level}">${p.count} mentions</span>
+ </div>
+ <div class="correlation-meta">${p.category} • ${p.sources.length} sources</div>
+ <div class="correlation-sources">
+ ${p.sources.slice(0, 4).map(s => `<span class="correlation-source-tag">${s}</span>`).join('')}
+ </div>
+ </div>
+ `).join('');
+ } else {
+ emergingEl.innerHTML = '<div class="no-correlations">No emerging patterns detected</div>';
+ }
+
+ // Render Momentum Signals
+ const momentumEl = document.getElementById('momentumSignals');
+ if (correlations.momentumSignals.length > 0) {
+ momentumEl.innerHTML = correlations.momentumSignals.slice(0, 4).map(m => `
+ <div class="correlation-item ${m.momentum === 'surging' ? 'high' : m.momentum === 'rising' ? 'elevated' : ''}">
+ <div class="correlation-item-header">
+ <span class="correlation-topic">${m.name}</span>
+ <span class="momentum-indicator ${m.momentum}">
+ ${m.momentum === 'surging' ? '🚀' : m.momentum === 'rising' ? '📈' : '➡️'}
+ ${m.momentum.toUpperCase()}
+ </span>
+ </div>
+ <div class="correlation-meta">${m.category} • ${m.current} now (+${m.delta} in 10m)</div>
+ ${m.headlines.length > 0 ? `
+ <div class="correlation-headlines">
+ ${m.headlines.slice(0, 2).map(h => `
+ <div class="correlation-headline">
+ <a href="${h.link}" target="_blank">${h.title.substring(0, 60)}...</a>
+ </div>
+ `).join('')}
+ </div>
+ ` : ''}
+ </div>
+ `).join('');
+ } else {
+ momentumEl.innerHTML = '<div class="no-correlations">No momentum signals detected</div>';
+ }
+
+ // Render Cross-Source Correlations
+ const crossEl = document.getElementById('crossSourceCorrelations');
+ if (correlations.crossSourceCorrelations.length > 0) {
+ crossEl.innerHTML = correlations.crossSourceCorrelations.slice(0, 4).map(c => `
+ <div class="correlation-item ${c.level}">
+ <div class="correlation-item-header">
+ <span class="correlation-topic">${c.name}</span>
+ <span class="correlation-score ${c.level}">${c.sourceCount} sources</span>
+ </div>
+ <div class="correlation-meta">${c.category} • Multi-outlet coverage</div>
+ <div class="correlation-sources">
+ ${c.sources.slice(0, 5).map(s => `<span class="correlation-source-tag">${s}</span>`).join('')}
+ </div>
+ </div>
+ `).join('');
+ } else {
+ crossEl.innerHTML = '<div class="no-correlations">No cross-source correlations</div>';
+ }
+
+ // Render Predictive Signals
+ const predictEl = document.getElementById('predictiveSignals');
+ if (correlations.predictiveSignals.length > 0) {
+ predictEl.innerHTML = correlations.predictiveSignals.slice(0, 4).map(p => `
+ <div class="correlation-item ${p.level}">
+ <div class="correlation-item-header">
+ <span class="correlation-topic">${p.name}</span>
+ <span class="correlation-score ${p.level}">${p.confidence}%</span>
+ </div>
+ <div class="correlation-meta">${p.prediction}</div>
+ <div class="prediction-confidence">
+ <div class="confidence-bar">
+ <div class="confidence-fill ${p.level}" style="width: ${p.confidence}%"></div>
+ </div>
+ <span class="confidence-label">confidence</span>
+ </div>
+ </div>
+ `).join('');
+ } else {
+ predictEl.innerHTML = '<div class="no-correlations">Gathering data for predictions...</div>';
+ }
+}
+
+// Analyze narratives
+export function analyzeNarratives(allNews) {
+ if (!allNews || allNews.length === 0) return null;
+
+ const now = Date.now();
+ const results = {
+ emergingFringe: [],
+ fringeToMainstream: [],
+ narrativeWatch: [],
+ disinfoSignals: []
+ };
+
+ NARRATIVE_PATTERNS.forEach(narrative => {
+ const matches = [];
+ const sourceMatches = { fringe: [], alternative: [], mainstream: [] };
+
+ allNews.forEach(item => {
+ const title = (item.title || '').toLowerCase();
+ const source = (item.source || '').toLowerCase();
+
+ const hasMatch = narrative.keywords.some(kw => title.includes(kw.toLowerCase()));
+ if (hasMatch) {
+ matches.push(item);
+
+ for (const [type, sources] of Object.entries(SOURCE_TYPES)) {
+ if (sources.some(s => source.includes(s))) {
+ sourceMatches[type].push(item);
+ break;
+ }
+ }
+ }
+ });
+
+ if (matches.length === 0) return;
+
+ if (!narrativeHistory[narrative.id]) {
+ narrativeHistory[narrative.id] = { firstSeen: now, sources: new Set() };
+ }
+ matches.forEach(m => narrativeHistory[narrative.id].sources.add(m.source));
+
+ const narrativeData = {
+ id: narrative.id,
+ name: narrative.id.replace(/-/g, ' ').replace(/\b\w/g, c => c.toUpperCase()),
+ category: narrative.category,
+ severity: narrative.severity,
+ count: matches.length,
+ fringeCount: sourceMatches.fringe.length,
+ mainstreamCount: sourceMatches.mainstream.length,
+ sources: [...new Set(matches.map(m => m.source))].slice(0, 5),
+ headlines: matches.slice(0, 3),
+ keywords: narrative.keywords
+ };
+
+ if (sourceMatches.mainstream.length > 0 && sourceMatches.fringe.length > 0) {
+ results.fringeToMainstream.push({
+ ...narrativeData,
+ status: 'crossing',
+ crossoverLevel: sourceMatches.mainstream.length / matches.length
+ });
+ } else if (narrative.severity === 'disinfo') {
+ results.disinfoSignals.push(narrativeData);
+ } else if (sourceMatches.fringe.length > 0 || sourceMatches.alternative.length > 0) {
+ results.emergingFringe.push(narrativeData);
+ } else {
+ results.narrativeWatch.push(narrativeData);
+ }
+ });
+
+ results.emergingFringe.sort((a, b) => b.count - a.count);
+ results.fringeToMainstream.sort((a, b) => b.crossoverLevel - a.crossoverLevel);
+ results.narrativeWatch.sort((a, b) => b.count - a.count);
+ results.disinfoSignals.sort((a, b) => b.count - a.count);
+
+ return results;
+}
+
+// Render narrative tracker
+export function renderNarrativeTracker(narratives) {
+ if (!isPanelEnabled('narrative')) return;
+
+ const statusEl = document.getElementById('narrativeStatus');
+ if (!narratives) {
+ if (statusEl) statusEl.textContent = 'NO DATA';
+ return;
+ }
+
+ const total = narratives.emergingFringe.length + narratives.fringeToMainstream.length +
+ narratives.narrativeWatch.length + narratives.disinfoSignals.length;
+ if (statusEl) statusEl.textContent = `${total} ACTIVE`;
+
+ // Render Emerging Fringe
+ const fringeEl = document.getElementById('emergingFringe');
+ if (fringeEl) {
+ if (narratives.emergingFringe.length > 0) {
+ fringeEl.innerHTML = narratives.emergingFringe.slice(0, 4).map(n => `
+ <div class="narrative-item ${n.count >= 5 ? 'viral' : n.count >= 3 ? 'spreading' : 'emerging'}">
+ <div class="narrative-header">
+ <span class="narrative-title">${n.name}</span>
+ <span class="narrative-badge ${n.count >= 5 ? 'viral' : n.count >= 3 ? 'spreading' : 'emerging'}">
+ ${n.count >= 5 ? 'VIRAL' : n.count >= 3 ? 'SPREADING' : 'EMERGING'}
+ </span>
+ </div>
+ <div class="narrative-description">${n.category} • ${n.count} mentions</div>
+ <div class="narrative-sources">
+ ${n.sources.map(s => `<span class="narrative-source-tag">${s}</span>`).join('')}
+ </div>
+ </div>
+ `).join('');
+ } else {
+ fringeEl.innerHTML = '<div class="no-narratives">No fringe narratives detected</div>';
+ }
+ }
+
+ // Render Fringe to Mainstream
+ const crossEl = document.getElementById('fringeToMainstream');
+ if (crossEl) {
+ if (narratives.fringeToMainstream.length > 0) {
+ crossEl.innerHTML = narratives.fringeToMainstream.slice(0, 4).map(n => `
+ <div class="narrative-item spreading">
+ <div class="narrative-header">
+ <span class="narrative-title">${n.name}</span>
+ <span class="narrative-badge spreading">CROSSING</span>
+ </div>
+ <div class="narrative-description">${n.category} • ${Math.round(n.crossoverLevel * 100)}% mainstream coverage</div>
+ <div class="narrative-crossover">
+ <span class="crossover-source fringe">Fringe (${n.fringeCount})</span>
+ <span class="crossover-arrow">→</span>
+ <span class="crossover-source mainstream">Mainstream (${n.mainstreamCount})</span>
+ </div>
+ </div>
+ `).join('');
+ } else {
+ crossEl.innerHTML = '<div class="no-narratives">No crossover narratives detected</div>';
+ }
+ }
+
+ // Render Narrative Watch
+ const watchEl = document.getElementById('narrativeWatch');
+ if (watchEl) {
+ if (narratives.narrativeWatch.length > 0) {
+ watchEl.innerHTML = narratives.narrativeWatch.slice(0, 4).map(n => `
+ <div class="narrative-item watch">
+ <div class="narrative-header">
+ <span class="narrative-title">${n.name}</span>
+ <span class="narrative-badge emerging">${n.count}</span>
+ </div>
+ <div class="narrative-description">${n.category}</div>
+ <div class="narrative-metrics">
+ <span class="narrative-metric">Sources: <span class="narrative-metric-value">${n.sources.length}</span></span>
+ </div>
+ </div>
+ `).join('');
+ } else {
+ watchEl.innerHTML = '<div class="no-narratives">No narratives on watch</div>';
+ }
+ }
+
+ // Render Disinfo Signals
+ const disinfoEl = document.getElementById('disinfoSignals');
+ if (disinfoEl) {
+ if (narratives.disinfoSignals.length > 0) {
+ disinfoEl.innerHTML = narratives.disinfoSignals.slice(0, 4).map(n => `
+ <div class="narrative-item disinfo">
+ <div class="narrative-header">
+ <span class="narrative-title">${n.name}</span>
+ <span class="narrative-badge disinfo">⚠ DISINFO</span>
+ </div>
+ <div class="narrative-description">${n.category} • Known disinformation pattern</div>
+ <div class="narrative-metrics">
+ <span class="narrative-metric">Mentions: <span class="narrative-metric-value">${n.count}</span></span>
+ </div>
+ </div>
+ `).join('');
+ } else {
+ disinfoEl.innerHTML = '<div class="no-narratives">No disinfo signals detected</div>';
+ }
+ }
+}
+
+// Calculate "Main Character" from news headlines
+export function calculateMainCharacter(allNews) {
+ const namePatterns = [
+ { pattern: /\btrump\b/gi, name: 'Trump' },
+ { pattern: /\bbiden\b/gi, name: 'Biden' },
+ { pattern: /\belon\b|\bmusk\b/gi, name: 'Elon Musk' },
+ { pattern: /\bputin\b/gi, name: 'Putin' },
+ { pattern: /\bzelensky\b/gi, name: 'Zelensky' },
+ { pattern: /\bxi\s*jinping\b|\bxi\b/gi, name: 'Xi Jinping' },
+ { pattern: /\bnetanyahu\b/gi, name: 'Netanyahu' },
+ { pattern: /\bsam\s*altman\b/gi, name: 'Sam Altman' },
+ { pattern: /\bmark\s*zuckerberg\b|\bzuckerberg\b/gi, name: 'Zuckerberg' },
+ { pattern: /\bjeff\s*bezos\b|\bbezos\b/gi, name: 'Bezos' },
+ { pattern: /\btim\s*cook\b/gi, name: 'Tim Cook' },
+ { pattern: /\bsatya\s*nadella\b|\bnadella\b/gi, name: 'Satya Nadella' },
+ { pattern: /\bsundar\s*pichai\b|\bpichai\b/gi, name: 'Sundar Pichai' },
+ { pattern: /\bwarren\s*buffett\b|\bbuffett\b/gi, name: 'Warren Buffett' },
+ { pattern: /\bjanet\s*yellen\b|\byellen\b/gi, name: 'Janet Yellen' },
+ { pattern: /\bjerome\s*powell\b|\bpowell\b/gi, name: 'Jerome Powell' },
+ { pattern: /\bkamala\s*harris\b|\bharris\b/gi, name: 'Kamala Harris' },
+ { pattern: /\bnancy\s*pelosi\b|\bpelosi\b/gi, name: 'Nancy Pelosi' },
+ { pattern: /\bjensen\s*huang\b|\bhuang\b/gi, name: 'Jensen Huang' },
+ { pattern: /\bdario\s*amodei\b|\bamodei\b/gi, name: 'Dario Amodei' }
+ ];
+
+ const counts = {};
+
+ allNews.forEach(item => {
+ const text = item.title.toLowerCase();
+ namePatterns.forEach(({ pattern, name }) => {
+ const matches = text.match(pattern);
+ if (matches) {
+ counts[name] = (counts[name] || 0) + matches.length;
+ }
+ });
+ });
+
+ const sorted = Object.entries(counts)
+ .sort((a, b) => b[1] - a[1])
+ .slice(0, 10);
+
+ return sorted;
+}
+
+// Detect regions from text
+export function detectRegions(text) {
+ const lower = text.toLowerCase();
+ const regions = [];
+ for (const [region, keywords] of Object.entries(REGION_KEYWORDS)) {
+ if (keywords.some(kw => lower.includes(kw))) {
+ regions.push(region);
+ }
+ }
+ return regions;
+}
+
+// Detect topics from text
+export function detectTopics(text) {
+ const lower = text.toLowerCase();
+ const topics = [];
+ for (const [topic, keywords] of Object.entries(TOPIC_KEYWORDS)) {
+ if (keywords.some(kw => lower.includes(kw))) {
+ topics.push(topic);
+ }
+ }
+ return topics;
+}
diff --git a/js/layers.js b/js/layers.js
new file mode 100644
index 0000000..f9b29c1
--- /dev/null
+++ b/js/layers.js
@@ -0,0 +1,261 @@
+// layers.js - Map layer controls, satellite imagery, flight data
+
+import { SATELLITE_CONFIG, FLIGHT_CACHE_DURATION } from './constants.js';
+import { getMapViewMode } from './map.js';
+
+// Map layer visibility state
+export const mapLayers = {
+ hotspots: true,
+ chokepoints: true,
+ earthquakes: false,
+ cyber: false,
+ conflicts: true,
+ intel: false,
+ bases: false,
+ nuclear: false,
+ cables: false,
+ sanctions: false,
+ flights: false,
+ satellite: false,
+ density: false
+};
+
+// Flight data cache
+let flightDataCache = null;
+let flightDataTimestamp = 0;
+
+// Toggle map layer visibility
+export function toggleLayer(layerName, refreshCallback) {
+ mapLayers[layerName] = !mapLayers[layerName];
+ if (refreshCallback) {
+ refreshCallback();
+ }
+}
+
+// Toggle satellite layer with special handling
+export function toggleSatelliteLayer(refreshCallback) {
+ mapLayers.satellite = !mapLayers.satellite;
+
+ const canvas = document.getElementById('satelliteCanvas');
+ const attribution = document.getElementById('satelliteAttribution');
+ const svg = document.getElementById('worldMapSVG');
+
+ if (mapLayers.satellite) {
+ // Show loading indicator
+ const loading = document.getElementById('satelliteLoading');
+ if (loading) loading.classList.add('visible');
+
+ // Render satellite tiles
+ renderSatelliteTiles().then(() => {
+ if (loading) loading.classList.remove('visible');
+ if (canvas) canvas.classList.add('visible');
+ if (attribution) attribution.classList.add('visible');
+ if (svg) svg.style.opacity = '0.7';
+ });
+ } else {
+ if (canvas) canvas.classList.remove('visible');
+ if (attribution) attribution.classList.remove('visible');
+ if (svg) svg.style.opacity = '1';
+ }
+
+ if (refreshCallback) {
+ refreshCallback();
+ }
+}
+
+// Render satellite tiles to canvas
+export async function renderSatelliteTiles() {
+ const canvas = document.getElementById('satelliteCanvas');
+ if (!canvas) return;
+
+ const container = document.getElementById('worldMapContainer');
+ const width = container.offsetWidth || 800;
+ const height = container.offsetHeight || 550;
+
+ canvas.width = width;
+ canvas.height = height;
+
+ const ctx = canvas.getContext('2d');
+
+ // Determine tile parameters based on view
+ const mapViewMode = getMapViewMode();
+ const isUSView = mapViewMode === 'us';
+ const isMidEastView = mapViewMode === 'mideast';
+ const isUkraineView = mapViewMode === 'ukraine';
+ const isTaiwanView = mapViewMode === 'taiwan';
+
+ let bounds, zoom;
+
+ if (isUSView) {
+ bounds = { north: 50, south: 24, east: -66, west: -125 };
+ zoom = 4;
+ } else if (isMidEastView) {
+ bounds = { north: 42, south: 12, east: 63, west: 25 };
+ zoom = 4;
+ } else if (isUkraineView) {
+ bounds = { north: 58, south: 42, east: 45, west: 22 };
+ zoom = 4;
+ } else if (isTaiwanView) {
+ bounds = { north: 42, south: 5, east: 145, west: 100 };
+ zoom = 4;
+ } else {
+ bounds = { north: 85, south: -85, east: 180, west: -180 };
+ zoom = 2;
+ }
+
+ // Calculate tile range
+ const tileCount = Math.pow(2, zoom);
+
+ // Convert bounds to tile coordinates
+ const minTileX = Math.floor((bounds.west + 180) / 360 * tileCount);
+ const maxTileX = Math.floor((bounds.east + 180) / 360 * tileCount);
+ const minTileY = Math.floor((1 - Math.log(Math.tan(bounds.north * Math.PI / 180) + 1 / Math.cos(bounds.north * Math.PI / 180)) / Math.PI) / 2 * tileCount);
+ const maxTileY = Math.floor((1 - Math.log(Math.tan(bounds.south * Math.PI / 180) + 1 / Math.cos(bounds.south * Math.PI / 180)) / Math.PI) / 2 * tileCount);
+
+ // Load and draw tiles
+ const tilePromises = [];
+
+ for (let x = minTileX; x <= maxTileX; x++) {
+ for (let y = minTileY; y <= maxTileY; y++) {
+ const tileX = ((x % tileCount) + tileCount) % tileCount;
+ const tileY = Math.max(0, Math.min(tileCount - 1, y));
+
+ const url = SATELLITE_CONFIG.esri.url
+ .replace('{z}', zoom)
+ .replace('{x}', tileX)
+ .replace('{y}', tileY);
+
+ const promise = loadTileImage(url).then(img => {
+ if (!img) return;
+
+ // Calculate tile position on canvas
+ const tileLonWidth = 360 / tileCount;
+ const tileLon = x * tileLonWidth - 180;
+
+ // Mercator Y calculation
+ const n = Math.PI - 2 * Math.PI * tileY / tileCount;
+ const tileLat = 180 / Math.PI * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)));
+
+ const n2 = Math.PI - 2 * Math.PI * (tileY + 1) / tileCount;
+ const tileLat2 = 180 / Math.PI * Math.atan(0.5 * (Math.exp(n2) - Math.exp(-n2)));
+
+ // Convert to canvas coordinates
+ const canvasX = ((tileLon - bounds.west) / (bounds.east - bounds.west)) * width;
+ const canvasX2 = ((tileLon + tileLonWidth - bounds.west) / (bounds.east - bounds.west)) * width;
+ const canvasY = ((bounds.north - tileLat) / (bounds.north - bounds.south)) * height;
+ const canvasY2 = ((bounds.north - tileLat2) / (bounds.north - bounds.south)) * height;
+
+ const tileWidth = canvasX2 - canvasX;
+ const tileHeight = canvasY2 - canvasY;
+
+ ctx.drawImage(img, canvasX, canvasY, tileWidth, tileHeight);
+ }).catch(e => {
+ console.warn('Tile load failed:', e);
+ });
+
+ tilePromises.push(promise);
+ }
+ }
+
+ await Promise.all(tilePromises);
+}
+
+// Load a single tile image
+export function loadTileImage(url) {
+ return new Promise((resolve, reject) => {
+ const img = new Image();
+ img.crossOrigin = 'anonymous';
+ img.onload = () => resolve(img);
+ img.onerror = () => resolve(null);
+ img.src = url;
+
+ // Timeout after 10 seconds
+ setTimeout(() => resolve(null), 10000);
+ });
+}
+
+// Fetch flight data from OpenSky Network API
+export async function fetchFlightData(bounds = null) {
+ const now = Date.now();
+
+ // Return cached data if still valid
+ if (flightDataCache && (now - flightDataTimestamp) < FLIGHT_CACHE_DURATION) {
+ return flightDataCache;
+ }
+
+ try {
+ let url = 'https://opensky-network.org/api/states/all';
+
+ if (bounds) {
+ url += `?lamin=${bounds.south}&lomin=${bounds.west}&lamax=${bounds.north}&lomax=${bounds.east}`;
+ }
+
+ const response = await fetch(url);
+ if (!response.ok) {
+ throw new Error(`HTTP ${response.status}`);
+ }
+
+ const data = await response.json();
+
+ // Parse OpenSky response format
+ const flights = (data.states || []).slice(0, 500).map(s => ({
+ icao24: s[0],
+ callsign: (s[1] || '').trim(),
+ country: s[2],
+ lon: s[5],
+ lat: s[6],
+ altitude: s[7] || s[13],
+ onGround: s[8],
+ velocity: s[9],
+ heading: s[10],
+ verticalRate: s[11],
+ squawk: s[14]
+ })).filter(f => f.lat && f.lon && !f.onGround);
+
+ flightDataCache = flights;
+ flightDataTimestamp = now;
+
+ return flights;
+ } catch (error) {
+ console.error('Failed to fetch flight data:', error);
+ return flightDataCache || [];
+ }
+}
+
+// Classify aircraft type based on callsign patterns
+export function classifyAircraft(callsign, country) {
+ const cs = (callsign || '').toUpperCase();
+
+ // Military patterns
+ if (/^(RCH|JAKE|DUKE|EVAC|AIR|RRR|NAVY|ARMY|USAF|RAF|IAF)/i.test(cs) ||
+ ['United States', 'Russia', 'China'].includes(country) && /^\d{5,}$/.test(cs)) {
+ return 'military';
+ }
+
+ // Cargo/freight patterns
+ if (/^(FDX|UPS|DHL|GTI|ABX|ATN|CLX)/i.test(cs)) {
+ return 'cargo';
+ }
+
+ // Helicopter patterns
+ if (cs.length <= 4 && /^[A-Z]{1,2}\d{2,3}$/.test(cs)) {
+ return 'helicopter';
+ }
+
+ return 'commercial';
+}
+
+// Get aircraft direction arrow based on heading
+export function getAircraftArrow(heading) {
+ if (heading === null || heading === undefined) return '✈';
+ const normalized = ((heading % 360) + 360) % 360;
+ if (normalized >= 337.5 || normalized < 22.5) return '↑';
+ if (normalized >= 22.5 && normalized < 67.5) return '↗';
+ if (normalized >= 67.5 && normalized < 112.5) return '→';
+ if (normalized >= 112.5 && normalized < 157.5) return '↘';
+ if (normalized >= 157.5 && normalized < 202.5) return '↓';
+ if (normalized >= 202.5 && normalized < 247.5) return '↙';
+ if (normalized >= 247.5 && normalized < 292.5) return '←';
+ if (normalized >= 292.5 && normalized < 337.5) return '↖';
+ return '✈';
+}
diff --git a/js/main.js b/js/main.js
new file mode 100644
index 0000000..e843033
--- /dev/null
+++ b/js/main.js
@@ -0,0 +1,219 @@
+// main.js - Application entry point
+
+// Import all modules
+import { FEEDS } from './constants.js';
+import { setStatus } from './utils.js';
+import {
+ fetchCategory, fetchMarkets, fetchSectors, fetchCommodities,
+ fetchEarthquakes, fetchCongressTrades, fetchWhaleTransactions,
+ fetchGovContracts, fetchAINews, fetchFedBalance, fetchPolymarket,
+ fetchLayoffs, fetchSituationNews, fetchIntelFeed
+} from './data.js';
+import {
+ renderGlobalMap, analyzeHotspotActivity, setMapView,
+ mapZoomIn, mapZoomOut, mapZoomReset, updateFlashback
+} from './map.js';
+import {
+ mapLayers, toggleLayer, toggleSatelliteLayer,
+ fetchFlightData, classifyAircraft, getAircraftArrow
+} from './layers.js';
+import {
+ isPanelEnabled, togglePanel, toggleSettings, applyPanelSettings,
+ initPanels, saveLivestreamUrl, resetPanelOrder
+} from './panels.js';
+import {
+ renderNews, renderMarkets, renderHeatmap, renderCommodities,
+ renderPolymarket, renderCongressTrades, renderWhaleWatch,
+ renderMainCharacter, renderGovContracts, renderAINews,
+ renderMoneyPrinter, renderIntelFeed, renderLayoffs, renderSituation
+} from './renderers.js';
+import {
+ analyzeCorrelations, renderCorrelationEngine,
+ analyzeNarratives, renderNarrativeTracker,
+ calculateMainCharacter
+} from './intelligence.js';
+import {
+ renderMonitorsList, openMonitorForm, closeMonitorForm,
+ selectMonitorColor, saveMonitor, editMonitor, deleteMonitor,
+ renderMonitorsPanel, getMonitorHotspots
+} from './monitors.js';
+import {
+ showHotspotPopup, showConflictPopup, showUSCityPopup,
+ showUSHotspotPopup, showChokepointPopup, showQuakePopup,
+ showCyberPopup, showCustomHotspotPopup, showAircraftPopup
+} from './popups.js';
+
+// Expose functions to window for onclick handlers
+window.togglePanel = (id) => togglePanel(id, refreshAll);
+window.toggleSettings = () => toggleSettings(renderMonitorsList);
+window.saveLivestreamUrl = saveLivestreamUrl;
+window.resetPanelOrder = resetPanelOrder;
+window.setMapView = (mode) => setMapView(mode, refreshAll);
+window.mapZoomIn = mapZoomIn;
+window.mapZoomOut = mapZoomOut;
+window.mapZoomReset = mapZoomReset;
+window.toggleLayer = (layer) => {
+ toggleLayer(layer, refreshAll);
+};
+window.toggleSatelliteLayer = () => toggleSatelliteLayer(refreshAll);
+window.updateFlashback = updateFlashback;
+window.openMonitorForm = openMonitorForm;
+window.closeMonitorForm = closeMonitorForm;
+window.selectMonitorColor = selectMonitorColor;
+window.saveMonitor = () => saveMonitor(refreshAll);
+window.editMonitor = editMonitor;
+window.deleteMonitor = (id) => deleteMonitor(id, refreshAll);
+window.showHotspotPopup = showHotspotPopup;
+window.showConflictPopup = showConflictPopup;
+window.showUSCityPopup = showUSCityPopup;
+window.showUSHotspotPopup = showUSHotspotPopup;
+window.showChokepointPopup = showChokepointPopup;
+window.showQuakePopup = showQuakePopup;
+window.showCyberPopup = showCyberPopup;
+window.showCustomHotspotPopup = showCustomHotspotPopup;
+window.showAircraftPopup = showAircraftPopup;
+
+// Staged refresh - loads critical data first for faster perceived startup
+async function refreshAll() {
+ const btn = document.getElementById('refreshBtn');
+ if (btn) btn.disabled = true;
+ setStatus('Loading critical...', true);
+
+ let allNews = [];
+
+ try {
+ // STAGE 1: Critical data (news + markets) - loads first
+ const stage1Promise = Promise.all([
+ isPanelEnabled('politics') ? fetchCategory(FEEDS.politics) : Promise.resolve([]),
+ isPanelEnabled('tech') ? fetchCategory(FEEDS.tech) : Promise.resolve([]),
+ isPanelEnabled('finance') ? fetchCategory(FEEDS.finance) : Promise.resolve([]),
+ isPanelEnabled('markets') ? fetchMarkets() : Promise.resolve([]),
+ isPanelEnabled('heatmap') ? fetchSectors() : Promise.resolve([])
+ ]);
+
+ const [politics, tech, finance, markets, sectors] = await stage1Promise;
+
+ // Render Stage 1 immediately
+ if (isPanelEnabled('politics')) renderNews(politics, 'politicsPanel', 'politicsCount');
+ if (isPanelEnabled('tech')) renderNews(tech, 'techPanel', 'techCount');
+ if (isPanelEnabled('finance')) renderNews(finance, 'financePanel', 'financeCount');
+ if (isPanelEnabled('markets')) renderMarkets(markets);
+ if (isPanelEnabled('heatmap')) renderHeatmap(sectors);
+
+ allNews = [...politics, ...tech, ...finance];
+ setStatus('Loading more...', true);
+
+ // STAGE 2: Secondary data
+ const stage2Promise = Promise.all([
+ isPanelEnabled('gov') ? fetchCategory(FEEDS.gov) : Promise.resolve([]),
+ isPanelEnabled('commodities') ? fetchCommodities() : Promise.resolve([]),
+ isPanelEnabled('polymarket') ? fetchPolymarket() : Promise.resolve([]),
+ isPanelEnabled('printer') ? fetchFedBalance() : Promise.resolve({ value: 0, change: 0, changePercent: 0, percentOfMax: 0 }),
+ isPanelEnabled('map') ? fetchEarthquakes() : Promise.resolve([])
+ ]);
+
+ const [gov, commodities, polymarket, fedBalance, earthquakes] = await stage2Promise;
+
+ if (isPanelEnabled('gov')) {
+ renderNews(gov, 'govPanel', 'govCount');
+ allNews = [...allNews, ...gov];
+ }
+ if (isPanelEnabled('commodities')) renderCommodities(commodities);
+ if (isPanelEnabled('polymarket')) renderPolymarket(polymarket);
+ if (isPanelEnabled('printer')) renderMoneyPrinter(fedBalance);
+
+ // Render map with earthquakes and shipping alert data
+ if (isPanelEnabled('map')) {
+ const activityData = analyzeHotspotActivity(allNews);
+ await renderGlobalMap(
+ activityData,
+ earthquakes,
+ allNews,
+ mapLayers,
+ getMonitorHotspots,
+ fetchFlightData,
+ classifyAircraft,
+ getAircraftArrow
+ );
+ }
+ if (isPanelEnabled('mainchar')) {
+ const mainCharRankings = calculateMainCharacter(allNews);
+ renderMainCharacter(mainCharRankings);
+ }
+
+ if (isPanelEnabled('correlation')) {
+ const correlations = analyzeCorrelations(allNews);
+ renderCorrelationEngine(correlations);
+ }
+
+ if (isPanelEnabled('narrative')) {
+ const narratives = analyzeNarratives(allNews);
+ renderNarrativeTracker(narratives);
+ }
+
+ setStatus('Loading extras...', true);
+
+ // STAGE 3: Extra data - lowest priority
+ const stage3Promise = Promise.all([
+ isPanelEnabled('congress') ? fetchCongressTrades() : Promise.resolve([]),
+ isPanelEnabled('whales') ? fetchWhaleTransactions() : Promise.resolve([]),
+ isPanelEnabled('contracts') ? fetchGovContracts() : Promise.resolve([]),
+ isPanelEnabled('ai') ? fetchAINews() : Promise.resolve([]),
+ isPanelEnabled('layoffs') ? fetchLayoffs() : Promise.resolve([]),
+ isPanelEnabled('venezuela') ? fetchSituationNews('venezuela maduro caracas crisis') : Promise.resolve([]),
+ isPanelEnabled('greenland') ? fetchSituationNews('greenland denmark trump arctic') : Promise.resolve([]),
+ isPanelEnabled('intel') ? fetchIntelFeed() : Promise.resolve([])
+ ]);
+
+ const [congressTrades, whales, contracts, aiNews, layoffs, venezuelaNews, greenlandNews, intelFeed] = await stage3Promise;
+
+ if (isPanelEnabled('congress')) renderCongressTrades(congressTrades);
+ if (isPanelEnabled('whales')) renderWhaleWatch(whales);
+ if (isPanelEnabled('contracts')) renderGovContracts(contracts);
+ if (isPanelEnabled('ai')) renderAINews(aiNews);
+ if (isPanelEnabled('layoffs')) renderLayoffs(layoffs);
+ if (isPanelEnabled('intel')) renderIntelFeed(intelFeed);
+ if (isPanelEnabled('venezuela')) {
+ renderSituation('venezuelaPanel', 'venezuelaStatus', venezuelaNews, {
+ title: 'Venezuela Crisis',
+ subtitle: 'Political instability & humanitarian situation',
+ criticalKeywords: ['invasion', 'military', 'coup', 'violence', 'sanctions', 'arrested']
+ });
+ }
+ if (isPanelEnabled('greenland')) {
+ renderSituation('greenlandPanel', 'greenlandStatus', greenlandNews, {
+ title: 'Greenland Dispute',
+ subtitle: 'US-Denmark tensions over Arctic territory',
+ criticalKeywords: ['purchase', 'trump', 'military', 'takeover', 'independence', 'referendum']
+ });
+ }
+
+ // Render My Monitors panel with all news
+ if (isPanelEnabled('monitors')) {
+ renderMonitorsPanel(allNews);
+ }
+
+ const now = new Date();
+ setStatus(`Updated ${now.toLocaleTimeString()}`);
+ } catch (error) {
+ console.error('Refresh error:', error);
+ setStatus('Error updating');
+ }
+
+ if (btn) btn.disabled = false;
+}
+
+// Expose refreshAll to window
+window.refreshAll = refreshAll;
+
+// Initialize application
+document.addEventListener('DOMContentLoaded', () => {
+ // Initialize panels
+ initPanels(renderMonitorsList);
+
+ // Initial data load
+ refreshAll();
+
+ // Auto-refresh every 5 minutes
+ setInterval(refreshAll, 5 * 60 * 1000);
+});
diff --git a/js/map.js b/js/map.js
new file mode 100644
index 0000000..c41ac3c
--- /dev/null
+++ b/js/map.js
@@ -0,0 +1,1057 @@
+// map.js - D3 map rendering, zoom/pan, projections
+
+import {
+ INTEL_HOTSPOTS, NEWS_REGIONS, CONFLICT_ZONES, MILITARY_BASES, NUCLEAR_FACILITIES,
+ UNDERSEA_CABLES, SANCTIONED_COUNTRIES, SHIPPING_CHOKEPOINTS, CYBER_REGIONS,
+ US_CITIES, US_HOTSPOTS, MIDEAST_HOTSPOTS, UKRAINE_HOTSPOTS, TAIWAN_HOTSPOTS,
+ MAP_ZOOM_MIN, MAP_ZOOM_MAX, MAP_ZOOM_STEP
+} from './constants.js';
+import { escapeHtml, getTimeAgo } from './utils.js';
+import {
+ hideHotspotPopup, hideChokepointPopup, hideQuakePopup, hideCyberPopup,
+ hideCustomHotspotPopup, hideConflictPopup, hideUSCityPopup, hideUSHotspotPopup,
+ hideAircraftPopup, showHotspotPopup, showConflictPopup, showUSCityPopup,
+ showUSHotspotPopup, showChokepointPopup, showQuakePopup, showCyberPopup,
+ showCustomHotspotPopup, showAircraftPopup
+} from './popups.js';
+
+// Map state
+let mapZoom = 1;
+let mapPan = { x: 0, y: 0 };
+let isPanning = false;
+let panStart = { x: 0, y: 0 };
+let mapViewMode = 'global';
+
+// World map data cache
+let worldMapData = null;
+let usStatesData = null;
+
+// Export state getters/setters
+export function getMapViewMode() { return mapViewMode; }
+export function getMapZoom() { return mapZoom; }
+export function getMapPan() { return mapPan; }
+
+// Load world map TopoJSON data
+export async function loadWorldMap() {
+ if (worldMapData) return worldMapData;
+ try {
+ const response = await fetch('https://cdn.jsdelivr.net/npm/world-atlas@2/countries-110m.json');
+ worldMapData = await response.json();
+ return worldMapData;
+ } catch (e) {
+ console.error('Failed to load world map:', e);
+ return null;
+ }
+}
+
+// Load US states TopoJSON data
+export async function loadUSStates() {
+ if (usStatesData) return usStatesData;
+ try {
+ const response = await fetch('https://cdn.jsdelivr.net/npm/us-atlas@3/states-10m.json');
+ usStatesData = await response.json();
+ return usStatesData;
+ } catch (e) {
+ console.error('Failed to load US states:', e);
+ return null;
+ }
+}
+
+// Map zoom functions
+export function mapZoomIn() {
+ if (mapZoom < MAP_ZOOM_MAX) {
+ mapZoom = Math.min(MAP_ZOOM_MAX, mapZoom + MAP_ZOOM_STEP);
+ applyMapTransform();
+ }
+}
+
+export function mapZoomOut() {
+ if (mapZoom > MAP_ZOOM_MIN) {
+ mapZoom = Math.max(MAP_ZOOM_MIN, mapZoom - MAP_ZOOM_STEP);
+ if (mapZoom === 1) {
+ mapPan = { x: 0, y: 0 };
+ }
+ applyMapTransform();
+ }
+}
+
+export function mapZoomReset() {
+ mapZoom = 1;
+ mapPan = { x: 0, y: 0 };
+ applyMapTransform();
+}
+
+// Switch between map views
+export function setMapView(mode, refreshCallback) {
+ if (mapViewMode === mode) return;
+ mapViewMode = mode;
+ mapZoom = 1;
+ mapPan = { x: 0, y: 0 };
+ if (window.cachedAllNews && refreshCallback) {
+ refreshCallback();
+ }
+}
+
+// Apply zoom/pan transform to map
+export function applyMapTransform() {
+ const wrapper = document.getElementById('mapZoomWrapper');
+ const levelDisplay = document.getElementById('mapZoomLevel');
+ const panHint = document.getElementById('mapPanHint');
+
+ if (wrapper) {
+ wrapper.style.transform = `scale(${mapZoom}) translate(${mapPan.x}px, ${mapPan.y}px)`;
+ }
+ if (levelDisplay) {
+ levelDisplay.textContent = `${mapZoom.toFixed(1)}x`;
+ }
+ if (panHint) {
+ panHint.classList.toggle('show', mapZoom > 1);
+ }
+}
+
+// Initialize map panning
+export function initMapPan() {
+ const container = document.getElementById('worldMapContainer');
+ if (!container) return;
+
+ container.addEventListener('mousedown', (e) => {
+ if (mapZoom <= 1) return;
+ if (e.target.closest('.map-zoom-controls')) return;
+
+ isPanning = true;
+ panStart = { x: e.clientX - mapPan.x * mapZoom, y: e.clientY - mapPan.y * mapZoom };
+ container.style.cursor = 'grabbing';
+ });
+
+ document.addEventListener('mousemove', (e) => {
+ if (!isPanning) return;
+
+ const maxPan = (mapZoom - 1) * 200;
+ mapPan.x = Math.max(-maxPan, Math.min(maxPan, (e.clientX - panStart.x) / mapZoom));
+ mapPan.y = Math.max(-maxPan, Math.min(maxPan, (e.clientY - panStart.y) / mapZoom));
+ applyMapTransform();
+ });
+
+ document.addEventListener('mouseup', () => {
+ if (isPanning) {
+ isPanning = false;
+ const container = document.getElementById('worldMapContainer');
+ if (container) container.style.cursor = '';
+ }
+ });
+
+ // Mouse wheel zoom
+ container.addEventListener('wheel', (e) => {
+ e.preventDefault();
+ if (e.deltaY < 0) {
+ mapZoomIn();
+ } else {
+ mapZoomOut();
+ }
+ }, { passive: false });
+}
+
+// Analyze news for hotspot activity
+export function analyzeHotspotActivity(allNews) {
+ const results = {};
+
+ INTEL_HOTSPOTS.forEach(spot => {
+ let score = 0;
+ let matchedHeadlines = [];
+
+ allNews.forEach(item => {
+ const title = item.title.toLowerCase();
+ const matchedKeywords = spot.keywords.filter(kw => title.includes(kw));
+ if (matchedKeywords.length > 0) {
+ score += matchedKeywords.length;
+ if (item.isAlert) score += 3;
+ matchedHeadlines.push({
+ title: item.title,
+ link: item.link,
+ source: item.source,
+ isAlert: item.isAlert
+ });
+ }
+ });
+
+ let level = 'low';
+ if (score >= 8) level = 'high';
+ else if (score >= 3) level = 'elevated';
+
+ results[spot.id] = { level, score, headlines: matchedHeadlines.slice(0, 5) };
+ });
+
+ return results;
+}
+
+// Calculate news density for each region
+export function calculateNewsDensity(allNews) {
+ const scores = {};
+ NEWS_REGIONS.forEach(region => {
+ let score = 0;
+ allNews.forEach(item => {
+ const title = (item.title || '').toLowerCase();
+ region.keywords.forEach(kw => {
+ if (title.includes(kw)) score++;
+ });
+ if (item.isAlert) score += 2;
+ });
+ scores[region.id] = score;
+ });
+ return scores;
+}
+
+// Update flashback time display
+export function updateFlashback(hoursAgo) {
+ const flashbackTime = document.getElementById('flashbackTime');
+ const flashbackIndicator = document.getElementById('flashbackIndicator');
+
+ if (parseInt(hoursAgo) === 0) {
+ flashbackTime.textContent = 'LIVE';
+ if (flashbackIndicator) flashbackIndicator.classList.remove('active');
+ } else {
+ const now = new Date();
+ now.setHours(now.getHours() - parseInt(hoursAgo));
+ flashbackTime.textContent = `-${hoursAgo}h`;
+ if (flashbackIndicator) flashbackIndicator.classList.add('active');
+ }
+}
+
+// Render the global map
+export async function renderGlobalMap(activityData, earthquakes = [], allNews = [], mapLayers, getMonitorHotspots, fetchFlightData, classifyAircraft, getAircraftArrow) {
+ // Cache allNews for popup access
+ window.cachedAllNews = allNews;
+
+ const panel = document.getElementById('mapPanel');
+ const timestamp = new Date().toISOString().replace('T', ' ').substring(0, 19) + ' UTC';
+
+ const isUSView = mapViewMode === 'us';
+ const isMidEastView = mapViewMode === 'mideast';
+ const isUkraineView = mapViewMode === 'ukraine';
+ const isTaiwanView = mapViewMode === 'taiwan';
+ const isRegionalView = isUSView || isMidEastView || isUkraineView || isTaiwanView;
+
+ let mapTitle, mapLegend;
+ if (isUSView) {
+ mapTitle = 'US DOMESTIC MONITOR';
+ mapLegend = '★ CAPITAL | ● MAJOR | ○ REGIONAL';
+ } else if (isMidEastView) {
+ mapTitle = 'MIDDLE EAST MONITOR';
+ mapLegend = '💥 CONFLICT | ☢ NUCLEAR | ⚠ CRISIS';
+ } else if (isUkraineView) {
+ mapTitle = 'UKRAINE-RUSSIA THEATER';
+ mapLegend = '⚔ FRONT | 🛡 DEFENSE | 🎯 STRIKE';
+ } else if (isTaiwanView) {
+ mapTitle = 'CHINA-TAIWAN THEATER';
+ mapLegend = '⚡ FLASHPOINT | 🏝 DISPUTED | 🛡 DEFENSE';
+ } else {
+ mapTitle = 'GLOBAL ACTIVITY MONITOR';
+ mapLegend = '⚓ SHIP | ☢ NUKES | ▪ BASES | ═ CABLES';
+ }
+
+ panel.innerHTML = `
+ <div class="world-map" id="worldMapContainer">
+ <div class="map-zoom-wrapper" id="mapZoomWrapper">
+ <canvas id="satelliteCanvas" class="satellite-canvas"></canvas>
+ <div class="satellite-loading" id="satelliteLoading">Loading satellite imagery...</div>
+ <div class="satellite-attribution" id="satelliteAttribution">Imagery: ESRI World Imagery</div>
+ <svg id="worldMapSVG"></svg>
+ <div class="map-overlays" id="mapOverlays"></div>
+ </div>
+ <div class="map-view-toggle">
+ <button class="map-view-btn ${mapViewMode === 'global' ? 'active' : ''}" onclick="setMapView('global')">GLOBAL</button>
+ <button class="map-view-btn ${isUSView ? 'active' : ''}" onclick="setMapView('us')">US</button>
+ <button class="map-view-btn ${isMidEastView ? 'active' : ''}" onclick="setMapView('mideast')">MIDEAST</button>
+ <button class="map-view-btn ${isUkraineView ? 'active' : ''}" onclick="setMapView('ukraine')">UKRAINE</button>
+ <button class="map-view-btn ${isTaiwanView ? 'active' : ''}" onclick="setMapView('taiwan')">TAIWAN</button>
+ </div>
+ <div class="map-zoom-controls">
+ <button class="map-zoom-btn" onclick="mapZoomIn()" title="Zoom In">+</button>
+ <div class="map-zoom-level" id="mapZoomLevel">1.0x</div>
+ <button class="map-zoom-btn" onclick="mapZoomOut()" title="Zoom Out">−</button>
+ <button class="map-zoom-btn map-zoom-reset" onclick="mapZoomReset()" title="Reset">RST</button>
+ </div>
+ <div class="map-pan-hint" id="mapPanHint">DRAG TO PAN</div>
+ <div class="conflict-popup" id="conflictPopup"></div>
+ <div class="us-city-popup" id="usCityPopup"></div>
+ <div class="map-corner-label tl">${mapTitle}</div>
+ <div class="map-corner-label tr">CLASSIFICATION: OPEN SOURCE</div>
+ <div class="map-corner-label bl">${mapLegend}</div>
+ <div class="map-corner-label br">${timestamp}</div>
+ </div>
+ `;
+
+ const container = document.getElementById('worldMapContainer');
+ const svg = d3.select('#worldMapSVG');
+ const width = container.offsetWidth || 800;
+ const height = container.offsetHeight || 550;
+
+ svg.attr('width', '100%')
+ .attr('height', '100%')
+ .attr('viewBox', `0 0 ${width} ${height}`)
+ .attr('preserveAspectRatio', 'none');
+
+ // Create projection based on view mode
+ let projection;
+ if (isUSView) {
+ projection = d3.geoAlbersUsa()
+ .scale(width * 1.3)
+ .translate([width / 2, height / 2]);
+ } else if (isMidEastView) {
+ projection = d3.geoMercator()
+ .center([42, 28])
+ .scale(width * 1.5)
+ .translate([width / 2, height / 2]);
+ } else if (isUkraineView) {
+ projection = d3.geoMercator()
+ .center([35, 50])
+ .scale(width * 2.2)
+ .translate([width / 2, height / 2]);
+ } else if (isTaiwanView) {
+ projection = d3.geoMercator()
+ .center([118, 23])
+ .scale(width * 1.8)
+ .translate([width / 2, height / 2]);
+ } else {
+ projection = d3.geoEquirectangular()
+ .scale(width / (2 * Math.PI))
+ .center([0, 0])
+ .translate([width / 2, height / 2]);
+ }
+
+ const path = d3.geoPath().projection(projection);
+
+ // Add background
+ svg.append('rect')
+ .attr('width', width)
+ .attr('height', height)
+ .attr('fill', '#020a08');
+
+ // Add grid pattern
+ const defs = svg.append('defs');
+
+ const smallGrid = defs.append('pattern')
+ .attr('id', 'smallGridD3')
+ .attr('width', 20)
+ .attr('height', 20)
+ .attr('patternUnits', 'userSpaceOnUse');
+ smallGrid.append('path')
+ .attr('d', 'M 20 0 L 0 0 0 20')
+ .attr('fill', 'none')
+ .attr('stroke', '#0a2a20')
+ .attr('stroke-width', 0.5);
+
+ const grid = defs.append('pattern')
+ .attr('id', 'gridD3')
+ .attr('width', 60)
+ .attr('height', 60)
+ .attr('patternUnits', 'userSpaceOnUse');
+ grid.append('rect')
+ .attr('width', 60)
+ .attr('height', 60)
+ .attr('fill', 'url(#smallGridD3)');
+ grid.append('path')
+ .attr('d', 'M 60 0 L 0 0 0 60')
+ .attr('fill', 'none')
+ .attr('stroke', '#0d3a2d')
+ .attr('stroke-width', 0.8);
+
+ svg.append('rect')
+ .attr('width', width)
+ .attr('height', height)
+ .attr('fill', 'url(#gridD3)');
+
+ // Add graticule
+ const graticule = d3.geoGraticule().step([30, 30]);
+ svg.append('path')
+ .datum(graticule)
+ .attr('d', path)
+ .attr('fill', 'none')
+ .attr('stroke', '#0f4035')
+ .attr('stroke-width', 0.5)
+ .attr('stroke-opacity', 0.5);
+
+ // Load and render countries
+ const world = await loadWorldMap();
+ if (world) {
+ const countries = topojson.feature(world, world.objects.countries);
+
+ svg.append('g')
+ .attr('class', 'countries-layer')
+ .selectAll('path')
+ .data(countries.features)
+ .enter()
+ .append('path')
+ .attr('d', path)
+ .attr('fill', d => {
+ if (mapLayers.sanctions) {
+ const countryId = d.id;
+ const sanctionLevel = SANCTIONED_COUNTRIES[countryId];
+ if (sanctionLevel === 'severe') return '#660000';
+ if (sanctionLevel === 'high') return '#442200';
+ if (sanctionLevel === 'moderate') return '#333300';
+ if (sanctionLevel === 'low') return '#223322';
+ }
+ return '#0a2018';
+ })
+ .attr('stroke', '#0f5040')
+ .attr('stroke-width', 0.5);
+
+ // Add US state boundaries (US view only)
+ if (isUSView) {
+ const usStates = await loadUSStates();
+ if (usStates) {
+ const states = topojson.feature(usStates, usStates.objects.states);
+ const stateBorders = topojson.mesh(usStates, usStates.objects.states, (a, b) => a !== b);
+
+ svg.append('g')
+ .attr('class', 'states-layer')
+ .selectAll('path')
+ .data(states.features)
+ .enter()
+ .append('path')
+ .attr('d', path)
+ .attr('fill', '#0a2018')
+ .attr('stroke', 'none');
+
+ svg.append('path')
+ .datum(stateBorders)
+ .attr('class', 'state-borders')
+ .attr('d', path)
+ .attr('fill', 'none')
+ .attr('stroke', '#1a6050')
+ .attr('stroke-width', 0.75)
+ .attr('stroke-linejoin', 'round');
+
+ const nationBorder = topojson.mesh(usStates, usStates.objects.nation);
+ svg.append('path')
+ .datum(nationBorder)
+ .attr('class', 'nation-border')
+ .attr('d', path)
+ .attr('fill', 'none')
+ .attr('stroke', '#2a8070')
+ .attr('stroke-width', 1.5);
+ }
+ }
+
+ // Regional view country highlighting
+ if (isMidEastView) {
+ const MIDEAST_COUNTRIES = ['SAU', 'ARE', 'QAT', 'KWT', 'BHR', 'OMN', 'IRN', 'IRQ', 'SYR', 'LBN', 'JOR', 'ISR', 'PSE', 'YEM', 'EGY', 'TUR', 'CYP', 'AFG', 'PAK'];
+ svg.append('g')
+ .attr('class', 'mideast-layer')
+ .selectAll('path')
+ .data(countries.features)
+ .enter()
+ .append('path')
+ .attr('d', path)
+ .attr('fill', d => {
+ const isoCode = d.properties.iso_a3 || d.id;
+ return MIDEAST_COUNTRIES.includes(isoCode) ? '#0f3028' : '#050f0c';
+ })
+ .attr('stroke', d => {
+ const isoCode = d.properties.iso_a3 || d.id;
+ return MIDEAST_COUNTRIES.includes(isoCode) ? '#2a8070' : '#0a2018';
+ })
+ .attr('stroke-width', d => {
+ const isoCode = d.properties.iso_a3 || d.id;
+ return MIDEAST_COUNTRIES.includes(isoCode) ? 1.0 : 0.3;
+ });
+ }
+
+ if (isUkraineView) {
+ const UKRAINE_THEATER = ['UKR', 'RUS', 'BLR', 'POL', 'ROU', 'MDA', 'HUN', 'SVK', 'LTU', 'LVA', 'EST', 'FIN'];
+ const PRIMARY_COUNTRIES = ['UKR', 'RUS', 'BLR'];
+ svg.append('g')
+ .attr('class', 'ukraine-layer')
+ .selectAll('path')
+ .data(countries.features)
+ .enter()
+ .append('path')
+ .attr('d', path)
+ .attr('fill', d => {
+ const isoCode = d.properties.iso_a3 || d.id;
+ if (isoCode === 'UKR') return '#1a4030';
+ if (isoCode === 'RUS') return '#301818';
+ if (isoCode === 'BLR') return '#282818';
+ if (UKRAINE_THEATER.includes(isoCode)) return '#0f2820';
+ return '#050f0c';
+ })
+ .attr('stroke', d => {
+ const isoCode = d.properties.iso_a3 || d.id;
+ if (isoCode === 'UKR') return '#3a9070';
+ if (isoCode === 'RUS') return '#803030';
+ if (PRIMARY_COUNTRIES.includes(isoCode)) return '#806040';
+ if (UKRAINE_THEATER.includes(isoCode)) return '#2a6050';
+ return '#0a2018';
+ })
+ .attr('stroke-width', d => {
+ const isoCode = d.properties.iso_a3 || d.id;
+ if (PRIMARY_COUNTRIES.includes(isoCode)) return 1.5;
+ if (UKRAINE_THEATER.includes(isoCode)) return 1.0;
+ return 0.3;
+ });
+ }
+
+ if (isTaiwanView) {
+ const TAIWAN_THEATER = ['CHN', 'TWN', 'PHL', 'JPN', 'VNM', 'MYS', 'KOR', 'IDN', 'BRN'];
+ const PRIMARY_COUNTRIES = ['CHN', 'TWN', 'PHL'];
+ svg.append('g')
+ .attr('class', 'taiwan-layer')
+ .selectAll('path')
+ .data(countries.features)
+ .enter()
+ .append('path')
+ .attr('d', path)
+ .attr('fill', d => {
+ const isoCode = d.properties.iso_a3 || d.id;
+ if (isoCode === 'CHN') return '#301818';
+ if (isoCode === 'TWN') return '#1a3040';
+ if (isoCode === 'PHL') return '#1a4030';
+ if (isoCode === 'JPN') return '#202840';
+ if (TAIWAN_THEATER.includes(isoCode)) return '#0f2820';
+ return '#050f0c';
+ })
+ .attr('stroke', d => {
+ const isoCode = d.properties.iso_a3 || d.id;
+ if (isoCode === 'CHN') return '#803030';
+ if (isoCode === 'TWN') return '#3080a0';
+ if (isoCode === 'PHL') return '#3a9070';
+ if (PRIMARY_COUNTRIES.includes(isoCode)) return '#806040';
+ if (TAIWAN_THEATER.includes(isoCode)) return '#2a6050';
+ return '#0a2018';
+ })
+ .attr('stroke-width', d => {
+ const isoCode = d.properties.iso_a3 || d.id;
+ if (PRIMARY_COUNTRIES.includes(isoCode)) return 1.5;
+ if (TAIWAN_THEATER.includes(isoCode)) return 1.0;
+ return 0.3;
+ });
+ }
+
+ // Add undersea cables (global view only)
+ if (mapLayers.cables && !isRegionalView) {
+ const cableGroup = svg.append('g').attr('class', 'cables-layer');
+ UNDERSEA_CABLES.forEach(cable => {
+ const lineGenerator = d3.line()
+ .x(d => { const p = projection(d); return p ? p[0] : 0; })
+ .y(d => { const p = projection(d); return p ? p[1] : 0; })
+ .curve(d3.curveBasis);
+
+ const points = cable.points.map(p => [p[0], p[1]]);
+ cableGroup.append('path')
+ .attr('d', lineGenerator(points))
+ .attr('class', `cable-path ${cable.major ? 'major' : ''}`)
+ .append('title')
+ .text(cable.name);
+ });
+ }
+
+ // Add conflict zone boundaries (global view only)
+ if (mapLayers.conflicts && !isRegionalView) {
+ const conflictGroup = svg.append('g').attr('class', 'conflicts-layer');
+ CONFLICT_ZONES.forEach(zone => {
+ const points = zone.coords.map(c => projection([c[0], c[1]]));
+ if (points.some(p => !p)) return;
+ if (points.length > 0) {
+ const pathData = 'M' + points.map(p => p.join(',')).join('L') + 'Z';
+ const isHigh = zone.intensity === 'high';
+
+ conflictGroup.append('path')
+ .attr('d', pathData)
+ .attr('class', 'conflict-zone-glow');
+
+ conflictGroup.append('path')
+ .attr('d', pathData)
+ .attr('class', `conflict-zone-fill ${isHigh ? 'high-intensity' : ''}`);
+
+ conflictGroup.append('path')
+ .attr('d', pathData)
+ .attr('class', `conflict-zone-path ${isHigh ? 'high-intensity' : ''}`);
+ }
+ });
+ }
+ }
+
+ // Helper to convert lon/lat to percentage
+ const toPercent = (lon, lat) => {
+ const projected = projection([lon, lat]);
+ if (!projected) return null;
+ return {
+ x: (projected[0] / width) * 100,
+ y: (projected[1] / height) * 100
+ };
+ };
+
+ // Build overlay HTML
+ let overlaysHTML = '';
+
+ // Coordinate labels (global view only)
+ if (!isRegionalView) {
+ [-60, -30, 0, 30, 60].forEach(lat => {
+ const pos = toPercent(-175, lat);
+ if (!pos) return;
+ const label = lat === 0 ? '0°' : (lat > 0 ? `${lat}°N` : `${Math.abs(lat)}°S`);
+ overlaysHTML += `<div class="coord-label lat" style="top: ${pos.y}%; left: 0.5%;">${label}</div>`;
+ });
+ [-120, -60, 0, 60, 120].forEach(lon => {
+ const pos = toPercent(lon, -85);
+ if (!pos) return;
+ const label = lon === 0 ? '0°' : (lon > 0 ? `${lon}°E` : `${Math.abs(lon)}°W`);
+ overlaysHTML += `<div class="coord-label lon" style="left: ${pos.x}%; bottom: 1%;">${label}</div>`;
+ });
+ }
+
+ // News density heatmap blobs (global view only)
+ if (mapLayers.density && !isRegionalView) {
+ const densityScores = calculateNewsDensity(allNews);
+ NEWS_REGIONS.forEach(region => {
+ const score = densityScores[region.id] || 0;
+ if (score > 0) {
+ const pos = toPercent(region.lon, region.lat);
+ if (!pos) return;
+ let level = 'low';
+ let size = region.radius;
+ if (score >= 10) { level = 'high'; size = region.radius * 1.5; }
+ else if (score >= 5) { level = 'medium'; size = region.radius * 1.2; }
+ overlaysHTML += `<div class="density-blob ${level}" style="left: ${pos.x}%; top: ${pos.y}%; width: ${size}px; height: ${size}px; transform: translate(-50%, -50%);"></div>`;
+ }
+ });
+ }
+
+ // Conflict zone labels (global view only)
+ if (mapLayers.conflicts && !isRegionalView) {
+ CONFLICT_ZONES.forEach(zone => {
+ const pos = toPercent(zone.labelPos.lon, zone.labelPos.lat);
+ if (!pos) return;
+ const intensityClass = zone.intensity === 'high' ? 'high-intensity' : '';
+ const zoneData = encodeURIComponent(JSON.stringify(zone));
+ overlaysHTML += `<div class="conflict-zone-label ${intensityClass}" style="left: ${pos.x}%; top: ${pos.y}%;" data-conflict-id="${zone.id}" data-conflict-info="${zoneData}" onclick="showConflictPopup(event, '${zone.id}')">${zone.name}</div>`;
+ });
+ }
+
+ // Military base markers (global view only)
+ if (mapLayers.bases && !isRegionalView) {
+ MILITARY_BASES.forEach(base => {
+ const pos = toPercent(base.lon, base.lat);
+ if (!pos) return;
+ overlaysHTML += `<div class="military-base ${base.type}" style="left: ${pos.x}%; top: ${pos.y}%;" title="${base.name}"><div class="base-icon ${base.type}"></div><div class="base-label ${base.type}">${base.name}</div></div>`;
+ });
+ }
+
+ // Nuclear facility markers (global view only)
+ if (mapLayers.nuclear && !isRegionalView) {
+ NUCLEAR_FACILITIES.forEach(facility => {
+ const pos = toPercent(facility.lon, facility.lat);
+ if (!pos) return;
+ const isWeapons = facility.type === 'weapons' || facility.type === 'enrichment';
+ overlaysHTML += `<div class="nuclear-facility" style="left: ${pos.x}%; top: ${pos.y}%;" title="${facility.name} (${facility.type})"><div class="nuclear-icon ${isWeapons ? 'weapons' : ''}"></div><div class="nuclear-label">${facility.name}</div></div>`;
+ });
+ }
+
+ // Cyber threat zones (global view only)
+ if (!isRegionalView) {
+ CYBER_REGIONS.forEach(cz => {
+ const pos = toPercent(cz.lon, cz.lat);
+ if (!pos) return;
+ const isActive = Math.random() > 0.6;
+ const czData = encodeURIComponent(JSON.stringify({ ...cz, isActive }));
+ overlaysHTML += `<div class="cyber-zone ${isActive ? 'active' : ''}" style="left: ${pos.x}%; top: ${pos.y}%;" data-cyber-id="${cz.id}" data-cyber-info="${czData}" onclick="showCyberPopup(event, '${cz.id}')"><div class="cyber-icon"></div><div class="cyber-label">${cz.group}</div></div>`;
+ });
+ }
+
+ // Shipping chokepoints (global view only)
+ if (!isRegionalView) {
+ SHIPPING_CHOKEPOINTS.forEach(cp => {
+ const pos = toPercent(cp.lon, cp.lat);
+ if (!pos) return;
+ const matchedHeadlines = allNews.filter(item => {
+ const title = (item.title || '').toLowerCase();
+ return cp.keywords.some(kw => title.includes(kw));
+ }).slice(0, 5).map(item => ({ title: item.title, link: item.link, source: item.source }));
+ const isAlert = matchedHeadlines.length > 0;
+ const cpData = encodeURIComponent(JSON.stringify({ ...cp, isAlert, headlines: matchedHeadlines }));
+ overlaysHTML += `<div class="chokepoint ${isAlert ? 'alert' : ''}" style="left: ${pos.x}%; top: ${pos.y}%;" data-chokepoint-id="${cp.id}" data-chokepoint-info="${cpData}" onclick="showChokepointPopup(event, '${cp.id}')"><div class="chokepoint-icon"></div><div class="chokepoint-label">${cp.name}</div></div>`;
+ });
+ }
+
+ // Earthquake markers
+ earthquakes.slice(0, 10).forEach((eq, index) => {
+ const pos = toPercent(eq.lon, eq.lat);
+ if (!pos) return;
+ const isMajor = eq.mag >= 6.0;
+ const eqData = encodeURIComponent(JSON.stringify({ mag: eq.mag, place: eq.place, time: eq.time, lat: eq.lat, lon: eq.lon, depth: eq.depth, id: eq.id || `eq_${index}` }));
+ overlaysHTML += `<div class="quake ${isMajor ? 'major' : ''}" style="left: ${pos.x}%; top: ${pos.y}%;" data-quake-id="eq_${index}" data-quake-info="${eqData}" onclick="showQuakePopup(event, 'eq_${index}')"><div class="quake-icon"></div><div class="quake-label">M${eq.mag.toFixed(1)}</div></div>`;
+ });
+
+ // Intel hotspots (global view only)
+ if (!isRegionalView) {
+ INTEL_HOTSPOTS.forEach(spot => {
+ const activity = activityData[spot.id] || { level: 'low', score: 0, headlines: [] };
+ const pos = toPercent(spot.lon, spot.lat);
+ if (!pos) return;
+ const activityJson = encodeURIComponent(JSON.stringify({
+ ...activity, name: spot.name, subtext: spot.subtext, lat: spot.lat, lon: spot.lon,
+ description: spot.description || '', agencies: spot.agencies || [], status: spot.status || ''
+ }));
+
+ if (activity.level === 'high' && activity.headlines.length > 0) {
+ overlaysHTML += `<div class="news-pulse" style="left: ${pos.x}%; top: ${pos.y}%;"><div class="news-pulse-ring"></div><div class="news-pulse-ring"></div><div class="news-pulse-ring"></div><div class="news-pulse-label">Breaking</div></div>`;
+ }
+
+ overlaysHTML += `<div class="hotspot ${activity.level}" style="left: ${pos.x}%; top: ${pos.y}%;" data-hotspot-id="${spot.id}" data-hotspot-activity="${activityJson}" onclick="showHotspotPopup(event, '${spot.id}')"><div class="hotspot-dot"></div><div class="hotspot-label">${spot.name}<div class="hotspot-info">${spot.subtext}</div></div></div>`;
+ });
+ }
+
+ // Custom monitor hotspots
+ if (getMonitorHotspots) {
+ const customHotspots = getMonitorHotspots(allNews);
+ customHotspots.forEach(monitor => {
+ const pos = toPercent(monitor.lon, monitor.lat);
+ if (!pos) return;
+ const matchData = encodeURIComponent(JSON.stringify({
+ id: monitor.id, name: monitor.name, color: monitor.color, keywords: monitor.keywords,
+ lat: monitor.lat, lon: monitor.lon, matchCount: monitor.matchCount, matches: monitor.matches.slice(0, 5)
+ }));
+ overlaysHTML += `<div class="custom-hotspot" style="left: ${pos.x}%; top: ${pos.y}%; color: ${monitor.color};" data-monitor-id="${monitor.id}" data-monitor-info="${matchData}" onclick="showCustomHotspotPopup(event, '${monitor.id}')"><div class="custom-hotspot-dot" style="background: ${monitor.color}; border-color: ${monitor.color};"></div><div class="custom-hotspot-label" style="color: ${monitor.color};">${monitor.name}<span class="custom-hotspot-count">${monitor.matchCount > 0 ? ` (${monitor.matchCount})` : ''}</span></div></div>`;
+ });
+ }
+
+ // Add popup containers
+ overlaysHTML += `<div class="hotspot-popup" id="hotspotPopup"></div>`;
+ overlaysHTML += `<div class="chokepoint-popup" id="chokepointPopup"></div>`;
+ overlaysHTML += `<div class="quake-popup" id="quakePopup"></div>`;
+ overlaysHTML += `<div class="cyber-popup" id="cyberPopup"></div>`;
+ overlaysHTML += `<div class="custom-hotspot-popup" id="customHotspotPopup"></div>`;
+
+ // Regional view specific overlays
+ if (isUSView) {
+ overlaysHTML += renderUSViewOverlays(projection, width, height, allNews);
+ overlaysHTML += `<div class="us-hotspot-popup" id="usHotspotPopup"></div>`;
+ }
+
+ if (isMidEastView) {
+ overlaysHTML += renderMidEastViewOverlays(projection, width, height, allNews);
+ overlaysHTML += `<div class="us-hotspot-popup" id="usHotspotPopup"></div>`;
+ }
+
+ if (isUkraineView) {
+ overlaysHTML += renderUkraineViewOverlays(projection, width, height, allNews);
+ overlaysHTML += `<div class="us-hotspot-popup" id="usHotspotPopup"></div>`;
+ }
+
+ if (isTaiwanView) {
+ overlaysHTML += renderTaiwanViewOverlays(projection, width, height, allNews);
+ overlaysHTML += `<div class="us-hotspot-popup" id="usHotspotPopup"></div>`;
+ }
+
+ // Layer toggle buttons (global view only)
+ if (!isRegionalView) {
+ overlaysHTML += `
+ <div class="map-layer-toggle">
+ <button class="layer-btn ${mapLayers.conflicts ? 'active' : ''}" onclick="toggleLayer('conflicts')">Conflicts</button>
+ <button class="layer-btn ${mapLayers.bases ? 'active' : ''}" onclick="toggleLayer('bases')">Bases</button>
+ <button class="layer-btn ${mapLayers.nuclear ? 'active' : ''}" onclick="toggleLayer('nuclear')">Nuclear</button>
+ <button class="layer-btn ${mapLayers.cables ? 'active' : ''}" onclick="toggleLayer('cables')">Cables</button>
+ <button class="layer-btn ${mapLayers.sanctions ? 'active' : ''}" onclick="toggleLayer('sanctions')">Sanctions</button>
+ <button class="layer-btn ${mapLayers.density ? 'active' : ''}" onclick="toggleLayer('density')">Density</button>
+ <button class="layer-btn ${mapLayers.flights ? 'active' : ''}" onclick="toggleLayer('flights')">Flights</button>
+ <button class="layer-btn satellite-btn ${mapLayers.satellite ? 'active' : ''}" onclick="toggleSatelliteLayer()">Satellite</button>
+ </div>
+ `;
+ }
+
+ // Flight radar overlay
+ if (mapLayers.flights && fetchFlightData) {
+ try {
+ const flights = await fetchFlightData();
+ const flightCount = flights.length;
+
+ flights.slice(0, 200).forEach(flight => {
+ const projected = projection([flight.lon, flight.lat]);
+ if (!projected) return;
+ const posX = (projected[0] / width) * 100;
+ const posY = (projected[1] / height) * 100;
+ if (posX < 0 || posX > 100 || posY < 0 || posY > 100) return;
+
+ const aircraftType = classifyAircraft(flight.callsign, flight.country);
+ const arrow = getAircraftArrow(flight.heading);
+ const flightData = encodeURIComponent(JSON.stringify(flight));
+
+ overlaysHTML += `<div class="aircraft-marker ${aircraftType}" style="left: ${posX}%; top: ${posY}%; transform: translate(-50%, -50%) rotate(${flight.heading || 0}deg);" onclick="showAircraftPopup(event, '${flightData}')" title="${flight.callsign || flight.icao24}"><div class="aircraft-icon" style="transform: rotate(-${flight.heading || 0}deg);">${arrow}</div></div>`;
+ });
+
+ overlaysHTML += `<div class="flight-count-badge" style="position: absolute; bottom: 30px; right: 10px;">✈ ${flightCount} flights</div>`;
+ } catch (e) {
+ console.error('Flight rendering failed:', e);
+ }
+ }
+
+ // Aircraft popup container
+ overlaysHTML += `<div class="aircraft-popup" id="aircraftPopup"></div>`;
+
+ // Flashback slider
+ overlaysHTML += `
+ <div class="flashback-mode-indicator" id="flashbackIndicator">Viewing Historical Data</div>
+ <div class="flashback-control">
+ <span class="flashback-label">Time</span>
+ <input type="range" class="flashback-slider" id="flashbackSlider" min="0" max="24" value="0" step="1" onchange="updateFlashback(this.value)">
+ <span class="flashback-time" id="flashbackTime">LIVE</span>
+ </div>
+ `;
+
+ document.getElementById('mapOverlays').innerHTML = overlaysHTML;
+
+ // Initialize map pan functionality
+ initMapPan();
+
+ // Close popups when clicking outside
+ document.getElementById('worldMapContainer').addEventListener('click', (e) => {
+ if (!e.target.closest('.hotspot') && !e.target.closest('.hotspot-popup')) hideHotspotPopup();
+ if (!e.target.closest('.chokepoint') && !e.target.closest('.chokepoint-popup')) hideChokepointPopup();
+ if (!e.target.closest('.quake') && !e.target.closest('.quake-popup')) hideQuakePopup();
+ if (!e.target.closest('.cyber-zone') && !e.target.closest('.cyber-popup')) hideCyberPopup();
+ if (!e.target.closest('.custom-hotspot') && !e.target.closest('.custom-hotspot-popup')) hideCustomHotspotPopup();
+ if (!e.target.closest('.conflict-zone-label') && !e.target.closest('.conflict-popup')) hideConflictPopup();
+ if (!e.target.closest('.us-city') && !e.target.closest('.us-city-popup')) hideUSCityPopup();
+ if (!e.target.closest('.us-hotspot') && !e.target.closest('.us-hotspot-popup')) hideUSHotspotPopup();
+ if (!e.target.closest('.aircraft-marker') && !e.target.closest('.aircraft-popup')) hideAircraftPopup();
+ });
+}
+
+// Helper functions for regional views
+function renderUSViewOverlays(projection, width, height, allNews) {
+ let html = '';
+
+ US_CITIES.forEach(city => {
+ const projected = projection([city.lon, city.lat]);
+ if (!projected) return;
+ const posX = (projected[0] / width) * 100;
+ const posY = (projected[1] / height) * 100;
+
+ let matchCount = 0;
+ if (allNews && allNews.length > 0) {
+ const matches = allNews.filter(item => {
+ const title = (item.title || '').toLowerCase();
+ return city.keywords.some(kw => title.includes(kw.toLowerCase()));
+ });
+ matchCount = matches.length;
+ }
+
+ const cityData = encodeURIComponent(JSON.stringify({
+ ...city, matchCount,
+ headlines: allNews ? allNews.filter(item => {
+ const title = (item.title || '').toLowerCase();
+ return city.keywords.some(kw => title.includes(kw.toLowerCase()));
+ }).slice(0, 8) : []
+ }));
+
+ const typeClass = city.type === 'capital' ? 'capital' : city.type === 'major' ? 'major' : '';
+ const activityLevel = matchCount >= 5 ? 'high-activity' : '';
+
+ html += `<div class="us-city ${typeClass} ${activityLevel}" style="left: ${posX}%; top: ${posY}%; color: ${city.type === 'capital' ? '#ffcc00' : city.type === 'major' ? '#00ff88' : '#00aaff'};" data-city-id="${city.id}" data-city-info="${cityData}" onclick="showUSCityPopup(event, '${city.id}')"><div class="us-city-dot"></div><div class="us-city-label">${city.name}${matchCount > 0 ? `<span class="us-city-count">(${matchCount})</span>` : ''}</div></div>`;
+ });
+
+ US_HOTSPOTS.forEach(hotspot => {
+ const projected = projection([hotspot.lon, hotspot.lat]);
+ if (!projected) return;
+ const posX = (projected[0] / width) * 100;
+ const posY = (projected[1] / height) * 100;
+
+ let matchCount = 0;
+ let matchedHeadlines = [];
+ if (allNews && allNews.length > 0) {
+ matchedHeadlines = allNews.filter(item => {
+ const title = (item.title || '').toLowerCase();
+ return hotspot.keywords.some(kw => title.includes(kw.toLowerCase()));
+ });
+ matchCount = matchedHeadlines.length;
+ }
+
+ const hotspotData = encodeURIComponent(JSON.stringify({ ...hotspot, matchCount, headlines: matchedHeadlines.slice(0, 8) }));
+
+ html += `<div class="us-hotspot ${hotspot.level}" style="left: ${posX}%; top: ${posY}%;" data-us-hotspot-id="${hotspot.id}" data-us-hotspot-info="${hotspotData}" onclick="showUSHotspotPopup(event, '${hotspot.id}')"><div class="us-hotspot-glow"></div><div class="us-hotspot-ring"></div><div class="us-hotspot-marker">${hotspot.icon}</div><div class="us-hotspot-label">${hotspot.name}<div class="us-hotspot-category">${hotspot.category}</div></div></div>`;
+ });
+
+ return html;
+}
+
+function renderMidEastViewOverlays(projection, width, height, allNews) {
+ let html = '';
+ const MIDEAST_CITIES = [
+ { id: 'riyadh', name: 'Riyadh', lat: 24.7136, lon: 46.6753, type: 'capital', keywords: ['riyadh', 'saudi'] },
+ { id: 'tehran', name: 'Tehran', lat: 35.6892, lon: 51.3890, type: 'capital', keywords: ['tehran', 'iran'] },
+ { id: 'cairo', name: 'Cairo', lat: 30.0444, lon: 31.2357, type: 'capital', keywords: ['cairo', 'egypt'] },
+ { id: 'ankara', name: 'Ankara', lat: 39.9334, lon: 32.8597, type: 'capital', keywords: ['ankara', 'turkey'] },
+ { id: 'baghdad', name: 'Baghdad', lat: 33.3152, lon: 44.3661, type: 'capital', keywords: ['baghdad', 'iraq'] },
+ { id: 'damascus', name: 'Damascus', lat: 33.5138, lon: 36.2765, type: 'capital', keywords: ['damascus', 'syria'] },
+ { id: 'jerusalem', name: 'Jerusalem', lat: 31.7683, lon: 35.2137, type: 'capital', keywords: ['jerusalem'] },
+ { id: 'tel-aviv', name: 'Tel Aviv', lat: 32.0853, lon: 34.7818, type: 'major', keywords: ['tel aviv', 'israel'] },
+ { id: 'dubai', name: 'Dubai', lat: 25.2048, lon: 55.2708, type: 'major', keywords: ['dubai', 'uae'] },
+ { id: 'doha', name: 'Doha', lat: 25.2854, lon: 51.5310, type: 'capital', keywords: ['doha', 'qatar'] },
+ { id: 'sanaa', name: "Sana'a", lat: 15.3694, lon: 44.1910, type: 'capital', keywords: ['sanaa', 'yemen'] }
+ ];
+
+ MIDEAST_CITIES.forEach(city => {
+ const projected = projection([city.lon, city.lat]);
+ if (!projected) return;
+ const posX = (projected[0] / width) * 100;
+ const posY = (projected[1] / height) * 100;
+
+ let matchCount = 0;
+ if (allNews && allNews.length > 0) {
+ matchCount = allNews.filter(item => {
+ const title = (item.title || '').toLowerCase();
+ return city.keywords.some(kw => title.includes(kw.toLowerCase()));
+ }).length;
+ }
+
+ const typeClass = city.type === 'capital' ? 'capital' : city.type === 'major' ? 'major' : '';
+ const activityLevel = matchCount >= 5 ? 'high-activity' : '';
+
+ html += `<div class="us-city ${typeClass} ${activityLevel}" style="left: ${posX}%; top: ${posY}%; color: ${city.type === 'capital' ? '#ffcc00' : '#00ff88'};"><div class="us-city-dot"></div><div class="us-city-label">${city.name}${matchCount > 0 ? `<span class="us-city-count">(${matchCount})</span>` : ''}</div></div>`;
+ });
+
+ MIDEAST_HOTSPOTS.forEach(hotspot => {
+ const projected = projection([hotspot.lon, hotspot.lat]);
+ if (!projected) return;
+ const posX = (projected[0] / width) * 100;
+ const posY = (projected[1] / height) * 100;
+
+ let matchCount = 0;
+ let matchedHeadlines = [];
+ if (allNews && allNews.length > 0) {
+ matchedHeadlines = allNews.filter(item => {
+ const title = (item.title || '').toLowerCase();
+ return hotspot.keywords.some(kw => title.includes(kw.toLowerCase()));
+ });
+ matchCount = matchedHeadlines.length;
+ }
+
+ const hotspotData = encodeURIComponent(JSON.stringify({ ...hotspot, matchCount, headlines: matchedHeadlines.slice(0, 8) }));
+
+ html += `<div class="us-hotspot ${hotspot.level}" style="left: ${posX}%; top: ${posY}%;" data-us-hotspot-id="${hotspot.id}" data-us-hotspot-info="${hotspotData}" onclick="showUSHotspotPopup(event, '${hotspot.id}')"><div class="us-hotspot-glow"></div><div class="us-hotspot-ring"></div><div class="us-hotspot-marker">${hotspot.icon}</div><div class="us-hotspot-label">${hotspot.name}<div class="us-hotspot-category">${hotspot.category}</div></div></div>`;
+ });
+
+ return html;
+}
+
+function renderUkraineViewOverlays(projection, width, height, allNews) {
+ let html = '';
+ const UKRAINE_CITIES = [
+ { id: 'kyiv', name: 'Kyiv', lat: 50.4501, lon: 30.5234, type: 'capital', keywords: ['kyiv', 'kiev'] },
+ { id: 'kharkiv', name: 'Kharkiv', lat: 49.9935, lon: 36.2304, type: 'major', keywords: ['kharkiv', 'kharkov'] },
+ { id: 'odesa', name: 'Odesa', lat: 46.4825, lon: 30.7233, type: 'major', keywords: ['odesa', 'odessa'] },
+ { id: 'donetsk', name: 'Donetsk', lat: 48.0159, lon: 37.8029, type: 'major', keywords: ['donetsk', 'donbas'] },
+ { id: 'moscow', name: 'Moscow', lat: 55.7558, lon: 37.6173, type: 'capital', keywords: ['moscow', 'kremlin', 'putin'] },
+ { id: 'minsk', name: 'Minsk', lat: 53.9045, lon: 27.5615, type: 'capital', keywords: ['minsk', 'belarus'] },
+ { id: 'sevastopol', name: 'Sevastopol', lat: 44.6167, lon: 33.5254, type: 'major', keywords: ['sevastopol', 'crimea'] }
+ ];
+
+ UKRAINE_CITIES.forEach(city => {
+ const projected = projection([city.lon, city.lat]);
+ if (!projected) return;
+ const posX = (projected[0] / width) * 100;
+ const posY = (projected[1] / height) * 100;
+
+ let matchCount = 0;
+ if (allNews && allNews.length > 0) {
+ matchCount = allNews.filter(item => {
+ const title = (item.title || '').toLowerCase();
+ return city.keywords.some(kw => title.includes(kw.toLowerCase()));
+ }).length;
+ }
+
+ const typeClass = city.type === 'capital' ? 'capital' : 'major';
+ const activityLevel = matchCount >= 5 ? 'high-activity' : '';
+ let cityColor = '#00ff88';
+ if (['moscow'].includes(city.id)) cityColor = '#ff6666';
+ else if (['minsk'].includes(city.id)) cityColor = '#ffaa44';
+ else if (['kyiv', 'kharkiv', 'odesa', 'donetsk', 'sevastopol'].includes(city.id)) cityColor = '#44aaff';
+
+ html += `<div class="us-city ${typeClass} ${activityLevel}" style="left: ${posX}%; top: ${posY}%; color: ${city.type === 'capital' ? '#ffcc00' : cityColor};"><div class="us-city-dot"></div><div class="us-city-label">${city.name}${matchCount > 0 ? `<span class="us-city-count">(${matchCount})</span>` : ''}</div></div>`;
+ });
+
+ UKRAINE_HOTSPOTS.forEach(hotspot => {
+ const projected = projection([hotspot.lon, hotspot.lat]);
+ if (!projected) return;
+ const posX = (projected[0] / width) * 100;
+ const posY = (projected[1] / height) * 100;
+
+ let matchCount = 0;
+ let matchedHeadlines = [];
+ if (allNews && allNews.length > 0) {
+ matchedHeadlines = allNews.filter(item => {
+ const title = (item.title || '').toLowerCase();
+ return hotspot.keywords.some(kw => title.includes(kw.toLowerCase()));
+ });
+ matchCount = matchedHeadlines.length;
+ }
+
+ const hotspotData = encodeURIComponent(JSON.stringify({ ...hotspot, matchCount, headlines: matchedHeadlines.slice(0, 8) }));
+
+ html += `<div class="us-hotspot ${hotspot.level}" style="left: ${posX}%; top: ${posY}%;" data-us-hotspot-id="${hotspot.id}" data-us-hotspot-info="${hotspotData}" onclick="showUSHotspotPopup(event, '${hotspot.id}')"><div class="us-hotspot-glow"></div><div class="us-hotspot-ring"></div><div class="us-hotspot-marker">${hotspot.icon}</div><div class="us-hotspot-label">${hotspot.name}<div class="us-hotspot-category">${hotspot.category}</div></div></div>`;
+ });
+
+ return html;
+}
+
+function renderTaiwanViewOverlays(projection, width, height, allNews) {
+ let html = '';
+ const TAIWAN_CITIES = [
+ { id: 'taipei', name: 'Taipei', lat: 25.0330, lon: 121.5654, type: 'capital', keywords: ['taipei', 'taiwan'] },
+ { id: 'beijing', name: 'Beijing', lat: 39.9042, lon: 116.4074, type: 'capital', keywords: ['beijing', 'china', 'xi jinping'] },
+ { id: 'shanghai', name: 'Shanghai', lat: 31.2304, lon: 121.4737, type: 'major', keywords: ['shanghai'] },
+ { id: 'manila', name: 'Manila', lat: 14.5995, lon: 120.9842, type: 'capital', keywords: ['manila', 'philippines'] },
+ { id: 'tokyo', name: 'Tokyo', lat: 35.6762, lon: 139.6503, type: 'capital', keywords: ['tokyo', 'japan'] },
+ { id: 'okinawa', name: 'Okinawa', lat: 26.5013, lon: 127.9454, type: 'major', keywords: ['okinawa', 'kadena'] }
+ ];
+
+ TAIWAN_CITIES.forEach(city => {
+ const projected = projection([city.lon, city.lat]);
+ if (!projected) return;
+ const posX = (projected[0] / width) * 100;
+ const posY = (projected[1] / height) * 100;
+ if (posX < 0 || posX > 100 || posY < 0 || posY > 100) return;
+
+ let matchCount = 0;
+ if (allNews && allNews.length > 0) {
+ matchCount = allNews.filter(item => {
+ const title = (item.title || '').toLowerCase();
+ return city.keywords.some(kw => title.includes(kw.toLowerCase()));
+ }).length;
+ }
+
+ const typeClass = city.type === 'capital' ? 'capital' : 'major';
+ const activityLevel = matchCount >= 5 ? 'high-activity' : '';
+ let cityColor = '#00ff88';
+ if (['beijing', 'shanghai'].includes(city.id)) cityColor = '#ff6666';
+ else if (['taipei'].includes(city.id)) cityColor = '#44aaff';
+ else if (['tokyo', 'okinawa'].includes(city.id)) cityColor = '#6688ff';
+
+ html += `<div class="us-city ${typeClass} ${activityLevel}" style="left: ${posX}%; top: ${posY}%; color: ${city.type === 'capital' ? '#ffcc00' : cityColor};"><div class="us-city-dot"></div><div class="us-city-label">${city.name}${matchCount > 0 ? `<span class="us-city-count">(${matchCount})</span>` : ''}</div></div>`;
+ });
+
+ TAIWAN_HOTSPOTS.forEach(hotspot => {
+ const projected = projection([hotspot.lon, hotspot.lat]);
+ if (!projected) return;
+ const posX = (projected[0] / width) * 100;
+ const posY = (projected[1] / height) * 100;
+ if (posX < 0 || posX > 100 || posY < 0 || posY > 100) return;
+
+ let matchCount = 0;
+ let matchedHeadlines = [];
+ if (allNews && allNews.length > 0) {
+ matchedHeadlines = allNews.filter(item => {
+ const title = (item.title || '').toLowerCase();
+ return hotspot.keywords.some(kw => title.includes(kw.toLowerCase()));
+ });
+ matchCount = matchedHeadlines.length;
+ }
+
+ const hotspotData = encodeURIComponent(JSON.stringify({ ...hotspot, matchCount, headlines: matchedHeadlines.slice(0, 8) }));
+
+ html += `<div class="us-hotspot ${hotspot.level}" style="left: ${posX}%; top: ${posY}%;" data-us-hotspot-id="${hotspot.id}" data-us-hotspot-info="${hotspotData}" onclick="showUSHotspotPopup(event, '${hotspot.id}')"><div class="us-hotspot-glow"></div><div class="us-hotspot-ring"></div><div class="us-hotspot-marker">${hotspot.icon}</div><div class="us-hotspot-label">${hotspot.name}<div class="us-hotspot-category">${hotspot.category}</div></div></div>`;
+ });
+
+ return html;
+}
diff --git a/js/monitors.js b/js/monitors.js
new file mode 100644
index 0000000..9969152
--- /dev/null
+++ b/js/monitors.js
@@ -0,0 +1,270 @@
+// monitors.js - Custom monitor CRUD and keyword scanning
+
+import { MONITOR_COLORS } from './constants.js';
+
+// Load monitors from localStorage
+export function loadMonitors() {
+ try {
+ const data = localStorage.getItem('customMonitors');
+ return data ? JSON.parse(data) : [];
+ } catch (e) {
+ console.error('Failed to load monitors:', e);
+ return [];
+ }
+}
+
+// Save monitors to localStorage
+export function saveMonitors(monitors) {
+ try {
+ localStorage.setItem('customMonitors', JSON.stringify(monitors));
+ } catch (e) {
+ console.error('Failed to save monitors:', e);
+ }
+}
+
+// Render monitors list in settings
+export function renderMonitorsList() {
+ const monitors = loadMonitors();
+ const container = document.getElementById('monitorsList');
+ if (!container) return;
+
+ if (monitors.length === 0) {
+ container.innerHTML = '<div style="font-size: 0.6rem; color: var(--text-dim); padding: 0.5rem 0;">No monitors yet</div>';
+ return;
+ }
+
+ container.innerHTML = monitors.map(m => `
+ <div class="monitor-item">
+ <div class="monitor-item-info">
+ <div class="monitor-item-name">
+ <div class="monitor-item-color" style="background: ${m.color};"></div>
+ ${m.name}
+ </div>
+ <div class="monitor-item-keywords">${m.keywords.join(', ')}</div>
+ ${m.lat && m.lon ? `<div class="monitor-item-location">📍 ${m.lat.toFixed(2)}, ${m.lon.toFixed(2)}</div>` : ''}
+ </div>
+ <div class="monitor-item-actions">
+ <button class="monitor-item-btn" onclick="editMonitor('${m.id}')" title="Edit">✎</button>
+ <button class="monitor-item-btn delete" onclick="deleteMonitor('${m.id}')" title="Delete">✕</button>
+ </div>
+ </div>
+ `).join('');
+}
+
+// Open monitor form (for add or edit)
+export function openMonitorForm(monitorId = null) {
+ const overlay = document.getElementById('monitorFormOverlay');
+ const titleEl = document.getElementById('monitorFormTitle');
+ const editIdEl = document.getElementById('monitorEditId');
+ const nameEl = document.getElementById('monitorName');
+ const keywordsEl = document.getElementById('monitorKeywords');
+ const latEl = document.getElementById('monitorLat');
+ const lonEl = document.getElementById('monitorLon');
+ const colorsContainer = document.getElementById('monitorColors');
+
+ // Render color options
+ colorsContainer.innerHTML = MONITOR_COLORS.map((c, i) =>
+ `<div class="monitor-color-option" style="background: ${c};" data-color="${c}" onclick="selectMonitorColor('${c}')"></div>`
+ ).join('');
+
+ if (monitorId) {
+ // Edit mode
+ const monitors = loadMonitors();
+ const monitor = monitors.find(m => m.id === monitorId);
+ if (monitor) {
+ titleEl.textContent = 'Edit Monitor';
+ editIdEl.value = monitorId;
+ nameEl.value = monitor.name;
+ keywordsEl.value = monitor.keywords.join(', ');
+ latEl.value = monitor.lat || '';
+ lonEl.value = monitor.lon || '';
+ selectMonitorColor(monitor.color);
+ }
+ } else {
+ // Add mode
+ titleEl.textContent = 'Add Monitor';
+ editIdEl.value = '';
+ nameEl.value = '';
+ keywordsEl.value = '';
+ latEl.value = '';
+ lonEl.value = '';
+ selectMonitorColor(MONITOR_COLORS[0]);
+ }
+
+ overlay.classList.add('open');
+}
+
+// Close monitor form
+export function closeMonitorForm() {
+ document.getElementById('monitorFormOverlay').classList.remove('open');
+}
+
+// Select a monitor color
+export function selectMonitorColor(color) {
+ document.querySelectorAll('.monitor-color-option').forEach(el => {
+ el.classList.toggle('selected', el.dataset.color === color);
+ });
+}
+
+// Get currently selected color
+export function getSelectedMonitorColor() {
+ const selected = document.querySelector('.monitor-color-option.selected');
+ return selected ? selected.dataset.color : MONITOR_COLORS[0];
+}
+
+// Save monitor (add or update)
+export function saveMonitor(refreshCallback) {
+ const editId = document.getElementById('monitorEditId').value;
+ const name = document.getElementById('monitorName').value.trim();
+ const keywordsRaw = document.getElementById('monitorKeywords').value.trim();
+ const lat = parseFloat(document.getElementById('monitorLat').value);
+ const lon = parseFloat(document.getElementById('monitorLon').value);
+ const color = getSelectedMonitorColor();
+
+ if (!name) {
+ alert('Please enter a name');
+ return;
+ }
+ if (!keywordsRaw) {
+ alert('Please enter at least one keyword');
+ return;
+ }
+
+ const keywords = keywordsRaw.split(',').map(k => k.trim().toLowerCase()).filter(k => k);
+
+ const monitor = {
+ id: editId || `monitor_${Date.now()}`,
+ name,
+ keywords,
+ color,
+ lat: isNaN(lat) ? null : lat,
+ lon: isNaN(lon) ? null : lon,
+ createdAt: editId ? undefined : new Date().toISOString()
+ };
+
+ const monitors = loadMonitors();
+ if (editId) {
+ const idx = monitors.findIndex(m => m.id === editId);
+ if (idx !== -1) {
+ monitor.createdAt = monitors[idx].createdAt;
+ monitors[idx] = monitor;
+ }
+ } else {
+ monitors.push(monitor);
+ }
+
+ saveMonitors(monitors);
+ closeMonitorForm();
+ renderMonitorsList();
+ if (refreshCallback) {
+ refreshCallback();
+ }
+}
+
+// Edit a monitor
+export function editMonitor(id) {
+ openMonitorForm(id);
+}
+
+// Delete a monitor
+export function deleteMonitor(id, refreshCallback) {
+ if (!confirm('Delete this monitor?')) return;
+ const monitors = loadMonitors().filter(m => m.id !== id);
+ saveMonitors(monitors);
+ renderMonitorsList();
+ if (refreshCallback) {
+ refreshCallback();
+ }
+}
+
+// Scan news for monitor matches
+export function scanMonitorsForMatches(allNews) {
+ const monitors = loadMonitors();
+ const results = {};
+
+ monitors.forEach(monitor => {
+ const matches = [];
+ allNews.forEach(item => {
+ const title = (item.title || '').toLowerCase();
+ const matched = monitor.keywords.some(kw => title.includes(kw));
+ if (matched) {
+ matches.push({
+ title: item.title,
+ link: item.link,
+ source: item.source,
+ monitorId: monitor.id,
+ monitorName: monitor.name,
+ monitorColor: monitor.color
+ });
+ }
+ });
+ results[monitor.id] = {
+ monitor,
+ matches: matches.slice(0, 10),
+ count: matches.length
+ };
+ });
+
+ return results;
+}
+
+// Render the My Monitors panel
+export function renderMonitorsPanel(allNews) {
+ const panel = document.getElementById('monitorsPanel');
+ const countEl = document.getElementById('monitorsCount');
+ if (!panel) return;
+
+ const monitors = loadMonitors();
+ if (monitors.length === 0) {
+ panel.innerHTML = `
+ <div class="monitors-empty">
+ No monitors configured
+ <div class="monitors-empty-hint">Click Settings → Add Monitor to get started</div>
+ </div>
+ `;
+ countEl.textContent = '-';
+ return;
+ }
+
+ const results = scanMonitorsForMatches(allNews);
+ let allMatches = [];
+
+ Object.values(results).forEach(r => {
+ allMatches = allMatches.concat(r.matches);
+ });
+
+ if (allMatches.length === 0) {
+ panel.innerHTML = `
+ <div class="monitors-empty">
+ No matches found
+ <div class="monitors-empty-hint">Your ${monitors.length} monitor(s) found no matching headlines</div>
+ </div>
+ `;
+ countEl.textContent = '0';
+ return;
+ }
+
+ countEl.textContent = allMatches.length;
+ panel.innerHTML = allMatches.slice(0, 20).map(match => `
+ <div class="monitor-match">
+ <div class="monitor-match-header">
+ <div class="monitor-match-dot" style="background: ${match.monitorColor};"></div>
+ <span class="monitor-match-name">${match.monitorName}</span>
+ </div>
+ <a href="${match.link}" target="_blank" class="monitor-match-title">${match.title}</a>
+ <div class="monitor-match-source">${match.source || 'News'}</div>
+ </div>
+ `).join('');
+}
+
+// Get monitor data for map hotspots
+export function getMonitorHotspots(allNews) {
+ const monitors = loadMonitors().filter(m => m.lat && m.lon);
+ const results = scanMonitorsForMatches(allNews);
+
+ return monitors.map(m => ({
+ ...m,
+ matchCount: results[m.id]?.count || 0,
+ matches: results[m.id]?.matches || []
+ }));
+}
diff --git a/js/panels.js b/js/panels.js
new file mode 100644
index 0000000..7210b84
--- /dev/null
+++ b/js/panels.js
@@ -0,0 +1,374 @@
+// panels.js - Panel management, settings, drag/drop, resize
+
+import { PANELS, NON_DRAGGABLE_PANELS } from './constants.js';
+
+// Drag state
+let draggedPanel = null;
+
+// Resize state
+let resizingPanel = null;
+let resizeStart = { x: 0, y: 0, width: 0, height: 0 };
+let resizeDirection = null;
+
+// Load panel visibility from localStorage
+export function getPanelSettings() {
+ try {
+ const saved = localStorage.getItem('situationMonitorPanels');
+ return saved ? JSON.parse(saved) : {};
+ } catch (e) {
+ return {};
+ }
+}
+
+// Save panel visibility to localStorage
+export function savePanelSettings(settings) {
+ try {
+ localStorage.setItem('situationMonitorPanels', JSON.stringify(settings));
+ } catch (e) {}
+}
+
+// Check if panel is enabled
+export function isPanelEnabled(panelId) {
+ const settings = getPanelSettings();
+ return settings[panelId] !== false; // Default to enabled
+}
+
+// Toggle panel visibility
+export function togglePanel(panelId, refreshCallback) {
+ const settings = getPanelSettings();
+ settings[panelId] = !isPanelEnabled(panelId);
+ savePanelSettings(settings);
+ applyPanelSettings();
+ updateSettingsUI();
+ if (refreshCallback) {
+ refreshCallback();
+ }
+}
+
+// Apply panel settings to DOM
+export function applyPanelSettings() {
+ document.querySelectorAll('[data-panel]').forEach(panel => {
+ const panelId = panel.dataset.panel;
+ if (isPanelEnabled(panelId)) {
+ panel.classList.remove('hidden');
+ } else {
+ panel.classList.add('hidden');
+ }
+ });
+}
+
+// Toggle settings modal
+export function toggleSettings(renderMonitorsList) {
+ const modal = document.getElementById('settingsModal');
+ modal.classList.toggle('open');
+ if (modal.classList.contains('open')) {
+ updateSettingsUI();
+ if (renderMonitorsList) {
+ renderMonitorsList();
+ }
+ // Load saved livestream URL
+ const savedUrl = localStorage.getItem('livestreamUrl') || 'https://www.youtube.com/watch?v=jWEZa9WEnIo';
+ const urlInput = document.getElementById('livestreamUrl');
+ if (urlInput) {
+ urlInput.value = savedUrl;
+ }
+ }
+}
+
+// Update settings UI
+export function updateSettingsUI() {
+ const container = document.getElementById('panelToggles');
+ if (!container) return;
+
+ container.innerHTML = Object.entries(PANELS).map(([id, config]) => {
+ const enabled = isPanelEnabled(id);
+ return `
+ <div class="panel-toggle-item">
+ <label onclick="togglePanel('${id}')">${config.name}</label>
+ <div class="toggle-switch ${enabled ? 'on' : ''}" onclick="togglePanel('${id}')"></div>
+ </div>
+ `;
+ }).join('');
+}
+
+// Extract YouTube video ID from various URL formats
+export function extractYouTubeId(url) {
+ if (!url) return null;
+ const patterns = [
+ /(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/|youtube\.com\/live\/)([^&\?\/]+)/,
+ /^([a-zA-Z0-9_-]{11})$/
+ ];
+ for (const pattern of patterns) {
+ const match = url.match(pattern);
+ if (match) return match[1];
+ }
+ return null;
+}
+
+// Save livestream URL
+export function saveLivestreamUrl() {
+ const input = document.getElementById('livestreamUrl');
+ const url = input.value.trim();
+ localStorage.setItem('livestreamUrl', url);
+ updateLivestreamEmbed();
+}
+
+// Update the livestream embed
+export function updateLivestreamEmbed() {
+ const url = localStorage.getItem('livestreamUrl') || 'https://www.youtube.com/watch?v=jWEZa9WEnIo';
+ const videoId = extractYouTubeId(url);
+ const panel = document.getElementById('tbpnPanel');
+ if (panel && videoId) {
+ panel.innerHTML = `
+ <iframe
+ src="https://www.youtube.com/embed/${videoId}?autoplay=0&mute=1"
+ frameborder="0"
+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
+ allowfullscreen>
+ </iframe>
+ `;
+ } else if (panel) {
+ panel.innerHTML = '<div class="loading-msg">Invalid YouTube URL</div>';
+ }
+}
+
+// Get current livestream embed URL
+export function getLivestreamEmbedUrl() {
+ const url = localStorage.getItem('livestreamUrl') || 'https://www.youtube.com/watch?v=jWEZa9WEnIo';
+ const videoId = extractYouTubeId(url);
+ return videoId ? `https://www.youtube.com/embed/${videoId}?autoplay=0&mute=1` : '';
+}
+
+// Initialize drag and drop
+export function initDragAndDrop() {
+ const dashboard = document.querySelector('.dashboard');
+ if (!dashboard) return;
+
+ const panels = dashboard.querySelectorAll('.panel');
+
+ panels.forEach(panel => {
+ const panelId = panel.dataset.panel;
+ const isDraggable = !NON_DRAGGABLE_PANELS.includes(panelId);
+
+ panel.setAttribute('draggable', isDraggable ? 'true' : 'false');
+
+ if (!isDraggable) {
+ panel.style.cursor = 'default';
+ const header = panel.querySelector('.panel-header');
+ if (header) header.style.cursor = 'default';
+ return;
+ }
+
+ panel.addEventListener('dragstart', (e) => {
+ draggedPanel = panel;
+ panel.classList.add('dragging');
+ e.dataTransfer.effectAllowed = 'move';
+ e.dataTransfer.setData('text/plain', panel.dataset.panel);
+ });
+
+ panel.addEventListener('dragend', () => {
+ panel.classList.remove('dragging');
+ document.querySelectorAll('.panel.drag-over').forEach(p => p.classList.remove('drag-over'));
+ draggedPanel = null;
+ savePanelOrder();
+ });
+
+ panel.addEventListener('dragover', (e) => {
+ e.preventDefault();
+ e.dataTransfer.dropEffect = 'move';
+ if (draggedPanel && draggedPanel !== panel) {
+ panel.classList.add('drag-over');
+ }
+ });
+
+ panel.addEventListener('dragleave', () => {
+ panel.classList.remove('drag-over');
+ });
+
+ panel.addEventListener('drop', (e) => {
+ e.preventDefault();
+ panel.classList.remove('drag-over');
+
+ if (draggedPanel && draggedPanel !== panel) {
+ const dashboard = document.querySelector('.dashboard');
+ const panels = [...dashboard.querySelectorAll('.panel')];
+ const draggedIdx = panels.indexOf(draggedPanel);
+ const targetIdx = panels.indexOf(panel);
+
+ if (draggedIdx < targetIdx) {
+ panel.parentNode.insertBefore(draggedPanel, panel.nextSibling);
+ } else {
+ panel.parentNode.insertBefore(draggedPanel, panel);
+ }
+ }
+ });
+ });
+}
+
+// Save panel order to localStorage
+export function savePanelOrder() {
+ const dashboard = document.querySelector('.dashboard');
+ if (!dashboard) return;
+
+ const panels = dashboard.querySelectorAll('.panel');
+ const order = [...panels].map(p => p.dataset.panel);
+ localStorage.setItem('panelOrder', JSON.stringify(order));
+}
+
+// Restore panel order from localStorage
+export function restorePanelOrder() {
+ const savedOrder = localStorage.getItem('panelOrder');
+ if (!savedOrder) return;
+
+ try {
+ const order = JSON.parse(savedOrder);
+ const dashboard = document.querySelector('.dashboard');
+ if (!dashboard) return;
+
+ const panels = [...dashboard.querySelectorAll('.panel')];
+
+ order.forEach(panelId => {
+ if (NON_DRAGGABLE_PANELS.includes(panelId)) return;
+ const panel = panels.find(p => p.dataset.panel === panelId);
+ if (panel) {
+ dashboard.appendChild(panel);
+ }
+ });
+ } catch (e) {
+ console.error('Error restoring panel order:', e);
+ }
+}
+
+// Reset panel order
+export function resetPanelOrder() {
+ localStorage.removeItem('panelOrder');
+ location.reload();
+}
+
+// Initialize panel resize
+export function initPanelResize() {
+ document.querySelectorAll('.panel').forEach(panel => {
+ if (panel.querySelector('.panel-resize-handle')) return;
+
+ // Corner handle
+ const cornerHandle = document.createElement('div');
+ cornerHandle.className = 'panel-resize-handle corner';
+ cornerHandle.addEventListener('mousedown', (e) => startResize(e, panel, 'corner'));
+ panel.appendChild(cornerHandle);
+
+ // Bottom edge handle
+ const bottomHandle = document.createElement('div');
+ bottomHandle.className = 'panel-resize-handle bottom';
+ bottomHandle.addEventListener('mousedown', (e) => startResize(e, panel, 'bottom'));
+ panel.appendChild(bottomHandle);
+
+ // Right edge handle
+ const rightHandle = document.createElement('div');
+ rightHandle.className = 'panel-resize-handle right';
+ rightHandle.addEventListener('mousedown', (e) => startResize(e, panel, 'right'));
+ panel.appendChild(rightHandle);
+ });
+
+ // Global mouse events for resize
+ document.addEventListener('mousemove', handleResizeMove);
+ document.addEventListener('mouseup', handleResizeEnd);
+}
+
+function startResize(e, panel, direction) {
+ e.preventDefault();
+ e.stopPropagation();
+
+ resizingPanel = panel;
+ resizeDirection = direction;
+ resizeStart = {
+ x: e.clientX,
+ y: e.clientY,
+ width: panel.offsetWidth,
+ height: panel.offsetHeight
+ };
+
+ panel.classList.add('resizing');
+ document.body.style.cursor = direction === 'corner' ? 'nwse-resize' :
+ direction === 'bottom' ? 'ns-resize' : 'ew-resize';
+}
+
+function handleResizeMove(e) {
+ if (!resizingPanel) return;
+
+ const deltaX = e.clientX - resizeStart.x;
+ const deltaY = e.clientY - resizeStart.y;
+
+ if (resizeDirection === 'corner' || resizeDirection === 'right') {
+ const newWidth = Math.max(200, resizeStart.width + deltaX);
+ resizingPanel.style.width = newWidth + 'px';
+ resizingPanel.style.minWidth = newWidth + 'px';
+ resizingPanel.style.maxWidth = newWidth + 'px';
+ }
+
+ if (resizeDirection === 'corner' || resizeDirection === 'bottom') {
+ const newHeight = Math.max(150, resizeStart.height + deltaY);
+ resizingPanel.style.minHeight = newHeight + 'px';
+ resizingPanel.style.maxHeight = newHeight + 'px';
+ }
+}
+
+function handleResizeEnd() {
+ if (resizingPanel) {
+ resizingPanel.classList.remove('resizing');
+ savePanelSizes();
+ resizingPanel = null;
+ resizeDirection = null;
+ document.body.style.cursor = '';
+ }
+}
+
+// Save panel sizes to localStorage
+export function savePanelSizes() {
+ const sizes = {};
+ document.querySelectorAll('.panel').forEach(panel => {
+ const panelName = panel.getAttribute('data-panel');
+ if (panelName && (panel.style.minHeight || panel.style.width)) {
+ sizes[panelName] = {
+ height: panel.style.minHeight,
+ width: panel.style.width
+ };
+ }
+ });
+ localStorage.setItem('panelSizes', JSON.stringify(sizes));
+}
+
+// Restore panel sizes from localStorage
+export function restorePanelSizes() {
+ const saved = localStorage.getItem('panelSizes');
+ if (!saved) return;
+
+ try {
+ const sizes = JSON.parse(saved);
+ Object.entries(sizes).forEach(([panelName, dims]) => {
+ const panel = document.querySelector(`.panel[data-panel="${panelName}"]`);
+ if (panel) {
+ if (dims.height) {
+ panel.style.minHeight = dims.height;
+ panel.style.maxHeight = dims.height;
+ }
+ if (dims.width) {
+ panel.style.width = dims.width;
+ panel.style.minWidth = dims.width;
+ panel.style.maxWidth = dims.width;
+ }
+ }
+ });
+ } catch (e) {
+ console.error('Failed to restore panel sizes:', e);
+ }
+}
+
+// Initialize all panel functionality
+export function initPanels(renderMonitorsList) {
+ applyPanelSettings();
+ restorePanelOrder();
+ restorePanelSizes();
+ updateLivestreamEmbed();
+ initDragAndDrop();
+ initPanelResize();
+}
diff --git a/js/popups.js b/js/popups.js
new file mode 100644
index 0000000..83283b7
--- /dev/null
+++ b/js/popups.js
@@ -0,0 +1,590 @@
+// popups.js - All popup show/hide functions
+
+import { escapeHtml, getTimeAgo } from './utils.js';
+
+// Helper function to position popup within map bounds
+function positionPopup(popup, targetEl, popupWidth, popupHeight) {
+ const mapContainer = document.getElementById('worldMapContainer');
+ if (!mapContainer) return;
+
+ const mapRect = mapContainer.getBoundingClientRect();
+ const targetRect = targetEl.getBoundingClientRect();
+
+ let left = targetRect.left - mapRect.left + 20;
+ let top = targetRect.top - mapRect.top - 10;
+
+ if (left + popupWidth > mapRect.width) {
+ left = targetRect.left - mapRect.left - popupWidth - 20;
+ }
+ if (top + popupHeight > mapRect.height) {
+ top = mapRect.height - popupHeight - 10;
+ }
+ if (top < 10) top = 10;
+ if (left < 10) left = 10;
+
+ popup.style.left = left + 'px';
+ popup.style.top = top + 'px';
+}
+
+// Hide hotspot popup
+export function hideHotspotPopup() {
+ const popup = document.getElementById('hotspotPopup');
+ if (popup) popup.classList.remove('visible');
+}
+
+// Hide conflict popup
+export function hideConflictPopup() {
+ const popup = document.getElementById('conflictPopup');
+ if (popup) popup.classList.remove('visible');
+}
+
+// Hide US city popup
+export function hideUSCityPopup() {
+ const popup = document.getElementById('usCityPopup');
+ if (popup) popup.classList.remove('visible');
+}
+
+// Hide US hotspot popup
+export function hideUSHotspotPopup() {
+ const popup = document.getElementById('usHotspotPopup');
+ if (popup) popup.classList.remove('visible');
+}
+
+// Hide chokepoint popup
+export function hideChokepointPopup() {
+ const popup = document.getElementById('chokepointPopup');
+ if (popup) popup.classList.remove('visible');
+}
+
+// Hide earthquake popup
+export function hideQuakePopup() {
+ const popup = document.getElementById('quakePopup');
+ if (popup) popup.classList.remove('visible');
+}
+
+// Hide cyber popup
+export function hideCyberPopup() {
+ const popup = document.getElementById('cyberPopup');
+ if (popup) popup.classList.remove('visible');
+}
+
+// Hide custom hotspot popup
+export function hideCustomHotspotPopup() {
+ const popup = document.getElementById('customHotspotPopup');
+ if (popup) popup.classList.remove('visible');
+}
+
+// Hide aircraft popup
+export function hideAircraftPopup() {
+ const popup = document.getElementById('aircraftPopup');
+ if (popup) popup.classList.remove('visible');
+}
+
+// Hide all popups
+export function hideAllPopups() {
+ hideHotspotPopup();
+ hideChokepointPopup();
+ hideQuakePopup();
+ hideCyberPopup();
+ hideCustomHotspotPopup();
+ hideConflictPopup();
+ hideUSCityPopup();
+ hideUSHotspotPopup();
+ hideAircraftPopup();
+}
+
+// Show hotspot popup
+export function showHotspotPopup(event, hotspotId) {
+ event.stopPropagation();
+
+ const hotspotEl = document.querySelector(`[data-hotspot-id="${hotspotId}"]`);
+ if (!hotspotEl) return;
+
+ hideChokepointPopup();
+ hideQuakePopup();
+ hideCyberPopup();
+ hideCustomHotspotPopup();
+ hideUSCityPopup();
+ hideUSHotspotPopup();
+
+ const activityData = JSON.parse(decodeURIComponent(hotspotEl.dataset.hotspotActivity));
+ const popup = document.getElementById('hotspotPopup');
+
+ let headlinesHTML = '';
+ if (activityData.headlines && activityData.headlines.length > 0) {
+ headlinesHTML = activityData.headlines.map(h => `
+ <div class="hotspot-popup-headline">
+ <div class="hotspot-popup-source">${escapeHtml(h.source || 'News')}</div>
+ <a href="${h.link || '#'}" target="_blank">${escapeHtml(h.title)}</a>
+ </div>
+ `).join('');
+ } else {
+ headlinesHTML = '<div class="hotspot-popup-empty">No recent headlines for this location</div>';
+ }
+
+ let agenciesHTML = '';
+ if (activityData.agencies && activityData.agencies.length > 0) {
+ agenciesHTML = `
+ <div class="hotspot-popup-agencies">
+ <div class="hotspot-popup-agencies-title">Key Entities</div>
+ ${activityData.agencies.map(a => `<span class="hotspot-popup-agency">${escapeHtml(a)}</span>`).join('')}
+ </div>
+ `;
+ }
+
+ popup.innerHTML = `
+ <button class="hotspot-popup-close" onclick="hideHotspotPopup()">&times;</button>
+ <div class="hotspot-popup-header">
+ <span class="hotspot-popup-title">${escapeHtml(activityData.name)}</span>
+ <span class="hotspot-popup-level ${activityData.level}">${activityData.level.toUpperCase()}</span>
+ </div>
+ <div class="hotspot-popup-subtext">${escapeHtml(activityData.subtext)}</div>
+ ${activityData.description ? `<div class="hotspot-popup-desc">${escapeHtml(activityData.description)}</div>` : ''}
+ <div class="hotspot-popup-meta">
+ <div class="hotspot-popup-meta-item">
+ <span class="hotspot-popup-meta-label">Coordinates</span>
+ <span class="hotspot-popup-meta-value">${activityData.lat.toFixed(2)}°${activityData.lat >= 0 ? 'N' : 'S'}, ${Math.abs(activityData.lon).toFixed(2)}°${activityData.lon >= 0 ? 'E' : 'W'}</span>
+ </div>
+ ${activityData.status ? `
+ <div class="hotspot-popup-meta-item">
+ <span class="hotspot-popup-meta-label">Status</span>
+ <span class="hotspot-popup-meta-value">${escapeHtml(activityData.status)}</span>
+ </div>
+ ` : ''}
+ </div>
+ ${agenciesHTML}
+ ${headlinesHTML.includes('hotspot-popup-headline') ? '<div class="hotspot-popup-headlines-title">Related Headlines</div>' : ''}
+ <div class="hotspot-popup-headlines">
+ ${headlinesHTML}
+ </div>
+ `;
+
+ popup.className = `hotspot-popup visible ${activityData.level}`;
+ positionPopup(popup, hotspotEl, 320, 400);
+}
+
+// Show conflict popup
+export function showConflictPopup(event, conflictId) {
+ event.stopPropagation();
+
+ const conflictEl = document.querySelector(`[data-conflict-id="${conflictId}"]`);
+ if (!conflictEl) return;
+
+ hideAllPopups();
+
+ const conflictData = JSON.parse(decodeURIComponent(conflictEl.dataset.conflictInfo));
+ const popup = document.getElementById('conflictPopup');
+
+ let matchedHeadlines = [];
+ if (window.cachedAllNews && conflictData.keywords) {
+ matchedHeadlines = window.cachedAllNews.filter(item => {
+ const title = (item.title || '').toLowerCase();
+ return conflictData.keywords.some(kw => title.includes(kw.toLowerCase()));
+ }).slice(0, 5);
+ }
+
+ let headlinesHTML = '';
+ if (matchedHeadlines.length > 0) {
+ headlinesHTML = `
+ <div class="conflict-popup-headlines-title">Related Headlines</div>
+ <div class="conflict-popup-headlines">
+ ${matchedHeadlines.map(h => `
+ <div class="conflict-popup-headline">
+ <div class="conflict-popup-headline-source">${escapeHtml(h.source || 'News')}</div>
+ <a href="${h.link || '#'}" target="_blank">${escapeHtml(h.title)}</a>
+ </div>
+ `).join('')}
+ </div>
+ `;
+ }
+
+ popup.innerHTML = `
+ <button class="conflict-popup-close" onclick="hideConflictPopup()">&times;</button>
+ <div class="conflict-popup-header">
+ <span class="conflict-popup-title">${escapeHtml(conflictData.name)}</span>
+ <span class="conflict-popup-intensity ${conflictData.intensity}">${conflictData.intensity.toUpperCase()}</span>
+ </div>
+ <div class="conflict-popup-meta">
+ <div class="conflict-popup-meta-item">
+ <span class="conflict-popup-meta-label">Start Date</span>
+ <span class="conflict-popup-meta-value">${escapeHtml(conflictData.startDate)}</span>
+ </div>
+ <div class="conflict-popup-meta-item">
+ <span class="conflict-popup-meta-label">Casualties</span>
+ <span class="conflict-popup-meta-value">${escapeHtml(conflictData.casualties)}</span>
+ </div>
+ <div class="conflict-popup-meta-item">
+ <span class="conflict-popup-meta-label">Displaced</span>
+ <span class="conflict-popup-meta-value">${escapeHtml(conflictData.displaced)}</span>
+ </div>
+ </div>
+ <div class="conflict-popup-desc">${escapeHtml(conflictData.description)}</div>
+ <div class="conflict-popup-parties">
+ <div class="conflict-popup-parties-title">Belligerents</div>
+ ${conflictData.parties.map(p => `<span class="conflict-popup-party">${escapeHtml(p)}</span>`).join('')}
+ </div>
+ <div class="conflict-popup-events">
+ <div class="conflict-popup-events-title">Key Developments</div>
+ ${conflictData.keyEvents.map(e => `<div class="conflict-popup-event">${escapeHtml(e)}</div>`).join('')}
+ </div>
+ ${headlinesHTML}
+ `;
+
+ popup.classList.add('visible');
+ positionPopup(popup, conflictEl, 380, 450);
+}
+
+// Show US city popup
+export function showUSCityPopup(event, cityId) {
+ event.stopPropagation();
+
+ const cityEl = document.querySelector(`[data-city-id="${cityId}"]`);
+ if (!cityEl) return;
+
+ hideAllPopups();
+
+ const cityData = JSON.parse(decodeURIComponent(cityEl.dataset.cityInfo));
+ const popup = document.getElementById('usCityPopup');
+
+ let headlinesHTML = '';
+ if (cityData.headlines && cityData.headlines.length > 0) {
+ headlinesHTML = cityData.headlines.map(h => `
+ <div class="us-city-popup-headline">
+ <div class="us-city-popup-headline-source">${escapeHtml(h.source || 'News')}</div>
+ <a href="${h.link || '#'}" target="_blank">${escapeHtml(h.title)}</a>
+ </div>
+ `).join('');
+ } else {
+ headlinesHTML = '<div style="padding: 1rem; color: #336688; font-size: 0.6rem; text-align: center;">No recent headlines for this city</div>';
+ }
+
+ const sectorsHTML = cityData.sectors ? cityData.sectors.map(s =>
+ `<span style="display: inline-block; font-size: 0.5rem; padding: 0.1rem 0.3rem; margin: 0.1rem; background: rgba(0, 170, 255, 0.1); border: 1px solid rgba(0, 170, 255, 0.2); color: #66aacc;">${escapeHtml(s)}</span>`
+ ).join('') : '';
+
+ popup.innerHTML = `
+ <button class="us-city-popup-close" onclick="hideUSCityPopup()">&times;</button>
+ <div class="us-city-popup-header">
+ <span class="us-city-popup-title">${escapeHtml(cityData.name)}</span>
+ <span class="us-city-popup-state">${escapeHtml(cityData.state)}</span>
+ </div>
+ <div class="us-city-popup-meta">
+ <div>
+ <span class="us-city-popup-meta-label">Population</span>
+ <span class="us-city-popup-meta-value">${escapeHtml(cityData.population)}</span>
+ </div>
+ <div>
+ <span class="us-city-popup-meta-label">News Matches</span>
+ <span class="us-city-popup-meta-value">${cityData.matchCount || 0}</span>
+ </div>
+ </div>
+ <div class="us-city-popup-desc">${escapeHtml(cityData.description)}</div>
+ ${sectorsHTML ? `<div style="padding: 0.5rem 1rem; border-bottom: 1px solid rgba(0, 100, 170, 0.2);"><div style="font-size: 0.45rem; color: #336688; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.3rem;">Key Sectors</div>${sectorsHTML}</div>` : ''}
+ <div class="us-city-popup-headlines-title">Related Headlines</div>
+ <div class="us-city-popup-headlines">
+ ${headlinesHTML}
+ </div>
+ `;
+
+ popup.classList.add('visible');
+ positionPopup(popup, cityEl, 360, 420);
+}
+
+// Show US hotspot popup
+export function showUSHotspotPopup(event, hotspotId) {
+ event.stopPropagation();
+
+ const hotspotEl = document.querySelector(`[data-us-hotspot-id="${hotspotId}"]`);
+ if (!hotspotEl) return;
+
+ hideAllPopups();
+
+ const hotspotData = JSON.parse(decodeURIComponent(hotspotEl.dataset.usHotspotInfo));
+ const popup = document.getElementById('usHotspotPopup');
+
+ let headlinesHTML = '';
+ if (hotspotData.headlines && hotspotData.headlines.length > 0) {
+ headlinesHTML = hotspotData.headlines.map(h => `
+ <div class="us-hotspot-popup-headline">
+ <div class="us-hotspot-popup-headline-source">${escapeHtml(h.source || 'News')}</div>
+ <a href="${h.link || '#'}" target="_blank">${escapeHtml(h.title)}</a>
+ </div>
+ `).join('');
+ } else {
+ headlinesHTML = '<div class="us-hotspot-popup-headline" style="color: #666;">No matching headlines found</div>';
+ }
+
+ popup.className = `us-hotspot-popup ${hotspotData.level}`;
+ popup.innerHTML = `
+ <button class="us-hotspot-popup-close" onclick="hideUSHotspotPopup()">&times;</button>
+ <div class="us-hotspot-popup-header">
+ <span class="us-hotspot-popup-title">${hotspotData.icon} ${escapeHtml(hotspotData.name)}</span>
+ <span class="us-hotspot-popup-level ${hotspotData.level}">${hotspotData.level.toUpperCase()}</span>
+ </div>
+ <div class="us-hotspot-popup-meta">
+ <div>
+ <span class="us-hotspot-popup-meta-label">Location</span>
+ <span class="us-hotspot-popup-meta-value">${escapeHtml(hotspotData.location)}</span>
+ </div>
+ <div>
+ <span class="us-hotspot-popup-meta-label">Category</span>
+ <span class="us-hotspot-popup-meta-value">${escapeHtml(hotspotData.category)}</span>
+ </div>
+ <div>
+ <span class="us-hotspot-popup-meta-label">Since</span>
+ <span class="us-hotspot-popup-meta-value">${escapeHtml(hotspotData.startDate)}</span>
+ </div>
+ <div>
+ <span class="us-hotspot-popup-meta-label">Status</span>
+ <span class="us-hotspot-popup-meta-value">${escapeHtml(hotspotData.status)}</span>
+ </div>
+ </div>
+ <div class="us-hotspot-popup-desc">${escapeHtml(hotspotData.description)}</div>
+ <div class="us-hotspot-popup-headlines-title">Related Headlines (${hotspotData.matchCount || 0})</div>
+ <div class="us-hotspot-popup-headlines">
+ ${headlinesHTML}
+ </div>
+ `;
+
+ popup.classList.add('visible');
+ positionPopup(popup, hotspotEl, 320, 400);
+}
+
+// Show chokepoint popup
+export function showChokepointPopup(event, chokepointId) {
+ event.stopPropagation();
+
+ const cpEl = document.querySelector(`[data-chokepoint-id="${chokepointId}"]`);
+ if (!cpEl) return;
+
+ hideAllPopups();
+
+ const cpData = JSON.parse(decodeURIComponent(cpEl.dataset.chokepointInfo));
+ const popup = document.getElementById('chokepointPopup');
+
+ let headlinesHTML = '';
+ if (cpData.headlines && cpData.headlines.length > 0) {
+ headlinesHTML = cpData.headlines.map(h => `
+ <div class="chokepoint-popup-headline">
+ <a href="${h.link || '#'}" target="_blank">${escapeHtml(h.title)}</a>
+ </div>
+ `).join('');
+ } else {
+ headlinesHTML = '<div class="chokepoint-popup-empty">No recent headlines for this chokepoint</div>';
+ }
+
+ popup.innerHTML = `
+ <button class="chokepoint-popup-close" onclick="hideChokepointPopup()">&times;</button>
+ <div class="chokepoint-popup-header">
+ <span class="chokepoint-popup-title">${escapeHtml(cpData.name)}</span>
+ <span class="chokepoint-popup-status ${cpData.isAlert ? 'alert' : 'normal'}">${cpData.isAlert ? 'ALERT' : 'NORMAL'}</span>
+ </div>
+ <div class="chokepoint-popup-info">
+ <div class="chokepoint-popup-stat">
+ <span class="chokepoint-popup-stat-label">Region</span>
+ <span class="chokepoint-popup-stat-value">${escapeHtml(cpData.region)}</span>
+ </div>
+ <div class="chokepoint-popup-stat">
+ <span class="chokepoint-popup-stat-label">Traffic</span>
+ <span class="chokepoint-popup-stat-value">${escapeHtml(cpData.traffic)}</span>
+ </div>
+ </div>
+ <div class="chokepoint-popup-desc">${escapeHtml(cpData.desc)}</div>
+ <div class="chokepoint-popup-headlines">
+ ${headlinesHTML}
+ </div>
+ `;
+
+ popup.className = `chokepoint-popup visible ${cpData.isAlert ? 'alert' : ''}`;
+ positionPopup(popup, cpEl, 280, 300);
+}
+
+// Show earthquake popup
+export function showQuakePopup(event, quakeId) {
+ event.stopPropagation();
+
+ const quakeEl = document.querySelector(`[data-quake-id="${quakeId}"]`);
+ if (!quakeEl) return;
+
+ hideAllPopups();
+
+ const eqData = JSON.parse(decodeURIComponent(quakeEl.dataset.quakeInfo));
+ const popup = document.getElementById('quakePopup');
+
+ const isMajor = eqData.mag >= 6.0;
+ const isModerate = eqData.mag >= 5.0;
+
+ let severity = 'minor';
+ let severityLabel = 'Minor';
+ if (isMajor) {
+ severity = 'major';
+ severityLabel = 'Major';
+ } else if (isModerate) {
+ severity = 'moderate';
+ severityLabel = 'Moderate';
+ }
+
+ const time = new Date(eqData.time);
+ const timeAgoStr = getTimeAgo(time);
+ const usgsLink = `https://earthquake.usgs.gov/earthquakes/eventpage/${eqData.id || ''}`;
+
+ popup.innerHTML = `
+ <button class="quake-popup-close" onclick="hideQuakePopup()">&times;</button>
+ <div class="quake-popup-header">
+ <span class="quake-popup-mag">M${eqData.mag.toFixed(1)}</span>
+ <span class="quake-popup-severity ${severity}">${severityLabel}</span>
+ </div>
+ <div class="quake-popup-location">${escapeHtml(eqData.place)}</div>
+ <div class="quake-popup-info">
+ <div class="quake-popup-stat">
+ <span class="quake-popup-stat-label">Depth</span>
+ <span class="quake-popup-stat-value">${eqData.depth.toFixed(1)} km</span>
+ </div>
+ <div class="quake-popup-stat">
+ <span class="quake-popup-stat-label">Coordinates</span>
+ <span class="quake-popup-stat-value">${eqData.lat.toFixed(2)}°, ${eqData.lon.toFixed(2)}°</span>
+ </div>
+ <div class="quake-popup-stat">
+ <span class="quake-popup-stat-label">Time</span>
+ <span class="quake-popup-stat-value">${timeAgoStr}</span>
+ </div>
+ </div>
+ <a href="${usgsLink}" target="_blank" class="quake-popup-link">View on USGS →</a>
+ `;
+
+ popup.className = `quake-popup visible ${isMajor ? 'major' : ''}`;
+ positionPopup(popup, quakeEl, 260, 220);
+}
+
+// Show cyber threat popup
+export function showCyberPopup(event, cyberId) {
+ event.stopPropagation();
+
+ const cyberEl = document.querySelector(`[data-cyber-id="${cyberId}"]`);
+ if (!cyberEl) return;
+
+ hideAllPopups();
+
+ const czData = JSON.parse(decodeURIComponent(cyberEl.dataset.cyberInfo));
+ const popup = document.getElementById('cyberPopup');
+
+ const targetsHTML = czData.targets.map(t =>
+ `<span class="cyber-popup-target-tag">${escapeHtml(t)}</span>`
+ ).join('');
+
+ popup.innerHTML = `
+ <button class="cyber-popup-close" onclick="hideCyberPopup()">&times;</button>
+ <div class="cyber-popup-header">
+ <span class="cyber-popup-title">${escapeHtml(czData.fullName)}</span>
+ <span class="cyber-popup-status ${czData.isActive ? 'active' : 'dormant'}">${czData.isActive ? 'Active' : 'Dormant'}</span>
+ </div>
+ <div class="cyber-popup-apt">${escapeHtml(czData.group)} — ${escapeHtml(czData.aka)}</div>
+ <div class="cyber-popup-desc">${escapeHtml(czData.desc)}</div>
+ <div class="cyber-popup-info">
+ <div class="cyber-popup-stat">
+ <span class="cyber-popup-stat-label">State Sponsor</span>
+ <span class="cyber-popup-stat-value">${escapeHtml(czData.sponsor)}</span>
+ </div>
+ <div class="cyber-popup-stat">
+ <span class="cyber-popup-stat-label">Coordinates</span>
+ <span class="cyber-popup-stat-value">${czData.lat.toFixed(1)}°, ${czData.lon.toFixed(1)}°</span>
+ </div>
+ </div>
+ <div class="cyber-popup-targets">
+ <div class="cyber-popup-targets-label">Primary Targets</div>
+ <div class="cyber-popup-target-tags">${targetsHTML}</div>
+ </div>
+ `;
+
+ popup.className = `cyber-popup visible ${czData.isActive ? 'active' : ''}`;
+ positionPopup(popup, cyberEl, 280, 300);
+}
+
+// Show custom hotspot popup
+export function showCustomHotspotPopup(event, monitorId) {
+ event.stopPropagation();
+
+ const hotspotEl = document.querySelector(`[data-monitor-id="${monitorId}"]`);
+ if (!hotspotEl) return;
+
+ hideAllPopups();
+
+ const monitorData = JSON.parse(decodeURIComponent(hotspotEl.dataset.monitorInfo));
+ const popup = document.getElementById('customHotspotPopup');
+
+ let headlinesHTML = '';
+ if (monitorData.matches && monitorData.matches.length > 0) {
+ headlinesHTML = monitorData.matches.map(h => `
+ <div class="custom-hotspot-popup-headline">
+ <div class="custom-hotspot-popup-headline-source">${escapeHtml(h.source || 'News')}</div>
+ <a href="${h.link || '#'}" target="_blank">${escapeHtml(h.title)}</a>
+ </div>
+ `).join('');
+ } else {
+ headlinesHTML = '<div style="padding: 1rem; color: #888; font-size: 0.6rem; text-align: center;">No matching headlines</div>';
+ }
+
+ popup.style.borderColor = monitorData.color || '#00ff88';
+ popup.innerHTML = `
+ <button class="custom-hotspot-popup-close" onclick="hideCustomHotspotPopup()">&times;</button>
+ <div class="custom-hotspot-popup-header" style="border-bottom-color: ${monitorData.color || '#00ff88'};">
+ <span class="custom-hotspot-popup-title" style="color: ${monitorData.color || '#00ff88'};">${escapeHtml(monitorData.name)}</span>
+ <span class="custom-hotspot-popup-count">${monitorData.matchCount || 0} matches</span>
+ </div>
+ <div class="custom-hotspot-popup-keywords">
+ ${monitorData.keywords.map(k => `<span class="custom-hotspot-popup-keyword">${escapeHtml(k)}</span>`).join('')}
+ </div>
+ <div class="custom-hotspot-popup-headlines">
+ ${headlinesHTML}
+ </div>
+ `;
+
+ popup.classList.add('visible');
+ positionPopup(popup, hotspotEl, 300, 350);
+}
+
+// Show aircraft popup
+export function showAircraftPopup(event, flightData) {
+ event.stopPropagation();
+
+ hideAllPopups();
+
+ const popup = document.getElementById('aircraftPopup');
+ if (!popup) return;
+
+ popup.innerHTML = `
+ <button class="aircraft-popup-close" onclick="hideAircraftPopup()">&times;</button>
+ <div class="aircraft-popup-header">
+ <span class="aircraft-popup-callsign">${escapeHtml(flightData.callsign || 'Unknown')}</span>
+ <span class="aircraft-popup-country">${escapeHtml(flightData.country || '')}</span>
+ </div>
+ <div class="aircraft-popup-info">
+ <div class="aircraft-popup-stat">
+ <span class="aircraft-popup-stat-label">Altitude</span>
+ <span class="aircraft-popup-stat-value">${flightData.altitude ? Math.round(flightData.altitude * 3.281) + ' ft' : 'N/A'}</span>
+ </div>
+ <div class="aircraft-popup-stat">
+ <span class="aircraft-popup-stat-label">Speed</span>
+ <span class="aircraft-popup-stat-value">${flightData.velocity ? Math.round(flightData.velocity * 1.944) + ' kts' : 'N/A'}</span>
+ </div>
+ <div class="aircraft-popup-stat">
+ <span class="aircraft-popup-stat-label">Heading</span>
+ <span class="aircraft-popup-stat-value">${flightData.heading ? Math.round(flightData.heading) + '°' : 'N/A'}</span>
+ </div>
+ <div class="aircraft-popup-stat">
+ <span class="aircraft-popup-stat-label">ICAO</span>
+ <span class="aircraft-popup-stat-value">${escapeHtml(flightData.icao24 || 'Unknown')}</span>
+ </div>
+ </div>
+ `;
+
+ popup.classList.add('visible');
+
+ // Position at cursor
+ const mapContainer = document.getElementById('worldMapContainer');
+ if (mapContainer) {
+ const mapRect = mapContainer.getBoundingClientRect();
+ popup.style.left = (event.clientX - mapRect.left + 10) + 'px';
+ popup.style.top = (event.clientY - mapRect.top + 10) + 'px';
+ }
+}
diff --git a/js/renderers.js b/js/renderers.js
new file mode 100644
index 0000000..eb12cb6
--- /dev/null
+++ b/js/renderers.js
@@ -0,0 +1,450 @@
+// renderers.js - All panel render functions
+
+import { timeAgo, getRelativeTime, escapeHtml } from './utils.js';
+import { isPanelEnabled } from './panels.js';
+
+// Render news items
+export function renderNews(items, panelId, countId) {
+ const panel = document.getElementById(panelId);
+ const count = document.getElementById(countId);
+
+ if (items.length === 0) {
+ panel.innerHTML = '<div class="error-msg">Failed to load</div>';
+ count.textContent = '0';
+ return;
+ }
+
+ panel.innerHTML = items.map(item => `
+ <div class="item ${item.isAlert ? 'alert' : ''}">
+ <div class="item-source">${item.source}${item.isAlert ? '<span class="alert-tag">ALERT</span>' : ''}</div>
+ <a class="item-title" href="${item.link}" target="_blank">${item.title}</a>
+ <div class="item-time">${timeAgo(item.pubDate)}</div>
+ </div>
+ `).join('');
+
+ count.textContent = items.length;
+}
+
+// Render markets
+export function renderMarkets(markets) {
+ const panel = document.getElementById('marketsPanel');
+ const count = document.getElementById('marketsCount');
+
+ if (markets.length === 0) {
+ panel.innerHTML = '<div class="error-msg">Failed to load</div>';
+ count.textContent = '0';
+ return;
+ }
+
+ panel.innerHTML = markets.map(m => {
+ const changeClass = m.change > 0 ? 'up' : m.change < 0 ? 'down' : '';
+ const changeText = m.change !== null ? `${m.change > 0 ? '+' : ''}${m.change.toFixed(2)}%` : '-';
+ const priceDisplay = typeof m.price === 'number' && m.price > 100
+ ? m.price.toLocaleString('en-US', { maximumFractionDigits: 0 })
+ : m.price?.toFixed(2);
+
+ return `
+ <div class="market-item">
+ <div>
+ <div class="market-name">${m.name}</div>
+ <div class="market-symbol">${m.symbol}</div>
+ </div>
+ <div class="market-data">
+ <div class="market-price">$${priceDisplay}</div>
+ <div class="market-change ${changeClass}">${changeText}</div>
+ </div>
+ </div>
+ `;
+ }).join('');
+
+ count.textContent = markets.length;
+}
+
+// Render sector heatmap
+export function renderHeatmap(sectors) {
+ const panel = document.getElementById('heatmapPanel');
+
+ if (sectors.length === 0) {
+ panel.innerHTML = '<div class="error-msg">Failed to load</div>';
+ return;
+ }
+
+ panel.innerHTML = '<div class="heatmap">' + sectors.map(s => {
+ let colorClass = 'up-0';
+ const c = s.change;
+ if (c >= 2) colorClass = 'up-3';
+ else if (c >= 1) colorClass = 'up-2';
+ else if (c >= 0.5) colorClass = 'up-1';
+ else if (c >= 0) colorClass = 'up-0';
+ else if (c >= -0.5) colorClass = 'down-0';
+ else if (c >= -1) colorClass = 'down-1';
+ else if (c >= -2) colorClass = 'down-2';
+ else colorClass = 'down-3';
+
+ return `
+ <div class="heatmap-cell ${colorClass}">
+ <div class="sector-name">${s.name}</div>
+ <div class="sector-change">${s.change >= 0 ? '+' : ''}${s.change.toFixed(2)}%</div>
+ </div>
+ `;
+ }).join('') + '</div>';
+}
+
+// Render commodities
+export function renderCommodities(commodities) {
+ const panel = document.getElementById('commoditiesPanel');
+
+ if (commodities.length === 0) {
+ panel.innerHTML = '<div class="error-msg">Failed to load</div>';
+ return;
+ }
+
+ panel.innerHTML = commodities.map(m => {
+ const changeClass = m.change > 0 ? 'up' : m.change < 0 ? 'down' : '';
+ const changeText = `${m.change > 0 ? '+' : ''}${m.change.toFixed(2)}%`;
+ const priceDisplay = m.price?.toFixed(2);
+
+ return `
+ <div class="market-item">
+ <div>
+ <div class="market-name">${m.name}</div>
+ <div class="market-symbol">${m.symbol}</div>
+ </div>
+ <div class="market-data">
+ <div class="market-price">${m.symbol === 'VIX' ? '' : '$'}${priceDisplay}</div>
+ <div class="market-change ${changeClass}">${changeText}</div>
+ </div>
+ </div>
+ `;
+ }).join('');
+}
+
+// Render Polymarket predictions
+export function renderPolymarket(markets) {
+ const panel = document.getElementById('polymarketPanel');
+ const count = document.getElementById('polymarketCount');
+
+ if (markets.length === 0) {
+ panel.innerHTML = '<div class="error-msg">Failed to load predictions</div>';
+ count.textContent = '0';
+ return;
+ }
+
+ const formatVolume = (v) => {
+ if (v >= 1000000) return '$' + (v / 1000000).toFixed(1) + 'M';
+ if (v >= 1000) return '$' + (v / 1000).toFixed(0) + 'K';
+ return '$' + v.toFixed(0);
+ };
+
+ panel.innerHTML = markets.map(m => `
+ <div class="prediction-item">
+ <div>
+ <div class="prediction-question">${m.question}</div>
+ <div class="prediction-volume">Vol: ${formatVolume(m.volume)}</div>
+ </div>
+ <div class="prediction-odds">
+ <span class="prediction-yes">${m.yes}%</span>
+ </div>
+ </div>
+ `).join('');
+
+ count.textContent = markets.length;
+}
+
+// Render congressional trades
+export function renderCongressTrades(trades) {
+ const panel = document.getElementById('congressPanel');
+ const count = document.getElementById('congressCount');
+
+ if (trades.length === 0) {
+ panel.innerHTML = '<div class="error-msg">Unable to load congressional trades</div>';
+ count.textContent = '0';
+ return;
+ }
+
+ panel.innerHTML = trades.map(t => `
+ <div class="congress-item">
+ <div class="congress-info">
+ <div>
+ <span class="congress-name">${t.name}</span>
+ <span class="congress-party ${t.party}">${t.party}</span>
+ </div>
+ <div class="congress-ticker">${t.ticker}</div>
+ <div class="congress-meta">${timeAgo(t.date)} · ${t.district}</div>
+ </div>
+ <div class="congress-type">
+ <span class="congress-action ${t.type}">${t.type.toUpperCase()}</span>
+ <div class="congress-amount">${t.amount}</div>
+ </div>
+ </div>
+ `).join('');
+
+ count.textContent = trades.length;
+}
+
+// Render whale watch
+export function renderWhaleWatch(whales) {
+ const panel = document.getElementById('whalePanel');
+ const count = document.getElementById('whaleCount');
+
+ if (whales.length === 0) {
+ panel.innerHTML = '<div class="error-msg">No whale transactions detected</div>';
+ count.textContent = '0';
+ return;
+ }
+
+ const formatAmount = (amt) => amt >= 1000 ? (amt / 1000).toFixed(1) + 'K' : amt.toFixed(2);
+ const formatUSD = (usd) => {
+ if (usd >= 1000000000) return '$' + (usd / 1000000000).toFixed(1) + 'B';
+ if (usd >= 1000000) return '$' + (usd / 1000000).toFixed(1) + 'M';
+ return '$' + (usd / 1000).toFixed(0) + 'K';
+ };
+
+ panel.innerHTML = whales.map(w => `
+ <div class="whale-item">
+ <div class="whale-header">
+ <span class="whale-coin">${w.coin}</span>
+ <span class="whale-amount">${formatAmount(w.amount)} ${w.coin}</span>
+ </div>
+ <div class="whale-flow">
+ <span class="whale-usd">${formatUSD(w.usd)}</span>
+ <span class="arrow">→</span>
+ <span>${w.hash}</span>
+ </div>
+ </div>
+ `).join('');
+
+ count.textContent = whales.length;
+}
+
+// Render main character
+export function renderMainCharacter(rankings) {
+ const panel = document.getElementById('mainCharPanel');
+
+ if (rankings.length === 0) {
+ panel.innerHTML = '<div class="error-msg">No main character detected</div>';
+ return;
+ }
+
+ const [topName, topCount] = rankings[0];
+
+ panel.innerHTML = `
+ <div class="main-char-display">
+ <div class="main-char-label">Today's Main Character</div>
+ <div class="main-char-name">${topName}</div>
+ <div class="main-char-count">${topCount} mentions in headlines</div>
+
+ <div class="main-char-list">
+ ${rankings.slice(1, 8).map((r, i) => `
+ <div class="char-row">
+ <span class="rank">${i + 2}.</span>
+ <span class="name">${r[0]}</span>
+ <span class="mentions">${r[1]}</span>
+ </div>
+ `).join('')}
+ </div>
+ </div>
+ `;
+}
+
+// Render government contracts
+export function renderGovContracts(contracts) {
+ const panel = document.getElementById('contractsPanel');
+ const count = document.getElementById('contractsCount');
+
+ if (contracts.length === 0) {
+ panel.innerHTML = '<div class="error-msg">Unable to load contracts</div>';
+ count.textContent = '0';
+ return;
+ }
+
+ const formatValue = (v) => {
+ if (v >= 1000000000) return '$' + (v / 1000000000).toFixed(1) + 'B';
+ if (v >= 1000000) return '$' + (v / 1000000).toFixed(1) + 'M';
+ if (v >= 1000) return '$' + (v / 1000).toFixed(0) + 'K';
+ return '$' + v.toFixed(0);
+ };
+
+ panel.innerHTML = contracts.map(c => `
+ <div class="contract-item">
+ <div class="contract-agency">${c.agency}</div>
+ <div class="contract-desc">${c.description.substring(0, 100)}${c.description.length > 100 ? '...' : ''}</div>
+ <div class="contract-meta">
+ <span class="contract-vendor">${c.vendor}</span>
+ <span class="contract-value">${formatValue(c.amount)}</span>
+ </div>
+ </div>
+ `).join('');
+
+ count.textContent = contracts.length;
+}
+
+// Render AI news
+export function renderAINews(items) {
+ const panel = document.getElementById('aiPanel');
+ const count = document.getElementById('aiCount');
+
+ if (items.length === 0) {
+ panel.innerHTML = '<div class="error-msg">Unable to load AI news</div>';
+ count.textContent = '0';
+ return;
+ }
+
+ panel.innerHTML = items.map(item => `
+ <div class="ai-item">
+ <div class="ai-source">${item.source}</div>
+ <a class="ai-title item-title" href="${item.link}" target="_blank">${item.title}</a>
+ <div class="ai-date">${timeAgo(item.date)}</div>
+ </div>
+ `).join('');
+
+ count.textContent = items.length;
+}
+
+// Render money printer (Fed balance)
+export function renderMoneyPrinter(data) {
+ const panel = document.getElementById('printerPanel');
+
+ const isExpanding = data.change > 0;
+ const status = isExpanding ? 'PRINTER ON' : 'PRINTER OFF';
+
+ panel.innerHTML = `
+ <div class="printer-gauge">
+ <div class="printer-label">Federal Reserve Balance Sheet</div>
+ <div class="printer-value">
+ ${data.value.toFixed(2)}<span class="printer-unit">T USD</span>
+ </div>
+ <div class="printer-change ${isExpanding ? 'up' : 'down'}">
+ ${data.change >= 0 ? '+' : ''}${(data.change * 1000).toFixed(0)}B (${data.changePercent >= 0 ? '+' : ''}${data.changePercent.toFixed(2)}%) WoW
+ </div>
+ <div class="printer-bar">
+ <div class="printer-fill" style="width: ${Math.min(data.percentOfMax, 100)}%"></div>
+ </div>
+ <div class="printer-status">
+ <span class="printer-indicator ${isExpanding ? 'on' : 'off'}"></span>
+ ${status}
+ </div>
+ </div>
+ `;
+}
+
+// Render Intel Feed panel
+export function renderIntelFeed(items) {
+ const panel = document.getElementById('intelPanel');
+ const count = document.getElementById('intelCount');
+
+ if (!items || items.length === 0) {
+ panel.innerHTML = '<div class="loading-msg">No intel available</div>';
+ count.textContent = '-';
+ return;
+ }
+
+ count.textContent = items.length;
+
+ panel.innerHTML = items.map(item => {
+ let tagsHTML = '';
+
+ if (item.sourceType === 'osint') {
+ tagsHTML += '<span class="intel-tag osint">OSINT</span>';
+ } else if (item.sourceType === 'govt') {
+ tagsHTML += '<span class="intel-tag govt">GOVT</span>';
+ }
+
+ item.regions.slice(0, 2).forEach(r => {
+ tagsHTML += `<span class="intel-tag region">${r}</span>`;
+ });
+
+ item.topics.slice(0, 2).forEach(t => {
+ tagsHTML += `<span class="intel-tag topic">${t}</span>`;
+ });
+
+ const timeAgoStr = item.pubDate ? getRelativeTime(new Date(item.pubDate)) : '';
+
+ return `
+ <div class="intel-item ${item.isPriority ? 'priority' : ''}">
+ <div class="intel-header">
+ <span class="intel-source">${item.source}</span>
+ <div class="intel-tags">${tagsHTML}</div>
+ </div>
+ <a href="${item.link}" target="_blank" class="intel-title">${item.title}</a>
+ <div class="intel-meta">
+ <span>${timeAgoStr}</span>
+ </div>
+ </div>
+ `;
+ }).join('');
+}
+
+// Render Layoffs panel
+export function renderLayoffs(layoffs) {
+ const panel = document.getElementById('layoffsPanel');
+ const count = document.getElementById('layoffsCount');
+
+ if (!layoffs || layoffs.length === 0) {
+ panel.innerHTML = '<div class="loading-msg">No recent layoffs data</div>';
+ count.textContent = '-';
+ return;
+ }
+
+ count.textContent = layoffs.length;
+
+ panel.innerHTML = layoffs.map(l => `
+ <div class="layoff-item">
+ <div class="layoff-company">${l.company}</div>
+ ${l.count ? `<div class="layoff-count">${parseInt(l.count).toLocaleString()} jobs</div>` : ''}
+ <div class="layoff-meta">
+ <span class="headline">${l.title}</span>
+ <span class="time">${timeAgo(l.date)}</span>
+ </div>
+ </div>
+ `).join('');
+}
+
+// Render Situation panel (Venezuela or Greenland)
+export function renderSituation(panelId, statusId, news, config) {
+ const panel = document.getElementById(panelId);
+ const status = document.getElementById(statusId);
+
+ if (!panel) return;
+
+ let threatLevel = 'monitoring';
+ let threatText = 'MONITORING';
+
+ if (news.length > 0) {
+ const recentNews = news.filter(n => {
+ const date = new Date(n.pubDate);
+ const hoursSince = (Date.now() - date.getTime()) / (1000 * 60 * 60);
+ return hoursSince < 24;
+ });
+
+ const criticalKeywords = config.criticalKeywords || [];
+ const hasCritical = news.some(n =>
+ criticalKeywords.some(k => n.title.toLowerCase().includes(k))
+ );
+
+ if (hasCritical || recentNews.length >= 3) {
+ threatLevel = 'critical';
+ threatText = 'CRITICAL';
+ } else if (recentNews.length >= 1) {
+ threatLevel = 'elevated';
+ threatText = 'ELEVATED';
+ }
+ }
+
+ status.innerHTML = `<span class="situation-status ${threatLevel}">${threatText}</span>`;
+
+ const newsHTML = news.length > 0 ? news.map(n => `
+ <div class="situation-item">
+ <a href="${n.link}" target="_blank" class="headline">${n.title}</a>
+ <div class="meta">${n.source} · ${timeAgo(n.pubDate)}</div>
+ </div>
+ `).join('') : '<div class="loading-msg">No recent news</div>';
+
+ panel.innerHTML = `
+ <div class="situation-header">
+ <div class="situation-title">${config.title}</div>
+ <div class="situation-subtitle">${config.subtitle}</div>
+ </div>
+ ${newsHTML}
+ `;
+}
diff --git a/js/utils.js b/js/utils.js
new file mode 100644
index 0000000..c181ecd
--- /dev/null
+++ b/js/utils.js
@@ -0,0 +1,71 @@
+// utils.js - Utility functions with no dependencies
+
+// Format relative time from a date
+export function getTimeAgo(date) {
+ const seconds = Math.floor((new Date() - new Date(date)) / 1000);
+ if (seconds < 60) return 'just now';
+ if (seconds < 3600) return Math.floor(seconds / 60) + 'm ago';
+ if (seconds < 86400) return Math.floor(seconds / 3600) + 'h ago';
+ if (seconds < 604800) return Math.floor(seconds / 86400) + 'd ago';
+ return new Date(date).toLocaleDateString();
+}
+
+// Alternative time formatter
+export function timeAgo(dateString) {
+ const date = new Date(dateString);
+ const now = new Date();
+ const seconds = Math.floor((now - date) / 1000);
+
+ if (seconds < 60) return 'just now';
+ if (seconds < 3600) return Math.floor(seconds / 60) + 'm';
+ if (seconds < 86400) return Math.floor(seconds / 3600) + 'h';
+ return Math.floor(seconds / 86400) + 'd';
+}
+
+// Another time format variant
+export function getRelativeTime(date) {
+ const now = new Date();
+ const diff = now - new Date(date);
+ const hours = Math.floor(diff / (1000 * 60 * 60));
+ const days = Math.floor(hours / 24);
+
+ if (hours < 1) return 'Just now';
+ if (hours < 24) return `${hours}h ago`;
+ if (days < 7) return `${days}d ago`;
+ return new Date(date).toLocaleDateString();
+}
+
+// Get date from days ago
+export function getDateDaysAgo(days) {
+ const date = new Date();
+ date.setDate(date.getDate() - days);
+ return date.toISOString().split('T')[0];
+}
+
+// Get today's date formatted
+export function getToday() {
+ return new Date().toISOString().split('T')[0];
+}
+
+// Escape HTML for safe display
+export function escapeHtml(text) {
+ const div = document.createElement('div');
+ div.textContent = text;
+ return div.innerHTML;
+}
+
+// Update status display
+export function setStatus(text, loading = false) {
+ const statusEl = document.getElementById('status');
+ if (statusEl) {
+ statusEl.textContent = text;
+ statusEl.classList.toggle('loading', loading);
+ }
+}
+
+// Convert lat/lon to map position (simple equirectangular projection)
+export function latLonToXY(lat, lon, width, height) {
+ const x = ((lon + 180) / 360) * width;
+ const y = ((90 - lat) / 180) * height;
+ return { x, y };
+}
diff --git a/styles.css b/styles.css
new file mode 100644
index 0000000..ce08e06
--- /dev/null
+++ b/styles.css
@@ -0,0 +1,4828 @@
+ * {
+ margin: 0;
+ padding: 0;
+ box-sizing: border-box;
+ }
+
+ :root {
+ --bg: #0a0a0a;
+ --surface: #141414;
+ --border: #2a2a2a;
+ --text: #e8e8e8;
+ --text-dim: #888;
+ --accent: #fff;
+ --red: #ff4444;
+ --green: #44ff88;
+ --yellow: #ffaa00;
+ }
+
+ body {
+ font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
+ background: var(--bg);
+ color: var(--text);
+ font-size: 12px;
+ line-height: 1.5;
+ }
+
+ .header {
+ position: sticky;
+ top: 0;
+ background: var(--bg);
+ border-bottom: 1px solid var(--border);
+ padding: 0.75rem 1.5rem;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ z-index: 100;
+ }
+
+ .header-left {
+ display: flex;
+ align-items: center;
+ gap: 2rem;
+ }
+
+ .title {
+ font-size: 0.8rem;
+ font-weight: bold;
+ letter-spacing: 0.1em;
+ text-transform: uppercase;
+ }
+
+ .status {
+ font-size: 0.7rem;
+ color: var(--text-dim);
+ }
+
+ .status.loading {
+ color: var(--accent);
+ }
+
+ .header-right {
+ display: flex;
+ align-items: center;
+ gap: 0.75rem;
+ }
+
+ .refresh-btn, .settings-btn {
+ background: var(--accent);
+ color: var(--bg);
+ border: none;
+ padding: 0.4rem 1.2rem;
+ font-family: inherit;
+ font-size: 0.7rem;
+ font-weight: bold;
+ letter-spacing: 0.05em;
+ text-transform: uppercase;
+ cursor: pointer;
+ transition: opacity 0.2s;
+ }
+
+ .settings-btn {
+ background: var(--surface);
+ color: var(--text);
+ border: 1px solid var(--border);
+ }
+
+ .monitors-btn {
+ background: linear-gradient(135deg, #00ff88 0%, #00cc6a 100%);
+ color: var(--bg);
+ border: none;
+ font-weight: bold;
+ position: relative;
+ overflow: hidden;
+ }
+
+ .monitors-btn::before {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: -100%;
+ width: 100%;
+ height: 100%;
+ background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
+ animation: monitors-shine 3s ease-in-out infinite;
+ }
+
+ @keyframes monitors-shine {
+ 0%, 100% { left: -100%; }
+ 50% { left: 100%; }
+ }
+
+ .refresh-btn:hover, .settings-btn:hover, .monitors-btn:hover {
+ opacity: 0.8;
+ }
+
+ .refresh-btn:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+
+ /* Settings Modal */
+ .settings-modal {
+ display: none;
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: rgba(0,0,0,0.8);
+ z-index: 1000;
+ justify-content: center;
+ align-items: center;
+ }
+
+ .settings-modal.open {
+ display: flex;
+ }
+
+ .settings-content {
+ background: var(--bg);
+ border: 1px solid var(--border);
+ padding: 1.5rem;
+ max-width: 400px;
+ width: 90%;
+ max-height: 80vh;
+ overflow-y: auto;
+ }
+
+ .settings-title {
+ font-size: 0.8rem;
+ font-weight: bold;
+ letter-spacing: 0.1em;
+ text-transform: uppercase;
+ margin-bottom: 1rem;
+ padding-bottom: 0.75rem;
+ border-bottom: 1px solid var(--border);
+ }
+
+ .settings-section {
+ margin-bottom: 1rem;
+ }
+
+ .settings-section-title {
+ font-size: 0.65rem;
+ color: var(--text-dim);
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ margin-bottom: 0.5rem;
+ }
+
+ .panel-toggle-item {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 0.5rem 0;
+ border-bottom: 1px solid var(--border);
+ }
+
+ .panel-toggle-item label {
+ font-size: 0.75rem;
+ cursor: pointer;
+ }
+
+ .toggle-switch {
+ position: relative;
+ width: 36px;
+ height: 20px;
+ background: var(--surface);
+ border-radius: 10px;
+ cursor: pointer;
+ transition: background 0.2s;
+ }
+
+ .toggle-switch.on {
+ background: var(--green);
+ }
+
+ .toggle-switch::after {
+ content: '';
+ position: absolute;
+ top: 2px;
+ left: 2px;
+ width: 16px;
+ height: 16px;
+ background: var(--text);
+ border-radius: 50%;
+ transition: transform 0.2s;
+ }
+
+ .toggle-switch.on::after {
+ transform: translateX(16px);
+ }
+
+ .settings-input {
+ width: 100%;
+ padding: 0.5rem;
+ background: var(--surface);
+ border: 1px solid var(--border);
+ color: var(--text);
+ font-family: inherit;
+ font-size: 0.7rem;
+ margin-bottom: 0.25rem;
+ }
+
+ .settings-input:focus {
+ outline: none;
+ border-color: var(--accent);
+ }
+
+ .settings-hint {
+ font-size: 0.6rem;
+ color: var(--text-dim);
+ }
+
+ .settings-reset {
+ width: 100%;
+ padding: 0.5rem;
+ background: transparent;
+ border: 1px solid var(--border);
+ color: var(--text-dim);
+ font-family: inherit;
+ font-size: 0.65rem;
+ cursor: pointer;
+ transition: all 0.2s;
+ }
+
+ .settings-reset:hover {
+ border-color: var(--red);
+ color: var(--red);
+ }
+
+ .settings-close {
+ margin-top: 1rem;
+ width: 100%;
+ padding: 0.6rem;
+ background: var(--accent);
+ color: var(--bg);
+ border: none;
+ font-family: inherit;
+ font-size: 0.7rem;
+ font-weight: bold;
+ letter-spacing: 0.05em;
+ text-transform: uppercase;
+ cursor: pointer;
+ }
+
+ .dashboard {
+ display: grid;
+ grid-template-columns: repeat(4, 1fr);
+ grid-template-rows: auto auto;
+ gap: 1px;
+ background: var(--border);
+ }
+
+ .panel {
+ background: var(--bg);
+ display: flex;
+ flex-direction: column;
+ min-height: 300px;
+ transition: min-height 0.2s, opacity 0.2s, transform 0.15s;
+ }
+
+ .panel.hidden {
+ min-height: 0;
+ display: none;
+ }
+
+ .panel.wide {
+ grid-column: span 2;
+ }
+
+ .panel.dragging {
+ opacity: 0.5;
+ transform: scale(0.98);
+ }
+
+ .panel.drag-over {
+ outline: 2px dashed var(--accent);
+ outline-offset: -2px;
+ }
+
+ /* Resizable panels */
+ .panel {
+ position: relative;
+ resize: none;
+ }
+
+ .panel-resize-handle {
+ position: absolute;
+ background: transparent;
+ z-index: 10;
+ }
+
+ .panel-resize-handle.corner {
+ width: 16px;
+ height: 16px;
+ bottom: 0;
+ right: 0;
+ cursor: nwse-resize;
+ }
+
+ .panel-resize-handle.corner::before {
+ content: '';
+ position: absolute;
+ bottom: 3px;
+ right: 3px;
+ width: 8px;
+ height: 8px;
+ border-right: 2px solid var(--border);
+ border-bottom: 2px solid var(--border);
+ opacity: 0.5;
+ transition: all 0.2s ease;
+ }
+
+ .panel:hover .panel-resize-handle.corner::before {
+ opacity: 1;
+ border-color: var(--text-dim);
+ }
+
+ .panel-resize-handle.corner:hover::before {
+ border-color: var(--accent);
+ width: 10px;
+ height: 10px;
+ }
+
+ .panel-resize-handle.bottom {
+ height: 6px;
+ left: 0;
+ right: 16px;
+ bottom: 0;
+ cursor: ns-resize;
+ }
+
+ .panel-resize-handle.right {
+ width: 6px;
+ top: 0;
+ bottom: 16px;
+ right: 0;
+ cursor: ew-resize;
+ }
+
+ .panel.resizing {
+ user-select: none;
+ transition: none;
+ }
+
+ .panel.resizing * {
+ pointer-events: none;
+ }
+
+ .panel-header {
+ padding: 0.75rem 1rem;
+ border-bottom: 1px solid var(--border);
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ cursor: grab;
+ user-select: none;
+ }
+
+ .panel-header:active {
+ cursor: grabbing;
+ }
+
+ .panel-header:hover {
+ background: var(--surface);
+ }
+
+ .drag-handle {
+ color: var(--text-dim);
+ margin-right: 0.5rem;
+ font-size: 0.7rem;
+ opacity: 0.5;
+ }
+
+ .panel-header:hover .drag-handle {
+ opacity: 1;
+ }
+
+ .panel-header-left {
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+ }
+
+ .panel-toggle {
+ font-size: 0.6rem;
+ color: var(--text-dim);
+ transition: transform 0.2s;
+ }
+
+ .panel.collapsed .panel-toggle {
+ transform: rotate(-90deg);
+ }
+
+ .panel-title {
+ font-size: 0.65rem;
+ font-weight: bold;
+ letter-spacing: 0.1em;
+ text-transform: uppercase;
+ color: var(--text-dim);
+ }
+
+ .panel-count {
+ font-size: 0.65rem;
+ color: var(--text-dim);
+ }
+
+ .panel-content {
+ flex: 1;
+ overflow-y: auto;
+ max-height: 380px;
+ transition: max-height 0.2s;
+ }
+
+ .panel.collapsed .panel-content {
+ max-height: 0;
+ overflow: hidden;
+ }
+
+ .panel.collapsed {
+ min-height: auto;
+ }
+
+ .item {
+ padding: 0.6rem 1rem;
+ border-bottom: 1px solid var(--border);
+ cursor: pointer;
+ transition: background 0.2s;
+ }
+
+ .item:hover {
+ background: var(--surface);
+ }
+
+ .item.alert {
+ border-left: 2px solid var(--yellow);
+ }
+
+ .item-source {
+ font-size: 0.55rem;
+ color: var(--text-dim);
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ margin-bottom: 0.15rem;
+ }
+
+ .item-title {
+ font-size: 0.75rem;
+ font-weight: normal;
+ color: var(--text);
+ text-decoration: none;
+ display: block;
+ }
+
+ .item-title:hover {
+ color: var(--accent);
+ }
+
+ .item-time {
+ font-size: 0.55rem;
+ color: var(--text-dim);
+ margin-top: 0.3rem;
+ }
+
+ .alert-tag {
+ font-size: 0.5rem;
+ background: var(--yellow);
+ color: var(--bg);
+ padding: 0.1rem 0.3rem;
+ margin-left: 0.5rem;
+ font-weight: bold;
+ }
+
+ /* Markets Panel */
+ .market-item {
+ padding: 0.5rem 1rem;
+ border-bottom: 1px solid var(--border);
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ }
+
+ .market-name {
+ font-size: 0.7rem;
+ font-weight: bold;
+ }
+
+ .market-symbol {
+ font-size: 0.55rem;
+ color: var(--text-dim);
+ }
+
+ .market-data {
+ text-align: right;
+ }
+
+ .market-price {
+ font-size: 0.75rem;
+ font-weight: bold;
+ }
+
+ .market-change {
+ font-size: 0.65rem;
+ }
+
+ .market-change.up {
+ color: var(--green);
+ }
+
+ .market-change.down {
+ color: var(--red);
+ }
+
+ /* Sector Heatmap */
+ .heatmap {
+ display: grid;
+ grid-template-columns: repeat(4, 1fr);
+ gap: 2px;
+ padding: 0.5rem;
+ }
+
+ .heatmap-cell {
+ padding: 0.6rem 0.4rem;
+ text-align: center;
+ font-size: 0.6rem;
+ font-weight: bold;
+ border-radius: 2px;
+ }
+
+ .heatmap-cell .sector-name {
+ font-size: 0.55rem;
+ opacity: 0.9;
+ margin-bottom: 0.2rem;
+ }
+
+ .heatmap-cell .sector-change {
+ font-size: 0.7rem;
+ }
+
+ .heatmap-cell.up-3 { background: #0d5a2d; color: #fff; }
+ .heatmap-cell.up-2 { background: #157a3c; color: #fff; }
+ .heatmap-cell.up-1 { background: #1d9a4b; color: #fff; }
+ .heatmap-cell.up-0 { background: #2a4a35; color: #fff; }
+ .heatmap-cell.down-0 { background: #4a2a2a; color: #fff; }
+ .heatmap-cell.down-1 { background: #8a3a3a; color: #fff; }
+ .heatmap-cell.down-2 { background: #aa3333; color: #fff; }
+ .heatmap-cell.down-3 { background: #cc2222; color: #fff; }
+
+ /* Polymarket */
+ .prediction-item {
+ padding: 0.6rem 1rem;
+ border-bottom: 1px solid var(--border);
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ gap: 1rem;
+ }
+
+ .prediction-question {
+ font-size: 0.75rem;
+ flex: 1;
+ color: var(--text);
+ }
+
+ .prediction-odds {
+ display: flex;
+ gap: 0.5rem;
+ flex-shrink: 0;
+ }
+
+ .prediction-yes, .prediction-no {
+ padding: 0.25rem 0.5rem;
+ font-size: 0.65rem;
+ font-weight: bold;
+ border-radius: 2px;
+ }
+
+ .prediction-yes {
+ background: var(--green);
+ color: var(--bg);
+ }
+
+ .prediction-no {
+ background: var(--red);
+ color: #fff;
+ }
+
+ .prediction-volume {
+ font-size: 0.55rem;
+ color: var(--text-dim);
+ margin-top: 0.25rem;
+ }
+
+ .error-msg {
+ padding: 1rem;
+ color: var(--text-dim);
+ font-size: 0.7rem;
+ }
+
+ /* Global Map - Situation Room Style */
+ .world-map {
+ width: 100%;
+ height: 550px;
+ position: relative;
+ background: #020a08;
+ overflow: hidden;
+ border: 1px solid #0a3020;
+ }
+
+ .world-map::before {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: repeating-linear-gradient(
+ 0deg,
+ transparent,
+ transparent 2px,
+ rgba(0, 40, 30, 0.03) 2px,
+ rgba(0, 40, 30, 0.03) 4px
+ );
+ pointer-events: none;
+ z-index: 10;
+ }
+
+ .world-map svg {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ }
+
+ /* Zoomable map container */
+ .map-zoom-wrapper {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ transform-origin: center center;
+ transition: transform 0.3s ease;
+ }
+
+ .map-zoom-controls {
+ position: absolute;
+ top: 10px;
+ right: 10px;
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ z-index: 50;
+ }
+
+ .map-zoom-btn {
+ width: 28px;
+ height: 28px;
+ background: rgba(0, 30, 20, 0.9);
+ border: 1px solid #0f6040;
+ color: #00ff88;
+ font-size: 1rem;
+ font-weight: bold;
+ cursor: pointer;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ transition: all 0.2s ease;
+ font-family: 'SF Mono', monospace;
+ }
+
+ .map-zoom-btn:hover {
+ background: rgba(0, 60, 40, 0.9);
+ border-color: #00ff88;
+ box-shadow: 0 0 10px rgba(0, 255, 136, 0.4);
+ }
+
+ .map-zoom-btn:active {
+ transform: scale(0.95);
+ }
+
+ .map-zoom-btn:disabled {
+ opacity: 0.3;
+ cursor: not-allowed;
+ }
+
+ .map-zoom-level {
+ font-size: 0.55rem;
+ color: #0f6040;
+ text-align: center;
+ padding: 2px 0;
+ font-family: 'SF Mono', monospace;
+ }
+
+ .map-zoom-reset {
+ font-size: 0.6rem;
+ padding: 4px 6px;
+ width: auto;
+ height: auto;
+ }
+
+ /* Pan hint */
+ .map-pan-hint {
+ position: absolute;
+ bottom: 30px;
+ left: 50%;
+ transform: translateX(-50%);
+ font-size: 0.5rem;
+ color: #0f6040;
+ letter-spacing: 0.1em;
+ text-transform: uppercase;
+ opacity: 0;
+ transition: opacity 0.3s ease;
+ z-index: 50;
+ pointer-events: none;
+ }
+
+ .world-map:hover .map-pan-hint.show {
+ opacity: 0.7;
+ }
+
+ /* Map View Toggle (Global/US) */
+ .map-view-toggle {
+ position: absolute;
+ top: 10px;
+ left: 10px;
+ display: flex;
+ gap: 0;
+ z-index: 50;
+ border: 1px solid #0f6040;
+ overflow: hidden;
+ }
+
+ .map-view-btn {
+ padding: 6px 12px;
+ background: rgba(0, 30, 20, 0.9);
+ border: none;
+ color: #0f6040;
+ font-size: 0.55rem;
+ font-weight: bold;
+ letter-spacing: 0.1em;
+ cursor: pointer;
+ transition: all 0.2s ease;
+ font-family: 'SF Mono', monospace;
+ }
+
+ .map-view-btn:first-child {
+ border-right: 1px solid #0f6040;
+ }
+
+ .map-view-btn:hover {
+ background: rgba(0, 60, 40, 0.9);
+ color: #00ff88;
+ }
+
+ .map-view-btn.active {
+ background: rgba(0, 255, 136, 0.2);
+ color: #00ff88;
+ }
+
+ /* US City Markers */
+ .us-city {
+ position: absolute;
+ transform: translate(-50%, -50%);
+ pointer-events: auto;
+ z-index: 25;
+ cursor: pointer;
+ }
+
+ .us-city-dot {
+ width: 8px;
+ height: 8px;
+ border-radius: 50%;
+ background: #00aaff;
+ border: 1px solid #00ddff;
+ transition: all 0.3s ease;
+ box-shadow: 0 0 6px rgba(0, 170, 255, 0.4);
+ }
+
+ .us-city.capital .us-city-dot {
+ width: 10px;
+ height: 10px;
+ background: #ffcc00;
+ border-color: #ffee66;
+ box-shadow: 0 0 8px rgba(255, 204, 0, 0.5);
+ }
+
+ .us-city.major .us-city-dot {
+ width: 9px;
+ height: 9px;
+ background: #00ff88;
+ border-color: #66ffaa;
+ box-shadow: 0 0 6px rgba(0, 255, 136, 0.4);
+ }
+
+ .us-city-label {
+ position: absolute;
+ top: 12px;
+ left: 50%;
+ transform: translateX(-50%);
+ font-size: 0.5rem;
+ color: #00aaff;
+ white-space: nowrap;
+ opacity: 0;
+ transition: all 0.3s ease;
+ text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
+ pointer-events: none;
+ }
+
+ .us-city.capital .us-city-label {
+ color: #ffcc00;
+ }
+
+ .us-city.major .us-city-label {
+ color: #00ff88;
+ }
+
+ .us-city:hover .us-city-label {
+ opacity: 1;
+ }
+
+ .us-city:hover .us-city-dot {
+ transform: scale(1.5);
+ box-shadow: 0 0 15px currentColor;
+ }
+
+ .us-city::before {
+ content: '';
+ position: absolute;
+ width: 30px;
+ height: 30px;
+ border-radius: 50%;
+ border: 1px solid transparent;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ transition: all 0.3s ease;
+ }
+
+ .us-city:hover::before {
+ border-color: currentColor;
+ opacity: 0.4;
+ animation: city-ping 1.5s ease-out infinite;
+ }
+
+ @keyframes city-ping {
+ 0% { transform: translate(-50%, -50%) scale(1); opacity: 0.4; }
+ 100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
+ }
+
+ .us-city-info {
+ font-size: 0.4rem;
+ color: rgba(0, 170, 255, 0.6);
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ }
+
+ /* US City activity indicators */
+ .us-city.high-activity .us-city-dot {
+ animation: city-pulse 1.5s ease-in-out infinite;
+ }
+
+ .us-city.high-activity::after {
+ content: '';
+ position: absolute;
+ width: 20px;
+ height: 20px;
+ border-radius: 50%;
+ background: radial-gradient(circle, rgba(255, 100, 100, 0.3) 0%, transparent 70%);
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ animation: activity-glow 2s ease-in-out infinite;
+ }
+
+ @keyframes city-pulse {
+ 0%, 100% { box-shadow: 0 0 6px currentColor; }
+ 50% { box-shadow: 0 0 15px currentColor; }
+ }
+
+ @keyframes activity-glow {
+ 0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
+ 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
+ }
+
+ /* US Breaking News Hotspots */
+ .us-hotspot {
+ position: absolute;
+ transform: translate(-50%, -50%);
+ pointer-events: auto;
+ z-index: 30;
+ cursor: pointer;
+ }
+
+ .us-hotspot-marker {
+ position: relative;
+ width: 24px;
+ height: 24px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 14px;
+ z-index: 2;
+ }
+
+ .us-hotspot-ring {
+ position: absolute;
+ width: 40px;
+ height: 40px;
+ border-radius: 50%;
+ border: 2px solid;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ animation: hotspot-pulse 2s ease-out infinite;
+ }
+
+ .us-hotspot.high .us-hotspot-ring {
+ border-color: #ff4444;
+ }
+
+ .us-hotspot.elevated .us-hotspot-ring {
+ border-color: #ffaa00;
+ }
+
+ .us-hotspot.medium .us-hotspot-ring {
+ border-color: #44aaff;
+ }
+
+ .us-hotspot-glow {
+ position: absolute;
+ width: 60px;
+ height: 60px;
+ border-radius: 50%;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ z-index: 0;
+ }
+
+ .us-hotspot.high .us-hotspot-glow {
+ background: radial-gradient(circle, rgba(255, 68, 68, 0.4) 0%, transparent 70%);
+ animation: glow-pulse 1.5s ease-in-out infinite;
+ }
+
+ .us-hotspot.elevated .us-hotspot-glow {
+ background: radial-gradient(circle, rgba(255, 170, 0, 0.3) 0%, transparent 70%);
+ animation: glow-pulse 2s ease-in-out infinite;
+ }
+
+ .us-hotspot.medium .us-hotspot-glow {
+ background: radial-gradient(circle, rgba(68, 170, 255, 0.25) 0%, transparent 70%);
+ }
+
+ @keyframes hotspot-pulse {
+ 0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
+ 100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
+ }
+
+ @keyframes glow-pulse {
+ 0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
+ 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
+ }
+
+ .us-hotspot-label {
+ position: absolute;
+ top: 28px;
+ left: 50%;
+ transform: translateX(-50%);
+ font-size: 0.55rem;
+ font-weight: bold;
+ white-space: nowrap;
+ text-shadow: 0 0 6px rgba(0, 0, 0, 0.9);
+ opacity: 0;
+ transition: opacity 0.3s ease;
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ }
+
+ .us-hotspot.high .us-hotspot-label {
+ color: #ff6666;
+ }
+
+ .us-hotspot.elevated .us-hotspot-label {
+ color: #ffcc44;
+ }
+
+ .us-hotspot.medium .us-hotspot-label {
+ color: #66bbff;
+ }
+
+ .us-hotspot:hover .us-hotspot-label {
+ opacity: 1;
+ }
+
+ .us-hotspot-category {
+ font-size: 0.4rem;
+ opacity: 0.7;
+ font-weight: normal;
+ }
+
+ /* US Hotspot Popup */
+ .us-hotspot-popup {
+ display: none;
+ position: absolute;
+ z-index: 100;
+ background: rgba(10, 20, 30, 0.95);
+ border: 1px solid rgba(255, 100, 100, 0.4);
+ border-radius: 4px;
+ width: 320px;
+ max-height: 400px;
+ overflow: hidden;
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
+ pointer-events: auto;
+ }
+
+ .us-hotspot-popup.visible {
+ display: block;
+ }
+
+ .us-hotspot-popup-header {
+ padding: 0.75rem 1rem;
+ border-bottom: 1px solid rgba(255, 100, 100, 0.3);
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ }
+
+ .us-hotspot-popup.high .us-hotspot-popup-header {
+ background: rgba(255, 68, 68, 0.15);
+ }
+
+ .us-hotspot-popup.elevated .us-hotspot-popup-header {
+ background: rgba(255, 170, 0, 0.15);
+ border-color: rgba(255, 170, 0, 0.3);
+ }
+
+ .us-hotspot-popup.medium .us-hotspot-popup-header {
+ background: rgba(68, 170, 255, 0.1);
+ border-color: rgba(68, 170, 255, 0.3);
+ }
+
+ .us-hotspot-popup-title {
+ font-size: 0.8rem;
+ font-weight: bold;
+ color: #ff8888;
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ }
+
+ .us-hotspot-popup.elevated .us-hotspot-popup-title {
+ color: #ffcc44;
+ }
+
+ .us-hotspot-popup.medium .us-hotspot-popup-title {
+ color: #66bbff;
+ }
+
+ .us-hotspot-popup-level {
+ font-size: 0.5rem;
+ padding: 0.2rem 0.5rem;
+ border-radius: 2px;
+ text-transform: uppercase;
+ font-weight: bold;
+ }
+
+ .us-hotspot-popup-level.high {
+ background: rgba(255, 68, 68, 0.3);
+ color: #ff8888;
+ }
+
+ .us-hotspot-popup-level.elevated {
+ background: rgba(255, 170, 0, 0.3);
+ color: #ffcc44;
+ }
+
+ .us-hotspot-popup-level.medium {
+ background: rgba(68, 170, 255, 0.2);
+ color: #66bbff;
+ }
+
+ .us-hotspot-popup-meta {
+ padding: 0.6rem 1rem;
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 0.4rem;
+ border-bottom: 1px solid rgba(255, 100, 100, 0.2);
+ font-size: 0.55rem;
+ }
+
+ .us-hotspot-popup-meta-label {
+ color: #664444;
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ }
+
+ .us-hotspot-popup-meta-value {
+ color: #cc8888;
+ }
+
+ .us-hotspot-popup-desc {
+ padding: 0.75rem 1rem;
+ font-size: 0.65rem;
+ color: #ccaaaa;
+ line-height: 1.5;
+ border-bottom: 1px solid rgba(255, 100, 100, 0.2);
+ }
+
+ .us-hotspot-popup-headlines-title {
+ font-size: 0.5rem;
+ color: #664444;
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ padding: 0.5rem 1rem 0.3rem;
+ }
+
+ .us-hotspot-popup-headlines {
+ max-height: 150px;
+ overflow-y: auto;
+ }
+
+ .us-hotspot-popup-headline {
+ padding: 0.5rem 1rem;
+ border-bottom: 1px solid rgba(255, 100, 100, 0.15);
+ font-size: 0.6rem;
+ color: #ddbbbb;
+ line-height: 1.4;
+ transition: background 0.2s;
+ }
+
+ .us-hotspot-popup-headline:hover {
+ background: rgba(255, 100, 100, 0.1);
+ }
+
+ .us-hotspot-popup-headline a {
+ color: inherit;
+ text-decoration: none;
+ }
+
+ .us-hotspot-popup-headline a:hover {
+ color: #ff9999;
+ }
+
+ .us-hotspot-popup-headline-source {
+ font-size: 0.45rem;
+ color: #664444;
+ text-transform: uppercase;
+ margin-bottom: 0.15rem;
+ }
+
+ .us-hotspot-popup-close {
+ position: absolute;
+ top: 0.5rem;
+ right: 0.5rem;
+ background: none;
+ border: none;
+ color: #886666;
+ font-size: 1rem;
+ cursor: pointer;
+ padding: 0.25rem;
+ line-height: 1;
+ transition: color 0.2s;
+ }
+
+ .us-hotspot-popup-close:hover {
+ color: #ff8888;
+ }
+
+ /* US City Popup */
+ .us-city-popup {
+ display: none;
+ position: absolute;
+ z-index: 100;
+ background: rgba(5, 15, 25, 0.98);
+ border: 1px solid #0066aa;
+ min-width: 300px;
+ max-width: 380px;
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 100, 200, 0.15);
+ pointer-events: auto;
+ }
+
+ .us-city-popup.visible {
+ display: block;
+ }
+
+ .us-city-popup-header {
+ padding: 0.75rem 1rem;
+ border-bottom: 1px solid rgba(0, 100, 170, 0.3);
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ background: rgba(0, 100, 170, 0.1);
+ }
+
+ .us-city-popup-title {
+ font-size: 0.8rem;
+ font-weight: bold;
+ color: #00aaff;
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ }
+
+ .us-city-popup-state {
+ font-size: 0.55rem;
+ padding: 0.2rem 0.5rem;
+ background: rgba(0, 170, 255, 0.2);
+ color: #00ccff;
+ border-radius: 2px;
+ }
+
+ .us-city-popup-meta {
+ padding: 0.6rem 1rem;
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 0.4rem;
+ border-bottom: 1px solid rgba(0, 100, 170, 0.2);
+ font-size: 0.55rem;
+ }
+
+ .us-city-popup-meta-label {
+ color: #336688;
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ }
+
+ .us-city-popup-meta-value {
+ color: #66aacc;
+ }
+
+ .us-city-popup-desc {
+ padding: 0.6rem 1rem;
+ font-size: 0.6rem;
+ color: #99bbcc;
+ line-height: 1.5;
+ border-bottom: 1px solid rgba(0, 100, 170, 0.2);
+ }
+
+ .us-city-popup-headlines-title {
+ font-size: 0.5rem;
+ color: #336688;
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ padding: 0.5rem 1rem 0.3rem;
+ }
+
+ .us-city-popup-headlines {
+ max-height: 180px;
+ overflow-y: auto;
+ }
+
+ .us-city-popup-headline {
+ padding: 0.5rem 1rem;
+ border-bottom: 1px solid rgba(0, 100, 170, 0.15);
+ font-size: 0.6rem;
+ color: #99bbcc;
+ cursor: pointer;
+ transition: background 0.2s;
+ }
+
+ .us-city-popup-headline:hover {
+ background: rgba(0, 100, 170, 0.15);
+ }
+
+ .us-city-popup-headline a {
+ color: inherit;
+ text-decoration: none;
+ }
+
+ .us-city-popup-headline a:hover {
+ color: #00ccff;
+ }
+
+ .us-city-popup-headline-source {
+ font-size: 0.45rem;
+ color: #336688;
+ text-transform: uppercase;
+ margin-bottom: 0.15rem;
+ }
+
+ .us-city-popup-close {
+ position: absolute;
+ top: 0.5rem;
+ right: 0.5rem;
+ background: none;
+ border: none;
+ color: #336688;
+ font-size: 1rem;
+ cursor: pointer;
+ padding: 0.25rem;
+ line-height: 1;
+ transition: color 0.2s;
+ }
+
+ .us-city-popup-close:hover {
+ color: #00aaff;
+ }
+
+ .map-overlays {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ pointer-events: none;
+ z-index: 5;
+ }
+
+ .map-overlays > * {
+ pointer-events: auto;
+ }
+
+ .coord-label {
+ position: absolute;
+ font-size: 0.55rem;
+ color: #0f6040;
+ font-family: 'SF Mono', monospace;
+ pointer-events: none;
+ z-index: 5;
+ }
+
+ .coord-label.lat {
+ transform: translateY(-50%);
+ }
+
+ .coord-label.lon {
+ transform: translateX(-50%);
+ }
+
+ .map-corner-label {
+ position: absolute;
+ font-size: 0.5rem;
+ color: #0f6040;
+ font-family: 'SF Mono', monospace;
+ letter-spacing: 0.1em;
+ z-index: 15;
+ }
+
+ .map-corner-label.tl { top: 8px; left: 10px; }
+ .map-corner-label.tr { top: 8px; right: 10px; }
+ .map-corner-label.bl { bottom: 8px; left: 10px; }
+ .map-corner-label.br { bottom: 8px; right: 10px; }
+
+ .hotspot {
+ position: absolute;
+ transform: translate(-50%, -50%);
+ pointer-events: none;
+ z-index: 20;
+ }
+
+ .hotspot-dot {
+ width: 10px;
+ height: 10px;
+ border-radius: 50%;
+ position: relative;
+ border: 1px solid;
+ }
+
+ .hotspot-dot::before {
+ content: '';
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: 100%;
+ height: 100%;
+ border-radius: 50%;
+ animation: pulse-ring 2s ease-out infinite;
+ }
+
+ .hotspot-dot::after {
+ content: '';
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: 24px;
+ height: 24px;
+ border-radius: 50%;
+ border: 1px solid;
+ opacity: 0.4;
+ }
+
+ .hotspot.low .hotspot-dot {
+ background: #00ff88;
+ border-color: #00ff88;
+ box-shadow: 0 0 10px #00ff88, 0 0 20px rgba(0,255,136,0.3);
+ }
+ .hotspot.low .hotspot-dot::before { background: #00ff88; }
+ .hotspot.low .hotspot-dot::after { border-color: #00ff88; }
+
+ .hotspot.elevated .hotspot-dot {
+ background: #ffcc00;
+ border-color: #ffcc00;
+ box-shadow: 0 0 10px #ffcc00, 0 0 20px rgba(255,204,0,0.3);
+ }
+ .hotspot.elevated .hotspot-dot::before { background: #ffcc00; }
+ .hotspot.elevated .hotspot-dot::after { border-color: #ffcc00; }
+
+ .hotspot.high .hotspot-dot {
+ background: #ff3333;
+ border-color: #ff3333;
+ box-shadow: 0 0 15px #ff3333, 0 0 30px rgba(255,51,51,0.4);
+ animation: glow-high 1s ease-in-out infinite alternate;
+ }
+ .hotspot.high .hotspot-dot::before { background: #ff3333; }
+ .hotspot.high .hotspot-dot::after { border-color: #ff3333; animation: target-lock 1.5s linear infinite; }
+
+ @keyframes pulse-ring {
+ 0% { width: 100%; height: 100%; opacity: 0.6; }
+ 100% { width: 250%; height: 250%; opacity: 0; }
+ }
+
+ @keyframes glow-high {
+ from { box-shadow: 0 0 10px #ff3333, 0 0 20px rgba(255,51,51,0.3); }
+ to { box-shadow: 0 0 20px #ff3333, 0 0 40px rgba(255,51,51,0.5); }
+ }
+
+ @keyframes target-lock {
+ from { transform: translate(-50%, -50%) rotate(0deg); }
+ to { transform: translate(-50%, -50%) rotate(360deg); }
+ }
+
+ .hotspot-label {
+ position: absolute;
+ top: 20px;
+ left: 50%;
+ transform: translateX(-50%);
+ font-size: 0.55rem;
+ font-family: 'SF Mono', monospace;
+ color: #00ff88;
+ white-space: nowrap;
+ text-shadow: 0 0 5px rgba(0,255,136,0.5);
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ }
+
+ .hotspot.elevated .hotspot-label { color: #ffcc00; text-shadow: 0 0 5px rgba(255,204,0,0.5); }
+ .hotspot.high .hotspot-label { color: #ff3333; text-shadow: 0 0 5px rgba(255,51,51,0.5); }
+
+ .hotspot-info {
+ font-size: 0.45rem;
+ color: #0a8060;
+ text-transform: none;
+ }
+
+ /* Hotspot Popup */
+ .hotspot-popup {
+ display: none;
+ position: absolute;
+ z-index: 100;
+ background: rgba(5, 10, 8, 0.95);
+ border: 1px solid #0f5040;
+ min-width: 280px;
+ max-width: 350px;
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0, 255, 136, 0.1);
+ pointer-events: auto;
+ }
+
+ .hotspot-popup.visible {
+ display: block;
+ }
+
+ .hotspot-popup-header {
+ padding: 0.75rem 1rem;
+ border-bottom: 1px solid #0f5040;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ }
+
+ .hotspot-popup-title {
+ font-size: 0.75rem;
+ font-weight: bold;
+ color: #00ff88;
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ }
+
+ .hotspot-popup.elevated .hotspot-popup-title { color: #ffcc00; }
+ .hotspot-popup.high .hotspot-popup-title { color: #ff3333; }
+
+ .hotspot-popup-level {
+ font-size: 0.55rem;
+ padding: 0.2rem 0.5rem;
+ border-radius: 2px;
+ font-weight: bold;
+ text-transform: uppercase;
+ }
+
+ .hotspot-popup-level.low { background: #00ff88; color: #000; }
+ .hotspot-popup-level.elevated { background: #ffcc00; color: #000; }
+ .hotspot-popup-level.high { background: #ff3333; color: #fff; animation: pulse-level 1s infinite; }
+
+ @keyframes pulse-level {
+ 0%, 100% { opacity: 1; }
+ 50% { opacity: 0.7; }
+ }
+
+ .hotspot-popup-subtext {
+ font-size: 0.55rem;
+ color: #0a8060;
+ padding: 0.5rem 1rem;
+ border-bottom: 1px solid #0a3020;
+ }
+
+ .hotspot-popup-headlines {
+ max-height: 200px;
+ overflow-y: auto;
+ }
+
+ .hotspot-popup-headline {
+ padding: 0.6rem 1rem;
+ border-bottom: 1px solid #0a3020;
+ font-size: 0.65rem;
+ color: #e8e8e8;
+ cursor: pointer;
+ transition: background 0.2s;
+ }
+
+ .hotspot-popup-headline:last-child {
+ border-bottom: none;
+ }
+
+ .hotspot-popup-headline:hover {
+ background: rgba(0, 255, 136, 0.1);
+ }
+
+ .hotspot-popup-headline a {
+ color: inherit;
+ text-decoration: none;
+ }
+
+ .hotspot-popup-headline a:hover {
+ color: #00ff88;
+ }
+
+ .hotspot-popup-source {
+ font-size: 0.5rem;
+ color: #0a8060;
+ text-transform: uppercase;
+ margin-bottom: 0.2rem;
+ }
+
+ .hotspot-popup-empty {
+ padding: 1rem;
+ font-size: 0.6rem;
+ color: #0a8060;
+ text-align: center;
+ font-style: italic;
+ }
+
+ .hotspot-popup-coords {
+ font-size: 0.5rem;
+ color: #0a6050;
+ padding: 0 1rem 0.5rem;
+ font-family: 'SF Mono', monospace;
+ }
+
+ .hotspot-popup-desc {
+ padding: 0.6rem 1rem;
+ font-size: 0.6rem;
+ color: #aaccbb;
+ line-height: 1.5;
+ border-bottom: 1px solid #0a3020;
+ }
+
+ .hotspot-popup-meta {
+ padding: 0.5rem 1rem;
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 0.4rem;
+ border-bottom: 1px solid #0a3020;
+ }
+
+ .hotspot-popup-meta-item {
+ font-size: 0.5rem;
+ }
+
+ .hotspot-popup-meta-label {
+ color: #0a6050;
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ display: block;
+ margin-bottom: 0.1rem;
+ }
+
+ .hotspot-popup-meta-value {
+ color: #00ff88;
+ }
+
+ .hotspot-popup-agencies {
+ padding: 0.5rem 1rem;
+ border-bottom: 1px solid #0a3020;
+ }
+
+ .hotspot-popup-agencies-title {
+ font-size: 0.45rem;
+ color: #0a6050;
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ margin-bottom: 0.3rem;
+ }
+
+ .hotspot-popup-agency {
+ display: inline-block;
+ font-size: 0.5rem;
+ padding: 0.1rem 0.3rem;
+ margin: 0.1rem 0.15rem 0.1rem 0;
+ background: rgba(0, 255, 136, 0.1);
+ border: 1px solid rgba(0, 255, 136, 0.2);
+ color: #00cc77;
+ }
+
+ .hotspot-popup-headlines-title {
+ font-size: 0.45rem;
+ color: #0a6050;
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ padding: 0.4rem 1rem 0.2rem;
+ }
+
+ .hotspot-popup-close {
+ position: absolute;
+ top: 0.5rem;
+ right: 0.5rem;
+ background: none;
+ border: none;
+ color: #0a8060;
+ font-size: 1rem;
+ cursor: pointer;
+ padding: 0.25rem;
+ line-height: 1;
+ }
+
+ .hotspot-popup-close:hover {
+ color: #00ff88;
+ }
+
+ .hotspot-popup-coords {
+ font-size: 0.5rem;
+ color: #0a6040;
+ padding: 0.4rem 1rem;
+ background: #030805;
+ font-family: 'SF Mono', monospace;
+ }
+
+ /* Make hotspots clickable */
+ .hotspot {
+ cursor: pointer;
+ pointer-events: auto;
+ }
+
+ .hotspot:hover .hotspot-dot {
+ transform: scale(1.4);
+ }
+
+ .hotspot:hover .hotspot-label {
+ transform: translateX(-50%) scale(1.1);
+ text-shadow: 0 0 10px currentColor;
+ }
+
+ .hotspot.low:hover .hotspot-dot { box-shadow: 0 0 25px #00ff88, 0 0 40px rgba(0,255,136,0.5); }
+ .hotspot.elevated:hover .hotspot-dot { box-shadow: 0 0 25px #ffcc00, 0 0 40px rgba(255,204,0,0.5); }
+ .hotspot.high:hover .hotspot-dot { box-shadow: 0 0 30px #ff3333, 0 0 50px rgba(255,51,51,0.6); }
+
+ /* Shipping Chokepoints */
+ .chokepoint {
+ position: absolute;
+ transform: translate(-50%, -50%);
+ pointer-events: auto;
+ z-index: 18;
+ cursor: pointer;
+ }
+
+ .chokepoint::before {
+ content: '';
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: 28px;
+ height: 28px;
+ border: 1px solid transparent;
+ border-radius: 4px;
+ transition: all 0.3s ease;
+ }
+
+ .chokepoint:hover::before {
+ border-color: #00aaff;
+ animation: chokepoint-scan 1.5s ease-in-out infinite;
+ }
+
+ @keyframes chokepoint-scan {
+ 0%, 100% { opacity: 1; }
+ 50% { opacity: 0.4; }
+ }
+
+ .chokepoint:hover .chokepoint-icon {
+ transform: scale(1.3);
+ box-shadow: 0 0 15px rgba(0,170,255,0.8);
+ }
+
+ .chokepoint:hover .chokepoint-label {
+ color: #00ffff;
+ text-shadow: 0 0 8px rgba(0,255,255,0.6);
+ }
+
+ .chokepoint.alert:hover .chokepoint-icon {
+ box-shadow: 0 0 20px rgba(255,170,0,1);
+ }
+
+ .chokepoint-icon {
+ width: 14px;
+ height: 14px;
+ background: #0066cc;
+ border: 2px solid #00aaff;
+ border-radius: 2px;
+ transition: all 0.2s ease;
+ position: relative;
+ box-shadow: 0 0 8px rgba(0,170,255,0.5);
+ }
+
+ .chokepoint-icon::after {
+ content: '⚓';
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ font-size: 8px;
+ }
+
+ .chokepoint.alert .chokepoint-icon {
+ background: #cc6600;
+ border-color: #ffaa00;
+ box-shadow: 0 0 12px rgba(255,170,0,0.6);
+ animation: pulse-ship 1.5s ease-in-out infinite;
+ }
+
+ @keyframes pulse-ship {
+ 0%, 100% { box-shadow: 0 0 8px rgba(255,170,0,0.4); }
+ 50% { box-shadow: 0 0 16px rgba(255,170,0,0.8); }
+ }
+
+ .chokepoint-label {
+ position: absolute;
+ top: 18px;
+ left: 50%;
+ transform: translateX(-50%);
+ font-size: 0.45rem;
+ color: #00aaff;
+ white-space: nowrap;
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ }
+
+ /* Chokepoint Popup */
+ .chokepoint-popup {
+ display: none;
+ position: absolute;
+ z-index: 100;
+ background: rgba(5, 8, 15, 0.95);
+ border: 1px solid #0066cc;
+ min-width: 260px;
+ max-width: 320px;
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0, 170, 255, 0.15);
+ pointer-events: auto;
+ }
+
+ .chokepoint-popup.visible {
+ display: block;
+ }
+
+ .chokepoint-popup.alert {
+ border-color: #ffaa00;
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 170, 0, 0.2);
+ }
+
+ .chokepoint-popup-header {
+ padding: 0.75rem 1rem;
+ border-bottom: 1px solid #0a3050;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ }
+
+ .chokepoint-popup-title {
+ font-size: 0.75rem;
+ font-weight: bold;
+ color: #00aaff;
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ }
+
+ .chokepoint-popup.alert .chokepoint-popup-title {
+ color: #ffaa00;
+ }
+
+ .chokepoint-popup-status {
+ font-size: 0.55rem;
+ padding: 0.2rem 0.5rem;
+ border-radius: 2px;
+ font-weight: bold;
+ text-transform: uppercase;
+ }
+
+ .chokepoint-popup-status.normal { background: #00aaff; color: #000; }
+ .chokepoint-popup-status.alert { background: #ffaa00; color: #000; }
+
+ .chokepoint-popup-info {
+ padding: 0.6rem 1rem;
+ border-bottom: 1px solid #0a3050;
+ }
+
+ .chokepoint-popup-stat {
+ display: flex;
+ justify-content: space-between;
+ font-size: 0.6rem;
+ padding: 0.25rem 0;
+ }
+
+ .chokepoint-popup-stat-label {
+ color: #0a8090;
+ }
+
+ .chokepoint-popup-stat-value {
+ color: #e8e8e8;
+ font-weight: bold;
+ }
+
+ .chokepoint-popup-desc {
+ font-size: 0.6rem;
+ color: #8090a0;
+ padding: 0.6rem 1rem;
+ border-bottom: 1px solid #0a3050;
+ line-height: 1.5;
+ }
+
+ .chokepoint-popup-headlines {
+ max-height: 150px;
+ overflow-y: auto;
+ }
+
+ .chokepoint-popup-headline {
+ padding: 0.5rem 1rem;
+ border-bottom: 1px solid #0a3050;
+ font-size: 0.6rem;
+ color: #e8e8e8;
+ }
+
+ .chokepoint-popup-headline:last-child {
+ border-bottom: none;
+ }
+
+ .chokepoint-popup-headline a {
+ color: inherit;
+ text-decoration: none;
+ }
+
+ .chokepoint-popup-headline a:hover {
+ color: #00aaff;
+ }
+
+ .chokepoint-popup-empty {
+ padding: 0.75rem 1rem;
+ font-size: 0.55rem;
+ color: #0a8090;
+ text-align: center;
+ font-style: italic;
+ }
+
+ .chokepoint-popup-close {
+ position: absolute;
+ top: 0.5rem;
+ right: 0.5rem;
+ background: none;
+ border: none;
+ color: #0a8090;
+ font-size: 1rem;
+ cursor: pointer;
+ padding: 0.25rem;
+ line-height: 1;
+ }
+
+ .chokepoint-popup-close:hover {
+ color: #00aaff;
+ }
+
+ /* Earthquake markers */
+ .quake {
+ position: absolute;
+ transform: translate(-50%, -50%);
+ pointer-events: auto;
+ z-index: 17;
+ cursor: pointer;
+ }
+
+ .quake::before {
+ content: '';
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: 30px;
+ height: 30px;
+ border-radius: 50%;
+ border: 1px solid transparent;
+ transition: all 0.3s ease;
+ }
+
+ .quake:hover::before {
+ border-color: #ff6600;
+ animation: quake-ring 0.5s ease-out infinite;
+ }
+
+ @keyframes quake-ring {
+ 0% { width: 20px; height: 20px; opacity: 1; }
+ 100% { width: 40px; height: 40px; opacity: 0; }
+ }
+
+ .quake:hover .quake-icon {
+ filter: brightness(1.5);
+ transform: scale(1.3);
+ }
+
+ .quake:hover .quake-label {
+ color: #ff9944;
+ text-shadow: 0 0 8px rgba(255, 102, 0, 0.8);
+ transform: translateX(-50%) scale(1.1);
+ }
+
+ .quake-icon {
+ width: 12px;
+ height: 12px;
+ background: radial-gradient(circle, #ff6600 0%, #ff3300 100%);
+ border-radius: 50%;
+ animation: quake-pulse 1s ease-out infinite;
+ transition: transform 0.2s, filter 0.2s;
+ }
+
+ .quake.major .quake-icon {
+ width: 18px;
+ height: 18px;
+ background: radial-gradient(circle, #ff0000 0%, #cc0000 100%);
+ animation: quake-pulse-major 0.8s ease-out infinite;
+ }
+
+ .quake.major:hover .quake-icon {
+ box-shadow: 0 0 25px rgba(255, 0, 0, 0.9);
+ }
+
+ @keyframes quake-pulse {
+ 0% { transform: scale(1); opacity: 1; }
+ 100% { transform: scale(2); opacity: 0; }
+ }
+
+ @keyframes quake-pulse-major {
+ 0% { transform: scale(1); opacity: 1; box-shadow: 0 0 10px #ff0000; }
+ 100% { transform: scale(2.5); opacity: 0; box-shadow: 0 0 30px #ff0000; }
+ }
+
+ .quake-label {
+ position: absolute;
+ top: 16px;
+ left: 50%;
+ transform: translateX(-50%);
+ font-size: 0.45rem;
+ color: #ff6600;
+ white-space: nowrap;
+ transition: all 0.2s ease;
+ }
+
+ /* Earthquake Popup */
+ .quake-popup {
+ display: none;
+ position: absolute;
+ z-index: 100;
+ background: rgba(15, 5, 5, 0.95);
+ border: 1px solid #ff4400;
+ min-width: 240px;
+ max-width: 300px;
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 68, 0, 0.2);
+ pointer-events: auto;
+ }
+
+ .quake-popup.visible {
+ display: block;
+ }
+
+ .quake-popup.major {
+ border-color: #ff0000;
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 0, 0, 0.3);
+ }
+
+ .quake-popup-header {
+ padding: 0.75rem 1rem;
+ border-bottom: 1px solid #401010;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ }
+
+ .quake-popup-mag {
+ font-size: 1.5rem;
+ font-weight: bold;
+ color: #ff6600;
+ }
+
+ .quake-popup.major .quake-popup-mag {
+ color: #ff0000;
+ }
+
+ .quake-popup-severity {
+ font-size: 0.55rem;
+ padding: 0.2rem 0.5rem;
+ border-radius: 2px;
+ font-weight: bold;
+ text-transform: uppercase;
+ }
+
+ .quake-popup-severity.minor { background: #ff6600; color: #000; }
+ .quake-popup-severity.moderate { background: #ff4400; color: #fff; }
+ .quake-popup-severity.major { background: #ff0000; color: #fff; animation: pulse-level 1s infinite; }
+
+ .quake-popup-location {
+ padding: 0.6rem 1rem;
+ font-size: 0.7rem;
+ color: #e8e8e8;
+ border-bottom: 1px solid #401010;
+ }
+
+ .quake-popup-info {
+ padding: 0.6rem 1rem;
+ }
+
+ .quake-popup-stat {
+ display: flex;
+ justify-content: space-between;
+ font-size: 0.6rem;
+ padding: 0.25rem 0;
+ }
+
+ .quake-popup-stat-label {
+ color: #804030;
+ }
+
+ .quake-popup-stat-value {
+ color: #e8e8e8;
+ }
+
+ .quake-popup-close {
+ position: absolute;
+ top: 0.5rem;
+ right: 0.5rem;
+ background: none;
+ border: none;
+ color: #804030;
+ font-size: 1rem;
+ cursor: pointer;
+ padding: 0.25rem;
+ line-height: 1;
+ }
+
+ .quake-popup-close:hover {
+ color: #ff6600;
+ }
+
+ .quake-popup-link {
+ display: block;
+ padding: 0.5rem 1rem;
+ font-size: 0.55rem;
+ color: #ff6600;
+ text-decoration: none;
+ border-top: 1px solid #401010;
+ text-align: center;
+ }
+
+ .quake-popup-link:hover {
+ background: rgba(255, 102, 0, 0.1);
+ }
+
+ /* Cyber threat indicators */
+ .cyber-zone {
+ position: absolute;
+ transform: translate(-50%, -50%);
+ pointer-events: auto;
+ z-index: 16;
+ cursor: pointer;
+ }
+
+ .cyber-zone::before {
+ content: '';
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: 35px;
+ height: 35px;
+ border-radius: 50%;
+ border: 1px solid transparent;
+ transition: all 0.3s ease;
+ }
+
+ .cyber-zone:hover::before {
+ border-color: #ff00ff;
+ background: radial-gradient(circle, rgba(255,0,255,0.1) 0%, transparent 70%);
+ animation: cyber-expand 1.5s ease-out infinite;
+ }
+
+ @keyframes cyber-expand {
+ 0% { width: 25px; height: 25px; opacity: 1; }
+ 100% { width: 50px; height: 50px; opacity: 0; }
+ }
+
+ .cyber-zone:hover .cyber-icon {
+ opacity: 1;
+ box-shadow: 0 0 25px rgba(255,0,255,0.9);
+ transform: scale(1.2);
+ animation: cyber-scan 1s linear infinite;
+ }
+
+ .cyber-zone:hover .cyber-label {
+ opacity: 1;
+ color: #ff66ff;
+ text-shadow: 0 0 10px rgba(255, 0, 255, 0.8);
+ transform: translateX(-50%) scale(1.1);
+ }
+
+ .cyber-icon {
+ width: 20px;
+ height: 20px;
+ border: 1px dashed #ff00ff;
+ border-radius: 50%;
+ opacity: 0.4;
+ animation: cyber-scan 3s linear infinite;
+ transition: all 0.3s ease;
+ }
+
+ .cyber-zone.active .cyber-icon {
+ opacity: 0.8;
+ border-color: #ff00ff;
+ box-shadow: 0 0 15px rgba(255,0,255,0.4);
+ animation: cyber-active 1s ease-in-out infinite;
+ }
+
+ .cyber-zone.active:hover .cyber-icon {
+ box-shadow: 0 0 30px rgba(255,0,255,1);
+ }
+
+ @keyframes cyber-scan {
+ from { transform: rotate(0deg); }
+ to { transform: rotate(360deg); }
+ }
+
+ @keyframes cyber-active {
+ 0%, 100% { opacity: 0.6; }
+ 50% { opacity: 1; }
+ }
+
+ .cyber-label {
+ position: absolute;
+ top: 16px;
+ left: 50%;
+ transform: translateX(-50%);
+ font-size: 0.45rem;
+ color: #ff00ff;
+ opacity: 0.6;
+ transition: all 0.2s ease;
+ }
+
+ /* Cyber Popup */
+ .cyber-popup {
+ display: none;
+ position: absolute;
+ z-index: 100;
+ background: rgba(10, 5, 15, 0.95);
+ border: 1px solid #ff00ff;
+ min-width: 260px;
+ max-width: 320px;
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 0, 255, 0.2);
+ pointer-events: auto;
+ }
+
+ .cyber-popup.visible {
+ display: block;
+ }
+
+ .cyber-popup.active {
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 40px rgba(255, 0, 255, 0.4);
+ }
+
+ .cyber-popup-header {
+ padding: 0.75rem 1rem;
+ border-bottom: 1px solid #301030;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ }
+
+ .cyber-popup-title {
+ font-size: 0.8rem;
+ font-weight: bold;
+ color: #ff00ff;
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ }
+
+ .cyber-popup-status {
+ font-size: 0.5rem;
+ padding: 0.2rem 0.5rem;
+ border-radius: 2px;
+ font-weight: bold;
+ text-transform: uppercase;
+ }
+
+ .cyber-popup-status.dormant { background: #404; color: #a0a; }
+ .cyber-popup-status.active { background: #ff00ff; color: #000; animation: pulse-level 1s infinite; }
+
+ .cyber-popup-apt {
+ padding: 0.5rem 1rem;
+ font-size: 0.65rem;
+ color: #ff80ff;
+ border-bottom: 1px solid #301030;
+ font-family: 'SF Mono', monospace;
+ }
+
+ .cyber-popup-desc {
+ padding: 0.6rem 1rem;
+ font-size: 0.6rem;
+ color: #a080a0;
+ line-height: 1.5;
+ border-bottom: 1px solid #301030;
+ }
+
+ .cyber-popup-info {
+ padding: 0.6rem 1rem;
+ }
+
+ .cyber-popup-stat {
+ display: flex;
+ justify-content: space-between;
+ font-size: 0.55rem;
+ padding: 0.2rem 0;
+ }
+
+ .cyber-popup-stat-label {
+ color: #604060;
+ }
+
+ .cyber-popup-stat-value {
+ color: #e8e8e8;
+ }
+
+ .cyber-popup-targets {
+ padding: 0.5rem 1rem;
+ border-top: 1px solid #301030;
+ }
+
+ .cyber-popup-targets-label {
+ font-size: 0.5rem;
+ color: #604060;
+ text-transform: uppercase;
+ margin-bottom: 0.3rem;
+ }
+
+ .cyber-popup-target-tags {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.3rem;
+ }
+
+ .cyber-popup-target-tag {
+ font-size: 0.5rem;
+ padding: 0.15rem 0.4rem;
+ background: #301030;
+ color: #ff80ff;
+ border-radius: 2px;
+ }
+
+ .cyber-popup-close {
+ position: absolute;
+ top: 0.5rem;
+ right: 0.5rem;
+ background: none;
+ border: none;
+ color: #604060;
+ font-size: 1rem;
+ cursor: pointer;
+ padding: 0.25rem;
+ line-height: 1;
+ }
+
+ .cyber-popup-close:hover {
+ color: #ff00ff;
+ }
+
+ /* Layoff tracker */
+ .layoff-item {
+ padding: 0.6rem 1rem;
+ border-bottom: 1px solid var(--border);
+ }
+
+ .layoff-company {
+ font-size: 0.75rem;
+ font-weight: bold;
+ color: var(--text);
+ }
+
+ .layoff-count {
+ font-size: 0.8rem;
+ color: var(--red);
+ font-weight: bold;
+ float: right;
+ }
+
+ .layoff-meta {
+ font-size: 0.55rem;
+ color: var(--text-dim);
+ margin-top: 0.2rem;
+ }
+
+ /* Situation panels */
+ .situation-header {
+ padding: 0.75rem 1rem;
+ background: var(--surface);
+ border-bottom: 1px solid var(--border);
+ }
+
+ .situation-title {
+ font-size: 0.8rem;
+ font-weight: bold;
+ margin-bottom: 0.3rem;
+ }
+
+ .situation-subtitle {
+ font-size: 0.6rem;
+ color: var(--text-dim);
+ }
+
+ .situation-status {
+ display: inline-block;
+ padding: 0.15rem 0.4rem;
+ font-size: 0.55rem;
+ font-weight: bold;
+ border-radius: 2px;
+ margin-left: 0.5rem;
+ }
+
+ .situation-status.critical { background: var(--red); color: #fff; }
+ .situation-status.elevated { background: var(--yellow); color: var(--bg); }
+ .situation-status.monitoring { background: var(--green); color: var(--bg); }
+
+ .situation-item {
+ padding: 0.5rem 1rem;
+ border-bottom: 1px solid var(--border);
+ font-size: 0.7rem;
+ }
+
+ .situation-item .label {
+ color: var(--text-dim);
+ font-size: 0.55rem;
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ }
+
+ .loading-msg {
+ padding: 1rem;
+ color: var(--text-dim);
+ font-size: 0.7rem;
+ animation: pulse 1.5s ease-in-out infinite;
+ }
+
+ @keyframes pulse {
+ 0%, 100% { opacity: 0.5; }
+ 50% { opacity: 1; }
+ }
+
+ /* Livestream */
+ .panel-wide {
+ grid-column: span 2;
+ }
+
+ .panel-livestream {
+ min-height: auto;
+ }
+
+ .livestream-container {
+ padding: 0 !important;
+ aspect-ratio: 16 / 9;
+ max-height: none;
+ overflow: hidden;
+ }
+
+ .livestream-container iframe {
+ width: 100%;
+ height: 100%;
+ border: none;
+ display: block;
+ }
+
+ .live-indicator {
+ background: var(--red);
+ color: #fff;
+ padding: 0.15rem 0.4rem;
+ border-radius: 3px;
+ font-size: 0.55rem;
+ font-weight: bold;
+ animation: live-pulse 2s ease-in-out infinite;
+ }
+
+ @keyframes live-pulse {
+ 0%, 100% { opacity: 1; }
+ 50% { opacity: 0.6; }
+ }
+
+ @media (max-width: 900px) {
+ .panel-wide {
+ grid-column: span 1;
+ }
+ }
+
+ /* Congressional Trades */
+ .congress-item {
+ padding: 0.6rem 1rem;
+ border-bottom: 1px solid var(--border);
+ display: flex;
+ justify-content: space-between;
+ align-items: flex-start;
+ gap: 0.75rem;
+ }
+
+ .congress-info {
+ flex: 1;
+ min-width: 0;
+ }
+
+ .congress-name {
+ font-size: 0.7rem;
+ font-weight: bold;
+ color: var(--text);
+ }
+
+ .congress-party {
+ font-size: 0.55rem;
+ padding: 0.1rem 0.3rem;
+ border-radius: 2px;
+ margin-left: 0.4rem;
+ }
+
+ .congress-party.D { background: #2266cc; color: #fff; }
+ .congress-party.R { background: #cc2222; color: #fff; }
+ .congress-party.I { background: #666; color: #fff; }
+
+ .congress-ticker {
+ font-size: 0.75rem;
+ font-weight: bold;
+ color: var(--accent);
+ margin-top: 0.2rem;
+ }
+
+ .congress-meta {
+ font-size: 0.55rem;
+ color: var(--text-dim);
+ margin-top: 0.15rem;
+ }
+
+ .congress-type {
+ text-align: right;
+ }
+
+ .congress-action {
+ font-size: 0.65rem;
+ font-weight: bold;
+ padding: 0.2rem 0.4rem;
+ border-radius: 2px;
+ }
+
+ .congress-action.buy { background: var(--green); color: var(--bg); }
+ .congress-action.sell { background: var(--red); color: #fff; }
+
+ .congress-amount {
+ font-size: 0.55rem;
+ color: var(--text-dim);
+ margin-top: 0.25rem;
+ }
+
+ /* Whale Watch */
+ .whale-item {
+ padding: 0.6rem 1rem;
+ border-bottom: 1px solid var(--border);
+ }
+
+ .whale-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ }
+
+ .whale-coin {
+ font-size: 0.7rem;
+ font-weight: bold;
+ }
+
+ .whale-amount {
+ font-size: 0.75rem;
+ font-weight: bold;
+ color: var(--accent);
+ }
+
+ .whale-usd {
+ font-size: 0.55rem;
+ color: var(--text-dim);
+ }
+
+ .whale-flow {
+ font-size: 0.6rem;
+ color: var(--text-dim);
+ margin-top: 0.2rem;
+ display: flex;
+ align-items: center;
+ gap: 0.3rem;
+ }
+
+ .whale-flow .arrow {
+ color: var(--yellow);
+ }
+
+ /* Main Character */
+ .main-char-display {
+ padding: 1.5rem 1rem;
+ text-align: center;
+ }
+
+ .main-char-label {
+ font-size: 0.6rem;
+ color: var(--text-dim);
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ margin-bottom: 0.5rem;
+ }
+
+ .main-char-name {
+ font-size: 1.5rem;
+ font-weight: bold;
+ color: var(--accent);
+ margin-bottom: 0.3rem;
+ }
+
+ .main-char-count {
+ font-size: 0.7rem;
+ color: var(--text-dim);
+ }
+
+ .main-char-list {
+ margin-top: 1rem;
+ padding-top: 1rem;
+ border-top: 1px solid var(--border);
+ }
+
+ .char-row {
+ display: flex;
+ justify-content: space-between;
+ padding: 0.35rem 1rem;
+ font-size: 0.7rem;
+ }
+
+ .char-row .rank {
+ color: var(--text-dim);
+ width: 1.5rem;
+ }
+
+ .char-row .name {
+ flex: 1;
+ }
+
+ .char-row .mentions {
+ color: var(--text-dim);
+ }
+
+ /* Contracts */
+ .contract-item {
+ padding: 0.6rem 1rem;
+ border-bottom: 1px solid var(--border);
+ }
+
+ .contract-agency {
+ font-size: 0.55rem;
+ color: var(--text-dim);
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ }
+
+ .contract-desc {
+ font-size: 0.75rem;
+ color: var(--text);
+ margin-top: 0.2rem;
+ }
+
+ .contract-meta {
+ display: flex;
+ justify-content: space-between;
+ margin-top: 0.3rem;
+ }
+
+ .contract-vendor {
+ font-size: 0.6rem;
+ color: var(--text-dim);
+ }
+
+ .contract-value {
+ font-size: 0.7rem;
+ font-weight: bold;
+ color: var(--green);
+ }
+
+ /* AI Tracker */
+ .ai-item {
+ padding: 0.6rem 1rem;
+ border-bottom: 1px solid var(--border);
+ }
+
+ .ai-source {
+ font-size: 0.55rem;
+ color: var(--text-dim);
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ }
+
+ .ai-title {
+ font-size: 0.75rem;
+ color: var(--text);
+ margin-top: 0.15rem;
+ }
+
+ .ai-date {
+ font-size: 0.55rem;
+ color: var(--text-dim);
+ margin-top: 0.2rem;
+ }
+
+ /* Intel Feed */
+ .intel-item {
+ padding: 0.6rem 1rem;
+ border-bottom: 1px solid var(--border);
+ }
+
+ .intel-item.priority {
+ border-left: 2px solid var(--red);
+ background: rgba(255, 68, 68, 0.05);
+ }
+
+ .intel-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: flex-start;
+ gap: 0.5rem;
+ margin-bottom: 0.2rem;
+ }
+
+ .intel-source {
+ font-size: 0.55rem;
+ color: var(--text-dim);
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ }
+
+ .intel-tags {
+ display: flex;
+ gap: 0.3rem;
+ flex-wrap: wrap;
+ }
+
+ .intel-tag {
+ font-size: 0.5rem;
+ padding: 0.1rem 0.35rem;
+ border-radius: 2px;
+ font-weight: bold;
+ text-transform: uppercase;
+ letter-spacing: 0.03em;
+ }
+
+ .intel-tag.region {
+ background: #1a3a5a;
+ color: #6ab0ff;
+ }
+
+ .intel-tag.topic {
+ background: #3a2a4a;
+ color: #b090d0;
+ }
+
+ .intel-tag.osint {
+ background: #2a4a3a;
+ color: #60d090;
+ }
+
+ .intel-tag.govt {
+ background: #4a3a2a;
+ color: #d0a060;
+ }
+
+ .intel-title {
+ font-size: 0.75rem;
+ color: var(--text);
+ text-decoration: none;
+ display: block;
+ line-height: 1.4;
+ }
+
+ .intel-title:hover {
+ color: var(--accent);
+ }
+
+ .intel-meta {
+ font-size: 0.55rem;
+ color: var(--text-dim);
+ margin-top: 0.25rem;
+ display: flex;
+ gap: 0.75rem;
+ }
+
+ /* Correlation Engine */
+ .correlation-panel {
+ padding: 0.5rem;
+ }
+
+ .correlation-sections {
+ display: grid;
+ grid-template-columns: repeat(2, 1fr);
+ gap: 0.75rem;
+ }
+
+ @media (max-width: 1200px) {
+ .correlation-sections {
+ grid-template-columns: 1fr;
+ }
+ }
+
+ .correlation-section {
+ background: rgba(0, 20, 40, 0.5);
+ border: 1px solid var(--border);
+ border-radius: 4px;
+ overflow: hidden;
+ }
+
+ .correlation-section-header {
+ padding: 0.5rem 0.75rem;
+ background: rgba(0, 40, 60, 0.5);
+ border-bottom: 1px solid var(--border);
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+ }
+
+ .correlation-icon {
+ font-size: 0.9rem;
+ }
+
+ .correlation-section-title {
+ font-size: 0.65rem;
+ font-weight: bold;
+ color: var(--accent);
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ }
+
+ .correlation-content {
+ padding: 0.5rem;
+ max-height: 200px;
+ overflow-y: auto;
+ }
+
+ .correlation-item {
+ padding: 0.5rem;
+ border-radius: 3px;
+ margin-bottom: 0.4rem;
+ background: rgba(0, 30, 50, 0.5);
+ border-left: 3px solid var(--accent);
+ }
+
+ .correlation-item.high {
+ border-left-color: #ff4444;
+ background: rgba(255, 68, 68, 0.1);
+ }
+
+ .correlation-item.elevated {
+ border-left-color: #ffaa00;
+ background: rgba(255, 170, 0, 0.08);
+ }
+
+ .correlation-item.emerging {
+ border-left-color: #44ff88;
+ background: rgba(68, 255, 136, 0.08);
+ }
+
+ .correlation-item-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: flex-start;
+ margin-bottom: 0.3rem;
+ }
+
+ .correlation-topic {
+ font-size: 0.7rem;
+ font-weight: bold;
+ color: var(--text);
+ }
+
+ .correlation-score {
+ font-size: 0.55rem;
+ padding: 0.15rem 0.4rem;
+ border-radius: 2px;
+ font-weight: bold;
+ }
+
+ .correlation-score.high {
+ background: rgba(255, 68, 68, 0.3);
+ color: #ff8888;
+ }
+
+ .correlation-score.elevated {
+ background: rgba(255, 170, 0, 0.3);
+ color: #ffcc44;
+ }
+
+ .correlation-score.emerging {
+ background: rgba(68, 255, 136, 0.3);
+ color: #88ffaa;
+ }
+
+ .correlation-meta {
+ font-size: 0.55rem;
+ color: var(--text-dim);
+ margin-bottom: 0.3rem;
+ }
+
+ .correlation-sources {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.25rem;
+ margin-top: 0.3rem;
+ }
+
+ .correlation-source-tag {
+ font-size: 0.45rem;
+ padding: 0.1rem 0.3rem;
+ background: rgba(0, 100, 150, 0.3);
+ color: #66aacc;
+ border-radius: 2px;
+ text-transform: uppercase;
+ }
+
+ .correlation-headlines {
+ margin-top: 0.4rem;
+ padding-top: 0.4rem;
+ border-top: 1px solid rgba(255, 255, 255, 0.1);
+ }
+
+ .correlation-headline {
+ font-size: 0.55rem;
+ color: var(--text-dim);
+ padding: 0.2rem 0;
+ display: flex;
+ gap: 0.3rem;
+ }
+
+ .correlation-headline::before {
+ content: '→';
+ color: var(--accent);
+ }
+
+ .correlation-headline a {
+ color: inherit;
+ text-decoration: none;
+ }
+
+ .correlation-headline a:hover {
+ color: var(--accent);
+ }
+
+ .prediction-confidence {
+ display: flex;
+ align-items: center;
+ gap: 0.4rem;
+ margin-top: 0.3rem;
+ }
+
+ .confidence-bar {
+ flex: 1;
+ height: 4px;
+ background: rgba(255, 255, 255, 0.1);
+ border-radius: 2px;
+ overflow: hidden;
+ }
+
+ .confidence-fill {
+ height: 100%;
+ border-radius: 2px;
+ transition: width 0.3s ease;
+ }
+
+ .confidence-fill.high {
+ background: linear-gradient(90deg, #ff4444, #ff8888);
+ }
+
+ .confidence-fill.medium {
+ background: linear-gradient(90deg, #ffaa00, #ffcc44);
+ }
+
+ .confidence-fill.low {
+ background: linear-gradient(90deg, #44aaff, #88ccff);
+ }
+
+ .confidence-label {
+ font-size: 0.5rem;
+ color: var(--text-dim);
+ min-width: 35px;
+ text-align: right;
+ }
+
+ .momentum-indicator {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.2rem;
+ font-size: 0.55rem;
+ padding: 0.1rem 0.3rem;
+ border-radius: 2px;
+ }
+
+ .momentum-indicator.rising {
+ background: rgba(68, 255, 136, 0.2);
+ color: #66ff99;
+ }
+
+ .momentum-indicator.surging {
+ background: rgba(255, 68, 68, 0.2);
+ color: #ff8888;
+ animation: pulse-surge 1s ease-in-out infinite;
+ }
+
+ .momentum-indicator.stable {
+ background: rgba(100, 100, 100, 0.2);
+ color: #999;
+ }
+
+ @keyframes pulse-surge {
+ 0%, 100% { opacity: 1; }
+ 50% { opacity: 0.6; }
+ }
+
+ .time-delta {
+ font-size: 0.5rem;
+ color: var(--text-dim);
+ }
+
+ .no-correlations {
+ font-size: 0.6rem;
+ color: var(--text-dim);
+ text-align: center;
+ padding: 1rem;
+ }
+
+ /* Narrative Tracker Styles */
+ .narrative-panel {
+ padding: 0.5rem;
+ }
+
+ .narrative-sections {
+ display: grid;
+ grid-template-columns: repeat(2, 1fr);
+ gap: 0.75rem;
+ }
+
+ @media (max-width: 600px) {
+ .narrative-sections {
+ grid-template-columns: 1fr;
+ }
+ }
+
+ .narrative-section {
+ background: rgba(40, 0, 40, 0.3);
+ border: 1px solid rgba(180, 80, 180, 0.3);
+ border-radius: 4px;
+ overflow: hidden;
+ }
+
+ .narrative-section-header {
+ display: flex;
+ align-items: center;
+ gap: 0.4rem;
+ padding: 0.4rem 0.6rem;
+ background: rgba(100, 50, 100, 0.2);
+ border-bottom: 1px solid rgba(180, 80, 180, 0.2);
+ }
+
+ .narrative-icon {
+ font-size: 0.8rem;
+ }
+
+ .narrative-section-title {
+ font-size: 0.6rem;
+ font-weight: bold;
+ color: #cc88cc;
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ }
+
+ .narrative-content {
+ padding: 0.5rem;
+ max-height: 200px;
+ overflow-y: auto;
+ }
+
+ .narrative-item {
+ padding: 0.4rem;
+ margin-bottom: 0.4rem;
+ background: rgba(80, 40, 80, 0.2);
+ border-radius: 3px;
+ border-left: 3px solid transparent;
+ }
+
+ .narrative-item:last-child {
+ margin-bottom: 0;
+ }
+
+ .narrative-item.viral {
+ border-left-color: #ff4488;
+ background: rgba(255, 68, 136, 0.1);
+ }
+
+ .narrative-item.spreading {
+ border-left-color: #ffaa44;
+ background: rgba(255, 170, 68, 0.1);
+ }
+
+ .narrative-item.emerging {
+ border-left-color: #44ff88;
+ background: rgba(68, 255, 136, 0.1);
+ }
+
+ .narrative-item.watch {
+ border-left-color: #8888ff;
+ background: rgba(136, 136, 255, 0.1);
+ }
+
+ .narrative-item.disinfo {
+ border-left-color: #ff4444;
+ background: rgba(255, 68, 68, 0.1);
+ }
+
+ .narrative-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: flex-start;
+ gap: 0.3rem;
+ margin-bottom: 0.2rem;
+ }
+
+ .narrative-title {
+ font-size: 0.65rem;
+ font-weight: bold;
+ color: #dda0dd;
+ }
+
+ .narrative-badge {
+ font-size: 0.45rem;
+ padding: 0.1rem 0.3rem;
+ border-radius: 2px;
+ text-transform: uppercase;
+ font-weight: bold;
+ }
+
+ .narrative-badge.viral {
+ background: rgba(255, 68, 136, 0.3);
+ color: #ff88aa;
+ }
+
+ .narrative-badge.spreading {
+ background: rgba(255, 170, 68, 0.3);
+ color: #ffcc88;
+ }
+
+ .narrative-badge.emerging {
+ background: rgba(68, 255, 136, 0.3);
+ color: #88ffaa;
+ }
+
+ .narrative-badge.disinfo {
+ background: rgba(255, 68, 68, 0.3);
+ color: #ff8888;
+ }
+
+ .narrative-description {
+ font-size: 0.55rem;
+ color: var(--text-dim);
+ margin-bottom: 0.3rem;
+ }
+
+ .narrative-metrics {
+ display: flex;
+ gap: 0.5rem;
+ flex-wrap: wrap;
+ }
+
+ .narrative-metric {
+ font-size: 0.5rem;
+ color: #aa88aa;
+ }
+
+ .narrative-metric-value {
+ font-weight: bold;
+ color: #cc88cc;
+ }
+
+ .narrative-sources {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.2rem;
+ margin-top: 0.3rem;
+ }
+
+ .narrative-source-tag {
+ font-size: 0.45rem;
+ padding: 0.1rem 0.3rem;
+ background: rgba(150, 80, 150, 0.3);
+ color: #bb99bb;
+ border-radius: 2px;
+ }
+
+ .narrative-crossover {
+ display: flex;
+ align-items: center;
+ gap: 0.3rem;
+ margin-top: 0.3rem;
+ padding-top: 0.3rem;
+ border-top: 1px dashed rgba(180, 80, 180, 0.2);
+ }
+
+ .crossover-arrow {
+ font-size: 0.6rem;
+ color: #cc88cc;
+ }
+
+ .crossover-source {
+ font-size: 0.5rem;
+ padding: 0.1rem 0.3rem;
+ border-radius: 2px;
+ }
+
+ .crossover-source.fringe {
+ background: rgba(255, 100, 100, 0.2);
+ color: #ff9999;
+ }
+
+ .crossover-source.mainstream {
+ background: rgba(100, 200, 100, 0.2);
+ color: #88cc88;
+ }
+
+ .no-narratives {
+ font-size: 0.6rem;
+ color: var(--text-dim);
+ text-align: center;
+ padding: 1rem;
+ }
+
+ /* Money Printer Gauge */
+ .printer-gauge {
+ padding: 1.5rem 1rem;
+ text-align: center;
+ }
+
+ .printer-label {
+ font-size: 0.6rem;
+ color: var(--text-dim);
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ margin-bottom: 0.75rem;
+ }
+
+ .printer-value {
+ font-size: 2rem;
+ font-weight: bold;
+ color: var(--accent);
+ }
+
+ .printer-unit {
+ font-size: 0.8rem;
+ color: var(--text-dim);
+ margin-left: 0.3rem;
+ }
+
+ .printer-change {
+ font-size: 0.8rem;
+ margin-top: 0.5rem;
+ }
+
+ .printer-change.up { color: var(--red); }
+ .printer-change.down { color: var(--green); }
+
+ .printer-bar {
+ margin-top: 1rem;
+ height: 8px;
+ background: var(--surface);
+ border-radius: 4px;
+ overflow: hidden;
+ }
+
+ .printer-fill {
+ height: 100%;
+ background: linear-gradient(90deg, var(--green), var(--yellow), var(--red));
+ transition: width 0.5s ease;
+ }
+
+ .printer-status {
+ margin-top: 0.75rem;
+ font-size: 0.65rem;
+ color: var(--text-dim);
+ }
+
+ .printer-indicator {
+ display: inline-block;
+ width: 8px;
+ height: 8px;
+ border-radius: 50%;
+ margin-right: 0.4rem;
+ animation: blink 1s infinite;
+ }
+
+ .printer-indicator.on { background: var(--red); }
+ .printer-indicator.off { background: var(--green); }
+
+ @keyframes blink {
+ 0%, 100% { opacity: 1; }
+ 50% { opacity: 0.4; }
+ }
+
+ .section-divider {
+ padding: 0.4rem 1rem;
+ background: var(--surface);
+ font-size: 0.55rem;
+ font-weight: bold;
+ letter-spacing: 0.1em;
+ text-transform: uppercase;
+ color: var(--text-dim);
+ }
+
+ @media (max-width: 1400px) {
+ .dashboard {
+ grid-template-columns: repeat(2, 1fr);
+ }
+ .panel.wide {
+ grid-column: span 1;
+ }
+ }
+
+ @media (max-width: 768px) {
+ .dashboard {
+ grid-template-columns: 1fr;
+ }
+
+ .header {
+ padding: 0.75rem 1rem;
+ }
+
+ .panel-content {
+ max-height: 350px;
+ }
+ }
+
+ /* Conflict Zone Boundaries - Enhanced Overlays */
+ .conflict-zone-path {
+ fill: none;
+ stroke: #ff3333;
+ stroke-width: 2;
+ stroke-dasharray: 8, 4;
+ stroke-linecap: round;
+ opacity: 0.8;
+ animation: conflict-march 1s linear infinite;
+ }
+
+ .conflict-zone-path.high-intensity {
+ stroke: #ff0000;
+ stroke-width: 3;
+ filter: drop-shadow(0 0 6px rgba(255, 0, 0, 0.8));
+ animation: conflict-march 0.8s linear infinite, conflict-pulse 2s ease-in-out infinite;
+ }
+
+ .conflict-zone-fill {
+ fill: rgba(255, 50, 50, 0.08);
+ stroke: none;
+ animation: conflict-fill-pulse 3s ease-in-out infinite;
+ }
+
+ .conflict-zone-fill.high-intensity {
+ fill: rgba(255, 30, 30, 0.15);
+ animation: conflict-fill-pulse 2s ease-in-out infinite;
+ }
+
+ /* Conflict zone inner glow effect */
+ .conflict-zone-glow {
+ fill: none;
+ stroke: rgba(255, 50, 50, 0.4);
+ stroke-width: 8;
+ filter: blur(4px);
+ animation: conflict-glow-pulse 2s ease-in-out infinite;
+ }
+
+ .conflict-zone-label {
+ position: absolute;
+ font-size: 0.55rem;
+ color: #ff4444;
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ background: rgba(20, 0, 0, 0.85);
+ padding: 0.2rem 0.5rem;
+ border: 1px solid #ff3333;
+ pointer-events: auto;
+ cursor: pointer;
+ white-space: nowrap;
+ animation: conflict-label-pulse 2s ease-in-out infinite;
+ transition: all 0.2s ease;
+ box-shadow: 0 0 10px rgba(255, 50, 50, 0.3), inset 0 0 8px rgba(255, 50, 50, 0.1);
+ }
+
+ .conflict-zone-label::before {
+ content: '⚠';
+ margin-right: 4px;
+ font-size: 0.6rem;
+ }
+
+ .conflict-zone-label.high-intensity {
+ border-color: #ff0000;
+ color: #ff0000;
+ box-shadow: 0 0 15px rgba(255, 0, 0, 0.5), inset 0 0 10px rgba(255, 0, 0, 0.2);
+ animation: conflict-label-pulse-high 1.5s ease-in-out infinite;
+ }
+
+ .conflict-zone-label.high-intensity::before {
+ content: '🔴';
+ animation: rotate 4s linear infinite;
+ }
+
+ .conflict-zone-label:hover {
+ background: rgba(60, 0, 0, 0.95);
+ transform: scale(1.15);
+ box-shadow: 0 0 20px rgba(255, 51, 51, 0.7), inset 0 0 15px rgba(255, 50, 50, 0.3);
+ animation: none;
+ z-index: 100;
+ }
+
+ @keyframes conflict-march {
+ to { stroke-dashoffset: -12; }
+ }
+
+ @keyframes conflict-pulse {
+ 0%, 100% { stroke-width: 3; }
+ 50% { stroke-width: 4; }
+ }
+
+ @keyframes conflict-fill-pulse {
+ 0%, 100% { opacity: 0.6; }
+ 50% { opacity: 1; }
+ }
+
+ @keyframes conflict-glow-pulse {
+ 0%, 100% { opacity: 0.3; stroke-width: 8; }
+ 50% { opacity: 0.6; stroke-width: 12; }
+ }
+
+ @keyframes conflict-label-pulse {
+ 0%, 100% { opacity: 0.9; box-shadow: 0 0 10px rgba(255, 50, 50, 0.3), inset 0 0 8px rgba(255, 50, 50, 0.1); }
+ 50% { opacity: 1; box-shadow: 0 0 15px rgba(255, 50, 50, 0.5), inset 0 0 10px rgba(255, 50, 50, 0.2); }
+ }
+
+ @keyframes conflict-label-pulse-high {
+ 0%, 100% { opacity: 0.9; box-shadow: 0 0 15px rgba(255, 0, 0, 0.5), inset 0 0 10px rgba(255, 0, 0, 0.2); }
+ 50% { opacity: 1; box-shadow: 0 0 25px rgba(255, 0, 0, 0.7), inset 0 0 15px rgba(255, 0, 0, 0.3); }
+ }
+
+ /* Conflict Zone Popup */
+ .conflict-popup {
+ display: none;
+ position: absolute;
+ z-index: 100;
+ background: rgba(20, 5, 5, 0.98);
+ border: 1px solid #ff3333;
+ min-width: 320px;
+ max-width: 400px;
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 50, 50, 0.2);
+ pointer-events: auto;
+ }
+
+ .conflict-popup.visible {
+ display: block;
+ }
+
+ .conflict-popup-header {
+ padding: 0.75rem 1rem;
+ border-bottom: 1px solid rgba(255, 50, 50, 0.3);
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ background: rgba(255, 50, 50, 0.1);
+ }
+
+ .conflict-popup-title {
+ font-size: 0.8rem;
+ font-weight: bold;
+ color: #ff4444;
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ }
+
+ .conflict-popup-intensity {
+ font-size: 0.55rem;
+ padding: 0.2rem 0.5rem;
+ border-radius: 2px;
+ font-weight: bold;
+ text-transform: uppercase;
+ }
+
+ .conflict-popup-intensity.high {
+ background: #ff0000;
+ color: #fff;
+ animation: pulse-level 1s infinite;
+ }
+ .conflict-popup-intensity.medium {
+ background: #ff6600;
+ color: #fff;
+ }
+ .conflict-popup-intensity.watch {
+ background: #ffcc00;
+ color: #000;
+ }
+
+ .conflict-popup-meta {
+ padding: 0.6rem 1rem;
+ border-bottom: 1px solid rgba(255, 50, 50, 0.2);
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 0.5rem;
+ }
+
+ .conflict-popup-meta-item {
+ font-size: 0.55rem;
+ }
+
+ .conflict-popup-meta-label {
+ color: #884444;
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ display: block;
+ margin-bottom: 0.15rem;
+ }
+
+ .conflict-popup-meta-value {
+ color: #ff8888;
+ }
+
+ .conflict-popup-desc {
+ padding: 0.75rem 1rem;
+ font-size: 0.65rem;
+ color: #ccaaaa;
+ line-height: 1.5;
+ border-bottom: 1px solid rgba(255, 50, 50, 0.2);
+ }
+
+ .conflict-popup-parties {
+ padding: 0.6rem 1rem;
+ border-bottom: 1px solid rgba(255, 50, 50, 0.2);
+ }
+
+ .conflict-popup-parties-title {
+ font-size: 0.5rem;
+ color: #884444;
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ margin-bottom: 0.4rem;
+ }
+
+ .conflict-popup-party {
+ display: inline-block;
+ font-size: 0.55rem;
+ padding: 0.15rem 0.4rem;
+ margin: 0.15rem 0.2rem 0.15rem 0;
+ background: rgba(255, 50, 50, 0.2);
+ border: 1px solid rgba(255, 50, 50, 0.3);
+ color: #ff8888;
+ }
+
+ .conflict-popup-events {
+ padding: 0.6rem 1rem;
+ border-bottom: 1px solid rgba(255, 50, 50, 0.2);
+ }
+
+ .conflict-popup-events-title {
+ font-size: 0.5rem;
+ color: #884444;
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ margin-bottom: 0.4rem;
+ }
+
+ .conflict-popup-event {
+ font-size: 0.55rem;
+ color: #ff8888;
+ padding: 0.2rem 0;
+ padding-left: 0.75rem;
+ position: relative;
+ }
+
+ .conflict-popup-event::before {
+ content: '•';
+ position: absolute;
+ left: 0;
+ color: #ff4444;
+ }
+
+ .conflict-popup-headlines {
+ max-height: 150px;
+ overflow-y: auto;
+ }
+
+ .conflict-popup-headlines-title {
+ font-size: 0.5rem;
+ color: #884444;
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ padding: 0.5rem 1rem 0.3rem;
+ }
+
+ .conflict-popup-headline {
+ padding: 0.5rem 1rem;
+ border-bottom: 1px solid rgba(255, 50, 50, 0.15);
+ font-size: 0.6rem;
+ color: #ccaaaa;
+ cursor: pointer;
+ transition: background 0.2s;
+ }
+
+ .conflict-popup-headline:hover {
+ background: rgba(255, 50, 50, 0.15);
+ }
+
+ .conflict-popup-headline a {
+ color: inherit;
+ text-decoration: none;
+ }
+
+ .conflict-popup-headline a:hover {
+ color: #ff8888;
+ }
+
+ .conflict-popup-headline-source {
+ font-size: 0.45rem;
+ color: #884444;
+ text-transform: uppercase;
+ margin-bottom: 0.15rem;
+ }
+
+ .conflict-popup-close {
+ position: absolute;
+ top: 0.5rem;
+ right: 0.5rem;
+ background: none;
+ border: none;
+ color: #884444;
+ font-size: 1rem;
+ cursor: pointer;
+ padding: 0.25rem;
+ line-height: 1;
+ transition: color 0.2s;
+ }
+
+ .conflict-popup-close:hover {
+ color: #ff4444;
+ }
+
+ /* Military Base Markers */
+ .military-base {
+ position: absolute;
+ transform: translate(-50%, -50%);
+ pointer-events: auto;
+ z-index: 19;
+ cursor: pointer;
+ }
+
+ .military-base::before {
+ content: '';
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: 20px;
+ height: 20px;
+ border-radius: 50%;
+ border: 1px solid transparent;
+ transition: all 0.3s ease;
+ }
+
+ .military-base:hover::before {
+ border-color: currentColor;
+ animation: base-ping 1s ease-out infinite;
+ }
+
+ .military-base:hover .base-icon {
+ transform: scale(1.5);
+ }
+
+ .military-base.us-nato:hover::before { border-color: #4488ff; }
+ .military-base.china:hover::before { border-color: #ff4444; }
+ .military-base.russia:hover::before { border-color: #ff8800; }
+
+ @keyframes base-ping {
+ 0% { width: 20px; height: 20px; opacity: 1; }
+ 100% { width: 35px; height: 35px; opacity: 0; }
+ }
+
+ .base-icon {
+ width: 8px;
+ height: 8px;
+ border-radius: 1px;
+ transition: transform 0.2s, box-shadow 0.2s;
+ }
+
+ .base-icon.us-nato {
+ background: #4488ff;
+ border: 1px solid #66aaff;
+ box-shadow: 0 0 6px rgba(68, 136, 255, 0.5);
+ }
+
+ .base-icon.china {
+ background: #ff4444;
+ border: 1px solid #ff6666;
+ box-shadow: 0 0 6px rgba(255, 68, 68, 0.5);
+ }
+
+ .base-icon.russia {
+ background: #ff8800;
+ border: 1px solid #ffaa44;
+ box-shadow: 0 0 6px rgba(255, 136, 0, 0.5);
+ }
+
+ .military-base:hover .base-icon.us-nato {
+ box-shadow: 0 0 15px rgba(68, 136, 255, 0.9);
+ }
+
+ .military-base:hover .base-icon.china {
+ box-shadow: 0 0 15px rgba(255, 68, 68, 0.9);
+ }
+
+ .military-base:hover .base-icon.russia {
+ box-shadow: 0 0 15px rgba(255, 136, 0, 0.9);
+ }
+
+ .base-label {
+ position: absolute;
+ top: 12px;
+ left: 50%;
+ transform: translateX(-50%) translateY(5px);
+ font-size: 0.45rem;
+ white-space: nowrap;
+ opacity: 0;
+ transition: all 0.2s ease;
+ background: rgba(0, 0, 0, 0.8);
+ padding: 0.15rem 0.4rem;
+ border-radius: 2px;
+ }
+
+ .military-base:hover .base-label {
+ opacity: 1;
+ transform: translateX(-50%) translateY(0);
+ }
+
+ .base-label.us-nato { color: #4488ff; border: 1px solid #4488ff; }
+ .base-label.china { color: #ff4444; border: 1px solid #ff4444; }
+ .base-label.russia { color: #ff8800; border: 1px solid #ff8800; }
+
+ /* Nuclear Facility Markers */
+ .nuclear-facility {
+ position: absolute;
+ transform: translate(-50%, -50%);
+ pointer-events: auto;
+ z-index: 18;
+ cursor: pointer;
+ }
+
+ .nuclear-facility::before {
+ content: '';
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: 24px;
+ height: 24px;
+ border-radius: 50%;
+ border: 1px dashed transparent;
+ transition: all 0.3s ease;
+ }
+
+ .nuclear-facility:hover::before {
+ border-color: #ffcc00;
+ animation: nuclear-rotate 3s linear infinite;
+ }
+
+ .nuclear-facility:hover .nuclear-icon {
+ transform: scale(1.4);
+ box-shadow: 0 0 20px rgba(255, 255, 0, 1);
+ }
+
+ .nuclear-facility:hover .nuclear-icon.weapons {
+ box-shadow: 0 0 25px rgba(255, 0, 0, 1);
+ }
+
+ @keyframes nuclear-rotate {
+ from { transform: translate(-50%, -50%) rotate(0deg); }
+ to { transform: translate(-50%, -50%) rotate(360deg); }
+ }
+
+ .nuclear-icon {
+ width: 10px;
+ height: 10px;
+ background: #ffcc00;
+ border: 2px solid #ffff00;
+ border-radius: 50%;
+ position: relative;
+ box-shadow: 0 0 8px rgba(255, 204, 0, 0.6);
+ transition: transform 0.2s, box-shadow 0.2s;
+ }
+
+ .nuclear-icon::before {
+ content: '☢';
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ font-size: 6px;
+ color: #000;
+ }
+
+ .nuclear-icon.weapons {
+ background: #ff0000;
+ border-color: #ff4444;
+ box-shadow: 0 0 10px rgba(255, 0, 0, 0.7);
+ animation: nuclear-pulse 1.5s ease-in-out infinite;
+ }
+
+ @keyframes nuclear-pulse {
+ 0%, 100% { box-shadow: 0 0 8px rgba(255, 0, 0, 0.5); }
+ 50% { box-shadow: 0 0 15px rgba(255, 0, 0, 0.9); }
+ }
+
+ .nuclear-label {
+ position: absolute;
+ top: 16px;
+ left: 50%;
+ transform: translateX(-50%) translateY(5px);
+ font-size: 0.45rem;
+ color: #ffcc00;
+ white-space: nowrap;
+ opacity: 0;
+ transition: all 0.2s ease;
+ background: rgba(0, 0, 0, 0.85);
+ padding: 0.15rem 0.4rem;
+ border: 1px solid #ffcc00;
+ border-radius: 2px;
+ }
+
+ .nuclear-facility:hover .nuclear-label {
+ opacity: 1;
+ transform: translateX(-50%) translateY(0);
+ }
+
+ /* Undersea Cables */
+ .cable-path {
+ fill: none;
+ stroke: #00ffff;
+ stroke-width: 1.5;
+ stroke-opacity: 0.4;
+ stroke-linecap: round;
+ cursor: pointer;
+ transition: all 0.3s ease;
+ }
+
+ .cable-path:hover {
+ stroke-opacity: 1;
+ stroke-width: 3;
+ stroke: #00ffff;
+ filter: drop-shadow(0 0 8px rgba(0, 255, 255, 0.8));
+ stroke-dasharray: 8, 4;
+ animation: cable-flow 0.5s linear infinite;
+ }
+
+ @keyframes cable-flow {
+ to { stroke-dashoffset: -12; }
+ }
+
+ .cable-path.major {
+ stroke-width: 2;
+ stroke-opacity: 0.6;
+ }
+
+ .cable-path.major:hover {
+ stroke-width: 4;
+ }
+
+ .cable-endpoint {
+ fill: #00ffff;
+ stroke: #00aaaa;
+ stroke-width: 1;
+ }
+
+ /* Sanctions Heat Map - Country fills */
+ .country-sanctioned-severe {
+ fill: #660000 !important;
+ }
+
+ .country-sanctioned-high {
+ fill: #442200 !important;
+ }
+
+ .country-sanctioned-moderate {
+ fill: #333300 !important;
+ }
+
+ .country-sanctioned-low {
+ fill: #223322 !important;
+ }
+
+ /* Breaking News Pulse */
+ .news-pulse {
+ position: absolute;
+ transform: translate(-50%, -50%);
+ pointer-events: none;
+ z-index: 25;
+ }
+
+ .news-pulse-ring {
+ position: absolute;
+ width: 40px;
+ height: 40px;
+ border: 2px solid #ff0000;
+ border-radius: 50%;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ animation: news-pulse-expand 2s ease-out infinite;
+ }
+
+ .news-pulse-ring:nth-child(2) {
+ animation-delay: 0.5s;
+ }
+
+ .news-pulse-ring:nth-child(3) {
+ animation-delay: 1s;
+ }
+
+ @keyframes news-pulse-expand {
+ 0% {
+ width: 10px;
+ height: 10px;
+ opacity: 1;
+ border-width: 3px;
+ }
+ 100% {
+ width: 80px;
+ height: 80px;
+ opacity: 0;
+ border-width: 1px;
+ }
+ }
+
+ .news-pulse-label {
+ position: absolute;
+ top: 50px;
+ left: 50%;
+ transform: translateX(-50%);
+ font-size: 0.5rem;
+ color: #ff0000;
+ white-space: nowrap;
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ animation: blink 1s ease-in-out infinite;
+ background: rgba(0, 0, 0, 0.8);
+ padding: 0.2rem 0.5rem;
+ border: 1px solid #ff0000;
+ }
+
+ /* 24-Hour Flashback Slider */
+ .flashback-control {
+ position: absolute;
+ bottom: 30px;
+ left: 50%;
+ transform: translateX(-50%);
+ display: flex;
+ align-items: center;
+ gap: 1rem;
+ background: rgba(0, 0, 0, 0.85);
+ padding: 0.5rem 1rem;
+ border: 1px solid #0f5040;
+ z-index: 50;
+ }
+
+ .flashback-label {
+ font-size: 0.55rem;
+ color: #0a8060;
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ transition: color 0.2s;
+ }
+
+ .flashback-control:hover .flashback-label {
+ color: #00ff88;
+ }
+
+ .flashback-slider {
+ width: 200px;
+ height: 4px;
+ -webkit-appearance: none;
+ appearance: none;
+ background: #0a3020;
+ border-radius: 2px;
+ cursor: pointer;
+ transition: all 0.2s;
+ }
+
+ .flashback-slider:hover {
+ background: #0f5040;
+ height: 6px;
+ }
+
+ .flashback-slider::-webkit-slider-thumb {
+ -webkit-appearance: none;
+ width: 14px;
+ height: 14px;
+ background: #00ff88;
+ border-radius: 50%;
+ cursor: pointer;
+ box-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
+ transition: all 0.2s;
+ }
+
+ .flashback-slider:hover::-webkit-slider-thumb {
+ width: 18px;
+ height: 18px;
+ box-shadow: 0 0 15px rgba(0, 255, 136, 0.9);
+ }
+
+ .flashback-slider::-moz-range-thumb {
+ width: 14px;
+ height: 14px;
+ background: #00ff88;
+ border-radius: 50%;
+ cursor: pointer;
+ border: none;
+ transition: all 0.2s;
+ }
+
+ .flashback-slider:hover::-moz-range-thumb {
+ width: 18px;
+ height: 18px;
+ box-shadow: 0 0 15px rgba(0, 255, 136, 0.9);
+ }
+
+ .flashback-time {
+ font-size: 0.65rem;
+ color: #00ff88;
+ font-family: 'SF Mono', monospace;
+ min-width: 60px;
+ transition: all 0.2s;
+ }
+
+ .flashback-control:hover .flashback-time {
+ text-shadow: 0 0 10px rgba(0, 255, 136, 0.8);
+ }
+
+ .flashback-mode-indicator {
+ position: absolute;
+ top: 30px;
+ left: 50%;
+ transform: translateX(-50%);
+ background: rgba(255, 170, 0, 0.9);
+ color: #000;
+ padding: 0.3rem 1rem;
+ font-size: 0.6rem;
+ font-weight: bold;
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ z-index: 50;
+ display: none;
+ }
+
+ .flashback-mode-indicator.active {
+ display: block;
+ animation: blink 1s ease-in-out infinite;
+ }
+
+ /* News Density Heatmap */
+ .density-blob {
+ position: absolute;
+ border-radius: 50%;
+ pointer-events: auto;
+ z-index: 12;
+ mix-blend-mode: screen;
+ cursor: pointer;
+ transition: all 0.3s ease;
+ }
+
+ .density-blob.low {
+ background: radial-gradient(circle, rgba(0, 255, 136, 0.3) 0%, transparent 70%);
+ }
+
+ .density-blob.medium {
+ background: radial-gradient(circle, rgba(255, 204, 0, 0.35) 0%, transparent 70%);
+ }
+
+ .density-blob.high {
+ background: radial-gradient(circle, rgba(255, 68, 68, 0.4) 0%, transparent 70%);
+ animation: density-glow 2s ease-in-out infinite;
+ }
+
+ .density-blob:hover {
+ transform: translate(-50%, -50%) scale(1.3) !important;
+ filter: brightness(1.5);
+ }
+
+ .density-blob.low:hover {
+ background: radial-gradient(circle, rgba(0, 255, 136, 0.5) 0%, transparent 70%);
+ }
+
+ .density-blob.medium:hover {
+ background: radial-gradient(circle, rgba(255, 204, 0, 0.55) 0%, transparent 70%);
+ }
+
+ .density-blob.high:hover {
+ background: radial-gradient(circle, rgba(255, 68, 68, 0.6) 0%, transparent 70%);
+ }
+
+ @keyframes density-glow {
+ 0%, 100% { opacity: 0.7; transform: translate(-50%, -50%) scale(1); }
+ 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
+ }
+
+ /* Map Layer Toggle */
+ .map-layer-toggle {
+ position: absolute;
+ top: 8px;
+ left: 50%;
+ transform: translateX(-50%);
+ display: flex;
+ gap: 2px;
+ background: rgba(0, 0, 0, 0.85);
+ padding: 4px;
+ border: 1px solid #0f5040;
+ z-index: 50;
+ backdrop-filter: blur(4px);
+ }
+
+ .layer-btn {
+ background: transparent;
+ border: 1px solid #0a3020;
+ color: #0a8060;
+ font-size: 0.5rem;
+ padding: 0.3rem 0.6rem;
+ cursor: pointer;
+ font-family: 'SF Mono', monospace;
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ transition: all 0.2s ease;
+ position: relative;
+ overflow: hidden;
+ }
+
+ .layer-btn::before {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: -100%;
+ width: 100%;
+ height: 100%;
+ background: linear-gradient(90deg, transparent, rgba(0, 255, 136, 0.2), transparent);
+ transition: left 0.4s ease;
+ }
+
+ .layer-btn:hover::before {
+ left: 100%;
+ }
+
+ .layer-btn:hover {
+ border-color: #00ff88;
+ color: #00ff88;
+ text-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
+ transform: translateY(-1px);
+ }
+
+ .layer-btn.active {
+ background: #0f5040;
+ color: #00ff88;
+ border-color: #00ff88;
+ box-shadow: 0 0 10px rgba(0, 255, 136, 0.3), inset 0 0 10px rgba(0, 255, 136, 0.1);
+ }
+
+ .layer-btn.active:hover {
+ background: #0a3020;
+ box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
+ }
+
+ /* Flight Radar Aircraft Markers */
+ .aircraft-marker {
+ position: absolute;
+ width: 16px;
+ height: 16px;
+ transform: translate(-50%, -50%);
+ cursor: pointer;
+ z-index: 50;
+ transition: transform 0.3s ease;
+ }
+
+ .aircraft-icon {
+ width: 100%;
+ height: 100%;
+ font-size: 12px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ color: #ffaa00;
+ text-shadow: 0 0 4px rgba(255, 170, 0, 0.5);
+ transition: all 0.2s ease;
+ }
+
+ .aircraft-marker:hover .aircraft-icon {
+ color: #ffcc44;
+ transform: scale(1.3);
+ text-shadow: 0 0 8px rgba(255, 204, 68, 0.8);
+ }
+
+ .aircraft-marker.military .aircraft-icon {
+ color: #ff4444;
+ text-shadow: 0 0 4px rgba(255, 68, 68, 0.5);
+ }
+
+ .aircraft-marker.cargo .aircraft-icon {
+ color: #44aaff;
+ text-shadow: 0 0 4px rgba(68, 170, 255, 0.5);
+ }
+
+ .aircraft-marker.helicopter .aircraft-icon {
+ color: #44ff88;
+ text-shadow: 0 0 4px rgba(68, 255, 136, 0.5);
+ }
+
+ .aircraft-trail {
+ position: absolute;
+ width: 2px;
+ height: 20px;
+ background: linear-gradient(to bottom, rgba(255, 170, 0, 0.4), transparent);
+ transform-origin: top center;
+ pointer-events: none;
+ }
+
+ .aircraft-popup {
+ position: absolute;
+ background: rgba(0, 20, 15, 0.95);
+ border: 1px solid #0a8060;
+ border-radius: 4px;
+ padding: 0.75rem;
+ min-width: 200px;
+ max-width: 280px;
+ z-index: 200;
+ display: none;
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 255, 136, 0.1);
+ }
+
+ .aircraft-popup.visible {
+ display: block;
+ }
+
+ .aircraft-popup-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 0.5rem;
+ padding-bottom: 0.5rem;
+ border-bottom: 1px solid rgba(0, 255, 136, 0.2);
+ }
+
+ .aircraft-callsign {
+ font-size: 0.9rem;
+ font-weight: bold;
+ color: #00ff88;
+ font-family: 'SF Mono', monospace;
+ }
+
+ .aircraft-type-badge {
+ font-size: 0.5rem;
+ padding: 0.15rem 0.4rem;
+ background: rgba(255, 170, 0, 0.2);
+ color: #ffaa00;
+ border-radius: 2px;
+ text-transform: uppercase;
+ }
+
+ .aircraft-details {
+ font-size: 0.65rem;
+ color: var(--text-dim);
+ }
+
+ .aircraft-detail-row {
+ display: flex;
+ justify-content: space-between;
+ padding: 0.2rem 0;
+ }
+
+ .aircraft-detail-label {
+ color: #0a8060;
+ }
+
+ .aircraft-detail-value {
+ color: #88ccaa;
+ font-family: 'SF Mono', monospace;
+ }
+
+ .aircraft-origin-dest {
+ margin-top: 0.5rem;
+ padding-top: 0.5rem;
+ border-top: 1px solid rgba(0, 255, 136, 0.2);
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+ font-size: 0.6rem;
+ }
+
+ .aircraft-airport {
+ color: #66aacc;
+ font-family: 'SF Mono', monospace;
+ }
+
+ .aircraft-route-arrow {
+ color: #0a8060;
+ }
+
+ .flight-count-badge {
+ font-size: 0.5rem;
+ padding: 0.1rem 0.3rem;
+ background: rgba(255, 170, 0, 0.2);
+ color: #ffaa00;
+ border-radius: 2px;
+ margin-left: 0.3rem;
+ }
+
+ /* Satellite Imagery Layer */
+ .satellite-canvas {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ z-index: 0;
+ opacity: 0;
+ transition: opacity 0.5s ease;
+ pointer-events: none;
+ }
+
+ .satellite-canvas.visible {
+ opacity: 0.85;
+ }
+
+ .satellite-loading {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ font-size: 0.7rem;
+ color: #00ff88;
+ background: rgba(0, 20, 15, 0.9);
+ padding: 0.5rem 1rem;
+ border-radius: 4px;
+ border: 1px solid #0a8060;
+ z-index: 5;
+ display: none;
+ }
+
+ .satellite-loading.visible {
+ display: block;
+ }
+
+ .satellite-attribution {
+ position: absolute;
+ bottom: 5px;
+ left: 5px;
+ font-size: 0.45rem;
+ color: rgba(255, 255, 255, 0.5);
+ background: rgba(0, 0, 0, 0.5);
+ padding: 0.1rem 0.3rem;
+ border-radius: 2px;
+ z-index: 10;
+ display: none;
+ }
+
+ .satellite-attribution.visible {
+ display: block;
+ }
+
+ .layer-btn.satellite-btn {
+ background: rgba(80, 60, 20, 0.3);
+ border-color: #806020;
+ color: #aa8844;
+ }
+
+ .layer-btn.satellite-btn.active {
+ background: rgba(120, 100, 40, 0.5);
+ border-color: #bbaa44;
+ color: #ffdd66;
+ box-shadow: 0 0 10px rgba(255, 220, 100, 0.3);
+ }
+
+ /* Custom Monitors */
+ .monitors-section {
+ margin-top: 1rem;
+ padding-top: 1rem;
+ border-top: 1px solid var(--border);
+ }
+
+ .monitors-list {
+ max-height: 200px;
+ overflow-y: auto;
+ margin-bottom: 0.75rem;
+ }
+
+ .monitor-item {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 0.5rem;
+ background: var(--surface);
+ border: 1px solid var(--border);
+ margin-bottom: 0.5rem;
+ border-radius: 2px;
+ }
+
+ .monitor-item-info {
+ flex: 1;
+ min-width: 0;
+ }
+
+ .monitor-item-name {
+ font-size: 0.7rem;
+ font-weight: bold;
+ color: var(--text);
+ display: flex;
+ align-items: center;
+ gap: 0.4rem;
+ }
+
+ .monitor-item-color {
+ width: 8px;
+ height: 8px;
+ border-radius: 50%;
+ flex-shrink: 0;
+ }
+
+ .monitor-item-keywords {
+ font-size: 0.55rem;
+ color: var(--text-dim);
+ margin-top: 0.2rem;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+
+ .monitor-item-location {
+ font-size: 0.5rem;
+ color: var(--green);
+ margin-top: 0.15rem;
+ }
+
+ .monitor-item-actions {
+ display: flex;
+ gap: 0.25rem;
+ }
+
+ .monitor-item-btn {
+ background: transparent;
+ border: 1px solid var(--border);
+ color: var(--text-dim);
+ width: 22px;
+ height: 22px;
+ font-size: 0.6rem;
+ cursor: pointer;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ transition: all 0.2s;
+ }
+
+ .monitor-item-btn:hover {
+ border-color: var(--text);
+ color: var(--text);
+ }
+
+ .monitor-item-btn.delete:hover {
+ border-color: var(--red);
+ color: var(--red);
+ }
+
+ .add-monitor-btn {
+ width: 100%;
+ padding: 0.5rem;
+ background: transparent;
+ border: 1px dashed var(--border);
+ color: var(--text-dim);
+ font-family: inherit;
+ font-size: 0.65rem;
+ cursor: pointer;
+ transition: all 0.2s;
+ }
+
+ .add-monitor-btn:hover {
+ border-color: var(--green);
+ color: var(--green);
+ }
+
+ /* Monitor Form Modal */
+ .monitor-form-overlay {
+ display: none;
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: rgba(0,0,0,0.9);
+ z-index: 1100;
+ justify-content: center;
+ align-items: center;
+ }
+
+ .monitor-form-overlay.open {
+ display: flex;
+ }
+
+ .monitor-form {
+ background: var(--bg);
+ border: 1px solid var(--border);
+ padding: 1.5rem;
+ width: 90%;
+ max-width: 400px;
+ }
+
+ .monitor-form-title {
+ font-size: 0.8rem;
+ font-weight: bold;
+ letter-spacing: 0.1em;
+ text-transform: uppercase;
+ margin-bottom: 1rem;
+ padding-bottom: 0.75rem;
+ border-bottom: 1px solid var(--border);
+ }
+
+ .monitor-form-field {
+ margin-bottom: 1rem;
+ }
+
+ .monitor-form-label {
+ font-size: 0.65rem;
+ color: var(--text-dim);
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ margin-bottom: 0.4rem;
+ display: block;
+ }
+
+ .monitor-form-input {
+ width: 100%;
+ padding: 0.5rem;
+ background: var(--surface);
+ border: 1px solid var(--border);
+ color: var(--text);
+ font-family: inherit;
+ font-size: 0.75rem;
+ }
+
+ .monitor-form-input:focus {
+ outline: none;
+ border-color: var(--green);
+ }
+
+ .monitor-form-hint {
+ font-size: 0.55rem;
+ color: var(--text-dim);
+ margin-top: 0.3rem;
+ }
+
+ .monitor-form-colors {
+ display: flex;
+ gap: 0.5rem;
+ flex-wrap: wrap;
+ }
+
+ .monitor-color-option {
+ width: 24px;
+ height: 24px;
+ border-radius: 50%;
+ cursor: pointer;
+ border: 2px solid transparent;
+ transition: all 0.2s;
+ }
+
+ .monitor-color-option:hover {
+ transform: scale(1.2);
+ }
+
+ .monitor-color-option.selected {
+ border-color: var(--text);
+ box-shadow: 0 0 10px currentColor;
+ }
+
+ .monitor-form-location {
+ display: flex;
+ gap: 0.5rem;
+ }
+
+ .monitor-form-location input {
+ flex: 1;
+ }
+
+ .monitor-form-actions {
+ display: flex;
+ gap: 0.5rem;
+ margin-top: 1.5rem;
+ }
+
+ .monitor-form-actions button {
+ flex: 1;
+ padding: 0.6rem;
+ font-family: inherit;
+ font-size: 0.7rem;
+ font-weight: bold;
+ letter-spacing: 0.05em;
+ text-transform: uppercase;
+ cursor: pointer;
+ transition: all 0.2s;
+ }
+
+ .monitor-save-btn {
+ background: var(--green);
+ color: var(--bg);
+ border: none;
+ }
+
+ .monitor-save-btn:hover {
+ opacity: 0.8;
+ }
+
+ .monitor-cancel-btn {
+ background: transparent;
+ color: var(--text-dim);
+ border: 1px solid var(--border);
+ }
+
+ .monitor-cancel-btn:hover {
+ border-color: var(--text);
+ color: var(--text);
+ }
+
+ /* Custom Hotspot (user-created) */
+ .custom-hotspot {
+ position: absolute;
+ transform: translate(-50%, -50%);
+ pointer-events: auto;
+ z-index: 21;
+ cursor: pointer;
+ }
+
+ .custom-hotspot-dot {
+ width: 12px;
+ height: 12px;
+ border-radius: 50%;
+ position: relative;
+ border: 2px solid;
+ box-shadow: 0 0 10px currentColor;
+ transition: all 0.2s;
+ }
+
+ .custom-hotspot-dot::before {
+ content: '';
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: 100%;
+ height: 100%;
+ border-radius: 50%;
+ animation: custom-pulse 2s ease-out infinite;
+ background: currentColor;
+ }
+
+ @keyframes custom-pulse {
+ 0% { width: 100%; height: 100%; opacity: 0.6; }
+ 100% { width: 250%; height: 250%; opacity: 0; }
+ }
+
+ .custom-hotspot:hover .custom-hotspot-dot {
+ transform: scale(1.4);
+ box-shadow: 0 0 20px currentColor;
+ }
+
+ .custom-hotspot-label {
+ position: absolute;
+ top: 18px;
+ left: 50%;
+ transform: translateX(-50%);
+ font-size: 0.5rem;
+ font-family: 'SF Mono', monospace;
+ white-space: nowrap;
+ text-shadow: 0 0 5px currentColor;
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ transition: all 0.2s;
+ }
+
+ .custom-hotspot:hover .custom-hotspot-label {
+ transform: translateX(-50%) scale(1.1);
+ }
+
+ .custom-hotspot-count {
+ font-size: 0.4rem;
+ opacity: 0.7;
+ }
+
+ /* My Monitors Panel */
+ .monitor-match {
+ padding: 0.6rem 1rem;
+ border-bottom: 1px solid var(--border);
+ cursor: pointer;
+ transition: background 0.2s;
+ }
+
+ .monitor-match:hover {
+ background: var(--surface);
+ }
+
+ .monitor-match-header {
+ display: flex;
+ align-items: center;
+ gap: 0.4rem;
+ margin-bottom: 0.3rem;
+ }
+
+ .monitor-match-dot {
+ width: 6px;
+ height: 6px;
+ border-radius: 50%;
+ flex-shrink: 0;
+ }
+
+ .monitor-match-name {
+ font-size: 0.6rem;
+ font-weight: bold;
+ color: var(--text-dim);
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ }
+
+ .monitor-match-title {
+ font-size: 0.75rem;
+ color: var(--text);
+ text-decoration: none;
+ display: block;
+ }
+
+ .monitor-match-title:hover {
+ color: var(--accent);
+ }
+
+ .monitor-match-source {
+ font-size: 0.5rem;
+ color: var(--text-dim);
+ margin-top: 0.2rem;
+ }
+
+ .monitors-empty {
+ padding: 1.5rem 1rem;
+ text-align: center;
+ color: var(--text-dim);
+ font-size: 0.7rem;
+ }
+
+ .monitors-empty-hint {
+ font-size: 0.6rem;
+ margin-top: 0.5rem;
+ opacity: 0.7;
+ }
+
+ /* Custom Hotspot Popup */
+ .custom-hotspot-popup {
+ display: none;
+ position: absolute;
+ z-index: 100;
+ background: rgba(5, 10, 8, 0.95);
+ border: 1px solid var(--border);
+ min-width: 280px;
+ max-width: 350px;
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
+ }
+
+ .custom-hotspot-popup.visible {
+ display: block;
+ }
+
+ .custom-hotspot-popup-header {
+ padding: 0.75rem 1rem;
+ border-bottom: 1px solid var(--border);
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+ }
+
+ .custom-hotspot-popup-dot {
+ width: 10px;
+ height: 10px;
+ border-radius: 50%;
+ flex-shrink: 0;
+ }
+
+ .custom-hotspot-popup-name {
+ font-size: 0.85rem;
+ font-weight: bold;
+ }
+
+ .custom-hotspot-popup-count {
+ margin-left: auto;
+ font-size: 0.65rem;
+ padding: 0.2rem 0.5rem;
+ border-radius: 3px;
+ background: var(--surface);
+ }
+
+ .custom-hotspot-popup-keywords {
+ padding: 0.5rem 1rem;
+ font-size: 0.6rem;
+ color: var(--text-dim);
+ border-bottom: 1px solid var(--border);
+ }
+
+ .custom-hotspot-popup-coords {
+ padding: 0.4rem 1rem;
+ font-size: 0.55rem;
+ color: var(--text-dim);
+ font-family: 'SF Mono', monospace;
+ border-bottom: 1px solid var(--border);
+ }
+
+ .custom-hotspot-popup-matches {
+ max-height: 200px;
+ overflow-y: auto;
+ }
+
+ .custom-hotspot-popup-match {
+ padding: 0.6rem 1rem;
+ border-bottom: 1px solid var(--border);
+ }
+
+ .custom-hotspot-popup-match:last-child {
+ border-bottom: none;
+ }
+
+ .custom-hotspot-popup-match a {
+ font-size: 0.7rem;
+ color: var(--text);
+ text-decoration: none;
+ display: block;
+ }
+
+ .custom-hotspot-popup-match a:hover {
+ color: var(--accent);
+ }
+
+ .custom-hotspot-popup-match-source {
+ font-size: 0.5rem;
+ color: var(--text-dim);
+ margin-top: 0.2rem;
+ }
+
+ .custom-hotspot-popup-empty {
+ padding: 1rem;
+ text-align: center;
+ font-size: 0.7rem;
+ color: var(--text-dim);
+ }
+
+ .custom-hotspot-popup-close {
+ position: absolute;
+ top: 0.5rem;
+ right: 0.5rem;
+ background: none;
+ border: none;
+ color: var(--text-dim);
+ font-size: 1rem;
+ cursor: pointer;
+ padding: 0.25rem;
+ line-height: 1;
+ }
+
+ .custom-hotspot-popup-close:hover {
+ color: var(--text);
+ }
diff --git a/test-modules.html b/test-modules.html
new file mode 100644
index 0000000..117ef9f
--- /dev/null
+++ b/test-modules.html
@@ -0,0 +1,280 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Module Tests</title>
+ <script src="https://d3js.org/d3.v7.min.js"></script>
+ <script src="https://cdn.jsdelivr.net/npm/topojson-client@3"></script>
+ <style>
+ body { font-family: monospace; background: #111; color: #0f0; padding: 20px; }
+ .pass { color: #0f0; }
+ .fail { color: #f00; }
+ .test-group { margin: 20px 0; padding: 10px; border: 1px solid #333; }
+ h2 { color: #0ff; margin: 0 0 10px 0; }
+ .result { padding: 2px 0; }
+ </style>
+</head>
+<body>
+ <h1>Module Test Results</h1>
+ <div id="results"></div>
+
+ <script type="module">
+ const results = document.getElementById('results');
+ let totalPass = 0;
+ let totalFail = 0;
+
+ function log(module, test, passed, error = null) {
+ const div = document.createElement('div');
+ div.className = `result ${passed ? 'pass' : 'fail'}`;
+ div.textContent = `${passed ? '✓' : '✗'} ${module}: ${test}${error ? ' - ' + error : ''}`;
+ results.appendChild(div);
+ if (passed) totalPass++; else totalFail++;
+ }
+
+ function createGroup(name) {
+ const group = document.createElement('div');
+ group.className = 'test-group';
+ group.innerHTML = `<h2>${name}</h2>`;
+ results.appendChild(group);
+ return group;
+ }
+
+ async function runTests() {
+ // Test 1: constants.js
+ const group1 = createGroup('constants.js');
+ try {
+ const constants = await import('./js/constants.js');
+ log('constants', 'Module loads', true);
+ log('constants', 'PANELS defined', !!constants.PANELS);
+ log('constants', 'FEEDS defined', !!constants.FEEDS);
+ log('constants', 'ALERT_KEYWORDS defined', Array.isArray(constants.ALERT_KEYWORDS));
+ log('constants', 'INTEL_HOTSPOTS defined', Array.isArray(constants.INTEL_HOTSPOTS));
+ log('constants', 'CORRELATION_TOPICS defined', Array.isArray(constants.CORRELATION_TOPICS));
+ log('constants', 'NARRATIVE_PATTERNS defined', Array.isArray(constants.NARRATIVE_PATTERNS));
+ log('constants', 'US_CITIES count > 0', constants.US_CITIES?.length > 0);
+ log('constants', 'SECTORS count > 0', constants.SECTORS?.length > 0);
+ } catch (e) {
+ log('constants', 'Module loads', false, e.message);
+ }
+
+ // Test 2: utils.js
+ const group2 = createGroup('utils.js');
+ try {
+ const utils = await import('./js/utils.js');
+ log('utils', 'Module loads', true);
+ log('utils', 'getTimeAgo exists', typeof utils.getTimeAgo === 'function');
+ log('utils', 'timeAgo exists', typeof utils.timeAgo === 'function');
+ log('utils', 'escapeHtml exists', typeof utils.escapeHtml === 'function');
+ log('utils', 'setStatus exists', typeof utils.setStatus === 'function');
+
+ // Functional tests
+ const timeResult = utils.timeAgo(new Date().toISOString());
+ log('utils', 'timeAgo returns string', typeof timeResult === 'string');
+
+ const escaped = utils.escapeHtml('<script>alert("xss")</script>');
+ log('utils', 'escapeHtml works', escaped.includes('&lt;'));
+ } catch (e) {
+ log('utils', 'Module loads', false, e.message);
+ }
+
+ // Test 3: data.js
+ const group3 = createGroup('data.js');
+ try {
+ const data = await import('./js/data.js');
+ log('data', 'Module loads', true);
+ log('data', 'fetchWithProxy exists', typeof data.fetchWithProxy === 'function');
+ log('data', 'fetchFeed exists', typeof data.fetchFeed === 'function');
+ log('data', 'fetchCategory exists', typeof data.fetchCategory === 'function');
+ log('data', 'fetchMarkets exists', typeof data.fetchMarkets === 'function');
+ log('data', 'fetchSectors exists', typeof data.fetchSectors === 'function');
+ log('data', 'fetchCommodities exists', typeof data.fetchCommodities === 'function');
+ log('data', 'fetchEarthquakes exists', typeof data.fetchEarthquakes === 'function');
+ log('data', 'hasAlertKeyword exists', typeof data.hasAlertKeyword === 'function');
+
+ // Functional test
+ const isAlert = data.hasAlertKeyword('Breaking: Nuclear attack warning');
+ log('data', 'hasAlertKeyword detects alert', isAlert === true);
+ } catch (e) {
+ log('data', 'Module loads', false, e.message);
+ }
+
+ // Test 4: popups.js
+ const group4 = createGroup('popups.js');
+ try {
+ const popups = await import('./js/popups.js');
+ log('popups', 'Module loads', true);
+ log('popups', 'showHotspotPopup exists', typeof popups.showHotspotPopup === 'function');
+ log('popups', 'hideHotspotPopup exists', typeof popups.hideHotspotPopup === 'function');
+ log('popups', 'showConflictPopup exists', typeof popups.showConflictPopup === 'function');
+ log('popups', 'showUSCityPopup exists', typeof popups.showUSCityPopup === 'function');
+ log('popups', 'showChokepointPopup exists', typeof popups.showChokepointPopup === 'function');
+ log('popups', 'showQuakePopup exists', typeof popups.showQuakePopup === 'function');
+ log('popups', 'showAircraftPopup exists', typeof popups.showAircraftPopup === 'function');
+ log('popups', 'hideAllPopups exists', typeof popups.hideAllPopups === 'function');
+ } catch (e) {
+ log('popups', 'Module loads', false, e.message);
+ }
+
+ // Test 5: map.js
+ const group5 = createGroup('map.js');
+ try {
+ const map = await import('./js/map.js');
+ log('map', 'Module loads', true);
+ log('map', 'renderGlobalMap exists', typeof map.renderGlobalMap === 'function');
+ log('map', 'mapZoomIn exists', typeof map.mapZoomIn === 'function');
+ log('map', 'mapZoomOut exists', typeof map.mapZoomOut === 'function');
+ log('map', 'mapZoomReset exists', typeof map.mapZoomReset === 'function');
+ log('map', 'setMapView exists', typeof map.setMapView === 'function');
+ log('map', 'analyzeHotspotActivity exists', typeof map.analyzeHotspotActivity === 'function');
+ log('map', 'calculateNewsDensity exists', typeof map.calculateNewsDensity === 'function');
+ log('map', 'loadWorldMap exists', typeof map.loadWorldMap === 'function');
+ log('map', 'initMapPan exists', typeof map.initMapPan === 'function');
+ } catch (e) {
+ log('map', 'Module loads', false, e.message);
+ }
+
+ // Test 6: layers.js
+ const group6 = createGroup('layers.js');
+ try {
+ const layers = await import('./js/layers.js');
+ log('layers', 'Module loads', true);
+ log('layers', 'mapLayers object exists', typeof layers.mapLayers === 'object');
+ log('layers', 'toggleLayer exists', typeof layers.toggleLayer === 'function');
+ log('layers', 'toggleSatelliteLayer exists', typeof layers.toggleSatelliteLayer === 'function');
+ log('layers', 'fetchFlightData exists', typeof layers.fetchFlightData === 'function');
+ log('layers', 'classifyAircraft exists', typeof layers.classifyAircraft === 'function');
+ log('layers', 'getAircraftArrow exists', typeof layers.getAircraftArrow === 'function');
+
+ // Functional tests
+ const arrow = layers.getAircraftArrow(90);
+ log('layers', 'getAircraftArrow returns arrow', arrow === '→');
+
+ const type = layers.classifyAircraft('RCH123', 'United States');
+ log('layers', 'classifyAircraft detects military', type === 'military');
+ } catch (e) {
+ log('layers', 'Module loads', false, e.message);
+ }
+
+ // Test 7: panels.js
+ const group7 = createGroup('panels.js');
+ try {
+ const panels = await import('./js/panels.js');
+ log('panels', 'Module loads', true);
+ log('panels', 'isPanelEnabled exists', typeof panels.isPanelEnabled === 'function');
+ log('panels', 'togglePanel exists', typeof panels.togglePanel === 'function');
+ log('panels', 'getPanelSettings exists', typeof panels.getPanelSettings === 'function');
+ log('panels', 'savePanelSettings exists', typeof panels.savePanelSettings === 'function');
+ log('panels', 'applyPanelSettings exists', typeof panels.applyPanelSettings === 'function');
+ log('panels', 'initDragAndDrop exists', typeof panels.initDragAndDrop === 'function');
+ log('panels', 'extractYouTubeId exists', typeof panels.extractYouTubeId === 'function');
+
+ // Functional tests
+ const ytId = panels.extractYouTubeId('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
+ log('panels', 'extractYouTubeId works', ytId === 'dQw4w9WgXcQ');
+
+ const enabled = panels.isPanelEnabled('map');
+ log('panels', 'isPanelEnabled returns boolean', typeof enabled === 'boolean');
+ } catch (e) {
+ log('panels', 'Module loads', false, e.message);
+ }
+
+ // Test 8: renderers.js
+ const group8 = createGroup('renderers.js');
+ try {
+ const renderers = await import('./js/renderers.js');
+ log('renderers', 'Module loads', true);
+ log('renderers', 'renderNews exists', typeof renderers.renderNews === 'function');
+ log('renderers', 'renderMarkets exists', typeof renderers.renderMarkets === 'function');
+ log('renderers', 'renderHeatmap exists', typeof renderers.renderHeatmap === 'function');
+ log('renderers', 'renderCommodities exists', typeof renderers.renderCommodities === 'function');
+ log('renderers', 'renderPolymarket exists', typeof renderers.renderPolymarket === 'function');
+ log('renderers', 'renderCongressTrades exists', typeof renderers.renderCongressTrades === 'function');
+ log('renderers', 'renderMainCharacter exists', typeof renderers.renderMainCharacter === 'function');
+ log('renderers', 'renderIntelFeed exists', typeof renderers.renderIntelFeed === 'function');
+ log('renderers', 'renderMoneyPrinter exists', typeof renderers.renderMoneyPrinter === 'function');
+ } catch (e) {
+ log('renderers', 'Module loads', false, e.message);
+ }
+
+ // Test 9: intelligence.js
+ const group9 = createGroup('intelligence.js');
+ try {
+ const intel = await import('./js/intelligence.js');
+ log('intelligence', 'Module loads', true);
+ log('intelligence', 'analyzeCorrelations exists', typeof intel.analyzeCorrelations === 'function');
+ log('intelligence', 'renderCorrelationEngine exists', typeof intel.renderCorrelationEngine === 'function');
+ log('intelligence', 'analyzeNarratives exists', typeof intel.analyzeNarratives === 'function');
+ log('intelligence', 'renderNarrativeTracker exists', typeof intel.renderNarrativeTracker === 'function');
+ log('intelligence', 'calculateMainCharacter exists', typeof intel.calculateMainCharacter === 'function');
+ log('intelligence', 'detectRegions exists', typeof intel.detectRegions === 'function');
+ log('intelligence', 'detectTopics exists', typeof intel.detectTopics === 'function');
+
+ // Functional tests
+ const mockNews = [
+ { title: 'Trump announces new tariffs on China', source: 'Reuters' },
+ { title: 'Biden responds to tariff announcement', source: 'AP' },
+ { title: 'Federal Reserve considers rate cut', source: 'WSJ' }
+ ];
+ const mainChar = intel.calculateMainCharacter(mockNews);
+ log('intelligence', 'calculateMainCharacter returns array', Array.isArray(mainChar));
+
+ const regions = intel.detectRegions('Ukraine conflict escalates near Kyiv');
+ log('intelligence', 'detectRegions finds Ukraine', regions.includes('Ukraine'));
+ } catch (e) {
+ log('intelligence', 'Module loads', false, e.message);
+ }
+
+ // Test 10: monitors.js
+ const group10 = createGroup('monitors.js');
+ try {
+ const monitors = await import('./js/monitors.js');
+ log('monitors', 'Module loads', true);
+ log('monitors', 'loadMonitors exists', typeof monitors.loadMonitors === 'function');
+ log('monitors', 'saveMonitors exists', typeof monitors.saveMonitors === 'function');
+ log('monitors', 'renderMonitorsList exists', typeof monitors.renderMonitorsList === 'function');
+ log('monitors', 'openMonitorForm exists', typeof monitors.openMonitorForm === 'function');
+ log('monitors', 'closeMonitorForm exists', typeof monitors.closeMonitorForm === 'function');
+ log('monitors', 'saveMonitor exists', typeof monitors.saveMonitor === 'function');
+ log('monitors', 'scanMonitorsForMatches exists', typeof monitors.scanMonitorsForMatches === 'function');
+ log('monitors', 'getMonitorHotspots exists', typeof monitors.getMonitorHotspots === 'function');
+
+ // Functional test
+ const loaded = monitors.loadMonitors();
+ log('monitors', 'loadMonitors returns array', Array.isArray(loaded));
+ } catch (e) {
+ log('monitors', 'Module loads', false, e.message);
+ }
+
+ // Test 11: main.js
+ const group11 = createGroup('main.js');
+ try {
+ const main = await import('./js/main.js');
+ log('main', 'Module loads', true);
+ log('main', 'window.refreshAll exposed', typeof window.refreshAll === 'function');
+ log('main', 'window.togglePanel exposed', typeof window.togglePanel === 'function');
+ log('main', 'window.toggleSettings exposed', typeof window.toggleSettings === 'function');
+ log('main', 'window.mapZoomIn exposed', typeof window.mapZoomIn === 'function');
+ log('main', 'window.setMapView exposed', typeof window.setMapView === 'function');
+ log('main', 'window.openMonitorForm exposed', typeof window.openMonitorForm === 'function');
+ log('main', 'window.showHotspotPopup exposed', typeof window.showHotspotPopup === 'function');
+ } catch (e) {
+ log('main', 'Module loads', false, e.message);
+ }
+
+ // Summary
+ const summary = document.createElement('div');
+ summary.className = 'test-group';
+ summary.innerHTML = `
+ <h2>SUMMARY</h2>
+ <div class="pass">Passed: ${totalPass}</div>
+ <div class="fail">Failed: ${totalFail}</div>
+ <div style="color: ${totalFail === 0 ? '#0f0' : '#f00'}; font-size: 20px; margin-top: 10px;">
+ ${totalFail === 0 ? '✓ ALL TESTS PASSED' : '✗ SOME TESTS FAILED'}
+ </div>
+ `;
+ results.appendChild(summary);
+ }
+
+ runTests();
+ </script>
+</body>
+</html>
diff --git a/test-node.mjs b/test-node.mjs
new file mode 100644
index 0000000..8eeb234
--- /dev/null
+++ b/test-node.mjs
@@ -0,0 +1,127 @@
+// Node.js module test script
+// Run with: node --experimental-vm-modules test-node.mjs
+
+import { fileURLToPath } from 'url';
+import { dirname, join } from 'path';
+import fs from 'fs';
+
+const __dirname = dirname(fileURLToPath(import.meta.url));
+
+console.log('\n=== MODULE SYNTAX VALIDATION ===\n');
+
+const modules = [
+ 'constants.js',
+ 'utils.js',
+ 'data.js',
+ 'popups.js',
+ 'map.js',
+ 'layers.js',
+ 'panels.js',
+ 'renderers.js',
+ 'intelligence.js',
+ 'monitors.js',
+ 'main.js'
+];
+
+let passed = 0;
+let failed = 0;
+
+for (const mod of modules) {
+ const path = join(__dirname, 'js', mod);
+ try {
+ const content = fs.readFileSync(path, 'utf8');
+
+ // Check for proper export statements
+ const hasExports = content.includes('export ');
+ const hasImports = content.includes('import ');
+
+ // Check for common syntax errors
+ const hasBalancedBraces = (content.match(/{/g) || []).length === (content.match(/}/g) || []).length;
+ const hasBalancedParens = (content.match(/\(/g) || []).length === (content.match(/\)/g) || []).length;
+ const hasBalancedBrackets = (content.match(/\[/g) || []).length === (content.match(/\]/g) || []).length;
+
+ // Count exports
+ const exportCount = (content.match(/export (const|function|async function|let|class)/g) || []).length;
+
+ // Count imports
+ const importCount = (content.match(/^import /gm) || []).length;
+
+ if (hasBalancedBraces && hasBalancedParens && hasBalancedBrackets) {
+ console.log(`✓ ${mod.padEnd(20)} - ${exportCount} exports, ${importCount} imports, syntax OK`);
+ passed++;
+ } else {
+ console.log(`✗ ${mod.padEnd(20)} - Unbalanced brackets/braces`);
+ failed++;
+ }
+ } catch (e) {
+ console.log(`✗ ${mod.padEnd(20)} - Error: ${e.message}`);
+ failed++;
+ }
+}
+
+console.log('\n=== FILE SIZE CHECK ===\n');
+
+let totalLines = 0;
+for (const mod of modules) {
+ const path = join(__dirname, 'js', mod);
+ const content = fs.readFileSync(path, 'utf8');
+ const lines = content.split('\n').length;
+ totalLines += lines;
+ console.log(` ${mod.padEnd(20)} ${lines.toString().padStart(5)} lines`);
+}
+
+const cssLines = fs.readFileSync(join(__dirname, 'styles.css'), 'utf8').split('\n').length;
+const htmlLines = fs.readFileSync(join(__dirname, 'index.html'), 'utf8').split('\n').length;
+
+console.log(` ${'styles.css'.padEnd(20)} ${cssLines.toString().padStart(5)} lines`);
+console.log(` ${'index.html'.padEnd(20)} ${htmlLines.toString().padStart(5)} lines`);
+console.log(` ${''.padEnd(20)} -----`);
+console.log(` ${'TOTAL'.padEnd(20)} ${(totalLines + cssLines + htmlLines).toString().padStart(5)} lines`);
+
+console.log('\n=== DEPENDENCY CHECK ===\n');
+
+// Check that each module's imports are valid
+const moduleExports = {};
+
+for (const mod of modules) {
+ const path = join(__dirname, 'js', mod);
+ const content = fs.readFileSync(path, 'utf8');
+
+ // Extract exports
+ const exports = content.match(/export (const|function|async function) (\w+)/g) || [];
+ moduleExports[mod] = exports.map(e => e.split(' ').pop());
+}
+
+// Check imports reference valid exports
+for (const mod of modules) {
+ const path = join(__dirname, 'js', mod);
+ const content = fs.readFileSync(path, 'utf8');
+
+ const importLines = content.match(/import \{[^}]+\} from '[^']+'/g) || [];
+ let issues = [];
+
+ for (const line of importLines) {
+ const match = line.match(/from '\.\/(\w+)\.js'/);
+ if (match) {
+ const targetMod = match[1] + '.js';
+ const imports = line.match(/\{([^}]+)\}/)[1].split(',').map(s => s.trim());
+
+ for (const imp of imports) {
+ if (moduleExports[targetMod] && !moduleExports[targetMod].includes(imp)) {
+ issues.push(`'${imp}' not exported from ${targetMod}`);
+ }
+ }
+ }
+ }
+
+ if (issues.length === 0) {
+ console.log(`✓ ${mod.padEnd(20)} - All imports valid`);
+ } else {
+ console.log(`? ${mod.padEnd(20)} - Check: ${issues.slice(0,2).join(', ')}`);
+ }
+}
+
+console.log('\n=== SUMMARY ===\n');
+console.log(`Passed: ${passed}/${modules.length}`);
+console.log(`Failed: ${failed}/${modules.length}`);
+console.log(failed === 0 ? '\n✓ ALL MODULES VALID' : '\n✗ SOME MODULES HAVE ISSUES');