/* Świat w liczbach – style strony. Style samych map: assets/world-map/src/maps.css
   Jasny „papier” i ciemny motyw (według ustawień systemu). Kolory danych (skale mapy) są w assets/js/util.js –
   strona używa ich tylko na mapie, w legendzie i w znacznikach obok liczb; tekst ma zawsze kolory tekstu. */

:root {
  color-scheme: light;
  --bg: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f3f2ef;
  --surface-3: #e9e8e3;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6b6964;           /* tekst drugorzędny (≥ 4,5:1 na tle) */
  --axis: #898781;            /* podpisy osi, kreski */
  --line: #e1e0d9;
  --line-2: #c3c2b7;
  --accent: #2a78d6;          /* znaczniki, przyciski, kraj na wykresie */
  --accent-ink: #ffffff;
  --danger: #b3261e;            /* błędy formularza */
  --link: #1c5cab;
  --ocean: #f1f0ec;
  --nodata: #e6e5df;
  --nodata-line: #cfcec6;
  --focus-fill: #2a78d6;
  --world-line: #898781;
  /* Kraje porównywane na wykresie (kolejne kolory kategoryczne po niebieskim kraju wybranym) */
  --cmp-1: #eb6834;
  --cmp-2: #1baf7a;
  --cmp-3: #eda100;
  --cmp-4: #8a5cd6;
  --cmp-5: #d4458f;
  --cmp-6: #0f9fb5;
  --cmp-7: #8c6239;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(11, 11, 11, .06), 0 8px 24px -12px rgba(11, 11, 11, .18);
  --header-h: 56px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #222221;
    --surface-3: #2c2c2a;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #a3a197;
    --axis: #898781;
    --line: #2c2c2a;
    --line-2: #383835;
    --accent: #3987e5;
    --accent-ink: #ffffff;
    --danger: #ef8a7d;
    --link: #86b6ef;
    --ocean: #131312;
    --nodata: #262625;
    --nodata-line: #34342f;
    --focus-fill: #3987e5;
    --world-line: #898781;
    --cmp-1: #d95926;
    --cmp-2: #199e70;
    --cmp-3: #c98500;
    --cmp-4: #9b74e3;
    --cmp-5: #dc5a9c;
    --cmp-6: #23a9be;
    --cmp-7: #a77b4f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -14px rgba(0, 0, 0, .8);
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #222221;
  --surface-3: #2c2c2a;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --muted: #a3a197;
  --axis: #898781;
  --line: #2c2c2a;
  --line-2: #383835;
  --accent: #3987e5;
  --accent-ink: #ffffff;
  --danger: #ef8a7d;
  --link: #86b6ef;
  --ocean: #131312;
  --nodata: #262625;
  --nodata-line: #34342f;
  --focus-fill: #3987e5;
  --world-line: #898781;
  --cmp-1: #d95926;
  --cmp-2: #199e70;
  --cmp-3: #c98500;
  --cmp-4: #9b74e3;
  --cmp-5: #dc5a9c;
  --cmp-6: #23a9be;
  --cmp-7: #a77b4f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -14px rgba(0, 0, 0, .8);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
h1, h2, h3 { font-weight: 650; line-height: 1.15; letter-spacing: -.01em; margin: 0 0 .5em; color: var(--ink); }
h1 { font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.5rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
code { font-size: .9em; padding: .1em .35em; border-radius: 5px; background: var(--surface-3); }

.lead { font-size: 1.05rem; color: var(--ink-2); }
.kicker { display: flex; align-items: center; gap: .4em; margin: 0 0 .35rem; font-size: .74rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.kicker svg { width: 16px; height: 16px; flex: none; color: var(--ink-2); }

.button {
  display: inline-flex; align-items: center; gap: .4em;
  padding: .6em 1.05em; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); text-decoration: none; font-weight: 600; font-size: .9rem;
  transition: filter .15s;
}
.button:hover { color: var(--accent-ink); filter: brightness(1.1); }

/* ---------- Nagłówek i menu ---------- */

.site-header {
  position: sticky; top: 0; z-index: 20;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(16px, 3vw, 32px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.08rem; letter-spacing: -.01em; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 28px; height: 28px; color: var(--accent); }

.site-nav ul { list-style: none; display: flex; align-items: center; gap: 1.4rem; margin: 0; padding: 0; }
.site-nav a { color: var(--muted); text-decoration: none; font-size: .88rem; font-weight: 500; }
.site-nav a:hover, .site-nav a[aria-current='page'] { color: var(--ink); }
.site-nav a[aria-current='page'] { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 7px; }
.nav-toggle { display: none; }

/* Inne mapy z serii – lista rozwijana w dół (app/other-maps.php) */
.more-menu { position: relative; }
.more-menu summary { display: inline-flex; align-items: center; gap: .25rem; list-style: none; cursor: pointer; color: var(--muted); font-size: .88rem; font-weight: 500; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-menu summary svg { width: 12px; height: 12px; transition: transform .15s; }
.more-menu[open] summary svg { transform: rotate(180deg); }
.more-menu summary:hover, .more-menu[open] summary { color: var(--ink); }
.site-nav .more-list {
  position: absolute; right: 0; top: calc(100% + 12px); z-index: 30; display: flex; flex-direction: column; align-items: stretch; gap: 2px;
  min-width: 240px; padding: 6px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow);
}
.site-nav .more-list a { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .45rem .65rem; border-radius: 8px; color: var(--ink-2); white-space: nowrap; }
.site-nav .more-list a:hover { background: var(--surface-2); color: var(--ink); }
/* Ostatnia pozycja: strona główna serii Ominuvo, oddzielona linią */
.site-nav .more-list .more-home { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.more-lang { padding: 0 .3em; border: 1px solid var(--line-2); border-radius: 4px; font-size: .66rem; font-weight: 600; letter-spacing: .04em; color: var(--muted); }
.site-nav { margin-left: auto; }

/* Przełącznik języków: przycisk z kodem języka, lista nazw w dwóch kolumnach. */
/* Przełącznik motywu: słońce / auto / księżyc */
/* Przełącznik motywu: moduł theme (assets/theme/theme.css) – wygląd jak dotąd, bez zmiennych --theme-switch-* */
.lang-menu { position: relative; margin-left: 1.2rem; }
.lang-menu summary {
  display: flex; align-items: center; gap: .35rem; padding: .3em .7em; list-style: none; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: 999px; color: var(--ink-2); font-size: .76rem; font-weight: 600; letter-spacing: .04em;
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary svg { width: 16px; height: 16px; }
.lang-menu summary:hover, .lang-menu[open] summary { color: var(--ink); border-color: var(--axis); }
.lang-switch {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px;
  min-width: 300px; max-height: 70vh; overflow: auto; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow);
}
.lang-switch a { display: block; padding: .4rem .6rem; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: .88rem; white-space: nowrap; }
.lang-switch a:hover { background: var(--surface-2); color: var(--ink); }
.lang-switch a[aria-current] { background: var(--surface-3); color: var(--ink); font-weight: 600; }

@media (max-width: 640px) {
  .brand span { font-size: .98rem; }
  .lang-menu { margin-left: .6rem; }
  .lang-switch { min-width: 260px; }
  .nav-toggle {
    display: grid; place-items: center; width: 38px; height: 38px; padding: 0;
    border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--ink-2); cursor: pointer;
  }
  .nav-toggle svg { width: 20px; height: 20px; }
  .site-nav { position: relative; }
  .site-nav ul {
    display: none; position: absolute; right: 0; top: calc(100% + 8px); min-width: 180px;
    flex-direction: column; gap: 0; padding: 6px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow);
  }
  .site-nav.is-open ul { display: flex; }
  .site-nav ul a { display: block; padding: .55rem .75rem; font-size: .95rem; border-radius: 8px; }
  .site-nav ul a:hover { background: var(--surface-2); }
  .site-nav ul { align-items: stretch; }
  /* W menu na telefonie lista innych map rozwija się w miejscu. */
  .more-menu summary { display: flex; padding: .55rem .75rem; font-size: .95rem; }
  .site-nav .more-list { position: static; min-width: 0; padding: 0 0 4px .6rem; background: none; border: 0; box-shadow: none; }
}

.site-footer { padding: 24px clamp(16px, 3vw, 32px) 32px; border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted); text-align: center; }
.site-footer p { margin: 0; }
.site-footer a { color: var(--ink-2); }
.site-footer p + p { margin-top: .45rem; }
/* Ikonki kanałów marki w stopce (Series::socialLinks, moduł series): kolor tekstu stopki, przy najechaniu i fokusie jaśniej */
.series-social-link { transition: opacity .15s; }
.series-social-link:hover, .series-social-link:focus-visible { opacity: .7; }
.page-explorer .site-footer { padding-block: 14px 18px; }

/* ---------- Mapa ---------- */

.world-map {
  --wm-ocean: var(--ocean);
  --wm-sphere-stroke: var(--line);
  --wm-land: url(#nodata);
  --wm-land-hover: url(#nodata);
  --wm-land-inactive: url(#nodata);
  --wm-dot: url(#nodata);
  --wm-dot-stroke: var(--axis);
  --wm-border: var(--surface);
  --wm-border-width: .6px;
  --wm-hover-outline: var(--ink);
  --wm-selected-outline: var(--ink);
  --wm-disputed-stroke: var(--axis);
  --wm-tooltip-bg: var(--surface);
  --wm-tooltip-fg: var(--ink);
  --wm-control-bg: var(--surface);
  --wm-control-fg: var(--ink);
  --wm-control-border: var(--line-2);
  --wm-font: var(--font);
}
/* Wybrany kraj zostaje w kolorze swojej klasy – zaznacza go obrys. */
.world-map .wm-country.wm-selected,
.world-map .wm-dot.wm-selected { fill: var(--wm-fill, var(--wm-land)); }
.world-map .wm-country.wm-hover[data-fill] { filter: none; }
.world-map .wm-hl-hover { stroke-width: 1.4px; }
.world-map .wm-hl-selected { stroke-width: 2.2px; }
/* Filtr grupy krajów: kraje spoza grupy przygaszone */
.world-map .wm-country.is-out, .world-map .wm-dot.is-out { opacity: .22; }
.world-map .wm-country.is-hot { stroke: var(--ink); stroke-width: 1.6px; }
.world-map .wm-tooltip { border: 1px solid var(--line-2); box-shadow: var(--shadow); padding: 7px 10px; }
.tip strong { display: block; font-size: .86rem; }
.tip span { display: block; font-size: 1rem; font-weight: 600; }
.tip small { display: block; font-size: .76rem; color: var(--muted); }
.is-loading .world-map { opacity: .6; transition: opacity .2s; }

/* ---------- Eksplorator: mapa, panel, oś lat ---------- */

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: 'map panel' 'year panel';
  gap: 14px 18px;
  padding: 14px clamp(16px, 2vw, 28px) 16px;
  height: calc(100dvh - var(--header-h));
  min-height: 620px;
}
.map-area { grid-area: map; position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.map-area .world-map { flex: 1; min-height: 0; border-radius: var(--radius); overflow: hidden; background: var(--surface); border: 1px solid var(--line); }

/* Legenda na mapie, w lewym dolnym rogu */
.map-export-wrap { position: absolute; z-index: 6; left: 12px; top: 12px; }
/* Przycisk „Osadź” (moduł embed-php) obok PNG */
.map-embed-wrap { position: absolute; z-index: 6; left: 98px; top: 12px; }
.map-embed-wrap .oe-embed-box { color: var(--ink); background: var(--surface, var(--bg)); }
.map-export {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35em .7em; border-radius: var(--radius-sm); cursor: pointer;
  font: 600 .74rem/1.2 var(--font); color: var(--ink-2); background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow);
}
.map-export:hover { color: var(--ink); border-color: var(--axis); }
.map-export:disabled { opacity: .6; cursor: progress; }
.map-export svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.map-export .caret { width: 12px; height: 12px; margin-left: -.1rem; transition: transform .15s; }
.map-export[aria-expanded="true"] .caret { transform: rotate(180deg); }
/* Menu formatów obrazka (sama mapa, z rankingiem…): moduł export (assets/export/export.css) */
.legend {
  position: absolute; z-index: 4; left: 12px; bottom: 12px; width: min(340px, calc(100% - 24px));
  padding: 9px 12px 8px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--line); box-shadow: var(--shadow);
  font-size: .74rem; color: var(--ink-2);
}
.lg-title { margin: 0 0 5px; font-weight: 600; color: var(--ink); }
.lg-bar { display: flex; gap: 2px; height: 10px; }
.lg-bar span { flex: 1; border-radius: 2px; }
.lg-ticks { position: relative; height: 16px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.lg-ticks span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.lg-nodata { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; }
.lg-nodata svg { width: 14px; height: 10px; border-radius: 2px; }

.panel {
  grid-area: panel; min-height: 0; overflow: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.picker { display: block; margin-bottom: 1rem; }
.picker-label { display: block; margin-bottom: .3rem; font-size: .74rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.picker select {
  width: 100%; padding: .6em 2.2em .6em .8em; font: inherit; font-size: .95rem; font-weight: 600; color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); background-color: var(--surface-2);
  appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.picker select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.ind-head h1 { font-size: 1.6rem; margin-bottom: .45rem; }
.ind-unit { font-size: .95rem; font-weight: 500; color: var(--muted); letter-spacing: 0; white-space: nowrap; }
.ind-desc { font-size: .9rem; color: var(--ink-2); margin-bottom: .6rem; }
.ind-summary { font-size: .9rem; color: var(--ink); margin-bottom: .6rem; }
.ind-summary:empty { display: none; }
.ind-source { font-size: .78rem; color: var(--muted); margin-bottom: 0; }
.ind-source a { color: var(--ink-2); }
.ind-note { display: inline-block; margin-top: .3rem; }

.panel-body { margin-top: 1rem; }
.list-head { display: flex; justify-content: space-between; align-items: baseline; font-size: .76rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 .5rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.list-head > span:last-child { letter-spacing: 0; text-transform: none; font-weight: 500; }
.list-empty { font-size: .9rem; color: var(--muted); }
/* Nad rankingiem: kierunek, grupa krajów i uzupełnianie braków */
.list-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem; margin: 0 0 .5rem; font-size: .8rem; }
.order-toggle {
  padding: .3em .75em; border-radius: 999px; cursor: pointer; white-space: nowrap;
  font: 500 .78rem/1.2 var(--font); color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-2);
}
.order-toggle:hover { color: var(--ink); border-color: var(--axis); }
.group-select {
  max-width: 13rem; padding: .3em .6em; border-radius: 999px; cursor: pointer;
  font: 500 .78rem/1.2 var(--font); color: var(--ink-2); background-color: var(--surface-2); border: 1px solid var(--line-2);
}
.group-select:hover { color: var(--ink); border-color: var(--axis); }
.fill-toggle { display: inline-flex; align-items: center; gap: .35rem; color: var(--ink-2); cursor: pointer; }
.fill-toggle[hidden] { display: none; }
.fill-toggle input { margin: 0; accent-color: var(--accent); }
.search input {
  width: 100%; margin-bottom: .5rem; padding: .55em .9em; font: inherit; font-size: .9rem; color: var(--ink);
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface-2);
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }

.rank-list { list-style: none; margin: 0 -8px; padding: 0; }
.rank-list a, .rank-list button {
  display: grid; grid-template-columns: 30px 12px minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%;
  padding: 5px 8px; border: 0; border-radius: 6px; background: none; color: inherit; font: inherit; font-size: .88rem; text-align: left; text-decoration: none; cursor: pointer;
}
/* Lista z serwera (bez JS) nie ma znaczników koloru. */
.rank-list a:not(:has(.sw)) { grid-template-columns: 30px minmax(0, 1fr) auto; }
.rank-list a:hover, .rank-list button:hover, .rank-list button:focus-visible { background: var(--surface-2); }
.rk { font-size: .76rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.sw { width: 12px; height: 12px; border-radius: 3px; }
.rk-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-val { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.rk-val small { font-weight: 400; color: var(--muted); }

/* Karta kraju */
.cc { position: relative; padding-top: .9rem; border-top: 1px solid var(--line); }
.cc h2 { font-size: 1.45rem; margin-bottom: .3rem; padding-right: 2rem; }
.cc h2 a { color: inherit; text-decoration: none; }
.cc h2 a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.cc-close {
  position: absolute; top: 2px; right: -8px; width: 36px; height: 36px;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.cc-close:hover { background: var(--surface-2); color: var(--ink); }
.cc-value { margin: 0; color: var(--ink-2); }
.cc-value strong { font-size: 2.1rem; font-weight: 650; color: var(--ink); letter-spacing: -.01em; }
.cc-value span { margin-left: .3em; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cc-change { margin: 0 0 .2rem; font-size: .95rem; font-weight: 600; color: var(--ink); }
.cc-rank { font-size: .88rem; color: var(--ink-2); margin-bottom: .8rem; }
.cc-none { color: var(--muted); font-size: .92rem; }
.cc-chart { margin: 0 0 1.1rem; }

/* Wykres liniowy */
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid line { stroke: var(--line); stroke-width: 1; }
.chart-grid text, .chart-axis text { fill: var(--axis); font-size: 10px; font-variant-numeric: tabular-nums; }
.chart-axis line { stroke: var(--line-2); }
.chart-year { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 2 3; }
.chart-hover { stroke: var(--axis); stroke-width: 1; }
.chart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ln.is-main { stroke: var(--accent); }
.chart .ln.is-world { stroke: var(--world-line); stroke-dasharray: 5 4; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .dot.is-main { fill: var(--accent); }
.chart .dot.is-world { fill: var(--world-line); }
.chart .ln.is-cmp-1 { stroke: var(--cmp-1); }
.chart .ln.is-cmp-2 { stroke: var(--cmp-2); }
.chart .ln.is-cmp-3 { stroke: var(--cmp-3); }
.chart .ln.is-cmp-4 { stroke: var(--cmp-4); }
.chart .ln.is-cmp-5 { stroke: var(--cmp-5); }
.chart .ln.is-cmp-6 { stroke: var(--cmp-6); }
.chart .ln.is-cmp-7 { stroke: var(--cmp-7); }
.chart .dot.is-cmp-1 { fill: var(--cmp-1); }
.chart .dot.is-cmp-2 { fill: var(--cmp-2); }
.chart .dot.is-cmp-3 { fill: var(--cmp-3); }
.chart .dot.is-cmp-4 { fill: var(--cmp-4); }
.chart .dot.is-cmp-5 { fill: var(--cmp-5); }
.chart .dot.is-cmp-6 { fill: var(--cmp-6); }
.chart .dot.is-cmp-7 { fill: var(--cmp-7); }
.chart [hidden] { display: none; }
.chart-hit { fill: transparent; cursor: crosshair; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; margin: 0 0 6px; font-size: .78rem; color: var(--ink-2); }
.chart-legend .key { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .key i { display: inline-block; width: 16px; border-top: 2px solid var(--accent); }
.chart-legend .key.is-world i { border-top: 2px dashed var(--world-line); }
.chart-legend .key.is-cmp-1 i, .cmp-chip.is-cmp-1 i { border-top-color: var(--cmp-1); }
.chart-legend .key.is-cmp-2 i, .cmp-chip.is-cmp-2 i { border-top-color: var(--cmp-2); }
.chart-legend .key.is-cmp-3 i, .cmp-chip.is-cmp-3 i { border-top-color: var(--cmp-3); }
.chart-legend .key.is-cmp-4 i, .cmp-chip.is-cmp-4 i { border-top-color: var(--cmp-4); }
.chart-legend .key.is-cmp-5 i, .cmp-chip.is-cmp-5 i { border-top-color: var(--cmp-5); }
.chart-legend .key.is-cmp-6 i, .cmp-chip.is-cmp-6 i { border-top-color: var(--cmp-6); }
.chart-legend .key.is-cmp-7 i, .cmp-chip.is-cmp-7 i { border-top-color: var(--cmp-7); }

/* Porównanie krajów w karcie: kraje na wykresie (z usuwaniem) i lista do dodania */
.cc-compare { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -.4rem 0 1.1rem; }
.cmp-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .15em .2em .15em .65em; border: 1px solid var(--line-2); border-radius: 999px; font-size: .8rem; color: var(--ink-2); }
.cmp-chip i { display: inline-block; width: 14px; border-top: 2px solid; }
.cmp-chip button { padding: 0 .35em; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 1rem; line-height: 1.2; cursor: pointer; }
.cmp-chip button:hover { background: var(--surface-2); color: var(--ink); }
/* Porównanie jako PNG – przycisk z menu formatów w karcie kraju */
.cc-export { position: relative; margin: 0 0 1rem; }
.cc-export .map-export { font-size: .78rem; }

.cmp-add select {
  max-width: 210px; padding: .3em .7em; font: inherit; font-size: .8rem; color: var(--ink);
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface-2); cursor: pointer;
}
.chart-readout { flex-basis: 100%; min-height: 1.3em; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-readout span { font-weight: 600; color: var(--ink-2); }
.chart-readout b { font-weight: 600; color: var(--ink); }
.chart-empty { font-size: .88rem; color: var(--muted); }

/* Oś lat */
.yearbar { grid-area: year; min-width: 0; }
.yb {
  padding: 10px 16px 4px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  user-select: none; -webkit-user-select: none;
}
.yb-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.yb-play {
  display: grid; place-items: center; width: 38px; height: 38px; flex: none; padding: 0; cursor: pointer;
  border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink); transition: filter .15s;
}
.yb-play:hover { filter: brightness(1.1); }
.yb-play svg { width: 17px; height: 17px; fill: currentColor; }
.yb-icon-pause, .is-playing .yb-icon-play { display: none; }
.is-playing .yb-icon-pause { display: inline; }
.yb-speed {
  min-width: 44px; padding: .35em .7em; border-radius: 999px; cursor: pointer;
  font: 500 .78rem/1.2 var(--font); color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-2); font-variant-numeric: tabular-nums;
}
.yb-speed:hover { color: var(--ink); border-color: var(--axis); }
.yb-loop {
  display: grid; place-items: center; width: 30px; height: 28px; padding: 0; border-radius: 999px; cursor: pointer;
  color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-2);
}
.yb-loop svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.yb-loop:hover { color: var(--ink); border-color: var(--axis); }
.yb-loop[aria-pressed='true'] { color: var(--accent); border-color: var(--accent); }
.yb-readout { margin: 0 0 0 6px; display: flex; align-items: baseline; gap: .6rem; }
/* Wartość / zmiana od roku – po prawej stronie nagłówka osi lat */
.yb-mode { display: flex; align-items: center; gap: 0; margin-left: auto; }
.yb-mode button {
  padding: .35em .8em; cursor: pointer; font: 500 .78rem/1.2 var(--font); color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line-2);
}
.yb-mode button:first-child { border-radius: 999px 0 0 999px; }
.yb-mode button:nth-child(2) { border-radius: 0 999px 999px 0; margin-left: -1px; }
.yb-mode button[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.yb-mode select {
  margin-left: 6px; padding: .3em .5em; font: inherit; font-size: .8rem; color: var(--ink);
  border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); cursor: pointer;
}
.yb-mode select[hidden] { display: none; }
.yb-year { font-size: 1.55rem; font-weight: 650; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.yb-info { font-size: .82rem; color: var(--muted); }

.yb-track { position: relative; height: 40px; cursor: pointer; touch-action: none; }
.yb-bars { position: absolute; inset: 0; }
.yb-bars span { position: absolute; bottom: 0; border-left: 1px solid var(--surface); border-right: 1px solid var(--surface); background: var(--surface-3); border-radius: 2px 2px 0 0; }
.yb-bars span.is-on { background: var(--accent); }
/* Rok bazowy mapy zmian */
.yb-bars span.is-base { background: var(--ink-2); }
.yb-track::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--line-2); }
.yb-handle {
  position: absolute; top: -4px; bottom: -2px; width: 2px; margin-left: -1px; z-index: 1;
  background: var(--ink); cursor: ew-resize;
}
.yb-handle::before {
  content: ''; position: absolute; left: 50%; top: -5px; width: 14px; height: 14px; margin-left: -7px;
  border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 3px var(--surface);
}
.yb-handle::after { content: ''; position: absolute; inset: 0 -12px; }  /* większy obszar chwytania */
.yb-handle:focus-visible { outline: none; }
.yb-handle:focus-visible::before { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }
.yb-axis { position: relative; height: 20px; margin-top: 3px; font-size: .7rem; color: var(--axis); font-variant-numeric: tabular-nums; }
.yb-axis span { position: absolute; top: 2px; transform: translateX(-50%); }

@media (max-width: 900px) {
  .yb-head { flex-wrap: wrap; }
  .yb-mode { margin-left: 0; flex-basis: 100%; margin-bottom: 12px; }
  .stage {
    grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: 'map' 'year' 'panel';
    height: auto; min-height: 0; padding-top: 10px;
  }
  .map-area .world-map { flex: none; height: min(56vh, 70vw); min-height: 240px; }
  .legend { position: static; width: auto; margin-top: 8px; box-shadow: none; background: var(--surface); }
  .panel { overflow: visible; scroll-margin-top: calc(var(--header-h) + 12px); }
}

/* ---------- Podstrony ---------- */

.page { max-width: 1200px; margin: 0 auto; padding: 20px clamp(16px, 3vw, 32px) 56px; }
.crumbs { display: flex; flex-wrap: wrap; gap: .5rem; font-size: .84rem; color: var(--muted); margin-bottom: 1.25rem; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs [aria-current] { color: var(--ink-2); }
.page-head { max-width: 760px; margin-bottom: 2rem; }

/* Kraj */
.country-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 36px; align-items: start; margin-bottom: 28px; }
.country-hero h1 { margin-bottom: 1rem; }
.facts { display: grid; gap: .45rem; margin: 0 0 1.2rem; }
.facts div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: baseline; }
.facts dt { font-size: .76rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 0; }
.country-hero .lead { font-size: .98rem; }
.country-map { margin: 0; }
.country-map .world-map { height: clamp(220px, 28vw, 340px); border-radius: var(--radius); overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.country-map .world-map { --wm-land: var(--nodata); --wm-land-inactive: var(--nodata); }

/* Kafelki z najważniejszymi liczbami */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 0 0 2.6rem; }
.tiles div { display: flex; flex-direction: column; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.tiles dt { order: 1; font-size: .8rem; color: var(--ink-2); }
.tiles dd { order: 2; margin: .1rem 0 0; font-size: 1.6rem; font-weight: 650; letter-spacing: -.01em; }
.tiles dd small { font-size: .85rem; font-weight: 500; color: var(--ink-2); letter-spacing: 0; }
.tiles dd.tile-meta { order: 3; font-size: .78rem; font-weight: 400; letter-spacing: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.tiles-wide { max-width: 560px; }

.ind-section { margin-bottom: 2.6rem; }
.ind-section h2, .cat-section h2 { display: flex; align-items: center; gap: .5rem; }
.ind-section h2 svg, .cat-icon { width: 22px; height: 22px; flex: none; color: var(--ink-2); }
.cat-section h2 span { font-size: .9rem; font-weight: 400; color: var(--muted); }
.ind-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.ind-card {
  display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 14px 16px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  color: inherit; text-decoration: none; transition: border-color .15s, transform .15s;
}
.ind-card:hover { color: inherit; border-color: var(--line-2); transform: translateY(-1px); box-shadow: var(--shadow); }
.ic-name { font-size: .9rem; font-weight: 600; color: var(--ink); }
.ic-value { color: var(--ink-2); font-size: .85rem; }
.ic-value strong { font-size: 1.35rem; font-weight: 650; color: var(--ink); }
.ic-value em { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; margin-left: .2em; }
.ic-rank { font-size: .78rem; color: var(--muted); }
.ic-desc { flex: 1; font-size: .85rem; color: var(--ink-2); }
.ic-meta { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.spark { margin-top: auto; padding-top: 6px; width: 100%; max-width: 160px; height: auto; overflow: visible; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark circle { fill: var(--accent); stroke: var(--surface); stroke-width: 1.5; }

/* Katalog */
.cat-section { margin-bottom: 2.6rem; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { display: inline-flex; padding: .3em .8em; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-2); color: var(--ink); text-decoration: none; font-size: .86rem; }
.chips a:hover { border-color: var(--accent); }

/* Strony tekstowe */
.prose-page { max-width: 760px; }
.prose-page h2 { margin-top: 2.2rem; }
.prose-page li { margin-bottom: .45rem; color: var(--ink-2); }
.prose-page p { color: var(--ink-2); }
.prose-page .lead { color: var(--ink-2); }
.error-page { text-align: center; padding-top: 12vh; }

@media (max-width: 900px) {
  .country-hero { grid-template-columns: 1fr; gap: 20px; }
  .country-map { order: -1; }
  .facts div { grid-template-columns: 120px 1fr; }
}

/* --- Wykres punktowy dwóch wskaźników (/compare) --- */
.scatter-page .page-head { margin-bottom: 1.2rem; }
.sc-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin-bottom: 14px; }
.sc-controls .picker { flex: 1 1 260px; margin: 0; }
.sc-controls .sc-group { flex: 0 1 220px; }
.sc-swap {
  width: 40px; height: 40px; margin-bottom: 2px; flex: none; cursor: pointer; border-radius: 50%;
  font-size: 1.1rem; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-2);
}
.sc-swap:hover { color: var(--ink); border-color: var(--axis); }
.sc-card { position: relative; padding: 12px 16px 10px; margin-bottom: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.sc-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin-bottom: 6px; font-size: .8rem; color: var(--ink-2); }
.sc-opts label { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; }
.sc-opts input { margin: 0; accent-color: var(--accent); }
.sc-opts label:has(input:disabled) { opacity: .5; cursor: default; }
.sc-size { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; color: var(--muted); }
.sc-size i { display: inline-block; border-radius: 50%; background: var(--accent); opacity: .8; }
.sc-size i:first-child { width: 7px; height: 7px; }
.sc-size i:nth-child(2) { width: 13px; height: 13px; margin-right: 3px; }
.sc-plot { min-height: 320px; }
.sc-svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.sc-svg .sc-vgrid { stroke: var(--line); stroke-dasharray: 2 3; }
.sc-axis-title { fill: var(--ink-2); font-size: 12px; font-weight: 600; }
.sc-year { fill: var(--line-2); font-size: 56px; font-weight: 700; font-variant-numeric: tabular-nums; pointer-events: none; }
.sc-pt { fill: var(--accent); fill-opacity: .78; stroke: var(--surface); stroke-width: 1.5px; cursor: pointer; }
.sc-pt.is-out { fill: var(--axis); fill-opacity: .22; stroke-opacity: .5; }
.sc-pt.is-hover { stroke: var(--ink); stroke-width: 1.5px; fill-opacity: 1; }
.sc-pt.is-sel { fill: var(--cmp-1); fill-opacity: 1; stroke: var(--ink); stroke-width: 2px; }
.sc-trail { fill: none; stroke: var(--cmp-1); stroke-width: 1.5px; stroke-opacity: .8; }
.sc-trail-dot { fill: var(--cmp-1); }
.sc-label { fill: var(--ink-2); font-size: 11px; font-weight: 500; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.sc-label.is-sel { fill: var(--ink); font-weight: 700; }
.sc-tip {
  position: absolute; z-index: 5; max-width: 280px; padding: 7px 10px; pointer-events: none;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: var(--shadow); font-size: .8rem; color: var(--ink-2);
}
.sc-tip strong { display: block; font-size: .88rem; color: var(--ink); }
.sc-tip span, .sc-tip small { display: block; }
.sc-tip b { color: var(--ink); font-variant-numeric: tabular-nums; }
.sc-tip small { color: var(--muted); }
.sc-sel { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 6px 0 0; font-size: .85rem; color: var(--ink-2); }
.sc-sel[hidden] { display: none; }
.sc-sel b { color: var(--ink); font-variant-numeric: tabular-nums; }
.sc-sel-key { width: 10px; height: 10px; border-radius: 50%; background: var(--cmp-1); }
.sc-sel-close { margin-left: auto; padding: 0 .4em; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.sc-sel-close:hover { background: var(--surface-2); color: var(--ink); }
.sc-corr { margin: 8px 0 0; font-size: .82rem; color: var(--muted); }
.sc-corr strong { font-weight: 600; color: var(--ink-2); }
.sc-yearbar { margin-bottom: 14px; }
.sc-table summary { cursor: pointer; font-size: .9rem; font-weight: 600; color: var(--ink-2); }
.sc-table-body { overflow-x: auto; margin-top: 8px; }
.sc-table table { width: 100%; border-collapse: collapse; font-size: .85rem; font-variant-numeric: tabular-nums; }
.sc-table caption { text-align: left; padding-bottom: 6px; color: var(--muted); }
.sc-table th, .sc-table td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.sc-table th:first-child { text-align: left; font-weight: 500; }
.sc-table thead th { font-weight: 600; color: var(--muted); }
@media (max-width: 640px) {
  .sc-card { padding: 10px 8px 8px; }
  .sc-size { margin-left: 0; }
  .sc-year { font-size: 40px; }
}

/* ---------- Kontakt ---------- */

.contact-form { display: grid; gap: 1.1rem; margin-top: 1.5rem; }
.contact-form .field { display: grid; gap: .35rem; }
.contact-form label { font-size: .9rem; font-weight: 600; color: var(--ink); }
.contact-form input[type="text"], .contact-form input[type="email"], .contact-form textarea {
  width: 100%; padding: .6em .8em; font: inherit; font-size: .95rem; color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface-2);
}
.contact-form textarea { min-height: 10rem; resize: vertical; }
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.contact-form [aria-invalid="true"] { border-color: var(--danger); }
.contact-form .consent { display: flex; align-items: flex-start; gap: .6rem; font-size: .88rem; font-weight: 400; color: var(--ink-2); line-height: 1.5; }
.contact-form .consent input { flex: none; margin: .25rem 0 0; width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }
.contact-form .field-error, .form-alert-error { color: var(--danger); font-size: .85rem; margin: 0; }
.contact-form .required-note { font-size: .82rem; color: var(--muted); margin: 0; }
.contact-form .button { justify-self: start; border: 0; cursor: pointer; font-family: inherit; font-size: .95rem; }
.contact-form .hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.form-alert { padding: .8rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink); }
.form-alert-error { border-color: var(--danger); font-size: .92rem; }
.form-note { margin-top: 2rem; font-size: .82rem; color: var(--muted); }
.prose-page .form-note { color: var(--muted); }

/* ---------- Quiz (/quiz – moduł quiz z assets) ---------- */

.quiz-stage { margin-bottom: 2rem; }
.quiz-stage .quiz { --quiz-ok: #1e8e5a; --quiz-bad: var(--danger); --quiz-target: #f2a541; }
.quiz-map {
  --wm-ocean: var(--ocean);
  --wm-sphere-stroke: var(--line);
  --wm-land: var(--surface-3);
  --wm-land-hover: var(--surface-3);
  --wm-dot: var(--surface-3);
  --wm-dot-stroke: var(--axis);
  --wm-border: var(--surface);
  --wm-border-width: .6px;
  --wm-control-bg: var(--surface);
  --wm-control-fg: var(--ink);
  --wm-control-border: var(--line-2);
  --wm-font: var(--font);
  position: relative; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden;
}
.quiz-about { max-width: 760px; color: var(--ink-2); }
.quiz-sources { padding-left: 1.1rem; font-size: .9rem; }
.quiz-sources li { margin-bottom: .3rem; }
