:root {
  --bg: #1d2126;
  --bg-elevated: rgba(29, 33, 38, 0.94);
  --bg-panel: rgba(24, 29, 36, 0.9);
  --line: rgba(148, 206, 242, 0.18);
  --line-strong: rgba(7, 136, 217, 0.48);
  --text: #eaf7ff;
  --muted: rgba(148, 206, 242, 0.68);
  --muted-strong: #94cef2;
  --cyan: #0788d9;
  --teal: #94cef2;
  --orange: #ff8a3d;
  --red: #ff4d6d;
  --violet: #353ff2;
  --panel-shadow: 0 20px 60px rgba(4, 10, 18, 0.38);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(7, 136, 217, 0.2), transparent 30%),
    radial-gradient(circle at top right, rgba(53, 63, 242, 0.18), transparent 28%),
    linear-gradient(180deg, #1d2126 0%, #12171d 100%);
  color: var(--text);
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", "Liberation Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

body {
  overflow: hidden;
}

a {
  color: var(--cyan);
  text-decoration: none;
}

.app-shell {
  height: 100vh;
  position: relative;
}

.app-content {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr;
  min-height: 0;
}

.app-content.hidden {
  display: none;
}

.maintenance-overlay {
  position: absolute;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background:
    radial-gradient(circle at top left, rgba(7, 136, 217, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(53, 63, 242, 0.12), transparent 24%),
    rgba(18, 23, 29, 0.98);
}

.maintenance-overlay.hidden {
  display: none;
}

.maintenance-card {
  width: min(560px, 100%);
  padding: 1.4rem 1.5rem;
  border: 1px solid rgba(148, 206, 242, 0.16);
  background: linear-gradient(180deg, rgba(29, 33, 38, 0.96), rgba(18, 23, 29, 0.98));
  box-shadow: var(--panel-shadow);
  text-align: center;
}

.maintenance-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  margin-bottom: 0.7rem;
}

.maintenance-eyebrow {
  margin: 0 0 0.55rem;
  color: var(--muted-strong);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.maintenance-title {
  margin: 0 0 0.65rem;
  font-size: 1rem;
  line-height: 1.2;
  font-weight: 600;
}

.maintenance-message {
  margin: 0;
  color: var(--muted-strong);
  font-size: 0.74rem;
  line-height: 1.55;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  min-height: 28px;
  padding: 0.22rem 0.65rem;
  border-bottom: 1px solid var(--line);
  background: rgba(24, 29, 36, 0.94);
  backdrop-filter: blur(8px);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  line-height: 1;
}

.brand-logo {
  width: 14px;
  height: 14px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(53, 63, 242, 0.3));
}

.brand-copy {
  display: flex;
  align-items: center;
  line-height: 1;
}

.brand-mark {
  color: var(--text);
  font-size: 0.73rem;
  line-height: 0;
  letter-spacing: 0.02em;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  min-height: 14px;
}

.headline-metrics {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  flex-wrap: wrap;
  min-width: 0;
}

.header-link,
.header-date,
.header-time,
.header-status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1;
  white-space: nowrap;
}

.header-link,
.header-date {
  padding-right: 0.55rem;
  border-right: 1px solid var(--line);
}

.header-time {
  padding-right: 0.55rem;
  border-right: 1px solid var(--line);
}

.header-link strong {
  color: var(--text);
  font-size: inherit;
  font-weight: 600;
}

.header-link {
  background: transparent;
  font-family: inherit;
  border-top: 0;
  border-left: 0;
  border-bottom: 0;
  border-right: 1px solid var(--line);
  cursor: pointer;
  padding: 0 0.55rem 0 0;
}

.header-link:hover {
  color: var(--muted-strong);
}

.header-action:active {
  color: var(--text);
}

.header-status {
  color: #6ff3b4;
  font-weight: 600;
  text-transform: lowercase;
}

.metric-label,
.label,
.overlay-label,
.feed-meta,
.kev-meta {
  color: var(--muted);
  font-size: 0.63rem;
}

.ticker {
  height: 26px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: rgba(20, 25, 31, 0.95);
  white-space: nowrap;
}

.ticker-track {
  display: flex;
  width: max-content;
  animation: ticker-scroll 260s linear infinite;
  will-change: transform;
}

.ticker:hover .ticker-track {
  animation-play-state: paused;
}

