/* HeritageMap – style strony. Style samych map: assets/world-map/src/maps.css (tu tylko ich zmienne).
   Jasny motyw „piaskowiec” (kamień, terakota, zieleń parków), ciemny „noc” (grafit, ciepłe światło) – według
   ustawień systemu albo wyboru w przełączniku w nagłówku (<html data-theme>). Kolory rodzajów wpisu: kulturowy – terakota,
   przyrodniczy – zieleń, mieszany – fiolet; zagrożony – czerwony pierścień. */

:root {
  --bg: #f3ede2;
  --bg-2: #e9e0cf;
  --paper: #fbf8f1;
  --paper-2: #fffdf8;
  --ink: #1f1a14;
  --ink-2: #463b2f;
  --muted: #74685a;
  --rule: #d2c5ad;
  --rule-2: #e2d8c4;
  --accent: #8a3a1c;
  --accent-2: #6e2c12;
  --accent-ink: #fff8ef;
  --gold: #a87b1e;
  --danger: #c62828;
  --band: #2a241d;
  --band-ink: #f4ecdd;
  --land: #fbf8f1;
  --land-2: #efe7d8;
  --ocean: #dfe6e6;
  --sphere: #b9c4c2;
  --land-focus: #efdcbc;
  --shadow: 0 1px 2px rgba(50, 38, 20, .12), 0 6px 22px rgba(50, 38, 20, .12);
  --t-cultural: #b4532e;
  --t-natural: #3c8a4b;
  --t-mixed: #6a58b0;
  --font: 'Alegreya', Georgia, 'Times New Roman', serif;
  --display: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --radius: 6px;
  --header-h: 62px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #14171c;
    --bg-2: #1a1e25;
    --paper: #1e232b;
    --paper-2: #242a33;
    --ink: #ece6da;
    --ink-2: #cfc5b4;
    --muted: #978d7e;
    --rule: #39414d;
    --rule-2: #2c333d;
    --accent: #e0a15a;
    --accent-2: #f0ba7a;
    --accent-ink: #1a120a;
    --gold: #e3b45a;
    --danger: #ff6b5e;
    --band: #0c0e12;
    --band-ink: #ebe2d2;
    --land: #2a313b;
    --land-2: #313945;
    --ocean: #11151b;
    --sphere: #222933;
    --land-focus: #5a4d37;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 26px rgba(0, 0, 0, .35);
    --t-cultural: #e8875f;
    --t-natural: #6fc47f;
    --t-mixed: #a594ea;
    color-scheme: dark;
  }
}
/* Ciemny motyw wybrany przełącznikiem w nagłówku (<html data-theme="dark">) – te same zmienne co wyżej. */
:root[data-theme='dark'] {
  --bg: #14171c;
  --bg-2: #1a1e25;
  --paper: #1e232b;
  --paper-2: #242a33;
  --ink: #ece6da;
  --ink-2: #cfc5b4;
  --muted: #978d7e;
  --rule: #39414d;
  --rule-2: #2c333d;
  --accent: #e0a15a;
  --accent-2: #f0ba7a;
  --accent-ink: #1a120a;
  --gold: #e3b45a;
  --danger: #ff6b5e;
  --band: #0c0e12;
  --band-ink: #ebe2d2;
  --land: #2a313b;
  --land-2: #313945;
  --ocean: #11151b;
  --sphere: #222933;
  --land-focus: #5a4d37;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 26px rgba(0, 0, 0, .35);
  --t-cultural: #e8875f;
  --t-natural: #6fc47f;
  --t-mixed: #a594ea;
  color-scheme: dark;
}

/* Kolor rodzaju z bazy (--c, odcienie dobrane do pergaminu) – w ciemnym motywie rozjaśniony. */
* { --cc: var(--c, var(--accent)); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) * { --cc: color-mix(in srgb, var(--c, var(--accent)) 58%, #f3e6c8); }
}
:root[data-theme='dark'] * { --cc: color-mix(in srgb, var(--c, var(--accent)) 58%, #f3e6c8); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(120% 80% at 10% 0%, rgba(255, 250, 235, .55), transparent 60%),
    radial-gradient(90% 70% at 100% 100%, rgba(60, 138, 75, .07), transparent 70%);
  background-attachment: fixed;
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--font);
  min-height: 100vh;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) body {
    background-image:
      radial-gradient(60% 50% at 88% -10%, rgba(240, 225, 180, .08), transparent 70%),
      radial-gradient(90% 60% at 0% 100%, rgba(227, 162, 75, .05), transparent 70%);
  }
}
:root[data-theme='dark'] body {
  background-image:
    radial-gradient(60% 50% at 88% -10%, rgba(240, 225, 180, .08), transparent 70%),
    radial-gradient(90% 60% at 0% 100%, rgba(227, 162, 75, .05), transparent 70%);
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-2); }
img { max-width: 100%; display: block; }
svg { width: 1em; height: 1em; flex: none; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; letter-spacing: .01em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 3.4vw, 2.6rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 1em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.kicker { font: 600 .78rem/1.3 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--cc); margin: 0 0 .5em; display: flex; align-items: center; gap: .45em; }
.lead { font-size: 1.15rem; color: var(--ink-2); }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Przyciski ---------- */

