:root {
  --bg-0: #f4efe5;
  --bg-1: #e7d8be;
  --ink: #111b28;
  --ink-soft: #344257;
  --panel: rgba(255, 255, 255, 0.86);
  --border: rgba(16, 24, 40, 0.14);
  --air: #d97706;
  --sea: #0f766e;
  --high: #0f766e;
  --medium: #c2410c;
  --low: #b42318;
  --shadow: 0 12px 40px rgba(14, 30, 37, 0.16);
  --mono: "IBM Plex Mono", monospace;
  --sans: "Space Grotesk", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 10%, rgba(217, 119, 6, 0.18), transparent 36%),
    radial-gradient(circle at 82% 16%, rgba(15, 118, 110, 0.2), transparent 42%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1));
  min-height: 100vh;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(17, 27, 40, 0.65) 0,
    rgba(17, 27, 40, 0.65) 1px,
    transparent 1px,
    transparent 3px
  );
}

.site-header,
.dashboard,
.table-panel,
.site-footer {
  width: min(1300px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.2rem 0 0.8rem;
}

.kicker {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

h1 {
  margin: 0.15rem 0 0.35rem;
  font-size: clamp(1.35rem, 2.8vw, 2.25rem);
  line-height: 1.1;
}

.subtitle {
  margin: 0;
  color: var(--ink-soft);
  max-width: 60ch;
}

.meta-chip {
  font-family: var(--mono);
  font-size: 0.78rem;
  background: rgba(17, 27, 40, 0.08);
  border: 1px solid rgba(17, 27, 40, 0.15);
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
  white-space: nowrap;
}

.dashboard {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 1rem;
  align-items: stretch;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(4px);
}

.control-panel {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: rise 460ms ease;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
}

.stat-card {
  background: rgba(17, 27, 40, 0.04);
  border: 1px solid rgba(17, 27, 40, 0.08);
  border-radius: 12px;
  padding: 0.55rem 0.6rem;
}

.stat-label {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.stat-value {
  margin: 0.22rem 0 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.filters h2 {
  margin: 0 0 0.8rem;
  font-size: 1.05rem;
}

.region-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  margin-bottom: 0.8rem;
}

.region-btn {
  border: 1px solid rgba(17, 27, 40, 0.16);
  background: #ffffff;
  color: var(--ink);
  border-radius: 10px;
  padding: 0.45rem 0.4rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

.region-btn:hover {
  transform: translateY(-1px);
}

.region-btn.active {
  background: var(--ink);
  color: #fef8f0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}

.field-label {
  font-size: 0.85rem;
}

input,
select,
button {
  font: inherit;
}

input[type="search"],
select {
  border: 1px solid rgba(17, 27, 40, 0.2);
  border-radius: 10px;
  padding: 0.5rem 0.55rem;
  background: #ffffff;
}

.inline-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  font-size: 0.82rem;
}

.inline-options label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.reset-btn {
  width: 100%;
  border: 1px solid rgba(17, 27, 40, 0.2);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  background: linear-gradient(180deg, #f8f8f8, #ececec);
  cursor: pointer;
}

.legend {
  border-top: 1px solid rgba(17, 27, 40, 0.12);
  padding-top: 0.9rem;
}

.legend h3 {
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
}

.legend p {
  margin: 0.25rem 0;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.48rem;
}

.dot {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 50%;
  display: inline-block;
}

.dot-plane {
  background: var(--air);
}

.dot-ship {
  background: var(--sea);
}

.dot-high {
  background: var(--high);
}

.dot-medium {
  background: var(--medium);
}

.dot-low {
  background: var(--low);
}

.dot-airbase {
  background: #4f46e5;
}

.dot-naval-base {
  background: #0369a1;
}

.dot-logistics-base {
  background: #6b7280;
}

.dot-attack {
  background: #b91c1c;
}

.legend-symbol {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.9);
  font-size: 0.6rem;
  color: #ffffff;
  line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", var(--mono);
}

.legend-inline {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", var(--mono);
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.legend-symbol.plane {
  background: var(--air);
}

.legend-symbol.ship {
  background: var(--sea);
}

.legend-symbol.airbase {
  background: #4f46e5;
}

.legend-symbol.naval-base {
  background: #0369a1;
}

.legend-symbol.logistics-base {
  background: #6b7280;
}

.legend-symbol.attack {
  background: #b91c1c;
}

.legend-symbol.nation {
  background: #1d4ed8;
}

.legend-line {
  width: 1.1rem;
  height: 0.2rem;
  border-radius: 999px;
  display: inline-block;
}

.legend-line.inbound-line {
  background: #a16207;
  border-top: 2px dashed #a16207;
}

.legend-symbol.confidence.high {
  background: var(--high);
}

.legend-symbol.confidence.medium {
  background: var(--medium);
}

.legend-symbol.confidence.low {
  background: var(--low);
}

.map-panel {
  position: relative;
  overflow: hidden;
  min-height: 620px;
  animation: rise 500ms ease;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 620px;
}

.selection-summary {
  position: absolute;
  left: 0.8rem;
  bottom: 0.8rem;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  background: rgba(17, 27, 40, 0.86);
  color: #fef8f0;
  font-family: var(--mono);
  font-size: 0.75rem;
  z-index: 450;
}

.symbol-marker-root {
  background: transparent;
  border: none;
}

.symbol-marker-wrap {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.symbol-marker {
  border-radius: 50%;
  border: 1px solid #ffffff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.4);
  color: #ffffff;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", var(--mono);
}

.symbol-marker.plane {
  background: var(--air);
}

.symbol-marker.ship {
  background: var(--sea);
}

.symbol-marker.attack {
  background: #b91c1c;
}

.symbol-marker.inbound {
  animation: inbound-pulse 1.35s ease-in-out infinite;
}

.symbol-marker.high {
  width: 28px;
  height: 28px;
  font-size: 0.9rem;
}

.symbol-marker.medium {
  width: 24px;
  height: 24px;
  font-size: 0.82rem;
}

.symbol-marker.low {
  width: 20px;
  height: 20px;
  font-size: 0.74rem;
}

.nation-marker-root {
  background: transparent;
  border: none;
}

.nation-marker {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  border: 1px solid #ffffff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.35);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
}

.nation-marker.high {
  background: #1d4ed8;
}

.nation-marker.medium {
  background: #2563eb;
}

.nation-marker.low {
  background: #3b82f6;
}

.track-popup {
  font-size: 0.82rem;
  line-height: 1.35;
}

.track-popup h4 {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
}

.track-popup p {
  margin: 0.1rem 0;
}

.track-popup a {
  color: #8a2600;
}

.base-popup {
  font-size: 0.82rem;
  line-height: 1.35;
}

.base-popup h4 {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
}

.base-popup p {
  margin: 0.1rem 0;
}

.incident-popup {
  font-size: 0.82rem;
  line-height: 1.35;
}

.incident-popup h4 {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
}

.incident-popup p {
  margin: 0.1rem 0;
}

.incident-popup a {
  color: #8a2600;
}

.base-marker {
  display: flex;
  align-items: center;
  justify-content: center;
}

.base-marker span {
  width: 12px;
  height: 12px;
  border: 1px solid #ffffff;
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.32);
  transform: rotate(45deg);
  border-radius: 1px;
  display: block;
}

.base-marker.airbase span {
  background: #4f46e5;
}

.base-marker.naval-base span {
  background: #0369a1;
}

.base-marker.logistics-hub span {
  background: #6b7280;
}

.table-panel {
  margin-top: 1rem;
  padding: 0.8rem 0.9rem 0.95rem;
  animation: rise 520ms ease;
}

.news-panel {
  margin-top: 1rem;
  padding: 0.9rem;
  animation: rise 520ms ease;
}

.news-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.news-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.news-head p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.news-subtitle {
  margin: 0.35rem 0 0.7rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.news-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.news-item {
  border: 1px solid rgba(17, 27, 40, 0.11);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  padding: 0.6rem;
}

.news-item.placeholder {
  grid-column: 1 / -1;
}

.news-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.7rem;
  font-family: var(--mono);
  color: var(--ink-soft);
}

.news-item h3 {
  margin: 0.42rem 0 0.36rem;
  font-size: 0.88rem;
  line-height: 1.3;
}

.news-item h3 a {
  color: #8a2600;
  text-decoration: none;
}

.news-item h3 a:hover {
  text-decoration: underline;
}

.news-item p {
  margin: 0.22rem 0;
  font-size: 0.79rem;
  color: var(--ink);
  line-height: 1.35;
}

.news-tags {
  font-family: var(--mono);
  color: var(--ink-soft) !important;
  font-size: 0.71rem !important;
}

.news-countries {
  font-family: var(--mono);
  color: #1d4ed8 !important;
  font-size: 0.71rem !important;
}

.news-source {
  color: var(--ink-soft) !important;
  font-size: 0.72rem !important;
}

.table-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.table-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.table-head p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--ink-soft);
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 940px;
}

th,
td {
  border-bottom: 1px solid rgba(17, 27, 40, 0.1);
  padding: 0.5rem 0.45rem;
  text-align: left;
  font-size: 0.82rem;
}

th {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

tbody tr {
  cursor: pointer;
  transition: background 120ms ease;
}

tbody tr:hover,
tbody tr.active {
  background: rgba(17, 27, 40, 0.06);
}

.badge {
  font-family: var(--mono);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.46rem;
  font-size: 0.66rem;
  letter-spacing: 0.03em;
}

.badge.high {
  background: rgba(15, 118, 110, 0.18);
  color: #0b4f49;
}

.badge.medium {
  background: rgba(194, 65, 12, 0.2);
  color: #8a2600;
}

.badge.low {
  background: rgba(180, 35, 24, 0.18);
  color: #741812;
}

.site-footer {
  color: var(--ink-soft);
  font-size: 0.8rem;
  padding: 0.85rem 0 1.2rem;
}

.site-footer p {
  margin: 0.22rem 0;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes inbound-pulse {
  0% {
    transform: scale(0.98);
    box-shadow: 0 0 0 0 rgba(161, 98, 7, 0.55);
  }
  70% {
    transform: scale(1.04);
    box-shadow: 0 0 0 8px rgba(161, 98, 7, 0);
  }
  100% {
    transform: scale(0.98);
    box-shadow: 0 0 0 0 rgba(161, 98, 7, 0);
  }
}

@media (max-width: 980px) {
  .site-header {
    flex-direction: column;
  }

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

  .map-panel,
  #map {
    min-height: 460px;
  }

  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .news-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .site-header,
  .dashboard,
  .table-panel,
  .site-footer {
    width: min(1300px, calc(100% - 1rem));
  }

  .region-switch {
    grid-template-columns: 1fr;
  }

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

  .news-list {
    grid-template-columns: 1fr;
  }
}
