* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #020510;
  --panel-bg: rgba(5, 10, 30, 0.85);
  --border: rgba(0, 200, 255, 0.15);
  --text: #c8d8f0;
  --text-dim: #607090;
  --accent: #00c8ff;
  --red: #ff3333;
  --orange: #ff8800;
  --yellow: #ffdd00;
  --green: #00ff88;
  --cyber: #00ff88;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Courier New', monospace;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  user-select: none;
}

#globe-container {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#globe-canvas {
  cursor: grab;
}
#globe-canvas:active {
  cursor: grabbing;
}

/* ── Header ── */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: linear-gradient(to bottom, rgba(2,5,16,0.95), transparent);
  pointer-events: none;
}

#header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--accent);
  text-transform: uppercase;
  text-shadow: 0 0 15px rgba(0,200,255,0.6);
}

#header h1 span {
  color: var(--red);
  text-shadow: 0 0 15px rgba(255,50,50,0.7);
}

#live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  letter-spacing: 2px;
  color: var(--red);
}

#live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse 1.5s infinite;
  box-shadow: 0 0 6px var(--red);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* ── Left Panel: Stats ── */
#stats-panel {
  position: fixed;
  top: 70px;
  left: 16px;
  z-index: 100;
  width: 240px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.panel-header {
  padding: 8px 14px;
  font-size: 0.65rem;
  letter-spacing: 2px;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  background: rgba(0, 200, 255, 0.05);
  text-transform: uppercase;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 14px;
  border-bottom: 1px solid rgba(0,200,255,0.06);
  font-size: 0.72rem;
}

.stat-row:last-child { border-bottom: none; }

.stat-label { color: var(--text-dim); }

.stat-value {
  font-weight: bold;
  color: var(--accent);
}

.stat-value.war { color: var(--red); }
.stat-value.conflict { color: var(--orange); }
.stat-value.tension { color: var(--yellow); }
.stat-value.cyber-val { color: var(--cyber); }

/* ── Right Panel: Feed ── */
#feed-panel {
  position: fixed;
  top: 70px;
  right: 16px;
  z-index: 100;
  width: 280px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  backdrop-filter: blur(10px);
  overflow: hidden;
  max-height: calc(100vh - 200px);
}

#feed-list {
  overflow-y: auto;
  max-height: calc(100vh - 280px);
  scrollbar-width: thin;
  scrollbar-color: rgba(0,200,255,0.2) transparent;
}

.feed-item {
  padding: 7px 14px;
  border-bottom: 1px solid rgba(0,200,255,0.06);
  font-size: 0.65rem;
  line-height: 1.5;
  animation: fadeInRight 0.3s ease;
}

.feed-item:last-child { border-bottom: none; }

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(10px); }
  to   { opacity: 1; transform: translateX(0); }
}

.feed-item .feed-time {
  color: var(--text-dim);
  font-size: 0.6rem;
}

.feed-item .feed-type {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.58rem;
  font-weight: bold;
  letter-spacing: 1px;
  margin-right: 4px;
}