.button {
  display: inline-flex; align-items: center; gap: .5em;
  padding: .55em 1.05em; border-radius: var(--radius); border: 1px solid var(--accent-2);
  background: var(--accent); color: var(--accent-ink); text-decoration: none;
  font: 600 .86rem/1.2 var(--display); letter-spacing: .06em;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18);
}
.button:hover { background: var(--accent-2); color: var(--accent-ink); }
.button-quiet { background: transparent; color: var(--ink); border-color: var(--rule); box-shadow: none; }
.button-quiet:hover { background: var(--paper-2); color: var(--accent); }
.ghost-btn, .icon-btn {
  display: inline-flex; align-items: center; gap: .4em; cursor: pointer;
  padding: .5em .8em; border-radius: var(--radius); border: 1px solid var(--rule);
  background: var(--paper-2); color: var(--ink-2); font: 500 .9rem/1.2 var(--font);
}
.ghost-btn:hover, .icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn { padding: .5em; font-size: 1.15rem; }

/* ---------- Nagłówek z blankami ---------- */

.site-header {
  position: relative; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  height: var(--header-h); padding: 0 clamp(16px, 2.4vw, 32px);
  background: var(--band); color: var(--band-ink);
}
.site-header::after {
  content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 9px;
  background: linear-gradient(90deg, var(--band) 0 55%, transparent 55% 100%) 0 0 / 26px 9px repeat-x;
  pointer-events: none;
}
.brand { display: flex; align-items: baseline; gap: .6em; color: inherit; text-decoration: none; min-width: 0; }
.brand-mark { width: 26px; height: 26px; color: var(--accent); align-self: center; }
@media (prefers-color-scheme: light) { :root:not([data-theme='dark']) .brand-mark { color: #d9604c; } }
:root[data-theme='light'] .brand-mark { color: #d9604c; }
.brand-name { font: 700 1.25rem/1 var(--display); letter-spacing: .06em; }
.brand-tag { font: italic 400 .95rem/1 var(--font); color: color-mix(in srgb, var(--band-ink) 65%, transparent); white-space: nowrap; }
.site-nav { margin-left: auto; }
.site-nav > ul { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.site-nav a, .maps-menu summary {
  display: block; padding: .45em .75em; border-radius: var(--radius);
  color: var(--band-ink); text-decoration: none; cursor: pointer;
  font: 600 .8rem/1.2 var(--display); letter-spacing: .1em; text-transform: uppercase;
}
.site-nav a:hover, .maps-menu summary:hover { background: rgba(255, 255, 255, .08); }
.site-nav a[aria-current='page'] { box-shadow: inset 0 -2px 0 #d9604c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .site-nav a[aria-current='page'] { box-shadow: inset 0 -2px 0 var(--accent); } }
:root[data-theme='dark'] .site-nav a[aria-current='page'] { box-shadow: inset 0 -2px 0 var(--accent); }
.maps-menu { position: relative; }
.maps-menu summary { list-style: none; display: flex; align-items: center; gap: .3em; }
.maps-menu summary::-webkit-details-marker { display: none; }
.maps-menu ul {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; list-style: none; margin: 0; padding: 6px;
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow);
}
.maps-menu ul a { color: var(--ink); text-transform: none; letter-spacing: 0; font: 500 .95rem/1.3 var(--font); }
.maps-menu ul a:hover { background: var(--bg-2); }
.maps-menu small { color: var(--muted); font-size: .7rem; }
.maps-menu .maps-more { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--rule-2); }
.maps-menu .maps-more a { color: var(--accent); }
.nav-toggle { display: none; background: none; border: 0; color: inherit; padding: 6px; cursor: pointer; }
.nav-toggle svg { width: 24px; height: 24px; }
.lang-switch { display: flex; gap: 2px; margin: 0; border: 1px solid rgba(255, 255, 255, .18); border-radius: var(--radius); padding: 2px; }
.lang-switch a { padding: .28em .55em; border-radius: 4px; color: var(--band-ink); text-decoration: none; font: 600 .74rem/1.2 var(--display); letter-spacing: .08em; }
.lang-switch a[aria-current='true'] { background: var(--band-ink); color: var(--band); }
/* Przełącznik motywu: słońce / auto / księżyc – moduł theme (assets/theme/theme.css); tu tylko wygląd na ciemnym pasie
   nagłówka przez zmienne: wybrany tryb jak wybrany język (jasne tło, ciemna ikona) */
.site-header {
  --theme-switch-gap-left: 0; --theme-switch-gap-left-compact: 0; --theme-switch-size: 24px; --theme-switch-icon: 15px;
  --theme-switch-bg: transparent; --theme-switch-bg-compact: transparent; --theme-switch-border: rgba(255, 255, 255, .18);
  --theme-switch-fg: color-mix(in srgb, var(--band-ink) 70%, transparent); --theme-switch-fg-active: var(--band-ink);
  --theme-switch-active: var(--band-ink); --theme-switch-focus: var(--accent);
}
.site-header .theme-switch button[aria-pressed='true'] { --theme-switch-fg-active: var(--band); }

@media (max-width: 860px) {
  .brand-tag { display: none; }
  .nav-toggle { display: block; margin-left: auto; }
  .site-nav { margin-left: 0; order: 3; }
  .site-nav > ul {
    display: none; position: absolute; left: 0; right: 0; top: calc(100% + 9px); flex-direction: column; align-items: stretch;
    padding: 10px 16px 16px; background: var(--band); box-shadow: var(--shadow);
  }
  .site-nav.is-open > ul { display: flex; }
  .maps-menu ul { position: static; margin-top: 4px; }
  .site-nav { order: 2; }
  .lang-switch { order: 3; }
  .theme-switch { order: 4; }
}
/* Na wąskim ekranie jeden przycisk z bieżącym trybem – dotknięcie przełącza auto → jasny → ciemny (moduł theme) */
@media (max-width: 480px) {
  .site-header { gap: 10px; }
  .site-header .theme-switch button[aria-pressed='true'] { --theme-switch-fg-active: var(--band-ink); }
}

/* ---------- Mapa: zmienne assetu i znaczniki ---------- */

.wm, .rm {
  --wm-ocean: var(--ocean);
  --wm-sphere-stroke: var(--sphere);
  --wm-land: var(--land);
  --wm-land-hover: var(--land);
  --wm-land-inactive: var(--land);
  --wm-border: var(--rule);
  --wm-border-width: .55px;
  --wm-hover-outline: transparent;
  --wm-control-bg: var(--paper);
  --wm-control-fg: var(--ink);
  --wm-control-border: var(--rule);
  --wm-font: var(--font);
  --wm-tooltip-bg: var(--band);
  --wm-tooltip-fg: var(--band-ink);
  --rm-land: var(--land);
  --rm-land-hover: var(--land-2);
  --rm-land-inactive: var(--land);
  --rm-border: var(--rule);
  --rm-border-width: .6px;
  --rm-outline: var(--ink-2);
  --rm-outline-width: 1px;
  --rm-frame: var(--rule);
  --rm-hover-outline: var(--ink);
  --rm-control-bg: var(--paper);
  --rm-control-fg: var(--ink);
  --rm-control-border: var(--rule);
  --rm-font: var(--font);
  --rm-tooltip-bg: var(--band);
  --rm-tooltip-fg: var(--band-ink);
}
.wm-country[data-fill], .rm-region[data-fill] { fill: var(--wm-fill, var(--rm-fill)); }
.wm-layer-overlay { pointer-events: none; }

/* „Pył”: wszystkie obiekty jako kropki o stałej wielkości na ekranie */
.dust path { fill: none; stroke-linecap: round; stroke-width: 2.6px; vector-effect: non-scaling-stroke; opacity: .62; }
.dust-cultural { stroke: var(--t-cultural); }
.dust-natural { stroke: var(--t-natural); }
.dust-mixed { stroke: var(--t-mixed); }

.mk circle {
  fill: var(--t-cultural); stroke: var(--paper-2); stroke-width: 1.3px; vector-effect: non-scaling-stroke; cursor: pointer;
  transition: stroke-width .12s;
}
.mk-natural circle { fill: var(--t-natural); }
.mk-mixed circle { fill: var(--t-mixed); }
.mk.is-danger circle { stroke: var(--danger); stroke-width: 3px; }
.mk.is-delisted circle { fill: var(--paper-2); stroke: var(--muted); stroke-width: 2px; stroke-dasharray: 2 2; }
.mk.is-year circle { stroke: var(--ink); stroke-width: 2.4px; }
.mk.is-new circle { animation: hm-pop .9s ease-out; }
@keyframes hm-pop { 0% { stroke-width: 9px; stroke-opacity: .35; } 100% { stroke-width: 2.4px; stroke-opacity: 1; } }
.mk-part circle { opacity: .75; stroke-width: 1px; cursor: default; }
.world-map svg.is-exporting .mk circle { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { .mk.is-new circle, .mk.is-sel circle { animation: none; } }
.mk.is-featured circle { stroke-width: 2px; }
.mk:hover circle, .mk.is-hot circle { stroke: var(--ink); stroke-width: 2.6px; }
.mk.is-dim circle { opacity: .55; }
.mk.is-sel circle { stroke: var(--ink); stroke-width: 3px; animation: beacon 1.8s ease-out infinite; }
@keyframes beacon {
  0% { stroke-opacity: 1; }
  60% { stroke-opacity: .25; }
  100% { stroke-opacity: 1; }
}
/* Obrazek PNG (moduł export – klasa .is-exporting na czas kopiowania mapy): bez pulsowania, wybrany obiekt z pełną
   obwódką */
svg.is-exporting .mk circle { animation: none !important; transition: none !important; }
svg.is-exporting .mk.is-sel circle { stroke-opacity: 1; stroke-width: 3.4px; }
@media (prefers-reduced-motion: reduce) { .mk circle { animation: none !important; } }

.map-tip {
  position: absolute; left: 0; top: 0; z-index: 6; pointer-events: none; max-width: 280px;
  padding: .45em .7em; border-radius: var(--radius); background: var(--band); color: var(--band-ink);
  box-shadow: var(--shadow); font-size: .9rem; line-height: 1.3;
}
.map-tip strong { display: block; font-family: var(--display); font-size: .88rem; letter-spacing: .02em; }
.map-tip span { color: color-mix(in srgb, var(--band-ink) 70%, transparent); }

/* ---------- Strona główna ---------- */

.atlas {
  display: grid; grid-template-columns: 390px minmax(0, 1fr); gap: 0;
  height: calc(100dvh - var(--header-h)); min-height: 620px;
}
.codex {
  order: -1; position: relative; z-index: 2; display: flex; flex-direction: column; min-height: 0;
  background: var(--paper); border-right: 1px solid var(--rule);
  box-shadow: 6px 0 24px -18px rgba(60, 38, 16, .6);
}
.codex-intro { padding: 26px 24px 14px; border-bottom: 1px solid var(--rule-2); }
.codex-intro[hidden] { display: none; }
.codex-intro h1 { font-size: 1.7rem; margin-bottom: .35em; }
.codex-intro .lead { font-size: 1.02rem; margin-bottom: .8em; }
.codex-list { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 24px 24px; scrollbar-width: thin; }
.stats { display: flex; gap: 22px; margin: 0 0 14px; }
.stats div { display: flex; flex-direction: column-reverse; }
.stats dd { margin: 0; font: 700 1.45rem/1 var(--display); color: var(--accent); }
.stats dt { font-size: .82rem; color: var(--muted); }
.search-row { display: flex; gap: 8px; }
.search { flex: 1; }
.search input {
  width: 100%; padding: .6em .8em; border-radius: var(--radius); border: 1px solid var(--rule);
  background: var(--paper-2); color: var(--ink); font: 400 1rem/1.2 var(--font);
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.notice { padding: .6em .8em; border-left: 3px solid var(--accent); background: var(--bg-2); font-size: .92rem; }

.atlas-map { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--ocean); }
.atlas-map .world-map { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.atlas-map .world-map::after {
  /* winieta jak na starej mapie */
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  box-shadow: inset 0 0 90px rgba(90, 60, 20, .28);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .atlas-map .world-map::after {
    box-shadow: inset 0 0 120px rgba(0, 0, 0, .55);
    background: radial-gradient(40% 35% at 85% 8%, rgba(240, 228, 190, .07), transparent 70%);
  }
}
:root[data-theme='dark'] .atlas-map .world-map::after {
  box-shadow: inset 0 0 120px rgba(0, 0, 0, .55);
  background: radial-gradient(40% 35% at 85% 8%, rgba(240, 228, 190, .07), transparent 70%);
}
.map-loading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; font: italic 1.1rem var(--font); color: var(--muted); pointer-events: none; }
.map-filters {
  position: absolute; z-index: 4; top: 18px; left: 14px; right: 70px;
  display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none;
}
.map-filters > * { pointer-events: auto; }
.chip {
  display: inline-flex; align-items: center; gap: .4em; cursor: pointer;
  padding: .36em .75em .36em .55em; border-radius: 4px;
  border: 1px solid var(--rule); background: color-mix(in srgb, var(--paper) 92%, transparent);
  color: var(--ink-2); font: 600 .78rem/1.2 var(--display); letter-spacing: .04em;
  box-shadow: 0 1px 3px rgba(60, 38, 16, .15); backdrop-filter: blur(4px);
}
.chip svg { width: 1.1em; height: 1.1em; color: var(--muted); }
.chip-type svg { color: var(--cc); }
.chip[aria-pressed='true'] { border-color: var(--cc); color: var(--ink); }
.chip-type[aria-pressed='false'] { opacity: .55; }
.chip-flag[aria-pressed='true'] { background: var(--band); color: var(--band-ink); border-color: var(--band); }
.chip-flag[aria-pressed='true'] svg { color: var(--danger); }
.chip-count { font: 500 .72rem/1 var(--font); color: var(--muted); }
.chip-sep { width: 1px; background: var(--rule); margin: 2px 4px; }

.years { position: relative; z-index: 3; padding: 10px 18px 12px; background: var(--paper); border-top: 1px solid var(--rule); }
.years::before {
  /* ząbki nad paskiem lat */
  content: ''; position: absolute; left: 0; right: 0; bottom: 100%; height: 7px;
  background: linear-gradient(90deg, var(--paper) 0 55%, transparent 55% 100%) 0 0 / 20px 7px repeat-x;
}
.years-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-bottom: 6px; }
.years-head h2 { font-size: .82rem; letter-spacing: .14em; text-transform: uppercase; margin: 0; color: var(--ink-2); }
.years-presets { display: flex; gap: 4px; margin: 0; flex-wrap: wrap; }
.years-presets button {
  border: 1px solid var(--rule-2); background: none; color: var(--ink-2); border-radius: 3px; cursor: pointer;
  font: 500 .8rem/1.2 var(--font); padding: .2em .55em;
}
.years-presets button:hover { border-color: var(--accent); color: var(--accent); }
.years-info { margin: 0 0 0 auto; font-size: .82rem; color: var(--muted); }
.year-bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; height: 66px; user-select: none; }
.year-bar {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; min-width: 0;
  border: 0; padding: 0; background: none; cursor: pointer; color: var(--muted);
}
.year-stack { flex: 1; display: flex; flex-direction: column-reverse; justify-content: flex-start; border-bottom: 1px solid var(--rule); }
.year-stack i { display: block; background: var(--cc); opacity: .55; min-height: 0; transition: height .25s; }
.year-bar:hover .year-stack i { opacity: .8; }
.year-bar.is-on .year-stack i { opacity: 1; }
.year-bar.is-on .year-label { color: var(--accent); font-weight: 700; }
.year-bar { position: relative; }
.year-label { position: absolute; left: 0; top: calc(100% + 2px); font: 600 .62rem/1 var(--font); white-space: nowrap; }
.year-bar.is-now .year-stack { box-shadow: 0 2px 0 var(--accent); }
.year-bars { margin-bottom: 14px; }
.year-player { margin-top: 4px; --tp-accent: var(--accent); --tp-ink: var(--ink); --tp-muted: var(--muted); --tp-line: var(--rule); --tp-surface: var(--paper-2); }

.list-head { display: flex; justify-content: space-between; align-items: baseline; font-size: .82rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); border-bottom: 1px solid var(--rule-2); padding-bottom: .4em; }
.list-head span { font: 600 .85rem var(--font); letter-spacing: 0; color: var(--accent); }
.list-empty, .list-more { color: var(--muted); font-style: italic; font-size: .95rem; }
.roll { list-style: none; margin: 0; padding: 0; }
.roll button {
  display: flex; align-items: center; gap: .65em; width: 100%; text-align: left; cursor: pointer;
  padding: .45em .3em; border: 0; border-bottom: 1px dotted var(--rule-2); background: none; color: var(--ink);
  font: inherit;
}
.roll button:hover { background: var(--bg-2); }
.roll svg { width: 1.15em; height: 1.15em; color: var(--cc); }
.roll span { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.roll strong { font-weight: 700; font-size: .98rem; line-height: 1.25; }
.roll em { font-style: normal; font-size: .84rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roll-danger { font-style: normal; font-weight: 700; color: #fff; background: var(--danger); border-radius: 50%; width: 1.2em; height: 1.2em; display: inline-grid; place-items: center; font-size: .72rem; line-height: 1; }
.danger-word { color: var(--danger); }

.folio { position: relative; }
.folio-close {
  position: absolute; right: -8px; top: -6px; z-index: 2; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--rule); background: var(--paper-2); color: var(--ink); font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.folio-img { display: block; margin: 0 0 14px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--rule); background: var(--bg-2); }
.folio-img img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.folio-kind { display: flex; align-items: center; gap: .4em; font: 600 .74rem/1.3 var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--cc); margin: 0 0 .4em; }
.folio h2 { font-size: 1.45rem; margin-bottom: .2em; }
.folio h2 a { color: var(--ink); text-decoration: none; }
.folio h2 a:hover { color: var(--accent); }
.folio-where { color: var(--ink-2); margin: 0 0 .2em; }
.folio-when { color: var(--muted); font-size: .95rem; }
.folio-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }
.folio h3 { font-size: .82rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); border-bottom: 1px solid var(--rule-2); padding-bottom: .4em; }

