/* ===========================================================
   ZAGŁĘBIE MASTERS — interfejs
   Warstwa DOM leży nad płótnem WebGL. Trzyma tekst, przyciski
   i okna dialogowe: dzięki temu napisy są zawsze ostre,
   a scena pozostaje w całości sprzętowa.
   =========================================================== */

:root {
  --gold-1: #ffe89b;
  --gold-2: #f0b423;
  --gold-3: #a86f07;
  --gold-4: #6b4402;

  --wood-1: #d8a15c;
  --wood-2: #a4642b;
  --wood-3: #6d3a12;
  --wood-4: #43220a;

  --red-1: #ff8a6a;
  --red-2: #e8443f;
  --red-3: #b21f28;
  --red-4: #710d15;

  --green-1: #8fe06a;
  --green-2: #4faa34;
  --green-3: #2c6b21;

  --blue-1: #8fd7ff;
  --blue-2: #3f97dd;
  --blue-3: #1c5a94;

  --ink: #2e1c12;
  --paper: #fdf6e6;

  --hud-h: 58px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

  --font: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  height: 100dvh;                 /* Android: pasek adresu nie ucina planszy */
  overflow: hidden;
  background: #14212f;
  font-family: var(--font);
  color: var(--paper);
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  /* blokada „przeciągnij, aby odświeżyć” i podświetleń przy przytrzymaniu */
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#stage { position: fixed; inset: 0; }

#gl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;             /* żadnego przewijania ani zoomu nad sceną */
}

#ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
  padding-top: var(--safe-t);
  padding-bottom: var(--safe-b);
}

#ui > * { pointer-events: auto; }

/* ===========================================================
   WSPÓLNE ELEMENTY
   =========================================================== */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px 0 6px;
  border-radius: 22px;
  background: linear-gradient(180deg, #4a2c14, #2c1808);
  border: 2px solid rgba(255, 220, 140, .55);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .35), inset 0 2px 6px rgba(0, 0, 0, .5);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .2px;
  color: #ffeec0;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .6);
  white-space: nowrap;
}

.pill canvas, .pill .ico { width: 28px; height: 28px; flex: none; display: block; }

.pill .val { font-variant-numeric: tabular-nums; }

.pill .plus {
  width: 24px; height: 24px;
  margin-left: 4px; margin-right: -6px;
  border-radius: 50%;
  border: 2px solid rgba(40, 22, 6, .6);
  background: linear-gradient(180deg, var(--green-1), var(--green-2));
  color: #123307;
  font-size: 18px; font-weight: 900; line-height: 19px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .3);
  text-shadow: none;
}
.pill .plus:active { transform: translateY(2px); box-shadow: none; }

/* --- okrągły przycisk boczny --- */
.rail-btn {
  position: relative;
  width: 52px; height: 52px;
  border-radius: 16px;
  border: 2px solid rgba(60, 34, 8, .7);
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2) 55%, var(--gold-3));
  box-shadow: 0 4px 0 var(--gold-4), 0 6px 12px rgba(0, 0, 0, .35);
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform .08s;
}
.rail-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--gold-4); }
.rail-btn canvas { width: 32px; height: 32px; display: block; filter: drop-shadow(0 1px 1px rgba(0,0,0,.3)); }
.rail-btn .lbl {
  position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%);
  font-size: 9px; font-weight: 900; letter-spacing: .3px;
  padding: 1px 6px; border-radius: 8px;
  background: rgba(30, 16, 4, .85);
  color: #ffdf9a; border: 1px solid rgba(255, 210, 120, .4);
  text-transform: uppercase;
}
.rail-btn .badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--red-1), var(--red-3));
  border: 2px solid #fff2d8;
  color: #fff; font-size: 11px; font-weight: 900; line-height: 17px;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .4);
}
.rail-btn .badge:empty, .rail-btn .badge[hidden] { display: none; }

/* --- duży przycisk --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px;
  padding: 0 22px;
  border: 2px solid rgba(50, 26, 4, .75);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2) 52%, var(--gold-3));
  color: #4a2b04;
  font-family: var(--font);
  font-size: 16px; font-weight: 900; letter-spacing: .4px;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .45);
  box-shadow: 0 4px 0 var(--gold-4), 0 8px 16px rgba(0, 0, 0, .3);
  cursor: pointer;
  transition: transform .08s, box-shadow .08s, filter .12s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--gold-4); }
.btn[disabled], .btn.off {
  filter: grayscale(.75) brightness(.75);
  cursor: default; pointer-events: none;
}
.btn.red {
  background: linear-gradient(180deg, var(--red-1), var(--red-2) 52%, var(--red-3));
  color: #fff3ea; box-shadow: 0 4px 0 var(--red-4), 0 8px 16px rgba(0, 0, 0, .3);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .35);
}
.btn.red:active { box-shadow: 0 0 0 var(--red-4); }
.btn.green {
  background: linear-gradient(180deg, var(--green-1), var(--green-2) 52%, var(--green-3));
  color: #f2fff0; box-shadow: 0 4px 0 #1d4a15, 0 8px 16px rgba(0, 0, 0, .3);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .3);
}
.btn.green:active { box-shadow: 0 0 0 #1d4a15; }
.btn.blue {
  background: linear-gradient(180deg, var(--blue-1), var(--blue-2) 52%, var(--blue-3));
  color: #f0faff; box-shadow: 0 4px 0 #103c66, 0 8px 16px rgba(0, 0, 0, .3);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .3);
}
.btn.blue:active { box-shadow: 0 0 0 #103c66; }
.btn.ghost {
  background: rgba(255, 245, 220, .10);
  border-color: rgba(255, 220, 150, .45);
  color: #ffe9bd; box-shadow: none; text-shadow: none;
}
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 13px; border-radius: 12px; }
/* przycisk bywa odnośnikiem (np. zbiórka) — bez podkreślenia z przeglądarki */
a.btn { text-decoration: none; }

/* ===========================================================
   GÓRNY PASEK
   =========================================================== */

#hud-top {
  position: absolute; top: calc(var(--safe-t) + 8px); left: 0; right: 0;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 8px; padding: 0 10px;
  pointer-events: none;
}
#hud-top > * { pointer-events: auto; }

.hud-left, .hud-right { display: flex; flex-direction: column; gap: 8px; }
.hud-right { align-items: flex-end; }

