:root {
  --bg: #05060a;
  --ink: #f2f3f7;
  --muted: #8b90a6;
  --line: rgba(255, 255, 255, 0.08);
  --glass: rgba(14, 16, 24, 0.72);
  --amber: #ffb020;
  --pink: #ff4d6d;
  --violet: #7c5cff;
  --grad: linear-gradient(110deg, var(--amber), var(--pink) 45%, var(--violet));
}

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

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  font-feature-settings: 'ss01', 'cv11';
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* --- фон: градиентный меш + сетка + шум --- */
.mesh { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.5;
  animation: drift 24s ease-in-out infinite;
}
.b1 { width: 46vw; height: 46vw; left: -10vw; top: -12vw; background: var(--amber); opacity: 0.28; }
.b2 { width: 40vw; height: 40vw; right: -8vw; top: 10vh; background: var(--violet); opacity: 0.3; animation-delay: -8s; }
.b3 { width: 38vw; height: 38vw; left: 25vw; bottom: -18vw; background: var(--pink); opacity: 0.2; animation-delay: -16s; }

@keyframes drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33% { transform: translate3d(4vw, 3vh, 0) scale(1.12); }
  66% { transform: translate3d(-3vw, -2vh, 0) scale(0.94); }
}

.grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%);
  opacity: 0.5;
}

.noise {
  position: absolute;
  inset: -50%;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --- карта --- */
#map {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: transparent;
}
.leaflet-container { background: transparent !important; }
.leaflet-tile-pane { opacity: 0.55; filter: saturate(0.2) contrast(1.05); }
.leaflet-control-attribution {
  background: rgba(5, 6, 10, 0.6) !important;
  color: var(--muted) !important;
  backdrop-filter: blur(8px);
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--muted) !important; }

/* --- стекло --- */
.glass {
  background: var(--glass);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  border: 1px solid var(--line);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* --- топбар --- */
.topbar {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 9px 9px 16px;
  border-radius: 999px;
  animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -0.02em; }
.logo { filter: drop-shadow(0 0 10px rgba(255, 176, 32, 0.7)); }
.brandname .dot { color: var(--amber); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.pill.live { color: #7ef0b0; border-color: rgba(126, 240, 176, 0.25); background: rgba(126, 240, 176, 0.08); }
.pill.live i {
  width: 6px; height: 6px; border-radius: 50%;
  background: #7ef0b0;
  box-shadow: 0 0 0 0 rgba(126, 240, 176, 0.7);
  animation: ping 2s infinite;
}
@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(126, 240, 176, 0.6); }
  70% { box-shadow: 0 0 0 7px rgba(126, 240, 176, 0); }
  100% { box-shadow: 0 0 0 0 rgba(126, 240, 176, 0); }
}

/* --- главная панель --- */
.hero {
  position: fixed;
  z-index: 20;
  top: 92px;
  left: 22px;
  bottom: 22px;
  width: 400px;
  padding: 26px;
  border-radius: 26px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
  animation: rise 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.06s both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.hero.glass { animation-name: rise; }

.badge {
  align-self: flex-start;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #d9d2ff;
  border: 1px solid rgba(124, 92, 255, 0.35);
  background: linear-gradient(90deg, rgba(124, 92, 255, 0.16), rgba(255, 77, 109, 0.12));
}
.badge b { color: #fff; }

h1 {
  font-size: 44px;
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.035em;
}
.grad {
  background: var(--grad);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer {
  to { background-position: 200% center; }
}

.tagline { color: var(--muted); font-size: 14px; line-height: 1.55; }
.tagline b { color: var(--ink); font-weight: 600; }

/* --- статы --- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  position: relative;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}
.stat::after {
  content: '';
  position: absolute; inset: 0;
  background: var(--grad);
  opacity: 0.07;
}
.stat b {
  display: block;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}
.stat span { position: relative; font-size: 11px; color: var(--muted); }

/* --- лидерборд --- */
.section h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 12px;
  font-weight: 600;
}
.section h2 .mono { text-transform: none; letter-spacing: 0; opacity: 0.5; font-size: 11px; }

/* --- вкладки лидерборда --- */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}
.tab {
  flex: 1;
  padding: 7px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: 600 12px 'Inter', sans-serif;
  cursor: pointer;
  transition: color 0.18s, background 0.18s;
}
.tab:hover { color: var(--ink); }
.tab.active {
  color: #100b00;
  background: var(--grad);
  box-shadow: 0 4px 14px rgba(255, 77, 109, 0.25);
}

.heroes { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.heroes li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 13.5px;
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
}
.heroes li:hover {
  transform: translateX(3px);
  border-color: rgba(255, 176, 32, 0.35);
  background: rgba(255, 176, 32, 0.06);
}
.heroes .who { display: flex; align-items: center; gap: 9px; min-width: 0; }
.heroes .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heroes .rank {
  flex-shrink: 0;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 7px;
  font-size: 11px; font-weight: 700;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
}
.heroes li:first-child .rank { background: var(--grad); color: #100b00; }
.heroes .score {
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--amber);
}
.heroes .empty {
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  border-style: dashed;
}

/* --- CTA --- */
.cta { margin-top: auto; padding-top: 6px; }
.btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 650;
  color: #100a02;
  text-decoration: none;
  background: var(--grad);
  background-size: 200% 100%;
  box-shadow: 0 10px 32px rgba(255, 77, 109, 0.28);
  transition: transform 0.18s, box-shadow 0.25s, background-position 0.6s;
}
.btn:hover {
  transform: translateY(-2px);
  background-position: 100% center;
  box-shadow: 0 16px 44px rgba(124, 92, 255, 0.42);
}
.btn:active { transform: translateY(0); }

.fineprint { margin-top: 10px; font-size: 12px; color: var(--muted); line-height: 1.5; text-align: center; }

.foot { font-size: 10px; color: rgba(139, 144, 166, 0.6); line-height: 1.6; }

/* --- маркеры --- */
.pin {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 10px;
  color: #150c00;
  background: var(--grad);
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 3px rgba(255, 176, 32, 0.12), 0 4px 14px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s;
  /* без fill-mode: если анимация не проиграет (реюз рендера, «уменьшение движения»),
     маркер остаётся видимым, а не залипает в scale(0) */
  animation: pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pin::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid rgba(255, 176, 32, 0.45);
  animation: halo 2.6s ease-out infinite;
}
.pin:hover { transform: scale(1.15); }

@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes halo {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(2.1); opacity: 0; }
}