.below { padding: 34px clamp(16px, 3vw, 44px) 20px; max-width: 1400px; margin: 0 auto; }
.section-head { display: flex; align-items: center; gap: 14px; font-size: .95rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); margin: 1.6em 0 1em; }
.section-head::before, .section-head::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--rule)); }
.section-head::after { background: linear-gradient(90deg, var(--rule), transparent); }
.section-head span::before, .section-head span::after { content: '◆'; color: var(--accent); font-size: .6em; vertical-align: .25em; margin: 0 .7em; }

.card-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; height: 100%; text-decoration: none; color: var(--ink);
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 1px 2px rgba(60, 38, 16, .08); transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: var(--ink); }
.card-img { position: relative; display: grid; place-items: center; aspect-ratio: 3 / 2; background: var(--bg-2); color: var(--cc); }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-img > svg { width: 42%; height: 42%; opacity: .5; }
.badge-danger { position: absolute; right: 8px; top: 8px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--band); color: var(--danger); }
.badge-danger svg { width: 16px; height: 16px; }
.card-body { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; }
.card-meta { display: flex; align-items: center; gap: .35em; font: 600 .68rem/1.3 var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--cc); }
.card strong { font-size: 1.05rem; line-height: 1.25; }
.card em { font-style: normal; color: var(--muted); font-size: .9rem; }