#shields {
  display: flex; gap: 4px; align-items: center;
  padding: 4px 8px; border-radius: 16px;
  background: rgba(20, 12, 4, .55);
  border: 2px solid rgba(255, 220, 140, .35);
}
#shields .slot {
  width: 22px; height: 22px;
  opacity: .28; filter: grayscale(1);
  transition: opacity .2s, filter .2s, transform .2s;
}
#shields .slot.on { opacity: 1; filter: none; transform: scale(1.06); }
#shields canvas { width: 100%; height: 100%; display: block; }

#village-tag {
  position: absolute; top: calc(var(--safe-t) + 54px); left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  padding: 5px 16px; border-radius: 18px;
  background: linear-gradient(180deg, rgba(58, 32, 10, .92), rgba(30, 16, 4, .95));
  border: 2px solid rgba(255, 215, 130, .5);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
  font-size: 13px; font-weight: 900; letter-spacing: .3px;
  color: #ffe9b8; text-shadow: 0 1px 0 rgba(0, 0, 0, .6);
  white-space: nowrap;
}
#village-tag .num {
  display: grid; place-items: center;
  min-width: 24px; height: 24px; padding: 0 5px;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-3));
  color: #4a2b04; font-size: 13px;
  text-shadow: none;
}
#village-tag canvas { width: 20px; height: 20px; display: block; }
#village-tag .vsub {
  font-size: 11px; font-weight: 700;
  color: rgba(255, 224, 168, .62);
  padding-left: 2px;
}
/* Miasto pokazujemy dopiero wtedy, gdy etykieta ma na nie miejsce
   i nie podchodzi pod wskaźnik tarcz po prawej. */
@media (max-width: 540px) { #village-tag .vsub { display: none; } }

/* ===========================================================
   TABLICZKA GRACZA (nad automatem)
   =========================================================== */

#player-plate {
  position: absolute;
  display: flex; align-items: center; gap: 8px;
  padding: 4px 14px 4px 4px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(58, 32, 10, .95), rgba(28, 15, 4, .96));
  border: 2px solid rgba(255, 214, 128, .55);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .45);
  transform: translate(-50%, -50%);
  pointer-events: auto; cursor: pointer;
  white-space: nowrap;
}
#player-plate canvas { width: 38px; height: 38px; display: block; border-radius: 50%; }
#player-plate .pp-txt { display: flex; flex-direction: column; line-height: 1.15; }
#player-plate .pp-nick { font-size: 13px; font-weight: 900; color: #ffe9b8; }
#player-plate .pp-coins { font-size: 12px; font-weight: 800; color: #ffd05a; font-variant-numeric: tabular-nums; }

/* ===========================================================
   TABLICA WYGRANEJ (na obudowie automatu)
   =========================================================== */

#win-plate {
  position: absolute;
  display: grid; place-items: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #ffd75e;
  text-shadow: 0 0 14px rgba(255, 180, 40, .75), 0 2px 0 rgba(80, 40, 0, .8);
  letter-spacing: 1px;
  transition: transform .12s;
}
#win-plate.pop { animation: winpop .5s ease-out; }
@keyframes winpop {
  0% { transform: translate(-50%, -50%) scale(.6); filter: brightness(2); }
  55% { transform: translate(-50%, -50%) scale(1.18); }
  100% { transform: translate(-50%, -50%) scale(1); }
}
#win-plate .sub {
  display: block; text-align: center;
  font-size: .40em; letter-spacing: 1.5px;
  color: #ffb4a0; text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .7);
}

/* ===========================================================
   BOCZNE PANELE PRZYCISKÓW
   =========================================================== */

.rail {
  position: absolute; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 16px;
  z-index: 4;
}
.rail.left { left: 8px; }
.rail.right { right: 8px; }

/* ===========================================================
   DOLNY PANEL
   =========================================================== */

#hud-bottom {
  position: absolute; left: 0; right: 0; bottom: calc(var(--safe-b) + 8px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 0 10px;
  pointer-events: none;
}
#hud-bottom > * { pointer-events: auto; }

#energy-bar {
  width: min(94%, 420px);
  height: 26px;
  border-radius: 14px;
  background: linear-gradient(180deg, #33200e, #1d1006);
  border: 2px solid rgba(255, 214, 128, .5);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .6), 0 3px 8px rgba(0, 0, 0, .35);
  position: relative; overflow: hidden;
}
#energy-bar .fill {
  position: absolute; inset: 2px auto 2px 2px;
  border-radius: 11px;
  background: linear-gradient(180deg, #9fe8ff, #3aa8e8 55%, #1c6fb0);
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, .3), 0 0 12px rgba(80, 200, 255, .5);
  transition: width .35s cubic-bezier(.2, .8, .3, 1);
}
#energy-bar .fill::after {
  content: ''; position: absolute; inset: 2px 2px 55% 2px;
  border-radius: 9px; background: rgba(255, 255, 255, .30);
}
#energy-bar .txt {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 900; letter-spacing: .5px;
  color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .85);
}

#bet-row {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 6px; border-radius: 18px;
  background: rgba(20, 12, 4, .6);
  border: 2px solid rgba(255, 214, 128, .35);
}
#bet-row .lab { font-size: 11px; font-weight: 900; color: #ffd9a0; text-transform: uppercase; letter-spacing: .5px; }
#bet-row .val {
  min-width: 54px; text-align: center;
  font-size: 15px; font-weight: 900; color: #ffe9b8;
  font-variant-numeric: tabular-nums;
}
#bet-row button {
  width: 30px; height: 30px; border-radius: 10px;
  border: 2px solid rgba(50, 26, 4, .7);
  background: linear-gradient(180deg, var(--gold-1), var(--gold-3));
  color: #4a2b04; font-size: 18px; font-weight: 900; line-height: 1;
  cursor: pointer; font-family: var(--font);
}
#bet-row button:active { transform: translateY(2px); }

#action-row {
  display: flex; align-items: flex-end; justify-content: center; gap: 14px;
  width: min(100%, 480px);
}

