:root {
  --bg: #eef4ff;
  --bg-accent: #ffd8ee;
  --panel: rgba(255, 251, 255, 0.88);
  --panel-strong: #fffdf8;
  --text: #1d2b28;
  --muted: #61706b;
  --stroke: rgba(29, 43, 40, 0.12);
  --shadow: 0 18px 40px rgba(77, 79, 140, 0.14);
  --low: #bfe7d3;
  --mid: #5fb3a2;
  --high: #123b5d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: 'Manrope', sans-serif;
  background:
    radial-gradient(circle at 84% 18%, rgba(92, 171, 255, 0.42), transparent 30%),
    radial-gradient(circle at 16% 12%, rgba(255, 132, 196, 0.34), transparent 28%),
    radial-gradient(circle at 32% 72%, rgba(255, 168, 214, 0.18), transparent 26%),
    linear-gradient(100deg, #ffd6ee 0%, #f2e7ff 42%, #dff0ff 100%);
}

.page-shell {
  width: min(1380px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 36px 0 48px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 20px;
  width: 100%;
  padding: 24px 28px;
  border: 1px solid var(--stroke);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}

.hero-copy {
  flex: 1;
  min-width: 0;
}

.eyebrow,
.panel-kicker,
.stat-label,
label,
.legend-title {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
}

h1,
h2 {
  margin: 0;
  font-family: 'Newsreader', serif;
  font-weight: 700;
  line-height: 1;
}

h1 {
  margin-top: 0;
  font-size: clamp(2.5rem, 4.4vw, 4.8rem);
  max-width: 100%;
}

.hero-source {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
}

.hero-note {
  width: 100%;
  max-width: none;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(29, 43, 40, 0.12);
  border-radius: 999px;
  background: rgba(255, 251, 255, 0.72);
  box-shadow: 0 10px 24px rgba(77, 79, 140, 0.1);
  backdrop-filter: blur(10px);
}

.language-option {
  min-width: 46px;
  padding: 8px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.language-option:hover {
  color: var(--text);
}

.language-option.is-active {
  background: linear-gradient(135deg, #e6f3ff, #beddff);
  color: #124a78;
  box-shadow: 0 8px 18px rgba(92, 171, 255, 0.28);
}

h2 {
  font-size: clamp(1.45rem, 2.2vw, 2rem);
}

.stat-card,
.panel,
.controls-panel {
  border: 1px solid var(--stroke);
  background: var(--panel);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.controls-panel {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 24px;
  padding: 18px 22px;
  border-radius: 24px;
}

label {
  display: block;
  margin-bottom: 8px;
}

select {
  min-width: 220px;
  padding: 14px 16px;
  border: 1px solid rgba(29, 43, 40, 0.16);
  border-radius: 14px;
  color: var(--text);
  background: var(--panel-strong);
  font: inherit;
}

.legend-wrap {
  min-width: 280px;
}

.legend-bar {
  height: 14px;
  margin-top: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--low), var(--mid), var(--high));
}

.legend-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.panel {
  padding: 22px;
  border-radius: 28px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.map-panel {
  min-height: 560px;
}

.map-frame {
  height: 470px;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.35)),
    linear-gradient(180deg, rgba(228, 239, 255, 0.82) 0%, rgba(255, 236, 247, 0.72) 100%);
}

svg {
  width: 100%;
  height: 100%;
  display: block;
}

.map-shape {
  stroke: rgba(255, 250, 245, 0.92);
  stroke-width: 1.15;
  transition: fill 180ms ease, transform 180ms ease, opacity 180ms ease;
}

.map-shape:hover {
  stroke: #24342f;
  stroke-width: 1.5;
}

.map-border {
  fill: none;
  stroke: rgba(36, 52, 47, 0.36);
  stroke-width: 1.05;
  pointer-events: none;
}

.composition-border {
  fill: none;
  stroke: rgba(36, 52, 47, 0.2);
  stroke-width: 1;
  stroke-dasharray: 4 5;
  pointer-events: none;
}

.tooltip {
  position: fixed;
  z-index: 20;
  min-width: 180px;
  padding: 10px 12px;
  border: 1px solid rgba(29, 43, 40, 0.12);
  border-radius: 14px;
  background: rgba(27, 34, 33, 0.94);
  color: #f8f5f1;
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.tooltip strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.98rem;
}

.tooltip span {
  display: block;
  font-size: 0.84rem;
  color: rgba(248, 245, 241, 0.75);
}

.ranking-panel {
  min-height: 420px;
}

.ranking-list {
  display: grid;
  gap: 10px;
}

.ranking-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid rgba(29, 43, 40, 0.08);
  border-radius: 18px;
  background: var(--panel-strong);
}

.ranking-index {
  font-weight: 800;
  color: var(--high);
}

.ranking-name {
  font-weight: 700;
}

.ranking-bar {
  grid-column: 2 / 4;
  height: 8px;
  border-radius: 999px;
  background: rgba(125, 47, 29, 0.1);
  overflow: hidden;
}

.ranking-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mid), var(--high));
}

.ranking-value {
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .hero {
    flex-direction: column;
    align-items: stretch;
  }

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

  .map-panel {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 22px;
  }

  .panel,
  .controls-panel,
  .stat-card {
    border-radius: 20px;
  }

  .map-frame {
    height: 390px;
  }

  .panel-head {
    flex-direction: column;
  }

  .language-switch {
    align-self: flex-start;
  }

}
