/* Ekran walki: poczekalnia, mecz, mapa sektorów i wynik. Zagnieżdżony w .ui razem z gra.css, tokeny stamtąd.
   Ruch: tylko transform/opacity (plus kolory), czasy i krzywe z gra.css; wariant bez ruchu włączają
   @media (prefers-reduced-motion) i klasa .no-motion — oba w gra.css (animation/transition: none !important).
   Rytm losowania (pola odczytu) i kadru krytyka ma własne czasy: to mechanika, nie dekoracja.
   Układ meczu (od góry): pasek gracza -> .sidesbar -> .sector-line -> .battlefield (2x2) -> .readout (3 pola) -> .actionbar.
   Szata graficzna (kolory, tła, obramowania) jest zebrana w zmiennych z gra.css — logika w app.js/walka.js. */
@keyframes m-reveal { 0% { transform: scale(.6); opacity: 0; } 55% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes m-rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes m-hit-rise { 0% { opacity: 0; transform: translateY(8px) scale(.8); } 15% { opacity: 1; transform: translateY(0) scale(1.15); } 100% { opacity: 0; transform: translateY(-34px) scale(1); } }
@keyframes m-urgent { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes m-bump { 0%, 100% { transform: scaleY(1); } 40% { transform: scaleY(1.7); } }
@keyframes m-edge-a { from { border-color: var(--color-side-a); } to { border-color: var(--color-outline); } }
@keyframes m-edge-b { from { border-color: var(--color-side-b); } to { border-color: var(--color-outline); } }
@keyframes m-enter { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes m-closing { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes m-flash { from { opacity: .9; } to { opacity: 0; } }
@keyframes m-shake-short { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
@keyframes m-field-stop { 0% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes m-jitter { 0% { transform: translateY(-4px); } 100% { transform: translateY(4px); } }
@keyframes m-crack { 0% { opacity: 0; transform: scale(.4); } 25% { opacity: 1; transform: scale(1.1); } 100% { opacity: 0; transform: scale(1); } }
@keyframes m-pop { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.14); } }

.ui {
/* ==========================================================================
   Układ ekranu meczu: stały pasek gracza, część środkowa, pasek akcji przy kciuku
   ========================================================================== */
.match {
  position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
  background: var(--color-bg-0);
}
.match.enter-fade { animation: ui-in-fade var(--dur-fast) var(--ease-out) both; }
.m-top { flex: none; }
.m-mid { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 4px; padding: 2px 12px 4px; }
.m-mid > *, .m-main > * { flex-shrink: 0; }
.m-main { display: flex; flex-direction: column; gap: 4px; flex: 1 1 0; min-height: 0; } /* wysokość: pole bitwy bierze całą resztę, strefy stałe się nie kurczą */
.m-main > .battle { flex: 1 1 0; min-height: 0; }

/* pasek gracza: wspólny układ .topbar z gra.css (avatar z poziomem, ammo, kamizelka, kasa, XP), tylko niższy */
.m-res { min-height: 56px; padding-top: 4px; padding-bottom: 4px; }
.m-res::after { display: none; }
.m-res:has(#m-level[hidden]) .tb-sep { display: none; } /* widz bez własnej postaci: bez zasobów, bez samego separatora */
.m-res .lvl-badge { --xp: 0; }
.m-res .tb-stat { flex: none; gap: 4px; }
.m-res .tb-ammo { flex: 1 1 0; min-width: 0; }
.tb-av-in .av-img { position: static; display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 6%; }
.tb-av-in .ic { width: 60%; height: 60%; margin: 20%; }
.chip-2l { display: flex; flex-direction: column; line-height: 1; }
.chip-2l .of { margin-top: 2px; font-size: 12px; }
.chip-2l .of:empty { display: none; }
.m-armor { display: inline-flex; align-items: center; gap: 2px; margin-left: 4px; padding-left: 4px; border-left: 1px solid var(--color-line); }
.m-armor .ic { width: 22px; height: 22px; color: var(--color-result-armor); }
.m-armor[data-stage="1"] .ic { color: var(--color-warning); }
.m-armor[data-stage="2"] .ic { color: var(--color-ammo); }
.m-armor[data-stage="3"] .ic { color: var(--color-error); }
.m-armor .of { font-size: 14px; color: var(--color-text-2); }
.tb-stat.is-pop, .m-armor.is-pop { animation: m-pop 420ms var(--ease-pop) 1; }

/* narzędzia: mapa, info (po lewej), wyciszenie, pomiń, test (po prawej) */
.m-boost { margin: 0 16px 4px; display: flex; align-items: center; gap: 4px; font-size: var(--fs-label); font-weight: 700; color: var(--color-accent); }
.m-boost[hidden] { display: none; }
.m-boost .ic { width: 16px; height: 16px; flex: none; }
.m-xpbar { margin: 0 16px 4px; }
.m-bar { display: flex; align-items: center; gap: 8px; padding: 0 16px 5px; }
.m-bar .btn { flex: 0 1 auto; min-width: 88px; min-height: 44px; padding: 0 14px; font-size: 15px; gap: 6px; border-radius: var(--radius-pill); }
.m-bar .btn .ic { width: 20px; height: 20px; }
.m-bar .btn-mute { margin-left: auto; min-width: 44px; width: 44px; padding: 0; }
.m-bar .btn[aria-pressed="true"]:not(.btn-mute) { --btn-bg: var(--color-accent); --btn-bg-pressed: var(--color-accent-pressed); --btn-ink: var(--color-on-accent); --btn-line: transparent; }

/* ==========================================================================
   Pasek stron: nasza strona z lewej, przeciwna z prawej; obrażenia w sektorze, punkty sektora w środku,
   pod spodem jeden pasek dzielony proporcjonalnie; wynik meczu mniejszą czcionką przy stronach
   ========================================================================== */
.battle { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.battle > * { flex-shrink: 0; }
.sidesbar {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 2px 8px; padding: 6px 4px 8px;
  border-top: 1px solid var(--color-line); border-bottom: 1px solid var(--color-line);
}
.sb-side { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.sb-b { align-items: flex-end; text-align: right; }
.sb-name { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.sb-b .sb-name { justify-content: flex-end; }
.sb-name .side-mark, .sb-name .side-mark .ic { width: 20px; height: 20px; }
.sidesbar .side-name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 800 15px / 1.1 var(--font-display); letter-spacing: .02em; text-transform: uppercase; }
.sidesbar .war-side { min-width: 0; }
.sb-score { flex: none; display: inline-flex; align-items: baseline; gap: 4px; margin-top: 2px; padding: 1px 8px; border-radius: var(--radius-pill); background: var(--color-bg-2); border: 1px solid var(--color-outline); font-size: 11px; line-height: 1.3; color: var(--color-text-2); }
.sb-score .num { font-size: 13px; line-height: 1; }
.sb-dmg { display: inline-flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.sb-dmg .num { font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; }
.sb-dmg-l { font-size: 14px; color: var(--color-text-2); }
.sb-pts {
  position: relative; display: grid; place-items: center; align-content: center; width: 58px; height: 58px; text-align: center; color: var(--color-text-1);
}
.sb-pts::before {
  content: ""; position: absolute; inset: 8px; z-index: 0; transform: rotate(45deg); border-radius: 9px;
  background: var(--color-bg-1); border: 2px solid var(--color-accent);
}
.sb-pts .num { position: relative; z-index: 1; font-size: 22px; line-height: .95; }
.sb-pts-l { position: relative; z-index: 1; font-family: var(--font-body); font-weight: 600; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; line-height: 1; color: var(--color-text-2); }
.sb-ratio { grid-column: 1 / -1; height: 12px; margin-top: 2px; }
.sidesbar .fx { left: 4px; right: 4px; top: 0; }
@media (max-width: 380px) { .sb-dmg-l { font-size: 13px; } .sector-line .t-heading { font-size: 16px; } }

.sector-line { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-height: 28px; padding: 0 4px; white-space: nowrap; }
.sector-line .t-heading { font-size: 17px; }
.sector-line .tag { padding: 0 6px; font-size: 11px; height: 20px; }
.sector-line .timer { margin-left: auto; max-width: 100%; font-size: 14px; }
@media (max-width: 380px) { .sector-line .tag .ic { display: none; } }
.sp-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { display: inline-flex; align-items: center; gap: 3px; padding: 0 8px; height: 22px; border-radius: var(--radius-pill); font-family: var(--font-display); font-weight: 700; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; background: var(--color-bg-2); border: 1px solid var(--color-outline); }
.tag .ic { width: 12px; height: 12px; }
.tag--mine { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-on-accent); }
.tag--ot { color: var(--color-warning); }
.tag--a { color: var(--color-side-a); }
.tag--b { color: var(--color-side-b); }
.timer { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-display); font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; color: var(--color-text-1); }
.timer .ic { width: 16px; height: 16px; }
.timer.is-urgent { color: var(--color-warning); animation: m-urgent 1s ease-in-out infinite; }

/* liczby trafień unoszące się nad paskiem i nad celem */
.fx { position: absolute; left: 0; right: 0; top: 0; height: 0; pointer-events: none; z-index: 6; }
.hit-float { position: absolute; top: -4px; font-family: var(--font-display); font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; white-space: nowrap; text-shadow: 0 1px 2px rgba(0, 0, 0, .8); animation: m-hit-rise 1s ease-out forwards; }
.hit-float.a { left: 2px; color: var(--color-side-a); }
.hit-float.b { right: 2px; color: var(--color-side-b); }
.ratio.edge-a { animation: m-edge-a 120ms ease-out 1; }
.ratio.edge-b { animation: m-edge-b 120ms ease-out 1; }
.ratio.is-bump { animation: m-bump 420ms var(--ease-pop) 1; }
.ratio.hl-a { border-color: var(--color-side-a); }
.ratio.hl-b { border-color: var(--color-side-b); }

/* ==========================================================================
   Pole bitwy: statyczne tło sektora (przyciemnione, żeby nie dominowało), czterej obrońcy 2x2 (po dwóch na stronę), plakietki nad postaciami
   Wysokość rośnie z oknem tylko do rozsądnej granicy (--fd-h): na dużym ekranie postacie nie rozjeżdżają się po całej kolumnie.
   ========================================================================== */
.battlefield {
  --fd-cap: 10.6dvh; --fd-ov: 34px; position: relative; flex: 1 1 0; min-height: 0; container-type: size; overflow: hidden; border-radius: var(--radius-l); border: var(--stroke-thin) solid var(--color-outline);
  background: linear-gradient(180deg, rgba(15,23,32,.28), rgba(15,23,32,.5)), var(--bf-bg, none) center / cover no-repeat, var(--color-bg-2);
}
.battlefield[data-s="0"] { --bf-bg: url("../grafika/tla/sektor-1.svg"); }
.battlefield[data-s="1"] { --bf-bg: url("../grafika/tla/sektor-2.svg"); }
.battlefield[data-s="2"] { --bf-bg: url("../grafika/tla/sektor-3.svg"); }
.battlefield[data-s="3"] { --bf-bg: url("../grafika/tla/sektor-4.svg"); }
.battlefield[data-s="4"] { --bf-bg: url("../grafika/tla/sektor-5.svg"); }
.battlefield.is-entering { animation: m-enter var(--dur-base) var(--ease-out) both; }
.battlefield.is-shake { animation: m-shake-short 150ms linear 1; }
/* siatka 2x2: dwie postacie naszej strony po lewej, dwie przeciwnej po prawej; wszystkie tego samego rozmiaru (--fd-h) */
.bf-grid {
  /* rozmiar postaci z wysokości pola (cqh): dwa rzędy z plakietką i pierścieniem (--fd-ov) mieszczą się zawsze, na wysokim ekranie rośnie do --fd-cap */
  --fd-h: clamp(32px, var(--fd-cap), 140px); --fd-h: clamp(32px, min(50cqh - 6px - var(--fd-ov), var(--fd-cap)), 140px);
  --sup-h: calc(var(--fd-h) * .5); --sup-row: calc(var(--sup-h) + 30px);
  position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 1fr; padding: 4px 2px 8px; }
.battlefield:has(.bf-sup) .bf-grid { --fd-h: clamp(32px, min(40cqh - 17px - .8 * var(--fd-ov), var(--fd-cap)), 140px); }
.bf-col { display: flex; flex-direction: column; justify-content: space-between; align-items: stretch; min-width: 0; }
.fd { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0 4px; }
.fd-plaque {
  position: relative; z-index: 2; display: flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 10px 3px 6px; border-radius: 999px;
  background: rgba(15,23,32,.84); border: 1px solid var(--color-line);
}
.fd--a .fd-plaque, .fd--b .fd-plaque { border-color: var(--color-line); }
/* znak strony w plakietce (nie tylko kolor): A = trójkąt, B = romb */
.fd-plaque::before { content: ""; flex: none; width: 9px; height: 9px; background: var(--color-text-3); }
.fd--a .fd-plaque::before { background: var(--color-side-a); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.fd--b .fd-plaque::before { background: var(--color-side-b); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.fd--sup .fd-plaque::before { margin-right: 3px; }
.fd-text { display: block; min-width: 0; line-height: 1.1; text-align: left; }
.fd .nm { display: block; max-width: 86px; font-weight: 600; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd .sm { display: block; font-size: 12px; color: var(--color-text-2); font-variant-numeric: tabular-nums; }
.fd.you .nm { color: var(--color-gold); }
.fd-art { position: relative; z-index: 1; display: block; flex: none; overflow: hidden; height: var(--fd-h); width: calc(var(--fd-h) * .66); }
.fd-art svg, .fd-art img { display: block; width: 100%; height: 100%; max-width: none; object-fit: contain; object-position: 50% 100%; } /* rozmiar daje kontener, nie naturalny rozmiar SVG */
.fd--b .fd-art { transform: scaleX(-1); } /* postacie obu stron patrzą na siebie */
.fd-base { position: absolute; z-index: 0; left: 50%; bottom: -5px; width: 76px; height: 20px; margin-left: -38px; border-radius: 50%; border: 2px solid var(--color-side-a); } /* pierścień pod stopami: kolor strony, własna postać pomarańczowa */
.fd--b .fd-base { border-color: var(--color-side-b); }
.fd.you .fd-base { width: 88px; height: 24px; margin-left: -44px; bottom: -7px; border-color: var(--color-accent); background: color-mix(in srgb, var(--color-accent) 18%, transparent); }
.fd-flash { position: absolute; inset: 30px 14px 0; z-index: 3; pointer-events: none; opacity: 0; border-radius: 50%; border: 2px solid var(--color-result-crit); } /* trafienie: znika sam obrys (bez wypełnienia i poświaty) */
.fd.is-hit .fd-flash { animation: m-flash 360ms ease-out 1; }
.fd.is-hit.is-strong .fd-flash { border-color: var(--color-gold); animation-duration: 520ms; }
.fd.is-hl .fd-flash { opacity: .7; }
.fd::after { content: ""; position: absolute; left: 50%; top: 52%; width: 34px; height: 34px; margin-left: -17px; z-index: 4; pointer-events: none; opacity: 0; background: var(--color-warning); clip-path: polygon(40% 0, 55% 30%, 100% 20%, 60% 55%, 80% 100%, 35% 65%, 0 85%, 30% 45%); }
.fd.is-crack::after { animation: m-crack 900ms ease-out 1; }
.fd.is-armor .fd-base { animation: m-pop 520ms var(--ease-pop) 1; }
.fd-fx { left: 0; right: 0; top: 40px; z-index: 5; }
.fd-fx .hit-float { left: 50%; margin-left: -22px; font-size: 18px; color: var(--color-text-1); }
.fd-fx .hit-float.strong { color: var(--color-warning); font-size: 22px; }
.fd-help { position: absolute; z-index: 5; right: 6px; top: 34px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--color-bg-0); border: 2px solid var(--color-accent); animation: m-rise 240ms var(--ease-out) both; }
.fd-help .ic { width: 16px; height: 16px; }
/* wspierający (nie bronią sektora): pionowa kolumna przy zewnętrznej krawędzi pola (A z lewej, B z prawej), mniejsi od obrońców.
   Obrońcy mają obok wolne miejsce (padding kolumny), więc rząd nigdy nie nachodzi na dolnego obrońcę. Nazwa w `title`/aria, w plakietce znak strony i wkład. */
.bf-col { position: relative; }
.battlefield:has(.bf-sup) .bf-col { padding-bottom: var(--sup-row); }
.bf-sup { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; height: var(--sup-row); display: flex; flex-direction: row; align-items: flex-end; justify-content: flex-start; gap: 8px; padding: 0 8px 9px; pointer-events: none; }
.bf-col--b .bf-sup { justify-content: flex-end; }
.bf-sup .bf-idle { opacity: .55; }
.bf-sup .fd { --fd-h: var(--sup-h); width: auto; min-width: calc(var(--sup-h) * .66); flex: none; padding: 0; gap: 0; }
.fd--sup .fd-plaque { padding: 0 6px 0 5px; gap: 3px; }
.fd--sup .fd-plaque .avatar, .fd--sup .nm { display: none; }
.fd--sup .sm { font-size: 11px; }
.fd--sup.you .fd-plaque { border-color: var(--color-accent); }
.fd--sup .fd-base, .fd--sup.you .fd-base { width: calc(var(--sup-h) * .66 + 12px); height: 12px; margin-left: calc((var(--sup-h) * .66 + 12px) / -2); bottom: -3px; border-width: 1px; }
/* tryby z większą obsadą sektora (Potyczka 3 + 2, Starcie 10): obrońcy jako mniejsze postacie w siatce `--cols` x `--rows`, rozmiar z szerokości i wysokości pola */
.bf-crowd { flex: 1 1 0; min-height: 0; display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); align-content: center; justify-items: center; gap: 6px 2px; --crowd-h: clamp(24px, min((50cqw - 10px) / var(--cols, 3) / .75, (100cqh - 24px) / var(--rows, 1) - 26px), 110px); }
.bf-crowd .fd { --fd-h: var(--crowd-h); --sup-h: var(--crowd-h); width: auto; min-width: calc(var(--crowd-h) * .66); padding: 0; gap: 0; }
.bf-crowd .fd-plaque { padding: 0 6px 0 5px; gap: 3px; }
.bf-more { align-self: center; padding: 1px 5px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--color-text-1); background: var(--color-bg-1); border: 1px solid var(--color-outline); }
.bf-sup-label { display: none; position: absolute; z-index: 1; left: 50%; bottom: 10px; transform: translateX(-50%); font-size: 12px; line-height: 1; color: var(--color-text-2); }
.battlefield:has(.bf-sup) .bf-sup-label { display: block; }
.fd-help.is-shield { border-color: var(--color-result-armor); }
.fd-help.is-boost { border-color: var(--color-warning); }
.pools-box { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.pool-row { display: grid; grid-template-columns: auto 1fr 1fr; align-items: center; gap: 8px; font-size: 12px; color: var(--color-text-2); }
.pool { display: flex; align-items: center; gap: 5px; min-width: 0; }
.pool .ic { width: 16px; height: 16px; flex: none; }
.pool .bar { flex: 1; min-width: 24px; height: 8px; }
.pool b { font-weight: 600; color: var(--color-text-1); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* wiersze listy sektorów na mapie (te same obrońcy co na polu bitwy, w wersji tekstowej) */
.defs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 12px; }
.defcol { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.def { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 2px 4px 2px 2px; border-radius: var(--radius-s); }
.def.you { background: color-mix(in srgb, var(--color-accent) 12%, transparent); box-shadow: inset 3px 0 0 var(--color-accent); }
.def-text { display: block; min-width: 0; line-height: 1.15; }
.def .nm, .rost .nm, .rank-row .nm { display: block; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.def .sm, .rost .sm, .rank-row .sm { display: block; font-size: 12px; color: var(--color-text-2); font-variant-numeric: tabular-nums; }
.def.you .nm { color: var(--color-gold); }

/* ==========================================================================
   Kadr ataku krytycznego: jedna warstwa nad polem bitwy (wejście 120, uderzenie 400, liczby 250, wyjście 120 ms).
   Warianty: .cf--dropped (etap kamizelki spadł: pęknięcie, odpryski, zmiana ikony), .cf--gone (kamizelki nie było: mocny błysk),
   .cf--same (bez zmiany: samo uderzenie). Stany: is-in -> is-strike -> is-nums -> is-out; .is-static = plansza przed -> po.
   Czasy kadru to mechanika rytmu: bez zmian.
   ========================================================================== */
@keyframes m-shard { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); } }
.cf { --cf-h: clamp(56px, min(132px, 100cqh - 112px), 132px); position: absolute; inset: 0; z-index: 8; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr auto; gap: 4px; padding: 8px 8px 10px; cursor: pointer; opacity: 0; background: rgba(11,18,25,.97); transition: opacity 120ms linear; overflow: hidden; }
.cf[hidden] { display: none; }
.cf.is-in { opacity: 1; }
.cf.is-out { opacity: 0; }
.cf::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; background: color-mix(in srgb, var(--color-result-crit) 28%, transparent); }
.cf.is-strike::after { animation: m-flash 300ms ease-out 1; }
.cf--gone.is-strike::after { animation-duration: 560ms; background: color-mix(in srgb, var(--color-gold) 40%, transparent); }
.cf-me { display: flex; align-items: flex-end; justify-content: flex-start; min-width: 0; }
.cf-art { display: block; overflow: hidden; height: calc(var(--cf-h) - 8px); width: calc((var(--cf-h) - 8px) * .68); }
.cf-art svg, .cf-art img { display: block; width: 100%; height: 100%; max-width: none; object-fit: contain; object-position: 50% 100%; }
.cf-me .cf-art { transform: translateX(-24px); transition: transform 160ms var(--ease-out); }
.cf.is-in .cf-me .cf-art { transform: translateX(0); }
.cf.is-strike .cf-me .cf-art { transform: translateX(14px); }
.cf-target { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.cf-plaque { max-width: 100%; padding: 2px 10px; border-radius: 999px; background: rgba(15,23,32,.9); border: 1px solid var(--color-side-b); font-weight: 600; font-size: 12px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cf-art--target { height: var(--cf-h); width: calc(var(--cf-h) * .7); transform: scaleX(-1); }
.cf.is-strike .cf-art--target { animation: m-shake-short 250ms linear 1; }
.cf-vest { position: absolute; right: 0; top: 48px; z-index: 2; width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50%; background: var(--color-bg-0); border: 2px solid var(--color-result-armor); }
.cf-vest .ic { width: 38px; height: 38px; color: var(--color-result-armor); }
.cf-vest-a, .cf-vest-b { position: absolute; inset: 0; display: grid; place-items: center; transition: opacity 120ms linear, transform 160ms var(--ease-out); }
.cf-vest-b { opacity: 0; transform: scale(.7); }
.cf--dropped.is-strike .cf-vest-a { opacity: 0; transform: scale(1.35); }
.cf--dropped.is-strike .cf-vest-b { opacity: 1; transform: none; }
.cf--dropped .cf-vest-b .ic { color: var(--color-warning); }
.cf--gone .cf-vest { border-color: var(--color-text-3); border-style: dashed; }
.cf--gone .cf-vest .ic { color: var(--color-text-3); opacity: .6; }
.cf--same.is-strike .cf-vest { animation: m-shake-short 250ms linear 1; }
.cf-shard { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; background: var(--color-warning); clip-path: polygon(0 0, 100% 40%, 40% 100%); opacity: 0; --dx: 0px; --dy: 0px; --rot: 0deg; }
.cf-s1 { --dx: -34px; --dy: -28px; --rot: -160deg; }
.cf-s2 { --dx: 36px; --dy: -22px; --rot: 140deg; }
.cf-s3 { --dx: -30px; --dy: 32px; --rot: 200deg; }
.cf-s4 { --dx: 34px; --dy: 30px; --rot: -120deg; }
.cf--dropped.is-strike .cf-shard { animation: m-shard 400ms ease-out 1 both; }
.cf-vest-name { max-width: 100%; margin-top: 0; font-family: var(--font-display); font-weight: 700; font-size: 13px; line-height: 1.15; text-align: center; color: var(--color-result-armor); }
.cf--dropped .cf-vest-name { color: var(--color-warning); }
.cf-nums { grid-column: 1 / -1; display: flex; justify-content: center; gap: 18px; opacity: 0; transform: translateY(8px); transition: opacity 120ms linear, transform 160ms var(--ease-out); }
.cf.is-nums .cf-nums { opacity: 1; transform: none; }
.cf-num { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.cf-num b { font-family: var(--font-display); font-weight: 700; font-size: 24px; font-variant-numeric: tabular-nums; }
.cf-num > span { font-size: 13px; color: var(--color-text-1); }
.cf-num[hidden] { display: none; }
.cf-num--dealt b { color: var(--color-result-crit); font-size: 30px; }
/* wariant bez ruchu: nieruchoma plansza przed -> po */
.cf.is-static .cf-vest { width: auto; padding: 0 8px; gap: 6px; border-radius: 999px; grid-auto-flow: column; }
.cf.is-static .cf-vest-a, .cf.is-static .cf-vest-b { position: static; opacity: 1; transform: none; }
.cf.is-static:not(.cf--dropped) .cf-vest-b { display: none; }
.cf.is-static.cf--dropped .cf-vest-a::after { content: "→"; margin-left: 6px; font-weight: 800; color: var(--color-warning); }

/* ==========================================================================
   Plansza prezentu (.gb): warstwa nad polem bitwy, buduje ją prezent-plansza.js (nie okno przeglądarki).
   Wybór, co dać wskazanej postaci: odbiorca (.gb-who), trzy duże przyciski (.gb-opt--ammo/--xp/--cash), odliczanie (.gb-count),
   potwierdzenie (.gb-done). Stany: .is-in (wejście), .is-busy (wysyłanie), .is-done (potwierdzenie), .is-super (Super prezent ×10).
   Animowane tylko opacity i transform; przy ruchu ograniczonym brak przejść (gra.css).
   ========================================================================== */
.gb { position: absolute; inset: 0; z-index: 9; display: flex; padding: var(--space-2); border-radius: var(--radius-l); background: var(--color-bg-1); opacity: 0; transform: translateY(8px); transition: opacity var(--dur-fast) linear, transform var(--dur-base) var(--ease-out); }
.gb[hidden] { display: none; }
.gb.is-in { opacity: 1; transform: none; }
.gb.is-super { box-shadow: inset 0 0 0 2px var(--color-gold); }
.gb-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: var(--space-3); overflow-y: auto; }
.gb-who { display: flex; align-items: center; gap: var(--space-3); }
.gb-art { flex: none; display: block; width: 44px; height: 64px; overflow: hidden; }
.gb-art[hidden] { display: none; }
.gb-art svg, .gb-art img { display: block; width: 100%; height: 100%; max-width: none; object-fit: contain; object-position: 50% 100%; }
.gb-text { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.gb-super { margin: 0; padding: 1px var(--space-2); border-radius: var(--radius-pill); background: var(--color-gold); color: var(--color-on-accent); font-family: var(--font-display); font-weight: 700; font-size: var(--fs-label); letter-spacing: .04em; text-transform: uppercase; }
.gb-super[hidden], .gb-plaque[hidden], .gb-note[hidden] { display: none; }
.gb-title { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-heading); line-height: 1.15; overflow-wrap: anywhere; }
.gb-plaque { max-width: 100%; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-body); color: var(--color-text-1); overflow-wrap: anywhere; }
.gb-note { margin: 0; font-size: var(--fs-small); line-height: 1.25; color: var(--color-warning); }
.gb-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.gb-opt { min-height: 92px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 4px; border-radius: var(--radius-m); border: 1px solid var(--color-outline); background: var(--color-bg-2); color: var(--color-text-1); font: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.gb-opt .gb-ic { width: 26px; height: 26px; }
.gb-opt--ammo .gb-ic { color: var(--color-ammo); }
.gb-opt--xp .gb-ic { color: var(--color-xp); }
.gb-opt--cash .gb-ic { color: var(--color-cash); }
.gb-num { font-family: var(--font-mono); font-size: var(--fs-num-m); line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.gb-name { font-size: var(--fs-label); line-height: 1.1; color: var(--color-text-2); }
.gb-opt:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.gb-opt[aria-disabled="true"] { opacity: .5; cursor: default; }
.gb-opt.is-picked { opacity: 1; border-color: var(--color-accent); }
.gb-count { margin: 0; min-height: 1.3em; text-align: center; font-size: var(--fs-small); line-height: 1.3; color: var(--color-text-2); }
.gb-done { display: none; margin: 0; }
.gb.is-done .gb-opts, .gb.is-done .gb-count { display: none; }
.gb.is-done .gb-done { flex: 1; display: flex; align-items: center; justify-content: center; gap: var(--space-2); text-align: center; font-weight: 700; font-size: var(--fs-heading); line-height: 1.2; color: var(--color-text-1); }
.gb-done-ic { flex: none; width: 28px; height: 28px; color: var(--color-success); }
.toast--super { border-color: var(--color-gold); }

/* ==========================================================================
   Pola odczytu terminala: trzy pola tuż nad przyciskiem akcji, napis wyniku wjeżdża nad nie, pod spodem jedno zdanie
   Stany (klasy na .rd, ustawia app.js wg harmonogramu z walka.js): is-noise -> is-hold -> is-merge -> is-result -> is-fade
   Wynik zawsze: kolor + symbol + nazwa (kolor sam nie niesie znaczenia). Płasko: bez poświat, bez linii skanowania.
   ========================================================================== */
.readout { position: relative; display: flex; flex-direction: column; gap: 4px; font-family: var(--font-body); font-variant-numeric: tabular-nums; }
.rd { position: relative; height: clamp(56px, 7.4dvh, 92px); --rc: var(--color-text-3); }
.rd.tone-idle { --rc: var(--color-text-2); }
.rd.tone-attack { --rc: var(--color-result-attack); }
.rd.tone-crit { --rc: var(--color-result-crit); }
.rd.tone-bigReward { --rc: var(--color-result-big); }
.rd.tone-smallReward { --rc: var(--color-result-small); }
.rd.tone-ammoRefund { --rc: var(--color-result-ammo); }
.rd.tone-armorRepair { --rc: var(--color-result-armor); }
.rd.tone-gift { --rc: var(--color-result-gift); }
.rd.tone-empty { --rc: var(--color-result-empty); }
.rd.tone-warn { --rc: var(--color-warning); }
.rd.tone-error { --rc: var(--color-error); }
.rd-fields { position: absolute; inset: 0 0 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; max-width: 380px; margin: 0 auto; }
.rd-field {
  position: relative; overflow: hidden; border-radius: var(--radius-xl); opacity: .9;
  background: var(--color-bg-2); border: var(--stroke-thin) solid var(--color-outline);
  transition: transform 180ms var(--ease-out), opacity 180ms var(--ease-out);
}
.rd-sym { position: absolute; inset: 10px; display: grid; place-items: center; opacity: 0; color: var(--rc); }
.rd-sym svg { display: block; width: 100%; height: 100%; }
.rd-sym.is-on { opacity: 1; }
.rd.is-noise .rd-field, .rd.is-hold .rd-field, .rd.is-merge .rd-field { opacity: 1; }
.rd.is-noise .rd-field:not(.is-stopped) .rd-sym.is-on { animation: m-jitter 80ms linear infinite alternate; }
.rd-field.is-stopped { border-color: var(--rc); animation: m-field-stop 160ms var(--ease-pop) 1; }
.rd.is-dim .rd-field { opacity: .45; }
/* zsunięcie trzech pól w jedno na środku (przesunięcie `--shift` liczy app.js z układu pól) */
.rd.is-merge .rd-field:nth-child(1) { transform: translateX(var(--shift, 0px)) scale(.82); opacity: .35; }
.rd.is-merge .rd-field:nth-child(3) { transform: translateX(calc(var(--shift, 0px) * -1)) scale(.82); opacity: .35; }
.rd.is-merge .rd-field:nth-child(2) { transform: scale(1.04); }
.rd.is-result .rd-field { opacity: .12; }
.rd.is-fade .rd-field { opacity: .9; }
.rd-result {
  position: absolute; inset: 4px 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: min(100%, 380px); margin: 0 auto;
  border-radius: var(--radius-l); text-align: center; pointer-events: none; opacity: 0; transform: translateY(14px) scale(.94);
  background: color-mix(in srgb, var(--rc) 12%, var(--color-bg-1)); border: 1px solid var(--rc);
  transition: opacity 180ms var(--ease-out), transform 220ms var(--ease-pop);
}
.rd.is-result .rd-result { opacity: 1; transform: none; }
.rd.is-fade .rd-result { opacity: 0; transform: none; transition-duration: 260ms, 260ms; }
.rd-label { max-width: 100%; font-family: var(--font-display); font-weight: 800; font-size: 22px; line-height: 1.05; letter-spacing: -.02em; color: var(--rc); overflow-wrap: anywhere; }
.rd.tone-crit .rd-label, .rd.tone-bigReward .rd-label { font-size: 28px; }
.rd.tone-crit .rd-result, .rd.tone-bigReward .rd-result { border-width: 2px; background: color-mix(in srgb, var(--rc) 18%, var(--color-bg-1)); }
.rd.tone-gift.is-super .rd-label { font-size: 28px; }
.rd.tone-gift.is-super .rd-result { border-width: 2px; background: color-mix(in srgb, var(--rc) 18%, var(--color-bg-1)); }
.rd-value { min-height: 1.2em; font-size: 19px; font-weight: 600; line-height: 1.1; color: var(--color-text-1); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.rd-value .res-cash { color: var(--color-cash); }
.rd-value .res-xp { color: var(--color-xp); }
.rd-series { position: absolute; right: 8px; top: 5px; font-family: var(--font-display); font-weight: 700; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--color-text-1); }
.rd-series:empty { display: none; }
/* znaczniki sprzętu przy wyniku (SERIA!, zwrot ammo): lewy górny róg, wjazd tylko transform/opacity */
.rd-gear { position: absolute; left: 8px; top: 5px; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; font-family: var(--font-display); font-weight: 800; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--color-accent); }
.rd-gear:empty { display: none; }
.rd-gear-tag { animation: m-pop 420ms var(--ease-pop) 1; }
.rd-msg { min-height: 2.5em; margin: 0; padding: 0 4px; text-align: center; font-family: var(--font-body); font-size: 13px; line-height: 1.3; color: var(--color-text-2); overflow-wrap: anywhere; }
/* podpis ostatniego wyniku (makieta „Atak · 120 obrażeń”): nazwa neutralnie, wartość w kolorze akcentu */
.rd-msg.is-caption { color: var(--color-text-1); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-msg.is-caption .rd-cap-label, .rd-msg.is-caption .rd-cap-val { font-size: 17px; }
.rd-cap-sep { color: var(--color-text-3); }
.rd-cap-val { color: var(--color-accent); }
.sheet-xp { display: flex; align-items: center; gap: 6px; margin: 0; font-size: var(--fs-small); color: var(--color-text-1); font-variant-numeric: tabular-nums; }
.sheet-xp .ic { width: 18px; height: 18px; flex: none; }
.rd.tone-warn + .rd-msg, .rd.tone-error + .rd-msg { color: var(--color-warning); font-weight: 600; }
.rd.tone-error + .rd-msg { color: var(--color-error); }
.term-forced { margin: 0; font-family: var(--font-body); font-size: 12px; text-align: center; color: var(--color-warning); }

/* ==========================================================================
   Strefa kciuka: wyjście po lewej, duży przycisk akcji, stawka po prawej; pod spodem przełącznik pięciu sektorów
   ========================================================================== */
.actionbar {
  flex: none; display: flex; flex-direction: column; gap: 8px; padding: 8px 12px calc(6px + env(safe-area-inset-bottom));
  background: var(--color-bg-1); border-top: 1px solid var(--color-outline);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
.actionbar button { touch-action: manipulation; }
.action-row { display: flex; gap: 10px; align-items: center; }
.action-row .btn-round { flex: none; width: 56px; height: 72px; margin: 0; border-radius: var(--radius-l); }
.actionbar.is-observer .action-row { justify-content: flex-start; }
.mult { flex: none; width: 72px; min-height: 72px; flex-direction: column; gap: 2px; padding: 0; }
.mult .num { font-size: 28px; line-height: 1; }
.mult .cost { display: inline-flex; align-items: center; gap: 3px; font-family: var(--font-body); font-weight: 600; font-size: 12px; letter-spacing: 0; color: var(--color-ammo); }
.mult .cost .ic { width: 14px; height: 14px; }
.mult.is-short .cost { color: var(--color-error); }
.mult.is-locked::after { content: ""; position: absolute; right: 6px; top: 6px; width: 14px; height: 14px; background: var(--color-text-2); clip-path: polygon(20% 40%, 20% 100%, 80% 100%, 80% 40%, 70% 40%, 70% 22%, 50% 0, 30% 22%, 30% 40%); }
.act-btn { flex: 1; min-width: 0; min-height: 72px; overflow: hidden; padding: 0 6px; font-size: 21px; letter-spacing: -.01em; }
.act-btn .btn-stack { position: relative; z-index: 1; }
.act-btn .btn-sub { font-size: 12px; opacity: .9; }
.act-btn:not(.ready) { --btn-bg: var(--color-bg-2); --btn-bg-pressed: var(--color-bg-2); --btn-ink: var(--color-text-2); --btn-line: var(--color-line); cursor: not-allowed; transform: none; }
.act-btn .act-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--color-accent); transform-origin: 0 50%; transform: scaleX(0); transition: transform 100ms linear; }
.act-btn[data-mode="ready"] .act-fill { opacity: 0; }
.act-btn .act-hold { position: absolute; inset: 0; background: rgba(15,23,32,.22); transform-origin: 0 50%; transform: scaleX(0); }
.act-btn:not(.ready) .act-hold { background: color-mix(in srgb, var(--color-accent) 28%, transparent); }
.act-btn.holding { box-shadow: inset 0 0 0 2px var(--color-text-1); }
/* seria trwa: etykieta „Stop”, kolor ostrzegawczy */
.act-btn.is-auto { --btn-bg: var(--color-warning); --btn-bg-pressed: #D8AC45; --btn-ink: var(--color-on-accent); --btn-line: transparent; }
.act-btn.is-auto .act-fill { background: var(--color-on-accent); }
/* przycisk serii dla klawiatury: widoczny dopiero po fokusie */
.auto-kbd:not(:focus):not(:focus-visible) { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.auto-kbd { align-self: center; min-height: 44px; }
@media (max-height: 820px) { .battlefield { --fd-cap: 10dvh; } .rd { height: clamp(52px, 6.6dvh, 92px); } .sec { min-height: 46px; } }
@media (max-width: 380px) { .act-btn { font-size: 18px; } .mult { width: 64px; } .action-row .btn-round { width: 48px; } }

/* przełącznik pięciu sektorów (znaczniki: punkty, stan, kto prowadzi, mój sektor) */
.secstrip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; } /* tyle kolumn, ile sektorów w trybie (5, 2 albo 1) */
.sec {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; padding: 5px 2px 6px; cursor: pointer;
  border-radius: var(--radius-m); background: var(--color-bg-2); border: var(--stroke-thin) solid var(--color-outline); color: var(--color-text-1);
  transition: background-color var(--dur-fast) var(--ease-out);
}
.sec .n { font-family: var(--font-display); font-weight: 800; font-size: 16px; line-height: 1; font-variant-numeric: tabular-nums; }
.sec .pts { display: inline-flex; align-items: center; gap: 2px; font-family: var(--font-display); font-weight: 600; font-size: 12px; color: var(--color-text-2); font-variant-numeric: tabular-nums; }
.sec .pts .ic { width: 12px; height: 12px; color: var(--color-warning); }
.sec .ratio { width: calc(100% - 8px); }
.sec.is-selected { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-on-accent); }
.sec.is-selected .pts { color: var(--color-on-accent); }
.sec.is-selected .pts .ic { color: var(--color-on-accent); }
.sec.is-closed { cursor: default; background: var(--color-bg-0); }
.sec.is-closed .n, .sec.is-closed .pts { color: var(--color-text-2); }
.sec.is-closed.is-selected { background: var(--color-bg-3); border-color: var(--color-text-2); color: var(--color-text-1); }
.sec .lead, .sec .flag { position: absolute; top: -6px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; background: var(--color-bg-0); border: 1px solid var(--color-outline); }
.sec .lead { right: -4px; }
.sec .flag { left: -4px; color: var(--color-text-1); }
.sec .lead .ic, .sec .flag .ic { width: 11px; height: 11px; }
.sec.is-closing, .mk.is-closing { animation: m-closing 420ms var(--ease-pop) 1; }

/* baner zdarzeń: zamknięcie sektora, dogrywka, start i koniec walki */
.m-banner {
  position: absolute; left: 16px; right: 16px; top: min(246px, 30%); z-index: 15; display: flex; flex-direction: column; align-items: center; gap: 0; padding: 5px 12px;
  text-align: center; border-radius: var(--radius-l); pointer-events: none; opacity: 0; transform: translateY(-12px);
  background: var(--color-bg-1); border: 1px solid var(--color-accent); box-shadow: var(--shadow-float);
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.m-banner.is-on { opacity: 1; transform: none; }
.m-banner .t-heading { letter-spacing: -.005em; }
.m-banner.is-a { border-color: var(--color-side-a); }
.m-banner.is-b { border-color: var(--color-side-b); }
.m-banner.is-ot { border-color: var(--color-warning); }
.m-banner .t-small { color: var(--color-text-1); }

/* panel „i” (arkusz od dołu): historia, ranking meczu, panel testowy */
.m-sheet { position: absolute; inset: 0; z-index: 30; }
.m-sheet .scrim { animation: ui-scrim var(--dur-fast) var(--ease-out) both; }
.m-sheet .sheet { max-height: 88%; overflow-y: auto; animation: ui-sheet var(--dur-base) var(--ease-out) both; padding-bottom: calc(env(safe-area-inset-bottom) + 16px); }
.m-sheet .sheet-head { align-items: center; }
.m-sheet .tab-btn { cursor: pointer; }
.pane { display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .btn { width: auto; flex: 1 1 auto; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; gap: 8px; padding: 7px 4px; border-top: 1px solid var(--color-line); font-size: 14px; }
.history li:first-child { border-top: 0; }
.history .t { flex: none; width: 3.2rem; padding-top: 1px; font-family: var(--font-body); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--color-text-3); }
.history .x { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 400; }
.history li.mine { background: color-mix(in srgb, var(--color-accent) 12%, transparent); box-shadow: inset 3px 0 0 var(--color-accent); font-weight: 600; }
.history li.closed { box-shadow: inset 3px 0 0 var(--color-text-1); font-weight: 600; }
.history li.overtime { box-shadow: inset 3px 0 0 var(--color-warning); color: var(--color-warning); font-weight: 600; }
.history li.new { animation: m-enter var(--dur-base) var(--ease-out) both; }

/* ==========================================================================
   Mapa sektorów (makieta 11): plan z markerami i lista obrońców
   ========================================================================== */
.mapview { display: flex; flex-direction: column; gap: 10px; animation: ui-in-fade var(--dur-fast) var(--ease-out) both; }
.map-board { position: relative; width: 100%; aspect-ratio: 390 / 600; overflow: hidden; border-radius: var(--radius-l); border: var(--stroke-thin) solid var(--color-outline); background: linear-gradient(180deg, rgba(15,23,32,.72), rgba(15,23,32,.72)), url("../grafika/tla/mapa-sektorow.svg") center / 100% 100% no-repeat, var(--color-bg-2); }
.mk {
  position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; padding: 0; display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--color-text-1); background: var(--color-bg-0);
  border: 2px solid var(--color-accent); font-variant-numeric: tabular-nums;
}
.mk.is-selected { background: var(--color-accent); color: var(--color-on-accent); }
.mk.is-closed { cursor: default; border-color: var(--color-text-3); }
.mk-cap {
  position: absolute; top: 50%; width: 118px; display: flex; flex-direction: column; gap: 3px; padding: 4px 6px; border-radius: var(--radius-m); text-align: left;
  transform: translateY(-50%); background: rgba(15,23,32,.94); border: 1px solid var(--color-outline); color: var(--color-text-1); font-size: 12px; line-height: 1.15;
}
.mk--r .mk-cap { left: calc(100% + 6px); }
.mk--l .mk-cap { right: calc(100% + 6px); }
.mk-row { display: flex; align-items: center; justify-content: space-between; gap: 4px; font-family: var(--font-display); font-weight: 700; font-size: 13px; }
.mk-row .ic { width: 13px; height: 13px; color: var(--color-warning); }
.mk-time { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; }
.map-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.map-row {
  display: flex; flex-direction: column; gap: 8px; width: 100%; padding: 8px 10px 10px; text-align: left; cursor: pointer; border-radius: var(--radius-l); color: var(--color-text-1);
  background: var(--color-bg-1); border: var(--stroke-thin) solid var(--color-outline);
}
.map-row.is-selected { border-color: var(--color-accent); box-shadow: inset 0 0 0 1px var(--color-accent); }
.map-row.is-closed { background: var(--color-bg-0); cursor: default; }
.map-row .hd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.map-row .hd .grow { flex: 1; }
.map-row .sums-line { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.map-row .sums-line .num { font-size: 16px; }
.sector-no { flex: none; }

/* ==========================================================================
   Poczekalnia
   ========================================================================== */
.roster { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin: 8px 0; }
.roster h4 { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 12px; }
.roster h4.side-a { color: var(--color-side-a); }
.roster h4.side-b { color: var(--color-side-b); }
.roster h4 .ic { width: 18px; height: 18px; }
.roster-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rost { display: flex; align-items: center; gap: 8px; min-height: 42px; min-width: 0; padding: 3px 6px 3px 4px; border-radius: var(--radius-m); background: var(--color-bg-2); border: var(--stroke-thin) solid var(--color-outline); }
.rost.me { box-shadow: inset 3px 0 0 var(--color-accent); }
.rost.empty { background: transparent; border: 1px dashed var(--color-line); color: var(--color-text-3); }
.rost.empty .nm { font-weight: 500; }

/* ==========================================================================
   Wynik meczu (makieta 12)
   ========================================================================== */
.banner .t-label { color: var(--color-text-2); }
.banner .t-xl { margin: 6px 0 4px; }
.banner { animation: ui-pop 320ms var(--ease-pop) both; }
.banner .score-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 4px 0 2px; }
.banner .side-tag { font-size: 12px; min-width: 0; text-transform: none; letter-spacing: 0; }
.result-score { font-size: 34px; line-height: 1; white-space: nowrap; }
.banner-note { margin: 2px 0 0; color: var(--color-text-2); }
.levelup { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px 12px; border-radius: var(--radius-l); background: var(--color-bg-1); border: 1px solid var(--color-accent); animation: ui-pop 320ms var(--ease-pop) both; }
.lu-soldier { flex: none; width: 54px; height: 80px; }
.lu-soldier svg, .lu-soldier img { height: 100%; width: auto; }
.lu-text { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -.01em; color: var(--color-accent); }
.res-head { display: block; margin: 0 0 6px 2px; }
.sec-res { animation: m-rise var(--dur-slow) var(--ease-pop) both; animation-delay: calc(var(--i, 0) * 70ms); }
.sec-res .ic { width: 24px; height: 24px; }
.sec-res .p { font-size: 14px; color: var(--color-text-3); }
.sec-res.won .p { color: var(--color-gold); }
.sec-res .sum { font-family: var(--font-display); font-weight: 600; font-size: 12px; line-height: 1.1; font-variant-numeric: tabular-nums; }
#result-me { grid-template-columns: 1fr 1fr; margin-top: 8px; }
.stat--wide { grid-column: 1 / -1; }
#result-me .stat .num { font-size: 24px; }
.rank-list { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rank-row { display: grid; grid-template-columns: 30px 32px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 46px; padding: 3px 8px 3px 4px; border-radius: var(--radius-m); background: var(--color-bg-2); border: var(--stroke-thin) solid var(--color-outline); }
.rank-list:not(.is-all) .rank-row.is-extra { display: none; }
.rank-row .rk { justify-self: center; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-family: var(--font-display); font-weight: 700; font-size: 13px; background: var(--color-bg-3); font-variant-numeric: tabular-nums; }
.rank-row.r1 { border-color: var(--color-gold); }
.rank-row.r2 { border-color: #C8D3CC; }
.rank-row.r3 { border-color: #B98760; }
.rank-row.r1 .rk { background: var(--color-gold); color: var(--color-on-accent); }
.rank-row.r2 .rk { background: #C8D3CC; color: var(--color-on-accent); }
.rank-row.r3 .rk { background: #B98760; color: var(--color-on-accent); }
.rank-row.mine { box-shadow: inset 3px 0 0 var(--color-accent); }
.rank-row.mine .nm { color: var(--color-gold); }
.rank-row .num { font-size: 16px; text-align: right; }
.result-actions .hint { text-align: center; }
.rank-toggle { margin: 0 auto; }

/* ==========================================================================
   Niski ekran (paski przeglądarki zostawiają 600-720 px): strefy stałe zagęszczone, pole bitwy bierze resztę.
   Cele dotykowe zostają >= 44 px, przycisk akcji w całości nad krawędzią.
   ========================================================================== */
@media (max-height: 720px) {
  .m-res { min-height: 48px; padding-top: 2px; padding-bottom: 2px; }
  .m-bar { padding-bottom: 3px; }
  .sidesbar { gap: 1px 6px; padding: 3px 4px 4px; }
  .sb-side { display: grid; grid-template-columns: auto auto; justify-content: start; align-items: center; gap: 0 6px; }
  .sb-b { justify-content: end; }
  .sb-name { grid-column: 1 / -1; }
  .sb-score { margin-top: 0; }
  .sb-pts { width: 48px; height: 48px; }
  .sb-pts::before { inset: 6px; }
  .sb-pts .num { font-size: 20px; }
  .sb-ratio { height: 10px; margin-top: 0; }
  .sb-dmg .num { font-size: 20px; }
  .battle { gap: 3px; }
  .sector-line { flex-wrap: nowrap; min-height: 22px; gap: 2px 6px; }
  .sector-line .t-heading { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
  .sector-line .tag { flex: none; height: 18px; padding: 0 5px; font-size: 9px; }
  .sector-line .tag .ic { display: none; }
  .sector-line .timer { flex: none; font-size: 12px; gap: 3px; }
  .sector-line .timer .ic { width: 14px; height: 14px; }
  .battlefield { --fd-ov: 39px; }
  .fd-plaque { padding: 1px 8px 1px 4px; }
  .fd-plaque .avatar { width: 26px; height: 26px; }
  .fd-plaque .avatar .lv { right: -5px; bottom: -5px; min-width: 18px; height: 16px; font-size: 10px; line-height: 14px; }
  .fd .nm, .fd .sm { font-size: 11px; }
  .rd { height: 46px; }
  .rd-result { inset: 2px 0; }
  .rd-label { font-size: 18px; }
  .rd.tone-crit .rd-label, .rd.tone-bigReward .rd-label, .rd.tone-gift.is-super .rd-label { font-size: 22px; }
  .rd-value { font-size: 15px; }
  .rd-msg { min-height: 0; height: 1.3em; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rd-msg.is-caption .rd-cap-label, .rd-msg.is-caption .rd-cap-val { font-size: 14px; }
  .readout { gap: 2px; }
  .actionbar { gap: 6px; padding: 6px 12px calc(4px + env(safe-area-inset-bottom)); }
  .action-row .btn-round { height: 56px; }
  .mult { min-height: 56px; }
  .mult .num { font-size: 24px; }
  .act-btn { min-height: 56px; font-size: 19px; }
  .sec { min-height: 44px; padding: 3px 2px 4px; }
  .m-banner { top: 190px; }
  .map-board { aspect-ratio: auto; height: calc(100dvh - 250px); min-height: 220px; } /* mapa: znaczniki w procentach, plan skaluje się do wolnej wysokości, lista sektorów pod spodem */
  .cf { gap: 2px; padding: 4px 8px 6px; }
  .cf-num b { font-size: 20px; }
  .cf-num--dealt b { font-size: 24px; }
  .cf-num > span { font-size: 11px; }
  .cf-vest { top: 30px; width: 44px; height: 44px; }
  .cf-vest .ic { width: 28px; height: 28px; }
  .gb-panel { gap: var(--space-2); }
  .gb-art { width: 34px; height: 48px; }
  .gb-opt { min-height: 64px; }
  .gb-opt .gb-ic { width: 22px; height: 22px; }
}
@media (max-height: 720px) { .sector-line .tag--mine { font-size: 0; padding: 0 5px; } .sector-line .tag--mine .ic { display: block; } .sector-line .tag--ot { display: none; } } /* niski: „Twój sektor” tylko ikoną (tekst zostaje dla czytników); znacznik dogrywki pomijamy, bo zegar mówi to samo */
@media (max-height: 720px) and (max-width: 380px) { .sb-score-l { display: none; } .sb-side { gap: 0 4px; } } /* wąski i niski: w pigułce samo „mecz”-liczba, żeby obrażenia i pigułka mieściły się obok rombu */
@media (max-height: 640px) {
  .m-res { min-height: 44px; }
  .sb-pts { width: 44px; height: 44px; }
  .sb-pts::before { inset: 5px; }
  .sb-pts .num { font-size: 18px; }
  .sb-pts-l { font-size: 9px; }
  .battlefield { --fd-ov: 37px; }
  .fd-plaque .avatar { width: 24px; height: 24px; }
  .rd { height: 42px; }
  .rd-label { font-size: 16px; }
  .rd-value { font-size: 14px; }
  .actionbar { gap: 4px; padding-top: 4px; }
  .action-row .btn-round, .mult, .act-btn { min-height: 48px; height: 48px; }
  .mult .num { font-size: 22px; }
  .act-btn { font-size: 18px; }
  .m-banner { top: 170px; }
  .gb-opt { min-height: 56px; }
}

/* ==========================================================================
   Lekki wygląd walki („spokojny premium”, 16.11): mniejsza skala typografii, cienkie 1 px obrysy, pomarańcz tylko na przycisku akcji
   i aktywnym stanie, mniej ramek (grupowanie odstępem). Ten blok jest ostatni, żeby wygrywać z regułami niskiego ekranu wyżej;
   cele dotykowe zostają >= 44 px. Skala: tytuł 15-18, liczba wyniku 18, etykieta 11-12, przycisk akcji 17.
   ========================================================================== */
.m-res { min-height: 48px; }
.m-res .tb-stat { font-size: 15px; font-weight: 600; }
.m-xpbar { margin: 0 16px 2px; height: 4px; border: 0; }
.m-bar { gap: 6px; padding: 0 12px 4px; }
.m-bar .btn { min-width: 0; min-height: 44px; padding: 0 12px; font-size: 14px; font-weight: 600; gap: 6px; --btn-bg: color-mix(in srgb, var(--color-bg-1) 55%, transparent); --btn-line: transparent; }
.m-bar .btn .ic { width: 18px; height: 18px; }
.m-bar .btn-mute { min-width: 44px; width: 44px; }

.sidesbar { gap: 2px 8px; padding: 4px 4px 6px; border-top: 0; border-bottom: 0; }
.sb-side { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name score" "dmg dmg"; justify-content: stretch; align-items: center; gap: 0 6px; }
.sb-b { grid-template-areas: "score name" "dmg dmg"; grid-template-columns: auto minmax(0, 1fr); justify-content: stretch; }
.sb-name { grid-area: name; gap: 4px; }
.sb-b .sb-name { justify-content: flex-end; }
.sb-score { grid-area: score; margin: 0; padding: 0 6px; font-size: 11px; line-height: 18px; background: transparent; }
.sb-score .num { font-size: 12px; font-weight: 600; }
.sb-dmg { grid-area: dmg; min-width: 0; max-width: 100%; gap: 4px; overflow: hidden; }
.sb-b .sb-dmg { justify-self: end; }
.sb-name .side-mark, .sb-name .side-mark .ic { width: 14px; height: 14px; }
.sidesbar .side-name { font: 700 12px / 1.1 var(--font-display); letter-spacing: .06em; }
.sb-dmg .num { font-size: 18px; font-weight: 700; }
.sb-dmg .num { flex: none; }
.sb-dmg-l { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 11px; font-weight: 400; color: var(--color-text-3); }
.sb-score-l { display: none; } /* w pigułce sama liczba (opis dla czytników w .visually-hidden): nazwa strony nie ucina się */
.sb-pts { width: 44px; height: 44px; }
.sb-pts::before { inset: 6px; border-width: 1px; border-radius: 6px; }
.sb-pts .num { font-size: 16px; font-weight: 700; }
.sb-pts-l { font-size: 8px; letter-spacing: .04em; }
.sb-ratio { height: 6px; margin-top: 0; border-width: 0; }
.sb-ratio .a::after { width: 2px; right: -1px; }
.sector-line { min-height: 24px; flex-wrap: nowrap; }
.sector-line .t-heading { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 15px; font-weight: 600; }
.sector-line .tag { height: 18px; padding: 0 6px; font-size: 10px; font-weight: 600; }
.sector-line .tag .ic { display: none; }
.sector-line .timer { flex: none; font-size: 13px; font-weight: 600; }
.sector-line .timer .ic { width: 14px; height: 14px; }
.tag--mine { background: transparent; border-color: var(--color-accent); color: var(--color-text-1); }
.battle { gap: 4px; }
.battlefield { border-radius: var(--radius-m); border-color: color-mix(in srgb, var(--color-outline) 60%, transparent); }
.fd-plaque { padding: 1px 8px 1px 5px; border-color: transparent; }
.fd .nm, .fd .sm { font-size: 11px; }

.actionbar { gap: 6px; padding: 6px 12px calc(6px + env(safe-area-inset-bottom)); border-top-color: color-mix(in srgb, var(--color-outline) 60%, transparent); }
.action-row { gap: 8px; }
.action-row .btn-round { width: 48px; height: 56px; --btn-bg: transparent; }
.mult { width: 64px; min-height: 56px; gap: 0; --btn-bg: transparent; }
.mult .num { font-size: 20px; font-weight: 700; }
.mult .cost { font-size: 11px; }
.mult .cost .ic { width: 12px; height: 12px; }
.act-btn { min-height: 56px; font-size: 17px; font-weight: 700; }
.act-btn .btn-sub { font-size: 11px; font-weight: 400; }

.secstrip { gap: 4px; }
.sec { min-height: 44px; padding: 4px 2px 5px; gap: 2px; background: transparent; border-color: color-mix(in srgb, var(--color-outline) 70%, transparent); }
.sec .n { font-size: 14px; font-weight: 700; }
.sec .pts { font-size: 11px; font-weight: 500; }
.sec.is-selected { background: color-mix(in srgb, var(--color-accent) 14%, var(--color-bg-1)); border-color: var(--color-accent); color: var(--color-text-1); }
.sec.is-selected .pts, .sec.is-selected .pts .ic { color: var(--color-text-2); }
.sec.is-selected .pts .ic { color: var(--color-warning); }
.secstrip:has(.sec:only-child) .sec { flex-direction: row; justify-content: center; align-items: center; gap: 10px; min-height: 44px; padding: 2px 10px; }
.secstrip:has(.sec:only-child) .sec .ratio { width: 56px; flex: none; }
.sec .ratio { height: 4px; border-width: 0; }
.sec .lead, .sec .flag { top: -5px; width: 14px; height: 14px; }
@media (max-height: 820px) { .sec { min-height: 44px; } .secstrip:has(.sec:only-child) .sec { min-height: 44px; } }
@media (max-width: 380px) {
  .sidesbar .side-name { letter-spacing: .03em; }
  .act-btn { font-size: 16px; }
  .mult { width: 58px; }
  .action-row .btn-round { width: 44px; }
}
@media (max-height: 720px) {
  .sector-line .tag--mine { font-size: 0; padding: 0 5px; }
  .sector-line .tag--mine .ic { display: block; }
  .m-res { min-height: 44px; }
  .m-bar { padding-bottom: 2px; }
  .sidesbar { padding: 2px 4px 4px; }
  .act-btn, .mult, .action-row .btn-round { min-height: 52px; height: 52px; }
  .mult .num { font-size: 18px; }
  .act-btn { font-size: 16px; }
}
@media (max-height: 640px) {
  .sb-pts { width: 40px; height: 40px; }
  .sb-pts .num { font-size: 15px; }
  .act-btn, .mult, .action-row .btn-round { min-height: 48px; height: 48px; }
}
}
.sec.is-foreign, .mk.is-foreign, .map-row.is-foreign { cursor: not-allowed; opacity: 0.55; }