.tally { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 26px; }
.tally a, .tally-plain { display: flex; justify-content: space-between; gap: 10px; padding: .4em 0; border-bottom: 1px dotted var(--rule); color: var(--ink); text-decoration: none; }
.tally a:hover span { color: var(--accent); }
.tally b { font: 600 .92rem var(--font); color: var(--muted); }
.tally-plain { color: var(--ink-2); }
.more-link { margin-top: 1em; font-family: var(--display); font-size: .9rem; letter-spacing: .04em; }

@media (max-width: 900px) {
  .atlas { display: flex; flex-direction: column; height: auto; min-height: 0; overflow-x: clip; }
  .atlas > * { min-width: 0; max-width: 100%; }
  .atlas-map { order: 1; }
  /* Wysokość (ok. połowa ekranu) i przewijanie pasa mapy w bok – tryb phone modułu world-map (home.js) */
  .atlas-map .world-map { flex: none; }
  .years-info { flex-basis: 100%; margin: 0; }
  .codex { order: 2; border-right: 0; border-top: 1px solid var(--rule); }
  .codex-intro { order: -1; }
  .codex-list { max-height: none; overflow: visible; }
  .map-filters { position: relative; top: auto; left: auto; right: auto; padding: 18px 12px 10px; flex-wrap: nowrap; overflow-x: auto; background: var(--paper); border-bottom: 1px solid var(--rule); }
  .chip { flex: none; }
  .atlas-map { display: flex; flex-direction: column; }
  .map-filters { order: -1; }
  .year-bars { height: 52px; gap: 1px; }
  .year-label { font-size: .55rem; }
}

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

