:root {
  --tlo: #0f131b; --karta: #171c28; --karta2: #202737; --linia: #2d3650; --tekst: #eef2f8; --cichy: #9aa6bd;
  --zloto: #fbbf24; --zielen: #34d399; --czerwien: #f87171; --dia: #60a5fa; --moj: #e11d48;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--tlo); color: var(--tekst); font: 15px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }

.btn { border: 1px solid var(--linia); background: var(--karta2); border-radius: 12px; padding: 10px 16px; font-weight: 800; transition: transform .08s; }
.btn:active { transform: translateY(2px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.glowny { background: linear-gradient(#fcd34d, #f59e0b); color: #2a1a00; border: 0; box-shadow: 0 4px 0 #b45309; font-size: 17px; padding: 13px 18px; }
.btn.glowny:active { box-shadow: 0 1px 0 #b45309; transform: translateY(3px); }
.btn.dia { background: linear-gradient(#93c5fd, #3b82f6); color: #06121f; border: 0; box-shadow: 0 4px 0 #1d4ed8; }
.btn.maly { padding: 7px 11px; font-size: 13px; }
.btn.pelny { width: 100%; }
.drobne { color: var(--cichy); font-size: 13px; }

/* ------------------------------------------------------------- powitanie */
.witaj { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; overflow: auto;
  background: radial-gradient(120% 90% at 50% 0, #27406b 0, #0f131b 62%); }
.witajKarta { width: min(430px, 100%); background: rgba(23,28,40,.92); border: 1px solid var(--linia); border-radius: 22px; padding: 24px; display: grid; gap: 12px; text-align: center; }
.witajKarta h1 { font-size: 46px; font-weight: 900; letter-spacing: .04em; color: var(--zloto); text-shadow: 0 3px 0 #7c4a03; }
.witajKarta .haslo { color: var(--cichy); margin-top: -8px; }
.witajKarta h2 { font-size: 20px; margin-top: 8px; }
.witajKarta label { display: grid; gap: 5px; text-align: left; font-size: 13px; color: var(--cichy); }
.witajKarta input { font: inherit; font-size: 19px; font-weight: 700; color: var(--tekst); background: #0b0e14; border: 1px solid var(--linia); border-radius: 12px; padding: 12px 14px; width: 100%; }
.witajKarta input:focus { outline: 2px solid var(--zloto); border-color: transparent; }
.jezyki { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.jezyki button { border: 1px solid var(--linia); background: transparent; border-radius: 99px; padding: 4px 12px; font-size: 13px; font-weight: 700; color: var(--cichy); }
.jezyki button.wybrana { background: var(--zloto); color: #2a1a00; border-color: transparent; }

/* --------------------------------------------------------------------- gra */
.gra { position: fixed; inset: 0; display: flex; flex-direction: column; }
.pasek { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; padding: max(7px, env(safe-area-inset-top)) 8px 7px; background: #131824; border-bottom: 1px solid var(--linia); z-index: 3; }
.zasob { display: flex; align-items: center; gap: 6px; background: var(--karta2); border: 1px solid var(--linia); border-radius: 99px; padding: 3px 11px 3px 4px; font-weight: 800; white-space: nowrap; font-size: 14px; }
.zasob svg { width: 24px; height: 24px; flex: none; }
.zasob small { color: var(--zielen); font-weight: 700; font-size: 11px; }
.zasob.pelny b { color: var(--czerwien); }
.zasob.dia { cursor: pointer; }
.zasob .slupek { position: relative; display: grid; }
.zasob .slupek i { display: block; height: 3px; border-radius: 2px; background: #0b0e14; overflow: hidden; margin-top: 1px; }
.zasob .slupek i::after { content: ''; display: block; height: 100%; width: var(--f, 0%); background: var(--zielen); }
.zasob.pelny .slupek i::after { background: var(--czerwien); }

.alarm { background: #7f1d1d; color: #fecaca; text-align: center; font-weight: 800; padding: 6px 10px; font-size: 14px; animation: mig 1s infinite alternate; z-index: 3; }
@keyframes mig { to { background: #b91c1c; } }

main { flex: 1; position: relative; min-height: 0; }
.widok { position: absolute; inset: 0; }
.widok.lista { overflow: auto; padding: 12px 12px 24px; display: grid; gap: 10px; align-content: start; max-width: 760px; margin: 0 auto; width: 100%; }
.przewijak { position: absolute; inset: 0; overflow: auto; background: #0b0f17; scrollbar-width: none; cursor: grab; }
.przewijak::-webkit-scrollbar { display: none; }
#scena { display: block; }
#mapa { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.mapaPrzyciski { position: absolute; right: 10px; top: 10px; display: grid; gap: 6px; }
.mapaPrzyciski button { min-width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--linia); background: rgba(23,28,40,.9); font-weight: 900; font-size: 20px; padding: 0 10px; }
.mapaPrzyciski button[data-mapa="dom"] { font-size: 13px; }
.kolejkaPasek { position: absolute; left: 10px; bottom: 10px; display: grid; gap: 6px; max-width: min(330px, calc(100% - 20px)); pointer-events: none; }
.kolejkaPasek div { background: rgba(16,20,30,.88); border: 1px solid var(--linia); border-radius: 12px; padding: 7px 12px; font-weight: 700; font-size: 13px; display: flex; justify-content: space-between; gap: 14px; }
.kolejkaPasek b { color: var(--zloto); }

.zakladki { display: grid; grid-template-columns: repeat(6, 1fr); background: #131824; border-top: 1px solid var(--linia); padding-bottom: env(safe-area-inset-bottom); z-index: 3; }
.zakladki button { position: relative; background: none; border: 0; padding: 7px 2px 6px; display: grid; justify-items: center; gap: 1px; color: var(--cichy); font-size: 11px; font-weight: 700; }
.zakladki svg { width: 24px; height: 24px; }
.zakladki button.wybrana { color: var(--zloto); }
.kropka { position: absolute; top: 5px; left: calc(50% + 7px); width: 10px; height: 10px; border-radius: 50%; background: var(--czerwien); border: 2px solid #131824; }

/* ------------------------------------------------------------------- karty */
.karta { background: var(--karta); border: 1px solid var(--linia); border-radius: 14px; padding: 12px 14px; display: grid; gap: 8px; }
.karta h3 { font-size: 16px; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.karta h3 small { color: var(--cichy); font-weight: 600; font-size: 12px; }
.karta p { color: var(--cichy); font-size: 13px; }
h2.dzial { font-size: 13px; color: var(--cichy); text-transform: uppercase; letter-spacing: .08em; margin-top: 6px; }
.rzad { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rzad.miedzy { justify-content: space-between; }
.pusto { color: var(--cichy); text-align: center; padding: 22px 14px; background: var(--karta); border-radius: 14px; }
.koszt { display: flex; gap: 10px; flex-wrap: wrap; font-weight: 800; font-size: 14px; }
.koszt span { display: inline-flex; align-items: center; gap: 4px; }
.koszt svg { width: 18px; height: 18px; }
.koszt .brak { color: var(--czerwien); }
.postep { height: 8px; border-radius: 99px; background: #0b0e14; overflow: hidden; }
.postep i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #f59e0b, #fde047); }
.efekt { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.efekt div { background: var(--karta2); border-radius: 10px; padding: 8px 10px; font-weight: 800; }
.efekt small { display: block; color: var(--cichy); font-weight: 600; font-size: 11px; }
.efekt div:last-child b { color: var(--zielen); }

.jednostka { grid-template-columns: 54px 1fr; align-items: start; }
.jednostka canvas { width: 54px; height: 62px; background: var(--karta2); border-radius: 10px; }
.staty { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--cichy); }
.staty b { color: var(--tekst); }
.ilePole { width: 76px; font: inherit; font-weight: 800; background: #0b0e14; color: var(--tekst); border: 1px solid var(--linia); border-radius: 10px; padding: 8px; text-align: center; }
.wybor { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; background: var(--karta2); border-radius: 10px; padding: 7px 10px; font-weight: 700; }

.raport { grid-template-columns: 8px 1fr; padding-left: 10px; }
.raport > i { border-radius: 4px; background: var(--cichy); }
.raport.wygrana > i { background: var(--zielen); }
.raport.przegrana > i { background: var(--czerwien); }
.raport h3 { font-size: 15px; }
.raport .slawa { color: var(--zloto); font-weight: 800; font-size: 12px; }

.podzakladki { display: flex; gap: 6px; }
.podzakladki button { flex: 1; background: transparent; border: 1px solid var(--linia); border-radius: 10px; padding: 7px; font-weight: 700; color: var(--cichy); font-size: 13px; }
.podzakladki button.wybrana { color: var(--tekst); background: var(--karta2); }
.ranking { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ranking li { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; align-items: center; background: var(--karta); border-radius: 10px; padding: 8px 12px; font-weight: 700; }
.ranking li.ja { outline: 2px solid var(--zloto); }
.ranking .m { color: var(--cichy); font-weight: 900; }
.ranking small { color: var(--cichy); font-weight: 600; }
.ranking .tyt { color: var(--zloto); font-size: 12px; }

/* ------------------------------------------------------------------ arkusz */
.arkusz { position: fixed; inset: 0; z-index: 10; display: grid; align-items: end; justify-items: center; }
.arkuszTlo { position: absolute; inset: 0; background: rgba(6,8,13,.55); }
.arkuszKarta { position: relative; width: min(520px, 100%); max-height: 86vh; overflow: auto; background: var(--karta); border: 1px solid var(--linia); border-bottom: 0;
  border-radius: 20px 20px 0 0; padding: 18px 16px max(18px, env(safe-area-inset-bottom)); display: grid; gap: 10px; animation: wjazd .2s; }
@keyframes wjazd { from { transform: translateY(30px); opacity: 0; } }
.arkuszKarta h2 { font-size: 21px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.arkuszKarta h2 small { color: var(--zloto); font-size: 14px; }
.arkuszKarta > p { color: var(--cichy); font-size: 14px; }
.ostrzez { color: var(--czerwien); font-weight: 700; font-size: 13px; }
.dobrze { color: var(--zielen); font-weight: 700; font-size: 13px; }
@media (min-width: 700px) { .arkusz { align-items: center; } .arkuszKarta { border-radius: 20px; border-bottom: 1px solid var(--linia); } }

.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 20; background: #f8fafc; color: #0d1017; border-radius: 12px; padding: 9px 16px;
  font-weight: 800; max-width: 92vw; text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.toast.zly { background: #fecaca; }

@media (max-width: 520px) {
  .zasob { font-size: 12px; padding: 2px 8px 2px 3px; gap: 4px; }
  .zasob svg { width: 20px; height: 20px; }
  .zasob small { display: none; }
  .zakladki button { font-size: 10px; }
}

.znak { display: inline-block; background: #24304a; color: #cfe0ff; border-radius: 6px; padding: 0 6px; font-size: 11px; font-weight: 900; letter-spacing: .04em; vertical-align: 1px; }
.podzakladki { flex-wrap: wrap; }
.ranking li .rzad { flex-wrap: nowrap; }

/* ------------------------------------------- konto, zakup diamentów, czat, linki */
a { color: var(--dia); }
.lnk { background: none; border: 0; padding: 4px 2px; color: var(--dia); font-weight: 700; font-size: 13px; text-decoration: underline; }
.prawne { text-align: center; font-size: 13px; color: var(--cichy); line-height: 1.9; }
.prawne a { white-space: nowrap; }
.witajKarta .lnk { font-size: 14px; justify-self: center; }
.adres { color: var(--tekst); overflow-wrap: anywhere; }

.zgoda { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; background: var(--karta2); border: 1px solid var(--linia); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--tekst); cursor: pointer; }
.zgoda input { width: 22px; height: 22px; margin: 0; accent-color: var(--zloto); }
.pakiet { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; }
.pakiet .ile { display: inline-flex; align-items: center; gap: 3px; color: var(--dia); font-weight: 800; vertical-align: middle; }
.pakiet .ile svg { width: 18px; height: 18px; }
.pakiet .btn { font-size: 15px; padding: 11px 14px; white-space: nowrap; }

.czatLista { display: grid; gap: 6px; align-content: start; max-height: 320px; min-height: 60px; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
.wiad { background: var(--karta2); border-radius: 10px; padding: 6px 10px; }
.wiad.moja { background: #1d2a44; }
.wiadGora { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.wiadGora b { font-size: 13px; }
.wiadGora small { color: var(--cichy); font-size: 11px; }
.wiadPrzyciski { display: inline-flex; gap: 10px; }
.wiadPrzyciski .lnk { padding: 0; font-size: 12px; }
.karta .wiad p { color: var(--tekst); font-size: 14px; overflow-wrap: anywhere; }
.czatRzad { display: flex; gap: 8px; }
.czatRzad .ilePole { flex: 1; min-width: 0; width: auto; text-align: left; font-weight: 600; }

@media (max-width: 520px) {
  .pakiet { grid-template-columns: 1fr; }
  .pakiet .btn { width: 100%; white-space: normal; }
}
