:root {
  --bg: #07140f;
  --bg-2: #0c1f18;
  --panel: rgba(214, 240, 224, 0.06);
  --panel-strong: rgba(214, 240, 224, 0.1);
  --text: #f3faf5;
  --muted: #9fb7aa;
  --line: rgba(180, 220, 196, 0.16);
  --accent: #7dffa3;
  --accent-2: #c8f56a;
  --warn: #ffd27a;
  --map-land: #163528;
  --map-stroke: rgba(196, 230, 208, 0.28);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
  --radius: 20px;
  --max: 1120px;
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 12% 0%, rgba(125, 255, 163, 0.16), transparent 34%),
    radial-gradient(circle at 88% 8%, rgba(200, 245, 106, 0.12), transparent 28%),
    linear-gradient(180deg, #08160f 0%, #0a1c14 48%, #07140f 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 78%);
}

a { color: inherit; text-decoration: none; }

.wrap {
  width: min(var(--max), 100%);
  margin: 0 auto;
  padding: 18px 16px 40px;
}

.topbar {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.nav-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.back-link,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.back-link:hover,
.pill:hover { color: var(--text); background: var(--panel-strong); }

.brand-block h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.brand-block .kicker {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.lead {
  margin: 10px 0 0;
  max-width: 54ch;
  color: var(--muted);
  line-height: 1.55;
  font-size: 1.02rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  padding: 14px 14px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(125, 255, 163, 0.08), rgba(255, 255, 255, 0.02));
  animation: rise-in 0.55s ease both;
}

.stat:nth-child(2) { animation-delay: 0.06s; }
.stat:nth-child(3) { animation-delay: 0.12s; }
.stat:nth-child(4) { animation-delay: 0.18s; }

@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}

.stat span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.sidebar,
.map-shell,
.detail,
.rank-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 20, 15, 0.72);
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 14px;
  display: grid;
  gap: 14px;
  position: sticky;
  top: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

select,
input[type="search"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b1a14;
  color: var(--text);
  padding: 0 12px;
  font: inherit;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 650;
  text-transform: none;
  letter-spacing: 0;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.map-shell {
  overflow: hidden;
  min-height: 560px;
  position: relative;
  animation: map-in 0.7s ease both;
}

@keyframes map-in {
  from { opacity: 0; transform: scale(0.985); }
  to { opacity: 1; transform: none; }
}

#map {
  width: 100%;
  height: min(72vh, 680px);
  min-height: 520px;
  background:
    radial-gradient(circle at 50% 40%, rgba(125, 255, 163, 0.08), transparent 42%),
    #08160f;
}

.map-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 500;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7, 20, 15, 0.88);
  backdrop-filter: blur(10px);
  color: var(--muted);
  font-size: 0.78rem;
}

.legend-bar {
  width: 140px;
  height: 10px;
  margin: 6px 0 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #163528, #2f7a4d, #7dffa3);
}

.detail {
  margin-top: 14px;
  padding: 16px;
}

.detail h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: -0.03em;
}

.detail .sub {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.player-list,
.team-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.player-list li,
.team-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.player-list .meta,
.team-list .meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.rank-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 14px;
  margin-top: 14px;
}

.rank-panel {
  padding: 16px;
}

.rank-panel h3 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.bar-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2f7a4d, var(--accent));
  transform-origin: left center;
  animation: bar-grow 0.45s ease both;
}

@keyframes bar-grow {
  from { transform: scaleX(0.15); opacity: 0.4; }
  to { transform: scaleX(1); opacity: 1; }
}

.bar-row span:last-child {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 3ch;
  text-align: right;
}

.disclaimer {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.leaflet-container {
  background: transparent;
  font: inherit;
}

.leaflet-control-attribution {
  background: rgba(7, 20, 15, 0.75) !important;
  color: var(--muted) !important;
  font-size: 10px !important;
}

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

.country-tooltip {
  background: rgba(7, 20, 15, 0.92);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  box-shadow: none;
  padding: 6px 8px;
}

.country-tooltip::before { display: none; }

@media (max-width: 920px) {
  .layout,
  .rank-grid,
  .stats {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  #map,
  .map-shell {
    min-height: 420px;
  }

  .bar-row {
    grid-template-columns: 90px 1fr auto;
  }
}
