:root {
  --background: #f5f7f8;
  --surface: rgba(255, 255, 255, 0.95);
  --text: #15232d;
  --muted: #5d6c74;
  --border: #dce3e7;
  --accent: #155f67;
  --positive: #16835b;
  --negative: #b64c45;
  --mixed: #b47a18;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--text);
  background: var(--background);
}

body {
  overflow: hidden;
}

button,
a {
  font: inherit;
}

.site-header {
  position: fixed;
  z-index: 20;
  top: 0;
  right: 0;
  left: 0;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand strong {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.brand span {
  color: var(--muted);
  font-size: 0.78rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav-link {
  padding: 0;
  color: var(--text);
  background: none;
  border: 0;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--accent);
}

#map {
  position: absolute;
  top: 72px;
  right: 0;
  bottom: 0;
  left: 0;
}

.intro-panel,
.country-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 16px 45px rgba(18, 37, 47, 0.14);
  backdrop-filter: blur(12px);
}

.intro-panel {
  position: absolute;
  z-index: 10;
  top: 104px;
  left: 24px;
  width: min(430px, calc(100vw - 48px));
  padding: 24px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 9px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1 {
  max-width: 390px;
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

h2 {
  margin: 0 0 14px;
  font-size: 1.7rem;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

h3 {
  margin: 25px 0 10px;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.intro,
.country-panel p,
.methodology-dialog p {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.6;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 8px 11px;
  color: var(--accent);
  background: #e8f2f2;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 750;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
}

.legend {
  display: grid;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.78rem;
}

.legend-symbol {
  width: 20px;
  font-size: 0.9rem;
  text-align: center;
}

.positive,
.score-positive {
  color: var(--positive);
}

.negative,
.score-negative {
  color: var(--negative);
}

.mixed,
.score-mixed {
  color: var(--mixed);
}

.country-panel {
  position: absolute;
  z-index: 15;
  top: 94px;
  right: 24px;
  bottom: 24px;
  width: min(400px, calc(100vw - 48px));
  padding: 25px;
  overflow-y: auto;
}

.country-panel[hidden] {
  display: none;
}

.close-button {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: #f3f6f7;
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.close-button:hover,
.close-button:focus-visible {
  color: var(--text);
  background: #e8edef;
}

.headline-score {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 15px 0;
}

.headline-score strong {
  font-size: 2.6rem;
  letter-spacing: -0.06em;
}

.headline-score span {
  max-width: 180px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.data-warning {
  padding: 10px 12px;
  background: #fff7e5;
  border: 1px solid #ead7a4;
  border-radius: 9px;
  font-size: 0.76rem !important;
}

.dimension-list {
  border-top: 1px solid var(--border);
}

.dimension-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.88rem;
}

.dimension-row strong {
  font-size: 1rem;
}

.story-list {
  margin: 0;
  padding-left: 1.15rem;
}

.story-list li {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.empty-state {
  font-style: italic;
}

.methodology-dialog {
  position: relative;
  width: min(620px, calc(100vw - 32px));
  padding: 30px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(18, 37, 47, 0.24);
}

.methodology-dialog::backdrop {
  background: rgba(14, 28, 35, 0.46);
  backdrop-filter: blur(3px);
}

.load-error {
  height: 100%;
  display: grid;
  place-content: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
}

.load-error span {
  color: var(--muted);
}

@media (max-width: 850px) {
  .site-header {
    padding: 12px 16px;
  }

  .brand span {
    display: none;
  }

  .site-nav {
    gap: 12px;
  }

  .site-nav .nav-link:last-child {
    display: none;
  }

  .intro-panel {
    top: 92px;
    left: 16px;
    width: calc(100vw - 32px);
    max-width: 390px;
    padding: 19px;
  }

  h1 {
    font-size: 2.25rem;
  }

  .country-panel {
    top: auto;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    max-height: 67vh;
    padding: 22px;
  }
}

@media (max-width: 520px) {
  .intro-panel {
    max-width: none;
  }

  .intro-panel .legend {
    display: none;
  }

  .intro-panel h1 {
    font-size: 1.85rem;
  }

  .intro {
    margin-bottom: 12px;
    font-size: 0.84rem;
  }
}
