:root {
  --bg-night: #030806;
  --bg-panel: rgba(8, 16, 13, 0.84);
  --bg-card: rgba(8, 18, 14, 0.9);
  --bg-card-soft: rgba(10, 24, 18, 0.86);
  --text-main: #eaffe2;
  --text-muted: #a6c9a6;
  --accent: #39ff14;
  --accent-soft: #98ff84;
  --accent-glow: rgba(57, 255, 20, 0.34);
  --border-soft: rgba(152, 255, 132, 0.24);
  --line-soft: rgba(152, 255, 132, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  color: var(--text-main);
  background: var(--bg-night);
  overflow-x: hidden;
}

.page-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 16% 20%, rgba(57, 255, 20, 0.18), transparent 42%),
    radial-gradient(circle at 84% 14%, rgba(88, 255, 143, 0.12), transparent 40%),
    radial-gradient(circle at 86% 88%, rgba(57, 255, 20, 0.09), transparent 36%),
    linear-gradient(180deg, #06110d 0%, #030806 42%, #020704 100%);
  pointer-events: none;
  z-index: 0;
}

main,
#map {
  width: 100%;
}

#map {
  position: relative;
  z-index: 1;
  height: 100%;
  border-radius: 18px;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.map-shell {
  height: min(74vh, 760px);
  min-height: 420px;
  border-radius: 20px;
  padding: 8px;
  border: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(10, 20, 15, 0.92), rgba(4, 10, 8, 0.96));
  box-shadow:
    0 22px 50px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(57, 255, 20, 0.17);
}

.top-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  background: var(--bg-panel);
  backdrop-filter: blur(8px);
}

h1 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0.01em;
  background: linear-gradient(90deg, var(--accent), #d6ffc6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 22px rgba(57, 255, 20, 0.2);
}

.top-panel p {
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.stats {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.stat-card {
  min-width: 112px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: rgba(7, 18, 13, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-card .label {
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat-card strong {
  margin-top: 4px;
  color: var(--accent);
  text-shadow: 0 0 14px rgba(57, 255, 20, 0.36);
  font-size: 1.04rem;
  font-weight: 700;
}

.leaflet-container {
  background: #04110b;
}

.leaflet-tile-pane {
  filter: brightness(1.1) contrast(1.16) saturate(1.08);
}

.info-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 12px;
}

.info-card {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
  color: var(--text-main);
}

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

.info-card h2 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-soft);
}

.country-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: rgba(7, 17, 13, 0.8);
}

.country-tab {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 6px 9px;
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.country-tab:hover {
  color: var(--text-main);
}

.country-tab.is-active {
  color: #04110b;
  border-color: rgba(57, 255, 20, 0.8);
  background: var(--accent);
  box-shadow: 0 0 15px rgba(57, 255, 20, 0.34);
}

.country-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.country-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: var(--bg-card-soft);
  color: var(--text-main);
  font-size: 0.9rem;
}

.country-list li strong {
  color: var(--accent);
}

.visit-table-wrap {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--bg-card-soft);
}

.visit-table {
  width: 100%;
  border-collapse: collapse;
}

.visit-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 11px 12px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-soft);
  background: rgba(5, 14, 10, 0.96);
  border-bottom: 1px solid var(--line-soft);
}

.visit-table tbody td {
  padding: 11px 12px;
  color: var(--text-main);
  font-size: 0.93rem;
  border-bottom: 1px solid rgba(152, 255, 132, 0.09);
}

.visit-table tbody td:nth-child(3) {
  color: var(--accent-soft);
  font-size: 0.85rem;
}

.powered-banner {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: rgba(7, 16, 12, 0.84);
  color: var(--text-muted);
  text-align: center;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #081810;
  color: #e7ffe0;
  border: 1px solid var(--line-soft);
}

.leaflet-popup-content strong {
  color: var(--accent);
}

.leaflet-control-zoom a {
  background-color: rgba(8, 18, 14, 0.94);
  color: var(--accent);
  border-bottom: 1px solid rgba(152, 255, 132, 0.2);
}

.leaflet-control-attribution {
  background: rgba(3, 9, 7, 0.65) !important;
  color: rgba(204, 255, 197, 0.8);
}

.leaflet-control-attribution a {
  color: var(--accent-soft);
}

@media (max-width: 900px) {
  .app-shell {
    padding: 14px;
    gap: 12px;
  }

  .top-panel {
    flex-direction: column;
    align-items: stretch;
  }

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

  .stat-card {
    min-width: 0;
    flex: 1;
  }

  .map-shell {
    min-height: 360px;
    height: 62vh;
    padding: 6px;
  }

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

@media (max-width: 640px) {
  .card-head {
    flex-direction: column;
    align-items: stretch;
  }

  .country-tabs {
    width: 100%;
  }

  .country-tab {
    flex: 1;
  }
}
