/* Ринг: сцена файтинга. Пиксельная сцена 480×270 (на экране ×2 = 960×540 или во всю ширину), HUD в DOM (имена,
   HP-полосы в две равные колонки, шкала спеца, таймер, счёт раундов), на таче и в режиме телефона — полоска спеца 36 px и
   пэд 120 px (слева крестовина: внизу шаг ← →, над ним прыжок ↖ ↑ ↗, лёжа — один ряд ← ↑ →; справа сетка 2×2 из 56×56 — удар,
   кнут, блок, рывок). Цвета и шрифты — токены game.css (:root); имена,
   таймер, титры и заголовок итога — Press Start 2P (размеры кратны 8 — буквы без мыла), полосы плоские с жёсткой рамкой 2 px,
   как у аркадных автоматов. Все классы с префиксом fx-, чтобы не пересекаться с .board/.ring/.arena. */
.fx-scene { position: relative; display: grid; gap: 8px; width: 100%; max-width: var(--fx-w, 960px); margin: 0 auto; color: var(--text); font: 13px/1.3 var(--ui); user-select: none; -webkit-user-select: none; }
.fx-hud { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 4px 6px; align-items: start; }
.fx-side { display: grid; gap: 4px; min-width: 0; }
.fx-name { display: flex; align-items: baseline; gap: 6px; min-width: 0; font: 600 13px/1.2 var(--ui); white-space: nowrap; }
.fx-name b { overflow: hidden; text-overflow: ellipsis; font: 400 16px/1.25 "Press Start 2P", var(--ui); }
.fx-name small { color: var(--text-dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
/* значок 28 px выше строки ника: свешивается вниз к полосе здоровья — поверх неё, иначе полоса закрывает цифру подранга */
.fx-name .fx-rk { position: relative; z-index: 1; display: inline-flex; flex: none; align-self: center; margin: -7px 0; }
.fx-name .fx-rk:empty { display: none; }
.fx-name .fx-rk b { overflow: visible; font: 700 12px/1 var(--ui); }     /* цифра подранга — не пиксельным шрифтом ника */
.fx-name .fx-you { font: 600 10px/1 var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--soul); }
.fx-name .fx-off { font: 600 10px/1 var(--ui); letter-spacing: .08em; text-transform: uppercase; color: var(--danger); font-style: normal; }
.fx-b .fx-name { flex-direction: row-reverse; }
/* HP: латунная рамка 2 px, внутри тёмный зазор 2 px; пустая часть тёмно-красная, свежий урон — красный хвост, сходит ступенями */
.fx-hp { position: relative; box-sizing: border-box; height: 18px; background: #0b0d0a; border: 2px solid var(--brass); overflow: hidden; }
.fx-hp::before { content: ""; position: absolute; inset: 2px; background: #3a140f; }
.fx-hp i { position: absolute; inset: 2px; transform-origin: 0 50%; will-change: transform; }
.fx-b .fx-hp i { transform-origin: 100% 50%; }
.fx-hp .fx-ghost { background: var(--danger); transition: transform .45s steps(6, end) .25s; }
.fx-hp .fx-fill { background: var(--fx-col, var(--brass)); box-shadow: inset 0 2px 0 rgba(255,255,255,.35), inset 0 -2px 0 rgba(0,0,0,.28); }
.fx-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; height: 6px; }
.fx-b .fx-meter { direction: rtl; }
.fx-meter i { position: relative; background: #1c211a; box-shadow: inset 0 0 0 1px #0b0d0a; overflow: hidden; }
.fx-meter i::after { content: ""; position: absolute; inset: 0; background: var(--soul); transform: scaleX(var(--k, 0)); transform-origin: 0 50%; transition: transform .15s; }
.fx-b .fx-meter i::after { transform-origin: 100% 50%; }
.fx-meter.fx-full i::after { animation: fx-pulse .7s ease-in-out infinite; }
@keyframes fx-pulse { 50% { opacity: .45; } }
.fx-mid { display: grid; justify-items: center; align-content: start; gap: 4px; min-width: 0; }
.fx-clock { font: 400 24px/1 "Press Start 2P", var(--display); color: var(--brass-hi); text-shadow: 2px 2px 0 #0b0d0a; min-height: 24px; }
.fx-clock.fx-low { color: var(--danger); }
.fx-score { display: flex; gap: 10px; }
.fx-score span { display: flex; gap: 4px; }
.fx-score i { box-sizing: border-box; width: 10px; height: 10px; background: #1c211a; border: 2px solid var(--brass); }
.fx-score i.fx-won { background: var(--brass-hi); }
.fx-mid small { font-size: 11px; color: var(--text-dim); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.fx-mid small:empty { display: none; }
.fx-watch { grid-column: 1 / -1; text-align: center; font-size: 12px; color: var(--text-dim); }
.fx-watch:empty { display: none; }
.fx-view { position: relative; justify-self: center; max-width: 100%; line-height: 0; }
/* canvas уже увеличен скриптом в целое число раз без сглаживания; до размера на экране его ужимает браузер — со сглаживанием */
.fx-canvas { display: block; max-width: 100%; background: #07090a; image-rendering: auto; }
/* окно сцены с Рингом шире на 24 px: внутри помещается ровно 960 — целый масштаб ×2 */
@media (min-width: 601px) { dialog.stage:has(.fx-scene) { width: min(96vw, 1008px); } }
/* карточка исхода — в верхней трети арены, победная стойка внизу остаётся видна */
.fx-card { position: absolute; inset: 0; display: grid; place-items: start center; padding-top: 4%; background: linear-gradient(180deg, rgba(13,16,12,.6), rgba(13,16,12,0) 55%); line-height: 1.3; }
.fx-card > div { display: grid; gap: 6px; padding: 14px 24px; max-width: 90%; text-align: center; background: var(--surface-1); border: 2px solid var(--brass); box-shadow: 0 0 0 2px #0b0d0a, 0 12px 0 rgba(0,0,0,.35); }
.fx-card h3 { margin: 0; font: 400 24px/1.3 "Press Start 2P", var(--display); color: var(--brass-hi); text-shadow: 2px 2px 0 #0b0d0a; }
.fx-card.fx-won h3 { color: var(--soul); }
.fx-card.fx-lost h3 { color: var(--danger); }
.fx-card p { margin: 0; font-size: 14px; }
.fx-card small { color: var(--text-dim); }
.fx-keys { color: var(--text-dim); font-size: 12px; text-align: center; }
/* полоска спеца и пэд: только на таче и в режиме телефона, зрителю — никогда */
.fx-special { display: none; position: relative; align-items: center; justify-content: center; height: 36px; border: 0; padding: 0; overflow: hidden; background: rgba(0,0,0,.5); box-shadow: inset 0 0 0 1px var(--line-brass); color: var(--text-dim); font: 600 12px/1 var(--ui); letter-spacing: .14em; text-transform: uppercase; touch-action: none; -webkit-tap-highlight-color: transparent; cursor: pointer; }
.fx-special i { position: absolute; inset: 0; background: var(--soul); opacity: .3; transform: scaleX(0); transform-origin: 0 50%; transition: transform .15s; }
.fx-special span { position: relative; }
.fx-special.fx-ready { color: var(--on-soul, #0d2a22); }
.fx-special.fx-ready i { opacity: 1; animation: fx-pulse .7s ease-in-out infinite; }
.fx-special.fx-on i { opacity: 1; animation: none; background: var(--brass-hi); }
.fx-pad { display: none; justify-content: space-between; height: 120px; padding: 0 12px; touch-action: none; }
/* крестовина: шесть колонок по 24 — сверху три кнопки прыжка по 56, снизу шаг ← → по 88 (шаг жмут чаще всего — он шире) */
.fx-pad-l { display: grid; grid-template-columns: repeat(6, 24px); grid-template-rows: 56px 56px; gap: 8px; }
.fx-pad-r { display: grid; grid-template-columns: 56px 56px; grid-template-rows: 56px 56px; gap: 8px; }
.fx-pad button { width: 56px; height: 56px; padding: 0; border: 0; border-radius: var(--r-2, 4px); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-brass); color: var(--text); font: 600 11px/1 var(--ui); letter-spacing: .06em; text-transform: uppercase; touch-action: none; -webkit-tap-highlight-color: transparent; cursor: pointer; }
.fx-pad-l button { width: auto; font-size: 22px; }
.fx-pad-l [data-bit="129"] { grid-column: 1 / 3; }
.fx-pad-l [data-bit="128"] { grid-column: 3 / 5; }
.fx-pad-l [data-bit="130"] { grid-column: 5 / 7; }
.fx-pad-l [data-bit="1"] { grid-column: 1 / 4; grid-row: 2; }
.fx-pad-l [data-bit="2"] { grid-column: 4 / 7; grid-row: 2; }
.fx-pad .fx-up { display: grid; place-content: center; justify-items: center; gap: 3px; font-size: 20px; line-height: 1; }
.fx-pad .fx-up b { font: inherit; }
.fx-pad .fx-up small { font: 600 9px/1 var(--ui); letter-spacing: .06em; color: var(--text-dim); }
.fx-pad .fx-up.fx-on small { color: inherit; }
/* узкая сцена (fx-narrow — уже 400, fx-tiny — уже 330; ставит fit по ширине сцены, а не окна): крестовина уже, правая сетка
   на самой узкой — по 52; между группами остаётся зазор, палец со стрелки не наезжает на «блок» */
.fx-narrow .fx-pad { padding: 0 6px; }
.fx-narrow .fx-pad-l { grid-template-columns: repeat(6, 20px); gap: 8px 6px; }
.fx-tiny .fx-pad-r { grid-template-columns: 52px 52px; grid-template-rows: 56px 56px; gap: 8px 6px; }
.fx-tiny .fx-pad-r button { width: 52px; }
.fx-pad button.fx-on { background: var(--brass); color: var(--on-brass, #2a1d08); }
.fx-touch .fx-special, .fx-touch .fx-pad { display: flex; }
.fx-touch .fx-keys { display: none; }
.fx-spectator .fx-special, .fx-spectator .fx-pad, .fx-spectator .fx-keys { display: none !important; }
/* телефон (ширина < 700): canvas во всю ширину 16:9, под ним HUD, полоска спеца 36 и пэд 120; без горизонтальной прокрутки */
.fx-phone { gap: 6px; }
.fx-phone .fx-view { order: 1; }
.fx-phone .fx-hud { order: 2; }
.fx-phone .fx-special { order: 3; }
.fx-phone .fx-pad { order: 4; }
.fx-phone .fx-keys { order: 5; }
.fx-phone .fx-name { font-size: 12px; }
.fx-phone .fx-name b { font-size: 8px; line-height: 1.5; }
.fx-phone .fx-name small { display: none; }
.fx-phone .fx-name .fx-rk { margin: -3px 0; }                            /* строка ника узкая: значок почти целиком в ней */
.fx-phone .fx-name .fx-rk b { font-size: 12px; line-height: 1; }         /* не 8 px пиксельного ника: цифра подранга читается */
.fx-phone .fx-hp { height: 14px; }
.fx-phone .fx-clock { font-size: 16px; min-height: 16px; }
.fx-phone .fx-card { padding-top: 3%; }
.fx-phone .fx-card h3 { font-size: 16px; }
.fx-phone .fx-card > div { gap: 4px; padding: 8px 14px; }
/* окно партии на телефоне стоя — на весь экран: пэд прижат к низу, а не висит посередине с пустой третью под ним (как на /ring) */
.stage-body:has(> .fx-phone) { display: flex; flex-direction: column; }
.stage-body > .fx-scene.fx-phone { flex: 1 0 auto; display: flex; flex-direction: column; }
.stage-body > .fx-phone .fx-view { align-self: center; }
.stage-body > .fx-phone.fx-touch .fx-special { margin-top: auto; }
/* лёжа и низкое окно на таче (fx-land, ставит fit): HUD над холстом, пэд и полоса спеца — поверх нижних углов холста,
   полупрозрачные; холст по высоте окна — иначе пэд уходил за нижний край экрана */
.fx-scene.fx-land .fx-hud { order: 0; }
.fx-scene.fx-land .fx-view { order: 1; }
.fx-land .fx-pad { position: absolute; left: 0; right: 0; bottom: 6px; height: auto; padding: 0 6px; align-items: flex-end; pointer-events: none; z-index: 3; }
.fx-land .fx-pad > div { pointer-events: auto; }
/* лёжа крестовина в один ряд ← ↑ → (↑ при зажатой стрелке и так прыгает в её сторону): в два ряда она закрывала своего бойца */
.fx-land .fx-pad-l { grid-template-columns: repeat(3, 52px); grid-template-rows: 52px; gap: 6px; }
.fx-land .fx-pad-l [data-bit="129"], .fx-land .fx-pad-l [data-bit="130"] { display: none; }
.fx-land .fx-pad-l [data-bit="1"] { grid-column: 1; grid-row: 1; }
.fx-land .fx-pad-l [data-bit="128"] { grid-column: 2; grid-row: 1; }
.fx-land .fx-pad-l [data-bit="2"] { grid-column: 3; grid-row: 1; }
.fx-land .fx-pad-r { grid-template-columns: 52px 52px; grid-template-rows: 52px 52px; gap: 6px; }
.fx-land .fx-pad button { width: 52px; height: 52px; background: rgba(38,46,34,.6); }
.fx-land .fx-pad-l button { width: 52px; }
.fx-land .fx-pad button.fx-on { background: var(--brass); }
/* полоса спеца — в просвете между крестовиной (6 + 168) и правой сеткой (110 + 6), по центру просвета, надпись в одну строку */
.fx-land .fx-special { position: absolute; left: 182px; right: 124px; bottom: 8px; width: auto; min-width: 96px; max-width: 200px; height: 32px; margin: 0 auto; z-index: 3; white-space: nowrap; letter-spacing: .08em; }
.fx-land .fx-keys { display: none; }
/* лёжа с полями по бокам холста (fx-side; ширину поля --fx-mx и кнопку --fx-pb, 42..50, ставит fit): группы 2×2 — в полях окна
   сцены, холст открыт целиком; слева прыжок над шагом ← →, полоса спеца — над правой группой, шириной с неё */
.fx-side .fx-pad { left: calc(-1 * var(--fx-mx, 0px)); right: calc(-1 * var(--fx-mx, 0px)); padding: 0 4px; }
.fx-side .fx-pad-l, .fx-side .fx-pad-r { grid-template-columns: var(--fx-pb, 50px) var(--fx-pb, 50px); grid-template-rows: var(--fx-pb, 50px) var(--fx-pb, 50px); gap: 6px; }
.fx-side .fx-pad button, .fx-side .fx-pad-l button { width: var(--fx-pb, 50px); height: var(--fx-pb, 50px); background: var(--surface-2); }
.fx-side .fx-pad-l [data-bit="128"] { grid-column: 1 / 3; grid-row: 1; width: auto; }
.fx-side .fx-pad-l [data-bit="1"] { grid-column: 1; grid-row: 2; }
.fx-side .fx-pad-l [data-bit="2"] { grid-column: 2; grid-row: 2; }
.fx-side .fx-special { left: auto; right: calc(4px - var(--fx-mx, 0px)); bottom: calc(2 * var(--fx-pb, 50px) + 18px); width: calc(2 * var(--fx-pb, 50px) + 6px); min-width: 0; max-width: none; margin: 0; font-size: 10px; letter-spacing: .04em; }
/* прозрачная сцена для оверлея OBS (FX.mount с transparent / noHud): холст без подложки, HUD сцены не показывается */
.fx-clear .fx-canvas { background: transparent; }
.fx-nohud .fx-hud { display: none; }
@media (prefers-reduced-motion: reduce) {
  .fx-meter.fx-full i::after, .fx-special.fx-ready i { animation: none; }
  .fx-hp .fx-ghost { transition: none; }
}
