:root {
  --bg: #0b0d12;
  --panel: #141821;
  --panel2: #1a1f2b;
  --border: #242b3a;
  --text: #dbe1ea;
  --muted: #8b93a5;
  --accent: #4f8cff;
  --jarvis: #00e5ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #10131a, #0b0d12);
  position: sticky; top: 0; z-index: 1000;
}
.brand { display: flex; align-items: center; gap: 10px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #2ecc71; box-shadow: 0 0 12px #2ecc71; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.brand-name { font-weight: 800; letter-spacing: 2px; font-size: 18px; }
.brand-sub { color: var(--muted); font-size: 13px; }
.top-right { display: flex; align-items: center; gap: 12px; }
.live-tag { color: #2ecc71; font-size: 12px; font-weight: 700; letter-spacing: 1px; }
.updated { color: var(--muted); font-size: 12px; }
.btn { background: var(--accent); color: #fff; border: none; padding: 7px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600; }
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: var(--panel2); border: 1px solid var(--border); color: var(--text); }

/* Breaking news bar */
.breaking-bar { display: flex; align-items: center; gap: 12px; background: #1a0a0a; border-bottom: 1px solid #e74c3c; padding: 8px 20px; font-size: 14px; }
.breaking-bar.hidden { display: none; }
.breaking-label { flex: 0 0 auto; background: #e74c3c; color: #fff; font-weight: 800; font-size: 11px; letter-spacing: 1px; padding: 3px 10px; border-radius: 4px; animation: pulse 1.5s infinite; }
.breaking-text { color: #ffb3b3; line-height: 1.4; }
.breaking-text a { color: #ffb3b3; text-decoration: none; }
.breaking-text a:hover { color: #fff; text-decoration: underline; }

/* Ticker */
.ticker { display: flex; align-items: stretch; border-bottom: 1px solid var(--border); background: #0e1117; overflow: hidden; }
.ticker-label { flex: 0 0 auto; background: #e74c3c; color: #fff; font-weight: 800; font-size: 11px; letter-spacing: 1px; padding: 6px 12px; display: flex; align-items: center; }
.ticker-window { flex: 1 1 auto; overflow: hidden; position: relative; }
.ticker-track { display: inline-block; white-space: nowrap; padding: 6px 0; font-size: 13px; color: var(--text); animation: ticker 120s linear infinite; }
.ticker-track a { color: var(--text); text-decoration: none; margin-right: 40px; }
.ticker-track a:hover { color: var(--accent); }
@keyframes ticker { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

/* Map */
.map-wrap { position: relative; height: 62vh; min-height: 420px; border-bottom: 1px solid var(--border); }
.map-wrap.fs { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; z-index: 2000; border-bottom: none; }
#map { position: absolute; inset: 0; background: #0b0d12; z-index: 1; }
.map-fs-btn {
  position: absolute; top: 14px; right: 14px; z-index: 600;
  width: 36px; height: 36px; border-radius: 6px;
  background: rgba(11,13,18,.92); border: 1px solid var(--border); color: var(--text);
  font-size: 18px; line-height: 1; cursor: pointer; backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.map-fs-btn:hover { color: #fff; border-color: var(--accent); }
.map-wrap.fs .map-fs-btn { top: 18px; right: 18px; }
.map-legend {
  position: absolute; top: 14px; right: 14px; z-index: 500;
  background: rgba(11,13,18,.92); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; font-size: 12px; line-height: 1.9; backdrop-filter: blur(4px);
}
.legend-title { font-weight: 700; letter-spacing: 1px; margin-bottom: 4px; color: var(--muted); text-transform: uppercase; font-size: 10px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.mil-icon { background: transparent; border: none; }
.mil-glyph { line-height: 0; }
.mil-glyph svg { width: 100%; height: 100%; display: block; }
.legend-note { color: var(--muted); font-size: 10px; margin-top: 6px; max-width: 220px; }
.map-stats { position: absolute; bottom: 14px; left: 14px; z-index: 500; display: flex; gap: 10px; flex-wrap: wrap; }
.map-stat { background: rgba(11,13,18,.92); border: 1px solid var(--border); border-radius: 6px; padding: 6px 12px; font-size: 12px; color: var(--muted); backdrop-filter: blur(4px); }
.map-stat span { color: var(--text); font-weight: 700; font-size: 16px; }
.map-wrap.fs .map-stats { bottom: 18px; left: 18px; }

/* Leaflet dark override */
.leaflet-container { background: #0b0d12 !important; }
.leaflet-tile-pane { filter: brightness(.62) contrast(1.12) saturate(.7); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #141821; color: var(--text); border: 1px solid var(--border); }
.leaflet-popup-content { font-size: 12px; }
.leaflet-popup-content b { display: block; margin-bottom: 2px; font-size: 13px; }
.leaflet-control-zoom a { background: #141821 !important; color: var(--text) !important; border-color: var(--border) !important; }

/* Layout */
.wrap { max-width: 1180px; margin: 24px auto; padding: 0 20px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 20px; }
.card.wide { grid-column: 1 / -1; }
h2 { margin: 0 0 14px; font-size: 15px; letter-spacing: .5px; color: var(--muted); text-transform: uppercase; }

/* Gauge */
.gauge-wrap { position: relative; width: 220px; margin: 0 auto; }
.gauge { width: 100%; height: auto; display: block; }
.gauge-value { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.index-num { font-size: 46px; font-weight: 800; }
.index-level { font-size: 13px; letter-spacing: 2px; font-weight: 700; }
.blurb { text-align: center; color: var(--muted); font-size: 13px; margin: 10px 0 4px; }
.scale { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: .5px; margin-top: 8px; }

/* components */
.components { display: flex; flex-direction: column; gap: 12px; }
.comp { display: grid; grid-template-columns: 150px 1fr 44px; align-items: center; gap: 10px; }
.comp-label { font-size: 13px; color: var(--muted); }
.comp-val { font-size: 13px; text-align: right; font-weight: 600; }
.bar { background: var(--panel2); height: 10px; border-radius: 5px; overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--accent); border-radius: 5px; transition: width .6s ease; }
.kw-hits { margin-top: 14px; }
.kw-hits .tag { display: inline-block; background: var(--panel2); border: 1px solid var(--border); border-radius: 12px; padding: 2px 9px; font-size: 11px; margin: 2px 3px; color: var(--muted); }

/* history */
.history { width: 100%; height: 220px; }

/* flights */
.stat-line { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.stat-line span { color: var(--muted); }
.countries { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.countries .tag { background: var(--panel2); border: 1px solid var(--border); border-radius: 4px; padding: 2px 8px; font-size: 11px; }
.flights { margin-top: 10px; max-height: 260px; overflow-y: auto; }
.flight { font-size: 12px; padding: 4px 0; border-bottom: 1px solid var(--border); font-family: monospace; }

/* airports */
.airports { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.airport { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--panel2); font-size: 13px; }
.airport-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.airport-code { font-weight: 800; font-size: 14px; color: var(--accent); letter-spacing: .5px; }
.airport-name { font-weight: 700; }
.airport-city { color: var(--muted); font-size: 12px; }
.airport-status { margin-left: auto; font-size: 10px; font-weight: 800; letter-spacing: .5px; padding: 2px 8px; border-radius: 10px; }
.airport-status.ok { background: rgba(46,204,113,.15); color: #2ecc71; border: 1px solid rgba(46,204,113,.4); }
.airport-status.warn { background: rgba(241,196,15,.15); color: #f1c40f; border: 1px solid rgba(241,196,15,.4); }
.airport-status.closed { background: rgba(231,76,60,.15); color: #e74c3c; border: 1px solid rgba(231,76,60,.4); }
.airport-note { color: var(--muted); font-size: 11px; margin-bottom: 6px; }
.airport-airlines { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.airline { font-size: 11px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); }
.airline.op { color: #8be0b0; border-color: rgba(46,204,113,.35); }
.airline.sus { color: #ff9d8f; border-color: rgba(231,76,60,.35); text-decoration: line-through; }
.airport-routes { color: var(--muted); font-size: 11px; }
.airport-routes span { color: var(--text); }

/* carriers */
.carriers { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; }
.carrier { padding: 8px 10px; background: var(--panel2); border-radius: 6px; font-size: 13px; border: 1px solid var(--border); }
.carrier .c-name { font-weight: 700; }
.carrier .c-meta { color: var(--muted); font-size: 12px; }

/* news */
.news, .gdelt { display: flex; flex-direction: column; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.news-item, .gdelt-item { padding: 9px 0; border-bottom: 1px solid var(--border); }
.news-item a, .gdelt-item a { color: var(--text); text-decoration: none; font-size: 14px; }
.news-item a:hover, .gdelt-item a:hover { color: var(--accent); }
.news-meta, .gdelt-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* gfp */
.gfp { width: 100%; border-collapse: collapse; font-size: 13px; }
.gfp th, .gfp td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.gfp th { color: var(--muted); }
.gfp-note, .disclaimer { color: var(--muted); font-size: 12px; margin: 10px 0 0; }
.disclaimer { text-align: center; max-width: 900px; margin: 0 auto 30px; padding: 0 20px; }

/* Telegram OSINT feed */
.tg-feed { display: flex; flex-direction: column; gap: 10px; max-height: 460px; overflow-y: auto; padding-right: 4px; }
.tg-post { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--panel2); }
.tg-head { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; }
.tg-channel { font-weight: 700; color: var(--accent); font-size: 13px; }
.tg-text { font-size: 14px; line-height: 1.5; }
.tg-text a { color: var(--text); text-decoration: none; }
.tg-text a:hover { color: var(--accent); }

/* Predictive analysis */
.pred-head { display: flex; gap: 24px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.pred-gauge { text-align: center; min-width: 180px; }
.pred-num { font-size: 52px; font-weight: 800; }
.pred-num .pred-pct { font-size: 22px; color: var(--muted); }
.pred-timeframe { font-size: 13px; letter-spacing: 1px; font-weight: 700; margin-top: 2px; }
.pred-meta { flex: 1 1 300px; }
.pred-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.pred-row span { color: var(--muted); }
.pred-rationale { color: var(--muted); font-size: 12px; margin: 10px 0 0; }
.pred-indexes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
.pred-idx { background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.pred-idx-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 13px; }
.pred-idx-label { font-weight: 700; }
.pred-idx .bar { height: 8px; }
.pred-idx-blurb { color: var(--muted); font-size: 11px; margin-top: 8px; }
.pred-kw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 12px 0; }
.pred-kw { background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.pred-kw-title { color: var(--muted); font-size: 12px; letter-spacing: .5px; text-transform: uppercase; margin-bottom: 8px; }
.kw-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.kw-chip { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 4px 10px; font-size: 13px; }
.kw-chip i { color: var(--muted); font-style: normal; font-size: 11px; }
.rag-context { margin: 12px 0; }
.rag-list { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; }
.rag-item { background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.rag-text { font-size: 13px; line-height: 1.5; }
.rag-src { color: var(--muted); font-size: 11px; margin-top: 6px; }
.pred-disclaimer { color: var(--muted); font-size: 12px; margin-top: 10px; }

/* X/Twitter accounts reference */
.x-accounts { display: flex; flex-wrap: wrap; gap: 8px; }
.x-account { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; background: var(--panel2); min-width: 200px; flex: 1 1 200px; }
.x-handle { font-weight: 700; color: var(--jarvis); font-size: 13px; }
.x-name { font-size: 13px; }

/* JARVIS */
.jarvis-orb {
  position: fixed; right: 22px; bottom: 22px; z-index: 1100;
  width: 60px; height: 60px; border-radius: 50%; border: none; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #7ff3ff, #00b8d4 60%, #006b7f);
  color: #003; font-size: 26px; box-shadow: 0 0 22px rgba(0,229,255,.55);
  transition: transform .2s;
}
.jarvis-orb:hover { transform: scale(1.08); }
.jarvis-panel {
  position: fixed; right: 22px; bottom: 92px; z-index: 1100;
  width: 360px; max-width: calc(100vw - 44px); max-height: 70vh;
  background: #0d1117; border: 1px solid var(--border); border-radius: 14px;
  display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(0,0,0,.6);
}
.jarvis-panel.hidden { display: none; }
.jarvis-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.jarvis-avatar { font-size: 22px; color: var(--jarvis); }
.jarvis-name { font-weight: 800; letter-spacing: 1px; color: var(--jarvis); }
.jarvis-status { font-size: 11px; color: var(--muted); }
.jarvis-close { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.jarvis-close:hover { color: #fff; }
.jarvis-log { flex: 1 1 auto; overflow-y: auto; padding: 12px 14px; font-size: 13px; display: flex; flex-direction: column; gap: 8px; max-height: 320px; }
.j-line { padding: 8px 10px; border-radius: 8px; max-width: 88%; }
.j-line.user { align-self: flex-end; background: var(--panel2); border: 1px solid var(--border); }
.j-line.jarvis { align-self: flex-start; background: rgba(0,229,255,.08); border: 1px solid rgba(0,229,255,.25); color: #c9f6ff; }
.jarvis-form { display: flex; border-top: 1px solid var(--border); }
.jarvis-form input { flex: 1; background: none; border: none; padding: 12px 14px; color: var(--text); font-size: 13px; outline: none; }
.jarvis-form button { background: none; border: none; color: var(--jarvis); font-size: 16px; padding: 0 14px; cursor: pointer; }

/* Radio player */
.radio-orb {
  position: fixed; left: 22px; bottom: 22px; z-index: 1100;
  width: 60px; height: 60px; border-radius: 50%; border: none; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #ffd27f, #e67e22 60%, #9c4d12);
  color: #201000; font-size: 26px; box-shadow: 0 0 22px rgba(230,126,34,.5);
  transition: transform .2s;
}
.radio-orb:hover { transform: scale(1.08); }
.radio-panel {
  position: fixed; left: 22px; bottom: 92px; z-index: 1100;
  width: 360px; max-width: calc(100vw - 44px); max-height: 74vh;
  background: #0d1117; border: 1px solid var(--border); border-radius: 14px;
  display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(0,0,0,.6);
  overflow: hidden;
}
.radio-panel.hidden { display: none; }
.radio-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.radio-avatar { font-size: 22px; }
.radio-name { font-weight: 800; letter-spacing: 1px; color: #ffb347; }
.radio-now { font-size: 12px; color: var(--muted); }
.radio-close { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.radio-close:hover { color: #fff; }
.radio-topbar { background: #e74c3c; color: #fff; font-weight: 800; font-size: 11px; letter-spacing: 1px; padding: 6px 14px; }
.radio-topbar.hidden { display: none; }
.radio-headlines { display: flex; flex-direction: column; gap: 4px; padding: 8px 14px; border-bottom: 1px solid var(--border); max-height: 150px; overflow-y: auto; background: #10131a; }
.radio-headlines:empty { display: none; }
.radio-headlines a { color: var(--text); text-decoration: none; font-size: 12px; line-height: 1.4; }
.radio-headlines a:hover { color: var(--accent); }
.radio-controls { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.radio-play { width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer; background: var(--accent); color: #fff; font-size: 16px; }
.radio-play.playing { background: #e74c3c; }
.radio-auto { background: var(--panel2); border: 1px solid var(--border); color: var(--muted); padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 11px; font-weight: 700; letter-spacing: 1px; }
.radio-auto.on { background: #e67e22; border-color: #e67e22; color: #fff; }
.radio-vol { flex: 1; }
.radio-vol input { width: 100%; accent-color: var(--accent); cursor: pointer; }
.radio-channels { flex: 1 1 auto; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.radio-group { color: var(--muted); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; margin-top: 4px; }
.radio-chan { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel2); cursor: pointer; font-size: 13px; }
.radio-chan:hover { border-color: var(--accent); }
.radio-chan .rc-name { flex: 1; }
.radio-chan .rc-tag { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.radio-chan.active { border-color: #ffb347; background: rgba(255,179,71,.08); }
.radio-chan.active .rc-name { color: #ffb347; font-weight: 700; }

@media (max-width: 760px) {
  .wrap { grid-template-columns: 1fr; padding: 0 12px; }
  .comp { grid-template-columns: 110px 1fr 40px; }
  .map-wrap { height: 60vh; min-height: 320px; }
  .map-wrap.fs { height: 100dvh; }
  .map-legend { max-width: 60vw; font-size: 11px; line-height: 1.7; padding: 8px 10px; }
  .legend-note { display: none; }
  .pred-indexes { grid-template-columns: 1fr 1fr; }
  .pred-kw-grid { grid-template-columns: 1fr; }
  .airports { grid-template-columns: 1fr; }
  .topbar { padding: 10px 12px; }
  .brand-sub { display: none; }
}
