/* ================================================================ BITWA 3 NA 3 — poczekalnia (public/js/ui/arena-lobby.js)
   U góry drużyny (niebiescy: gracze i boty, czerwoni: stały skład bitwy) z odliczaniem pośrodku, pod spodem wybór klasy
   (style .pk-* z style.css), po starcie — plansza „Do boju!”. Kolor klasy na karcie drużyny: --c. */
#arena { position: fixed; inset: 0; z-index: 30; overflow: hidden auto; display: grid; justify-items: center;
  background: radial-gradient(ellipse 45% 40% at 18% 12%, rgba(60, 130, 255, .22), transparent 70%), radial-gradient(ellipse 45% 40% at 82% 12%, rgba(255, 70, 60, .2), transparent 70%),
    radial-gradient(ellipse at center, rgba(4, 7, 12, .62), rgba(4, 7, 12, .9)); }
#arena.hidden { display: none; }
body.arena-lobby #start, body.arena-lobby #lobby-bar, body.arena-lobby #who { display: none; }
.ar-wrap { position: relative; display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: clamp(8px, 1.6vh, 16px); width: 100%; max-width: 1320px; height: 100vh;
  box-sizing: border-box; padding: clamp(10px, 2.2vh, 22px) 24px clamp(12px, 2.6vh, 26px); }
