:root {
  --p: #f4e8d0;
  --pd: #e8d9b8;
  --ink: #3a2817;
  --il: #5c4328;
  --g: #b8860b;
  --gl: #d4a84b;
  --w: #6b4423;
  --wd: #3d2817;
  --gr: #4a6b3a;
  --rd: #b33a2a;
  --sh: rgba(58, 40, 23, 0.4);
  /* (28.4) Dostepnosc — skala czcionki (0.9/1.0/1.1) ustawiana z panelu. */
  --font-scale: 1;
}

/* (28.4) Tryb wysokiego kontrastu — jasniejszy tekst + zloto, ciemniejsze tlo.
   html.high-contrast ma wyzsza specyficznosc niz :root, wiec nadpisuje zmienne
   takze z noweui.css niezaleznie od kolejnosci ladowania. */
html.high-contrast {
  --p: #ffffff;
  --pd: #f2f2f2;
  --gl: #ffe07a;
  --g: #ffcf3a;
  --nu-text: #ffffff;
  --nu-text-dim: #e0d2b0;
  --nu-gold: #ffd84a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Inline resource icon — renderowana wszędzie przez RI z config.js */
.res-icon {
  width: 2.15em;
  height: 2.15em;
  vertical-align: -0.2em;
  object-fit: contain;
  image-rendering: auto;
}

html, body {
  height: 100%;
  font-family: 'Philosopher', serif;
  color: var(--ink);
  background: #1a2a10;
  /* (28.4) Bazowy rozmiar skalowany przez --font-scale (dostepnosc). Skaluje
     tekst em/rem-based; elementy z twardym px pozostaja (akceptowalne dla MVP). */
  font-size: calc(14px * var(--font-scale, 1));
  overflow: hidden;  /* only inner containers scroll, not the page itself */
}

.game {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.main {
  display: flex;
  flex: 1;
  overflow: hidden;
  z-index: 2;
  min-height: 0;  /* allow flex children to shrink below content size */
}

.center {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Right army panel */
.ap {
  width: 230px;
  min-width: 230px;
  background: linear-gradient(180deg, rgba(61, 40, 23, 0.93), rgba(61, 40, 23, 0.97));
  border-left: 3px solid var(--g);
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.apt {
  font-family: 'Almendra', serif;
  font-size: 17px;
  color: var(--gl);
  text-align: center;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(184, 134, 11, 0.4);
}

.au {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(244, 232, 208, 0.08);
  border: 1px solid rgba(184, 134, 11, 0.25);
  border-radius: 3px;
  padding: 6px 8px;
}

.au-n {
  font-family: 'Almendra', serif;
  font-size: 14px;
  color: var(--p);
  display: flex;
  align-items: center;
  gap: 4px;
}

.au-c {
  font-size: 15px;
  font-weight: 700;
  color: var(--gl);
}

.au-s {
  display: flex;
  gap: 4px;
  font-size: 11px;
  color: rgba(244, 232, 208, 0.5);
}

.atot {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(184, 134, 11, 0.4);
  text-align: center;
  font-size: 12px;
  color: var(--p);
}

.atot .v {
  font-size: 15px;
  font-weight: 700;
  color: var(--gl);
  display: block;
  margin-top: 2px;
}

.wi {
  background: rgba(244, 232, 208, 0.06);
  border: 1px solid rgba(184, 134, 11, 0.2);
  border-radius: 3px;
  padding: 6px;
  text-align: center;
  font-size: 12px;
  color: rgba(244, 232, 208, 0.6);
}

.wi .b {
  color: var(--gl);
  font-size: 14px;
  font-weight: 700;
}

.bonus-info {
  font-size: 11px;
  color: rgba(244, 232, 208, 0.4);
  text-align: center;
  padding: 3px;
}

.march-list { margin-top: 4px; }

.march-item {
  background: rgba(244, 232, 208, 0.06);
  border: 1px solid rgba(184, 134, 11, 0.2);
  border-radius: 3px;
  padding: 5px 7px;
  font-size: 12px;
  color: var(--p);
  margin-bottom: 3px;
}

.march-item .mt-type {
  font-weight: 700;
  color: var(--gl);
}

/* Nadchodzace marsze: atak/grabiez = czerwony border, wsparcie = zielony. */
.march-item.mi-neg {
  border-color: rgba(196, 68, 68, 0.55);
  background: rgba(120, 30, 30, 0.18);
}
.march-item.mi-neg .mt-type { color: #e88; }
.march-item.mi-pos {
  border-color: rgba(120, 196, 100, 0.45);
  background: rgba(40, 90, 30, 0.15);
}
.march-item.mi-pos .mt-type { color: #b0d68c; }
.incoming-list { margin-top: 8px; }

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--wd);
  color: var(--p);
  padding: 8px 18px;
  border: 2px solid var(--g);
  border-radius: 4px;
  font-size: 14px;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.5);
  /* z-index 600 (od 19.3a) — powyzej nu-confirm-overlay (500) zeby toasty
     wywolane podczas otwartego confirmDialog byly widoczne nad backdropem. */
  z-index: 600;
  opacity: 0;
  transition: all 0.3s;
  text-align: center;
  max-width: 92%;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Footer with version info */
.game-footer {
  background: linear-gradient(180deg, var(--wd), #2a1a0e);
  border-top: 2px solid var(--g);
  padding: 4px 12px;
  font-size: 11px;
  color: rgba(244, 232, 208, 0.6);
  text-align: center;
  letter-spacing: 0.5px;
  font-family: 'Philosopher', serif;
  flex-shrink: 0;  /* prevent footer from being squeezed by flex */
}

.game-footer .v-tag {
  color: var(--gl);
  font-weight: 700;
}

.game-footer a {
  color: rgba(244, 232, 208, 0.8);
  text-decoration: none;
  margin-left: 10px;
}

.game-footer a:hover { color: var(--gl); }

/* (045 multi-world) Ekran wyboru świata */
.world-select-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 8, 6, 0.92);
}
.world-select-box {
  background: #1c1712; border: 1px solid #6b5836; border-radius: 10px;
  padding: 28px 32px; max-width: 460px; width: 90%;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}
.world-select-box h2 { margin: 0 0 18px; color: #d8b877; text-align: center; }
.world-select-item {
  display: flex; flex-direction: column; gap: 3px; width: 100%;
  text-align: left; padding: 12px 16px; margin-bottom: 10px;
  background: #2a2117; border: 1px solid #4a3c26; border-radius: 8px;
  color: #e8ddc8; cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
.world-select-item:hover:not(:disabled) { background: #34291b; border-color: #7a6238; }
.world-select-item:disabled { opacity: 0.5; cursor: default; }
.world-select-item .ws-name { font-size: 17px; font-weight: 600; }
.world-select-item .ws-meta { font-size: 12px; opacity: 0.75; }
.world-select-box .ws-empty { color: #c8b89a; text-align: center; }
/* (48.0) Nagłówki grup (Twoje / Otwarte) + komunikat błędu linku świata */
.world-select-box .ws-group-title {
  margin: 14px 0 8px; font-size: 12px; letter-spacing: 1px;
  text-transform: uppercase; color: #b39457; opacity: 0.85;
}
.world-select-box .ws-group-title:first-of-type { margin-top: 4px; }
.world-select-box .ws-error {
  margin: 0 0 14px; padding: 9px 12px; border-radius: 6px; text-align: center;
  font-size: 13px; color: #f0d0b0;
  background: rgba(120, 40, 30, 0.35); border: 1px solid #7a3a2a;
}