#spin-btn {
  position: relative;
  width: 168px; height: 74px;
  border: none; padding: 0;
  border-radius: 22px;
  background: linear-gradient(180deg, #ff9a72, var(--red-2) 45%, var(--red-3));
  border: 3px solid #7d1018;
  box-shadow: 0 6px 0 var(--red-4), 0 10px 22px rgba(0, 0, 0, .45),
              inset 0 3px 0 rgba(255, 255, 255, .35);
  color: #fff;
  font-family: var(--font); font-size: 26px; font-weight: 900;
  letter-spacing: 2px; text-transform: uppercase;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .4);
  cursor: pointer;
  transition: transform .07s, box-shadow .07s;
}
#spin-btn:active, #spin-btn.press {
  transform: translateY(5px);
  box-shadow: 0 1px 0 var(--red-4), 0 4px 10px rgba(0, 0, 0, .4), inset 0 3px 0 rgba(255, 255, 255, .25);
}
#spin-btn[disabled] { filter: grayscale(.6) brightness(.7); cursor: default; }
/* Za mało zakręceń: przycisk działa, ale wygląda na przygaszony i sam
   podpowiada, co zrobić — zamiast udawać, że gra się zacięła. */
#spin-btn.short {
  background: linear-gradient(180deg, #b8867a, #8a5b52 45%, #5e3a34);
  border-color: #4a2a25;
  box-shadow: 0 6px 0 #3a201c, 0 10px 22px rgba(0, 0, 0, .4),
              inset 0 3px 0 rgba(255, 255, 255, .2);
}
#spin-btn.short .hint { color: #ffd9c8; }
#spin-btn .hint {
  position: absolute; left: 0; right: 0; bottom: 6px;
  font-size: 9px; font-weight: 800; letter-spacing: .6px;
  color: rgba(255, 235, 220, .8); text-shadow: none;
  text-transform: uppercase;
}
#spin-btn.auto {
  background: linear-gradient(180deg, #a8e88f, var(--green-2) 45%, var(--green-3));
  border-color: #1d4a15; box-shadow: 0 6px 0 #14330e, 0 10px 22px rgba(0, 0, 0, .45),
              inset 0 3px 0 rgba(255, 255, 255, .35);
}
#spin-btn .ring {
  position: absolute; inset: -6px; border-radius: 26px;
  border: 3px solid rgba(255, 220, 120, .85);
  opacity: 0; pointer-events: none;
}
#spin-btn.ready .ring { animation: ringpulse 1.8s ease-out infinite; }
@keyframes ringpulse {
  0% { opacity: .9; transform: scale(1); }
  70% { opacity: 0; transform: scale(1.18); }
  100% { opacity: 0; transform: scale(1.18); }
}

.side-btn {
  width: 76px; height: 62px;
  border-radius: 18px;
  border: 2px solid rgba(50, 26, 4, .75);
  background: linear-gradient(180deg, var(--wood-1), var(--wood-2) 55%, var(--wood-3));
  box-shadow: 0 4px 0 var(--wood-4), 0 8px 14px rgba(0, 0, 0, .35);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  cursor: pointer; font-family: var(--font);
  transition: transform .08s, box-shadow .08s;
}
.side-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--wood-4); }
.side-btn canvas { width: 28px; height: 28px; display: block; }
.side-btn .lbl {
  font-size: 10px; font-weight: 900; letter-spacing: .3px;
  color: #ffe4b0; text-transform: uppercase; text-shadow: 0 1px 0 rgba(0, 0, 0, .6);
}
.side-btn.active {
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2) 55%, var(--gold-3));
  box-shadow: 0 4px 0 var(--gold-4), 0 8px 14px rgba(0, 0, 0, .35);
}
.side-btn.active .lbl { color: #4a2b04; text-shadow: 0 1px 0 rgba(255, 255, 255, .4); }

/* ===========================================================
   ZNACZNIKI BUDYNKÓW W WIOSCE
   =========================================================== */

#markers { position: absolute; inset: 0; pointer-events: none; }

/* Znacznik zakotwiczony dolną krawędzią: cała etykieta zawsze stoi
   NAD budynkiem i nigdy nie kładzie się na jego dachu. */
.marker {
  position: absolute;
  transform: translate(-50%, -100%);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  pointer-events: auto; cursor: pointer;
}
.marker .cost {
  display: flex; align-items: center; gap: 4px;
  padding: 3px 10px 3px 4px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(50, 28, 8, .95), rgba(26, 14, 4, .96));
  border: 2px solid rgba(255, 214, 128, .6);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .45);
  font-size: 12px; font-weight: 900; color: #ffe0a0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.marker .cost canvas { width: 18px; height: 18px; display: block; }
.marker.can .cost { border-color: #a8f08a; color: #e8ffd8; animation: bob 1.6s ease-in-out infinite; }
.marker.max .cost { border-color: rgba(255, 214, 128, .3); color: #c9a97a; }
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
.marker .lv {
  display: flex; gap: 2px;
}
.marker .lv i {
  width: 9px; height: 9px; border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  border: 1px solid rgba(0, 0, 0, .35);
}
.marker .lv i.on { background: linear-gradient(180deg, var(--gold-1), var(--gold-2)); }
.marker .name {
  font-size: 10px; font-weight: 800; color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .9);
  max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ===========================================================
   OKNA DIALOGOWE
   =========================================================== */

#modal-root {
  position: absolute; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  padding: calc(var(--safe-t) + 12px) 12px calc(var(--safe-b) + 12px);
  background: rgba(8, 12, 20, .70);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 20;
}
#modal-root.on { display: flex; }

.modal {
  width: min(100%, 460px);
  max-height: 100%;
  display: flex; flex-direction: column;
  border-radius: 26px;
  background: linear-gradient(180deg, #b8763a, #8c4f1e 22%, #6b3a13);
  border: 3px solid var(--gold-2);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .65), inset 0 2px 0 rgba(255, 220, 150, .3);
  overflow: hidden;
  animation: modalin .28s cubic-bezier(.2, 1.2, .4, 1);
}
@keyframes modalin {
  from { transform: translateY(28px) scale(.94); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.modal-head {
  position: relative;
  padding: 14px 52px 12px;
  text-align: center;
  background: linear-gradient(180deg, var(--red-2), var(--red-3));
  border-bottom: 3px solid var(--gold-3);
}
.modal-head h2 {
  margin: 0;
  font-size: 19px; font-weight: 900; letter-spacing: .8px;
  text-transform: uppercase;
  color: #fff3d8;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .45);
}
.modal-head p {
  margin: 4px 0 0; font-size: 12px; font-weight: 700;
  color: rgba(255, 233, 205, .82);
}
.modal-x {
  position: absolute; top: 10px; right: 10px;
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid rgba(60, 20, 10, .6);
  background: linear-gradient(180deg, #fff0d0, #e0a83c);
  color: #6b2810; font-size: 19px; font-weight: 900; line-height: 1;
  cursor: pointer; font-family: var(--font);
  box-shadow: 0 3px 0 rgba(120, 60, 10, .7);
}
.modal-x:active { transform: translateY(2px); box-shadow: none; }

.modal-body {
  padding: 14px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 220, 150, .10), transparent 60%),
    linear-gradient(180deg, rgba(0, 0, 0, .12), rgba(0, 0, 0, .28));
}
.modal-foot {
  padding: 12px 14px;
  display: flex; gap: 10px; justify-content: center;
  border-top: 2px solid rgba(255, 214, 128, .25);
  background: rgba(0, 0, 0, .22);
}

/* --- karta pozycji na liście --- */
.row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 240, 210, .14), rgba(0, 0, 0, .18));
  border: 2px solid rgba(255, 214, 128, .28);
}
.row.done { border-color: rgba(150, 230, 120, .55); }
.row .grow { flex: 1; min-width: 0; }
.row .t1 { font-size: 14px; font-weight: 900; color: #ffe9c0; }
.row .t2 { font-size: 12px; font-weight: 700; color: rgba(255, 230, 195, .75); margin-top: 2px; }
.row canvas { display: block; flex: none; }

.bar {
  height: 10px; border-radius: 6px; margin-top: 6px;
  background: rgba(0, 0, 0, .4);
  border: 1px solid rgba(0, 0, 0, .5);
  overflow: hidden;
}
.bar i {
  display: block; height: 100%;
  background: linear-gradient(180deg, var(--green-1), var(--green-2));
  transition: width .3s;
}
.bar.gold i { background: linear-gradient(180deg, var(--gold-1), var(--gold-2)); }

.reward-line {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  flex-wrap: wrap; margin: 8px 0;
}
.reward-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 12px 5px 5px;
  border-radius: 16px;
  background: rgba(0, 0, 0, .32);
  border: 2px solid rgba(255, 214, 128, .4);
  font-size: 14px; font-weight: 900; color: #ffe4a8;
  font-variant-numeric: tabular-nums;
}
.reward-chip canvas { width: 24px; height: 24px; display: block; }