.page { max-width: 1240px; margin: 0 auto; padding: 22px clamp(16px, 3vw, 40px) 40px; }
.crumbs { display: flex; flex-wrap: wrap; gap: .45em; font-size: .9rem; color: var(--muted); margin: 6px 0 22px; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.page-head { max-width: 820px; margin-bottom: 18px; }
.prose-page { max-width: 860px; }
.prose-page h2 { margin-top: 1.6em; }
.type-list { list-style: none; padding: 0; }
.type-list li { display: flex; gap: .6em; align-items: baseline; margin-bottom: .6em; }
.type-list svg { color: var(--cc); align-self: center; width: 1.3em; height: 1.3em; }

/* Strona obiektu */
.site-hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; align-items: start; margin-bottom: 26px; }
.site-hero.has-img { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.site-head h1 { font-size: clamp(1.9rem, 4vw, 3rem); margin-bottom: .2em; }
.site-head .kicker svg { width: 1.3em; height: 1.3em; }
.alt-name { font-style: italic; color: var(--muted); margin-top: -.2em; }
.site-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.site-photo { margin: 0; }
.site-photo img { width: 100%; height: auto; max-height: 520px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--rule); box-shadow: var(--shadow); background: var(--bg-2); }
.site-photo figcaption { font-size: .8rem; color: var(--muted); margin-top: .5em; }
.site-photo figcaption a { color: inherit; }
.site-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 40px; align-items: start; }
.site-body { max-width: 760px; }
.site-body h2 { margin-top: 1.4em; font-size: 1.3rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 26px; margin: 0 0 10px; padding: 14px 18px; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); }
.facts div { padding: .45em 0; border-bottom: 1px dotted var(--rule-2); }
.facts dt { font: 600 .68rem/1.3 var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 0; }
.initial::first-letter { float: left; font: 700 3.4em/.85 var(--display); color: var(--accent); margin: .06em .1em 0 0; }
.legend-box { margin: 1.6em 0; padding: 16px 20px; border: 1px solid var(--rule); border-left: 4px solid var(--gold); background: var(--paper); border-radius: var(--radius); font-style: italic; }
.legend-box h2 { margin-top: 0; font-style: normal; font-size: 1.05rem; color: var(--gold); }
.legend-box p { margin: 0; }
.more { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1.6em; }
.site-side h2 { font-size: .95rem; letter-spacing: .12em; text-transform: uppercase; margin-top: 1.2em; }
.side-map { margin: 0; position: relative; }
.side-map .world-map { height: 300px; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; background: var(--ocean); }
.mini-list { list-style: none; padding: 0; margin: 0; }
.mini-list a { display: flex; gap: .6em; align-items: center; padding: .45em 0; border-bottom: 1px dotted var(--rule-2); color: var(--ink); text-decoration: none; }
.mini-list a:hover strong { color: var(--accent); }
.mini-list svg { color: var(--cc); width: 1.15em; height: 1.15em; }
.mini-list span { display: flex; flex-direction: column; }
.mini-list em { font-style: normal; font-size: .85rem; color: var(--muted); }
.side-links { display: flex; flex-direction: column; gap: .4em; margin-top: 1.2em; font-size: .95rem; }