.ticker-group {
  display: inline-flex;
  gap: 2.75rem;
  padding-right: 2.75rem;
}

.ticker-item {
  color: var(--muted-strong);
  font-size: 0.63rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ticker-link {
  color: inherit;
  text-decoration: none;
}

.ticker-link:hover {
  color: var(--text);
}

@keyframes ticker-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

.layout {
  min-height: 0;
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr) 360px;
  gap: 1rem;
  padding: 0.7rem;
}

.panel,
.map-stage {
  min-height: 0;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(29, 33, 38, 0.9), rgba(18, 23, 29, 0.94));
  box-shadow: var(--panel-shadow);
}

.panel {
  overflow: auto;
}

.panel-section {
  padding: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.62rem;
  color: var(--muted-strong);
}

.section-toggle {
  width: 100%;
  padding: 0 0 0.1rem;
  background: transparent;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.62rem;
  color: var(--muted-strong);
  transition: color 120ms ease;
}

.section-toggle:hover {
  color: var(--text);
}

.section-toggle-icon {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1;
  transition: color 120ms ease, transform 120ms ease;
}

.section-toggle:hover .section-toggle-icon {
  color: var(--text);
  transform: scale(1.04);
}

.collapsible-section.is-collapsed > :not(.section-toggle) {
  display: none;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 16px rgba(148, 206, 242, 0.68);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.status-grid article,
.legend-item,
.target-item,
.feed-item,
.kev-item {
  padding: 0.68rem;
  background: rgba(27, 35, 43, 0.8);
  border: 1px solid rgba(148, 206, 242, 0.16);
}

.typed-card {
  position: relative;
  border-left: 2px solid var(--card-accent, rgba(148, 206, 242, 0.5));
}

.typed-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--card-accent, rgba(148, 206, 242, 0.5));
  box-shadow: 0 0 10px color-mix(in srgb, var(--card-accent) 40%, transparent);
}

.status-grid strong,
.legend-item strong,
.target-item strong {
  display: block;
  margin-top: 0.24rem;
  font-size: 0.76rem;
  line-height: 1.2;
}

.legend-item strong {
  margin-top: 0;
  font-size: 0.66rem;
}

.legend-list,
.target-list,
.kev-list,
.feed-list {
  display: grid;
  gap: 0.55rem;
}

.item-badges {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
}

.threat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 16px;
  padding: 0.08rem 0.34rem;
  border: 1px solid color-mix(in srgb, var(--badge-color) 42%, transparent);
  color: var(--badge-color);
  background: color-mix(in srgb, var(--badge-color) 10%, transparent);
  font-size: 0.54rem;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.category-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 16px;
  padding: 0.08rem 0.34rem;
  border: 1px solid rgba(148, 206, 242, 0.16);
  color: var(--muted-strong);
  background: rgba(148, 206, 242, 0.05);
  font-size: 0.54rem;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.legend-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.64rem;
}

.legend-swatch {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.legend-swatch::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--swatch);
  box-shadow: 0 0 12px color-mix(in srgb, var(--swatch) 70%, transparent);
}

.target-item {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
}

.map-stage {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(7, 136, 217, 0.22), transparent 44%),
    linear-gradient(180deg, #1d2126 0%, #12171d 100%);
}

.map-stage::before,
.map-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 650;
}

.map-stage::before {
  background:
    linear-gradient(rgba(40, 176, 224, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(53, 63, 242, 0.065) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at center, black 42%, transparent 88%);
}

.map-stage::after {
  background:
    radial-gradient(circle at 50% 40%, transparent 0%, transparent 64%, rgba(18, 23, 29, 0.25) 100%),
    linear-gradient(180deg, rgba(7, 136, 217, 0.05), rgba(53, 63, 242, 0.035) 42%, transparent 70%);
  mix-blend-mode: normal;
}

.map-toolbar {
  position: absolute;
  z-index: 920;
  top: 0.7rem;
  left: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  align-content: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
  max-width: calc(100% - 1.4rem);
}

.toolbar-chip {
  padding: 0.28rem 0.48rem;
  background: rgba(23, 29, 36, 0.94);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-transform: uppercase;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
}

.toolbar-chip strong {
  color: var(--text);
  font-size: 0.62rem;
  font-weight: 600;
}

.toolbar-chip-accent {
  color: var(--cyan);
  border-color: rgba(7, 136, 217, 0.5);
}

.map-filter {
  position: relative;
}

.map-filter-button {
  cursor: pointer;
  font-family: inherit;
  color: var(--muted-strong);
}

.map-filter-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 180px;
  padding: 0.45rem;
  border: 1px solid var(--line);
  background: rgba(23, 29, 36, 0.98);
  box-shadow: var(--panel-shadow);
  display: grid;
  gap: 0.35rem;
  z-index: 930;
}

