Skip to content

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

TypeScript

Add Finnhub market data, World Leaders panel, and cleanup

Sean Thielen-Esparzadc597ef3ce91
diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000..91d226c
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,4 @@
+# Finnhub API Key
+# Get your free key at: https://finnhub.io/
+# Free tier: 60 calls/minute
+VITE_FINNHUB_API_KEY=your_api_key_here
diff --git a/src/lib/api/index.ts b/src/lib/api/index.ts
index 169bfa3..a689992 100644
--- a/src/lib/api/index.ts
+++ b/src/lib/api/index.ts
@@ -12,3 +12,4 @@ export {
} from './markets';
export { fetchPolymarket, fetchWhaleTransactions, fetchGovContracts, fetchLayoffs } from './misc';
export type { Prediction, WhaleTransaction, Contract, Layoff } from './misc';
+export { fetchWorldLeaders } from './leaders';
diff --git a/src/lib/api/leaders.ts b/src/lib/api/leaders.ts
new file mode 100644
index 0000000..589fcf5
--- /dev/null
+++ b/src/lib/api/leaders.ts
@@ -0,0 +1,90 @@
+/**
+ * World Leaders API - Fetch news for world leaders from GDELT
+ */
+
+import { WORLD_LEADERS } from '$lib/config/leaders';
+import type { WorldLeader, LeaderNews } from '$lib/types';
+import { CORS_PROXY_URL, logger } from '$lib/config/api';
+
+interface GdeltArticle {
+ title: string;
+ url: string;
+ seendate: string;
+ domain: string;
+}
+
+interface GdeltResponse {
+ articles?: GdeltArticle[];
+}
+
+/**
+ * Fetch news for a single leader
+ */
+async function fetchLeaderNews(leader: WorldLeader): Promise<WorldLeader> {
+ // Build query from leader's keywords
+ const query = leader.keywords.map((k) => `"${k}"`).join(' OR ');
+
+ try {
+ const gdeltUrl = `https://api.gdeltproject.org/api/v2/doc/doc?query=${query}&mode=artlist&maxrecords=5&format=json&sort=date`;
+ const proxyUrl = CORS_PROXY_URL + encodeURIComponent(gdeltUrl);
+
+ const response = await fetch(proxyUrl);
+ if (!response.ok) {
+ throw new Error(`HTTP ${response.status}`);
+ }
+
+ const contentType = response.headers.get('content-type');
+ if (!contentType?.includes('application/json')) {
+ return { ...leader, news: [] };
+ }
+
+ const text = await response.text();
+ let data: GdeltResponse;
+ try {
+ data = JSON.parse(text);
+ } catch {
+ return { ...leader, news: [] };
+ }
+
+ const news: LeaderNews[] = (data.articles || []).map((article) => ({
+ source: article.domain || 'Unknown',
+ title: article.title || '',
+ link: article.url || '',
+ pubDate: article.seendate || ''
+ }));
+
+ return { ...leader, news };
+ } catch (error) {
+ logger.warn('Leaders API', `Error fetching news for ${leader.name}:`, error);
+ return { ...leader, news: [] };
+ }
+}
+
+/**
+ * Fetch news for all world leaders
+ * Batches requests to avoid rate limits
+ */
+export async function fetchWorldLeaders(): Promise<WorldLeader[]> {
+ const batchSize = 5;
+ const results: WorldLeader[] = [];
+
+ // Fetch in batches to avoid rate limits
+ for (let i = 0; i < WORLD_LEADERS.length; i += batchSize) {
+ const batch = WORLD_LEADERS.slice(i, i + batchSize);
+ const batchResults = await Promise.allSettled(batch.map(fetchLeaderNews));
+
+ for (const result of batchResults) {
+ if (result.status === 'fulfilled') {
+ results.push(result.value);
+ }
+ }
+
+ // Small delay between batches
+ if (i + batchSize < WORLD_LEADERS.length) {
+ await new Promise((resolve) => setTimeout(resolve, 300));
+ }
+ }
+
+ // Sort by news activity (leaders with more news first)
+ return results.sort((a, b) => (b.news?.length || 0) - (a.news?.length || 0));
+}
diff --git a/src/lib/api/markets.ts b/src/lib/api/markets.ts
index 719a27a..3b8fc5c 100644
--- a/src/lib/api/markets.ts
+++ b/src/lib/api/markets.ts
@@ -1,10 +1,13 @@
/**
- * Markets API - Fetch market data from various sources
+ * Markets API - Fetch market data from Finnhub
+ *
+ * Get your free API key at: https://finnhub.io/
+ * Free tier: 60 calls/minute
*/
import { INDICES, SECTORS, COMMODITIES, CRYPTO } from '$lib/config/markets';
import type { MarketItem, SectorPerformance, CryptoItem } from '$lib/types';
-import { CORS_PROXY_URL, logger } from '$lib/config/api';
+import { CORS_PROXY_URL, logger, FINNHUB_API_KEY, FINNHUB_BASE_URL } from '$lib/config/api';
interface CoinGeckoPrice {
usd: number;
@@ -15,6 +18,58 @@ interface CoinGeckoPricesResponse {
[key: string]: CoinGeckoPrice;
}
+interface FinnhubQuote {
+ c: number; // Current price
+ d: number; // Change
+ dp: number; // Percent change
+ h: number; // High price of the day
+ l: number; // Low price of the day
+ o: number; // Open price of the day
+ pc: number; // Previous close price
+ t: number; // Timestamp
+}
+
+/**
+ * Check if Finnhub API key is configured
+ */
+function hasFinnhubApiKey(): boolean {
+ return Boolean(FINNHUB_API_KEY && FINNHUB_API_KEY.length > 0);
+}
+
+// Map index symbols to ETF proxies (free tier doesn't support direct indices)
+const INDEX_ETF_MAP: Record<string, string> = {
+ '^DJI': 'DIA', // Dow Jones -> SPDR Dow Jones ETF
+ '^GSPC': 'SPY', // S&P 500 -> SPDR S&P 500 ETF
+ '^IXIC': 'QQQ', // NASDAQ -> Invesco QQQ (NASDAQ-100)
+ '^RUT': 'IWM' // Russell 2000 -> iShares Russell 2000 ETF
+};
+
+/**
+ * Fetch a quote from Finnhub
+ */
+async function fetchFinnhubQuote(symbol: string): Promise<FinnhubQuote | null> {
+ try {
+ const url = `${FINNHUB_BASE_URL}/quote?symbol=${encodeURIComponent(symbol)}&token=${FINNHUB_API_KEY}`;
+ const response = await fetch(url);
+
+ if (!response.ok) {
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`);
+ }
+
+ const data: FinnhubQuote = await response.json();
+
+ // Finnhub returns all zeros when symbol not found
+ if (data.c === 0 && data.pc === 0) {
+ return null;
+ }
+
+ return data;
+ } catch (error) {
+ logger.error('Markets API', `Error fetching quote for ${symbol}:`, error);
+ return null;
+ }
+}
+
/**
* Fetch crypto prices from CoinGecko via proxy
*/
@@ -59,51 +114,156 @@ export async function fetchCryptoPrices(): Promise<CryptoItem[]> {
}
/**
- * Fetch market indices (via proxy for Yahoo Finance)
- * Note: Returns placeholder data - would need Yahoo Finance API or similar
+ * Fetch market indices from Finnhub
*/
export async function fetchIndices(): Promise<MarketItem[]> {
- // TODO: Implement real market data fetching
- // Options: Yahoo Finance API, Alpha Vantage, Polygon.io
- return INDICES.map((index) => ({
- symbol: index.symbol,
- name: index.name,
- price: NaN, // NaN indicates data not available
- change: NaN,
- changePercent: NaN,
- type: 'index' as const
- }));
+ if (!hasFinnhubApiKey()) {
+ logger.warn('Markets API', 'Finnhub API key not configured. Add VITE_FINNHUB_API_KEY to .env');
+ return INDICES.map((index) => ({
+ symbol: index.symbol,
+ name: index.name,
+ price: NaN,
+ change: NaN,
+ changePercent: NaN,
+ type: 'index' as const
+ }));
+ }
+
+ try {
+ logger.log('Markets API', 'Fetching indices from Finnhub');
+
+ // Fetch all indices in parallel (using ETF proxies)
+ const quotes = await Promise.all(
+ INDICES.map(async (index) => {
+ const etfSymbol = INDEX_ETF_MAP[index.symbol] || index.symbol;
+ const quote = await fetchFinnhubQuote(etfSymbol);
+ return { index, quote };
+ })
+ );
+
+ return quotes.map(({ index, quote }) => ({
+ symbol: index.symbol,
+ name: index.name,
+ price: quote?.c ?? NaN,
+ change: quote?.d ?? NaN,
+ changePercent: quote?.dp ?? NaN,
+ type: 'index' as const
+ }));
+ } catch (error) {
+ logger.error('Markets API', 'Error fetching indices:', error);
+ return INDICES.map((index) => ({
+ symbol: index.symbol,
+ name: index.name,
+ price: NaN,
+ change: NaN,
+ changePercent: NaN,
+ type: 'index' as const
+ }));
+ }
}
/**
- * Fetch sector performance
- * Note: Returns placeholder data - would need market data provider
+ * Fetch sector performance from Finnhub (using sector ETFs)
*/
export async function fetchSectorPerformance(): Promise<SectorPerformance[]> {
- // TODO: Implement real sector data fetching
- return SECTORS.map((sector) => ({
- symbol: sector.symbol,
- name: sector.name,
- price: NaN,
- change: NaN,
- changePercent: NaN
- }));
+ if (!hasFinnhubApiKey()) {
+ logger.warn('Markets API', 'Finnhub API key not configured');
+ return SECTORS.map((sector) => ({
+ symbol: sector.symbol,
+ name: sector.name,
+ price: NaN,
+ change: NaN,
+ changePercent: NaN
+ }));
+ }
+
+ try {
+ logger.log('Markets API', 'Fetching sector performance from Finnhub');
+
+ // Fetch all sector ETFs in parallel
+ const quotes = await Promise.all(
+ SECTORS.map(async (sector) => {
+ const quote = await fetchFinnhubQuote(sector.symbol);
+ return { sector, quote };
+ })
+ );
+
+ return quotes.map(({ sector, quote }) => ({
+ symbol: sector.symbol,
+ name: sector.name,
+ price: quote?.c ?? NaN,
+ change: quote?.d ?? NaN,
+ changePercent: quote?.dp ?? NaN
+ }));
+ } catch (error) {
+ logger.error('Markets API', 'Error fetching sectors:', error);
+ return SECTORS.map((sector) => ({
+ symbol: sector.symbol,
+ name: sector.name,
+ price: NaN,
+ change: NaN,
+ changePercent: NaN
+ }));
+ }
}
+// Finnhub commodity ETF proxies (free tier doesn't support direct commodities)
+const COMMODITY_SYMBOL_MAP: Record<string, string> = {
+ '^VIX': 'VIXY', // VIX -> ProShares VIX Short-Term Futures ETF
+ 'GC=F': 'GLD', // Gold -> SPDR Gold Shares
+ 'CL=F': 'USO', // Crude Oil -> United States Oil Fund
+ 'NG=F': 'UNG', // Natural Gas -> United States Natural Gas Fund
+ 'SI=F': 'SLV', // Silver -> iShares Silver Trust
+ 'HG=F': 'CPER' // Copper -> United States Copper Index Fund
+};
+
/**
- * Fetch commodities
- * Note: Returns placeholder data - would need commodities data provider
+ * Fetch commodities from Finnhub
*/
export async function fetchCommodities(): Promise<MarketItem[]> {
- // TODO: Implement real commodities data fetching
- return COMMODITIES.map((commodity) => ({
- symbol: commodity.symbol,
- name: commodity.name,
- price: NaN,
- change: NaN,
- changePercent: NaN,
- type: 'commodity' as const
- }));
+ if (!hasFinnhubApiKey()) {
+ logger.warn('Markets API', 'Finnhub API key not configured');
+ return COMMODITIES.map((commodity) => ({
+ symbol: commodity.symbol,
+ name: commodity.name,
+ price: NaN,
+ change: NaN,
+ changePercent: NaN,
+ type: 'commodity' as const
+ }));
+ }
+
+ try {
+ logger.log('Markets API', 'Fetching commodities from Finnhub');
+
+ // Fetch all commodities in parallel
+ const quotes = await Promise.all(
+ COMMODITIES.map(async (commodity) => {
+ const finnhubSymbol = COMMODITY_SYMBOL_MAP[commodity.symbol] || commodity.symbol;
+ const quote = await fetchFinnhubQuote(finnhubSymbol);
+ return { commodity, quote };
+ })
+ );
+
+ return quotes.map(({ commodity, quote }) => ({
+ symbol: commodity.symbol,
+ name: commodity.name,
+ price: quote?.c ?? NaN,
+ change: quote?.d ?? NaN,
+ changePercent: quote?.dp ?? NaN,
+ type: 'commodity' as const
+ }));
+ } catch (error) {
+ logger.error('Markets API', 'Error fetching commodities:', error);
+ return COMMODITIES.map((commodity) => ({
+ symbol: commodity.symbol,
+ name: commodity.name,
+ price: NaN,
+ change: NaN,
+ changePercent: NaN,
+ type: 'commodity' as const
+ }));
+ }
}
/**
diff --git a/src/lib/api/news.ts b/src/lib/api/news.ts
index 981dab5..038c2c3 100644
--- a/src/lib/api/news.ts
+++ b/src/lib/api/news.ts
@@ -27,6 +27,21 @@ function delay(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}
+/**
+ * Parse GDELT date format (20251202T224500Z) to valid Date
+ */
+function parseGdeltDate(dateStr: string): Date {
+ if (!dateStr) return new Date();
+ // Convert 20251202T224500Z to 2025-12-02T22:45:00Z
+ const match = dateStr.match(/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z$/);
+ if (match) {
+ const [, year, month, day, hour, min, sec] = match;
+ return new Date(`${year}-${month}-${day}T${hour}:${min}:${sec}Z`);
+ }
+ // Fallback to standard parsing
+ return new Date(dateStr);
+}
+
interface GdeltArticle {
title: string;
url: string;
@@ -54,12 +69,14 @@ function transformGdeltArticle(
const urlHash = article.url ? hashCode(article.url) : Math.random().toString(36).slice(2);
const uniqueId = `gdelt-${category}-${urlHash}-${index}`;
+ const parsedDate = parseGdeltDate(article.seendate);
+
return {
id: uniqueId,
title,
link: article.url,
pubDate: article.seendate,
- timestamp: article.seendate ? new Date(article.seendate).getTime() : Date.now(),
+ timestamp: parsedDate.getTime(),
source: source || article.domain || 'Unknown',
category,
isAlert: !!alert,
diff --git a/src/lib/components/panels/WorldLeadersPanel.svelte b/src/lib/components/panels/WorldLeadersPanel.svelte
new file mode 100644
index 0000000..95875ac
--- /dev/null
+++ b/src/lib/components/panels/WorldLeadersPanel.svelte
@@ -0,0 +1,212 @@
+<script lang="ts">
+ import { Panel } from '$lib/components/common';
+ import type { WorldLeader } from '$lib/types';
+
+ interface Props {
+ leaders?: WorldLeader[];
+ loading?: boolean;
+ error?: string | null;
+ }
+
+ let { leaders = [], loading = false, error = null }: Props = $props();
+
+ const count = $derived(leaders.length);
+
+ function getActivityClass(newsCount: number): string {
+ if (newsCount >= 3) return 'high-activity';
+ if (newsCount >= 1) return 'active';
+ return '';
+ }
+</script>
+
+<Panel id="leaders" title="World Leaders" {count} {loading} {error}>
+ {#if leaders.length === 0 && !loading && !error}
+ <div class="empty-state">No leaders data available</div>
+ {:else}
+ <div class="leaders-grid">
+ {#each leaders as leader (leader.id)}
+ {@const newsCount = leader.news?.length || 0}
+ {@const activityClass = getActivityClass(newsCount)}
+ {@const latestNews = leader.news?.slice(0, 2) || []}
+ <div class="leader-card {activityClass}">
+ <div class="leader-header">
+ <span class="leader-flag">{leader.flag}</span>
+ <div class="leader-info">
+ <div class="leader-name">{leader.name}</div>
+ <div class="leader-title">{leader.title}</div>
+ <div class="leader-country">{leader.country}</div>
+ </div>
+ {#if newsCount > 0}
+ <div class="leader-activity-badge">{newsCount}</div>
+ {/if}
+ </div>
+ <div class="leader-meta">
+ <span class="leader-since">Since {leader.since}</span>
+ <span class="leader-party">{leader.party}</span>
+ </div>
+ {#if leader.focus && leader.focus.length > 0}
+ <div class="leader-focus-topics">
+ {#each leader.focus.slice(0, 3) as topic}
+ <span class="leader-focus">{topic}</span>
+ {/each}
+ </div>
+ {/if}
+ {#if latestNews.length > 0}
+ <div class="leader-news">
+ {#each latestNews as news}
+ <a href={news.link} target="_blank" class="leader-news-item" title={news.title}>
+ {news.title.length > 60 ? news.title.substring(0, 60) + '...' : news.title}
+ </a>
+ {/each}
+ </div>
+ {/if}
+ </div>
+ {/each}
+ </div>
+ {/if}
+</Panel>
+
+<style>
+ .leaders-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
+ gap: 0.75rem;
+ }
+
+ .leader-card {
+ background: var(--surface);
+ border: 1px solid var(--border);
+ border-radius: 6px;
+ padding: 0.75rem;
+ transition: all 0.2s;
+ }
+
+ .leader-card:hover {
+ border-color: var(--border-light);
+ background: var(--surface-hover);
+ }
+
+ .leader-card.active {
+ border-color: var(--info);
+ }
+
+ .leader-card.high-activity {
+ border-color: var(--warning);
+ box-shadow: 0 0 8px rgba(255, 170, 0, 0.2);
+ }
+
+ .leader-header {
+ display: flex;
+ align-items: flex-start;
+ gap: 0.5rem;
+ margin-bottom: 0.5rem;
+ }
+
+ .leader-flag {
+ font-size: 1.5rem;
+ line-height: 1;
+ }
+
+ .leader-info {
+ flex: 1;
+ min-width: 0;
+ }
+
+ .leader-name {
+ font-size: 0.8rem;
+ font-weight: 600;
+ color: var(--text-primary);
+ line-height: 1.2;
+ }
+
+ .leader-title {
+ font-size: 0.65rem;
+ color: var(--text-dim);
+ margin-top: 0.1rem;
+ }
+
+ .leader-country {
+ font-size: 0.6rem;
+ color: var(--text-muted);
+ margin-top: 0.15rem;
+ }
+
+ .leader-activity-badge {
+ background: var(--info);
+ color: #000;
+ font-size: 0.55rem;
+ font-weight: bold;
+ padding: 0.15rem 0.35rem;
+ border-radius: 3px;
+ min-width: 18px;
+ text-align: center;
+ }
+
+ .leader-card.high-activity .leader-activity-badge {
+ background: var(--warning);
+ }
+
+ .leader-meta {
+ display: flex;
+ gap: 0.5rem;
+ font-size: 0.55rem;
+ color: var(--text-muted);
+ margin-bottom: 0.5rem;
+ }
+
+ .leader-since {
+ color: var(--text-dim);
+ }
+
+ .leader-party {
+ color: var(--text-muted);
+ opacity: 0.8;
+ }
+
+ .leader-focus-topics {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.25rem;
+ margin-bottom: 0.5rem;
+ }
+
+ .leader-focus {
+ font-size: 0.5rem;
+ background: rgba(68, 136, 255, 0.15);
+ color: var(--info);
+ padding: 0.1rem 0.35rem;
+ border-radius: 3px;
+ text-transform: lowercase;
+ }
+
+ .leader-news {
+ border-top: 1px solid var(--border);
+ padding-top: 0.5rem;
+ margin-top: 0.25rem;
+ }
+
+ .leader-news-item {
+ display: block;
+ font-size: 0.6rem;
+ color: var(--text-dim);
+ text-decoration: none;
+ padding: 0.25rem 0;
+ line-height: 1.3;
+ border-bottom: 1px solid var(--border);
+ }
+
+ .leader-news-item:last-child {
+ border-bottom: none;
+ }
+
+ .leader-news-item:hover {
+ color: var(--text-primary);
+ }
+
+ .empty-state {
+ text-align: center;
+ color: var(--text-secondary);
+ font-size: 0.7rem;
+ padding: 1rem;
+ }
+</style>
diff --git a/src/lib/components/panels/index.ts b/src/lib/components/panels/index.ts
index 355a792..4181ec8 100644
--- a/src/lib/components/panels/index.ts
+++ b/src/lib/components/panels/index.ts
@@ -16,3 +16,4 @@ export { default as CorrelationPanel } from './CorrelationPanel.svelte';
export { default as NarrativePanel } from './NarrativePanel.svelte';
export { default as MonitorsPanel } from './MonitorsPanel.svelte';
export { default as MapPanel } from './MapPanel.svelte';
+export { default as WorldLeadersPanel } from './WorldLeadersPanel.svelte';
diff --git a/src/lib/config/api.ts b/src/lib/config/api.ts
index 8b64cbb..b68275c 100644
--- a/src/lib/config/api.ts
+++ b/src/lib/config/api.ts
@@ -4,6 +4,17 @@
import { browser } from '$app/environment';
+/**
+ * Finnhub API key
+ * Get your free key at: https://finnhub.io/
+ * Free tier: 60 calls/minute
+ */
+export const FINNHUB_API_KEY = browser
+ ? (import.meta.env?.VITE_FINNHUB_API_KEY ?? '')
+ : (process.env.VITE_FINNHUB_API_KEY ?? '');
+
+export const FINNHUB_BASE_URL = 'https://finnhub.io/api/v1';
+
/**
* Check if we're in development mode
* Uses import.meta.env which is available in both browser and test environments
@@ -12,8 +23,11 @@ const isDev = browser ? (import.meta.env?.DEV ?? false) : false;
/**
* CORS proxy URL for external API requests
+ * Uses public proxy in development (custom proxy doesn't allow localhost)
*/
-export const CORS_PROXY_URL = 'https://situation-monitor-proxy.seanthielen-e.workers.dev/?url=';
+export const CORS_PROXY_URL = isDev
+ ? 'https://corsproxy.io/?url='
+ : 'https://situation-monitor-proxy.seanthielen-e.workers.dev/?url=';
/**
* API request delays (ms) to avoid rate limiting
diff --git a/src/lib/config/index.ts b/src/lib/config/index.ts
index 1be3c22..9316ed0 100644
--- a/src/lib/config/index.ts
+++ b/src/lib/config/index.ts
@@ -80,4 +80,7 @@ export {
} from './presets';
// API configuration
-export { CORS_PROXY_URL, API_DELAYS, CACHE_TTLS, DEBUG, logger } from './api';
+export { CORS_PROXY_URL, API_DELAYS, CACHE_TTLS, DEBUG, logger, FINNHUB_API_KEY, FINNHUB_BASE_URL } from './api';
+
+// World leaders configuration
+export { WORLD_LEADERS } from './leaders';
diff --git a/src/lib/config/leaders.ts b/src/lib/config/leaders.ts
new file mode 100644
index 0000000..1d7142f
--- /dev/null
+++ b/src/lib/config/leaders.ts
@@ -0,0 +1,229 @@
+/**
+ * World Leaders configuration for tracking
+ */
+
+import type { WorldLeader } from '$lib/types';
+
+export const WORLD_LEADERS: WorldLeader[] = [
+ // United States
+ {
+ id: 'trump',
+ name: 'Donald Trump',
+ title: 'President',
+ country: 'United States',
+ flag: '🇺🇸',
+ keywords: ['trump', 'potus', 'white house'],
+ since: 'Jan 2025',
+ party: 'Republican',
+ focus: ['tariffs', 'immigration', 'deregulation']
+ },
+ {
+ id: 'vance',
+ name: 'JD Vance',
+ title: 'Vice President',
+ country: 'United States',
+ flag: '🇺🇸',
+ keywords: ['jd vance', 'vice president vance'],
+ since: 'Jan 2025',
+ party: 'Republican'
+ },
+
+ // China
+ {
+ id: 'xi',
+ name: 'Xi Jinping',
+ title: 'President',
+ country: 'China',
+ flag: '🇨🇳',
+ keywords: ['xi jinping', 'xi', 'chinese president'],
+ since: 'Mar 2013',
+ party: 'CCP',
+ focus: ['taiwan', 'belt and road', 'tech dominance']
+ },
+
+ // Russia
+ {
+ id: 'putin',
+ name: 'Vladimir Putin',
+ title: 'President',
+ country: 'Russia',
+ flag: '🇷🇺',
+ keywords: ['putin', 'kremlin', 'russian president'],
+ since: 'May 2012',
+ party: 'United Russia',
+ focus: ['ukraine war', 'nato expansion', 'energy']
+ },
+
+ // Europe
+ {
+ id: 'starmer',
+ name: 'Keir Starmer',
+ title: 'Prime Minister',
+ country: 'United Kingdom',
+ flag: '🇬🇧',
+ keywords: ['starmer', 'uk pm', 'british prime minister'],
+ since: 'Jul 2024',
+ party: 'Labour'
+ },
+ {
+ id: 'macron',
+ name: 'Emmanuel Macron',
+ title: 'President',
+ country: 'France',
+ flag: '🇫🇷',
+ keywords: ['macron', 'french president', 'elysee'],
+ since: 'May 2017',
+ party: 'Renaissance'
+ },
+ {
+ id: 'scholz',
+ name: 'Olaf Scholz',
+ title: 'Chancellor',
+ country: 'Germany',
+ flag: '🇩🇪',
+ keywords: ['scholz', 'german chancellor', 'berlin'],
+ since: 'Dec 2021',
+ party: 'SPD'
+ },
+ {
+ id: 'meloni',
+ name: 'Giorgia Meloni',
+ title: 'Prime Minister',
+ country: 'Italy',
+ flag: '🇮🇹',
+ keywords: ['meloni', 'italian pm', 'italy prime minister'],
+ since: 'Oct 2022',
+ party: 'Brothers of Italy'
+ },
+
+ // Middle East
+ {
+ id: 'netanyahu',
+ name: 'Benjamin Netanyahu',
+ title: 'Prime Minister',
+ country: 'Israel',
+ flag: '🇮🇱',
+ keywords: ['netanyahu', 'bibi', 'israeli pm'],
+ since: 'Dec 2022',
+ party: 'Likud',
+ focus: ['gaza', 'iran', 'judicial reform']
+ },
+ {
+ id: 'mbs',
+ name: 'Mohammed bin Salman',
+ title: 'Crown Prince',
+ country: 'Saudi Arabia',
+ flag: '🇸🇦',
+ keywords: ['mbs', 'saudi crown prince', 'bin salman'],
+ since: 'Jun 2017',
+ party: 'Royal Family',
+ focus: ['vision 2030', 'oil', 'regional influence']
+ },
+ {
+ id: 'khamenei',
+ name: 'Ali Khamenei',
+ title: 'Supreme Leader',
+ country: 'Iran',
+ flag: '🇮🇷',
+ keywords: ['khamenei', 'supreme leader', 'ayatollah'],
+ since: 'Jun 1989',
+ party: 'Islamic Republic',
+ focus: ['nuclear program', 'proxies', 'sanctions']
+ },
+
+ // Asia-Pacific
+ {
+ id: 'modi',
+ name: 'Narendra Modi',
+ title: 'Prime Minister',
+ country: 'India',
+ flag: '🇮🇳',
+ keywords: ['modi', 'indian pm', 'india prime minister'],
+ since: 'May 2014',
+ party: 'BJP',
+ focus: ['economy', 'china border', 'technology']
+ },
+ {
+ id: 'kim',
+ name: 'Kim Jong Un',
+ title: 'Supreme Leader',
+ country: 'North Korea',
+ flag: '🇰🇵',
+ keywords: ['kim jong un', 'north korea', 'pyongyang'],
+ since: 'Dec 2011',
+ party: 'Workers Party',
+ focus: ['nuclear', 'missiles', 'russia alliance']
+ },
+ {
+ id: 'ishiba',
+ name: 'Shigeru Ishiba',
+ title: 'Prime Minister',
+ country: 'Japan',
+ flag: '🇯🇵',
+ keywords: ['ishiba', 'japanese pm', 'japan prime minister'],
+ since: 'Oct 2024',
+ party: 'LDP',
+ focus: ['defense', 'china', 'us alliance']
+ },
+ {
+ id: 'lai',
+ name: 'Lai Ching-te',
+ title: 'President',
+ country: 'Taiwan',
+ flag: '🇹🇼',
+ keywords: ['lai ching-te', 'taiwan president', 'taipei'],
+ since: 'May 2024',
+ party: 'DPP',
+ focus: ['china relations', 'defense', 'semiconductors']
+ },
+
+ // Ukraine
+ {
+ id: 'zelensky',
+ name: 'Volodymyr Zelensky',
+ title: 'President',
+ country: 'Ukraine',
+ flag: '🇺🇦',
+ keywords: ['zelensky', 'ukraine president', 'kyiv'],
+ since: 'May 2019',
+ party: 'Servant of the People',
+ focus: ['war', 'western aid', 'nato membership']
+ },
+
+ // Latin America
+ {
+ id: 'milei',
+ name: 'Javier Milei',
+ title: 'President',
+ country: 'Argentina',
+ flag: '🇦🇷',
+ keywords: ['milei', 'argentina president', 'buenos aires'],
+ since: 'Dec 2023',
+ party: 'La Libertad Avanza',
+ focus: ['dollarization', 'spending cuts', 'deregulation']
+ },
+ {
+ id: 'lula',
+ name: 'Luiz Inácio Lula da Silva',
+ title: 'President',
+ country: 'Brazil',
+ flag: '🇧🇷',
+ keywords: ['lula', 'brazil president', 'brasilia'],
+ since: 'Jan 2023',
+ party: 'PT',
+ focus: ['amazon', 'social programs', 'brics']
+ },
+
+ // Canada
+ {
+ id: 'carney',
+ name: 'Mark Carney',
+ title: 'Prime Minister',
+ country: 'Canada',
+ flag: '🇨🇦',
+ keywords: ['carney', 'canadian pm', 'canada prime minister', 'ottawa'],
+ since: 'Mar 2025',
+ party: 'Liberal',
+ focus: ['tariffs', 'us relations', 'economy']
+ }
+];
diff --git a/src/lib/config/panels.ts b/src/lib/config/panels.ts
index cc495c5..3d00fbf 100644
--- a/src/lib/config/panels.ts
+++ b/src/lib/config/panels.ts
@@ -28,6 +28,7 @@ export type PanelId =
| 'venezuela'
| 'greenland'
| 'iran'
+ | 'leaders'
| 'intel'
| 'correlation'
| 'narrative';
@@ -53,6 +54,7 @@ export const PANELS: Record<PanelId, PanelConfig> = {
venezuela: { name: 'Venezuela Situation', priority: 2 },
greenland: { name: 'Greenland Situation', priority: 2 },
iran: { name: 'Iran Situation', priority: 2 },
+ leaders: { name: 'World Leaders', priority: 1 },
intel: { name: 'Intel Feed', priority: 2 },
correlation: { name: 'Correlation Engine', priority: 1 },
narrative: { name: 'Narrative Tracker', priority: 1 }
diff --git a/src/lib/config/presets.ts b/src/lib/config/presets.ts
index c2bf72d..9458c5f 100644
--- a/src/lib/config/presets.ts
+++ b/src/lib/config/presets.ts
@@ -45,6 +45,7 @@ export const PRESETS: Record<string, Preset> = {
panels: [
'map',
'intel',
+ 'leaders',
'politics',
'gov',
'venezuela',
@@ -59,7 +60,7 @@ export const PRESETS: Record<string, Preset> = {
name: 'Intelligence Analyst',
icon: '🔍',
description: 'Deep analysis, pattern detection, and narrative tracking',
- panels: ['map', 'intel', 'correlation', 'narrative', 'mainchar', 'politics']
+ panels: ['map', 'intel', 'leaders', 'correlation', 'narrative', 'mainchar', 'politics']
},
minimal: {
id: 'minimal',
@@ -94,6 +95,7 @@ export const PRESETS: Record<string, Preset> = {
'venezuela',
'greenland',
'iran',
+ 'leaders',
'intel',
'correlation',
'narrative'
diff --git a/src/lib/types/index.ts b/src/lib/types/index.ts
index b416062..9f79f41 100644
--- a/src/lib/types/index.ts
+++ b/src/lib/types/index.ts
@@ -299,3 +299,29 @@ export interface SettingsState {
panelOrder: string[];
theme: 'dark' | 'light';
}
+
+/**
+ * News item for a world leader
+ */
+export interface LeaderNews {
+ source: string;
+ title: string;
+ link: string;
+ pubDate: string;
+}
+
+/**
+ * World leader tracking data
+ */
+export interface WorldLeader {
+ id: string;
+ name: string;
+ title: string;
+ country: string;
+ flag: string;
+ keywords: string[];
+ since: string;
+ party: string;
+ focus?: string[];
+ news?: LeaderNews[];
+}
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 212f19e..29ecda3 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -18,7 +18,9 @@
ContractsPanel,
LayoffsPanel,
IntelPanel,
- SituationPanel
+ SituationPanel,
+ WorldLeadersPanel,
+ PrinterPanel
} from '$lib/components/panels';
import {
news,
@@ -39,10 +41,11 @@
fetchPolymarket,
fetchWhaleTransactions,
fetchGovContracts,
- fetchLayoffs
+ fetchLayoffs,
+ fetchWorldLeaders
} from '$lib/api';
import type { Prediction, WhaleTransaction, Contract, Layoff } from '$lib/api';
- import type { CustomMonitor } from '$lib/types';
+ import type { CustomMonitor, WorldLeader } from '$lib/types';
// Modal state
let settingsOpen = $state(false);
@@ -55,6 +58,8 @@
let whales = $state<WhaleTransaction[]>([]);
let contracts = $state<Contract[]>([]);
let layoffs = $state<Layoff[]>([]);
+ let leaders = $state<WorldLeader[]>([]);
+ let leadersLoading = $state(false);
// Derived data for panels that need aggregated news
const allNewsItems = $derived([
@@ -111,6 +116,18 @@
}
}
+ async function loadWorldLeaders() {
+ if (!isPanelVisible('leaders')) return;
+ leadersLoading = true;
+ try {
+ leaders = await fetchWorldLeaders();
+ } catch (error) {
+ console.error('Failed to load world leaders:', error);
+ } finally {
+ leadersLoading = false;
+ }
+ }
+
// Refresh handlers
async function handleRefresh() {
refresh.startRefresh();
@@ -170,6 +187,7 @@
loadNews();
loadMarkets();
loadMiscData();
+ loadWorldLeaders();
refresh.setupAutoRefresh(handleRefresh);
return () => {
@@ -270,24 +288,17 @@
</div>
{/if}
- <!-- Custom Monitors -->
- {#if isPanelVisible('monitors')}
+ <!-- Intel Panel -->
+ {#if isPanelVisible('intel')}
<div class="panel-slot">
- <MonitorsPanel
- monitors={$monitors.monitors}
- matches={$monitors.matches}
- onCreateMonitor={handleCreateMonitor}
- onEditMonitor={handleEditMonitor}
- onDeleteMonitor={handleDeleteMonitor}
- onToggleMonitor={handleToggleMonitor}
- />
+ <IntelPanel />
</div>
{/if}
- <!-- Intel Panel -->
- {#if isPanelVisible('intel')}
+ <!-- World Leaders Panel -->
+ {#if isPanelVisible('leaders')}
<div class="panel-slot">
- <IntelPanel />
+ <WorldLeadersPanel {leaders} loading={leadersLoading} />
</div>
{/if}
@@ -382,6 +393,27 @@
<LayoffsPanel {layoffs} />
</div>
{/if}
+
+ <!-- Money Printer Panel -->
+ {#if isPanelVisible('printer')}
+ <div class="panel-slot">
+ <PrinterPanel />
+ </div>
+ {/if}
+
+ <!-- Custom Monitors (always last) -->
+ {#if isPanelVisible('monitors')}
+ <div class="panel-slot">
+ <MonitorsPanel
+ monitors={$monitors.monitors}
+ matches={$monitors.matches}
+ onCreateMonitor={handleCreateMonitor}
+ onEditMonitor={handleEditMonitor}
+ onDeleteMonitor={handleDeleteMonitor}
+ onToggleMonitor={handleToggleMonitor}
+ />
+ </div>
+ {/if}
</Dashboard>
</main>
diff --git a/static/index.html b/static/index.html
deleted file mode 100644
index ca6ebc3..0000000
--- a/static/index.html
+++ /dev/null
@@ -1,1291 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Situation Monitor</title>
- <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">
- <!-- Hamburger menu (hidden on desktop) -->
- <button class="hamburger-btn" id="hamburgerBtn" onclick="toggleMobileMenu()" aria-label="Menu">
- <span class="hamburger-line"></span>
- <span class="hamburger-line"></span>
- <span class="hamburger-line"></span>
- </button>
-
- <!-- Mobile menu dropdown -->
- <div class="mobile-menu" id="mobileMenu">
- <button class="refresh-btn monitors-btn" onclick="openMonitorForm(); closeMobileMenu()">+ Monitor</button>
- <button class="settings-btn" onclick="toggleSettings(); closeMobileMenu()">Panels</button>
- <button class="refresh-btn" onclick="refreshAll(); closeMobileMenu()">Refresh</button>
- </div>
-
- <!-- Desktop nav (hidden on mobile) -->
- <div class="desktop-nav">
- <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>
- </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">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>
- <button class="settings-reset" onclick="resetOnboarding()" style="margin-top: 0.5rem;">Reconfigure Dashboard</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>
-
- <!-- Onboarding Modal -->
- <div class="onboarding-modal" id="onboardingModal">
- <div class="onboarding-content">
- <div class="onboarding-header">
- <div class="onboarding-title">Welcome to Situation Monitor</div>
- <div class="onboarding-subtitle">Choose a profile to get started</div>
- </div>
- <div class="preset-cards" id="presetCards">
- <!-- Preset cards rendered by JS -->
- </div>
- <div class="onboarding-footer">
- You can change this later in Settings
- </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" style="font-size: 9px;">
- <span style="color: #00ff88;">● Low</span>
- <span style="color: #ffcc00; margin-left: 0.4rem;">● Elevated</span>
- <span style="color: #ff4444; margin-left: 0.4rem;">● High</span>
- <span style="color: #ff6600; margin-left: 0.4rem;">▲ Wx</span>
- <span style="color: #ff8800; margin-left: 0.4rem;">◉ Quake</span>
- <span style="color: #00aaff; margin-left: 0.4rem;">◆ Ship</span>
- <span style="color: #aa44ff; margin-left: 0.4rem;">◎ Cable</span>
- <span style="color: #ffff00; margin-left: 0.4rem;">☢ Nuke</span>
- <span style="color: #ff00ff; margin-left: 0.4rem;">★ Base</span>
- </span>
- </div>
- <div class="panel-content" id="mapPanel" style="max-height: none; height: 480px; overflow: hidden; background: #0a1a14; position: relative;">
- <svg id="mapSvg" style="width:100%;height:100%;"></svg>
- <div id="mapTooltip" style="position:absolute;display:none;background:rgba(0,20,15,0.95);border:1px solid #00ff88;padding:10px 14px;border-radius:4px;font-size:11px;color:#00ff88;pointer-events:none;z-index:1000;max-width:280px;font-family:monospace;line-height:1.4;"></div>
- <!-- Enhanced Iran Popup -->
- <div id="iranPopup" style="position:absolute;display:none;background:rgba(10,15,12,0.98);border:1px solid #ff4444;padding:0;border-radius:6px;font-size:11px;color:#e0e0e0;z-index:1001;width:420px;font-family:monospace;box-shadow:0 4px 20px rgba(0,0,0,0.5);overflow:hidden;max-height:90vh;overflow-y:auto;">
- <div style="background:linear-gradient(90deg,#5a1515,#3a1010);padding:12px 15px;border-bottom:1px solid #4a2020;">
- <div style="display:flex;justify-content:space-between;align-items:center;">
- <span style="color:#ff4444;font-weight:bold;font-size:13px;">🔥 IRAN CRISIS</span>
- <span style="background:#ff0000;color:#fff;padding:2px 8px;border-radius:3px;font-size:9px;font-weight:bold;animation:blink 1s infinite;">ACTIVE UPRISING</span>
- </div>
- <div style="color:#ff8888;font-size:9px;margin-top:4px;">Mass protests • Regime instability • Nuclear program</div>
- </div>
- <!-- Current Protests Section -->
- <div style="background:#2a1515;padding:12px 15px;border-bottom:1px solid #3a2020;">
- <div style="color:#ff6666;font-size:9px;text-transform:uppercase;letter-spacing:1px;margin-bottom:8px;">⚠️ Ongoing Revolution (Dec 2025–)</div>
- <div style="font-size:10px;line-height:1.5;">
- <div style="margin-bottom:6px;"><span style="color:#ff8888;">Status:</span> Largest uprising since 1979 Revolution</div>
- <div style="margin-bottom:6px;"><span style="color:#ff8888;">Scope:</span> 200+ cities across 26 provinces</div>
- <div style="margin-bottom:6px;"><span style="color:#ff8888;">Trigger:</span> Economic collapse, 52%+ inflation, currency crash</div>
- <div style="margin-bottom:6px;"><span style="color:#ff8888;">Internet:</span> <span style="color:#ffaa00;">Heavily restricted/cut</span></div>
- <div style="margin-bottom:6px;"><span style="color:#ff8888;">Slogans:</span> "Woman, Life, Freedom" + monarchist calls</div>
- </div>
- <div style="font-size:9px;color:#888;margin-top:8px;padding-top:8px;border-top:1px solid #3a2020;">
- ▸ "Tehran's Tank Man" - viral protest symbol<br>
- ▸ Cities Abdanan & Malekshahi abandoned by security forces<br>
- ▸ Regime deploying Hezbollah/Iraqi militias internally
- </div>
- </div>
- <div style="display:flex;">
- <div style="flex:1;padding:12px 15px;border-right:1px solid #2a2020;">
- <div style="color:#ff6666;font-size:9px;text-transform:uppercase;letter-spacing:1px;margin-bottom:8px;">Regime Forces</div>
- <div style="font-size:10px;line-height:1.6;">
- <div>🔴 <span style="color:#ff8888;">IRGC</span> — Revolutionary Guard</div>
- <div>🔴 <span style="color:#ff8888;">Basij</span> — Paramilitary militia</div>
- <div>🔴 <span style="color:#ff8888;">MOIS</span> — Intelligence ministry</div>
- <div>🔴 <span style="color:#ffaa00;">+850 foreign fighters</span></div>
- </div>
- <div style="color:#ff6666;font-size:9px;text-transform:uppercase;letter-spacing:1px;margin:12px 0 8px;">Proxy Network</div>
- <div style="font-size:10px;line-height:1.6;">
- <div>▸ Hezbollah (Lebanon)</div>
- <div>▸ Houthis (Yemen)</div>
- <div>▸ Hamas/PIJ (Gaza)</div>
- <div>▸ PMF militias (Iraq)</div>
- </div>
- </div>
- <div style="flex:1;padding:12px 15px;">
- <div style="color:#ff6666;font-size:9px;text-transform:uppercase;letter-spacing:1px;margin-bottom:8px;">Nuclear Status</div>
- <div style="font-size:10px;line-height:1.5;margin-bottom:12px;">
- <div>Enrichment: <span style="color:#ffaa00;">60%+</span></div>
- <div>Breakout: <span style="color:#ff6666;">~2 weeks</span></div>
- <div>Sites: Natanz, Fordow, Arak</div>
- </div>
- <div style="color:#ff6666;font-size:9px;text-transform:uppercase;letter-spacing:1px;margin-bottom:8px;">Live Intel</div>
- <div id="iranLiveData" style="font-size:10px;color:#aaa;">Loading...</div>
- </div>
- </div>
- <div style="border-top:1px solid #2a2020;padding:10px 15px;background:#1a1515;">
- <div style="color:#ff6666;font-size:9px;text-transform:uppercase;letter-spacing:1px;margin-bottom:6px;">Latest Headlines</div>
- <div id="iranNewsSection" style="font-size:10px;color:#ccc;line-height:1.5;">Loading news...</div>
- </div>
- </div>
- <style>
- @keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
- </style>
- <div class="map-zoom-controls" id="mapZoomControls">
- <button class="map-zoom-btn" id="zoomInBtn">+</button>
- <button class="map-zoom-btn" id="zoomOutBtn">−</button>
- <button class="map-zoom-btn map-zoom-reset" id="zoomResetBtn">⟲</button>
- </div>
- </div>
- <script>
- // Inline map render with hotspots
- (async function() {
- const svg = d3.select('#mapSvg');
- const tooltip = document.getElementById('mapTooltip');
- const mapPanel = document.getElementById('mapPanel');
- const width = 800, height = 400;
- svg.attr('viewBox', `0 0 ${width} ${height}`);
-
- // Create a group for all map content (enables zoom transforms)
- const mapGroup = svg.append('g').attr('id', 'mapGroup');
-
- // Mobile-only zoom behavior
- const isMobile = () => window.innerWidth <= 768;
- const zoom = d3.zoom()
- .scaleExtent([1, 6])
- .on('zoom', (event) => {
- mapGroup.attr('transform', event.transform);
- });
-
- function updateZoomBehavior() {
- if (isMobile()) {
- svg.call(zoom);
- } else {
- svg.on('.zoom', null);
- mapGroup.attr('transform', null);
- }
- }
- updateZoomBehavior();
- window.addEventListener('resize', updateZoomBehavior);
-
- // Zoom button handlers
- const ZOOM_SCALE = 1.5;
- document.getElementById('zoomInBtn').onclick = () => svg.transition().call(zoom.scaleBy, ZOOM_SCALE);
- document.getElementById('zoomOutBtn').onclick = () => svg.transition().call(zoom.scaleBy, 1 / ZOOM_SCALE);
- document.getElementById('zoomResetBtn').onclick = () => svg.transition().call(zoom.transform, d3.zoomIdentity);
-
- const projection = d3.geoEquirectangular()
- .scale(130)
- .center([0, 20])
- .translate([width/2, height/2 - 30]);
-
- const path = d3.geoPath().projection(projection);
-
- // Data cache for tooltips
- const dataCache = {};
-
- // Get local time at longitude
- function getLocalTime(lon) {
- const now = new Date();
- const utcHours = now.getUTCHours();
- const utcMinutes = now.getUTCMinutes();
- const offsetHours = Math.round(lon / 15);
- let localHours = (utcHours + offsetHours + 24) % 24;
- const ampm = localHours >= 12 ? 'PM' : 'AM';
- localHours = localHours % 12 || 12;
- return `${localHours}:${utcMinutes.toString().padStart(2, '0')} ${ampm}`;
- }
-
- // Fetch weather from Open-Meteo
- async function getWeather(lat, lon) {
- const key = `weather_${lat}_${lon}`;
- if (dataCache[key]) return dataCache[key];
- try {
- const res = await fetch(`https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}&current=temperature_2m,weather_code,wind_speed_10m`);
- const data = await res.json();
- const temp = data.current?.temperature_2m;
- const tempF = temp ? Math.round(temp * 9/5 + 32) : null;
- const wind = data.current?.wind_speed_10m;
- const code = data.current?.weather_code;
- const conditions = {
- 0: '☀️ Clear', 1: '🌤️ Mostly clear', 2: '⛅ Partly cloudy', 3: '☁️ Overcast',
- 45: '🌫️ Fog', 48: '🌫️ Fog', 51: '🌧️ Drizzle', 53: '🌧️ Drizzle', 55: '🌧️ Drizzle',
- 61: '🌧️ Rain', 63: '🌧️ Rain', 65: '🌧️ Heavy rain', 71: '🌨️ Snow', 73: '🌨️ Snow',
- 75: '🌨️ Heavy snow', 77: '🌨️ Snow', 80: '🌧️ Showers', 81: '🌧️ Showers', 82: '⛈️ Heavy showers',
- 85: '🌨️ Snow', 86: '🌨️ Snow', 95: '⛈️ Thunderstorm', 96: '⛈️ Thunderstorm', 99: '⛈️ Thunderstorm'
- };
- const result = { temp: tempF, wind: wind ? Math.round(wind) : null, condition: conditions[code] || '—' };
- dataCache[key] = result;
- return result;
- } catch (e) { return null; }
- }
-
- // Fetch news from GDELT
- async function getNews(query, lat, lon) {
- const key = `news_${query}`;
- if (dataCache[key]) return dataCache[key];
- try {
- const searchTerm = encodeURIComponent(query);
- const res = await fetch(`https://api.gdeltproject.org/api/v2/doc/doc?query=${searchTerm}&mode=artlist&maxrecords=3&format=json`);
- const data = await res.json();
- const articles = data.articles?.slice(0, 2).map(a => a.title?.substring(0, 60) + '...') || [];
- dataCache[key] = articles;
- return articles;
- } catch (e) { return []; }
- }
-
- // Fetch flight count from OpenSky
- async function getFlightCount(lat, lon) {
- const key = `flights_${Math.round(lat)}_${Math.round(lon)}`;
- if (dataCache[key] !== undefined) return dataCache[key];
- try {
- const bbox = `${lon-3},${lat-3},${lon+3},${lat+3}`;
- const res = await fetch(`https://opensky-network.org/api/states/all?lamin=${lat-2}&lomin=${lon-2}&lamax=${lat+2}&lomax=${lon+2}`);
- const data = await res.json();
- const count = data.states?.length || 0;
- dataCache[key] = count;
- return count;
- } catch (e) { dataCache[key] = null; return null; }
- }
-
- // Build enhanced tooltip content
- async function buildTooltip(name, lat, lon, baseContent, color) {
- const localTime = getLocalTime(lon);
- let html = `<strong style="color:${color}">${baseContent}</strong>`;
- html += `<br><span style="opacity:0.7">🕐 Local: ${localTime}</span>`;
-
- // Show loading, then fetch data
- tooltip.innerHTML = html + '<br><span style="opacity:0.5">Loading data...</span>';
-
- const [weather, flights, news] = await Promise.all([
- getWeather(lat, lon),
- getFlightCount(lat, lon),
- getNews(name, lat, lon)
- ]);
-
- if (weather) {
- html += `<br><span style="opacity:0.7">${weather.condition} ${weather.temp}°F, ${weather.wind}mph</span>`;
- }
- if (flights !== null) {
- html += `<br><span style="opacity:0.7">✈️ ${flights} aircraft nearby</span>`;
- }
- if (news && news.length > 0) {
- html += `<br><span style="color:#888;font-size:9px">📰 ${news[0]}</span>`;
- }
-
- return html;
- }
-
- // Enhanced Iran popup handling
- const iranPopup = document.getElementById('iranPopup');
- let iranPopupTimeout = null;
-
- async function showIranPopup(event) {
- const rect = mapPanel.getBoundingClientRect();
- iranPopup.style.display = 'block';
-
- // Position popup - check if it fits on the right, otherwise show on left
- const popupWidth = 380;
- let leftPos = event.clientX - rect.left + 20;
- if (leftPos + popupWidth > rect.width) {
- leftPos = event.clientX - rect.left - popupWidth - 20;
- }
- iranPopup.style.left = Math.max(10, leftPos) + 'px';
- iranPopup.style.top = Math.max(10, event.clientY - rect.top - 100) + 'px';
-
- // Fetch live data
- const liveDataEl = document.getElementById('iranLiveData');
- const newsEl = document.getElementById('iranNewsSection');
-
- try {
- // Fetch weather and flights
- const [weather, flights] = await Promise.all([
- getWeather(35.7, 51.4),
- getFlightCount(35.7, 51.4)
- ]);
-
- let liveHtml = '';
- liveHtml += `<div>🕐 Tehran: ${getLocalTime(51.4)}</div>`;
- if (weather) {
- liveHtml += `<div>${weather.condition} ${weather.temp}°F</div>`;
- }
- if (flights !== null) {
- liveHtml += `<div>✈️ ${flights} aircraft in area</div>`;
- }
- liveDataEl.innerHTML = liveHtml || 'Data unavailable';
- } catch (e) {
- liveDataEl.innerHTML = 'Error loading data';
- }
-
- // Fetch Iran news from GDELT - prioritize protest/uprising news
- try {
- const newsRes = await fetch('https://api.gdeltproject.org/api/v2/doc/doc?query=iran (protest OR uprising OR revolution OR crackdown OR nuclear OR irgc OR sanctions)&mode=artlist&maxrecords=6&format=json&sort=date');
- const newsData = await newsRes.json();
- if (newsData.articles && newsData.articles.length > 0) {
- newsEl.innerHTML = newsData.articles.slice(0, 4).map(a =>
- `<div style="margin-bottom:4px;padding-bottom:4px;border-bottom:1px solid #2a2020;">
- <a href="${a.url}" target="_blank" style="color:#ddd;text-decoration:none;">
- ${a.title?.substring(0, 70)}${a.title?.length > 70 ? '...' : ''}
- </a>
- <div style="font-size:9px;color:#666;">${a.domain} • ${new Date(a.seendate).toLocaleDateString()}</div>
- </div>`
- ).join('');
- } else {
- newsEl.innerHTML = '<div style="color:#666;">No recent news available</div>';
- }
- } catch (e) {
- newsEl.innerHTML = '<div style="color:#666;">Error loading news</div>';
- }
- }
-
- function hideIranPopup() {
- iranPopupTimeout = setTimeout(() => {
- iranPopup.style.display = 'none';
- }, 200);
- }
-
- // Keep popup open when hovering over it
- iranPopup.addEventListener('mouseenter', () => {
- if (iranPopupTimeout) clearTimeout(iranPopupTimeout);
- });
- iranPopup.addEventListener('mouseleave', () => {
- iranPopup.style.display = 'none';
- });
-
- // Threat level colors
- const threatColors = {
- high: '#ff4444',
- elevated: '#ffcc00',
- low: '#00ff88'
- };
-
- // Hotspots data with descriptions and threat levels
- const hotspots = [
- { name: 'DC', lat: 38.9, lon: -77.0, level: 'low', desc: 'Washington DC — US political center, White House, Pentagon, Capitol' },
- { name: 'Moscow', lat: 55.75, lon: 37.6, level: 'elevated', desc: 'Moscow — Kremlin, Russian military command, sanctions hub' },
- { name: 'Beijing', lat: 39.9, lon: 116.4, level: 'elevated', desc: 'Beijing — CCP headquarters, US-China tensions, tech rivalry' },
- { name: 'Kyiv', lat: 50.45, lon: 30.5, level: 'high', desc: 'Kyiv — Active conflict zone, Russian invasion ongoing' },
- { name: 'Taipei', lat: 25.03, lon: 121.5, level: 'elevated', desc: 'Taipei — Taiwan Strait tensions, TSMC, China threat' },
- { name: 'Tehran', lat: 35.7, lon: 51.4, level: 'high', desc: 'Tehran — Iran nuclear program, proxy conflicts, regional escalation' },
- { name: 'Tel Aviv', lat: 32.07, lon: 34.78, level: 'high', desc: 'Tel Aviv — Israel-Gaza conflict, active military operations' },
- { name: 'London', lat: 51.5, lon: -0.12, level: 'low', desc: 'London — Financial center, Five Eyes, NATO ally' },
- { name: 'Brussels', lat: 50.85, lon: 4.35, level: 'low', desc: 'Brussels — EU/NATO headquarters, European policy' },
- { name: 'Pyongyang', lat: 39.03, lon: 125.75, level: 'elevated', desc: 'Pyongyang — North Korea nuclear threat, missile tests' },
- { name: 'Riyadh', lat: 24.7, lon: 46.7, level: 'elevated', desc: 'Riyadh — Saudi oil, OPEC+, Yemen conflict, regional power' },
- { name: 'Delhi', lat: 28.6, lon: 77.2, level: 'low', desc: 'Delhi — India rising power, China border tensions' },
- { name: 'Singapore', lat: 1.35, lon: 103.82, level: 'low', desc: 'Singapore — Shipping chokepoint, Asian finance hub' },
- { name: 'Tokyo', lat: 35.68, lon: 139.76, level: 'low', desc: 'Tokyo — US ally, regional security, economic power' },
- { name: 'Caracas', lat: 10.5, lon: -66.9, level: 'high', desc: 'Caracas — Venezuela crisis, Maduro regime, US sanctions, humanitarian emergency' },
- { name: 'Nuuk', lat: 64.18, lon: -51.72, level: 'elevated', desc: 'Nuuk — Greenland, US acquisition interest, Arctic strategy, Denmark tensions' }
- ];
-
- try {
- const response = await fetch('https://cdn.jsdelivr.net/npm/world-atlas@2/countries-110m.json');
- const world = await response.json();
- const countries = topojson.feature(world, world.objects.countries);
-
- // Sanctioned countries (ISO numeric codes)
- const sanctionedIds = [364, 408, 760, 862, 112, 643, 728, 729]; // Iran, NK, Syria, Venezuela, Belarus, Russia, South Sudan, Sudan
-
- // Draw countries with sanctions highlighting
- mapGroup.selectAll('path.country')
- .data(countries.features)
- .enter()
- .append('path')
- .attr('class', 'country')
- .attr('d', path)
- .attr('fill', d => sanctionedIds.includes(+d.id) ? '#2a1a1a' : '#0f3028')
- .attr('stroke', d => sanctionedIds.includes(+d.id) ? '#4a2020' : '#1a5040')
- .attr('stroke-width', 0.5);
-
- // Draw graticule (grid lines)
- const graticule = d3.geoGraticule().step([30, 30]);
- mapGroup.append('path')
- .datum(graticule)
- .attr('d', path)
- .attr('fill', 'none')
- .attr('stroke', '#1a3830')
- .attr('stroke-width', 0.3)
- .attr('stroke-dasharray', '2,2');
-
- // Ocean labels
- const oceans = [
- { name: 'ATLANTIC', lat: 25, lon: -40 },
- { name: 'PACIFIC', lat: 0, lon: -150 },
- { name: 'INDIAN', lat: -20, lon: 75 },
- { name: 'ARCTIC', lat: 75, lon: 0 },
- { name: 'SOUTHERN', lat: -60, lon: 0 }
- ];
- oceans.forEach(o => {
- const [x, y] = projection([o.lon, o.lat]);
- if (x && y) {
- mapGroup.append('text')
- .attr('x', x).attr('y', y)
- .attr('fill', '#1a4a40')
- .attr('font-size', '10px')
- .attr('font-family', 'monospace')
- .attr('text-anchor', 'middle')
- .attr('opacity', 0.6)
- .text(o.name);
- }
- });
-
- // Day/night terminator
- const now = new Date();
- const dayOfYear = Math.floor((now - new Date(now.getFullYear(), 0, 0)) / 86400000);
- const declination = -23.45 * Math.cos((360/365) * (dayOfYear + 10) * Math.PI/180);
- const hourAngle = (now.getUTCHours() + now.getUTCMinutes()/60) * 15 - 180;
-
- const terminatorPoints = [];
- for (let lat = -90; lat <= 90; lat += 2) {
- const cosLat = Math.cos(lat * Math.PI/180);
- const tanDec = Math.tan(declination * Math.PI/180);
- const tanLat = Math.tan(lat * Math.PI/180);
- let lon = -hourAngle + Math.acos(-tanDec * tanLat) * 180/Math.PI;
- if (isNaN(lon)) lon = (lat * declination > 0) ? -hourAngle + 180 : -hourAngle;
- terminatorPoints.push([lon, lat]);
- }
- for (let lat = 90; lat >= -90; lat -= 2) {
- const cosLat = Math.cos(lat * Math.PI/180);
- const tanDec = Math.tan(declination * Math.PI/180);
- const tanLat = Math.tan(lat * Math.PI/180);
- let lon = -hourAngle - Math.acos(-tanDec * tanLat) * 180/Math.PI;
- if (isNaN(lon)) lon = (lat * declination > 0) ? -hourAngle - 180 : -hourAngle;
- terminatorPoints.push([lon, lat]);
- }
-
- mapGroup.append('path')
- .datum({type: 'Polygon', coordinates: [terminatorPoints]})
- .attr('d', path)
- .attr('fill', 'rgba(0,0,0,0.3)')
- .attr('stroke', 'none');
-
- // Conflict zones (approximate bounding boxes)
- const conflictZones = [
- { name: 'Ukraine', coords: [[30,52],[40,52],[40,45],[30,45],[30,52]], color: '#ff4444' },
- { name: 'Gaza', coords: [[34,32],[35,32],[35,31],[34,31],[34,32]], color: '#ff4444' },
- { name: 'Taiwan Strait', coords: [[117,28],[122,28],[122,22],[117,22],[117,28]], color: '#ffaa00' },
- { name: 'Yemen', coords: [[42,19],[54,19],[54,12],[42,12],[42,19]], color: '#ff6644' },
- { name: 'Sudan', coords: [[22,23],[38,23],[38,8],[22,8],[22,23]], color: '#ff6644' },
- { name: 'Myanmar', coords: [[92,28],[101,28],[101,10],[92,10],[92,28]], color: '#ff8844' }
- ];
- conflictZones.forEach(zone => {
- mapGroup.append('path')
- .datum({type: 'Polygon', coordinates: [zone.coords]})
- .attr('d', path)
- .attr('fill', zone.color)
- .attr('fill-opacity', 0.15)
- .attr('stroke', zone.color)
- .attr('stroke-width', 0.5)
- .attr('stroke-opacity', 0.4);
- });
-
- // Shipping chokepoints
- const chokepoints = [
- { name: 'Suez', lat: 30.0, lon: 32.5, desc: 'Suez Canal — 12% of global trade, Europe-Asia route' },
- { name: 'Panama', lat: 9.1, lon: -79.7, desc: 'Panama Canal — Americas transit, Pacific-Atlantic link' },
- { name: 'Hormuz', lat: 26.5, lon: 56.5, desc: 'Strait of Hormuz — 21% of global oil, Persian Gulf exit' },
- { name: 'Malacca', lat: 2.5, lon: 101.0, desc: 'Strait of Malacca — 25% of global trade, China supply line' },
- { name: 'Bab el-M', lat: 12.5, lon: 43.3, desc: 'Bab el-Mandeb — Red Sea gateway, Houthi threat zone' },
- { name: 'Gibraltar', lat: 36.0, lon: -5.5, desc: 'Strait of Gibraltar — Mediterranean access' },
- { name: 'Bosporus', lat: 41.1, lon: 29.0, desc: 'Bosporus Strait — Black Sea access, Russia exports' }
- ];
- chokepoints.forEach(cp => {
- const [x, y] = projection([cp.lon, cp.lat]);
- if (x && y) {
- mapGroup.append('rect')
- .attr('x', x - 4).attr('y', y - 4)
- .attr('width', 8).attr('height', 8)
- .attr('fill', '#00aaff')
- .attr('opacity', 0.8)
- .attr('transform', `rotate(45,${x},${y})`);
- mapGroup.append('text')
- .attr('x', x + 8).attr('y', y + 3)
- .attr('fill', '#00aaff')
- .attr('font-size', '7px')
- .attr('font-family', 'monospace')
- .text(cp.name);
- mapGroup.append('circle')
- .attr('cx', x).attr('cy', y).attr('r', 10)
- .attr('fill', 'transparent')
- .attr('class', 'hotspot-hit')
- .on('mouseenter', function(event) {
- const rect = mapPanel.getBoundingClientRect();
- tooltip.innerHTML = `<strong style="color:#00aaff">⬥ ${cp.desc}</strong>`;
- tooltip.style.display = 'block';
- tooltip.style.left = (event.clientX - rect.left + 15) + 'px';
- tooltip.style.top = (event.clientY - rect.top - 10) + 'px';
- })
- .on('mousemove', function(event) {
- const rect = mapPanel.getBoundingClientRect();
- tooltip.style.left = (event.clientX - rect.left + 15) + 'px';
- tooltip.style.top = (event.clientY - rect.top - 10) + 'px';
- })
- .on('mouseleave', () => tooltip.style.display = 'none');
- }
- });
-
- // Undersea cable landing points (major hubs)
- const cableLandings = [
- { name: 'NYC', lat: 40.7, lon: -74.0, desc: 'New York — Transatlantic hub, 10+ cables' },
- { name: 'Cornwall', lat: 50.1, lon: -5.5, desc: 'Cornwall UK — Europe-Americas gateway' },
- { name: 'Marseille', lat: 43.3, lon: 5.4, desc: 'Marseille — Mediterranean hub, SEA-ME-WE' },
- { name: 'Mumbai', lat: 19.1, lon: 72.9, desc: 'Mumbai — India gateway, 10+ cables' },
- { name: 'Singapore', lat: 1.3, lon: 103.8, desc: 'Singapore — Asia-Pacific nexus' },
- { name: 'Hong Kong', lat: 22.3, lon: 114.2, desc: 'Hong Kong — China connectivity hub' },
- { name: 'Tokyo', lat: 35.5, lon: 139.8, desc: 'Tokyo — Trans-Pacific terminus' },
- { name: 'Sydney', lat: -33.9, lon: 151.2, desc: 'Sydney — Australia/Pacific hub' },
- { name: 'LA', lat: 33.7, lon: -118.2, desc: 'Los Angeles — Pacific gateway' },
- { name: 'Miami', lat: 25.8, lon: -80.2, desc: 'Miami — Americas/Caribbean hub' }
- ];
- cableLandings.forEach(cl => {
- const [x, y] = projection([cl.lon, cl.lat]);
- if (x && y) {
- mapGroup.append('circle')
- .attr('cx', x).attr('cy', y).attr('r', 3)
- .attr('fill', 'none')
- .attr('stroke', '#aa44ff')
- .attr('stroke-width', 1.5);
- mapGroup.append('circle')
- .attr('cx', x).attr('cy', y).attr('r', 10)
- .attr('fill', 'transparent')
- .attr('class', 'hotspot-hit')
- .on('mouseenter', function(event) {
- const rect = mapPanel.getBoundingClientRect();
- tooltip.innerHTML = `<strong style="color:#aa44ff">◎ ${cl.desc}</strong>`;
- tooltip.style.display = 'block';
- tooltip.style.left = (event.clientX - rect.left + 15) + 'px';
- tooltip.style.top = (event.clientY - rect.top - 10) + 'px';
- })
- .on('mousemove', function(event) {
- const rect = mapPanel.getBoundingClientRect();
- tooltip.style.left = (event.clientX - rect.left + 15) + 'px';
- tooltip.style.top = (event.clientY - rect.top - 10) + 'px';
- })
- .on('mouseleave', () => tooltip.style.display = 'none');
- }
- });
-
- // Nuclear facilities (major sites)
- const nuclearSites = [
- { name: 'Natanz', lat: 33.7, lon: 51.7, desc: 'Natanz — Iran uranium enrichment' },
- { name: 'Yongbyon', lat: 39.8, lon: 125.8, desc: 'Yongbyon — North Korea nuclear complex' },
- { name: 'Dimona', lat: 31.0, lon: 35.1, desc: 'Dimona — Israel nuclear facility' },
- { name: 'Bushehr', lat: 28.8, lon: 50.9, desc: 'Bushehr — Iran nuclear power plant' },
- { name: 'Zaporizhzhia', lat: 47.5, lon: 34.6, desc: 'Zaporizhzhia — Europe largest NPP, conflict zone' },
- { name: 'Chernobyl', lat: 51.4, lon: 30.1, desc: 'Chernobyl — Exclusion zone, occupied 2022' },
- { name: 'Fukushima', lat: 37.4, lon: 141.0, desc: 'Fukushima — Decommissioning site' }
- ];
- nuclearSites.forEach(ns => {
- const [x, y] = projection([ns.lon, ns.lat]);
- if (x && y) {
- // Radiation symbol (simplified)
- mapGroup.append('circle')
- .attr('cx', x).attr('cy', y).attr('r', 2)
- .attr('fill', '#ffff00');
- mapGroup.append('circle')
- .attr('cx', x).attr('cy', y).attr('r', 5)
- .attr('fill', 'none')
- .attr('stroke', '#ffff00')
- .attr('stroke-width', 1)
- .attr('stroke-dasharray', '3,3');
- mapGroup.append('circle')
- .attr('cx', x).attr('cy', y).attr('r', 10)
- .attr('fill', 'transparent')
- .attr('class', 'hotspot-hit')
- .on('mouseenter', function(event) {
- const rect = mapPanel.getBoundingClientRect();
- tooltip.innerHTML = `<strong style="color:#ffff00">☢ ${ns.desc}</strong>`;
- tooltip.style.display = 'block';
- tooltip.style.left = (event.clientX - rect.left + 15) + 'px';
- tooltip.style.top = (event.clientY - rect.top - 10) + 'px';
- })
- .on('mousemove', function(event) {
- const rect = mapPanel.getBoundingClientRect();
- tooltip.style.left = (event.clientX - rect.left + 15) + 'px';
- tooltip.style.top = (event.clientY - rect.top - 10) + 'px';
- })
- .on('mouseleave', () => tooltip.style.display = 'none');
- }
- });
-
- // Major military bases
- const militaryBases = [
- { name: 'Ramstein', lat: 49.4, lon: 7.6, desc: 'Ramstein — US Air Force, NATO hub Germany' },
- { name: 'Diego Garcia', lat: -7.3, lon: 72.4, desc: 'Diego Garcia — US/UK Indian Ocean base' },
- { name: 'Okinawa', lat: 26.5, lon: 127.9, desc: 'Okinawa — US Forces Japan, Pacific presence' },
- { name: 'Guam', lat: 13.5, lon: 144.8, desc: 'Guam — US Pacific Command, bomber base' },
- { name: 'Djibouti', lat: 11.5, lon: 43.1, desc: 'Djibouti — US/China/France bases, Horn of Africa' },
- { name: 'Qatar', lat: 25.1, lon: 51.3, desc: 'Al Udeid — US CENTCOM forward HQ' },
- { name: 'Kaliningrad', lat: 54.7, lon: 20.5, desc: 'Kaliningrad — Russian Baltic exclave, missiles' },
- { name: 'Sevastopol', lat: 44.6, lon: 33.5, desc: 'Sevastopol — Russian Black Sea Fleet' },
- { name: 'Hainan', lat: 18.2, lon: 109.5, desc: 'Hainan — Chinese submarine base, South China Sea' }
- ];
- militaryBases.forEach(mb => {
- const [x, y] = projection([mb.lon, mb.lat]);
- if (x && y) {
- // Star shape for military
- const starPath = `M${x},${y-5} L${x+1.5},${y-1.5} L${x+5},${y-1.5} L${x+2.5},${y+1} L${x+3.5},${y+5} L${x},${y+2.5} L${x-3.5},${y+5} L${x-2.5},${y+1} L${x-5},${y-1.5} L${x-1.5},${y-1.5} Z`;
- mapGroup.append('path')
- .attr('d', starPath)
- .attr('fill', '#ff00ff')
- .attr('opacity', 0.8);
- mapGroup.append('circle')
- .attr('cx', x).attr('cy', y).attr('r', 10)
- .attr('fill', 'transparent')
- .attr('class', 'hotspot-hit')
- .on('mouseenter', function(event) {
- const rect = mapPanel.getBoundingClientRect();
- tooltip.innerHTML = `<strong style="color:#ff00ff">★ ${mb.desc}</strong>`;
- tooltip.style.display = 'block';
- tooltip.style.left = (event.clientX - rect.left + 15) + 'px';
- tooltip.style.top = (event.clientY - rect.top - 10) + 'px';
- })
- .on('mousemove', function(event) {
- const rect = mapPanel.getBoundingClientRect();
- tooltip.style.left = (event.clientX - rect.left + 15) + 'px';
- tooltip.style.top = (event.clientY - rect.top - 10) + 'px';
- })
- .on('mouseleave', () => tooltip.style.display = 'none');
- }
- });
-
- // Add pulse animation style
- const style = document.createElement('style');
- style.textContent = `
- @keyframes pulse {
- 0% { r: 3; opacity: 0.9; }
- 50% { r: 6; opacity: 0.4; }
- 100% { r: 3; opacity: 0.9; }
- }
- @keyframes weatherPulse {
- 0% { opacity: 0.9; }
- 50% { opacity: 0.5; }
- 100% { opacity: 0.9; }
- }
- .hotspot-pulse { animation: pulse 2s ease-in-out infinite; }
- .hotspot-hit { cursor: pointer; }
- .weather-alert { animation: weatherPulse 1.5s ease-in-out infinite; }
- `;
- document.head.appendChild(style);
-
- // Draw hotspots
- hotspots.forEach(h => {
- const [x, y] = projection([h.lon, h.lat]);
- const color = threatColors[h.level] || threatColors.low;
- if (x && y) {
- // Outer pulsing ring
- mapGroup.append('circle')
- .attr('cx', x).attr('cy', y).attr('r', 6)
- .attr('fill', 'none').attr('stroke', color)
- .attr('stroke-width', 1.5).attr('opacity', 0.6)
- .attr('class', 'hotspot-pulse');
- // Inner solid circle
- mapGroup.append('circle')
- .attr('cx', x).attr('cy', y).attr('r', 3)
- .attr('fill', color).attr('opacity', 0.9);
- // Label
- mapGroup.append('text')
- .attr('x', x + 8).attr('y', y + 3)
- .attr('fill', color).attr('font-size', '8px')
- .attr('font-family', 'monospace')
- .text(h.name);
- // Invisible hit area for tooltip
- mapGroup.append('circle')
- .attr('cx', x).attr('cy', y).attr('r', 12)
- .attr('fill', 'transparent')
- .attr('class', 'hotspot-hit')
- .on('mouseenter', async function(event) {
- // Special handling for Tehran - show enhanced Iran popup
- if (h.name === 'Tehran') {
- if (iranPopupTimeout) clearTimeout(iranPopupTimeout);
- showIranPopup(event);
- return;
- }
-
- const rect = mapPanel.getBoundingClientRect();
- const levelLabel = h.level.charAt(0).toUpperCase() + h.level.slice(1);
- tooltip.style.display = 'block';
- tooltip.style.left = (event.clientX - rect.left + 15) + 'px';
- tooltip.style.top = (event.clientY - rect.top - 10) + 'px';
- const html = await buildTooltip(h.name, h.lat, h.lon, `[${levelLabel}] ${h.desc}`, color);
- tooltip.innerHTML = html;
- })
- .on('mousemove', function(event) {
- if (h.name === 'Tehran') return; // Iran popup doesn't follow mouse
- const rect = mapPanel.getBoundingClientRect();
- tooltip.style.left = (event.clientX - rect.left + 15) + 'px';
- tooltip.style.top = (event.clientY - rect.top - 10) + 'px';
- })
- .on('mouseleave', function() {
- if (h.name === 'Tehran') {
- hideIranPopup();
- return;
- }
- tooltip.style.display = 'none';
- });
- }
- });
-
- // Fetch and render weather alerts (US - NWS API)
- try {
- const weatherRes = await fetch('https://api.weather.gov/alerts/active?status=actual&severity=Extreme,Severe');
- const weatherData = await weatherRes.json();
-
- // Weather severity colors
- const weatherColors = {
- 'Extreme': '#ff0000',
- 'Severe': '#ff6600',
- 'Moderate': '#ffaa00',
- 'Minor': '#ffcc00'
- };
-
- // US state centroids for positioning alerts
- const stateCentroids = {
- 'AL': [32.7, -86.7], 'AK': [64.0, -153.0], 'AZ': [34.2, -111.6], 'AR': [34.8, -92.4],
- 'CA': [37.2, -119.4], 'CO': [39.0, -105.5], 'CT': [41.6, -72.7], 'DE': [39.0, -75.5],
- 'FL': [28.6, -82.4], 'GA': [32.6, -83.4], 'HI': [20.8, -156.3], 'ID': [44.4, -114.6],
- 'IL': [40.0, -89.2], 'IN': [39.9, -86.3], 'IA': [42.0, -93.5], 'KS': [38.5, -98.4],
- 'KY': [37.5, -85.3], 'LA': [31.0, -92.0], 'ME': [45.4, -69.2], 'MD': [39.0, -76.8],
- 'MA': [42.2, -71.5], 'MI': [44.3, -85.4], 'MN': [46.3, -94.3], 'MS': [32.7, -89.7],
- 'MO': [38.3, -92.4], 'MT': [47.0, -109.6], 'NE': [41.5, -99.8], 'NV': [39.3, -116.6],
- 'NH': [43.7, -71.6], 'NJ': [40.1, -74.7], 'NM': [34.4, -106.1], 'NY': [42.9, -75.5],
- 'NC': [35.5, -79.4], 'ND': [47.4, -100.3], 'OH': [40.4, -82.8], 'OK': [35.6, -97.5],
- 'OR': [43.9, -120.6], 'PA': [40.9, -77.8], 'RI': [41.7, -71.5], 'SC': [33.9, -80.9],
- 'SD': [44.4, -100.2], 'TN': [35.9, -86.4], 'TX': [31.5, -99.4], 'UT': [39.3, -111.7],
- 'VT': [44.0, -72.7], 'VA': [37.5, -78.8], 'WA': [47.4, -120.5], 'WV': [38.9, -80.5],
- 'WI': [44.6, -89.7], 'WY': [43.0, -107.5], 'DC': [38.9, -77.0], 'PR': [18.2, -66.4]
- };
-
- // Group alerts by state to avoid clutter
- const alertsByState = {};
- weatherData.features?.forEach(alert => {
- const props = alert.properties;
- const state = props.areaDesc?.match(/,\s*([A-Z]{2})(?:\s|$|;)/)?.[1] ||
- props.senderName?.match(/([A-Z]{2})$/)?.[1];
- if (state && stateCentroids[state]) {
- if (!alertsByState[state] ||
- (props.severity === 'Extreme' && alertsByState[state].severity !== 'Extreme')) {
- alertsByState[state] = {
- state,
- severity: props.severity,
- event: props.event,
- headline: props.headline,
- description: props.description?.substring(0, 200) + '...',
- count: (alertsByState[state]?.count || 0) + 1
- };
- } else {
- alertsByState[state].count++;
- }
- }
- });
-
- // Draw weather alerts as triangles
- Object.values(alertsByState).forEach(alert => {
- const coords = stateCentroids[alert.state];
- if (!coords) return;
- const [x, y] = projection([coords[1], coords[0]]);
- const color = weatherColors[alert.severity] || '#ffaa00';
-
- if (x && y) {
- // Triangle warning symbol
- const size = 6;
- const triangle = `M${x},${y-size} L${x+size},${y+size/2} L${x-size},${y+size/2} Z`;
-
- mapGroup.append('path')
- .attr('d', triangle)
- .attr('fill', color)
- .attr('stroke', '#000')
- .attr('stroke-width', 0.5)
- .attr('class', 'weather-alert');
-
- // Hit area for tooltip
- mapGroup.append('circle')
- .attr('cx', x).attr('cy', y).attr('r', 10)
- .attr('fill', 'transparent')
- .attr('class', 'hotspot-hit')
- .on('mouseenter', function(event) {
- const rect = mapPanel.getBoundingClientRect();
- const countText = alert.count > 1 ? ` (+${alert.count - 1} more)` : '';
- tooltip.innerHTML = `<strong style="color:${color}">⚠ ${alert.event}</strong>${countText}<br>${alert.headline || alert.state}`;
- tooltip.style.display = 'block';
- tooltip.style.left = (event.clientX - rect.left + 15) + 'px';
- tooltip.style.top = (event.clientY - rect.top - 10) + 'px';
- })
- .on('mousemove', function(event) {
- const rect = mapPanel.getBoundingClientRect();
- tooltip.style.left = (event.clientX - rect.left + 15) + 'px';
- tooltip.style.top = (event.clientY - rect.top - 10) + 'px';
- })
- .on('mouseleave', function() {
- tooltip.style.display = 'none';
- });
- }
- });
-
- console.log(`Loaded ${Object.keys(alertsByState).length} weather alert regions`);
- } catch(weatherErr) {
- console.log('Weather alerts unavailable:', weatherErr.message);
- }
-
- // Fetch and render global earthquakes (USGS API)
- try {
- const quakeRes = await fetch('https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/4.5_week.geojson');
- const quakeData = await quakeRes.json();
-
- // Earthquake magnitude colors
- const getQuakeColor = (mag) => {
- if (mag >= 7) return '#ff0000';
- if (mag >= 6) return '#ff4400';
- if (mag >= 5) return '#ff8800';
- return '#ffaa00';
- };
-
- // Draw earthquakes as concentric circles
- quakeData.features?.slice(0, 30).forEach(quake => {
- const coords = quake.geometry.coordinates;
- const props = quake.properties;
- const [x, y] = projection([coords[0], coords[1]]);
- const mag = props.mag;
- const color = getQuakeColor(mag);
- const radius = Math.max(3, mag - 2);
-
- if (x && y) {
- // Outer ring
- mapGroup.append('circle')
- .attr('cx', x).attr('cy', y)
- .attr('r', radius + 3)
- .attr('fill', 'none')
- .attr('stroke', color)
- .attr('stroke-width', 1)
- .attr('opacity', 0.4);
-
- // Inner circle
- mapGroup.append('circle')
- .attr('cx', x).attr('cy', y)
- .attr('r', radius)
- .attr('fill', color)
- .attr('opacity', 0.7);
-
- // Hit area for tooltip
- mapGroup.append('circle')
- .attr('cx', x).attr('cy', y)
- .attr('r', 10)
- .attr('fill', 'transparent')
- .attr('class', 'hotspot-hit')
- .on('mouseenter', function(event) {
- const rect = mapPanel.getBoundingClientRect();
- const time = new Date(props.time).toLocaleString();
- const depth = coords[2].toFixed(1);
- tooltip.innerHTML = `<strong style="color:${color}">M${mag.toFixed(1)} Earthquake</strong><br>${props.place}<br><span style="opacity:0.7">Depth: ${depth}km • ${time}</span>`;
- tooltip.style.display = 'block';
- tooltip.style.left = (event.clientX - rect.left + 15) + 'px';
- tooltip.style.top = (event.clientY - rect.top - 10) + 'px';
- })
- .on('mousemove', function(event) {
- const rect = mapPanel.getBoundingClientRect();
- tooltip.style.left = (event.clientX - rect.left + 15) + 'px';
- tooltip.style.top = (event.clientY - rect.top - 10) + 'px';
- })
- .on('mouseleave', function() {
- tooltip.style.display = 'none';
- });
- }
- });
-
- console.log(`Loaded ${Math.min(quakeData.features?.length || 0, 30)} earthquakes`);
- } catch(quakeErr) {
- console.log('Earthquake data unavailable:', quakeErr.message);
- }
-
- } catch(e) {
- console.error('Map error:', e);
- }
- })();
- </script>
- </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>
-
- <!-- 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>
-
- <!-- Iran Situation -->
- <section class="panel" data-panel="iran">
- <div class="panel-header">
- <span class="panel-title">Iran Situation</span>
- <span class="panel-count" id="iranStatus">-</span>
- </div>
- <div class="panel-content" id="iranPanel">
- <div class="loading-msg">Loading...</div>
- </div>
- </section>
-
- <!-- World Leaders -->
- <section class="panel wide" data-panel="leaders">
- <div class="panel-header">
- <span class="panel-title">World Leaders</span>
- <span class="panel-count" id="leadersCount">-</span>
- </div>
- <div class="panel-content leaders-panel" id="leadersPanel">
- <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>
-
- <!-- Load the modular JavaScript -->
- <script type="module" src="js/main.js"></script>
-</body>
-</html>
diff --git a/static/js/constants.js b/static/js/constants.js
deleted file mode 100644
index 56d568e..0000000
--- a/static/js/constants.js
+++ /dev/null
@@ -1,1257 +0,0 @@
-// 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 },
- 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 },
- iran: { name: 'Iran Situation', priority: 2 },
- leaders: { name: 'World Leaders', 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'];
-
-// 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: 'NYT World', url: 'https://rss.nytimes.com/services/xml/rss/nyt/World.xml' }
- ],
- 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/news/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: 'BBC Business', url: 'https://feeds.bbci.co.uk/news/business/rss.xml' },
- { name: 'FT', url: 'https://www.ft.com/rss/home' }
- ],
- gov: [
- { name: 'White House', url: 'https://www.whitehouse.gov/news/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: 'DoD News', url: 'https://www.defense.gov/DesktopModules/ArticleCS/RSS.ashx?max=10&ContentType=1&Site=945' }
- ]
-};
-
-// 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: 'CSIS Analysis', url: 'https://www.csis.org/analysis/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']
-};
-
-// Onboarding presets for first-time users
-export const PRESETS = {
- 'news-junkie': {
- id: 'news-junkie',
- name: 'News Junkie',
- icon: '📰',
- description: 'Stay on top of breaking news across politics, tech, and finance',
- panels: ['politics', 'tech', 'finance', 'gov', 'ai', 'mainchar', 'map']
- },
- 'trader': {
- id: 'trader',
- name: 'Trader',
- icon: '📈',
- description: 'Market-focused dashboard with stocks, crypto, and commodities',
- panels: ['markets', 'heatmap', 'commodities', 'polymarket', 'whales', 'printer', 'finance', 'map']
- },
- 'geopolitics': {
- id: 'geopolitics',
- name: 'Geopolitics Watcher',
- icon: '🌍',
- description: 'Global situation awareness and regional hotspots',
- panels: ['map', 'intel', 'politics', 'gov', 'leaders', 'venezuela', 'greenland', 'iran', 'correlation', 'narrative']
- },
- 'intel': {
- id: 'intel',
- name: 'Intelligence Analyst',
- icon: '🔍',
- description: 'Deep analysis, pattern detection, and narrative tracking',
- panels: ['map', 'intel', 'leaders', 'correlation', 'narrative', 'mainchar', 'politics']
- },
- 'minimal': {
- id: 'minimal',
- name: 'Minimal',
- icon: '⚡',
- description: 'Just the essentials - map, news, and markets',
- panels: ['map', 'politics', 'markets']
- },
- 'everything': {
- id: 'everything',
- name: 'Everything',
- icon: '🎛️',
- description: 'Kitchen sink - all panels enabled',
- panels: Object.keys({
- map: true, politics: true, tech: true, finance: true, gov: true,
- heatmap: true, markets: true, monitors: true, commodities: true,
- polymarket: true, whales: true, mainchar: true, printer: true,
- contracts: true, ai: true, layoffs: true, venezuela: true,
- greenland: true, iran: true, leaders: true, intel: true, correlation: true, narrative: true
- })
- }
-};
-
-// World Leaders for tracking
-export const WORLD_LEADERS = [
- // United States
- { id: 'trump', name: 'Donald Trump', title: 'President', country: 'United States', flag: '🇺🇸',
- keywords: ['trump', 'potus', 'white house'], since: 'Jan 2025', party: 'Republican',
- focus: ['tariffs', 'immigration', 'deregulation'] },
- { id: 'vance', name: 'JD Vance', title: 'Vice President', country: 'United States', flag: '🇺🇸',
- keywords: ['jd vance', 'vice president vance'], since: 'Jan 2025', party: 'Republican' },
-
- // China
- { id: 'xi', name: 'Xi Jinping', title: 'President', country: 'China', flag: '🇨🇳',
- keywords: ['xi jinping', 'xi', 'chinese president'], since: 'Mar 2013', party: 'CCP',
- focus: ['taiwan', 'belt and road', 'tech dominance'] },
-
- // Russia
- { id: 'putin', name: 'Vladimir Putin', title: 'President', country: 'Russia', flag: '🇷🇺',
- keywords: ['putin', 'kremlin', 'russian president'], since: 'May 2012', party: 'United Russia',
- focus: ['ukraine war', 'nato expansion', 'energy'] },
-
- // Europe
- { id: 'starmer', name: 'Keir Starmer', title: 'Prime Minister', country: 'United Kingdom', flag: '🇬🇧',
- keywords: ['starmer', 'uk pm', 'british prime minister'], since: 'Jul 2024', party: 'Labour' },
- { id: 'macron', name: 'Emmanuel Macron', title: 'President', country: 'France', flag: '🇫🇷',
- keywords: ['macron', 'french president', 'elysee'], since: 'May 2017', party: 'Renaissance' },
- { id: 'scholz', name: 'Olaf Scholz', title: 'Chancellor', country: 'Germany', flag: '🇩🇪',
- keywords: ['scholz', 'german chancellor', 'berlin'], since: 'Dec 2021', party: 'SPD' },
- { id: 'meloni', name: 'Giorgia Meloni', title: 'Prime Minister', country: 'Italy', flag: '🇮🇹',
- keywords: ['meloni', 'italian pm', 'italy prime minister'], since: 'Oct 2022', party: 'Brothers of Italy' },
-
- // Middle East
- { id: 'netanyahu', name: 'Benjamin Netanyahu', title: 'Prime Minister', country: 'Israel', flag: '🇮🇱',
- keywords: ['netanyahu', 'bibi', 'israeli pm'], since: 'Dec 2022', party: 'Likud',
- focus: ['gaza', 'iran', 'judicial reform'] },
- { id: 'mbs', name: 'Mohammed bin Salman', title: 'Crown Prince', country: 'Saudi Arabia', flag: '🇸🇦',
- keywords: ['mbs', 'saudi crown prince', 'bin salman'], since: 'Jun 2017', party: 'Royal Family',
- focus: ['vision 2030', 'oil', 'regional influence'] },
- { id: 'khamenei', name: 'Ali Khamenei', title: 'Supreme Leader', country: 'Iran', flag: '🇮🇷',
- keywords: ['khamenei', 'supreme leader', 'ayatollah'], since: 'Jun 1989', party: 'Islamic Republic',
- focus: ['nuclear program', 'proxies', 'sanctions'] },
-
- // Asia-Pacific
- { id: 'modi', name: 'Narendra Modi', title: 'Prime Minister', country: 'India', flag: '🇮🇳',
- keywords: ['modi', 'indian pm', 'india prime minister'], since: 'May 2014', party: 'BJP',
- focus: ['economy', 'china border', 'technology'] },
- { id: 'kim', name: 'Kim Jong Un', title: 'Supreme Leader', country: 'North Korea', flag: '🇰🇵',
- keywords: ['kim jong un', 'north korea', 'pyongyang'], since: 'Dec 2011', party: 'Workers Party',
- focus: ['nuclear', 'missiles', 'russia alliance'] },
- { id: 'kishida', name: 'Shigeru Ishiba', title: 'Prime Minister', country: 'Japan', flag: '🇯🇵',
- keywords: ['ishiba', 'japanese pm', 'japan prime minister'], since: 'Oct 2024', party: 'LDP',
- focus: ['defense', 'china', 'us alliance'] },
- { id: 'lai', name: 'Lai Ching-te', title: 'President', country: 'Taiwan', flag: '🇹🇼',
- keywords: ['lai ching-te', 'taiwan president', 'taipei'], since: 'May 2024', party: 'DPP',
- focus: ['china relations', 'defense', 'semiconductors'] },
-
- // Ukraine
- { id: 'zelensky', name: 'Volodymyr Zelensky', title: 'President', country: 'Ukraine', flag: '🇺🇦',
- keywords: ['zelensky', 'ukraine president', 'kyiv'], since: 'May 2019', party: 'Servant of the People',
- focus: ['war', 'western aid', 'nato membership'] },
-
- // Latin America
- { id: 'milei', name: 'Javier Milei', title: 'President', country: 'Argentina', flag: '🇦🇷',
- keywords: ['milei', 'argentina president', 'buenos aires'], since: 'Dec 2023', party: 'La Libertad Avanza',
- focus: ['dollarization', 'spending cuts', 'deregulation'] },
- { id: 'lula', name: 'Luiz Inácio Lula da Silva', title: 'President', country: 'Brazil', flag: '🇧🇷',
- keywords: ['lula', 'brazil president', 'brasilia'], since: 'Jan 2023', party: 'PT',
- focus: ['amazon', 'social programs', 'brics'] },
-
- // Canada
- { id: 'carney', name: 'Mark Carney', title: 'Prime Minister', country: 'Canada', flag: '🇨🇦',
- keywords: ['carney', 'canadian pm', 'canada prime minister', 'ottawa'], since: 'Mar 2025', party: 'Liberal',
- focus: ['tariffs', 'us relations', 'economy'] }
-];
-
-// AI RSS feeds for arms race tracking
-export const AI_FEEDS = [
- { name: 'OpenAI', url: 'https://openai.com/news/rss.xml' },
- { name: 'Google AI', url: 'https://blog.google/technology/ai/rss/' },
- { name: 'DeepMind', url: 'https://deepmind.google/blog/rss.xml' },
- { name: 'Hugging Face', url: 'https://huggingface.co/blog/feed.xml' },
- { name: 'MIT AI News', url: 'https://news.mit.edu/rss/topic/artificial-intelligence2' },
- { name: 'VentureBeat AI', url: 'https://venturebeat.com/category/ai/feed' }
-];
diff --git a/static/js/data.js b/static/js/data.js
deleted file mode 100644
index 291745d..0000000
--- a/static/js/data.js
+++ /dev/null
@@ -1,648 +0,0 @@
-// data.js - All data fetching functions with service layer integration
-
-import { CORS_PROXIES, ALERT_KEYWORDS, SECTORS, COMMODITIES, INTEL_SOURCES, AI_FEEDS, WORLD_LEADERS } from './constants.js';
-import { serviceClient } from './services/index.js';
-
-// Fetch with proxy fallback - now uses ServiceClient
-export async function fetchWithProxy(url) {
- return serviceClient.fetchWithProxy(url);
-}
-
-// Worker URL for RSS parsing
-const WORKER_URL = 'https://situation-monitor-proxy.seanthielen-e.workers.dev';
-
-// Simple in-memory cache for Worker responses (avoids network hop on re-renders)
-const workerCache = new Map();
-const CACHE_TTL = 3 * 60 * 1000; // 3 minutes (Worker edge cache is 5 min)
-
-function getCachedWorkerResponse(url) {
- const entry = workerCache.get(url);
- if (!entry) return null;
- if (Date.now() - entry.timestamp > CACHE_TTL) {
- workerCache.delete(url);
- return null;
- }
- return entry.data;
-}
-
-function setCachedWorkerResponse(url, data) {
- // Limit cache size to prevent memory bloat
- if (workerCache.size > 100) {
- const oldest = workerCache.keys().next().value;
- workerCache.delete(oldest);
- }
- workerCache.set(url, { data, timestamp: Date.now() });
-}
-
-// Fetch RSS feed using Cloudflare Worker with built-in RSS-to-JSON parsing
-export async function fetchFeedViaJson(source) {
- const proxyUrl = `${WORKER_URL}/?url=${encodeURIComponent(source.url)}&format=json`;
-
- // Check memory cache first
- const cached = getCachedWorkerResponse(proxyUrl);
- if (cached) {
- return cached.map(item => ({ ...item, _cached: true }));
- }
-
- try {
- const response = await fetch(proxyUrl);
-
- if (!response.ok) {
- throw new Error(`HTTP ${response.status}`);
- }
-
- const data = await response.json();
- if (data.status !== 'ok' || !data.items) return [];
-
- const items = data.items.slice(0, 5).map(item => ({
- source: source.name,
- title: (item.title || 'No title').trim(),
- link: item.link || '',
- pubDate: item.pubDate || '',
- isAlert: hasAlertKeyword(item.title || ''),
- _cached: false
- }));
-
- // Cache the result
- setCachedWorkerResponse(proxyUrl, items);
- return items;
- } catch (e) {
- console.log(`Worker failed for ${source.name}, trying XML fallback...`);
- return null; // Signal to try XML fallback
- }
-}
-
-// Check for alert keywords
-export function hasAlertKeyword(title) {
- const lower = title.toLowerCase();
- return ALERT_KEYWORDS.some(kw => lower.includes(kw));
-}
-
-// Parse RSS feed - tries Cloudflare Worker JSON first, then falls back to XML
-export async function fetchFeed(source) {
- // Try Worker RSS-to-JSON first
- const jsonResult = await fetchFeedViaJson(source);
- if (jsonResult?.length > 0) {
- return jsonResult;
- }
-
- // Fallback to XML proxy
- 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);
-}
-
-// Baseline market data (updated periodically with realistic values)
-const BASELINE_PRICES = {
- // Indices
- '^GSPC': { price: 5950, name: 'S&P 500', display: 'SPX' },
- '^DJI': { price: 42500, name: 'Dow Jones', display: 'DJI' },
- '^IXIC': { price: 19200, name: 'NASDAQ', display: 'NDX' },
- // Stocks
- 'AAPL': { price: 258, name: 'Apple', display: 'AAPL' },
- 'MSFT': { price: 425, name: 'Microsoft', display: 'MSFT' },
- 'NVDA': { price: 148, name: 'NVIDIA', display: 'NVDA' },
- 'GOOGL': { price: 198, name: 'Alphabet', display: 'GOOGL' },
- 'AMZN': { price: 225, name: 'Amazon', display: 'AMZN' },
- 'META': { price: 615, name: 'Meta', display: 'META' },
- 'TSLA': { price: 395, name: 'Tesla', display: 'TSLA' },
- 'BRK-B': { price: 468, name: 'Berkshire', display: 'BRK.B' },
- 'TSM': { price: 205, name: 'TSMC', display: 'TSM' },
- 'LLY': { price: 780, name: 'Eli Lilly', display: 'LLY' },
- 'AVGO': { price: 240, name: 'Broadcom', display: 'AVGO' },
- 'WMT': { price: 92, name: 'Walmart', display: 'WMT' },
- 'JPM': { price: 245, name: 'JPMorgan', display: 'JPM' },
- 'V': { price: 320, name: 'Visa', display: 'V' },
- 'UNH': { price: 530, name: 'UnitedHealth', display: 'UNH' },
- 'NVO': { price: 98, name: 'Novo Nordisk', display: 'NVO' },
- 'XOM': { price: 108, name: 'Exxon', display: 'XOM' },
- 'MA': { price: 525, name: 'Mastercard', display: 'MA' },
- 'ORCL': { price: 175, name: 'Oracle', display: 'ORCL' },
- 'PG': { price: 168, name: 'P&G', display: 'PG' },
- 'COST': { price: 935, name: 'Costco', display: 'COST' },
- 'JNJ': { price: 145, name: 'J&J', display: 'JNJ' },
- 'HD': { price: 405, name: 'Home Depot', display: 'HD' },
- 'NFLX': { price: 875, name: 'Netflix', display: 'NFLX' },
- 'BAC': { price: 46, name: 'BofA', display: 'BAC' },
- // Sector ETFs
- 'XLK': { price: 235, name: 'Tech' },
- 'XLF': { price: 48, name: 'Finance' },
- 'XLE': { price: 88, name: 'Energy' },
- 'XLV': { price: 145, name: 'Health' },
- 'XLY': { price: 215, name: 'Consumer' },
- 'XLI': { price: 135, name: 'Industrial' },
- 'XLP': { price: 82, name: 'Staples' },
- 'XLU': { price: 75, name: 'Utilities' },
- 'XLB': { price: 92, name: 'Materials' },
- 'XLRE': { price: 42, name: 'Real Est' },
- 'XLC': { price: 95, name: 'Comms' },
- 'SMH': { price: 265, name: 'Semis' },
- // Commodities
- '^VIX': { price: 18, name: 'VIX', display: 'VIX' },
- 'GC=F': { price: 2650, name: 'Gold', display: 'GOLD' },
- 'CL=F': { price: 72, name: 'Crude Oil', display: 'OIL' },
- 'NG=F': { price: 3.2, name: 'Natural Gas', display: 'NATGAS' },
- 'SI=F': { price: 31, name: 'Silver', display: 'SILVER' },
- 'HG=F': { price: 4.1, name: 'Copper', display: 'COPPER' }
-};
-
-// Generate realistic market variation
-function getMarketVariation() {
- // Simulates daily market movement (-2% to +2%)
- return (Math.random() - 0.5) * 4;
-}
-
-// Fetch stock quote - uses fallback data since free APIs require keys
-export async function fetchQuote(symbol) {
- const baseline = BASELINE_PRICES[symbol];
- if (baseline) {
- const change = getMarketVariation();
- const price = baseline.price * (1 + change / 100);
- return { price, change };
- }
- return null;
-}
-
-// Fetch market data (stocks + crypto) - crypto now uses ServiceClient with caching
-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));
- markets.push(...stockResults.filter(Boolean));
-
- // Crypto - now uses ServiceClient with caching and circuit breaker
- try {
- const result = await serviceClient.request('COINGECKO', '/api/v3/simple/price', {
- params: {
- ids: 'bitcoin,ethereum,solana',
- vs_currencies: 'usd',
- include_24hr_change: 'true'
- }
- });
-
- const crypto = result.data;
- 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.message);
- }
-
- 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 congressional trades news (original data source no longer available)
-export async function fetchCongressTrades() {
- // Note: The House Stock Watcher S3 bucket is no longer publicly accessible.
- // This now fetches congressional trading-related news instead.
- try {
- const feedUrl = 'https://news.google.com/rss/search?q=congress+stock+trading+disclosure&hl=en-US&gl=US&ceid=US:en';
- const proxyUrl = `${WORKER_URL}/?url=${encodeURIComponent(feedUrl)}&format=json`;
- const response = await fetch(proxyUrl);
-
- if (!response.ok) throw new Error(`HTTP ${response.status}`);
-
- const data = await response.json();
- if (data.status === 'ok' && data.items) {
- return data.items.slice(0, 10).map(item => ({
- name: item.title.substring(0, 50) + (item.title.length > 50 ? '...' : ''),
- party: '-',
- ticker: 'NEWS',
- action: 'INFO',
- amount: '',
- date: item.pubDate?.split(' ')[0] || '',
- link: item.link,
- isNews: true
- }));
- }
- } catch (error) {
- console.error('Error fetching congress trades news:', error.message);
- }
- 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 - using Cloudflare Worker
-export async function fetchAINews() {
- const fetchAIFeed = async (source) => {
- const proxyUrl = `${WORKER_URL}/?url=${encodeURIComponent(source.url)}&format=json`;
- const response = await fetch(proxyUrl);
-
- if (!response.ok) return [];
-
- const data = await response.json();
- if (data.status !== 'ok' || !data.items) return [];
-
- return data.items.slice(0, 3).map(item => ({
- source: source.name,
- title: (item.title || 'No title').trim(),
- link: item.link || '',
- date: item.pubDate || ''
- }));
- };
-
- const results = await Promise.allSettled(AI_FEEDS.map(fetchAIFeed));
- const items = results
- .filter(r => r.status === 'fulfilled')
- .flatMap(r => r.value);
-
- return items.sort((a, b) => new Date(b.date) - new Date(a.date)).slice(0, 15);
-}
-
-// Fetch Fed balance sheet from FRED - routed through CORS proxy
-export async function fetchFedBalance() {
- try {
- // FRED doesn't support CORS, so we route through proxy
- const fredUrl = 'https://fred.stlouisfed.org/graph/fredgraph.csv?id=WALCL&cosd=2024-01-01';
- const text = await serviceClient.fetchWithProxy(fredUrl);
-
- // Parse CSV (format: observation_date,WALCL)
- const lines = text.trim().split('\n').slice(1); // Skip header
- if (lines.length >= 2) {
- const latestLine = lines[lines.length - 1].split(',');
- const previousLine = lines[lines.length - 2].split(',');
-
- const latest = parseFloat(latestLine[1]);
- const previous = parseFloat(previousLine[1]);
- const change = latest - previous;
- const changePercent = (change / previous) * 100;
-
- return {
- value: latest / 1000000,
- change: change / 1000000,
- changePercent,
- date: latestLine[0],
- percentOfMax: (latest / 9000000) * 100
- };
- }
- } catch (error) {
- console.error('Error fetching Fed balance:', error.message);
- }
-
- return {
- value: 6.8,
- change: 0,
- changePercent: 0,
- date: new Date().toISOString().split('T')[0],
- percentOfMax: 75
- };
-}
-
-// Fetch Polymarket data
-export async function fetchPolymarket() {
- // Polymarket API requires authentication - return curated prediction data
- // These represent active prediction markets on major events
- return [
- { question: 'Will there be a US-China military incident in 2026?', yes: 0.18, volume: '2.4M' },
- { question: 'Will Bitcoin reach $150K by end of 2026?', yes: 0.35, volume: '8.1M' },
- { question: 'Will Fed cut rates in Q1 2026?', yes: 0.42, volume: '5.2M' },
- { question: 'Will AI cause major job losses in 2026?', yes: 0.28, volume: '1.8M' },
- { question: 'Will Ukraine conflict end in 2026?', yes: 0.22, volume: '3.5M' },
- { question: 'Will Trump complete full term?', yes: 0.78, volume: '12.3M' },
- { question: 'Will oil prices exceed $100/barrel?', yes: 0.31, volume: '2.1M' },
- { question: 'Will there be a major cyberattack on US infrastructure?', yes: 0.45, volume: '1.5M' }
- ];
-}
-
-// Fetch earthquake data from USGS - now with ServiceClient
-export async function fetchEarthquakes() {
- try {
- const result = await serviceClient.request('USGS', '/earthquakes/feed/v1.0/summary/4.5_day.geojson', {});
-
- const data = result.data;
- return data.features.map(f => ({
- id: f.id,
- mag: 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.message);
- 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 [];
- }
-}
-
-// Helper function for GDELT queries via ServiceClient
-async function fetchGDELTQuery(query, maxrecords = 10) {
- try {
- const result = await serviceClient.request('GDELT', '/api/v2/doc/doc', {
- params: {
- query: query,
- mode: 'artlist',
- maxrecords: maxrecords,
- format: 'json',
- sort: 'date'
- }
- });
-
- return (result.data.articles || []).map(article => ({
- source: article.domain || 'GDELT',
- title: article.title || '',
- link: article.url || '',
- pubDate: article.seendate || '',
- isAlert: ALERT_KEYWORDS.some(kw => (article.title || '').toLowerCase().includes(kw))
- }));
- } catch (error) {
- console.log(`GDELT query failed: ${query.substring(0, 30)}...`);
- return [];
- }
-}
-
-// Fetch general news from GDELT as fallback for correlation/narrative analysis - now with ServiceClient
-export async function fetchGDELTNews() {
- const queries = [
- '(politics OR government OR congress)',
- '(technology OR AI OR "artificial intelligence")',
- '(economy OR finance OR markets)',
- '(world OR international OR global)',
- '(military OR defense OR security)'
- ];
-
- const results = await Promise.allSettled(
- queries.map(query => fetchGDELTQuery(query, 10))
- );
-
- const items = results
- .filter(r => r.status === 'fulfilled' && r.value)
- .flatMap(r => r.value);
-
- // Remove duplicates by title prefix
- const seen = new Set();
- return items.filter(item => {
- const key = item.title.toLowerCase().substring(0, 50);
- if (seen.has(key)) return false;
- seen.add(key);
- return true;
- }).slice(0, 50);
-}
-
-// Fetch situation-specific news using GDELT - now with ServiceClient
-export async function fetchSituationNews(keywords, limit = 10) {
- try {
- return await fetchGDELTQuery(keywords, limit);
- } catch (error) {
- console.error('Error fetching situation news:', error);
- return [];
- }
-}
-
-// Fetch Intel feed using GDELT API - now with ServiceClient
-export async function fetchIntelFeed() {
- // GDELT queries for intelligence-related news
- const queries = [
- { query: '(military OR defense OR pentagon)', topics: ['DEFENSE'], regions: ['US'] },
- { query: '(intelligence OR espionage OR CIA)', topics: ['INTEL'], regions: ['US'] },
- { query: '(cyberattack OR ransomware OR hacking)', topics: ['CYBER'], regions: [] },
- { query: 'russia (ukraine OR war OR invasion)', topics: ['CONFLICT'], regions: ['EUROPE'] },
- { query: 'china (taiwan OR military)', topics: ['CONFLICT'], regions: ['APAC'] },
- { query: 'iran (nuclear OR sanctions)', topics: ['NUCLEAR', 'DIPLO'], regions: ['MENA'] },
- { query: '"north korea" (missile OR nuclear)', topics: ['NUCLEAR'], regions: ['APAC'] }
- ];
-
- const fetchIntelQuery = async ({ query, topics, regions }) => {
- const result = await serviceClient.request('GDELT', '/api/v2/doc/doc', {
- params: { query, mode: 'artlist', maxrecords: 5, format: 'json', sort: 'date' }
- });
-
- return (result.data.articles || []).map(article => {
- const domain = article.domain || '';
- const sourceType = domain.includes('.gov') ? 'govt' :
- domain.includes('bellingcat') ? 'osint' : 'news';
- return {
- source: domain || 'Unknown',
- sourceType,
- title: article.title || '',
- link: article.url || '',
- pubDate: article.seendate || '',
- isAlert: ALERT_KEYWORDS.some(kw => (article.title || '').toLowerCase().includes(kw)),
- regions,
- topics
- };
- });
- };
-
- const results = await Promise.allSettled(queries.map(fetchIntelQuery));
- const items = results
- .filter(r => r.status === 'fulfilled')
- .flatMap(r => r.value);
-
- // Remove duplicates by title prefix
- const seen = new Set();
- const unique = items.filter(item => {
- const key = item.title.toLowerCase().substring(0, 50);
- if (seen.has(key)) return false;
- seen.add(key);
- return true;
- });
-
- // Sort by alert status then date
- unique.sort((a, b) => {
- if (a.isAlert !== b.isAlert) return a.isAlert ? -1 : 1;
- return new Date(b.pubDate) - new Date(a.pubDate);
- });
-
- return unique.slice(0, 30);
-}
-
-// Export serviceClient health status for debugging
-export function getServiceHealth() {
- return serviceClient.getHealthStatus();
-}
-
-// Fetch world leaders news - queries GDELT for each leader
-export async function fetchWorldLeaders() {
- const fetchLeaderNews = async (leader) => {
- // Build query from leader's keywords
- const query = leader.keywords.map(k => `"${k}"`).join(' OR ');
-
- try {
- const result = await serviceClient.request('GDELT', '/api/v2/doc/doc', {
- params: {
- query: query,
- mode: 'artlist',
- maxrecords: 5,
- format: 'json',
- sort: 'date'
- }
- });
-
- const news = (result.data.articles || []).map(article => ({
- source: article.domain || 'Unknown',
- title: article.title || '',
- link: article.url || '',
- pubDate: article.seendate || ''
- }));
-
- return { ...leader, news };
- } catch (error) {
- return { ...leader, news: [] };
- }
- };
-
- // Fetch news for all leaders in parallel (with some batching to avoid rate limits)
- const batchSize = 5;
- const results = [];
-
- for (let i = 0; i < WORLD_LEADERS.length; i += batchSize) {
- const batch = WORLD_LEADERS.slice(i, i + batchSize);
- const batchResults = await Promise.allSettled(batch.map(fetchLeaderNews));
- results.push(...batchResults.map(r => r.status === 'fulfilled' ? r.value : null).filter(Boolean));
- }
-
- // Sort by news activity (leaders with more news first)
- return results.sort((a, b) => (b.news?.length || 0) - (a.news?.length || 0));
-}
diff --git a/static/js/intelligence.js b/static/js/intelligence.js
deleted file mode 100644
index 7434ad7..0000000
--- a/static/js/intelligence.js
+++ /dev/null
@@ -1,516 +0,0 @@
-// 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/static/js/main.js b/static/js/main.js
deleted file mode 100644
index 00e4e7e..0000000
--- a/static/js/main.js
+++ /dev/null
@@ -1,281 +0,0 @@
-// main.js - Application entry point
-
-// Import all modules
-import { FEEDS } from './constants.js';
-import { setStatus } from './utils.js';
-import {
- fetchCategory, fetchMarkets, fetchSectors, fetchCommodities,
- fetchEarthquakes, fetchWhaleTransactions,
- fetchGovContracts, fetchAINews, fetchFedBalance, fetchPolymarket,
- fetchLayoffs, fetchSituationNews, fetchIntelFeed, fetchGDELTNews,
- fetchWorldLeaders
-} from './data.js';
-import { renderGlobalMap } from './map.js';
-import {
- isPanelEnabled, togglePanel, toggleSettings, applyPanelSettings,
- initPanels, resetPanelOrder
-} from './panels.js';
-import {
- renderNews, renderMarkets, renderHeatmap, renderCommodities,
- renderPolymarket, renderWhaleWatch,
- renderMainCharacter, renderGovContracts, renderAINews,
- renderMoneyPrinter, renderIntelFeed, renderLayoffs, renderSituation,
- renderWorldLeaders
-} from './renderers.js';
-import {
- analyzeCorrelations, renderCorrelationEngine,
- analyzeNarratives, renderNarrativeTracker,
- calculateMainCharacter
-} from './intelligence.js';
-import {
- renderMonitorsList, openMonitorForm, closeMonitorForm,
- selectMonitorColor, saveMonitor, editMonitor, deleteMonitor,
- renderMonitorsPanel
-} from './monitors.js';
-import { initOnboarding, isFirstVisit } from './onboarding.js';
-
-// Expose functions to window for onclick handlers
-window.togglePanel = (id) => togglePanel(id, refreshAll);
-window.toggleSettings = () => toggleSettings(renderMonitorsList);
-window.resetPanelOrder = resetPanelOrder;
-window.openMonitorForm = openMonitorForm;
-window.closeMonitorForm = closeMonitorForm;
-window.selectMonitorColor = selectMonitorColor;
-window.saveMonitor = () => saveMonitor(refreshAll);
-window.editMonitor = editMonitor;
-window.deleteMonitor = (id) => deleteMonitor(id, refreshAll);
-
-// Mobile menu functions
-function getMobileMenuElements() {
- return {
- menu: document.getElementById('mobileMenu'),
- btn: document.getElementById('hamburgerBtn')
- };
-}
-
-function toggleMobileMenu() {
- const { menu, btn } = getMobileMenuElements();
- menu?.classList.toggle('open');
- btn?.classList.toggle('active');
-}
-
-function closeMobileMenu() {
- const { menu, btn } = getMobileMenuElements();
- menu?.classList.remove('open');
- btn?.classList.remove('active');
-}
-
-// Close mobile menu on outside click or resize to desktop
-document.addEventListener('click', (e) => {
- const { menu, btn } = getMobileMenuElements();
- const isOpen = menu?.classList.contains('open');
- const clickedOutside = !menu?.contains(e.target) && !btn?.contains(e.target);
- if (isOpen && clickedOutside) closeMobileMenu();
-});
-
-window.addEventListener('resize', () => {
- if (window.innerWidth > 768) closeMobileMenu();
-});
-
-window.toggleMobileMenu = toggleMobileMenu;
-window.closeMobileMenu = closeMobileMenu;
-
-// Staged refresh - loads critical data first for faster perceived startup
-async function refreshAll() {
- console.log('refreshAll started');
- const btn = document.getElementById('refreshBtn');
- if (btn) btn.disabled = true;
- setStatus('Loading critical...', true);
-
- let allNews = [];
- let politics = [], tech = [], finance = [], markets = [], sectors = [];
- let gov = [], commodities = [], polymarket = [], fedBalance = { value: 0, change: 0, changePercent: 0, percentOfMax: 0 }, earthquakes = [];
-
- // STAGE 1: Critical data (news + markets) - loads first
- try {
- const stage1Promise = Promise.allSettled([
- 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 results = await stage1Promise;
- politics = results[0].status === 'fulfilled' ? results[0].value : [];
- tech = results[1].status === 'fulfilled' ? results[1].value : [];
- finance = results[2].status === 'fulfilled' ? results[2].value : [];
- markets = results[3].status === 'fulfilled' ? results[3].value : [];
- sectors = results[4].status === 'fulfilled' ? results[4].value : [];
- } catch (e) {
- console.error('Stage 1 error:', e);
- }
-
- // 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
- try {
- const stage2Promise = Promise.allSettled([
- 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 results = await stage2Promise;
- gov = results[0].status === 'fulfilled' ? results[0].value : [];
- commodities = results[1].status === 'fulfilled' ? results[1].value : [];
- polymarket = results[2].status === 'fulfilled' ? results[2].value : [];
- fedBalance = results[3].status === 'fulfilled' ? results[3].value : { value: 0, change: 0, changePercent: 0, percentOfMax: 0 };
- earthquakes = results[4].status === 'fulfilled' ? results[4].value : [];
- } catch (e) {
- console.error('Stage 2 error:', e);
- }
-
- 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
- if (isPanelEnabled('map')) {
- try {
- await renderGlobalMap();
- } catch (mapError) {
- console.error('Map render error:', mapError);
- }
- }
-
- // If RSS feeds failed, use GDELT as fallback for analysis panels
- if (allNews.length < 10) {
- try {
- const gdeltNews = await fetchGDELTNews();
- allNews = [...allNews, ...gdeltNews];
- console.log(`Added ${gdeltNews.length} GDELT articles as fallback`);
- } catch (e) {
- console.error('GDELT fallback error:', e);
- }
- }
-
- if (isPanelEnabled('mainchar')) {
- try {
- const mainCharRankings = calculateMainCharacter(allNews);
- renderMainCharacter(mainCharRankings);
- } catch (e) { console.error('mainchar error:', e); }
- }
-
- if (isPanelEnabled('correlation')) {
- try {
- const correlations = analyzeCorrelations(allNews);
- renderCorrelationEngine(correlations);
- } catch (e) { console.error('correlation error:', e); }
- }
-
- if (isPanelEnabled('narrative')) {
- try {
- const narratives = analyzeNarratives(allNews);
- renderNarrativeTracker(narratives);
- } catch (e) { console.error('narrative error:', e); }
- }
-
- setStatus('Loading extras...', true);
-
- // STAGE 3: Extra data - lowest priority
- let whales = [], contracts = [], aiNews = [], layoffs = [], venezuelaNews = [], greenlandNews = [], iranNews = [], intelFeed = [], leadersData = [];
- try {
- const stage3Promise = Promise.allSettled([
- 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('iran') ? fetchSituationNews('iran (protest OR uprising OR revolution OR nuclear OR irgc OR sanctions)') : Promise.resolve([]),
- isPanelEnabled('intel') ? fetchIntelFeed() : Promise.resolve([]),
- isPanelEnabled('leaders') ? fetchWorldLeaders() : Promise.resolve([])
- ]);
-
- const results = await stage3Promise;
- whales = results[0].status === 'fulfilled' ? results[0].value : [];
- contracts = results[1].status === 'fulfilled' ? results[1].value : [];
- aiNews = results[2].status === 'fulfilled' ? results[2].value : [];
- layoffs = results[3].status === 'fulfilled' ? results[3].value : [];
- venezuelaNews = results[4].status === 'fulfilled' ? results[4].value : [];
- greenlandNews = results[5].status === 'fulfilled' ? results[5].value : [];
- iranNews = results[6].status === 'fulfilled' ? results[6].value : [];
- intelFeed = results[7].status === 'fulfilled' ? results[7].value : [];
- leadersData = results[8].status === 'fulfilled' ? results[8].value : [];
- } catch (e) {
- console.error('Stage 3 error:', e);
- }
-
- 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']
- });
- }
- if (isPanelEnabled('iran')) {
- renderSituation('iranPanel', 'iranStatus', iranNews, {
- title: 'Iran Crisis',
- subtitle: 'Revolution protests, regime instability & nuclear program',
- criticalKeywords: ['protest', 'uprising', 'revolution', 'crackdown', 'killed', 'shot', 'nuclear', 'strike', 'attack', 'irgc', 'khamenei']
- });
- }
- if (isPanelEnabled('leaders')) renderWorldLeaders(leadersData);
-
- // Render My Monitors panel with all news
- if (isPanelEnabled('monitors')) {
- renderMonitorsPanel(allNews);
- }
-
- const now = new Date();
- setStatus(`Updated ${now.toLocaleTimeString()}`);
-
- if (btn) btn.disabled = false;
-}
-
-// Expose refreshAll to window
-window.refreshAll = refreshAll;
-
-// Initialize application
-document.addEventListener('DOMContentLoaded', () => {
- // Initialize panels
- initPanels(renderMonitorsList);
-
- // Initialize onboarding (shows modal on first visit)
- initOnboarding(refreshAll);
-
- // Only load data if not first visit (onboarding will trigger refreshAll after preset selection)
- if (!isFirstVisit()) {
- refreshAll();
- }
-
- // Auto-refresh every hour (users can manually refresh anytime)
- setInterval(refreshAll, 60 * 60 * 1000);
-});
diff --git a/static/js/map.js b/static/js/map.js
deleted file mode 100644
index 24de28b..0000000
--- a/static/js/map.js
+++ /dev/null
@@ -1,3 +0,0 @@
-// map.js - stub (map rendered inline in HTML)
-export async function renderGlobalMap() {}
-export function analyzeHotspotActivity() { return {}; }
diff --git a/static/js/monitors.js b/static/js/monitors.js
deleted file mode 100644
index 9969152..0000000
--- a/static/js/monitors.js
+++ /dev/null
@@ -1,270 +0,0 @@
-// 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/static/js/onboarding.js b/static/js/onboarding.js
deleted file mode 100644
index 7c5b4f6..0000000
--- a/static/js/onboarding.js
+++ /dev/null
@@ -1,121 +0,0 @@
-// onboarding.js - First-visit onboarding experience
-
-import { PRESETS, PANELS } from './constants.js';
-import { savePanelSettings, applyPanelSettings } from './panels.js';
-
-const STORAGE_KEY = 'onboardingComplete';
-const PRESET_KEY = 'selectedPreset';
-
-/**
- * Check if this is the user's first visit
- */
-export function isFirstVisit() {
- return !localStorage.getItem(STORAGE_KEY);
-}
-
-/**
- * Get the currently selected preset
- */
-export function getSelectedPreset() {
- return localStorage.getItem(PRESET_KEY) || null;
-}
-
-/**
- * Show the onboarding modal
- */
-export function showOnboarding() {
- const modal = document.getElementById('onboardingModal');
- if (modal) {
- modal.classList.add('open');
- document.body.style.overflow = 'hidden';
- }
-}
-
-/**
- * Hide the onboarding modal
- */
-export function hideOnboarding() {
- const modal = document.getElementById('onboardingModal');
- if (modal) {
- modal.classList.remove('open');
- document.body.style.overflow = '';
- }
-}
-
-/**
- * Apply a preset configuration
- */
-export function selectPreset(presetId, refreshCallback) {
- const preset = PRESETS[presetId];
- if (!preset) {
- console.error('Unknown preset:', presetId);
- return;
- }
-
- // Build panel settings - disable all panels first, then enable preset panels
- const settings = {};
- Object.keys(PANELS).forEach(panelId => {
- settings[panelId] = preset.panels.includes(panelId);
- });
-
- // Save settings
- savePanelSettings(settings);
- localStorage.setItem(PRESET_KEY, presetId);
- localStorage.setItem(STORAGE_KEY, 'true');
-
- // Apply and refresh
- applyPanelSettings();
- hideOnboarding();
-
- if (refreshCallback) {
- refreshCallback();
- }
-}
-
-/**
- * Reset onboarding to show modal again
- */
-export function resetOnboarding() {
- localStorage.removeItem(STORAGE_KEY);
- localStorage.removeItem(PRESET_KEY);
- showOnboarding();
-}
-
-/**
- * Render preset cards into the onboarding modal
- */
-export function renderOnboardingCards() {
- const container = document.getElementById('presetCards');
- if (!container) return;
-
- const presetOrder = ['news-junkie', 'trader', 'geopolitics', 'intel', 'minimal', 'everything'];
-
- container.innerHTML = presetOrder.map(id => {
- const preset = PRESETS[id];
- return `
- <div class="preset-card" onclick="selectPreset('${id}')">
- <div class="preset-icon">${preset.icon}</div>
- <div class="preset-name">${preset.name}</div>
- <div class="preset-description">${preset.description}</div>
- <div class="preset-panel-count">${preset.panels.length} panels</div>
- </div>
- `;
- }).join('');
-}
-
-/**
- * Initialize onboarding - call on DOMContentLoaded
- */
-export function initOnboarding(refreshCallback) {
- // Render preset cards
- renderOnboardingCards();
-
- // Expose selectPreset to window for onclick handlers
- window.selectPreset = (presetId) => selectPreset(presetId, refreshCallback);
- window.resetOnboarding = resetOnboarding;
-
- // Show modal if first visit
- if (isFirstVisit()) {
- showOnboarding();
- }
-}
diff --git a/static/js/panels.js b/static/js/panels.js
deleted file mode 100644
index fe5fc53..0000000
--- a/static/js/panels.js
+++ /dev/null
@@ -1,229 +0,0 @@
-// 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;
-}
-
-// 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');
- if (!modal) return;
- modal.classList.toggle('open');
- if (modal.classList.contains('open')) {
- updateSettingsUI();
- if (renderMonitorsList) renderMonitorsList();
- }
-}
-
-// 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('');
-}
-
-// Initialize drag and drop
-function initDragAndDrop() {
- const dashboard = document.querySelector('.dashboard');
- if (!dashboard) return;
-
- dashboard.querySelectorAll('.panel').forEach(panel => {
- const panelId = panel.dataset.panel;
- const isDraggable = !NON_DRAGGABLE_PANELS.includes(panelId);
- panel.setAttribute('draggable', isDraggable ? 'true' : 'false');
-
- if (!isDraggable) return;
-
- panel.addEventListener('dragstart', (e) => {
- draggedPanel = panel;
- panel.classList.add('dragging');
- e.dataTransfer.effectAllowed = 'move';
- });
-
- panel.addEventListener('dragend', () => {
- panel.classList.remove('dragging');
- document.querySelectorAll('.drag-over').forEach(p => p.classList.remove('drag-over'));
- draggedPanel = null;
- savePanelOrder();
- });
-
- panel.addEventListener('dragover', (e) => {
- e.preventDefault();
- 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 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/restore panel order
-function savePanelOrder() {
- const dashboard = document.querySelector('.dashboard');
- if (!dashboard) return;
- const order = [...dashboard.querySelectorAll('.panel')].map(p => p.dataset.panel);
- localStorage.setItem('panelOrder', JSON.stringify(order));
-}
-
-function restorePanelOrder() {
- const saved = localStorage.getItem('panelOrder');
- if (!saved) return;
- try {
- const order = JSON.parse(saved);
- 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) {}
-}
-
-export function resetPanelOrder() {
- localStorage.removeItem('panelOrder');
- location.reload();
-}
-
-// Panel resize
-function initPanelResize() {
- document.querySelectorAll('.panel').forEach(panel => {
- if (panel.querySelector('.panel-resize-handle')) return;
-
- const handle = document.createElement('div');
- handle.className = 'panel-resize-handle corner';
- handle.addEventListener('mousedown', (e) => {
- e.preventDefault();
- resizingPanel = panel;
- resizeStart = { x: e.clientX, y: e.clientY, width: panel.offsetWidth, height: panel.offsetHeight };
- panel.classList.add('resizing');
- });
- panel.appendChild(handle);
- });
-
- document.addEventListener('mousemove', (e) => {
- if (!resizingPanel) return;
- const newWidth = Math.max(200, resizeStart.width + (e.clientX - resizeStart.x));
- const newHeight = Math.max(150, resizeStart.height + (e.clientY - resizeStart.y));
- resizingPanel.style.width = newWidth + 'px';
- resizingPanel.style.minHeight = newHeight + 'px';
- });
-
- document.addEventListener('mouseup', () => {
- if (resizingPanel) {
- resizingPanel.classList.remove('resizing');
- savePanelSizes();
- resizingPanel = null;
- }
- });
-}
-
-function savePanelSizes() {
- const sizes = {};
- document.querySelectorAll('.panel').forEach(panel => {
- const name = panel.dataset.panel;
- if (name && (panel.style.minHeight || panel.style.width)) {
- sizes[name] = { 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(([name, dims]) => {
- const panel = document.querySelector(`.panel[data-panel="${name}"]`);
- if (panel) {
- if (dims.height) panel.style.minHeight = dims.height;
- if (dims.width) panel.style.width = dims.width;
- }
- });
- } catch (e) {}
-}
-
-// Initialize all panel functionality
-export function initPanels() {
- applyPanelSettings();
- restorePanelOrder();
- restorePanelSizes();
- initDragAndDrop();
- initPanelResize();
-}
diff --git a/static/js/renderers.js b/static/js/renderers.js
deleted file mode 100644
index fb1cd2a..0000000
--- a/static/js/renderers.js
+++ /dev/null
@@ -1,507 +0,0 @@
-// 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;
- }
-
- const getColorClass = (change) => {
- if (change >= 2) return 'up-3';
- if (change >= 1) return 'up-2';
- if (change >= 0.5) return 'up-1';
- if (change >= 0) return 'up-0';
- if (change >= -0.5) return 'down-0';
- if (change >= -1) return 'down-1';
- if (change >= -2) return 'down-2';
- return 'down-3';
- };
-
- panel.innerHTML = '<div class="heatmap">' + sectors.map(s => `
- <div class="heatmap-cell ${getColorClass(s.change)}">
- <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 (typeof v === 'string') return '$' + v;
- if (!v) return '$0';
- if (v >= 1e6) return '$' + (v / 1e6).toFixed(1) + 'M';
- if (v >= 1e3) return '$' + (v / 1e3).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 trade news</div>';
- count.textContent = '0';
- return;
- }
-
- // Check if these are news items (new format) or trades (old format)
- const isNews = trades[0]?.isNews;
-
- if (isNews) {
- panel.innerHTML = trades.map(t => `
- <div class="congress-item">
- <div class="congress-info" style="width: 100%;">
- <a href="${t.link}" target="_blank" class="congress-name" style="font-size: 0.65rem; line-height: 1.3; display: block;">
- ${escapeHtml(t.name)}
- </a>
- <div class="congress-meta">${t.date ? timeAgo(t.date) : ''}</div>
- </div>
- </div>
- `).join('');
- } else {
- panel.innerHTML = trades.map(t => `
- <div class="congress-item">
- <div class="congress-info">
- <div>
- <span class="congress-name">${escapeHtml(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 ? ' · ' + t.district : ''}</div>
- </div>
- <div class="congress-type">
- <span class="congress-action ${t.action}">${t.action}</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;
-
- const buildTags = (item) => {
- const tags = [];
- if (item.sourceType === 'osint') tags.push('<span class="intel-tag osint">OSINT</span>');
- else if (item.sourceType === 'govt') tags.push('<span class="intel-tag govt">GOVT</span>');
- tags.push(...item.regions.slice(0, 2).map(r => `<span class="intel-tag region">${r}</span>`));
- tags.push(...item.topics.slice(0, 2).map(t => `<span class="intel-tag topic">${t}</span>`));
- return tags.join('');
- };
-
- panel.innerHTML = items.map(item => {
- 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">${buildTags(item)}</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}
- `;
-}
-
-// Render World Leaders panel
-export function renderWorldLeaders(leadersData) {
- const panel = document.getElementById('leadersPanel');
- const count = document.getElementById('leadersCount');
-
- if (!leadersData || leadersData.length === 0) {
- panel.innerHTML = '<div class="loading-msg">Loading leaders data...</div>';
- count.textContent = '-';
- return;
- }
-
- count.textContent = leadersData.length;
-
- panel.innerHTML = `<div class="leaders-grid">${leadersData.map(leader => {
- const newsCount = leader.news?.length || 0;
- const activityClass = newsCount >= 3 ? 'high-activity' : newsCount >= 1 ? 'active' : '';
- const latestNews = leader.news?.slice(0, 2) || [];
- const focusTopics = leader.focus?.slice(0, 3).map(f => `<span class="leader-focus">${f}</span>`).join('') || '';
-
- return `
- <div class="leader-card ${activityClass}">
- <div class="leader-header">
- <span class="leader-flag">${leader.flag}</span>
- <div class="leader-info">
- <div class="leader-name">${leader.name}</div>
- <div class="leader-title">${leader.title}</div>
- <div class="leader-country">${leader.country}</div>
- </div>
- ${newsCount > 0 ? `<div class="leader-activity-badge">${newsCount}</div>` : ''}
- </div>
- <div class="leader-meta">
- <span class="leader-since">Since ${leader.since}</span>
- <span class="leader-party">${leader.party}</span>
- </div>
- ${focusTopics ? `<div class="leader-focus-topics">${focusTopics}</div>` : ''}
- ${latestNews.length > 0 ? `
- <div class="leader-news">
- ${latestNews.map(n => `
- <a href="${n.link}" target="_blank" class="leader-news-item" title="${n.title}">
- ${n.title.length > 60 ? n.title.substring(0, 60) + '...' : n.title}
- </a>
- `).join('')}
- </div>
- ` : ''}
- </div>
- `;
- }).join('')}</div>`;
-}
diff --git a/static/js/services/CacheManager.js b/static/js/services/CacheManager.js
deleted file mode 100644
index 8f8a68c..0000000
--- a/static/js/services/CacheManager.js
+++ /dev/null
@@ -1,231 +0,0 @@
-// CacheManager.js - Two-tier caching with memory (L1) and localStorage (L2)
-
-export class CacheManager {
- constructor(options = {}) {
- this.memoryCache = new Map();
- this.storagePrefix = options.prefix || 'sm_cache_';
- this.maxMemorySize = options.maxMemorySize || 100;
- this.debug = options.debug || false;
- }
-
- /**
- * Generate a cache key from URL and params
- */
- generateKey(url, params = {}) {
- const sortedParams = Object.keys(params)
- .sort()
- .map(k => `${k}=${params[k]}`)
- .join('&');
- return `${url}${sortedParams ? '?' + sortedParams : ''}`;
- }
-
- /**
- * Get from cache - checks memory first, then localStorage
- * Returns: { data, fromCache: 'memory'|'storage', isStale } or null
- */
- get(key) {
- // L1: Memory check
- if (this.memoryCache.has(key)) {
- const entry = this.memoryCache.get(key);
- if (this.isValid(entry)) {
- this.log(`Cache HIT (memory): ${key.substring(0, 50)}...`);
- return { data: entry.data, fromCache: 'memory', isStale: this.isStale(entry) };
- }
- this.memoryCache.delete(key);
- }
-
- // L2: Storage check
- try {
- const stored = localStorage.getItem(this.storagePrefix + this.hashKey(key));
- if (stored) {
- const entry = JSON.parse(stored);
- if (this.isValid(entry)) {
- // Promote to memory cache
- this.setMemory(key, entry);
- this.log(`Cache HIT (storage): ${key.substring(0, 50)}...`);
- return { data: entry.data, fromCache: 'storage', isStale: this.isStale(entry) };
- }
- localStorage.removeItem(this.storagePrefix + this.hashKey(key));
- }
- } catch (e) {
- // Storage read error - continue without cache
- this.log(`Storage read error: ${e.message}`);
- }
-
- this.log(`Cache MISS: ${key.substring(0, 50)}...`);
- return null;
- }
-
- /**
- * Set in both caches
- */
- set(key, data, ttl, staleWhileRevalidate = true) {
- const now = Date.now();
- const entry = {
- data,
- timestamp: now,
- ttl,
- staleUntil: staleWhileRevalidate ? now + ttl * 2 : now + ttl
- };
-
- this.setMemory(key, entry);
- this.setStorage(key, entry);
- this.log(`Cache SET: ${key.substring(0, 50)}... (TTL: ${ttl / 1000}s)`);
- }
-
- /**
- * Memory cache with LRU eviction
- */
- setMemory(key, entry) {
- // LRU eviction - remove oldest entry if at capacity
- if (this.memoryCache.size >= this.maxMemorySize) {
- const firstKey = this.memoryCache.keys().next().value;
- this.memoryCache.delete(firstKey);
- }
- this.memoryCache.set(key, entry);
- }
-
- /**
- * Storage with error handling and quota management
- */
- setStorage(key, entry) {
- try {
- const serialized = JSON.stringify(entry);
- localStorage.setItem(this.storagePrefix + this.hashKey(key), serialized);
- } catch (e) {
- if (e.name === 'QuotaExceededError') {
- this.pruneStorage();
- try {
- localStorage.setItem(this.storagePrefix + this.hashKey(key), JSON.stringify(entry));
- } catch (e2) {
- this.log(`Storage quota exceeded, could not save: ${key.substring(0, 30)}...`);
- }
- }
- }
- }
-
- /**
- * Check if entry is still valid (not beyond stale period)
- */
- isValid(entry) {
- return Date.now() < entry.staleUntil;
- }
-
- /**
- * Check if entry is stale (past TTL but still within stale period)
- */
- isStale(entry) {
- return Date.now() > entry.timestamp + entry.ttl;
- }
-
- /**
- * Hash long keys to fit in localStorage key limits
- */
- hashKey(key) {
- // Simple hash for shorter localStorage keys
- let hash = 0;
- for (let i = 0; i < key.length; i++) {
- const char = key.charCodeAt(i);
- hash = ((hash << 5) - hash) + char;
- hash = hash & hash; // Convert to 32-bit integer
- }
- return Math.abs(hash).toString(36);
- }
-
- /**
- * Remove oldest cache entries to free up space
- */
- pruneStorage() {
- const keys = [];
- for (let i = 0; i < localStorage.length; i++) {
- const key = localStorage.key(i);
- if (key?.startsWith(this.storagePrefix)) {
- try {
- const entry = JSON.parse(localStorage.getItem(key));
- keys.push({ key, timestamp: entry.timestamp });
- } catch (e) {
- // Invalid entry - remove it
- localStorage.removeItem(key);
- }
- }
- }
- // Sort by timestamp (oldest first) and remove half
- keys.sort((a, b) => a.timestamp - b.timestamp);
- keys.slice(0, Math.ceil(keys.length / 2)).forEach(k => localStorage.removeItem(k.key));
- this.log(`Pruned ${Math.ceil(keys.length / 2)} old cache entries`);
- }
-
- /**
- * Invalidate cache entries matching a pattern
- */
- invalidate(pattern) {
- let count = 0;
-
- // Clear from memory
- for (const [key] of this.memoryCache) {
- if (key.includes(pattern)) {
- this.memoryCache.delete(key);
- count++;
- }
- }
-
- // Clear from storage
- for (let i = localStorage.length - 1; i >= 0; i--) {
- const key = localStorage.key(i);
- if (key?.startsWith(this.storagePrefix)) {
- localStorage.removeItem(key);
- count++;
- }
- }
-
- this.log(`Invalidated ${count} entries matching: ${pattern}`);
- }
-
- /**
- * Clear all cache entries
- */
- clear() {
- this.memoryCache.clear();
- for (let i = localStorage.length - 1; i >= 0; i--) {
- const key = localStorage.key(i);
- if (key?.startsWith(this.storagePrefix)) {
- localStorage.removeItem(key);
- }
- }
- this.log('Cache cleared');
- }
-
- /**
- * Get cache statistics
- */
- getStats() {
- let storageCount = 0;
- let storageSize = 0;
-
- for (let i = 0; i < localStorage.length; i++) {
- const key = localStorage.key(i);
- if (key?.startsWith(this.storagePrefix)) {
- storageCount++;
- storageSize += (localStorage.getItem(key) || '').length;
- }
- }
-
- return {
- memoryEntries: this.memoryCache.size,
- storageEntries: storageCount,
- storageSizeKB: Math.round(storageSize / 1024 * 100) / 100
- };
- }
-
- /**
- * Debug logging
- */
- log(message) {
- if (this.debug) {
- console.log(`[CacheManager] ${message}`);
- }
- }
-}
-
-// Export singleton instance
-export const cacheManager = new CacheManager({ prefix: 'sm_' });
diff --git a/static/js/services/CircuitBreaker.js b/static/js/services/CircuitBreaker.js
deleted file mode 100644
index dae154b..0000000
--- a/static/js/services/CircuitBreaker.js
+++ /dev/null
@@ -1,178 +0,0 @@
-// CircuitBreaker.js - Circuit breaker pattern for failing services
-
-const STATES = {
- CLOSED: 'CLOSED', // Normal operation - requests flow through
- OPEN: 'OPEN', // Blocking requests - service is failing
- HALF_OPEN: 'HALF_OPEN' // Testing recovery - allowing limited requests
-};
-
-export class CircuitBreaker {
- constructor(serviceId, options = {}) {
- this.serviceId = serviceId;
- this.failureThreshold = options.failureThreshold || 3;
- this.resetTimeout = options.resetTimeout || 30000;
- this.halfOpenMaxRequests = options.halfOpenMaxRequests || 1;
-
- this.state = STATES.CLOSED;
- this.failures = 0;
- this.successes = 0;
- this.lastFailureTime = null;
- this.halfOpenRequests = 0;
- }
-
- /**
- * Check if a request can proceed
- */
- canRequest() {
- switch (this.state) {
- case STATES.CLOSED:
- return true;
-
- case STATES.OPEN:
- // Check if reset timeout has passed
- if (Date.now() - this.lastFailureTime >= this.resetTimeout) {
- this.state = STATES.HALF_OPEN;
- this.halfOpenRequests = 0;
- console.log(`[CircuitBreaker] ${this.serviceId}: OPEN -> HALF_OPEN (testing recovery)`);
- return true;
- }
- return false;
-
- case STATES.HALF_OPEN:
- return this.halfOpenRequests < this.halfOpenMaxRequests;
-
- default:
- return false;
- }
- }
-
- /**
- * Record a successful request
- */
- recordSuccess() {
- this.successes++;
-
- if (this.state === STATES.HALF_OPEN) {
- // Recovery confirmed - close the circuit
- this.state = STATES.CLOSED;
- console.log(`[CircuitBreaker] ${this.serviceId}: HALF_OPEN -> CLOSED (recovered)`);
- }
-
- this.failures = 0;
- this.halfOpenRequests = 0;
- }
-
- /**
- * Record a failed request
- */
- recordFailure() {
- this.failures++;
- this.lastFailureTime = Date.now();
-
- if (this.state === STATES.HALF_OPEN) {
- // Recovery failed - reopen the circuit
- this.state = STATES.OPEN;
- console.warn(`[CircuitBreaker] ${this.serviceId}: HALF_OPEN -> OPEN (recovery failed)`);
- } else if (this.failures >= this.failureThreshold) {
- // Threshold reached - open the circuit
- this.state = STATES.OPEN;
- console.warn(`[CircuitBreaker] ${this.serviceId}: CLOSED -> OPEN (${this.failures} failures)`);
- }
- }
-
- /**
- * Track a half-open request
- */
- trackHalfOpenRequest() {
- if (this.state === STATES.HALF_OPEN) {
- this.halfOpenRequests++;
- }
- }
-
- /**
- * Get current state information
- */
- getState() {
- return {
- state: this.state,
- failures: this.failures,
- successes: this.successes,
- lastFailure: this.lastFailureTime,
- canRequest: this.canRequest(),
- timeSinceLastFailure: this.lastFailureTime
- ? Date.now() - this.lastFailureTime
- : null,
- timeUntilRetry: this.state === STATES.OPEN
- ? Math.max(0, this.resetTimeout - (Date.now() - this.lastFailureTime))
- : 0
- };
- }
-
- /**
- * Force reset the circuit breaker
- */
- reset() {
- this.state = STATES.CLOSED;
- this.failures = 0;
- this.successes = 0;
- this.lastFailureTime = null;
- this.halfOpenRequests = 0;
- console.log(`[CircuitBreaker] ${this.serviceId}: Reset to CLOSED`);
- }
-}
-
-/**
- * Registry to manage circuit breakers for multiple services
- */
-export class CircuitBreakerRegistry {
- constructor() {
- this.breakers = new Map();
- }
-
- /**
- * Get or create a circuit breaker for a service
- */
- get(serviceId, options = {}) {
- if (!this.breakers.has(serviceId)) {
- this.breakers.set(serviceId, new CircuitBreaker(serviceId, options));
- }
- return this.breakers.get(serviceId);
- }
-
- /**
- * Get status of all circuit breakers
- */
- getStatus() {
- const status = {};
- for (const [id, breaker] of this.breakers) {
- status[id] = breaker.getState();
- }
- return status;
- }
-
- /**
- * Reset all circuit breakers
- */
- resetAll() {
- for (const breaker of this.breakers.values()) {
- breaker.reset();
- }
- }
-
- /**
- * Get count of open circuits
- */
- getOpenCount() {
- let count = 0;
- for (const breaker of this.breakers.values()) {
- if (breaker.state === STATES.OPEN) count++;
- }
- return count;
- }
-}
-
-// Export singleton registry
-export const circuitBreakerRegistry = new CircuitBreakerRegistry();
-
-// Export states for external use
-export { STATES as CircuitBreakerStates };
diff --git a/static/js/services/RequestDeduplicator.js b/static/js/services/RequestDeduplicator.js
deleted file mode 100644
index 7a4a646..0000000
--- a/static/js/services/RequestDeduplicator.js
+++ /dev/null
@@ -1,71 +0,0 @@
-// RequestDeduplicator.js - Prevent duplicate in-flight requests
-
-export class RequestDeduplicator {
- constructor() {
- this.inFlight = new Map();
- }
-
- /**
- * Get an existing in-flight request promise if one exists
- */
- get(key) {
- return this.inFlight.get(key) || null;
- }
-
- /**
- * Track a new in-flight request
- */
- track(key, promise) {
- this.inFlight.set(key, promise);
-
- // Clean up when promise resolves or rejects
- promise
- .finally(() => this.inFlight.delete(key))
- .catch(() => {}); // Prevent unhandled rejection
-
- return promise;
- }
-
- /**
- * Deduplicate: return existing promise or track new one
- */
- dedupe(key, requestFn) {
- const existing = this.get(key);
- if (existing) {
- console.log(`[Deduplicator] Reusing in-flight request: ${key.substring(0, 50)}...`);
- return existing;
- }
- return this.track(key, requestFn());
- }
-
- /**
- * Check if a request is currently in-flight
- */
- isInFlight(key) {
- return this.inFlight.has(key);
- }
-
- /**
- * Get count of in-flight requests
- */
- getCount() {
- return this.inFlight.size;
- }
-
- /**
- * Get all in-flight keys (for debugging)
- */
- getInFlightKeys() {
- return Array.from(this.inFlight.keys());
- }
-
- /**
- * Clear all tracked requests (use with caution)
- */
- clear() {
- this.inFlight.clear();
- }
-}
-
-// Export singleton instance
-export const requestDeduplicator = new RequestDeduplicator();
diff --git a/static/js/services/ServiceClient.js b/static/js/services/ServiceClient.js
deleted file mode 100644
index 6b4e71b..0000000
--- a/static/js/services/ServiceClient.js
+++ /dev/null
@@ -1,281 +0,0 @@
-// ServiceClient.js - Unified fetch client with caching, retries, and circuit breaker
-
-import { CacheManager } from './CacheManager.js';
-import { CircuitBreakerRegistry } from './CircuitBreaker.js';
-import { RequestDeduplicator } from './RequestDeduplicator.js';
-import { ServiceRegistry } from './ServiceRegistry.js';
-import { ServiceError, NetworkError, TimeoutError, CircuitOpenError } from './errors.js';
-
-export class ServiceClient {
- constructor(options = {}) {
- this.cache = new CacheManager({ prefix: 'sm_', debug: options.debug });
- this.circuitBreakers = new CircuitBreakerRegistry();
- this.deduplicator = new RequestDeduplicator();
- this.debug = options.debug || false;
- }
-
- /**
- * Main request method - handles caching, circuit breaker, deduplication
- */
- async request(serviceId, endpoint, options = {}) {
- const config = ServiceRegistry.get(serviceId);
- if (!config) {
- throw new ServiceError(`Unknown service: ${serviceId}`, serviceId);
- }
-
- const url = this.buildUrl(config, endpoint, options.params);
- const cacheKey = this.cache.generateKey(url, options.params);
-
- // 1. Check cache first (unless explicitly disabled)
- if (options.useCache !== false && config.cache) {
- const cached = this.cache.get(cacheKey);
- if (cached && !cached.isStale) {
- return { data: cached.data, fromCache: cached.fromCache, stale: false };
- }
- if (cached && cached.isStale && config.cache.staleWhileRevalidate) {
- // Return stale data immediately, revalidate in background
- this.revalidateInBackground(serviceId, endpoint, options, cacheKey, config);
- return { data: cached.data, fromCache: cached.fromCache, stale: true };
- }
- }
-
- // 2. Check circuit breaker
- const breaker = this.circuitBreakers.get(serviceId, config.circuitBreaker);
- if (!breaker.canRequest()) {
- // Circuit is open - try to return cached data
- const cached = this.cache.get(cacheKey);
- if (cached) {
- return { data: cached.data, fromCache: 'fallback', circuitOpen: true };
- }
- throw new CircuitOpenError(serviceId);
- }
-
- // 3. Deduplicate concurrent requests
- return this.deduplicator.dedupe(cacheKey, () =>
- this.executeRequest(serviceId, url, options, cacheKey, breaker, config)
- );
- }
-
- /**
- * Execute the actual request with retries
- */
- async executeRequest(serviceId, url, options, cacheKey, breaker, config) {
- const retries = options.retries ?? config.retries ?? 2;
- let lastError;
-
- for (let attempt = 0; attempt <= retries; attempt++) {
- try {
- if (attempt > 0) {
- this.log(`Retry attempt ${attempt} for ${serviceId}`);
- }
-
- breaker.trackHalfOpenRequest();
- const data = await this.fetchWithTimeout(url, options, config);
- breaker.recordSuccess();
-
- // Cache successful response
- if (config.cache) {
- this.cache.set(
- cacheKey,
- data,
- config.cache.ttl,
- config.cache.staleWhileRevalidate
- );
- }
-
- return { data, fromCache: false, attempt };
- } catch (error) {
- lastError = error;
- this.log(`Request failed (attempt ${attempt + 1}/${retries + 1}): ${error.message}`);
-
- // Don't retry on certain errors
- if (
- error instanceof CircuitOpenError ||
- error.status === 404 ||
- error.status === 401 ||
- error.status === 403
- ) {
- break;
- }
-
- if (attempt < retries) {
- await this.delay(this.getBackoffDelay(attempt));
- }
- }
- }
-
- breaker.recordFailure();
-
- // Try returning stale cache on failure
- const cached = this.cache.get(cacheKey);
- if (cached) {
- console.warn(`[ServiceClient] ${serviceId}: Returning stale cache after ${retries + 1} failed attempts`);
- return { data: cached.data, fromCache: 'stale-fallback', error: lastError.message };
- }
-
- throw lastError;
- }
-
- /**
- * Fetch with AbortController timeout
- */
- async fetchWithTimeout(url, options, config) {
- const controller = new AbortController();
- const timeout = options.timeout || config.timeout || 10000;
- const timeoutId = setTimeout(() => controller.abort(), timeout);
-
- try {
- const fetchOptions = {
- ...options.fetchOptions,
- signal: controller.signal,
- headers: {
- 'Accept': options.accept || 'application/json',
- ...options.headers
- }
- };
-
- const response = await fetch(url, fetchOptions);
-
- if (!response.ok) {
- throw new NetworkError(`HTTP ${response.status}: ${response.statusText}`, response.status);
- }
-
- // Handle different response types
- const contentType = response.headers.get('content-type') || '';
- if (options.responseType === 'text' || contentType.includes('text/') || contentType.includes('xml')) {
- return await response.text();
- }
- return await response.json();
- } catch (error) {
- if (error.name === 'AbortError') {
- throw new TimeoutError(url, timeout);
- }
- throw error;
- } finally {
- clearTimeout(timeoutId);
- }
- }
-
- /**
- * Build URL from config and endpoint
- */
- buildUrl(config, endpoint, params = {}) {
- let baseUrl = config.baseUrl || '';
-
- // Handle full URLs (for CORS proxy passthrough)
- if (endpoint.startsWith('http://') || endpoint.startsWith('https://')) {
- baseUrl = '';
- }
-
- const fullUrl = baseUrl + endpoint;
- const url = new URL(fullUrl);
-
- // Add query params
- Object.entries(params).forEach(([key, value]) => {
- if (value !== undefined && value !== null) {
- url.searchParams.set(key, value);
- }
- });
-
- return url.toString();
- }
-
- /**
- * Calculate exponential backoff delay with jitter
- */
- getBackoffDelay(attempt) {
- // Base: 1s, 2s, 4s... + random 0-500ms jitter
- const baseDelay = Math.pow(2, attempt) * 1000;
- const jitter = Math.random() * 500;
- return Math.min(baseDelay + jitter, 10000); // Max 10 seconds
- }
-
- /**
- * Delay helper
- */
- delay(ms) {
- return new Promise(resolve => setTimeout(resolve, ms));
- }
-
- /**
- * Revalidate in background (fire and forget)
- */
- revalidateInBackground(serviceId, endpoint, options, cacheKey, config) {
- const breaker = this.circuitBreakers.get(serviceId, config.circuitBreaker);
- const url = this.buildUrl(config, endpoint, options.params);
-
- this.executeRequest(serviceId, url, { ...options, useCache: false }, cacheKey, breaker, config)
- .then(() => this.log(`Background revalidation complete: ${serviceId}`))
- .catch(() => this.log(`Background revalidation failed: ${serviceId}`));
- }
-
- /**
- * Fetch through CORS proxy with fallback
- */
- async fetchWithProxy(targetUrl, options = {}) {
- const proxies = ServiceRegistry.getCorsProxies();
- const config = ServiceRegistry.get('CORS_PROXY');
- let lastError;
-
- for (let i = 0; i < proxies.length; i++) {
- const proxy = proxies[i];
- const proxyUrl = proxy + encodeURIComponent(targetUrl);
-
- try {
- const response = await this.fetchWithTimeout(proxyUrl, {
- ...options,
- accept: 'application/rss+xml, application/xml, text/xml, */*',
- responseType: 'text'
- }, config);
-
- // Validate response (check for error pages)
- if (response && !response.includes('<!DOCTYPE html>') && !response.includes('error code:')) {
- return response;
- }
- } catch (e) {
- this.log(`Proxy ${i + 1} failed: ${e.message}`);
- lastError = e;
- }
- }
-
- throw lastError || new NetworkError('All CORS proxies failed');
- }
-
- /**
- * Get health status of all services
- */
- getHealthStatus() {
- return {
- circuitBreakers: this.circuitBreakers.getStatus(),
- openCircuits: this.circuitBreakers.getOpenCount(),
- inFlightRequests: this.deduplicator.getCount(),
- cacheStats: this.cache.getStats()
- };
- }
-
- /**
- * Clear cache for a specific service pattern
- */
- clearServiceCache(pattern) {
- this.cache.invalidate(pattern);
- }
-
- /**
- * Reset all circuit breakers
- */
- resetCircuitBreakers() {
- this.circuitBreakers.resetAll();
- }
-
- /**
- * Debug logging
- */
- log(message) {
- if (this.debug) {
- console.log(`[ServiceClient] ${message}`);
- }
- }
-}
-
-// Export singleton instance
-export const serviceClient = new ServiceClient({ debug: false });
diff --git a/static/js/services/ServiceRegistry.js b/static/js/services/ServiceRegistry.js
deleted file mode 100644
index 8d33ea3..0000000
--- a/static/js/services/ServiceRegistry.js
+++ /dev/null
@@ -1,121 +0,0 @@
-// ServiceRegistry.js - Service configurations for all external APIs
-
-const SERVICE_CONFIG = {
- GDELT: {
- id: 'gdelt',
- baseUrl: 'https://api.gdeltproject.org',
- timeout: 15000,
- retries: 1,
- cache: {
- ttl: 3 * 60 * 1000, // 3 minutes (real-time news)
- staleWhileRevalidate: true
- },
- circuitBreaker: {
- failureThreshold: 2,
- resetTimeout: 60000 // 1 minute
- }
- },
-
- COINGECKO: {
- id: 'coingecko',
- baseUrl: 'https://api.coingecko.com',
- timeout: 10000,
- retries: 2,
- cache: {
- ttl: 60 * 1000, // 1 minute (crypto volatility)
- staleWhileRevalidate: false
- },
- circuitBreaker: {
- failureThreshold: 3,
- resetTimeout: 120000 // 2 minutes (API can be flaky)
- }
- },
-
- FRED: {
- id: 'fred',
- baseUrl: 'https://fred.stlouisfed.org',
- timeout: 10000,
- retries: 2,
- cache: {
- ttl: 60 * 60 * 1000, // 1 hour (weekly data)
- staleWhileRevalidate: true
- },
- circuitBreaker: {
- failureThreshold: 3,
- resetTimeout: 60000
- }
- },
-
- USGS: {
- id: 'usgs',
- baseUrl: 'https://earthquake.usgs.gov',
- timeout: 10000,
- retries: 2,
- cache: {
- ttl: 5 * 60 * 1000, // 5 minutes
- staleWhileRevalidate: true
- },
- circuitBreaker: {
- failureThreshold: 3,
- resetTimeout: 60000
- }
- },
-
- CORS_PROXY: {
- id: 'cors_proxy',
- baseUrl: null, // Uses proxy URLs from list
- proxies: [
- 'https://situation-monitor-proxy.seanthielen-e.workers.dev/?url=',
- 'https://api.allorigins.win/raw?url='
- ],
- timeout: 12000,
- retries: 1, // Already has proxy fallback
- cache: {
- ttl: 5 * 60 * 1000,
- staleWhileRevalidate: true
- },
- circuitBreaker: {
- failureThreshold: 5,
- resetTimeout: 120000
- }
- }
-};
-
-export class ServiceRegistry {
- /**
- * Get configuration for a service
- */
- static get(serviceId) {
- return SERVICE_CONFIG[serviceId] || null;
- }
-
- /**
- * Get all service IDs
- */
- static getServiceIds() {
- return Object.keys(SERVICE_CONFIG);
- }
-
- /**
- * Get all service configurations
- */
- static getAll() {
- return { ...SERVICE_CONFIG };
- }
-
- /**
- * Check if a service is registered
- */
- static has(serviceId) {
- return Object.hasOwn(SERVICE_CONFIG, serviceId);
- }
-
- /**
- * Get CORS proxies list
- */
- static getCorsProxies() {
- return SERVICE_CONFIG.CORS_PROXY.proxies;
- }
-}
-
-export { SERVICE_CONFIG };
diff --git a/static/js/services/errors.js b/static/js/services/errors.js
deleted file mode 100644
index f8f19f1..0000000
--- a/static/js/services/errors.js
+++ /dev/null
@@ -1,34 +0,0 @@
-// errors.js - Custom error classes for service layer
-
-export class ServiceError extends Error {
- constructor(message, serviceId = null) {
- super(message);
- this.name = 'ServiceError';
- this.serviceId = serviceId;
- }
-}
-
-export class NetworkError extends Error {
- constructor(message, status = null) {
- super(message);
- this.name = 'NetworkError';
- this.status = status;
- }
-}
-
-export class TimeoutError extends Error {
- constructor(url, timeout = null) {
- super(`Request timed out: ${url}`);
- this.name = 'TimeoutError';
- this.url = url;
- this.timeout = timeout;
- }
-}
-
-export class CircuitOpenError extends Error {
- constructor(serviceId) {
- super(`Circuit breaker open for service: ${serviceId}`);
- this.name = 'CircuitOpenError';
- this.serviceId = serviceId;
- }
-}
diff --git a/static/js/services/index.js b/static/js/services/index.js
deleted file mode 100644
index a2235d3..0000000
--- a/static/js/services/index.js
+++ /dev/null
@@ -1,8 +0,0 @@
-// index.js - Barrel export for service layer
-
-export { serviceClient, ServiceClient } from './ServiceClient.js';
-export { cacheManager, CacheManager } from './CacheManager.js';
-export { circuitBreakerRegistry, CircuitBreakerRegistry, CircuitBreakerStates } from './CircuitBreaker.js';
-export { requestDeduplicator, RequestDeduplicator } from './RequestDeduplicator.js';
-export { ServiceRegistry, SERVICE_CONFIG } from './ServiceRegistry.js';
-export { ServiceError, NetworkError, TimeoutError, CircuitOpenError } from './errors.js';
diff --git a/static/js/utils.js b/static/js/utils.js
deleted file mode 100644
index c181ecd..0000000
--- a/static/js/utils.js
+++ /dev/null
@@ -1,71 +0,0 @@
-// 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/static/styles.css b/static/styles.css
deleted file mode 100644
index b97a83a..0000000
--- a/static/styles.css
+++ /dev/null
@@ -1,5621 +0,0 @@
- * {
- 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: none; /* Hidden on desktop */
- 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: 15;
- }
-
- .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);
- }
-
- /* Onboarding Modal */
- .onboarding-modal {
- display: none;
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background: rgba(0, 10, 5, 0.95);
- z-index: 2000;
- justify-content: center;
- align-items: center;
- }
-
- .onboarding-modal.open {
- display: flex;
- }
-
- .onboarding-content {
- background: var(--bg);
- border: 1px solid var(--border);
- padding: 2rem;
- max-width: 600px;
- width: 90%;
- max-height: 90vh;
- overflow-y: auto;
- }
-
- .onboarding-header {
- text-align: center;
- margin-bottom: 1.5rem;
- }
-
- .onboarding-title {
- font-size: 1.1rem;
- font-weight: bold;
- letter-spacing: 0.1em;
- text-transform: uppercase;
- color: var(--green);
- margin-bottom: 0.5rem;
- }
-
- .onboarding-subtitle {
- font-size: 0.75rem;
- color: var(--text-dim);
- }
-
- .preset-cards {
- display: grid;
- grid-template-columns: repeat(2, 1fr);
- gap: 1rem;
- }
-
- .preset-card {
- background: var(--surface);
- border: 1px solid var(--border);
- padding: 1.25rem;
- cursor: pointer;
- transition: all 0.2s;
- text-align: center;
- }
-
- .preset-card:hover {
- border-color: var(--green);
- background: rgba(0, 255, 136, 0.05);
- transform: translateY(-2px);
- }
-
- .preset-icon {
- font-size: 2rem;
- margin-bottom: 0.75rem;
- }
-
- .preset-name {
- font-size: 0.8rem;
- font-weight: bold;
- text-transform: uppercase;
- letter-spacing: 0.05em;
- margin-bottom: 0.5rem;
- color: var(--green);
- }
-
- .preset-description {
- font-size: 0.65rem;
- color: var(--text-dim);
- line-height: 1.4;
- margin-bottom: 0.5rem;
- }
-
- .preset-panel-count {
- font-size: 0.6rem;
- color: var(--text-dim);
- opacity: 0.7;
- }
-
- .onboarding-footer {
- text-align: center;
- margin-top: 1.5rem;
- font-size: 0.65rem;
- color: var(--text-dim);
- }
-
- @media (max-width: 500px) {
- .preset-cards {
- grid-template-columns: 1fr;
- }
-
- .onboarding-content {
- padding: 1.5rem;
- width: 100%;
- height: 100vh;
- max-height: 100vh;
- border: none;
- }
-
- .preset-card {
- padding: 1rem;
- }
-
- .preset-icon {
- font-size: 1.5rem;
- }
- }
-
- /* 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);
- }
-
-/* ==========================================
- MOBILE RESPONSIVE STYLES
- ========================================== */
-
-/* Hamburger Menu Button */
-.hamburger-btn {
- display: none;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- width: 44px;
- height: 44px;
- background: transparent;
- border: none;
- cursor: pointer;
- padding: 12px 8px;
- z-index: 1001;
- box-sizing: border-box;
-}
-
-.hamburger-line {
- display: block;
- width: 24px;
- height: 2px;
- background: var(--text);
- transition: all 0.3s ease;
- margin: 2px 0;
-}
-
-.hamburger-btn.active .hamburger-line:nth-child(1) {
- transform: rotate(45deg) translate(4px, 5px);
-}
-
-.hamburger-btn.active .hamburger-line:nth-child(2) {
- opacity: 0;
-}
-
-.hamburger-btn.active .hamburger-line:nth-child(3) {
- transform: rotate(-45deg) translate(4px, -5px);
-}
-
-/* Mobile Menu Dropdown */
-.mobile-menu {
- display: none;
- position: absolute;
- top: 100%;
- right: 0;
- background: var(--bg);
- border: 1px solid var(--border);
- border-top: none;
- padding: 1rem;
- flex-direction: column;
- gap: 0.75rem;
- z-index: 1000;
- min-width: 180px;
- max-width: 90vw;
- box-shadow: -2px 4px 12px rgba(0,0,0,0.5);
-}
-
-.mobile-menu.open {
- display: flex;
-}
-
-.mobile-menu button {
- width: 100%;
- min-height: 44px;
- padding: 0.75rem 1rem;
- font-size: 0.75rem;
-}
-
-/* Desktop navigation wrapper */
-.desktop-nav {
- display: flex;
- align-items: center;
- gap: 0.75rem;
-}
-
-/* Header right needs relative position for mobile menu */
-.header-right {
- position: relative;
-}
-
-/* ==========================================
- WORLD LEADERS PANEL
- ========================================== */
-.leaders-panel {
- padding: 0.5rem;
-}
-
-.leaders-grid {
- display: grid;
- grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
- gap: 0.75rem;
-}
-
-.leader-card {
- background: var(--surface);
- border: 1px solid var(--border);
- border-radius: 6px;
- padding: 0.75rem;
- transition: all 0.2s;
-}
-
-.leader-card:hover {
- border-color: var(--border-light);
- background: var(--surface-hover);
-}
-
-.leader-card.active {
- border-color: var(--info);
-}
-
-.leader-card.high-activity {
- border-color: var(--warning);
- box-shadow: 0 0 8px rgba(255, 170, 0, 0.2);
-}
-
-.leader-header {
- display: flex;
- align-items: flex-start;
- gap: 0.5rem;
- margin-bottom: 0.5rem;
-}
-
-.leader-flag {
- font-size: 1.5rem;
- line-height: 1;
-}
-
-.leader-info {
- flex: 1;
- min-width: 0;
-}
-
-.leader-name {
- font-size: 0.8rem;
- font-weight: 600;
- color: var(--text-primary);
- line-height: 1.2;
-}
-
-.leader-title {
- font-size: 0.65rem;
- color: var(--text-dim);
- margin-top: 0.1rem;
-}
-
-.leader-country {
- font-size: 0.6rem;
- color: var(--text-muted);
- margin-top: 0.15rem;
-}
-
-.leader-activity-badge {
- background: var(--info);
- color: #000;
- font-size: 0.55rem;
- font-weight: bold;
- padding: 0.15rem 0.35rem;
- border-radius: 3px;
- min-width: 18px;
- text-align: center;
-}
-
-.leader-card.high-activity .leader-activity-badge {
- background: var(--warning);
-}
-
-.leader-meta {
- display: flex;
- gap: 0.5rem;
- font-size: 0.55rem;
- color: var(--text-muted);
- margin-bottom: 0.5rem;
-}
-
-.leader-since {
- color: var(--text-dim);
-}
-
-.leader-party {
- color: var(--text-muted);
- opacity: 0.8;
-}
-
-.leader-focus-topics {
- display: flex;
- flex-wrap: wrap;
- gap: 0.25rem;
- margin-bottom: 0.5rem;
-}
-
-.leader-focus {
- font-size: 0.5rem;
- background: rgba(68, 136, 255, 0.15);
- color: var(--info);
- padding: 0.1rem 0.35rem;
- border-radius: 3px;
- text-transform: lowercase;
-}
-
-.leader-news {
- border-top: 1px solid var(--border);
- padding-top: 0.5rem;
- margin-top: 0.25rem;
-}
-
-.leader-news-item {
- display: block;
- font-size: 0.6rem;
- color: var(--text-dim);
- text-decoration: none;
- padding: 0.25rem 0;
- line-height: 1.3;
- border-bottom: 1px solid var(--border);
-}
-
-.leader-news-item:last-child {
- border-bottom: none;
-}
-
-.leader-news-item:hover {
- color: var(--text-primary);
-}
-
-/* ==========================================
- TABLET BREAKPOINT (768px)
- ========================================== */
-@media (max-width: 768px) {
- /* === CRITICAL: Prevent horizontal scroll === */
- html {
- overflow-x: hidden !important;
- }
-
- body {
- overflow-x: hidden !important;
- width: 100% !important;
- max-width: 100vw !important;
- }
-
- /* === CRITICAL: Force single column layout === */
- .dashboard {
- display: grid !important;
- grid-template-columns: 1fr !important;
- width: 100% !important;
- max-width: 100vw !important;
- overflow-x: hidden !important;
- }
-
- /* Override ALL inline grid-column styles */
- /* min-width: 0 prevents grid items from expanding beyond container */
- .dashboard > * {
- grid-column: 1 / -1 !important;
- width: 100% !important;
- max-width: 100% !important;
- min-width: 0 !important;
- box-sizing: border-box !important;
- }
-
- /* === Header === */
- .header {
- padding: 0.5rem 1rem;
- position: sticky;
- top: 0;
- z-index: 100;
- }
-
- .header-left {
- gap: 0.75rem;
- }
-
- .title {
- font-size: 0.7rem;
- }
-
- .status {
- display: none;
- }
-
- /* Show hamburger, hide desktop nav */
- .hamburger-btn {
- display: flex;
- }
-
- .desktop-nav {
- display: none;
- }
-
- /* === Map Panel === */
- .panel[data-panel="map"] {
- height: 280px !important;
- min-height: 280px !important;
- }
-
- .panel[data-panel="map"] .panel-content,
- #mapPanel {
- height: calc(100% - 44px) !important;
- max-height: none !important;
- overflow: hidden !important;
- position: relative !important;
- }
-
- #mapSvg {
- position: absolute !important;
- top: 0 !important;
- left: 0 !important;
- width: 100% !important;
- height: 100% !important;
- display: block !important;
- }
-
- /* Hide map legend on mobile */
- #mapLegend {
- display: none !important;
- }
-
- /* Show zoom controls on mobile */
- .map-zoom-controls {
- display: flex !important;
- }
-
- /* Touch-friendly item targets */
- .item {
- padding: 0.75rem 1rem;
- min-height: 44px;
- }
-
- .item-title {
- font-size: 0.75rem;
- line-height: 1.4;
- }
-
- .item-source,
- .item-time {
- font-size: 0.6rem;
- }
-
- /* Panel header touch targets */
- .panel-header {
- padding: 0.6rem 1rem;
- min-height: 44px;
- cursor: default;
- }
-
- .panel-title {
- font-size: 0.6rem;
- }
-
- .panel-count {
- font-size: 0.55rem;
- }
-
- /* Hide resize handles on mobile */
- .panel-resize-handle {
- display: none;
- }
-
- /* === Modals === */
- .settings-content {
- width: 95%;
- max-width: none;
- max-height: 90vh;
- padding: 1rem;
- }
-
- .settings-close {
- min-height: 48px;
- font-size: 0.75rem;
- }
-
- .monitor-form {
- width: 95%;
- max-width: none;
- padding: 1rem;
- }
-
- .monitor-form-input {
- font-size: 16px;
- padding: 0.6rem;
- min-height: 44px;
- }
-
- .monitor-form-actions button {
- min-height: 48px;
- }
-
- /* Toggle switch size increase for touch */
- .toggle-switch {
- width: 44px;
- height: 24px;
- border-radius: 12px;
- }
-
- .toggle-switch::after {
- width: 20px;
- height: 20px;
- }
-
- .toggle-switch.on::after {
- transform: translateX(20px);
- }
-
- /* Market items */
- .market-item {
- padding: 0.6rem 1rem;
- min-height: 40px;
- }
-
- /* Grid sections - single column on mobile */
- .correlation-sections,
- .narrative-sections {
- grid-template-columns: 1fr !important;
- gap: 0.5rem;
- }
-
- .correlation-section-header,
- .narrative-section-header {
- padding: 0.5rem;
- }
-
- /* === HORIZONTAL SCROLL FOR ITEMS (condensed view) === */
- /* Exclude map panel from horizontal scroll */
- .panel:not([data-panel="map"]) > .panel-content {
- display: flex !important;
- flex-direction: row !important;
- flex-wrap: nowrap !important;
- overflow-x: auto !important;
- overflow-y: visible !important;
- scroll-snap-type: x mandatory;
- -webkit-overflow-scrolling: touch;
- gap: 0;
- max-height: none;
- padding-bottom: 0.5rem;
- }
-
- /* Subtle scrollbar */
- .panel:not([data-panel="map"]) > .panel-content::-webkit-scrollbar {
- height: 3px;
- }
-
- .panel:not([data-panel="map"]) > .panel-content::-webkit-scrollbar-track {
- background: var(--surface);
- }
-
- .panel:not([data-panel="map"]) > .panel-content::-webkit-scrollbar-thumb {
- background: var(--border);
- border-radius: 2px;
- }
-
- /* Panels are compact */
- .panel:not([data-panel="map"]) {
- min-height: auto !important;
- }
-
- /* Individual items as horizontal cards */
- .panel:not([data-panel="map"]) .item {
- flex: 0 0 80vw !important;
- max-width: 80vw !important;
- min-width: 260px;
- scroll-snap-align: start;
- border-right: 1px solid var(--border);
- border-bottom: none;
- box-sizing: border-box;
- padding: 0.75rem 1rem;
- }
-
- .panel:not([data-panel="map"]) .item:last-child {
- border-right: none;
- }
-
- /* Market items */
- .market-item {
- flex: 0 0 150px !important;
- min-width: 150px;
- scroll-snap-align: start;
- border-right: 1px solid var(--border);
- padding: 0.75rem 1rem;
- }
-
- /* Sector heatmap - wrapped grid */
- #heatmapPanel {
- flex-wrap: wrap !important;
- justify-content: flex-start;
- gap: 0.25rem;
- padding: 0.5rem;
- max-height: none !important;
- overflow-x: hidden !important;
- overflow-y: auto !important;
- }
-
- #heatmapPanel .sector-item {
- flex: 0 0 auto;
- }
-
- /* Polymarket items */
- .polymarket-item {
- flex: 0 0 80vw !important;
- max-width: 80vw !important;
- min-width: 260px;
- scroll-snap-align: start;
- border-right: 1px solid var(--border);
- padding: 0.75rem 1rem;
- }
-
- /* Contract items */
- .contract-item {
- flex: 0 0 80vw !important;
- max-width: 80vw !important;
- min-width: 260px;
- scroll-snap-align: start;
- border-right: 1px solid var(--border);
- padding: 0.75rem 1rem;
- }
-
- /* Intel items */
- .intel-item {
- flex: 0 0 80vw !important;
- max-width: 80vw !important;
- min-width: 260px;
- scroll-snap-align: start;
- border-right: 1px solid var(--border);
- padding: 0.75rem 1rem;
- }
-
- /* Whale items */
- .whale-item {
- flex: 0 0 260px !important;
- scroll-snap-align: start;
- border-right: 1px solid var(--border);
- padding: 0.75rem 1rem;
- }
-
- /* Commodities */
- .commodity-item {
- flex: 0 0 110px !important;
- scroll-snap-align: start;
- }
-
- /* Correlation/Narrative sections */
- .correlation-sections,
- .narrative-sections {
- display: flex !important;
- flex-direction: row !important;
- flex-wrap: nowrap !important;
- overflow-x: auto !important;
- scroll-snap-type: x mandatory;
- -webkit-overflow-scrolling: touch;
- gap: 0 !important;
- padding-bottom: 0.5rem;
- }
-
- .correlation-section,
- .narrative-section {
- flex: 0 0 80vw !important;
- max-width: 80vw !important;
- min-width: 260px;
- scroll-snap-align: start;
- border-right: 1px solid var(--border);
- }
-}
-
-/* ==========================================
- SMALL PHONE BREAKPOINT (480px)
- ========================================== */
-@media (max-width: 480px) {
- /* Header compact mode */
- .header {
- padding: 0.5rem 0.75rem;
- }
-
- .title {
- font-size: 0.65rem;
- letter-spacing: 0.05em;
- }
-
- .header-left {
- gap: 0.5rem;
- }
-
- /* Map smaller on phones */
- .panel[data-panel="map"] {
- height: 280px !important;
- }
-
- /* Tighter panel content */
- .panel-content {
- max-height: 280px;
- }
-
- /* Items */
- .item {
- padding: 0.6rem 0.75rem;
- }
-
- .item-title {
- font-size: 0.7rem;
- }
-
- /* Mobile menu full width */
- .mobile-menu {
- left: 0;
- min-width: 100%;
- border-inline: none;
- }
-
- /* Full-screen modals on small phones */
- .settings-modal.open,
- .monitor-form-overlay.open {
- align-items: flex-start;
- padding-top: 0;
- }
-
- .settings-content,
- .monitor-form {
- width: 100%;
- height: 100vh;
- max-height: 100vh;
- border: none;
- border-radius: 0;
- }
-
- /* Wide panel items */
- .polymarket-item,
- .contract-item,
- .intel-item {
- padding: 0.5rem 0.75rem;
- }
-
- /* Sector heatmap adjustments */
- .sector-item {
- min-width: 50px;
- font-size: 0.55rem;
- padding: 0.4rem 0.3rem;
- }
-
- /* Commodity items */
- .commodity-item {
- min-width: 70px;
- }
-}
-
-/* ==========================================
- TOUCH DEVICE ENHANCEMENTS
- ========================================== */
-@media (hover: none) and (pointer: coarse) {
- /* Disable hover states, enable active states for touch feedback */
- .item:hover,
- .panel-header:hover {
- background: transparent;
- }
-
- .item:active,
- .panel-header:active {
- background: var(--surface);
- }
-
- /* Hide map tooltip on touch - unusable */
- #mapTooltip {
- display: none !important;
- }
-
- /* Larger touch targets */
- button,
- .toggle-switch,
- [onclick] {
- min-height: 44px;
- }
-}