/* Listy: rodzaj, stulecie, kraj, region */
.listing-hero { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 30px; align-items: start; }
.listing-map { margin: 0; position: relative; }
.listing-map .world-map, .listing-map .region-map { height: clamp(300px, 38vw, 470px); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; background: var(--ocean); }
.listing-map .region-map { background: var(--paper); }
.listing-map figcaption { font-size: .85rem; color: var(--muted); margin-top: .4em; }

/* Mapa jako PNG – przycisk i menu formatów (moduł export, assets/export/export.css) w kolorach strony */
:root {
  --export-surface: var(--paper); --export-ink: var(--ink); --export-ink-2: var(--ink-2); --export-muted: var(--muted);
  --export-line: var(--rule); --export-hover: var(--bg-2); --export-radius: var(--radius); --export-font: var(--font);
}
/* Strona główna: w lewym dolnym rogu mapy, tuż nad paskiem stuleci; menu otwiera się w górę */
.years > .map-export-wrap { position: absolute; z-index: 4; left: 12px; bottom: calc(100% + 18px); }
/* Strona obiektu i listy: podpis mapy z przyciskiem po prawej */
.map-caption { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: .4em; font-size: .85rem; color: var(--muted); }
.map-caption .map-export-wrap { position: relative; flex: none; }
.type-tally { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .95rem; color: var(--ink-2); }
.type-tally li { display: flex; align-items: center; gap: .35em; }
.type-tally svg { color: var(--cc); }
.register-groups { columns: 3 300px; column-gap: 34px; }
.reg-group { break-inside: avoid; margin-bottom: 22px; }
.reg-group h3 { display: flex; justify-content: space-between; border-bottom: 1px solid var(--rule); padding-bottom: .3em; margin-bottom: .3em; }
.reg-group h3 a { color: var(--ink); text-decoration: none; }
.reg-group h3 a:hover { color: var(--accent); }
.reg-group h3 span { font: 600 .9rem var(--font); color: var(--muted); }
.reg-group ol { list-style: none; padding: 0; margin: 0; }
.reg-group li a { display: flex; align-items: baseline; gap: .5em; padding: .22em 0; color: var(--ink); text-decoration: none; }
.reg-group li a:hover span { color: var(--accent); text-decoration: underline; }
.reg-group li svg { color: var(--cc); align-self: center; width: .95em; height: .95em; }
.reg-group li span { flex: 1; }
.reg-group li em { font-style: normal; font-size: .84rem; color: var(--muted); white-space: nowrap; }