.feed-type.URUSH       { background: rgba(255,0,0,0.2);    color: #ff4444; border: 1px solid rgba(255,0,0,0.5); }
.feed-type.JANG        { background: rgba(255,50,0,0.2);   color: #ff6633; border: 1px solid rgba(255,50,0,0.4); }
.feed-type.HUJUM       { background: rgba(255,100,0,0.2);  color: #ff8844; border: 1px solid rgba(255,100,0,0.4); }
.feed-type.QATLIAM     { background: rgba(180,0,0,0.25);   color: #ff2200; border: 1px solid rgba(180,0,0,0.5); }
.feed-type.ZIDDIYAT    { background: rgba(255,160,0,0.2);  color: #ffaa44; border: 1px solid rgba(255,160,0,0.4); }
.feed-type.war         { background: rgba(255,0,0,0.2);    color: #ff4444; border: 1px solid rgba(255,0,0,0.5); }
.feed-type.fight       { background: rgba(255,50,0,0.2);   color: #ff6633; border: 1px solid rgba(255,50,0,0.4); }
.feed-type.assault     { background: rgba(255,100,0,0.2);  color: #ff8844; border: 1px solid rgba(255,100,0,0.4); }
.feed-type.massviolence{ background: rgba(180,0,0,0.25);   color: #ff2200; border: 1px solid rgba(180,0,0,0.5); }
.feed-type.update      { background: rgba(0,100,100,0.2);  color: #00cccc; border: 1px solid rgba(0,150,150,0.3); }
.feed-type.tension     { background: rgba(200,150,0,0.2);  color: #ffcc44; border: 1px solid rgba(200,150,0,0.4); }

.feed-text { color: var(--text); }

/* ── Bottom Legend ── */
#legend {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  gap: 20px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 8px 24px;
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.63rem;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-line {
  width: 24px;
  height: 2px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Tooltip ── */
#tooltip {
  position: fixed;
  z-index: 200;
  background: rgba(5, 12, 35, 0.95);
  border: 1px solid rgba(0,200,255,0.35);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.72rem;
  pointer-events: none;
  display: none;
  max-width: 220px;
  backdrop-filter: blur(8px);
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

#tooltip .tt-country {
  font-weight: bold;
  color: var(--accent);
  margin-bottom: 4px;
  font-size: 0.8rem;
}

#tooltip .tt-intensity {
  margin-bottom: 2px;
}

/* ── Status bar ── */
#statusbar {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 100;
  font-size: 0.6rem;
  color: var(--text-dim);
  text-align: right;
  line-height: 1.7;
  pointer-events: none;
}

#statusbar .src { color: rgba(0,200,255,0.5); }

/* ── Mobile toggle buttons ── */
.mob-btn {
  display: none;
  position: fixed;
  top: 12px;
  z-index: 200;
  background: rgba(5,10,30,0.9);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 1.1rem;
  width: 38px;
  height: 38px;
  border-radius: 6px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 0.2s;
  line-height: 1;
}
.mob-btn:hover { background: rgba(0,200,255,0.12); }
.left-btn  { left: 12px; }
.right-btn { right: 12px; }

/* Panel backdrop */
#panel-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
}
#panel-backdrop.active { display: block; }

/* ── Scanline overlay ── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  pointer-events: none;
  z-index: 50;
}

/* ══════════════════════════════════════
   RESPONSIVE — MOBILE
   ══════════════════════════════════════ */
@media (max-width: 768px) {

  /* Show toggle buttons */
  .mob-btn { display: flex; align-items: center; justify-content: center; }

  /* Header title smaller */
  #header h1 { font-size: 0.72rem; letter-spacing: 1.5px; }
  #header { padding: 10px 58px; }

  /* Stats panel — slide in from LEFT */
  #stats-panel {
    top: 0;
    left: 0;
    bottom: 0;
    width: 80vw;
    max-width: 300px;
    border-radius: 0 12px 12px 0;
    transform: translateX(-105%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    z-index: 110;
    overflow-y: auto;
  }
  #stats-panel.open { transform: translateX(0); }

  /* Feed panel — slide in from RIGHT */
  #feed-panel {
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: 85vw;
    max-width: 320px;
    border-radius: 12px 0 0 12px;
    max-height: 100vh;
    transform: translateX(105%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    z-index: 110;
  }
  #feed-panel.open { transform: translateX(0); }

  #feed-list {
    max-height: calc(100vh - 60px);
  }

  /* Legend smaller, wrap */
  #legend {
    gap: 10px;
    padding: 7px 14px;
    border-radius: 20px;
    flex-wrap: wrap;
    justify-content: center;
    bottom: 50px;
    max-width: 92vw;
  }
  .legend-item { font-size: 0.58rem; }

  /* Status bar */
  #statusbar {
    bottom: 4px;
    right: 8px;
    font-size: 0.52rem;
  }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,200,255,0.2); border-radius: 2px; }

/* ── Loading screen ── */
#loading {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

#loading h2 {
  color: var(--accent);
  letter-spacing: 4px;
  font-size: 0.9rem;
  text-transform: uppercase;
}

.loader {
  width: 60px;
  height: 60px;
  border: 2px solid rgba(0,200,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#loading p {
  color: var(--text-dim);
  font-size: 0.7rem;
  letter-spacing: 2px;
}