/* --- sezon miesięczny --- */
.season-head {
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(170, 120, 255, .20), rgba(0, 0, 0, .28));
  border: 2px solid rgba(190, 150, 255, .55);
}
.season-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.season-top canvas { width: 30px; height: 30px; display: block; flex: none; }
.season-top .t1 { font-size: 16px; font-weight: 900; color: #e6d8ff; }
.season-top .t2 { font-size: 12px; font-weight: 700; color: rgba(226, 214, 255, .8); margin-top: 2px; }
.season-head .t2 { font-size: 12px; font-weight: 700; color: rgba(226, 214, 255, .8); }
.set-block.season .set-head .nm { color: #e6d8ff; }
.season-tag {
  display: inline-block; margin-left: 6px;
  padding: 1px 7px; border-radius: 8px;
  background: linear-gradient(180deg, #a97cf0, #6b3fb8);
  border: 1px solid rgba(230, 216, 255, .6);
  font-size: 9px; font-weight: 900; letter-spacing: .6px;
  color: #fff; vertical-align: middle;
}

/* --- siatka kart --- */
.set-block { margin-bottom: 16px; }
.set-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.set-head .nm { font-size: 15px; font-weight: 900; color: #ffe9c0; flex: 1; }
.set-head .ct { font-size: 12px; font-weight: 800; color: #ffd070; }
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}
.card-grid canvas {
  width: 100%; height: auto; display: block;
  border-radius: 10px;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .5));
}
.card-cell { position: relative; }
.card-cell .dup {
  position: absolute; right: -4px; top: -4px;
  min-width: 20px; height: 20px; padding: 0 4px;
  border-radius: 10px; background: linear-gradient(180deg, var(--green-1), var(--green-2));
  border: 2px solid #fff; color: #103005;
  font-size: 11px; font-weight: 900; line-height: 17px; text-align: center;
}

/* --- sklep --- */
.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shop-item {
  padding: 12px 8px; text-align: center;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 240, 210, .16), rgba(0, 0, 0, .22));
  border: 2px solid rgba(255, 214, 128, .35);
  cursor: pointer;
  transition: transform .1s;
}
.shop-item:active { transform: scale(.97); }
.shop-item canvas { width: 46px; height: 46px; display: block; margin: 0 auto 6px; }
.shop-item .amt { font-size: 18px; font-weight: 900; color: #ffe9b8; }
.shop-item .price {
  margin-top: 6px; padding: 4px;
  border-radius: 10px;
  background: rgba(0, 0, 0, .3);
  font-size: 13px; font-weight: 900; color: #ffd05a;
  font-variant-numeric: tabular-nums;
}
.shop-item.off { filter: grayscale(.7) brightness(.7); }

/* --- zakładki okresów i kategorii rankingu --- */
.seg.tabs { margin-bottom: 10px; }

.chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 12px;
}
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px 6px 6px;
  border-radius: 16px;
  border: 2px solid rgba(255, 214, 128, .3);
  background: rgba(0, 0, 0, .25);
  color: #ffe4b0; font-family: var(--font);
  font-size: 12px; font-weight: 900; cursor: pointer;
  white-space: nowrap;
}
.chip canvas { width: 20px; height: 20px; display: block; }
.chip.on {
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  color: #4a2b04; border-color: rgba(50, 26, 4, .55);
}