.ar-head { position: relative; display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 40px; }
.ar-head h2 { margin: 0; font: 700 clamp(22px, 3.6vh, 30px) Georgia, serif; color: var(--title); letter-spacing: .08em; text-shadow: 0 2px 8px #000, 0 0 14px rgba(255, 140, 110, .35); }
.ar-skulls { font-size: 16px; filter: drop-shadow(0 1px 2px #000); }
.ar-leave { position: absolute; left: 0; top: 50%; transform: translateY(-50%); }

/* drużyny */
.ar-teams { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: clamp(10px, 2vw, 26px); }
.ar-team { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.ar-team li { --c: #8fa0b8; position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; min-width: 0;
  padding: 8px 10px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--team) 55%, #263040);
  background: linear-gradient(135deg, color-mix(in srgb, var(--team) 42%, rgba(14, 18, 26, .95)), color-mix(in srgb, var(--team) 14%, rgba(10, 13, 20, .96))); box-shadow: 0 6px 16px #0008;
  animation: ar-card-in .4s cubic-bezier(.2, .9, .3, 1.2) both; }
.ar-blue { --team: #2f7fe8; } .ar-red { --team: #e0453a; }   /* kolory drużyn jak w grach MOBA; kolor klasy (--c) tylko w portrecie */
.ar-blue li { border-left: 4px solid #4a9cff; } .ar-red li { border-right: 4px solid #ff5a4a; }
.ar-red li { grid-template-columns: minmax(0, 1fr) auto; text-align: right; } .ar-red li .ar-face { order: 2; }
.ar-team li.you { box-shadow: 0 0 0 2px #ffd65a, 0 0 22px rgba(255, 214, 90, .4), 0 6px 16px #0008; }
.ar-face { --sz: clamp(44px, 7.4vh, 66px); position: relative; width: var(--sz); height: var(--sz); display: grid; place-items: center; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 42% 30%, color-mix(in srgb, var(--c) 50%, #1a1f2a), #07090d 72%); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 75%, #000), 0 0 12px color-mix(in srgb, var(--c) 40%, transparent); }
.ar-face img { width: 100%; height: 100%; object-fit: contain; }
.ar-face b { font: 700 calc(var(--sz) * .44) Georgia, serif; color: #f4f8ff; text-shadow: 0 2px 0 #000; }
.ar-team li div { display: grid; gap: 2px; min-width: 0; }
.ar-team li b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--title); font-size: clamp(13px, 1.9vh, 15px); }
.ar-team li b small { padding: 0 5px; border-radius: 4px; font-size: 10px; color: #1a1406; background: #ffd65a; vertical-align: 2px; }
.ar-team li em { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: normal; font-size: 12px; color: color-mix(in srgb, var(--team) 35%, #e8eef6); }
.ar-team li.bot b { color: #b8c2d0; font-weight: 600; }
.ar-state { position: absolute; right: 8px; top: 6px; font-style: normal; font-size: 11px; color: var(--dim); }
.ar-team li.locked .ar-state { color: #7dff9a; font-size: 15px; font-weight: 700; }
.ar-red .ar-state { left: 8px; right: auto; }

/* odliczanie: pierścień kurczy się do zera */
.ar-mid { position: relative; width: clamp(70px, 11vh, 96px); height: clamp(70px, 11vh, 96px); display: grid; place-items: center; }
.ar-ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.ar-ring circle { fill: rgba(8, 10, 16, .85); stroke: #2a3446; stroke-width: 6; }
.ar-ring .ar-ring-on { fill: none; stroke: #ffd65a; stroke-dasharray: 276.5; transition: stroke-dashoffset .5s linear; filter: drop-shadow(0 0 6px rgba(255, 214, 90, .7)); }
.ar-left { position: relative; font: 700 clamp(24px, 4vh, 34px) Georgia, serif; color: #fff; text-shadow: 0 2px 0 #000; }
#arena.ar-hurry .ar-ring-on { stroke: #ff6a5a; } #arena.ar-hurry .ar-left { color: #ffb4a8; animation: ar-tick 1s ease-in-out infinite; }

/* wybór klasy (ten sam co przed obroną, mniejszy portret) */
.ar-classes { --cls: #8fc8ff; position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: clamp(14px, 2vw, 26px); width: 100%; min-height: 0; }
.ar-classes .pk-art { --sz: clamp(120px, 30vh, 280px); }
.ar-classes .pk-grid { --t: clamp(58px, 9vh, 92px); }
.ar-classes .pk-info h3 { font-size: clamp(26px, 4.4vh, 40px); }
.ar-classes.going .pk-hero { animation: pk-go .6s ease-out forwards; }
.pk-tile.taken { cursor: not-allowed; filter: grayscale(1) brightness(.45); }
.pk-tile.taken:hover { transform: none; }
.pk-tile.taken::before, .pk-tile.botpick::before { position: absolute; left: 4px; top: 4px; z-index: 1; padding: 0 5px; border-radius: 4px; font: 700 10px "Segoe UI", sans-serif; line-height: 15px; }
.pk-tile.taken::before { content: '✕'; color: #fff; background: #a03028; }
.pk-tile.botpick::before { content: 'BOT'; color: #cfe2ff; background: #24406a; }

/* start bitwy */
.ar-go { position: absolute; inset: auto 0 0 0; top: clamp(150px, 26vh, 230px); display: grid; align-content: center; justify-items: center; gap: 14px;
  background: radial-gradient(ellipse 60% 50% at 50% 40%, rgba(255, 170, 80, .18), transparent 70%), rgba(4, 6, 10, .82); border-radius: 16px; animation: ar-go-in .5s ease-out both; }
.ar-go.hidden { display: none; }
.ar-go h3 { margin: 0; font: 700 clamp(40px, 8vh, 72px) Georgia, serif; letter-spacing: .1em; color: #ffe2b0; text-shadow: 0 4px 0 #2a1406, 0 0 40px rgba(255, 150, 60, .7); }
.ar-go p { margin: 0; color: #d8dfea; font-size: 16px; }
#arena.ar-started .ar-classes { visibility: hidden; }

@keyframes ar-card-in { from { opacity: 0; transform: translateY(-10px) scale(.94); } }
@keyframes ar-tick { 50% { transform: scale(1.15); } }
@keyframes ar-go-in { from { opacity: 0; transform: scale(1.06); } }
@media (max-width: 900px) {
  .ar-teams { grid-template-columns: 1fr; justify-items: center; }
  .ar-team { width: 100%; }
  .ar-classes { grid-template-columns: 1fr; }
}

/* karta bitwy na mapie świata (ui/worldmap.js): skład przeciwników */
.wm-tag-arena { background: #8a2a24 !important; color: #ffe6dc !important; }
.wm-ar-foes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 10px; padding: 0; list-style: none; }
.wm-ar-foes li { --c: #8fa0b8; display: grid; justify-items: center; gap: 4px; padding: 8px 4px; border-radius: 10px; background: linear-gradient(color-mix(in srgb, var(--c) 22%, rgba(0, 0, 0, .35)), rgba(0, 0, 0, .3)); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); }
.wm-ar-face { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; overflow: hidden; background: radial-gradient(circle at 42% 30%, color-mix(in srgb, var(--c) 50%, #1a1f2a), #07090d 72%); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 75%, #000); }
.wm-ar-face img { width: 100%; height: 100%; object-fit: contain; }
.wm-ar-face b { font: 700 24px Georgia, serif; color: #fff; }
.wm-ar-foes em { font-style: normal; font-size: 12px; font-weight: 600; text-align: center; }
.wm-ar-start { background: linear-gradient(#b8463a, #6e1f1a) !important; border-color: #ff9a80 !important; }

/* ================================================================ BITWA w grze (public/js/arena-client.js)
   U góry pasek: poziom i doświadczenie drużyn (niebiescy z lewej, czerwoni z prawej), pośrodku czas do następnej fali.
   W bitwie nie ma stanu obrony, paska budowy, dróg na radarze ani osobistego paska doświadczenia (poziom ma drużyna). */
body.arena #td, body.arena #build, body.arena #radar-lanes, body.arena #xp { display: none !important; }
#ar-bar { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 12; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center; gap: 12px; width: min(640px, calc(100vw - 420px)); min-width: 380px; pointer-events: none; }
body:not(.arena) #ar-bar, body.picking #ar-bar, body.lobby #ar-bar { display: none; }
.ar-side { --team: #2f7fe8; display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--team) 45%, rgba(10, 13, 20, .9)), rgba(10, 13, 20, .88)); border: 1px solid color-mix(in srgb, var(--team) 60%, #000);
  box-shadow: 0 4px 14px #0009; }
.ar-side.red { --team: #e0453a; grid-template-columns: minmax(0, 1fr) auto auto; }
.ar-lv { min-width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; font: 700 17px Georgia, serif; color: #fff;
  background: radial-gradient(circle at 40% 30%, color-mix(in srgb, var(--team) 70%, #fff), color-mix(in srgb, var(--team) 60%, #000)); box-shadow: 0 0 0 2px #0008, 0 0 12px color-mix(in srgb, var(--team) 70%, transparent); }
.ar-name { font: 700 11px "Segoe UI", sans-serif; letter-spacing: .14em; text-transform: uppercase; color: #eef4ff; text-shadow: 0 1px 2px #000; }
.ar-xp { position: relative; height: 9px; border-radius: 5px; overflow: hidden; background: #05070b; border: 1px solid #0008; }
.ar-xp s { position: absolute; inset: 0 auto 0 0; width: 0; text-decoration: none; background: linear-gradient(90deg, color-mix(in srgb, var(--team) 60%, #000), color-mix(in srgb, var(--team) 60%, #fff)); transition: width .4s; }
.ar-side.red .ar-xp s { inset: 0 0 0 auto; }
.ar-side.up .ar-lv { animation: ar-up .9s ease-out; }
.ar-clock { display: grid; justify-items: center; min-width: 58px; padding: 3px 8px; border-radius: 8px; background: rgba(8, 10, 16, .82); border: 1px solid #2a3446; }
.ar-clock b { font: 700 20px Georgia, serif; color: #ffe2a8; line-height: 1.1; }
.ar-clock em { font: 600 9px "Segoe UI", sans-serif; font-style: normal; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
@keyframes ar-up { 40% { transform: scale(1.35); filter: brightness(1.8); } }

/* zarośla: bohater w krzakach — zielona winieta na brzegach ekranu (wrogowie nie widzą go z daleka) */
#ar-brush { position: fixed; inset: 0; pointer-events: none; z-index: 5; opacity: 0; transition: opacity 0.35s;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(30, 90, 30, 0.38) 82%, rgba(14, 50, 14, 0.62) 100%); }
#ar-brush.on { opacity: 1; }
body:not(.arena) #ar-brush { display: none; }

/* przewaga poziomów: „+N” jak indeks przy kulce poziomu drużyny, która prowadzi */
#ar-bar .ar-side { position: relative; }
#ar-bar .ar-side[data-lead]:not([data-lead=""])::after { content: attr(data-lead); position: absolute; top: -7px; font: 800 12px/1 system-ui, sans-serif; padding: 3px 5px; border-radius: 9px; color: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }
#ar-bar .ar-side.blue[data-lead]:not([data-lead=""])::after { left: 30px; background: #2f6fe0; }
#ar-bar .ar-side.red[data-lead]:not([data-lead=""])::after { right: 30px; background: #c8373a; }

/* powiadomienia bitwy: baner na środku (twoje zabójstwa, serie, forty) i lista zabójstw pod minimapą */
#ar-banner { position: fixed; left: 50%; top: 92px; transform: translateX(-50%); z-index: 30; pointer-events: none; display: grid; justify-items: center; gap: 2px; }
#ar-banner .ab { display: flex; align-items: center; gap: 12px; padding: 8px 22px 8px 10px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(14, 18, 28, .92), rgba(8, 10, 16, .86)); border: 1px solid color-mix(in srgb, var(--c) 70%, transparent);
  box-shadow: 0 0 24px color-mix(in srgb, var(--c) 45%, transparent), 0 4px 14px #000a; animation: ab-in .35s cubic-bezier(.2, 1.6, .4, 1), ab-out .4s ease-in forwards; animation-delay: 0s, var(--life, 2.6s); }
#ar-banner .ab img { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; border: 2px solid var(--c); background: #0a0f16; }
#ar-banner .ab img.gone, #ar-feed .af img.gone { display: none; }
#ar-banner .ab b { display: block; font: 800 26px/1.05 Georgia, serif; letter-spacing: .04em; text-transform: uppercase; color: var(--c); text-shadow: 0 0 14px color-mix(in srgb, var(--c) 70%, transparent), 0 2px 3px #000; }
#ar-banner .ab span { display: block; font: 600 13px "Segoe UI", sans-serif; color: #dfe6f2; }
#ar-banner .ab span:empty { display: none; }
@keyframes ab-in { from { transform: scale(.4); opacity: 0; } }
@keyframes ab-out { to { transform: translateY(-14px); opacity: 0; } }
#ar-feed { position: fixed; right: 16px; top: 236px; z-index: 20; pointer-events: none; display: grid; gap: 4px; justify-items: end; }
#ar-feed .af { display: flex; align-items: center; gap: 6px; padding: 3px 8px 3px 4px; border-radius: 16px; font: 600 12px "Segoe UI", sans-serif; color: #e8edf5;
  background: rgba(8, 10, 16, .78); border-left: 3px solid var(--k); animation: ab-in .25s ease-out, ab-out .5s ease-in forwards; animation-delay: 0s, 7s; }
#ar-feed .af img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; border: 2px solid var(--b); background: #0a0f16; }
#ar-feed .af img.k { border-color: var(--k); }
#ar-feed .af i { font-style: normal; color: var(--k); font-size: 14px; }
#ar-feed .af em { font-style: normal; color: #9aa6b8; font-size: 11px; }
body:not(.arena) #ar-banner, body:not(.arena) #ar-feed { display: none; }

/* tabela wyników bitwy (Tab / krzyżak w górę; też na podsumowaniu) */
#ar-board { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 40; pointer-events: none; padding: 14px 16px; border-radius: 14px;
  background: rgba(8, 11, 18, .92); border: 1px solid #2a3446; box-shadow: 0 8px 40px #000c; }
#ar-board.hidden, #sum-board.hidden, body:not(.arena) #ar-board { display: none; }
.scoreboard { border-collapse: separate; border-spacing: 0 3px; font: 600 13px "Segoe UI", sans-serif; color: #dfe6f2; }
.scoreboard th { font: 700 10px "Segoe UI", sans-serif; letter-spacing: .08em; text-transform: uppercase; color: #8f9bb0; padding: 0 10px 4px; text-align: right; }
.scoreboard th.sb-name, .scoreboard td.sb-name { text-align: left; }
.scoreboard td { padding: 4px 10px; text-align: right; font-variant-numeric: tabular-nums; background: rgba(255, 255, 255, .03); }
.scoreboard tbody.blue td { background: rgba(60, 110, 220, .14); }
.scoreboard tbody.red td { background: rgba(210, 60, 60, .14); }
.scoreboard tr.me td { background: rgba(255, 210, 110, .16); }
.scoreboard td:first-child { border-radius: 8px 0 0 8px; } .scoreboard td:last-child { border-radius: 0 8px 8px 0; }
.scoreboard tr.sb-team td { background: none !important; text-align: left; font: 800 11px Georgia, serif; letter-spacing: .1em; text-transform: uppercase; padding: 8px 4px 2px; }
.scoreboard tbody.blue tr.sb-team td { color: #7fb0ff; } .scoreboard tbody.red tr.sb-team td { color: #ff8a7a; }
.scoreboard td.sb-name { display: flex; align-items: center; gap: 8px; min-width: 190px; }
.scoreboard td.sb-name img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: #0a0f16; border: 2px solid #3a4558; }
.scoreboard tbody.blue td.sb-name img { border-color: #4f86ee; } .scoreboard tbody.red td.sb-name img { border-color: #d24a44; }
.scoreboard td.sb-name img.gone { visibility: hidden; }
.scoreboard td.sb-name span { display: grid; line-height: 1.15; }
.scoreboard td.sb-name em { font-style: normal; font-size: 11px; color: #8f9bb0; }
.scoreboard td.sb-name u { text-decoration: none; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: #8f9bb0; }
.scoreboard td.top { color: #ffd36a; text-shadow: 0 0 8px rgba(255, 200, 80, .5); }
#sum-board { margin: 12px auto 4px; overflow-x: auto; max-width: 100%; }
#sum-board .scoreboard { margin: 0 auto; }
