:root {
  --wood-1: #3a2a1a;
  --wood-2: #22180f;
  --wood-3: #140e08;
  --gold: #cfa95c;
  --gold-hi: #f1d79a;
  --gold-lo: #7a5a26;
  --cream: #eadcb8;
  --cream-dim: #b9a77f;
  --ink: #1c140c;
  --red: #a3262b;
  --green: #6f9a44;
  --sea: #1f4d5e;
  --shadow: 0 6px 24px rgba(0, 0, 0, .55);
  --serif: "EB Garamond", "Iowan Old Style", Georgia, serif;
  --caps: "Cinzel", "Trajan Pro", "EB Garamond", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #14262e; color: var(--cream); font-family: var(--serif); }
button { font: inherit; color: inherit; }

#map { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; cursor: default; touch-action: none; }
#map.grabbing { cursor: grabbing; }
.vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 58%, rgba(5, 10, 12, .55) 100%); }

/* ozdobna rama: ciemne drewno + złota listwa */
.frame {
  background:
    linear-gradient(180deg, rgba(255, 230, 170, .06), transparent 30%),
    repeating-linear-gradient(95deg, rgba(0, 0, 0, .06) 0 3px, transparent 3px 9px),
    linear-gradient(180deg, var(--wood-1), var(--wood-2));
  border: 1px solid var(--gold-lo);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .7), inset 0 0 0 3px rgba(207, 169, 92, .55), inset 0 0 0 4px rgba(0, 0, 0, .6), var(--shadow);
  border-radius: 3px;
}

/* ---- górny pasek ---- */
#topbar {
  position: fixed; top: 8px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 18px;
  padding: 6px 16px 6px 8px; max-width: calc(100vw - 16px);
  z-index: 10;
}
.realm { display: flex; align-items: center; gap: 10px; flex: none; }
.realm-shield svg { width: 34px; height: 38px; display: block; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .6)); }
.realm-shield path { fill: #fff; stroke: var(--gold); stroke-width: 2; }
.realm-shield { position: relative; }
.realm-shield::after { content: ""; position: absolute; left: 3px; right: 3px; top: 19px; bottom: 3px; background: var(--red); clip-path: polygon(0 0, 100% 0, 100% 10%, 85% 55%, 50% 100%, 15% 55%, 0 10%); }
.realm-name { display: flex; flex-direction: column; line-height: 1.05; }
.realm-title { font-family: var(--caps); font-weight: 700; font-size: 15px; letter-spacing: .06em; color: var(--gold-hi); text-shadow: 0 1px 0 #000; white-space: nowrap; }
.realm-sub { font-size: 12.5px; color: var(--cream-dim); font-style: italic; }
.resources { display: flex; gap: 6px; flex-wrap: nowrap; overflow: hidden; }
.res {
  display: flex; align-items: center; gap: 6px; padding: 3px 10px 3px 6px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .45), rgba(0, 0, 0, .25));
  border: 1px solid rgba(207, 169, 92, .35); border-radius: 2px; white-space: nowrap;
}
.res svg { width: 18px; height: 18px; flex: none; }
.res b { font-weight: 700; font-size: 15px; color: var(--cream); font-variant-numeric: tabular-nums; }
.res small { font-size: 11px; color: var(--cream-dim); text-transform: uppercase; letter-spacing: .05em; }
.d-short { display: none; }
.date-box {
  flex: none; font-family: var(--caps); font-weight: 700; font-size: 14px; color: var(--gold-hi);
  padding: 4px 12px; border: 1px solid rgba(207, 169, 92, .5); background: rgba(0, 0, 0, .4); border-radius: 2px; white-space: nowrap;
}

/* ---- wyszukiwarka ---- */
#search { position: fixed; top: 72px; left: 12px; width: 330px; z-index: 12; display: flex; align-items: center; padding: 5px 8px; }
#search .ico { width: 18px; height: 18px; fill: none; stroke: var(--gold); stroke-width: 2; flex: none; margin: 0 6px 0 2px; }
#search-input {
  flex: 1; background: rgba(0, 0, 0, .35); border: 1px solid rgba(207, 169, 92, .3); color: var(--cream);
  font: 16px var(--serif); padding: 5px 8px; outline: none; border-radius: 2px; min-width: 0;
}
#search-input:focus { border-color: var(--gold); }
#search-input::placeholder { color: #8d7d5d; font-style: italic; }
#search-results {
  position: absolute; top: 100%; left: 0; right: 0; margin: 4px 0 0; padding: 4px 0; list-style: none;
  max-height: 50vh; overflow: auto; display: none;
  background: linear-gradient(180deg, var(--wood-1), var(--wood-2)); border: 1px solid var(--gold-lo); box-shadow: var(--shadow);
}
#search-results.open { display: block; }
#search-results li { padding: 5px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
#search-results li small { color: var(--cream-dim); font-style: italic; text-align: right; }
#search-results li.active, #search-results li:hover { background: rgba(207, 169, 92, .2); }

