/* POPIÓŁ — /ziemia. Dark, warm, golden-hour palette (PKiN at dusk). Mobile first. */
:root {
  color-scheme: dark;
  --bg: #0d0d0c; --bg2: #121110; --panel: #171614; --card: #1d1b18; --card2: #24211d; --line: #2c2924; --line2: #3a352e;
  --text: #ece6d8; --text2: #cfc7b6; --muted: #9a9384; --faint: #8f887b; /* faint was #6f695e (3.2:1 on cards), now AA */
  --accent: #c47834; --gold: #e0b25a; --gold2: #f3d38b;
  --ok: #6fbf73; --warn: #e0b25a; --bad: #e0705a; --info: #6aa8e0; --violet: #a98be0;
  --st-full: #5fb865; --st-part: #e0b25a; --st-wip: #4d8fe0; --st-plan: #8a8476;
  --r: 14px; --r2: 10px; --pad: clamp(14px, 3.2vw, 28px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  /* text on filled surfaces */
  --on-gold: #000; --on-accent: #140b03; --on-ok: #08240a; --accent-hi: #d4873f;
  --ok-text: #a7e0aa; --bad-text: #f0a898; --info-text: #a9cdf0; --violet-text: #cbb8f0; --err-text: #f0b0a2;
  /* tints and edges of the status colours */
  --ok-tint: rgba(111,191,115,.12); --ok-edge: rgba(111,191,115,.35); --ok-halo: rgba(111,191,115,.18);
  --gold-tint: rgba(224,178,90,.12); --gold-edge: rgba(224,178,90,.35); --gold-press: rgba(224,178,90,.16); --gold-mark: rgba(224,178,90,.28);
  --bad-tint: rgba(224,112,90,.12); --bad-edge: rgba(224,112,90,.35); --err-tint: rgba(224,112,90,.08); --err-edge: rgba(224,112,90,.4);
  --info-tint: rgba(106,168,224,.12); --info-edge: rgba(106,168,224,.35);
  --violet-tint: rgba(169,139,224,.12); --violet-edge: rgba(169,139,224,.35);
  /* page glows, glass bars, veils */
  --glow-gold: rgba(224,178,90,.08); --glow-accent: rgba(196,120,52,.07);
  --top-glass: rgba(13,13,12,.92); --bar-glass: rgba(23,22,20,.97); --veil: rgba(0,0,0,.6); --row-hover: rgba(255,255,255,.015);
  --tap: 44px; /* smallest touch target */
}
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h, 140px) + 10px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); min-height: 100vh;
  background-image: radial-gradient(1200px 500px at 85% -10%, var(--glow-gold), transparent 60%),
                    radial-gradient(900px 400px at -10% 0%, var(--glow-accent), transparent 60%); background-attachment: fixed; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: var(--gold); color: var(--on-gold); padding: 8px 12px; border-radius: 8px; z-index: 100;
  display: inline-flex; align-items: center; min-height: var(--tap); }
:focus-visible { outline: 2px solid var(--gold2); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .mono { font-family: var(--mono); font-size: .92em; }
.nowrap { white-space: nowrap; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: .01em; }
h2 { font-size: clamp(20px, 2.6vw, 26px); }
h3 { font-size: 17px; }
p { margin: 0 0 .8em; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 30; background: var(--top-glass); backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px var(--pad) 2px; max-width: 1400px; margin: 0 auto; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; }
.logo svg { width: 34px; height: 34px; color: var(--gold); flex: none; }
.logo b { display: block; font-size: 19px; letter-spacing: .2em; }
.logo small { display: block; color: var(--muted); font-size: 12px; letter-spacing: .04em; margin-top: -2px; }
.search-btn { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line2); border-radius: 999px;
  padding: 7px 12px; color: var(--text2); cursor: pointer; min-height: var(--tap); min-width: var(--tap); justify-content: center; }
.search-btn svg { width: 17px; height: 17px; }
.search-btn kbd { font: 12px var(--mono); border: 1px solid var(--line2); border-radius: 5px; padding: 0 5px; color: var(--muted); }
.search-btn:hover { border-color: var(--gold); color: var(--text); }
@media (max-width: 560px) { .search-btn span, .search-btn kbd { display: none; } }

.statusbar { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; padding: 2px var(--pad) 6px; max-width: 1400px; margin: 0 auto;
  font-size: 13px; color: var(--text2); }
.statusbar .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--faint); }
.statusbar .dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-halo); }
.statusbar .dot.bad { background: var(--bad); }
.statusbar .dot.warn { background: var(--warn); }
.statusbar .owner { color: var(--gold2); border: 1px solid var(--line2); border-radius: 999px; padding: 0 9px; }
.statusbar .fresh { color: var(--bg); background: var(--gold); border-radius: 999px; padding: 1px 10px; font-weight: 600; text-decoration: none; }
/* phones: one scrollable status line keeps the sticky header short (app.js publishes its height as --header-h) */
@media (max-width: 560px) {
  .statusbar { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; scrollbar-width: none; gap: 14px; }
  .statusbar::-webkit-scrollbar { display: none; }
  .statusbar > * { flex: none; }
}