/* --- wiersz tablicy wyników --- */
.row.lb { padding: 8px 10px; }
.place {
  min-width: 30px; height: 30px; padding: 0 6px;
  border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, .35);
  border: 2px solid rgba(255, 214, 128, .25);
  font-size: 13px; font-weight: 900; color: #ffe0a0;
}
.place.top1 { background: linear-gradient(180deg, #ffe98f, #e0a306); color: #4a2b04; border-color: #b8860b; }
.place.top2 { background: linear-gradient(180deg, #eef2f6, #9fadbb); color: #2f3a45; border-color: #8b97a4; }
.place.top3 { background: linear-gradient(180deg, #f0b98c, #b3703a); color: #3d220e; border-color: #8a5326; }

.lb-val {
  display: flex; align-items: center; gap: 5px; flex: none;
  font-size: 14px; font-weight: 900; color: #ffd870;
  font-variant-numeric: tabular-nums;
}
.lb-val canvas { width: 20px; height: 20px; display: block; }

/* --- suwak głośności --- */
.slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 28px;
  background: transparent; cursor: pointer;
}
.slider::-webkit-slider-runnable-track {
  height: 10px; border-radius: 6px;
  background: linear-gradient(90deg, var(--gold-2), var(--gold-1));
  border: 1px solid rgba(0, 0, 0, .45);
}
.slider::-moz-range-track {
  height: 10px; border-radius: 6px;
  background: linear-gradient(90deg, var(--gold-2), var(--gold-1));
  border: 1px solid rgba(0, 0, 0, .45);
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; margin-top: -9px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff6dd, #d9a63c);
  border: 2px solid rgba(60, 34, 8, .7);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .45);
}
.slider::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(180deg, #fff6dd, #d9a63c);
  border: 2px solid rgba(60, 34, 8, .7);
}

/* --- postaw kawę --- */
.btn.coffee {
  background: linear-gradient(180deg, #f0c98a, #c98a4a 52%, #8a5522);
  border-color: rgba(60, 32, 8, .75);
  color: #3d2208;
  box-shadow: 0 4px 0 #5c3612, 0 8px 16px rgba(0, 0, 0, .3);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
  gap: 8px;
}
.btn.coffee:active { box-shadow: 0 0 0 #5c3612; }
.btn.coffee canvas { width: 26px; height: 26px; display: block; }

.coffee-row { border-color: rgba(240, 200, 140, .45); }
.coffee-text {
  font-size: 14px; font-weight: 700; line-height: 1.5;
  color: #ffe9c0; margin-top: 4px;
}
.coffee-blik {
  padding: 10px; border-radius: 14px;
  background: rgba(0, 0, 0, .28);
  border: 2px solid rgba(255, 214, 128, .3);
  text-align: center;
}
.coffee-num {
  font-size: 22px; font-weight: 900; letter-spacing: 1px;
  color: #ffd870; margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* ===========================================================
   PANELE BOCZNE — zadania i sezon
   Na szerokim ekranie po bokach automatu zostaje pusta trawa.
   Zamiast jej marnować, pokazujemy tam to, co gracz i tak chce
   wiedzieć: co jest do zrobienia i ile zostało do końca sezonu.
   =========================================================== */

#panel-quests, #panel-season {
  position: absolute;
  top: calc(var(--safe-t) + 120px);
  width: 220px;
  max-height: calc(100% - 260px);
  overflow: hidden;
  padding: 10px 12px 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(58, 32, 10, .90), rgba(28, 15, 4, .93));
  border: 2px solid rgba(255, 214, 128, .40);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .40);
  cursor: pointer;
  display: none;
  transition: transform .12s, border-color .2s;
}
#panel-quests:hover, #panel-season:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 214, 128, .75);
}
#panel-quests { left: 16px; }
#panel-season { right: 16px; border-color: rgba(190, 150, 255, .45); }
#panel-season:hover { border-color: rgba(190, 150, 255, .8); }

.panel-head {
  display: flex; align-items: center; gap: 7px;
  padding-bottom: 8px; margin-bottom: 8px;
  border-bottom: 2px solid rgba(255, 214, 128, .22);
  font-size: 14px; font-weight: 900; letter-spacing: .4px;
  color: #ffe9b8; text-transform: uppercase;
}
.panel-head canvas { width: 22px; height: 22px; display: block; }
.panel-badge {
  margin-left: auto;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--red-1), var(--red-3));
  border: 2px solid #fff2d8;
  color: #fff; font-size: 11px; font-weight: 900; line-height: 16px;
  text-align: center;
}

.panel-row { margin-bottom: 9px; }
.panel-row .bar { height: 8px; margin-top: 4px; }
.pr-top { display: flex; align-items: baseline; gap: 5px; }
.pr-tag {
  flex: none;
  padding: 1px 6px; border-radius: 7px;
  background: rgba(255, 214, 128, .18);
  font-size: 9px; font-weight: 900; letter-spacing: .3px;
  color: #ffd79a; text-transform: uppercase;
}
.pr-txt {
  font-size: 12px; font-weight: 800; color: #ffe9c0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pr-sub {
  font-size: 11px; font-weight: 700;
  color: rgba(255, 232, 200, .62); margin-top: 3px;
}
.pr-sub.ready { color: #9de88a; font-weight: 900; }
.panel-row.done .pr-txt { color: #cdf3bd; }

@media (max-width: 899px) {
  #panel-quests, #panel-season { display: none !important; }
}
@media (min-width: 1280px) {
  #panel-quests, #panel-season { width: 250px; }
  #panel-quests { left: 28px; }
  #panel-season { right: 28px; }
}
body.low-fx #panel-quests, body.low-fx #panel-season { box-shadow: none; }

/* ===========================================================
   LICZNIK WIELKIEGO NAJAZDU
   =========================================================== */

#attack-counter {
  position: absolute;
  left: 50%; top: calc(var(--safe-t) + 96px);
  transform: translateX(-50%);
  z-index: 14; pointer-events: none;
  padding: 8px 18px 10px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(70, 20, 10, .94), rgba(30, 10, 4, .96));
  border: 2px solid rgba(255, 170, 60, .65);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .55);
  text-align: center;
  animation: acin .3s cubic-bezier(.2, 1.3, .4, 1);
}
@keyframes acin { from { transform: translateX(-50%) scale(.8); opacity: 0; } }
#attack-counter .ac-head {
  font-size: 12px; font-weight: 900; letter-spacing: 1.4px;
  color: #ffb45e; text-shadow: 0 2px 0 rgba(0, 0, 0, .5);
}
#attack-counter .ac-pips {
  display: flex; gap: 7px; justify-content: center; margin: 6px 0 4px;
}
#attack-counter .ac-pips i {
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  border: 2px solid rgba(255, 190, 110, .55);
}
#attack-counter .ac-pips i.hit {
  background: linear-gradient(180deg, #ffd45e, #e0700c);
  border-color: #fff0c0;
  box-shadow: 0 0 8px rgba(255, 170, 40, .8);
}
#attack-counter .ac-pips i.blocked {
  background: linear-gradient(180deg, #cfe4ff, #6c9ccc);
  border-color: #eaf4ff;
}
/* skarbiec w rajdzie — od razu widać, że to nie było zwykłe kopnięcie */
#attack-counter .ac-pips i.jack {
  background: linear-gradient(180deg, #fff3b0, #ff9a1f);
  border-color: #fff;
  box-shadow: 0 0 12px rgba(255, 200, 60, .95);
}
#attack-counter .ac-sub {
  font-size: 11px; font-weight: 800; color: rgba(255, 224, 190, .85);
}
#attack-counter .ac-sum {
  display: flex; align-items: center; gap: 5px; justify-content: center;
  margin-top: 5px; font-size: 14px; font-weight: 900; color: #ffd870;
  font-variant-numeric: tabular-nums;
}
#attack-counter .ac-sum canvas { width: 20px; height: 20px; display: block; }