.map-filter-menu.hidden {
  display: none;
}

.map-filter-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text);
  font-size: 0.63rem;
}

.map-filter-option input {
  margin: 0;
}

.map-filter-option-disabled {
  color: var(--muted);
}

#map,
#attack-canvas {
  position: absolute;
  inset: 0;
}

#map {
  background:
    radial-gradient(circle at 50% 35%, rgba(7, 136, 217, 0.14), transparent 34%),
    linear-gradient(180deg, #1d2126, #12171d);
  filter: saturate(1.12) contrast(1.08) brightness(1.16);
}

#attack-canvas {
  pointer-events: none;
  z-index: 760;
}

.map-tooltip {
  position: absolute;
  z-index: 950;
  max-width: 240px;
  padding: 0.35rem 0.45rem;
  border: 1px solid rgba(148, 206, 242, 0.18);
  background: rgba(19, 24, 30, 0.96);
  color: var(--text);
  font-size: 0.61rem;
  line-height: 1.35;
  pointer-events: none;
  box-shadow: var(--panel-shadow);
  transform: translate(10px, 10px);
}

.map-tooltip.hidden {
  display: none;
}

.map-tooltip-title {
  color: var(--text);
  font-weight: 600;
}

.map-tooltip-meta {
  color: var(--muted-strong);
  margin-top: 0.12rem;
}

.leaflet-pane {
  z-index: 500;
}

.leaflet-tile-pane {
  filter: hue-rotate(166deg) saturate(1.25) contrast(1.08) brightness(1.12);
}

.leaflet-control-zoom {
  border: 1px solid var(--line) !important;
  box-shadow: none !important;
  margin-top: 54px !important;
  margin-left: 12px !important;
}

.leaflet-control-zoom a {
  background: rgba(29, 33, 38, 0.95) !important;
  color: var(--text) !important;
  border-bottom: 1px solid var(--line) !important;
}

.map-overlay-bottom {
  position: absolute;
  left: 0.7rem;
  right: 0.7rem;
  bottom: 0.7rem;
  z-index: 920;
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  padding: 0.3rem 0.35rem;
  border: 1px solid rgba(148, 206, 242, 0.12);
  background: rgba(24, 29, 36, 0.62);
  backdrop-filter: blur(12px);
}

.overlay-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  min-height: 22px;
  padding: 0.18rem 0.42rem;
  border: 1px solid rgba(148, 206, 242, 0.14);
  background: rgba(20, 25, 31, 0.84);
}

.overlay-chip strong {
  font-size: 0.66rem;
  line-height: 1;
  color: var(--text);
}

.overlay-chip-tracked {
  border-color: rgba(7, 136, 217, 0.26);
}

.overlay-chip-tracked strong {
  color: #94cef2;
}

.overlay-chip-severity {
  border-color: rgba(255, 77, 109, 0.32);
}

.overlay-chip-severity strong {
  color: #ff7d98;
}

.overlay-chip-updated {
  border-color: rgba(53, 63, 242, 0.28);
}

.overlay-chip-updated strong {
  color: #b5bbff;
}

.feed-item h3,
.kev-item h3 {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  line-height: 1.35;
}

.feed-item h3 a {
  color: #94cef2;
}

.feed-item h3 a:hover {
  color: #c8ecff;
}

.kev-item h3 a {
  color: #94cef2;
}

.kev-item h3 a:hover {
  color: #c8ecff;
}

.feed-item p,
.kev-item p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 0.64rem;
  line-height: 1.45;
}

.feed-meta,
.kev-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  margin-top: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.severity-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-transform: uppercase;
  font-size: 0.64rem;
}

.source-badge {
  color: var(--cyan);
}

@media (max-width: 1280px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .map-stage {
    min-height: 70vh;
  }

  .headline-metrics {
    width: 100%;
    justify-content: flex-start;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .headline-metrics {
    gap: 0.4rem;
  }

  .brand-logo {
    width: 14px;
    height: 14px;
  }

  .map-stage {
    min-height: 60vh;
  }
}
