* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: #141414; /* lighter dark */
  font-family: 'Fira Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
  color: #e5e5e5;
  min-height: 100vh;
}
canvas { display: block; }

/* Top KPI strip */
#kpi-strip {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 65%; /* slight push from center */
  display: flex;
  justify-content: space-between;
  z-index: 6;
  pointer-events: none; /* non-interactive overlay */
}
.kpi-group { display: flex; gap: 10px; }
.kpi-item {
  background: #1a1d21;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 8px 10px 6px;
  width: 120px;
}
.kpi-title { font-size: 9px; color: #999; margin-bottom: 2px; }
.kpi-value { font-size: 16px; color: #fff; font-weight: 600; line-height: 1; margin-bottom: 4px; }
#kpi-alerts { color: #ef4444; }
#kpi-incidents { color: #06b6d4; }
#kpi-eps { color: #f59e0b; }
#kpi-blocked { color: #22c55e; }
#kpi-mttd { color: #8b5cf6; }
#kpi-mttr { color: #3b82f6; }
.kpi-spark { width: 100%; height: 24px; display: block; opacity: 0.9; }

/* Bottom ticker */
#ticker {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 28px;
  background: #16191d;
  border-top: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
  z-index: 6;
  pointer-events: none;
}
#ticker-track {
  display: inline-block;
  white-space: nowrap;
  will-change: transform;
  padding-left: 0;           /* JS-driven marquee manages offset */
  animation: none;           /* disable CSS animation; use JS for consistent loop */
  font-size: 11px;
  color: #cfcfcf;
}
@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

#info {
  position: absolute;
  top: 20px;
  left: 20px;
  background: #1a1d21; /* darker than page for contrast */
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 20px;
  max-width: 260px;
  border-radius: 8px;
  z-index: 5;
}

h1 {
  font-family: 'Cairo Play', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #fff;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.2;
}

.brand-word { display: inline-block; margin-right: 6px; }

