:root {
  --bg: #070b12;
  --bg-2: #0f1724;
  --panel: rgba(14, 21, 34, 0.7);
  --border: rgba(141, 156, 188, 0.22);
  --text: #f3f6fd;
  --muted: #97a4bf;
  --strong-green: #00c774;
  --light-green: #55e0a0;
  --neutral: #7e8798;
  --light-red: #f57e89;
  --strong-red: #ee3f5d;
  --highlight: #47b6ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  background: radial-gradient(1100px 520px at 75% -5%, #16355f 0%, transparent 48%),
    radial-gradient(900px 480px at -10% 100%, #33155c 0%, transparent 48%),
    var(--bg);
  color: var(--text);
  overflow: hidden;
}

.app-bg {
  position: fixed;
  inset: 0;
  background: linear-gradient(130deg, rgba(73, 199, 255, 0.06), rgba(255, 101, 122, 0.04));
  pointer-events: none;
}

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  max-width: 1360px;
  height: 100dvh;
  margin: 0 auto;
  padding: 14px 16px 16px;
}

.glass {
  border: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(13px);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.32);
}

.topbar {
  border-radius: 18px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

h1 {
  font-size: 1.72rem;
  margin: 0;
  letter-spacing: 0.01em;
}

h2 {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 3px;
  color: #74c9ff;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.status-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0 4px;
  color: var(--muted);
  font-size: 0.75rem;
}

.footer a {
  color: #74c9ff;
  text-decoration: none;
  font-weight: 700;
}

.footer a:hover {
  text-decoration: underline;
}

.refresh-btn {
  border: 1px solid rgba(145, 201, 255, 0.4);
  background: linear-gradient(140deg, rgba(46, 101, 160, 0.36), rgba(20, 147, 176, 0.32));
  color: var(--text);
  border-radius: 10px;
  height: 32px;
  padding: 0 12px;
  font: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}

.refresh-btn:hover {
  box-shadow: 0 0 0 1px rgba(145, 201, 255, 0.24), 0 0 20px rgba(71, 182, 255, 0.28);
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1.28fr) minmax(0, 0.72fr);
  gap: 10px;
  min-height: 0;
}

.panel {
  border-radius: 18px;
  padding: 12px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.map-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  border: 1px solid rgba(152, 164, 194, 0.15);
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(18, 28, 46, 0.92), rgba(8, 13, 23, 0.92));
}

#worldMap {
  width: 100%;
  height: 100%;
}

.country {
  transition: stroke 650ms ease, stroke-width 650ms ease, stroke-opacity 650ms ease, filter 280ms ease;
  fill: #111826;
  stroke: var(--country-stroke, rgba(184, 193, 214, 0.42));
  stroke-width: 0.35;
  vector-effect: non-scaling-stroke;
}

.country.monitored {
  stroke-width: 0.85;
}

.country.monitored:hover {
  filter: drop-shadow(0 0 10px rgba(126, 195, 255, 0.82));
}

.country.pulse {
  animation: pulseGlow 2.4s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(82, 235, 167, 0)); }
  50% { filter: drop-shadow(0 0 12px rgba(82, 235, 167, 0.46)); }
}

.tooltip {
  position: absolute;
  min-width: 214px;
  max-width: 280px;
  pointer-events: none;
  background: rgba(9, 14, 24, 0.96);
  border: 1px solid rgba(122, 136, 166, 0.48);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.38);
  transform: translate(12px, -50%);
}

.tooltip.hidden {
  display: none;
}

.tooltip h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.tooltip p {
  margin: 2px 0;
  font-size: 0.84rem;
  color: #d2dbef;
}

.legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  color: #bbcae7;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.cards {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  grid-auto-flow: column;
  grid-auto-columns: minmax(170px, 1fr);
  gap: 6px;
  flex: 1;
  align-content: start;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.card {
  border: 1px solid rgba(126, 139, 166, 0.26);
  border-radius: 14px;
  padding: 6px 7px;
  background: linear-gradient(130deg, rgba(35, 47, 69, 0.45), rgba(15, 24, 39, 0.6));
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
  min-width: 0;
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(168, 186, 222, 0.44);
}

.card.live {
  box-shadow: 0 0 22px rgba(78, 206, 149, 0.21);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.card-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-sub {
  margin: 2px 0 5px;
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1.1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 0.62rem;
  line-height: 1.1;
  min-width: 0;
}

.row span,
.row strong {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v-pos { color: var(--strong-green); }
.v-neg { color: var(--strong-red); }
.v-neu { color: var(--neutral); }

@media (min-width: 900px) {
  .list-panel {
    min-width: 0;
  }
}

@media (max-width: 1120px) {
  .map-wrap {
    min-height: 0;
  }
}

@media (max-width: 700px) {
  .shell {
    padding: 12px;
  }

  h1 {
    font-size: 1.55rem;
  }

  .grid {
    gap: 10px;
    grid-template-rows: minmax(0, 1.18fr) minmax(0, 0.82fr);
  }

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

  .status-wrap {
    width: 100%;
    justify-content: space-between;
  }

  .cards {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-auto-flow: row;
    grid-auto-columns: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }
}