/* Katalog */
.type-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.type-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 16px 18px 18px;
  background: var(--paper); border: 1px solid var(--rule); border-top: 4px solid var(--cc); border-radius: var(--radius);
  color: var(--ink); text-decoration: none;
}
.type-card:hover { box-shadow: var(--shadow); color: var(--ink); }
.type-card svg { width: 30px; height: 30px; color: var(--cc); }
.type-card strong { font: 700 1.05rem/1.2 var(--display); }
.type-card span { font-size: .93rem; color: var(--ink-2); }
.type-card b { position: absolute; right: 16px; top: 14px; font: 700 1.2rem var(--display); color: var(--cc); }
.type-card-danger { --c: #c62828; }
.type-card-delisted { --c: #7a6f62; }
.century-scale { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; align-items: flex-end; overflow-x: auto; padding-bottom: 4px; }
.century-scale a { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 54px; height: 150px; justify-content: flex-end; color: var(--ink); text-decoration: none; }
.century-scale i { display: block; width: 100%; height: var(--h); min-height: 3px; background: var(--accent); opacity: .75; border-radius: 2px 2px 0 0; }
.century-scale a:hover i { opacity: 1; }
.century-scale span { font: 600 .7rem/1.1 var(--display); text-align: center; }
.century-scale b { font: 500 .78rem var(--font); color: var(--muted); }
.letters { columns: 4 200px; column-gap: 30px; }
.letters section { break-inside: avoid; margin-bottom: 14px; }
.letters h3 { color: var(--accent); border-bottom: 1px solid var(--rule); margin-bottom: .2em; }
.letters ul { list-style: none; margin: 0; padding: 0; }
.letters li { display: flex; justify-content: space-between; gap: 8px; padding: .12em 0; }
.letters li a { color: var(--ink); text-decoration: none; }
.letters li a:hover { color: var(--accent); text-decoration: underline; }
.letters b { font-weight: 500; color: var(--muted); font-size: .9rem; }

.error-page { text-align: center; padding-top: 60px; }

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

.contact-form { max-width: 640px; }
.form-field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 16px; }
.form-field label { font-weight: 700; color: var(--ink-2); }
.form-field input[type='text'], .form-field input[type='email'], .form-field textarea {
  width: 100%; padding: .6em .8em; border-radius: var(--radius); border: 1px solid var(--rule);
  background: var(--paper-2); color: var(--ink); font: 400 1rem/1.4 var(--font);
}
.form-field textarea { resize: vertical; min-height: 9em; }
.form-field input:focus, .form-field textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.form-field [aria-invalid='true'] { border-color: var(--accent); }
.form-consent { flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: 4px 10px; }
.form-consent input { margin: .35em 0 0; width: 1.1em; height: 1.1em; accent-color: var(--accent); flex: none; }
.form-consent label { flex: 1; font-weight: 400; color: var(--ink); }
.form-consent .field-error { flex-basis: 100%; }
.req { color: var(--accent); }
.field-error { color: var(--accent); font-size: .92rem; }
.form-required { font-size: .9rem; }
.form-alert, .form-success { padding: .7em .9em; border-left: 3px solid var(--accent); background: var(--bg-2); }
.form-success { border-left-color: var(--gold); font-size: 1.1rem; }
.form-clause { max-width: 640px; margin-top: 26px; font-size: .9rem; }
.hp-field { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.error-mark { width: 90px; height: 90px; color: var(--t-mixed); margin-bottom: 12px; }

@media (max-width: 960px) {
  .site-hero.has-img, .site-layout, .listing-hero { grid-template-columns: minmax(0, 1fr); }
  .site-photo { order: -1; }
}

/* ---------- Stopka i podpowiedź języka ---------- */

.site-footer {
  position: relative; margin-top: 40px; padding: 26px clamp(16px, 3vw, 40px) 30px;
  background: var(--band); color: color-mix(in srgb, var(--band-ink) 80%, transparent); font-size: .92rem;
}
.site-footer::before {
  content: ''; position: absolute; left: 0; right: 0; bottom: 100%; height: 9px;
  background: linear-gradient(90deg, var(--band) 0 55%, transparent 55% 100%) 0 0 / 26px 9px repeat-x;
}
.site-footer p { max-width: 1240px; margin: 0 auto .5em; }
.site-footer a { color: var(--band-ink); }
/* 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; }
/* Podpowiedź języka: wyśrodkowana, na telefonie na całą szerokość ekranu (z left: 50% pasek miał tylko pół ekranu) */
.lang-hint {
  position: fixed; z-index: 50; left: 12px; right: 12px; bottom: 16px; width: max-content; margin: 0 auto;
  display: flex; align-items: center; gap: 12px; padding: .6em .7em .6em 1em; max-width: calc(100% - 24px);
  background: var(--band); color: var(--band-ink); border-radius: var(--radius); box-shadow: var(--shadow); font-size: .95rem;
}
.lang-hint[hidden] { display: none; }
/* Czat (moduł chat-series): pływający przycisk w prawym dolnym rogu – na telefonie podpowiedź języka obok niego, nie pod nim */
@media (max-width: 640px) { body:not(.page-home):has(> #ominuvo-chat) .lang-hint { right: 84px; margin-right: 0; } }
.lang-hint a { color: var(--band-ink); font-weight: 700; }
.lang-hint button { background: none; border: 0; color: inherit; font-size: 1.3rem; cursor: pointer; line-height: 1; }

/* ---------- Quiz (/quiz – moduł quiz z assets) ---------- */
.quiz-stage { margin-bottom: 28px; }
.quiz-stage .quiz { --quiz-accent: var(--accent); --quiz-surface: var(--paper); --quiz-target: var(--gold); --quiz-radius: var(--radius); --quiz-accent-ink: var(--accent-ink); }
.quiz-map {
  --wm-ocean: var(--ocean); --wm-sphere-stroke: var(--rule); --wm-land: var(--land); --wm-land-hover: var(--land-2);
  --wm-dot: var(--land); --wm-border: var(--bg); --wm-border-width: .6px; --wm-font: var(--font);
  --wm-control-bg: var(--paper); --wm-control-fg: var(--ink); --wm-control-border: var(--rule-2);
  position: relative; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--bg-2); overflow: hidden;
}
.quiz-about { max-width: 820px; color: var(--ink-2); }

/* ---------- HeritageMap: dodatki ---------- */
.chip-select { padding: 0; }
.chip-select select { border: 0; background: transparent; color: inherit; font: inherit; padding: .32em .5em; max-width: 13em; cursor: pointer; }
.chip-select select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.criteria-list { padding-left: 1.1em; }
.criteria-list li { margin: .3em 0; }
.criteria-list b { font-family: var(--display); }
.crit-natural > a, .crit-natural b { color: var(--t-natural); }
.crit-cultural > a, .crit-cultural b { color: var(--t-cultural); }
.crit-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.crit-grid a { display: flex; align-items: baseline; gap: .45em; padding: .55em .8em; border: 1px solid var(--rule); border-left: 4px solid currentColor; border-radius: var(--radius); background: var(--paper); text-decoration: none; }
.crit-grid strong { flex: 1; color: var(--ink); font-weight: 500; }
.crit-grid span { font: 700 .95rem var(--display); }
.year-scale a { width: 30px; }
.year-scale span { font-size: .6rem; writing-mode: vertical-rl; transform: rotate(180deg); }
.notice { background: var(--paper); border: 1px solid var(--rule); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: .7em 1em; }
.notice-history { border-left-color: var(--muted); }
.footer-note { font-size: .85rem; opacity: .85; }
.series-links { margin-top: 1.6em; padding: .8em 1.1em; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); }
.series-links h2 { margin-top: 0; font-size: 1.05rem; }
.series-links ul { margin: 0; padding-left: 1.1em; }
.parts-list { margin-top: 1em; font-size: .92rem; }
.parts-list summary { cursor: pointer; font-family: var(--display); letter-spacing: .04em; }
.parts-list ol { max-height: 260px; overflow: auto; padding-left: 1.6em; margin: .4em 0; }
.rank-list { list-style: none; margin: 18px 0; padding: 0; max-width: 860px; }
.rank-list li { display: flex; align-items: baseline; gap: .9em; padding: .55em .2em; border-bottom: 1px dotted var(--rule); }
.rank-place { font: 700 1.15rem/1 var(--display); color: var(--cc); min-width: 2em; text-align: right; }
.rank-name { flex: 1; display: flex; flex-direction: column; }
.rank-name a { color: var(--ink); font-weight: 600; text-decoration: none; }
.rank-name a:hover { color: var(--accent); text-decoration: underline; }
.rank-name em { font-style: normal; font-size: .86rem; color: var(--muted); }
.rank-value { font: 700 1.05rem var(--display); color: var(--ink-2); white-space: nowrap; }
.top-map { margin-bottom: 10px; }
.folio-when { font-size: .9rem; color: var(--muted); margin: 0 0 .6em; }