.brand-zelfire { color: #f97316; font-size: 28px; }
.brand-threat { color: #ef4444; }
.brand-detection { color: #22c55e; }

/* MITRE ATT&CK panel (separate block) */
#mitre-panel {
  position: absolute;
  left: 20px;
  /* top is set via JS to sit below #info */
  background: #1a1d21;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 20px;
  max-width: 260px;
  border-radius: 8px;
  z-index: 5;
}
#mitre-panel h2 {
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.mitre-alert-style { color: #ef4444; font-size: 13px; }
.mitre-alert-style strong { font-weight: 600; }
#mitre-panel .ttp-tech {
  color: #bbb; /* light grey for technique ID (overridden inline for random colors) */
  font-size: 15px;
  font-weight: 400;
}
#mitre-panel .ttp-name {
  color: #888; /* darker grey for technique name */
  font-size: 14px;
  font-weight: 400;
}

/* Smaller font for very long technique names */
#mitre-panel .ttp-name.ttp-name-small {
  font-size: 12px;
}
.ttp-item { padding: 6px 0; border-bottom: 1px dashed rgba(255,255,255,0.06); }
.ttp-item:last-child { border-bottom: none; }
.ttp-line1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ttp-tech { color: #8b5cf6; font-weight: 700; font-size: 12px; letter-spacing: 0.2px; }
.ttp-count { font-weight: 700; padding: 2px 8px; border-radius: 999px; font-size: 10px; border: 1px solid transparent; }
.ttp-name { color: #9aa; font-size: 10px; margin-top: 4px; line-height: 1.3; }

/* Severity colors for count pills */
.ttp-count.sev-low  { background: rgba(34,197,94,0.15);  border-color: rgba(34,197,94,0.35);  color: #22c55e; }
.ttp-count.sev-med  { background: rgba(234,179,8,0.15);  border-color: rgba(234,179,8,0.35);  color: #eab308; }
.ttp-count.sev-high { background: rgba(249,115,22,0.15); border-color: rgba(249,115,22,0.35); color: #f97316; }
.ttp-count.sev-crit { background: rgba(239,68,68,0.15);  border-color: rgba(239,68,68,0.35);  color: #ef4444; }

.subtitle {
  font-size: 10px;
  color: #555;
  margin-bottom: 14px;
}

#current-time {
  font-size: 28px;
  font-weight: 300;
  color: #fff;
  margin: 12px 0 6px;
  letter-spacing: -1px;
}

#current-date {
  font-size: 11px;
  color: #777;
  margin-bottom: 16px;
}

.ring-legend {
  margin-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 14px;
}

.legend-section { margin-bottom: 10px; }

.legend-section-title {
  font-size: 14px;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}

.legend-item {
  display: flex;
  align-items: center;
  margin: 4px 0;
  font-size: 13px;
  color: #777;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  margin-right: 8px;
}

.legend-label { color: #bbb; }
.legend-count {
  margin-left: auto;
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; /* fixed width ensures consistent pill size */
  padding: 2px 0; /* vertical padding only */
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.15);
  color: #ddd;
  background: rgba(255,255,255,0.05);
  font-variant-numeric: tabular-nums; /* uniform digit widths */
}
.legend-count-alerts { border-color: rgba(239,68,68,0.35); color: #ef4444; background: rgba(239,68,68,0.12); }
.legend-count-events { border-color: rgba(245,158,11,0.35); color: #f59e0b; background: rgba(245,158,11,0.12); }
.legend-count-incidents { border-color: rgba(6,182,212,0.35); color: #06b6d4; background: rgba(6,182,212,0.12); }

#tooltip {
  position: absolute;
  background: rgba(15, 15, 15, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 14px;
  pointer-events: none;
  display: none;
  font-size: 10px;
  z-index: 1000;
  max-width: 240px;
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

#tooltip h3 {
  font-size: 10px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

#tooltip .detail {
  color: #888;
  margin: 2px 0;
  line-height: 1.4;
}

#tooltip .event-tooltip-date {
  color: #aaa;
  font-weight: 500;
}

#event-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(15, 15, 15, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 20px;
  max-width: 260px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  border-radius: 8px;
}

#event-panel h2 {
  font-size: 10px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 14px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Right column stack */
#right-column {
  position: absolute;
  top: 20px;
  right: 20px;
  bottom: 56px; /* lift above ticker/controls to avoid clash */
  width: 220px; /* slimmer so it won't clash with top KPIs */
  display: flex;
  flex-direction: column;
  gap: 10px; /* add breathing space between right panels */
  z-index: 5;
}

/* Live Attacks panel (stacked inside right column) */
#attacks-panel {
  background: #1a1d21;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 20px 20px 10px; /* smaller bottom padding to reduce visible gap */
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  min-height: 0;
  flex: 1 1 auto; /* fill available space */
}
#attacks-panel h2 {
  font-size: 16px; /* larger heading */
  font-weight: 500;
  color: #f97316; /* orange to match brand */
  margin-bottom: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.attack-item { padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
.attack-item:last-child { border-bottom: none; }

.attack-list { flex: 1; min-height: 0; overflow-y: auto; }
.attack-line1 { display: flex; align-items: center; gap: 8px; }
.attack-flag { font-size: 14px; }
.attack-ip { color: #fff; font-weight: 600; font-size: 12px; letter-spacing: 0.2px; }
.attack-service { margin-left: auto; font-size: 10px; padding: 2px 6px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.06); color: #ddd; }
.attack-line2 { margin-top: 4px; display: flex; align-items: center; gap: 8px; }
.attack-cve { font-size: 10px; color: #9aa; }
.attack-country { font-size: 10px; color: #777; margin-left: auto; }

.event-category { margin-bottom: 14px; }

.event-category-title {
  font-size: 8px;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.event-item {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 10px;
}
.event-item:last-child { border-bottom: none; }

.event-date {
  color: #fff;
  font-weight: 500;
  font-size: 10px;
}

.event-name {
  color: #999;
  margin-top: 1px;
  font-size: 9px;
}

.event-days {
  color: #555;
  font-size: 9px;
  margin-top: 1px;
}

.event-icon { margin-right: 5px; font-size: 9px; }

.event-type-political { color: #ef4444; }
.event-type-sports { color: #22c55e; }
.event-type-entertainment { color: #f59e0b; }
.event-type-cultural { color: #ec4899; }
.event-type-astronomical { color: #3b82f6; }
.event-type-tech { color: #8b5cf6; }

#controls {
  position: absolute;
  bottom: 56px; /* lift above ticker */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  background: transparent; /* remove outer box */
  padding: 0;              /* no extra padding around buttons */
  border-radius: 0;
  border: none;
}

/* Ticker colored segments */
.tick-item { margin-right: 28px; }
.tick-ip { color: #f97316; font-weight: 600; }
.tick-service { color: #06b6d4; }
.tick-cve { color: #ef4444; font-weight: 600; }
.tick-country { color: #9aa; }
.tick-sep { color: #555; margin: 0 10px; }

/* Bottom mini-widgets */
.mini-widget {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}
#right-widgets {
  background: #1a1d21;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 12px;
  flex: 0 0 auto;      /* size to content */
  margin-top: auto;     /* stick to bottom of column */
}
.mini-title { font-size: 11px; color: #fff; font-weight: 600; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.4px; }
.mini-list { display: grid; gap: 6px; }
.mini-row { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; }
.mini-label { font-size: 11px; color: #bbb; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-count { font-size: 11px; color: #888; }
.mini-bar { height: 6px; background: rgba(255,255,255,0.06); border-radius: 999px; overflow: hidden; grid-column: 1 / -1; }
.mini-fill { height: 100%; width: 0%; background: #3b82f6; border-radius: 999px; }

.control-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #666;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  font-family: 'Fira Sans', sans-serif;
  font-weight: 400;
  transition: all 0.15s ease;
  border-radius: 4px;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.control-btn.active {
  background: rgba(255, 255, 255, 0.06);
  color: #ddd;
  border-color: rgba(255, 255, 255, 0.12);
}

#event-panel::-webkit-scrollbar { width: 3px; }
#event-panel::-webkit-scrollbar-track { background: transparent; }
#event-panel::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 2px; }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.filter-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #666;
  padding: 3px 8px;
  font-size: 8px;
  cursor: pointer;
  font-family: 'Fira Sans', sans-serif;
  border-radius: 3px;
  transition: all 0.15s ease;
}

.filter-btn:hover { color: #fff; }
.filter-btn.active { background: rgba(255,255,255,0.1); color: #fff; }
