:root {
  --bg: #eef1f4;
  --panel: #fff;
  --text: #1a2332;
  --muted: #5c6773;
  --border: rgba(0, 0, 0, 0.12);
  --shadow: rgba(0, 0, 0, 0.12);
  --low: #1a9d4f;
  --mid: #b8860b;
  --high: #c0392b;
  --accent: #1971c2;
  --side-pad: max(16px, env(safe-area-inset-left));
  --side-pad-r: max(16px, env(safe-area-inset-right));
  --top-pad: max(8px, env(safe-area-inset-top));
  --bottom-pad: max(16px, env(safe-area-inset-bottom));
  --map-h: clamp(380px, 58dvh, 620px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  overflow-y: auto;
}

/* Минимальная главная: симулятор, виджет сети, Telegram-блоки, «факты» — см. landing-archived в index.html */
body.landing-minimal .landing-archived {
  display: none !important;
}

body.landing-minimal .landing-intro {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

body.landing-minimal .landing-body {
  padding-top: 16px;
  padding-bottom: max(24px, var(--bottom-pad));
}

#page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* ── Map (top, clean — only network panel floats) ── */
.map-hero {
  position: relative;
  width: 100%;
  height: var(--map-h);
  flex-shrink: 0;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #dce4ec;
  touch-action: none;
}

.map-float {
  position: absolute;
  z-index: 400;
  pointer-events: auto;
}

.map-float--network {
  top: var(--top-pad);
  right: var(--side-pad-r);
  max-width: min(calc(100% - 24px), 220px);
  z-index: 410;
}

.map-float--pulse {
  bottom: max(10px, env(safe-area-inset-bottom));
  right: var(--side-pad-r);
  pointer-events: none;
}

.city-pulse {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px 10px;
  min-width: 116px;
  box-shadow: 0 4px 18px var(--shadow);
  backdrop-filter: blur(8px);
}

.network-panel {
  background: linear-gradient(145deg, rgba(255,255,255,0.97) 0%, rgba(243,247,252,0.95) 100%);
  border: 1px solid rgba(25, 113, 194, 0.2);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 6px 22px rgba(25, 113, 194, 0.14);
  backdrop-filter: blur(8px);
}

.network-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.network-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--low);
  animation: net-pulse 2.4s ease-out infinite;
}

@keyframes net-pulse {
  0% { box-shadow: 0 0 0 0 rgba(26, 157, 79, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(26, 157, 79, 0); }
  100% { box-shadow: 0 0 0 0 rgba(26, 157, 79, 0); }
}

.network-panel-title {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.network-panel-meta {
  font-size: 0.62rem;
  color: var(--muted);
  width: 100%;
}

.network-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.network-stat {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 10px;
  padding: 8px 10px;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.network-stat--wide { grid-column: 1 / -1; }

.network-stat-value {
  font-size: clamp(1.05rem, 3vw, 1.3rem);
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.network-stat-label {
  margin-top: 2px;
  font-size: 0.62rem;
  color: var(--muted);
  line-height: 1.2;
}

.hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 500;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 14px;
  box-shadow: 0 4px 24px var(--shadow);
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}

/* ── Controls below map ── */
.below-map {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 10px var(--side-pad-r) 14px var(--side-pad);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lang-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 88px;
  overflow-y: auto;
}

.lang-btn {
  min-height: 32px;
  min-width: 32px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  letter-spacing: 0.02em;
}

.lang-btn--active {
  border-color: var(--accent);
  color: var(--accent);
  background: #e7f2ff;
}

.filters-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 12px 20px;
  align-items: end;
  width: 100%;
}

.filters-row .control-block {
  min-width: 0;
}

.filters-row .chip-row {
  flex-wrap: nowrap;
}

.filters-row .chip-row--scroll {
  overflow-x: auto;
}

@media (max-width: 640px) {
  .map-float--network {
    max-width: min(calc(58% - 8px), 200px);
  }

  .filters-row {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 16px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .filters-row::-webkit-scrollbar { display: none; }

  .filters-row .control-block {
    flex: 0 0 auto;
    min-width: min(100%, 200px);
  }

  .filters-row .control-block--city {
    min-width: min(100%, 260px);
  }

  .filters-row .control-block--period {
    min-width: min(100%, 220px);
  }
}

.control-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.control-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

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

.chip-row--scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.chip-row--scroll::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  min-height: 36px;
  min-width: 36px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 4px var(--shadow);
}

.chip--active {
  border-color: var(--accent);
  color: var(--accent);
  background: #e7f2ff;
}

@media (min-width: 768px) {
  .filters-row {
    gap: 12px 24px;
  }
}

.cp-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(24px, auto));
  gap: 6px;
}