body.low-fx #attack-counter { animation: none; box-shadow: none; }

/* --- hub zakręceń --- */
.spin-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-bottom: 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(90, 190, 255, .18), rgba(0, 0, 0, .25));
  border: 2px solid rgba(140, 210, 255, .45);
}
.spin-head canvas { width: 44px; height: 44px; display: block; flex: none; }
.spin-head .t1 { font-size: 22px; font-weight: 900; color: #cfefff; font-variant-numeric: tabular-nums; }
.spin-head .t2 { font-size: 12px; font-weight: 700; color: rgba(220, 240, 255, .78); margin-top: 2px; }

/* --- kod podarunkowy --- */
.code-row { border-color: rgba(150, 230, 120, .35); }
.code-form { display: flex; gap: 8px; }
.code-form input {
  flex: 1; min-width: 0; height: 40px; padding: 0 12px;
  border-radius: 12px;
  border: 2px solid rgba(255, 214, 128, .5);
  background: rgba(0, 0, 0, .35);
  color: #ffe9b8; font-family: var(--font);
  font-size: 15px; font-weight: 800; letter-spacing: 1px;
  text-transform: uppercase; outline: none;
}
.code-form input:focus { border-color: var(--gold-2); background: rgba(0, 0, 0, .5); }
.code-form .btn { flex: none; }

/* --- pigułka klikalna --- */
.pill.tappable { cursor: pointer; }
.pill.tappable:active { transform: translateY(2px); }

/* --- błąd i potwierdzenie formularza --- */
.form-err {
  min-height: 18px; margin-top: 8px; text-align: center;
  font-size: 13px; font-weight: 800; color: #ff9d94;
}
.form-ok {
  min-height: 18px; margin-top: 8px; text-align: center;
  font-size: 13px; font-weight: 800; color: #9de88a;
}

/* --- rajd / atak: podsumowanie --- */
.foe-head {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  margin-bottom: 10px;
}
.foe-head canvas { width: 46px; height: 46px; border-radius: 50%; display: block; }
.foe-head .nm { font-size: 16px; font-weight: 900; color: #ffe9c0; }
.foe-head .vl { font-size: 12px; font-weight: 700; color: rgba(255, 230, 195, .75); }

/* --- ustawienia --- */
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; margin-bottom: 8px;
  border-radius: 14px;
  background: rgba(0, 0, 0, .2);
  border: 2px solid rgba(255, 214, 128, .25);
}
.set-row .lb { font-size: 14px; font-weight: 800; color: #ffe9c0; }
.set-row .sub { font-size: 11px; font-weight: 600; color: rgba(255, 230, 195, .65); margin-top: 2px; }

.switch {
  width: 54px; height: 30px; border-radius: 16px; flex: none;
  background: rgba(0, 0, 0, .45);
  border: 2px solid rgba(255, 214, 128, .4);
  position: relative; cursor: pointer;
  transition: background .2s;
}
.switch i {
  position: absolute; top: 2px; left: 2px;
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(180deg, #fff6dd, #d9a63c);
  transition: transform .2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .4);
}
.switch.on { background: linear-gradient(180deg, var(--green-2), var(--green-3)); }
.switch.on i { transform: translateX(24px); }

.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1; padding: 8px 6px;
  border-radius: 12px;
  border: 2px solid rgba(255, 214, 128, .3);
  background: rgba(0, 0, 0, .25);
  color: #ffe4b0; font-family: var(--font);
  font-size: 12px; font-weight: 900; cursor: pointer;
  text-transform: uppercase; letter-spacing: .3px;
}
.seg button.on {
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  color: #4a2b04; border-color: rgba(50, 26, 4, .6);
}

/* ===========================================================
   MENU GŁÓWNE
   Pozycje-wiersze zamiast ściany przełączników: gracz wchodzi tu
   po konkretną rzecz (konto, karty, ranking), więc każda ma ikonę,
   opis i strzałkę — widać, że to prowadzi dalej.
   =========================================================== */

.menu-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; margin-bottom: 8px;
  border-radius: 14px;
  background: rgba(0, 0, 0, .22);
  border: 2px solid rgba(255, 214, 128, .25);
  cursor: pointer;
  transition: border-color .15s, transform .1s, background .15s;
}
.menu-row:hover {
  border-color: rgba(255, 214, 128, .6);
  background: rgba(0, 0, 0, .30);
}
.menu-row:active { transform: scale(.985); }
.menu-row canvas { width: 30px; height: 30px; display: block; flex: none; }
.menu-row .lb { font-size: 14px; font-weight: 800; color: #ffe9c0; }
.menu-row .sub {
  font-size: 11px; font-weight: 600;
  color: rgba(255, 230, 195, .65); margin-top: 2px;
}
.menu-arrow {
  flex: none; font-size: 22px; font-weight: 900;
  color: rgba(255, 214, 128, .55); line-height: 1;
}
.menu-badge {
  flex: none; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 11px;
  background: linear-gradient(180deg, var(--red-1), var(--red-3));
  border: 2px solid #fff2d8;
  color: #fff; font-size: 12px; font-weight: 900; line-height: 18px;
  text-align: center;
}
.menu-sep {
  margin: 14px 0 8px;
  font-size: 11px; font-weight: 900; letter-spacing: .8px;
  color: rgba(255, 214, 128, .70); text-transform: uppercase;
}

/* ===========================================================
   MAPA REGIONÓW
   Osiem regionów po sto etapów. Zakładki u góry, pod nimi plansza
   10×10 — cała setka mieści się na ekranie telefonu bez przewijania
   kafelków, więc widać postęp regionu jednym spojrzeniem.
   =========================================================== */

.map-tabs {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px;
  margin-bottom: 10px;
  scrollbar-width: none;
}
.map-tabs::-webkit-scrollbar { display: none; }
.map-tab {
  flex: none; display: flex; align-items: center; gap: 5px;
  padding: 7px 11px; border-radius: 11px;
  border: 2px solid rgba(255, 214, 128, .3);
  background: rgba(0, 0, 0, .25);
  color: #ffe4b0; font-family: var(--font);
  font-size: 12px; font-weight: 900; cursor: pointer; white-space: nowrap;
}
.map-tab.on {
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  color: #4a2b04; border-color: rgba(50, 26, 4, .6);
}
.map-tab.locked { opacity: .5; }
.map-tab.flagged { border-color: rgba(140, 230, 110, .6); }
.map-tab .fm { font-size: 11px; }

.map-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.map-head .lb { font-size: 15px; font-weight: 900; color: #ffe9c0; }
.map-head .sub { font-size: 11.5px; color: rgba(255, 230, 195, .65); }

.flag-mark { font-size: 46px; line-height: 1; }
.flag-mark.small { font-size: 26px; }
.flag-name {
  font-size: 19px; font-weight: 900; color: #ffe9c0; margin-top: 4px;
}
.flag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.flag-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 9px; border-radius: 10px;
  background: rgba(0, 0, 0, .25);
  border: 2px solid rgba(140, 230, 110, .45);
  font-size: 12px; font-weight: 800; color: #dff3d0;
}

.map-grid {
  display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px;
  margin: 10px 0;
}
.map-cell {
  position: relative; aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; padding: 0;
  border: 2px solid rgba(255, 214, 128, .22);
  background: rgba(0, 0, 0, .28);
  color: rgba(255, 232, 200, .75);
  font-family: var(--font); font-size: 10px; font-weight: 900;
  cursor: pointer;
}
.map-cell .no { line-height: 1; }
.map-cell .mk { position: absolute; right: 2px; bottom: 1px; font-size: 8px; }
.map-cell.done {
  background: linear-gradient(180deg, var(--green-1), var(--green-2));
  border-color: rgba(20, 60, 10, .5); color: #13300a;
}
.map-cell.current {
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  border-color: #fff2d8; color: #4a2b04;
  box-shadow: 0 0 10px rgba(255, 190, 60, .8);
}
.map-cell.open { border-color: rgba(255, 214, 128, .75); color: #ffe9c0; }
.map-cell.locked { opacity: .45; cursor: default; }

.map-legend {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  margin-top: 8px; font-size: 11px; color: rgba(255, 230, 195, .7);
}
.map-legend .lg { display: flex; align-items: center; gap: 5px; }
.map-legend i {
  width: 12px; height: 12px; border-radius: 4px; display: block;
  border: 2px solid rgba(255, 214, 128, .22); background: rgba(0, 0, 0, .28);
}
.map-legend i.done { background: linear-gradient(180deg, var(--green-1), var(--green-2)); }
.map-legend i.current { background: linear-gradient(180deg, var(--gold-1), var(--gold-2)); }
.map-legend i.open { border-color: rgba(255, 214, 128, .75); }
.map-legend i.locked { opacity: .45; }

@media (max-width: 380px) {
  .map-cell { font-size: 9px; }
  .map-cell .mk { display: none; }
}

/* ===========================================================
   PANEL ADMINISTRATORA
   =========================================================== */

.admin-tag {
  margin-left: 7px; padding: 1px 7px;
  border-radius: 8px; vertical-align: middle;
  background: linear-gradient(180deg, #ff6a4d, #c62d17);
  border: 2px solid #ffd7c8;
  font-size: 10px; font-weight: 900; letter-spacing: .5px; color: #fff;
}
.admin-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 7px;
  margin-bottom: 8px;
}
.admin-grid .btn { width: 100%; }
.admin-vil { display: flex; flex-wrap: wrap; gap: 5px; }
.admin-vil .btn { min-width: 38px; padding: 6px 8px; }

/* plakietka w HUD, żeby administrator nie zapomniał, w jakim trybie gra
   (kolejny element kolumny — HUD jest flexem, więc nie trzeba nic pozycjonować) */
body.is-admin .hud-left::after {
  content: 'ADMIN — BEZ OGRANICZEŃ';
  align-self: flex-start;
  padding: 2px 9px; border-radius: 9px;
  background: linear-gradient(180deg, #ff6a4d, #c62d17);
  border: 2px solid #ffd7c8;
  font-size: 9px; font-weight: 900; letter-spacing: .6px; color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
}

/* ===========================================================
   KOMUNIKATY PRZELOTNE
   =========================================================== */

#toasts {
  position: absolute; left: 50%; top: calc(var(--safe-t) + 96px);
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 6px; align-items: center;
  pointer-events: none; z-index: 15;
  width: max-content; max-width: 90%;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px 8px 8px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(58, 32, 10, .96), rgba(26, 14, 4, .97));
  border: 2px solid rgba(255, 214, 128, .55);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
  font-size: 14px; font-weight: 900; color: #ffe9b8;
  animation: toastin .28s cubic-bezier(.2, 1.2, .4, 1);
  white-space: nowrap;
}
.toast canvas { width: 26px; height: 26px; display: block; }
.toast.out { animation: toastout .3s ease-in forwards; }
@keyframes toastin { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastout { to { transform: translateY(-14px); opacity: 0; } }

/* --- duży komunikat na środku --- */
#banner {
  position: absolute; left: 50%; top: 38%;
  transform: translate(-50%, -50%);
  pointer-events: none; z-index: 16;
  text-align: center;
  display: none;
}
#banner.on { display: block; animation: bannerin .4s cubic-bezier(.2, 1.4, .4, 1); }
#banner .big {
  font-size: clamp(30px, 10vw, 58px); font-weight: 900;
  letter-spacing: 2px; text-transform: uppercase;
  color: #ffd75e;
  text-shadow: 0 0 24px rgba(255, 170, 30, .9), 0 4px 0 rgba(110, 40, 0, .85),
               0 8px 20px rgba(0, 0, 0, .6);
}
#banner .small {
  margin-top: 4px;
  font-size: clamp(14px, 4vw, 20px); font-weight: 900;
  color: #fff2d0; text-shadow: 0 2px 6px rgba(0, 0, 0, .8);
}
@keyframes bannerin {
  from { transform: translate(-50%, -50%) scale(.5); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* ===========================================================
   EKRAN STARTOWY
   =========================================================== */

#boot {
  position: absolute; inset: 0; z-index: 60;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px;
  background: radial-gradient(120% 90% at 50% 20%, #2c5f8f, #142438 70%, #0d1826);
  text-align: center;
  transition: opacity .45s;
}
#boot.hide { opacity: 0; pointer-events: none; }
#boot h1 {
  margin: 0; font-size: clamp(30px, 9vw, 52px); font-weight: 900;
  letter-spacing: 2px; text-transform: uppercase;
  background: linear-gradient(180deg, #fff6cd, #f0b423 55%, #a86f07);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 0 rgba(70, 34, 4, .9)) drop-shadow(0 8px 16px rgba(0, 0, 0, .5));
}
#boot .tag { font-size: 14px; font-weight: 800; color: #a8c8e8; letter-spacing: 1px; margin-top: -8px; }
#boot .load {
  width: min(80%, 300px); height: 14px; border-radius: 8px;
  background: rgba(0, 0, 0, .45); border: 2px solid rgba(255, 214, 128, .4);
  overflow: hidden;
}
#boot .load i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--gold-3), var(--gold-1));
  transition: width .3s;
}
#boot .msg { font-size: 13px; font-weight: 700; color: #90b0d0; min-height: 18px; }
#boot .err {
  max-width: 420px; padding: 14px 16px; border-radius: 14px;
  background: rgba(180, 40, 40, .25); border: 2px solid rgba(255, 120, 110, .5);
  font-size: 13px; line-height: 1.5; color: #ffd9d4; text-align: left;
}