/* ---- panel prowincji ---- */
#province {
  position: fixed; left: 12px; top: 124px; width: 370px; max-height: calc(100vh - 140px);
  display: flex; flex-direction: column; z-index: 11; transition: transform .25s ease, opacity .25s ease;
}
#province.hidden { transform: translateX(-110%); opacity: 0; pointer-events: none; }
#province .close {
  position: absolute; top: 6px; right: 8px; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; z-index: 2;
  background: radial-gradient(circle at 40% 35%, #c2423f, #6b1414); border: 1px solid var(--gold); font-size: 18px; line-height: 1; color: #fff;
}
.prov-head {
  display: flex; gap: 12px; align-items: center; padding: 14px 44px 12px 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--woj, #777) 55%, #000), color-mix(in srgb, var(--woj, #777) 25%, #000));
  border-bottom: 2px solid var(--gold-lo); margin: 4px 4px 0;
}
.shield { position: relative; width: 52px; height: 58px; flex: none; }
.shield svg { width: 100%; height: 100%; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .6)); }
.shield path { fill: var(--woj, #777); stroke: var(--gold-hi); stroke-width: 2; }
.shield span { position: absolute; inset: 0 0 6px; display: grid; place-items: center; font: 900 22px var(--caps); color: #fff; text-shadow: 0 2px 2px rgba(0, 0, 0, .7); }
.prov-titles h2 { margin: 0; font: 700 22px/1.1 var(--caps); color: #fff; text-shadow: 0 2px 2px #000; letter-spacing: .02em; }
#p-kind { color: var(--cream); font-style: italic; font-size: 14px; margin-top: 3px; opacity: .9; }
.tabs { display: flex; margin: 0 4px; border-bottom: 1px solid var(--gold-lo); }
.tabs button {
  flex: 1; padding: 6px 4px; cursor: pointer; background: rgba(0, 0, 0, .35); border: none; border-right: 1px solid rgba(207, 169, 92, .25);
  font: 600 13px var(--caps); letter-spacing: .04em; color: var(--cream-dim);
}
.tabs button:last-child { border-right: none; }
.tabs button.active { background: linear-gradient(180deg, rgba(207, 169, 92, .35), rgba(207, 169, 92, .1)); color: var(--gold-hi); }
.tabs button:disabled { opacity: .35; cursor: default; }
.prov-body { overflow: auto; padding: 12px 14px 14px; }
.prov-body::-webkit-scrollbar, #search-results::-webkit-scrollbar, #outliner-list::-webkit-scrollbar { width: 8px; }
.prov-body::-webkit-scrollbar-thumb, #search-results::-webkit-scrollbar-thumb, #outliner-list::-webkit-scrollbar-thumb { background: var(--gold-lo); border-radius: 4px; }

.section-title { font: 700 12px var(--caps); letter-spacing: .1em; color: var(--gold); text-transform: uppercase; margin: 14px 0 6px; display: flex; align-items: center; gap: 8px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--gold-lo), transparent); }
.section-title:first-child { margin-top: 0; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.stat { background: rgba(0, 0, 0, .3); border: 1px solid rgba(207, 169, 92, .22); padding: 6px 8px; border-radius: 2px; }
.stat small { display: block; font-size: 11px; color: var(--cream-dim); text-transform: uppercase; letter-spacing: .05em; }
.stat b { font-size: 19px; font-variant-numeric: tabular-nums; color: #fff; }
.stat i { font-size: 12px; color: var(--cream-dim); }

.dev { display: flex; gap: 6px; align-items: stretch; }
.dev-item { flex: 1; display: flex; align-items: center; gap: 6px; padding: 6px; background: rgba(0, 0, 0, .3); border: 1px solid rgba(207, 169, 92, .22); border-radius: 2px; }
.dev-item svg { width: 24px; height: 24px; flex: none; }
.dev-item b { font-size: 20px; color: #fff; }
.dev-item small { display: block; font-size: 10.5px; color: var(--cream-dim); line-height: 1; }
.dev-total { flex: none; width: 58px; display: grid; place-items: center; text-align: center; background: radial-gradient(circle, rgba(207, 169, 92, .35), rgba(0, 0, 0, .3)); border: 1px solid var(--gold); border-radius: 2px; }
.dev-total b { font: 900 24px var(--caps); color: var(--gold-hi); display: block; line-height: 1; }
.dev-total small { font-size: 10px; color: var(--cream); }
.note { font-size: 12.5px; color: var(--cream-dim); font-style: italic; margin: 6px 0 0; }

.rows { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 15px; }
.rows dt { color: var(--cream-dim); }
.rows dd { margin: 0; color: var(--cream); text-align: right; }
.link { color: var(--gold-hi); cursor: pointer; text-decoration: underline dotted rgba(241, 215, 154, .5); text-underline-offset: 3px; background: none; border: none; padding: 0; text-align: inherit; }
.link:hover { color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 13.5px; padding: 2px 8px; border: 1px solid rgba(207, 169, 92, .35); background: rgba(0, 0, 0, .3); border-radius: 10px; cursor: pointer; }
.chip:hover { border-color: var(--gold); background: rgba(207, 169, 92, .18); }
.chip .sw, .sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: 0; box-shadow: 0 0 0 1px rgba(0, 0, 0, .6); }

.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.bars li { position: relative; display: flex; justify-content: space-between; gap: 8px; padding: 3px 8px; font-size: 14px; cursor: pointer; border-radius: 2px; overflow: hidden; }
.bars li .bar { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, rgba(207, 169, 92, .32), rgba(207, 169, 92, .12)); z-index: 0; }
.bars li span, .bars li b { position: relative; z-index: 1; }
.bars li b { font-weight: 600; font-variant-numeric: tabular-nums; }
.bars li:hover { background: rgba(255, 255, 255, .06); }
.bars li.cur { outline: 1px solid var(--gold); }

/* ---- lista województw ---- */
#outliner { position: fixed; right: 12px; top: 72px; width: 250px; z-index: 9; padding: 4px; }
.outliner-head { width: 100%; display: flex; justify-content: space-between; padding: 5px 8px; background: rgba(0, 0, 0, .35); border: none; cursor: pointer; font: 700 13px var(--caps); letter-spacing: .08em; color: var(--gold-hi); }
#outliner.collapsed #outliner-list { display: none; }
#outliner.collapsed .chev { transform: rotate(-90deg); }
#outliner-list { list-style: none; margin: 4px 0 0; padding: 0; max-height: calc(100vh - 560px); min-height: 80px; overflow: auto; }
#outliner-list li { display: flex; align-items: center; gap: 6px; padding: 3px 8px; font-size: 14.5px; cursor: pointer; }
#outliner-list li:hover, #outliner-list li.cur { background: rgba(207, 169, 92, .18); }
#outliner-list li span.nm { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#outliner-list li b { font-weight: 600; font-size: 13px; color: var(--cream-dim); font-variant-numeric: tabular-nums; }

/* ---- legenda ---- */
#legend { position: fixed; left: 12px; bottom: 28px; z-index: 8; padding: 8px 12px 10px; min-width: 220px; max-width: 300px; }
#province:not(.hidden) ~ #legend { left: 394px; }
#legend h3 { margin: 0 0 6px; font: 700 13px var(--caps); letter-spacing: .08em; color: var(--gold-hi); }
#legend .ramp { height: 12px; border: 1px solid rgba(0, 0, 0, .7); border-radius: 1px; }
#legend .ticks { display: flex; justify-content: space-between; font-size: 12px; color: var(--cream-dim); margin-top: 2px; font-variant-numeric: tabular-nums; }
#legend ul { list-style: none; margin: 0; padding: 0; font-size: 14px; display: grid; gap: 2px; }
#legend li { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#legend li b { font-weight: 400; color: var(--cream-dim); font-size: 12.5px; font-variant-numeric: tabular-nums; }
#legend .sw { width: 12px; height: 12px; }
#legend p { margin: 6px 0 0; font-size: 12px; color: var(--cream-dim); font-style: italic; }

/* ---- róg: tryby + minimapa ---- */
#corner { position: fixed; right: 12px; bottom: 28px; z-index: 9; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#modes { display: grid; grid-template-columns: repeat(4, 44px); gap: 4px; padding: 7px; }
.mode-btn {
  width: 44px; height: 44px; cursor: pointer; position: relative; border-radius: 2px; padding: 0;
  background: linear-gradient(180deg, #5a4329, #2a1d11); border: 1px solid var(--gold-lo);
  box-shadow: inset 0 1px 0 rgba(255, 230, 170, .25), inset 0 -2px 4px rgba(0, 0, 0, .5);
  display: grid; place-items: center;
}
.mode-btn svg { width: 28px; height: 28px; }
.mode-btn:hover { border-color: var(--gold); filter: brightness(1.15); }
.mode-btn.active { border-color: var(--gold-hi); background: linear-gradient(180deg, #8a6a35, #4a3418); box-shadow: inset 0 0 0 1px var(--gold-hi), 0 0 10px rgba(241, 215, 154, .45); }
.mode-btn kbd { position: absolute; right: 2px; bottom: 0; font: 600 10px var(--serif); color: var(--cream-dim); }
.mini-wrap { position: relative; padding: 6px; line-height: 0; }
#minimap { width: 240px; height: 200px; cursor: pointer; border: 1px solid rgba(0, 0, 0, .8); background: var(--sea); }
.zoom-btns { position: absolute; left: -36px; bottom: 6px; display: flex; flex-direction: column; gap: 4px; }
.zoom-btns button {
  width: 30px; height: 30px; cursor: pointer; font: 700 18px/1 var(--serif); color: var(--gold-hi);
  background: linear-gradient(180deg, #5a4329, #2a1d11); border: 1px solid var(--gold-lo); border-radius: 50%; box-shadow: var(--shadow);
}
.zoom-btns button:hover { border-color: var(--gold-hi); }

/* ---- dymek ---- */
#tooltip {
  position: fixed; z-index: 30; pointer-events: none; display: none; max-width: 300px;
  padding: 7px 11px 8px; font-size: 14.5px; line-height: 1.3;
  background: linear-gradient(180deg, rgba(48, 35, 21, .97), rgba(24, 17, 10, .97));
  border: 1px solid var(--gold); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .6), var(--shadow); border-radius: 2px;
}
#tooltip .t-name { font: 700 16px var(--caps); color: var(--gold-hi); }
#tooltip .t-sub { color: var(--cream-dim); font-style: italic; font-size: 13px; }
#tooltip .t-val { margin-top: 3px; color: #fff; }
#tooltip .t-val b { color: var(--gold-hi); }

#credits { position: fixed; bottom: 4px; left: 50%; transform: translateX(-50%); font-size: 11.5px; color: rgba(234, 220, 184, .7); text-shadow: 0 1px 2px #000; white-space: nowrap; z-index: 7; pointer-events: none; }

#loading { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: #14262e; transition: opacity .5s; }
#loading.done { opacity: 0; pointer-events: none; }
.loading-box { padding: 18px 26px; font: 600 16px var(--caps); color: var(--gold-hi); display: flex; align-items: center; gap: 14px; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--gold-lo); border-top-color: var(--gold-hi); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- węższe ekrany ---- */
@media (max-width: 1100px) {
  #outliner { display: none; }
}
@media (max-width: 760px) {
  #topbar { top: 0; left: 0; right: 0; transform: none; border-radius: 0; gap: 8px; padding: 5px 8px; max-width: none; }
  .resources, .realm-sub { display: none; }
  .date-box { margin-left: auto; font-size: 12px; padding: 3px 8px; }
  #search { top: 56px; left: 8px; right: 8px; width: auto; }
  #province { left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 55vh; border-radius: 0; }
  #province.hidden { transform: translateY(110%); }
  #legend { left: 8px; bottom: 22px; min-width: 0; max-width: 46vw; padding: 6px 8px; }
  #province:not(.hidden) ~ #legend { display: none; }
  .mini-wrap { display: none; }
  #corner { right: 8px; bottom: 22px; }
  #modes { grid-template-columns: repeat(4, 38px); padding: 5px; }
  .mode-btn { width: 38px; height: 38px; }
  .mode-btn kbd { display: none; }
  #credits { font-size: 9.5px; white-space: normal; width: 100%; text-align: center; padding: 0 8px; line-height: 1.2; bottom: 2px; }
  .realm-title { font-size: 12.5px; letter-spacing: .02em; }
  .realm-shield svg { width: 26px; height: 30px; }
  .realm-shield::after { top: 15px; }
  .date-box { font-size: 11px; padding: 3px 6px; }
  .d-long { display: none; }
  .d-short { display: inline; }
  #corner, #legend { bottom: 34px; }
}

/* ---- miasta, budynki, kultura ---- */
.bars.static li { cursor: default; }
.bars.static li:hover { background: none; }
.towns { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.towns li { display: flex; justify-content: space-between; gap: 8px; font-size: 14.5px; padding: 3px 8px; background: rgba(0, 0, 0, .25); border: 1px solid rgba(207, 169, 92, .18); border-radius: 2px; }
.towns li i { color: var(--cream-dim); font-size: 13px; }
.towns li span:last-child { color: var(--cream-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bld { display: flex; gap: 10px; padding: 8px; margin-bottom: 6px; background: linear-gradient(180deg, rgba(0, 0, 0, .35), rgba(0, 0, 0, .2)); border: 1px solid rgba(207, 169, 92, .3); border-radius: 2px; }
.bld-ic { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--c); border: 2px solid #24160a; box-shadow: inset 0 0 0 2px rgba(241, 215, 154, .7), 0 2px 4px rgba(0, 0, 0, .5); }
.bld-ic svg { width: 24px; height: 24px; }
.bld-name { font: 700 15px var(--caps); color: var(--gold-hi); line-height: 1.2; }
.bld-meta { font-size: 12.5px; color: var(--cream-dim); margin: 2px 0 3px; }
.bld-meta .stars { color: #f0c24a; letter-spacing: 1px; }
.bld-meta .unesco { display: inline-block; padding: 0 5px; border: 1px solid rgba(120, 170, 220, .6); color: #a8cdf0; border-radius: 2px; font-size: 11px; letter-spacing: .04em; }
.bld-desc { font-size: 14px; line-height: 1.3; }
.bld-eff { margin-top: 4px; font-size: 13px; color: #9fd08a; }
#tooltip .t-eff { margin-top: 3px; color: #9fd08a; font-size: 13px; }

/* ---- przełącznik poziomu prowincji ---- */
#gran { display: flex; align-items: center; gap: 4px; padding: 5px 6px 5px 10px; }
#gran span { font: 700 11px var(--caps); letter-spacing: .08em; color: var(--cream-dim); text-transform: uppercase; margin-right: 4px; }
#gran button {
  cursor: pointer; padding: 4px 10px; font: 600 13px var(--caps); letter-spacing: .03em; color: var(--cream-dim);
  background: linear-gradient(180deg, #4a3721, #22180e); border: 1px solid var(--gold-lo); border-radius: 2px;
}
#gran button:hover { color: var(--cream); border-color: var(--gold); }
#gran button.active { color: var(--gold-hi); background: linear-gradient(180deg, #8a6a35, #4a3418); border-color: var(--gold-hi); box-shadow: 0 0 8px rgba(241, 215, 154, .35); }
@media (max-width: 760px) { #gran span { display: none; } #gran button { padding: 3px 8px; font-size: 12px; } }

/* ---- rozwój na karcie prowincji ---- */
.dv { display: flex; gap: 10px; align-items: stretch; }
.dv-medal { position: relative; flex: none; width: 92px; display: grid; place-items: center; text-align: center; }
.dv-medal svg { position: absolute; inset: 0; margin: auto; width: 92px; height: 92px; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .6)); }
.dv-medal path { fill: #6b4f22; stroke: var(--gold-hi); stroke-width: 2.5; }
.dv-medal::before { content: ""; position: absolute; width: 62px; height: 62px; left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #8a6a35, #3a2a12); box-shadow: inset 0 0 0 2px rgba(241, 215, 154, .8), inset 0 -6px 10px rgba(0, 0, 0, .5); z-index: 1; }
.dv-medal > div { position: relative; z-index: 2; line-height: 1; }
.dv-medal b { display: block; font: 900 28px var(--caps); color: var(--gold-hi); text-shadow: 0 2px 2px #000; }
.dv-medal small { display: block; font-size: 10px; color: var(--cream); text-transform: uppercase; letter-spacing: .08em; margin-top: 1px; }
.dv-medal em { position: absolute; left: 50%; transform: translateX(-50%); top: 58px; white-space: nowrap; font: italic 11.5px var(--serif); color: var(--cream-dim); }
.dv-medal.hl path { stroke: #fff; stroke-width: 4; }
.dv-rows { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dv-row { display: flex; align-items: center; gap: 7px; padding: 4px 5px 4px 4px; background: rgba(0, 0, 0, .3); border: 1px solid rgba(207, 169, 92, .22); border-left: 3px solid var(--c); border-radius: 2px; }
.dv-row.hl { background: rgba(207, 169, 92, .18); border-color: var(--gold); border-left-color: var(--c); box-shadow: 0 0 8px rgba(241, 215, 154, .25); }
.dv-ic { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 40% 35%, #4a3a26, #1c140b); box-shadow: inset 0 0 0 1px rgba(241, 215, 154, .6); }
.dv-ic svg { width: 19px; height: 19px; }
.dv-mid { flex: 1; min-width: 0; }
.dv-name { font: 700 11.5px var(--caps); letter-spacing: .05em; color: var(--cream); text-transform: uppercase; }
.dv-pips { display: flex; gap: 2px; margin: 3px 0 2px; }
.dv-pips i { flex: 1; height: 6px; max-width: 12px; background: rgba(0, 0, 0, .55); box-shadow: inset 0 0 0 1px rgba(207, 169, 92, .25); border-radius: 1px; }
.dv-pips i.on { background: linear-gradient(180deg, color-mix(in srgb, var(--c) 70%, #fff), var(--c)); box-shadow: 0 0 3px color-mix(in srgb, var(--c) 60%, transparent); }
.dv-src { font-size: 11.5px; color: var(--cream-dim); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-val { flex: none; width: 26px; text-align: right; font: 900 20px var(--caps); color: #fff; text-shadow: 0 1px 2px #000; }
.dv-plus { flex: none; width: 20px; height: 20px; border-radius: 50%; padding: 0; font: 700 14px/1 var(--serif); color: rgba(241, 215, 154, .45);
  background: linear-gradient(180deg, #3a2a18, #1c140b); border: 1px solid rgba(207, 169, 92, .3); cursor: not-allowed; }
.dv-split { display: flex; height: 6px; margin-top: 8px; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px rgba(0, 0, 0, .6); }
.dv-split span { display: block; }

/* ---- przełącznik części rozwoju w legendzie ---- */
.dev-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 8px; }
.dev-tabs button {
  display: flex; align-items: center; justify-content: center; gap: 5px; cursor: pointer; padding: 4px 6px;
  font: 600 12.5px var(--caps); color: var(--cream-dim); background: linear-gradient(180deg, #4a3721, #22180e);
  border: 1px solid var(--gold-lo); border-bottom: 2px solid var(--c); border-radius: 2px;
}
.dev-tabs button svg { width: 16px; height: 16px; }
.dev-tabs button:hover { color: var(--cream); border-color: var(--gold); border-bottom-color: var(--c); }
.dev-tabs button.active { color: var(--gold-hi); background: linear-gradient(180deg, #8a6a35, #4a3418); border-color: var(--gold-hi); border-bottom-color: var(--c); box-shadow: 0 0 8px rgba(241, 215, 154, .35); }
.section-title .sec-extra { order: 2; font: italic 12px var(--serif); letter-spacing: 0; text-transform: none; color: var(--cream-dim); }

/* dymki zasobów */
#tooltip.wide { max-width: 340px; }
#tooltip .t-row { display: flex; justify-content: space-between; gap: 14px; margin-top: 3px; font-size: 13.5px; }
#tooltip .t-row b { color: #fff; font-variant-numeric: tabular-nums; white-space: nowrap; }
#tooltip .t-row.pos b { color: #9fd08a; }
#tooltip .t-row.neg b { color: #ff8a7a; }
#tooltip .t-rule { font-size: 11.5px; color: var(--cream-dim); font-style: italic; margin: -1px 0 3px; }
#tooltip .t-src { margin-top: 6px; font-size: 11.5px; color: var(--cream-dim); font-style: italic; border-top: 1px solid rgba(207, 169, 92, .25); padding-top: 4px; }
#tooltip .t-src + .t-src { margin-top: 1px; border-top: none; padding-top: 0; }


/* ================= górny pasek w stylu gier strategicznych ================= */
#topbar {
  position: fixed; top: 4px; left: 4px; right: auto; transform: none; z-index: 10;
  display: flex; align-items: flex-start; gap: 0; padding: 0; max-width: calc(100vw - 280px);
  background: none; border: none; box-shadow: none;
}
.crest { flex: none; width: 124px; height: 134px; margin-right: -30px; position: relative; z-index: 2; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .65)); cursor: help; }
.crest svg { width: 100%; height: 100%; display: block; }
.tb-main { display: flex; flex-direction: column; align-items: flex-start; padding-top: 8px; min-width: 0; }
.tb-res {
  display: flex; align-items: center; height: 38px; padding: 0 14px 0 34px; max-width: 100%; overflow: hidden;
  background: linear-gradient(180deg, #2a3d56 0%, #16243a 55%, #0c1522 100%);
  border: 2px solid #c9a24f; border-left: none; border-radius: 0 21px 21px 0;
  box-shadow: inset 0 0 0 1px #000, inset 0 2px 0 rgba(255, 255, 255, .08), 0 3px 8px rgba(0, 0, 0, .6);
}
.tb-res .res {
  display: flex; align-items: center; gap: 7px; height: 100%; padding: 0 12px 0 6px; flex: none;
  background: none; border: none; border-radius: 0; box-shadow: none; cursor: help;
  border-right: 1px solid rgba(201, 162, 79, .28);
}
.tb-res .res:last-child { border-right: none; }
.tb-res .res:hover { background: linear-gradient(180deg, rgba(255, 220, 140, .12), transparent); }
.medal {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 40% 35%, #3a5072, #0c1522 75%);
  border: 2px solid #d9b05a; box-shadow: inset 0 0 0 1px #000, 0 1px 2px rgba(0, 0, 0, .8);
}
.medal svg { width: 19px; height: 19px; }
.tb-res .res b { font: 600 16px var(--serif); color: #fbf3df; text-shadow: 0 1px 2px #000; min-width: 22px; text-align: right; }
.tb-res .res .delta { font-size: 12.5px; }
.tb-res .res .badge { font-size: 15px; }
.tb-ribbon {
  position: relative; display: flex; align-items: center; gap: 10px; height: 30px; margin-left: 20px; padding: 0 30px 0 26px; min-width: 560px;
  background: linear-gradient(180deg, #34496a, #1a2a40 70%, #142033);
  border-top: 1px solid #0a0f18; border-bottom: 2px solid #9c7a36;
  clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 50%, 100% 100%, 0 100%);
  box-shadow: 0 3px 6px rgba(0, 0, 0, .5);
}
.tb-ribbon .realm-title { font: 600 18px var(--serif); letter-spacing: .01em; color: #fff; text-shadow: 0 1px 2px #000; text-transform: none; }
.tb-ribbon .realm-sub { font-size: 12.5px; color: #b9c4d4; font-style: italic; white-space: nowrap; }
.tb-points { margin-left: auto; display: flex; gap: 16px; }
.tb-points .pt { display: flex; align-items: center; gap: 5px; cursor: help; }
.tb-points .pt svg { width: 19px; height: 19px; filter: drop-shadow(0 1px 1px #000); }
.tb-points .pt b { font: 600 15px var(--serif); color: #fff; text-shadow: 0 1px 2px #000; font-variant-numeric: tabular-nums; }
.tb-banners { display: flex; gap: 5px; margin: 2px 0 0 36px; }
.banner {
  width: 36px; height: 48px; display: grid; justify-items: center; align-content: start; padding-top: 7px; cursor: help;
  background: linear-gradient(180deg, #5c9a44, #2f6424 80%); border: 1px solid #13240c;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18), 0 3px 5px rgba(0, 0, 0, .55);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 83% 86%, 67% 100%, 50% 86%, 33% 100%, 17% 86%, 0 100%);
}
.banner.bad { background: linear-gradient(180deg, #b8362f, #6f1612 80%); border-color: #2a0806; }
.banner svg { width: 22px; height: 22px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .8)); }
.banner:hover { filter: brightness(1.15); }

/* wstęga z datą (prawy górny róg) */
#era {
  position: fixed; top: 10px; right: 12px; z-index: 10; display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 16px 0 2px;
  background: linear-gradient(180deg, #34496a, #16243a); border: 2px solid #c9a24f; border-radius: 18px 3px 3px 18px;
  box-shadow: inset 0 0 0 1px #000, 0 3px 8px rgba(0, 0, 0, .6);
  font: 600 16px var(--serif); color: #fff; text-shadow: 0 1px 2px #000; white-space: nowrap;
}
.era-medal { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 40% 35%, #fff0b0, #c9962e 70%, #6e4a12); border: 1px solid #3a2606; }
.era-medal svg { width: 20px; height: 20px; }

/* elementy przesunięte, żeby nie kolidowały z herbem */
#search { top: 52px; left: auto; right: 12px; width: 262px; }
#outliner { top: 98px; }
#outliner-list { max-height: calc(100vh - 590px); }
#province { top: 150px; max-height: calc(100vh - 166px); }

@media (max-width: 1400px) { .tb-ribbon { min-width: 480px; } .tb-res .res { padding: 0 9px 0 5px; } }
@media (max-width: 1100px) { #topbar { max-width: calc(100vw - 8px); } .tb-points, .tb-banners { display: none; } }
@media (max-width: 760px) {
  #topbar { top: 2px; left: 2px; max-width: calc(100vw - 4px); }
  .crest { width: 66px; height: 72px; margin-right: -18px; }
  .tb-main { padding-top: 4px; }
  .tb-res { height: 32px; padding: 0 8px 0 22px; }
  .tb-res .res:nth-child(n+4) { display: none; }
  .tb-res .res { padding: 0 7px 0 4px; gap: 5px; }
  .medal { width: 24px; height: 24px; } .medal svg { width: 15px; height: 15px; }
  .tb-res .res b { font-size: 13.5px; } .tb-res .res .delta { display: none; }
  .tb-ribbon { min-width: 0; height: 24px; margin-left: 12px; padding: 0 22px 0 14px; }
  .tb-ribbon .realm-title { font-size: 14px; }
  .tb-ribbon .realm-sub { display: none; }
  #era { display: none; }
  #search { top: 78px; left: 8px; right: 8px; width: auto; }
}
.res .delta { color: #b9c4d4; font-variant-numeric: tabular-nums; white-space: nowrap; }
.res .delta.neg { color: #ff8a7a; }
.res.warn b { color: #ffb38a; }
.res .badge { padding: 0 6px; border-radius: 2px; min-width: 28px; text-align: center; border: 1px solid rgba(0, 0, 0, .7); }
.res .badge.pos { background: linear-gradient(180deg, #4f8a3a, #2f5a22); color: #eaffd8; }
.res .badge.neg { background: linear-gradient(180deg, #a3262b, #6b1414); color: #ffe0d8; }
.res .badge.zero { background: linear-gradient(180deg, #6b5a40, #3a2f20); }
.res small { display: none; }
@media (max-width: 1400px) { .tb-res .res.opt1 { display: none; } }
@media (max-width: 1220px) { .tb-res .res.opt2 { display: none; } }
.gran-sep { width: 1px; align-self: stretch; margin: 2px 4px; background: rgba(207, 169, 92, .35); }
#mil-toggle.active { color: var(--gold-hi); background: linear-gradient(180deg, #4f5a2a, #2c3416); border-color: var(--gold-hi); }
/* medaliony budynków w panelu – większe, ze złotą obręczą */
.bld-ic { width: 52px; height: 52px; border: 3px solid #d8a942; background: radial-gradient(circle at 38% 32%, color-mix(in srgb, var(--c) 60%, #fff), var(--c) 55%, color-mix(in srgb, var(--c) 55%, #000)); box-shadow: inset 0 0 0 1.5px #1a1008, 0 0 0 1.5px #1a1008, 0 3px 6px rgba(0, 0, 0, .55); }
.bld-ic svg { width: 32px; height: 32px; filter: drop-shadow(1px 1.5px 0 rgba(0, 0, 0, .55)); }
/* stolica w panelu: korona przy nazwie i złota tarcza */
#p-name.capital::before { content: "♛ "; color: #ffd860; text-shadow: 0 0 8px rgba(255, 210, 90, .9), 0 2px 2px #000; }
#province:has(#p-name.capital) .shield path { stroke: #ffd860; stroke-width: 3; }

/* lista po prawej: dwie zwijane sekcje (województwa, wojsko) */
#outliner { max-height: calc(100vh - 470px); overflow: auto; display: flex; flex-direction: column; gap: 4px; }
#outliner::-webkit-scrollbar { width: 8px; } #outliner::-webkit-scrollbar-thumb { background: var(--gold-lo); border-radius: 4px; }
#outliner.collapsed #outliner-list { display: revert; }
.ol-sec.collapsed .ol-list { display: none !important; }
.ol-sec.collapsed .chev { transform: rotate(-90deg); }
.chev { transition: transform .15s; }
.ol-list { list-style: none; margin: 4px 0 0; padding: 0; max-height: none !important; min-height: 0 !important; overflow: visible !important; }
.ol-list li { display: flex; align-items: center; gap: 6px; padding: 3px 8px; font-size: 14.5px; cursor: pointer; }
.ol-list li:hover, .ol-list li.cur { background: rgba(207, 169, 92, .18); }
.ol-list li span.nm { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ol-list li span.nm i { color: var(--cream-dim); font-size: 12.5px; }
.ol-list li b { font-weight: 600; font-size: 13px; color: var(--cream-dim); font-variant-numeric: tabular-nums; }
#outliner-mil li b { min-width: 22px; text-align: center; padding: 0 4px; color: #fff4d8; background: #0f1824; border: 1px solid #d9b05a; border-radius: 3px; font-size: 12.5px; }
#outliner-mil li.forming b { border-style: dashed; opacity: .8; }
.mil-sw { flex: none; width: 12px; height: 14px; clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .6); }
#outliner { max-height: calc(100vh - 575px); min-height: 90px; }
#bld-toggle.active { color: var(--gold-hi); background: linear-gradient(180deg, #6a4a7a, #3a2446); border-color: var(--gold-hi); }
/* stopka ze źródłami: między legendą a rogiem z minimapą, może zawinąć się do 2 linii */
#credits { font-size: 10.5px; white-space: normal; text-align: center; line-height: 1.25; max-width: calc(100vw - 660px); }
@media (max-width: 760px) { #credits { max-width: none; } }
@media (max-width: 1100px) { #outliner { display: none; } }

/* przycisk „i” obok daty i panel źródeł danych */
#credits { display: none; }
#era { padding-right: 4px; }
#info-btn {
  width: 26px; height: 26px; margin-left: 2px; border-radius: 50%; cursor: pointer; padding: 0; display: grid; place-items: center;
  font: italic 700 16px/1 Georgia, var(--serif); color: #3a2606; text-shadow: 0 1px 0 rgba(255, 255, 255, .4);
  background: radial-gradient(circle at 40% 35%, #fff0b0, #c9962e 70%, #6e4a12); border: 1px solid #3a2606; box-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}
#info-btn:hover, #info-btn.active { filter: brightness(1.15); box-shadow: 0 0 0 2px rgba(255, 227, 138, .6), 0 1px 2px rgba(0, 0, 0, .6); }
#info-panel { position: fixed; top: 52px; right: 12px; width: 360px; max-width: calc(100vw - 24px); max-height: calc(100vh - 70px); overflow: auto; z-index: 25; padding: 12px 16px 14px; }
#info-panel.hidden { display: none; }
#info-panel h3 { margin: 0 0 8px; font: 700 14px var(--caps); letter-spacing: .08em; color: var(--gold-hi); }
#info-panel ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
#info-panel li { font-size: 14px; line-height: 1.3; }
#info-panel li span { display: block; font-size: 12.5px; color: var(--cream-dim); font-style: italic; }
#info-panel a { color: var(--gold-hi); text-decoration: underline dotted rgba(241, 215, 154, .5); text-underline-offset: 3px; }
#info-panel a:hover { color: #fff; }
#info-panel .note { margin-top: 10px; }
@media (max-width: 760px) { #era { display: flex; top: 4px; right: 4px; height: 28px; font-size: 0; padding: 0 3px; gap: 0; } #era .era-medal, #era #date { display: none; } #info-panel { top: 40px; } }

/* ===== telefon: elementy interfejsu nie zachodzą na siebie ===== */
@media (max-width: 760px) {
  #era { top: 42px; right: 6px; }
  #gran { position: fixed; left: 8px; right: 8px; bottom: 26px; justify-content: center; padding: 4px 6px; }
  #gran .lbl { display: none; }
  #gran button { padding: 4px 10px; font-size: 12.5px; }
  #mil-toggle, #bld-toggle { min-width: 40px; font-size: 15px; }
  #corner { bottom: 72px; }
  #legend { bottom: 72px; left: 8px; max-width: calc(100vw - 200px); max-height: 30vh; overflow: auto; padding: 6px 9px 8px; }
  #legend h3 { font-size: 12px; margin-bottom: 4px; }
  #legend p { display: none; }
  #legend ul { font-size: 12.5px; }
  #legend .dev-tabs { grid-template-columns: 1fr; }
}

/* przycisk muzyki obok „i” */
#music-btn {
  position: relative; width: 26px; height: 26px; margin-left: 4px; border-radius: 50%; cursor: pointer; padding: 0; display: grid; place-items: center; color: #3a2606;
  background: radial-gradient(circle at 40% 35%, #fff0b0, #c9962e 70%, #6e4a12); border: 1px solid #3a2606; box-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}
#music-btn svg { width: 15px; height: 15px; }
#music-btn:hover { filter: brightness(1.15); box-shadow: 0 0 0 2px rgba(255, 227, 138, .6), 0 1px 2px rgba(0, 0, 0, .6); }
#music-btn.off { filter: grayscale(.85) brightness(.8); }
#music-btn.off::after { content: ""; position: absolute; left: 4px; right: 4px; top: 50%; height: 2px; background: #3a2606; transform: rotate(-45deg); border-radius: 1px; }

/* ekran startowy z przyciskiem „Wejdź” (gdy przeglądarka blokuje autoodtwarzanie dźwięku) */
#loading.ready { cursor: pointer; background: radial-gradient(ellipse at center, rgba(20,38,46,.55), rgba(10,18,24,.92)); }
#loading.ready .loading-box { flex-direction: column; gap: 16px; padding: 28px 44px 20px; text-align: center; }
.enter-title { font: 700 26px var(--caps); letter-spacing: .06em; color: var(--gold-hi); text-shadow: 0 2px 0 #000; }
.enter-btn { font: 700 20px var(--caps); letter-spacing: .08em; color: #2a1a04; padding: 10px 46px; border-radius: 4px; cursor: pointer;
  background: linear-gradient(#ffe9a8, #d8a942 55%, #8a6420); border: 2px solid #4a3008; box-shadow: 0 0 0 2px #d8b36a, 0 6px 18px rgba(0,0,0,.6); }
.enter-btn:hover, .enter-btn:focus-visible { filter: brightness(1.12); outline: none; }
.enter-mute { font: italic 15px "EB Garamond", serif; color: #c9b48a; background: none; border: 0; cursor: pointer; text-decoration: underline; opacity: .8; }
.enter-mute:hover { opacity: 1; color: var(--gold-hi); }

/* ---- okno państwa (klik w herb) ---- */
.crest.realm { cursor: pointer; }
.crest.realm:hover, .crest.realm.active { filter: drop-shadow(0 0 8px rgba(255, 216, 120, .55)) drop-shadow(0 4px 6px rgba(0, 0, 0, .65)); }
.crest.realm:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: -10px; border-radius: 50%; }
#country { position: fixed; left: 12px; top: 150px; width: 470px; max-width: calc(100vw - 24px); max-height: calc(100vh - 166px); display: flex; flex-direction: column; z-index: 14; transition: transform .25s ease, opacity .25s ease; }
#country.hidden { transform: translateY(-12px); opacity: 0; pointer-events: none; visibility: hidden; }
#country .close { position: absolute; top: 6px; right: 8px; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; z-index: 2;
  background: radial-gradient(circle at 40% 35%, #c2423f, #6b1414); border: 1px solid var(--gold); font-size: 18px; line-height: 1; color: #fff; }
.cty-head { display: flex; gap: 12px; align-items: center; padding: 12px 44px 10px 14px; margin: 4px 4px 0; border-bottom: 2px solid var(--gold-lo);
  background: linear-gradient(180deg, #6b1a1e, #2a0c0e); }
.cty-head h2 { margin: 0; font: 700 19px var(--caps); color: var(--gold-hi); letter-spacing: .04em; text-shadow: 0 2px 0 #000; }
.cty-sub { font-size: 13.5px; color: var(--cream-dim); font-style: italic; }
.cty-flag { flex: none; width: 34px; height: 22px; border: 1px solid var(--gold); box-shadow: 0 0 0 1px #000; background: linear-gradient(#f4f1ea 50%, #c4232c 50%); }
#cty-tabs button { flex: 1; }

.court { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.person { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 1px; padding: 8px 6px 9px; background: rgba(0, 0, 0, .3); border: 1px solid rgba(207, 169, 92, .25); border-radius: 2px; min-width: 0; }
.cameo { display: block; width: 74px; height: 88px; border-radius: 4px; border: 2px solid var(--gold); box-shadow: 0 0 0 1px #000, inset 0 0 14px rgba(0, 0, 0, .7); overflow: hidden; background: radial-gradient(ellipse at 50% 30%, #4b5d7a, #141b28); flex: none; }
.cameo svg { width: 100%; height: 100%; display: block; }
.cameo path { fill: #d8b36a; opacity: .82; }
.cameo.c-pres { background: radial-gradient(ellipse at 50% 30%, #b0353a, #3a0a0c); border-color: #ffd860; }
.cameo.c-prem { background: radial-gradient(ellipse at 50% 30%, #3f5f8a, #111a2a); }
.cameo.c-heir { background: radial-gradient(ellipse at 50% 30%, #5a5a6a, #18181f); }
.cameo.c-adm { background: radial-gradient(ellipse at 50% 30%, #7a6a2a, #221a08); }
.cameo.c-dip { background: radial-gradient(ellipse at 50% 30%, #2f6f6a, #0a1f1d); }
.cameo.c-mil { background: radial-gradient(ellipse at 50% 30%, #5a6a3a, #161c0c); }
.person .role, .adv .role { font: 700 10.5px var(--caps); letter-spacing: .1em; text-transform: uppercase; color: var(--gold); margin-top: 5px; }
.adv .role { margin-top: 0; }
.pname { font: 700 15.5px var(--serif); color: #fff; line-height: 1.15; }
.poffice { font-size: 12.5px; color: var(--cream); line-height: 1.2; }
.pmeta { font-size: 12px; color: var(--cream-dim); font-style: italic; line-height: 1.25; }
.pparty { font-size: 12px; color: var(--cream-dim); margin-top: 2px; }
.term { display: block; width: 90%; height: 6px; margin: 4px auto 1px; background: rgba(0, 0, 0, .55); border: 1px solid var(--gold-lo); border-radius: 3px; overflow: hidden; }
.term i { display: block; height: 100%; background: linear-gradient(90deg, #8a6420, #f1d79a); }
.advisors { display: grid; gap: 6px; }
.adv { display: flex; gap: 10px; align-items: center; padding: 6px 8px; background: rgba(0, 0, 0, .3); border: 1px solid rgba(207, 169, 92, .25); border-radius: 2px; }
.adv .cameo { width: 52px; height: 62px; }
.adv-ic { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 40% 35%, #4a3a22, #1a120a); border: 1px solid var(--gold); }
.adv-ic svg { width: 19px; height: 19px; }
.adv-txt { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.adv-res { font-size: 12.5px; color: #cfe0b0; line-height: 1.25; margin-top: 2px; }
.cty-note { font-size: 12.5px; font-style: italic; color: var(--cream-dim); margin: 6px 2px 0; line-height: 1.3; }
.cty-line { margin: 0 0 6px; font-size: 14px; }
.cty-src { margin-top: 12px; font-size: 11.5px; color: var(--cream-dim); line-height: 1.35; }
.cty-src a { color: var(--gold-hi); text-decoration: underline dotted rgba(241, 215, 154, .5); }
.mixbar { display: flex; height: 12px; border: 1px solid var(--gold-lo); border-radius: 2px; overflow: hidden; box-shadow: 0 0 0 1px #000; }
.mixbar i { display: block; height: 100%; }
.mixleg { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 5px; font-size: 12.5px; color: var(--cream-dim); }
.chip.static { cursor: default; }
.chip.static:hover { border-color: rgba(207, 169, 92, .35); background: rgba(0, 0, 0, .3); }
.chip i { color: var(--cream-dim); font-size: 12px; }
.ledger { background: rgba(0, 0, 0, .3); border: 1px solid rgba(207, 169, 92, .22); padding: 4px 10px; border-radius: 2px; }
.ledger .t-row { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 14px; border-bottom: 1px solid rgba(207, 169, 92, .12); }
.ledger .t-row:last-child { border-bottom: 0; }
.ledger .t-row.pos b { color: #a8e07a; } .ledger .t-row.neg b { color: #ff9a88; }
.ledger .t-row.sum { font-weight: 700; border-top: 1px solid var(--gold-lo); }
@media (max-width: 760px) {
  #country { left: 6px; right: 6px; width: auto; top: 80px; max-height: calc(100vh - 160px); }
  .court { gap: 5px; }
  .person .cameo { width: 58px; height: 70px; }
  .pname { font-size: 14px; }
  .poffice { font-size: 11.5px; }
}
body:has(#country:not(.hidden)) #province { visibility: hidden; }
@media (max-width: 760px) {
  .cty-head h2 { font-size: 16px; }
  .cty-head { padding: 10px 44px 8px 10px; }
  .adv-ic { display: none; }
  #country { max-height: calc(100vh - 90px); }
}
.cameo.photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; display: block; filter: sepia(.18) saturate(.92) contrast(1.03); }
.cameo.photo { box-shadow: 0 0 0 1px #000, 0 3px 8px rgba(0, 0, 0, .55); position: relative; }
.cameo.photo::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 10px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(255, 230, 170, .25); pointer-events: none; }

/* bilans budżetu w zakładce „Gospodarka” – jak okno gospodarki w grach */
#country { width: 540px; }
.bs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bs-col { background: rgba(0, 0, 0, .35); border: 1px solid rgba(207, 169, 92, .3); border-radius: 2px; padding: 0 0 6px; min-width: 0; box-shadow: inset 0 0 12px rgba(0, 0, 0, .5); }
.bs-head { font: 700 13px var(--caps); letter-spacing: .08em; text-align: center; color: #f4e6c8; padding: 4px 0 5px; margin-bottom: 4px; border-bottom: 1px solid #000;
  background: linear-gradient(180deg, #8a2a26, #4a1210); box-shadow: inset 0 1px 0 rgba(255, 200, 170, .25); }
.bs-row { position: relative; display: grid; grid-template-columns: 1fr auto auto; align-items: baseline; gap: 5px; padding: 2px 8px 3px; font-size: 13px; line-height: 1.2; cursor: help; }
.bs-row:hover { background: rgba(207, 169, 92, .12); }
.bs-n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--cream); }
.bs-p { font-size: 11.5px; color: var(--cream-dim); font-variant-numeric: tabular-nums; }
.bs-row b { font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; }
.bs-col.inc .bs-row b { color: #a8e07a; }
.bs-col.exp .bs-row b { color: #ff9a88; }
.bs-row i { position: absolute; left: 8px; bottom: 0; height: 2px; max-width: calc(100% - 16px); opacity: .55; }
.bs-col.inc .bs-row i { background: linear-gradient(90deg, #6f9a44, transparent); }
.bs-col.exp .bs-row i { background: linear-gradient(90deg, #a3262b, transparent); }
.bs-total { display: flex; justify-content: space-between; gap: 6px; margin: 6px 6px 0; padding: 4px 8px; font: 700 13px var(--caps); letter-spacing: .03em;
  background: linear-gradient(180deg, #2a2218, #15100a); border: 1px solid var(--gold-lo); box-shadow: inset 0 0 0 1px #000; }
.bs-col.inc .bs-total b { color: #a8e07a; } .bs-col.exp .bs-total b { color: #ff9a88; }
.bs-bottom { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; margin-top: 8px; align-items: stretch; }
.bs-mini { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px 10px; background: rgba(0, 0, 0, .35); border: 1px solid rgba(207, 169, 92, .3); border-radius: 2px; cursor: help; }
.bs-mini span svg { width: 22px; height: 22px; display: block; }
.bs-mini b { font-size: 15px; font-variant-numeric: tabular-nums; }
.bs-mini small { font-size: 10.5px; color: var(--cream-dim); text-transform: uppercase; letter-spacing: .05em; }
.bs-balance { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 12px; padding: 6px 14px; border: 2px solid var(--gold); border-radius: 3px;
  background: linear-gradient(180deg, #2c2418, #120d08); box-shadow: inset 0 0 0 1px #000, inset 0 0 16px rgba(0, 0, 0, .7), 0 0 0 1px #000; }
.bs-balance span { font: 700 18px var(--caps); color: var(--gold-hi); }
.bs-balance b { font: 700 26px var(--serif); text-align: right; font-variant-numeric: tabular-nums; }
.bs-balance.neg b { color: #ff8a7a; } .bs-balance.pos b { color: #a8e07a; }
.bs-balance small { grid-column: 1 / -1; text-align: right; font-size: 12px; color: var(--cream-dim); font-style: italic; }
@media (max-width: 760px) {
  #country { width: auto; }
  .bs { grid-template-columns: 1fr; }
  .bs-bottom { grid-template-columns: 1fr 1fr; }
  .bs-balance { grid-column: 1 / -1; }
}

/* zakładka „Handel” */
.tr-sum { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.tr-box { display: flex; flex-direction: column; align-items: center; padding: 6px 4px 7px; border: 1px solid rgba(207, 169, 92, .35); border-radius: 2px;
  background: linear-gradient(180deg, #2a2218, #120d08); box-shadow: inset 0 0 0 1px #000, inset 0 0 12px rgba(0, 0, 0, .6); }
.tr-box small { font: 700 11px var(--caps); letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.tr-box b { font: 700 22px var(--serif); font-variant-numeric: tabular-nums; line-height: 1.1; }
.tr-box span { font-size: 12px; color: var(--cream-dim); }
.tr-box.e b { color: #a8e07a; } .tr-box.m b { color: #ff9a88; }
.tr-box.s { border-color: var(--gold); } .tr-box.s.neg b { color: #ff8a7a; } .tr-box.s.pos b { color: #a8e07a; }
.dyn { font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dyn.up { color: #a8d88a; } .dyn.down { color: #ff9a88; }
.tr-legend { display: flex; gap: 14px; margin: 8px 2px 0; font-size: 12px; color: var(--cream-dim); }
.tr-legend i, .tr-bars i { display: inline-block; height: 4px; border-radius: 2px; }
.tr-legend i { width: 16px; margin-right: 5px; vertical-align: 3px; }
.tr-legend i.e, .tr-bars i.e { background: #7fb85a; } .tr-legend i.m, .tr-bars i.m { background: #c4524a; }
.tr-legend .r { margin-left: auto; }
.tr-list { background: rgba(0, 0, 0, .3); border: 1px solid rgba(207, 169, 92, .22); border-radius: 2px; padding: 2px 0; }
.tr-row { display: grid; grid-template-columns: 1fr auto 52px; align-items: baseline; column-gap: 8px; padding: 4px 9px 5px; font-size: 13.5px; border-bottom: 1px solid rgba(207, 169, 92, .1); }
.tr-row:last-child { border-bottom: 0; }
.tr-row[title]:not([title=""]) { cursor: help; }
.tr-n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-v { font-size: 12.5px; color: var(--cream-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tr-row > b { text-align: right; font-variant-numeric: tabular-nums; font-size: 13.5px; }
.tr-row b.pos, .tr-side b.pos { color: #a8e07a; } .tr-row b.neg, .tr-side b.neg { color: #ff9a88; }
.tr-row .na { text-align: right; color: var(--cream-dim); font-size: 12px; }
.tr-bars { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 2px; margin-top: 3px; }
.tr-bars i { min-width: 1px; }
.tr-row.k { cursor: pointer; }
.tr-row.k:hover, .tr-row.k.open { background: rgba(207, 169, 92, .12); }
.tr-row.k:focus-visible { outline: 1px solid var(--gold-hi); outline-offset: -1px; }
.iso { display: inline-block; min-width: 24px; margin-right: 7px; padding: 0 3px; font: 700 10px/15px var(--serif); letter-spacing: .04em; text-align: center; color: #1c140c;
  background: linear-gradient(180deg, #e8d29a, #b8964e); border-radius: 2px; box-shadow: 0 0 0 1px #000; vertical-align: 1px; }
.tr-detail { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 7px; cursor: default; }
.tr-side { display: flex; flex-direction: column; padding: 5px 7px; background: rgba(0, 0, 0, .4); border: 1px solid rgba(207, 169, 92, .25); border-radius: 2px; }
.tr-side small { font: 700 10.5px var(--caps); letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.tr-side b { font-size: 15.5px; font-variant-numeric: tabular-nums; }
.tr-side span { font-size: 11.5px; color: var(--cream-dim); line-height: 1.25; }
.tr-side.none b { color: var(--cream-dim); }
@media (max-width: 760px) {
  .tr-box b { font-size: 18px; }
  .tr-detail { grid-template-columns: 1fr 1fr; }
  .tr-detail .bal { grid-column: 1 / -1; }
}

/* ikonki zakładek okna państwa */
#cty-tabs button { display: flex; align-items: center; justify-content: center; gap: 6px; }
.tab-ic { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #4a3a22, #1a120a); box-shadow: 0 0 0 1px #000, 0 0 0 2px rgba(207, 169, 92, .45); }
.tab-ic svg { width: 19px; height: 19px; display: block; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .6)); }
#cty-tabs button:not(.active) .tab-ic { filter: saturate(.55) brightness(.85); }
#cty-tabs button:hover .tab-ic, #cty-tabs button.active .tab-ic { filter: none; box-shadow: 0 0 0 1px #000, 0 0 0 2px var(--gold), 0 0 6px rgba(255, 216, 120, .35); }
@media (max-width: 760px) {
  #cty-tabs button { flex-direction: column; gap: 2px; padding: 5px 2px 4px; font-size: 11.5px; letter-spacing: .02em; }
  .tab-ic { width: 24px; height: 24px; }
}
.tr-n .flag { width: 20px; height: 15px; margin-right: 7px; vertical-align: -2px; border-radius: 2px; object-fit: cover; box-shadow: 0 0 0 1px rgba(0, 0, 0, .8), 0 0 0 2px rgba(207, 169, 92, .35); }