.cp-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 24px;
}

.cp-trip-icon { font-size: 8px; }
.cp-num { font-size: 14px; font-weight: 800; }
.cp-active .cp-num { color: var(--low); }
.cp-done .cp-num { color: var(--high); }

/* ── Text content ── */
.landing-body {
  padding: 24px var(--side-pad-r) var(--bottom-pad) var(--side-pad);
  background: #fff;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
}

.landing-intro {
  padding-bottom: 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.hero-title {
  font-size: clamp(1.35rem, 4.5vw, 1.85rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 10px;
}

.hero-sub {
  font-size: clamp(0.95rem, 2.8vw, 1.1rem);
  color: var(--muted);
  margin-bottom: 12px;
}

.hero-welcome {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.6;
}

.landing-block { margin-bottom: 28px; }

.landing-block p,
.landing-block li {
  margin-bottom: 12px;
  font-size: 1rem;
}

.landing-em {
  font-weight: 600;
  color: var(--accent);
}

.landing-block--why {
  padding: 20px;
  background: #f4f7fb;
  border-radius: 12px;
  border-left: 4px solid var(--accent);
}

.landing-lead {
  font-size: 1.15rem !important;
  font-weight: 800;
}

.landing-pulse {
  font-size: 1.05rem !important;
  font-weight: 700;
  color: var(--accent);
}

.landing-list {
  padding-left: 1.2rem;
  margin-bottom: 12px;
}

.landing-cta { text-align: center; padding: 8px 0 24px; }

.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 28px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(25, 113, 194, 0.35);
}

.landing-footer {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

/* ── Leaflet ── */
.leaflet-container { font: inherit; }

.leaflet-control-zoom {
  margin-left: max(10px, env(safe-area-inset-left)) !important;
  margin-bottom: max(52px, env(safe-area-inset-bottom)) !important;
  border: none !important;
  box-shadow: 0 2px 10px var(--shadow) !important;
}

.leaflet-control-zoom a {
  min-width: 40px !important;
  min-height: 40px !important;
  line-height: 40px !important;
  background: #fff !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
}

.cell-popup-wrap .leaflet-popup-content { margin: 12px 14px; font-size: 13px; line-height: 1.5; }
.cell-popup { max-width: 280px; }
.cell-popup-title { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.cell-popup-section { margin-bottom: 8px; }
.cell-popup-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 2px;
}
.cell-popup-value { font-size: 13px; }
.cell-popup-muted { font-size: 12px; color: var(--muted); }
.cell-popup-neighbors { font-size: 12px; color: var(--muted); margin-top: 4px; }
.cell-popup-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  line-height: 1.45;
}

.leaflet-control-attribution {
  background: rgba(255,255,255,.85) !important;
  font-size: 9px !important;
  color: var(--muted) !important;
}

.cell-label-wrap { background: transparent !important; border: none !important; }

.cell-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 54px;
  gap: 2px;
  font-size: clamp(10px, 2.8vw, 12px);
  font-weight: 800;
  color: #1a2332;
  text-shadow: 0 0 4px #fff, 0 1px 2px rgba(255,255,255,.95);
  pointer-events: none;
}

.cell-in { flex: 1; color: #cc7f3e; font-size: 9px; text-align: left; }
.cell-out { flex: 1; color: #8a9eb0; font-size: 9px; text-align: right; }
.cell-heat { flex: 0 0 auto; color: #9a8b7a; font-size: 11px; font-weight: 700; margin-left: 2px; }
.cell-now { flex: 0 0 auto; font-size: 14px; margin: 0 2px; }

.moderation-bar {
  margin-top: 10px;
  padding: 0 4px;
}

.moderation-btn {
  width: 100%;
  border: 1px dashed #9aa8b8;
  background: #f4f6f8;
  color: #4a5568;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.moderation-btn:hover {
  background: #eef1f4;
}

.moderation-backdrop {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(20, 28, 38, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.moderation-backdrop.hidden {
  display: none;
}

.moderation-dialog {
  width: min(420px, 100%);
  max-height: min(70vh, 520px);
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  padding: 16px 18px 18px;
}

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

.moderation-dialog-head h2 {
  margin: 0;
  font-size: 17px;
}

.moderation-close {
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #6b7280;
}

.moderation-country {
  margin-bottom: 12px;
}

.moderation-country-name {
  font-weight: 700;
  margin-bottom: 4px;
}

.moderation-list ul {
  margin: 0;
  padding-left: 18px;
  color: #4a5568;
}