/* --- pole nicku przy pierwszym uruchomieniu --- */
.name-form { display: flex; flex-direction: column; gap: 10px; align-items: center; width: min(100%, 340px); }
.name-form input {
  width: 100%; height: 48px; padding: 0 16px;
  border-radius: 14px;
  border: 2px solid rgba(255, 214, 128, .5);
  background: rgba(0, 0, 0, .35);
  color: #ffe9b8; font-family: var(--font);
  font-size: 17px; font-weight: 800; text-align: center;
  outline: none;
}
.name-form input:focus { border-color: var(--gold-2); background: rgba(0, 0, 0, .5); }
.avatar-pick { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.avatar-pick canvas {
  width: 52px; height: 52px; border-radius: 50%; display: block;
  border: 3px solid transparent; cursor: pointer;
  opacity: .55; transition: opacity .15s, transform .15s;
}
.avatar-pick canvas.on { opacity: 1; border-color: var(--gold-2); transform: scale(1.08); }

/* ===========================================================
   DROBIAZGI
   =========================================================== */

.muted { color: rgba(255, 232, 200, .62); font-size: 12px; font-weight: 700; }
.center { text-align: center; }
.mt8 { margin-top: 8px; }
.mt14 { margin-top: 14px; }

#net-dot {
  position: absolute; right: 6px; bottom: 4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #6ad86a; box-shadow: 0 0 6px rgba(120, 255, 120, .8);
}
#net-dot.off { background: #d8a03a; box-shadow: 0 0 6px rgba(255, 190, 80, .7); }