/* --- попап --- */
.leaflet-popup-content-wrapper {
  background: var(--glass);
  backdrop-filter: blur(24px);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.leaflet-popup-tip { background: var(--glass); border: 1px solid var(--line); }
.leaflet-popup-content { margin: 14px 16px; font-size: 13.5px; line-height: 1.5; }
.leaflet-popup-content .t { font-weight: 700; font-size: 15px; letter-spacing: -0.02em; }
.leaflet-popup-content .d {
  display: inline-block;
  margin: 7px 0;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--amber);
  background: rgba(255, 176, 32, 0.12);
  border: 1px solid rgba(255, 176, 32, 0.25);
}
.leaflet-popup-content .a { display: block; font-size: 11px; color: var(--muted); }
.leaflet-popup-close-button { color: var(--muted) !important; }

/* --- зум --- */
.leaflet-control-zoom a {
  background: var(--glass) !important;
  backdrop-filter: blur(20px);
  color: var(--ink) !important;
  border: 1px solid var(--line) !important;
  border-radius: 11px !important;
  margin-top: 6px;
  font-weight: 500;
}
.leaflet-control-zoom a:hover { background: rgba(255, 176, 32, 0.15) !important; }

/* На средних экранах панель уже — иначе она съедает пол-карты */
@media (max-width: 1200px) {
  .hero { width: 320px; padding: 22px; }
  h1 { font-size: 38px; }
}

/* --- мобилка --- */
@media (max-width: 860px) {
  body { overflow: auto; }
  .topbar { top: 10px; gap: 8px; padding: 7px 8px 7px 12px; font-size: 12px; }
  .topbar .pill.ghost { display: none; }
  .hero {
    position: relative;
    inset: auto;
    width: auto;
    margin: 74px 12px 12px;
    border-radius: 22px;
  }
  #map { position: fixed; inset: 0; }
  h1 { font-size: 36px; }
}
