* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0f0f1a; --bg2: #1a1a2e; --bg3: #16213e;
  --text: #e0e0e0; --text-dim: #8888aa;
  --accent: #00d4ff; --danger: #ff3355; --warning: #ffaa00; --ok: #00cc66;
  --radius: 8px;
}
body {
  font-family: -apple-system, 'Segoe UI', system-ui, monospace;
  background: var(--bg); color: var(--text); height: 100vh; overflow: hidden;
}
header {
  background: var(--bg2); padding: 12px 20px; display: flex;
  align-items: center; gap: 16px; border-bottom: 1px solid #2a2a4a;
}
header h1 { font-size: 1.2rem; font-weight: 600; white-space: nowrap; }
#clock { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text-dim); }
.btn-location {
  background: var(--bg3); color: var(--accent); border: 1px solid #2a2a4a;
  padding: 4px 12px; border-radius: var(--radius); cursor: pointer;
  font-size: 0.8rem; display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden; max-width: 240px;
}
.btn-location:hover { border-color: var(--accent); }
#location-name { overflow: hidden; text-overflow: ellipsis; }
.badge {
  padding: 2px 12px; border-radius: 12px; font-size: 0.75rem; font-weight: 500;
}
.badge-ok { background: #003320; color: var(--ok); }
.badge-warn { background: #332200; color: var(--warning); animation: pulse 1.5s infinite; }
.badge-danger { background: #330011; color: var(--danger); animation: pulse 0.8s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
main { display: flex; height: calc(100vh - 53px); }
#sidebar {
  width: 320px; background: var(--bg2); padding: 16px;
  display: flex; flex-direction: column; gap: 16px; overflow-y: auto;
  border-right: 1px solid #2a2a4a; flex-shrink: 0;
}
#sidebar h2 { font-size: 0.85rem; text-transform: uppercase; color: var(--text-dim); letter-spacing: 1px; margin-bottom: 8px; }
#main-panel { flex: 1; display: flex; flex-direction: column; }
#map-container { flex: 1; position: relative; background: #0a0a18; }
#map-canvas { width: 100%; height: 100%; display: block; }
#map-legend {
  position: absolute; bottom: 12px; left: 12px;
  background: rgba(15,15,26,0.85); padding: 6px 12px; border-radius: var(--radius);
  font-size: 0.7rem; color: var(--text-dim); display: flex; gap: 12px; align-items: center;
}
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot-missile { background: var(--danger); }
.dot-center { background: var(--accent); }
.dot-trajectory { background: var(--warning); opacity: 0.5; }
.dot-aircraft { background: #00cc66; }
#info-bar {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px;
  background: #2a2a4a; padding: 1px;
}
.info-card {
  background: var(--bg2); padding: 10px 16px; text-align: center;
}
.info-label { display: block; font-size: 0.65rem; color: var(--text-dim); text-transform: uppercase; }
.info-value { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
#threat-list, #alert-list { font-size: 0.8rem; max-height: 200px; overflow-y: auto; }
.threat-item, .alert-item {
  background: var(--bg3); padding: 8px 10px; margin-bottom: 4px; border-radius: 4px;
  border-left: 3px solid var(--text-dim);
}
.threat-item.critical { border-left-color: var(--danger); }
.threat-item.warning { border-left-color: var(--warning); }
.alert-item { border-left-color: var(--accent); }
.civil-alert { border-left-color: #00cc66 !important; }
.article-alert { border-left-color: #ffaa00 !important; }
.threat-item .eta { color: var(--warning); font-weight: 600; }
.threat-item .dist { color: var(--text-dim); }
.muted { color: var(--text-dim); font-style: italic; font-size: 0.75rem; }
#aircraft-section h2 { display: flex; align-items: center; gap: 8px; }
#aircraft-section .badge { font-size: 0.7rem; padding: 1px 8px; }
.aircraft-item {
  background: var(--bg3); padding: 6px 10px; margin-bottom: 3px; border-radius: 4px;
  border-left: 3px solid #00cc66; font-size: 0.78rem;
}
.aircraft-item .flight { color: #00cc66; font-weight: 600; }
.aircraft-item .adata { color: var(--text-dim); font-size: 0.7rem; }
.aircraft-item.nearby { border-left-color: var(--warning); }
.rng-badge { background: var(--warning); color: #000; font-size: 0.6rem; padding: 1px 5px; border-radius: 3px; font-weight: 600; }
#notification-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--danger); color: white; text-align: center;
  padding: 12px; font-weight: 600; font-size: 1.1rem;
  transition: transform 0.3s; cursor: pointer;
}
#notification-banner.hidden { transform: translateY(-100%); }
#notification-banner.warning { background: var(--warning); color: black; }
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal.hidden { display: none; }
.modal-content {
  background: var(--bg2); border-radius: var(--radius); padding: 24px;
  min-width: 360px; position: relative; max-height: 80vh; overflow-y: auto;
}
.modal-close { position: absolute; top: 12px; right: 16px; cursor: pointer; font-size: 1.5rem; }
.modal label { display: block; margin: 12px 0; font-size: 0.85rem; color: var(--text-dim); }
.modal input[type="text"], .modal input[type="number"] {
  width: 100%; margin-top: 4px; padding: 8px; border: 1px solid #3a3a5a;
  border-radius: 4px; background: var(--bg); color: var(--text);
}
.location-search-input {
  width: 100%; padding: 10px; border: 1px solid var(--accent);
  border-radius: var(--radius); background: var(--bg); color: var(--text);
  margin-bottom: 8px; font-size: 1rem;
}
.location-result {
  padding: 8px 10px; cursor: pointer; border-radius: 4px;
  font-size: 0.85rem; border-bottom: 1px solid #2a2a4a;
}
.location-result:hover { background: var(--bg3); color: var(--accent); }
#location-search-status { font-size: 0.75rem; padding: 4px 0; }
.btn {
  padding: 8px 18px; border: none; border-radius: var(--radius);
  cursor: pointer; font-weight: 500; font-size: 0.85rem;
}
.btn-primary { background: var(--accent); color: black; }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid #3a3a5a; }
.btn-sm { padding: 4px 10px; font-size: 0.75rem; }
.btn-icon {
  position: fixed; bottom: 20px; right: 20px; z-index: 50;
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: var(--bg2); color: var(--text); font-size: 1.2rem;
  cursor: pointer; box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
#settings-toggle:hover { background: var(--bg3); }
@media (max-width: 768px) {
  main { flex-direction: column; }
  #sidebar { width: 100%; max-height: 40vh; border-right: none; border-bottom: 1px solid #2a2a4a; }
  #info-bar { grid-template-columns: repeat(3, 1fr); }
}