.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 0 var(--pad) 0; max-width: 1400px; margin: 0 auto;
  -webkit-overflow-scrolling: touch; mask-image: linear-gradient(90deg, black 92%, transparent); }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; display: flex; align-items: center; gap: 6px; padding: 9px 12px 10px; color: var(--muted); border-bottom: 2px solid transparent;
  text-decoration: none !important; font-size: 14px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--gold2); border-bottom-color: var(--gold); }
.tabs .ico { font-size: 15px; filter: saturate(.8); }

/* ---------- layout ---------- */
main { max-width: 1400px; margin: 0 auto; padding: 18px var(--pad) 40px; outline: none; }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 18px; margin: 4px 0 16px; }
.section-head p { margin: 0; color: var(--muted); max-width: 820px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.grid.tight { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.cols { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 980px) { .cols.two { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } .cols.two-eq { grid-template-columns: 1fr 1fr; } }
.card { background: linear-gradient(180deg, var(--card), var(--panel)); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; }
.card.pad0 { padding: 0; overflow: hidden; }
.card h3 { display: flex; align-items: center; gap: 8px; }
.card .more { display: inline-block; margin-top: 8px; font-size: 14px; }
.card.link { cursor: pointer; transition: border-color .15s, transform .15s; }
.card.link:hover { border-color: var(--line2); transform: translateY(-1px); }
.hr { height: 1px; background: var(--line); margin: 14px 0; border: 0; }

/* ---------- small components ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; line-height: 1; padding: 4px 8px; border-radius: 999px;
  background: var(--card2); border: 1px solid var(--line2); color: var(--text2); white-space: nowrap; vertical-align: middle; }
.badge.ok { background: var(--ok-tint); border-color: var(--ok-edge); color: var(--ok-text); }
.badge.warn { background: var(--gold-tint); border-color: var(--gold-edge); color: var(--gold2); }
.badge.bad { background: var(--bad-tint); border-color: var(--bad-edge); color: var(--bad-text); }
.badge.info { background: var(--info-tint); border-color: var(--info-edge); color: var(--info-text); }
.badge.violet { background: var(--violet-tint); border-color: var(--violet-edge); color: var(--violet-text); }
.badge.live { background: var(--ok); color: var(--on-ok); border-color: transparent; font-weight: 700; letter-spacing: .06em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line2); background: var(--card); color: var(--text2); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--gold-press); border-color: var(--gold); color: var(--gold2); }
.chip[aria-pressed="true"] .faint { color: inherit; }
.chip:hover { border-color: var(--gold); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line2);
  background: var(--card2); color: var(--text); cursor: pointer; text-decoration: none !important; font-size: 14px; min-height: var(--tap); }
.btn:hover { border-color: var(--gold); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.btn.primary:hover { background: var(--accent-hi); }
.ghost { background: none; border: 1px solid var(--line2); border-radius: 8px; padding: 6px 10px; color: var(--muted); cursor: pointer; }
.input { width: 100%; background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px; padding: 9px 12px; color: var(--text); min-height: var(--tap); }
.input:focus { outline: none; border-color: var(--gold); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 14px; }
.toolbar .input { max-width: 360px; }
.toolbar .grow { flex: 1; }
.empty { padding: 26px; text-align: center; color: var(--muted); border: 1px dashed var(--line2); border-radius: var(--r); }
.err { padding: 14px; border-radius: var(--r2); border: 1px solid var(--err-edge); background: var(--err-tint); color: var(--err-text); }
.note { font-size: 13px; color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
ul.bul { margin: 6px 0 0; padding-left: 18px; } ul.bul li { margin: 3px 0; }
ul.plain { list-style: none; margin: 0; padding: 0; }
.spinner { width: 22px; height: 22px; border: 2px solid var(--line2); border-top-color: var(--gold); border-radius: 50%; animation: spin 1s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* big numbers */
.metric { display: flex; flex-direction: column; gap: 2px; }
.metric .v { font-size: clamp(24px, 3.4vw, 32px); font-weight: 750; letter-spacing: -.01em; color: var(--gold2); font-variant-numeric: tabular-nums; line-height: 1.1; }
.metric .u { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.metric .l { font-size: 13.5px; color: var(--text2); }
.metric .d { font-size: 12px; color: var(--faint); }

/* bars (simple charts) */
.bars { display: grid; gap: 6px; }
.bar { display: grid; grid-template-columns: minmax(90px, 30%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.bar .track { height: 10px; background: var(--bg2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bar .fill { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); border-radius: 999px; }
.bar .lab { color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .val { color: var(--muted); font-variant-numeric: tabular-nums; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 80px; }
.spark i { flex: 1; background: linear-gradient(180deg, var(--gold), var(--accent)); border-radius: 3px 3px 0 0; min-height: 1px; opacity: .9; }
.spark i:hover { opacity: 1; filter: brightness(1.2); }

/* tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r2); }
table.tbl { border-collapse: collapse; width: 100%; font-size: 14px; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; background: var(--panel); position: sticky; top: 0; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: var(--row-hover); }

/* details/summary */
details.box { border: 1px solid var(--line); border-radius: var(--r2); background: var(--panel); }
details.box > summary { cursor: pointer; padding: 10px 14px; list-style: none; display: flex; align-items: center; gap: 8px; min-height: var(--tap); }
details.box > summary::-webkit-details-marker { display: none; }
details.box > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
details.box[open] > summary::before { transform: rotate(90deg); }
details.box > .in { padding: 0 14px 14px; }

/* ---------- search overlay ---------- */
.search { position: fixed; inset: 0; z-index: 60; background: var(--veil); backdrop-filter: blur(3px); display: flex; justify-content: center; padding: 8vh 12px 12px; }
.search[hidden] { display: none; }
.search-box { width: min(760px, 100%); max-height: 80vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line2);
  border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.search-row { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.search-row input { flex: 1; background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px; padding: 10px 12px; color: var(--text); font-size: 16px; }
.search-row input:focus { outline: none; border-color: var(--gold); }
.search-row .ghost { min-height: var(--tap); min-width: var(--tap); }
.search-results { overflow-y: auto; padding: 6px; }
.sr { display: block; padding: 9px 12px; border-radius: 10px; color: var(--text); text-decoration: none !important; }
.sr:hover, .sr.sel { background: var(--card2); }
.sr .t { font-weight: 600; } .sr .s { font-size: 12px; color: var(--gold); margin-right: 8px; text-transform: uppercase; letter-spacing: .06em; }
.sr .x { font-size: 13px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
mark { background: var(--gold-mark); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------- footer ---------- */
.foot { max-width: 1400px; margin: 0 auto; padding: 10px var(--pad) 40px; color: var(--faint); font-size: 13px; border-top: 1px solid var(--line); }
.foot p { margin: 6px 0; }
.noscript { text-align: center; padding: 40px; }

/* ---------- section-specific shared bits ---------- */
.status-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--text2); }
.status-legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-right: 6px; vertical-align: -2px; }
.st-full { background: var(--st-full); } .st-part { background: var(--st-part); } .st-wip { background: var(--st-wip); } .st-plan { background: var(--st-plan); }
.thumb { aspect-ratio: 16/9; width: 100%; object-fit: cover; background: var(--bg2); border-radius: var(--r2); display: block; }
.player-bar { position: sticky; bottom: 0; z-index: 20; background: var(--bar-glass); border-top: 1px solid var(--line2); padding: 10px var(--pad);
  display: flex; align-items: center; gap: 12px; backdrop-filter: blur(8px); }
.player-bar audio { flex: 1; min-width: 0; height: 40px; }

/* ---------- touch area ----------
   Small controls keep their size, so the lists stay as dense as they were; a transparent ::after lets them answer on a
   44 px area. No section draws its own ::after on these elements. The map's zoom buttons simply get bigger (they float
   over the map and cost no row). Inline tags inside the rows of a list stay small on purpose: the same filters sit in the
   chip row above each list. */
.chip, .zm-chip, a.more, a.tl-more, .foot a, main summary, a.badge, #sec-mapa .zm-tbl button.nm { position: relative; }
.chip::after, .zm-chip::after, a.more::after, a.tl-more::after, .foot a::after, main summary::after, a.badge::after, #sec-mapa .zm-tbl button.nm::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 100%; height: 100%; min-width: var(--tap); min-height: var(--tap);
  transform: translate(-50%, -50%); }
/* A touch area must not take a press that falls inside a neighbour's own box:
   - chips wrap into rows 5-6 px apart: each chip keeps its own box (a transparent ::before over it, above the areas);
   - "zobacz wszystkie" sits 8 px under a list, a map-table name 7 px under the row above: these areas start 7 / 6 px
     above the control and take the rest of their 44 px below it, inside their own card / row;
   - a licence badge has other links 5 px away: its area grows 4 px each way (30 px), not 11. */
.chip::before, .zm-chip::before { content: ""; position: absolute; inset: -1px; z-index: 1; }
a.more::after { top: -7px; transform: translateX(-50%); }
#sec-mapa .zm-tbl button.nm::after { top: -6px; transform: translateX(-50%); }
a.badge::after { min-height: calc(100% + 10px); }
#sec-mapa .leaflet-bar a { width: var(--tap); height: var(--tap); line-height: var(--tap); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