/* ===========================================================
   PROFIL OSZCZĘDNY
   Rozmycie tła i wielowarstwowe cienie to na Androidzie praca
   kompozytora liczona w milisekundach na każdą klatkę. Przy niskim
   profilu upraszczamy je, zachowując czytelność interfejsu.
   =========================================================== */

body.low-fx #modal-root {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: rgba(8, 12, 20, .86);
}
body.low-fx .rail-btn,
body.low-fx .side-btn,
body.low-fx .btn,
body.low-fx #spin-btn { box-shadow: 0 3px 0 rgba(0, 0, 0, .45); }
body.low-fx .pill,
body.low-fx .marker .cost,
body.low-fx .toast,
body.low-fx #village-tag,
body.low-fx #player-plate { box-shadow: none; }
body.low-fx .modal { box-shadow: 0 10px 24px rgba(0, 0, 0, .6); }
body.low-fx #banner .big { text-shadow: 0 3px 0 rgba(110, 40, 0, .85); }
body.low-fx #win-plate { text-shadow: 0 2px 0 rgba(80, 40, 0, .8); }
body.low-fx #energy-bar .fill { box-shadow: none; }
body.low-fx .card-grid canvas { filter: none; }

/* Animacje w pętli budzą kompozytor bez przerwy — przy niskim profilu
   zostawiamy tylko te, które niosą informację. */
body.low-fx #spin-btn.ready .ring { animation: none; opacity: .55; }
body.low-fx .marker.can .cost { animation: none; }
body.low-fx .modal { animation: none; }
body.low-fx .toast { animation: none; }

@media (prefers-reduced-motion: reduce) {
  #spin-btn.ready .ring, .marker.can .cost { animation: none; }
  .modal, .toast, #banner.on { animation-duration: .01ms; }
}

/* ===========================================================
   TELEFON — cele dotyku i gęste ekrany
   =========================================================== */

/* Przewijanie wewnątrz okien nie może ciągnąć strony pod spodem. */
.modal-body { overscroll-behavior: contain; }

/* Małe przyciski (plus przy monetach, zmiana zakładu, zamknięcie okna)
   dostają niewidoczne pole dotyku 44×44 px — tyle wynosi minimum, przy
   którym trafia się palcem bez pudłowania. Duże przyciski już je mają. */
/* .modal-x jest już `absolute` — nie wolno tego nadpisać, bo krzyżyk
   zjechałby z narożnika okna na środek. */
.pill .plus, #bet-row button { position: relative; }
.pill .plus::after, #bet-row button::after, .modal-x::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 44px; height: 44px;
  transform: translate(-50%, -50%);
}

/* Wąskie telefony: mniejsze marginesy, żeby automat był jak największy. */
@media (max-width: 380px) {
  .rail.left { left: 4px; }
  .rail.right { right: 4px; }
  #hud-top { padding: 0 6px; }
  .pill { height: 34px; font-size: 14px; padding: 0 10px 0 5px; }
  .pill canvas, .pill .ico { width: 24px; height: 24px; }
  #spin-btn { width: 140px; height: 66px; font-size: 23px; }
  .side-btn { width: 66px; height: 56px; }
  #energy-bar { height: 24px; }
  #energy-bar .txt { font-size: 12px; }
}

/* --- ekran bardzo niski: chowamy etykiety --- */
@media (max-height: 620px) {
  .rail { gap: 10px; }
  .rail-btn { width: 44px; height: 44px; border-radius: 13px; }
  .rail-btn canvas { width: 26px; height: 26px; }
  .rail-btn .lbl { display: none; }
  #spin-btn { width: 148px; height: 62px; font-size: 22px; }
  .side-btn { width: 66px; height: 54px; }
  #village-tag { font-size: 12px; padding: 4px 12px; }
}

@media (min-width: 760px) {
  .rail.left { left: max(8px, calc(50% - 330px)); }
  .rail.right { right: max(8px, calc(50% - 330px)); }
}
